2 * Copyright (C) 2008 Pioneers of the Inevitable <songbird@songbirdnest.com>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
20 #ifndef __DSHOWVIDEOSINK_H__
21 #define __DSHOWVIDEOSINK_H__
24 #include <gst/video/video.h>
25 #include <gst/video/gstvideosink.h>
27 #include "dshowvideofakesrc.h"
36 #pragma warning( disable : 4090 4024)
39 #define GST_TYPE_DSHOWVIDEOSINK (gst_dshowvideosink_get_type())
40 #define GST_DSHOWVIDEOSINK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DSHOWVIDEOSINK,GstDshowVideoSink))
41 #define GST_DSHOWVIDEOSINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DSHOWVIDEOSINK,GstDshowVideoSinkClass))
42 #define GST_IS_DSHOWVIDEOSINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DSHOWVIDEOSINK))
43 #define GST_IS_DSHOWVIDEOSINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DSHOWVIDEOSINK))
44 typedef struct _GstDshowVideoSink GstDshowVideoSink;
45 typedef struct _GstDshowVideoSinkClass GstDshowVideoSinkClass;
47 #define GST_DSHOWVIDEOSINK_GRAPH_LOCK(sink) g_mutex_lock (&GST_DSHOWVIDEOSINK (sink)->graph_lock)
48 #define GST_DSHOWVIDEOSINK_GRAPH_UNLOCK(clock) g_mutex_unlock (&GST_DSHOWVIDEOSINK (sink)->graph_lock)
50 /* Renderer-specific support classes */
54 virtual ~RendererSupport() {};
55 virtual const char *GetName() = 0;
56 virtual IBaseFilter *GetFilter() = 0;
57 virtual gboolean Configure() = 0;
58 virtual gboolean SetRendererWindow(HWND window) = 0;
59 virtual void PaintWindow() = 0;
60 virtual void MoveWindow() = 0;
61 virtual void DestroyWindow() = 0;
62 virtual void DisplayModeChanged() = 0;
63 virtual void SetAspectRatioMode() = 0;
66 struct _GstDshowVideoSink
70 /* Preferred renderer to use: VM9 or VMR */
71 char *preferredrenderer;
73 /* The filter graph (DirectShow equivalent to pipeline */
74 IFilterGraph *filter_graph;
76 IMediaEventEx *filter_media_event;
78 /* Renderer wrapper (EVR, VMR9, or VMR) and support code */
79 RendererSupport *renderersupport;
81 /* Our fakesrc filter */
82 VideoFakeSrc *fakesrc;
84 /* DirectShow description of media type (equivalent of GstCaps) */
85 AM_MEDIA_TYPE mediatype;
87 gboolean keep_aspect_ratio;
90 /* If the window is closed, we set this and error out */
91 gboolean window_closed;
93 /* The video window set through GstXOverlay */
96 /* If we created the window, it needs to be closed in ::stop() */
97 gboolean is_new_window;
100 gboolean graph_running;
102 /* If we create our own window, we run it from another thread */
103 GThread *window_thread;
104 HANDLE window_created_signal;
106 /* If we use an app-supplied window, we need to hook its WNDPROC */
109 /* Lock for transitions */
112 gboolean comInitialized;
113 GMutex com_init_lock;
114 GMutex com_deinit_lock;
115 GCond com_initialized;
116 GCond com_uninitialize;
117 GCond com_uninitialized;
120 struct _GstDshowVideoSinkClass
122 GstVideoSinkClass parent_class;
125 GType gst_dshowvideosink_get_type (void);
128 #endif /* __DSHOWVIDEOSINK_H__ */