1 /* GStreamer
2  * Copyright (C)  2007 Sebastien Moutte <sebastien@moutte.net>
3  *
4  * gstdshowvideosrc.h:
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  */
21 
22 #ifndef __GST_DSHOWVIDEOSRC_H__
23 #define __GST_DSHOWVIDEOSRC_H__
24 
25 #include <glib.h>
26 #include <gst/gst.h>
27 #include <gst/base/gstpushsrc.h>
28 
29 #include "gstdshow.h"
30 #include "gstdshowfakesink.h"
31 
32 // 30323449-0000-0010-8000-00AA00389B71            MEDIASUBTYPE_I420
33 DEFINE_GUID (MEDIASUBTYPE_I420, 0x30323449, 0x0000, 0x0010, 0x80, 0x00, 0x00,
34 	0xAA, 0x00, 0x38, 0x9B, 0x71);
35 DEFINE_GUID (MEDIASUBTYPE_UYVY, 0x59565955, 0x0000, 0x0010, 0x80, 0x00, 0x00,
36     0xAA, 0x00, 0x38, 0x9B, 0x71);
37 
38 G_BEGIN_DECLS
39 #define GST_TYPE_DSHOWVIDEOSRC              (gst_dshowvideosrc_get_type())
40 #define GST_DSHOWVIDEOSRC(obj)              (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DSHOWVIDEOSRC,GstDshowVideoSrc))
41 #define GST_DSHOWVIDEOSRC_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DSHOWVIDEOSRC,GstDshowVideoSrcClass))
42 #define GST_IS_DSHOWVIDEOSRC(obj)           (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DSHOWVIDEOSRC))
43 #define GST_IS_DSHOWVIDEOSRC_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DSHOWVIDEOSRC))
44 typedef struct _GstDshowVideoSrc GstDshowVideoSrc;
45 typedef struct _GstDshowVideoSrcClass GstDshowVideoSrcClass;
46 
47 
48 struct _GstDshowVideoSrc
49 {
50   GstPushSrc src;
51 
52   /* device dshow reference (generally classid/name) */
53   gchar *device;
54 
55   /* device friendly name */
56   gchar *device_name;
57 
58   /* device index */
59   gint device_index;
60 
61   /* list of caps created from the list of supported media types of the dshow capture filter */
62   GstCaps *caps;
63 
64   /* list of dshow media types from the filter's capture pins */
65   GList *pins_mediatypes;
66 
67   /* dshow video capture filter */
68   IBaseFilter *video_cap_filter;
69 
70   /* dshow sink filter */
71   CDshowFakeSink *dshow_fakesink;
72 
73   /* graph manager interfaces */
74   IMediaFilter *media_filter;
75   IFilterGraph *filter_graph;
76 
77   IGraphBuilder	*graph_builder;
78   ICaptureGraphBuilder2 *capture_builder;
79   IAMVideoCompression *pVC;
80   //IAMVfwCaptureDialogs *pDlg;
81   //IAMStreamConfig *pASC;      // for audio cap
82   IAMStreamConfig *pVSC;      // for video cap
83 
84   /* the last buffer from DirectShow */
85   GCond buffer_cond;
86   GMutex buffer_mutex;
87   GstBuffer *buffer;
88   gboolean stop_requested;
89 
90   gboolean is_rgb;
91   gboolean is_running;
92   gint width;
93   gint height;
94 };
95 
96 struct _GstDshowVideoSrcClass
97 {
98   GstPushSrcClass parent_class;
99 };
100 
101 GType gst_dshowvideosrc_get_type (void);
102 
103 
104 GstCaps * gst_dshowvideosrc_getcaps_from_capture_filter (IBaseFilter * filter,
105     GList ** pins_mediatypes);
106 
107 
108 G_END_DECLS
109 #endif /* __GST_DSHOWVIDEOSRC_H__ */
110