2 * Copyright (C) 2007 Sebastien Moutte <sebastien@moutte.net>
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.
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.
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.
33 #include <gst/video/video.h>
35 typedef struct _DshowDeviceEntry DshowDeviceEntry;
37 struct _DshowDeviceEntry
46 typedef struct _GstCapturePinMediaType
48 AM_MEDIA_TYPE *mediatype;
51 VIDEO_STREAM_CONFIG_CAPS vscc;
58 gint granularityWidth; //will be removed when GST_TYPE_INT_RANGE_STEP exits
59 gint granularityHeight; //will be removed when GST_TYPE_INT_RANGE_STEP exits
60 } GstCapturePinMediaType;
62 /* free memory of the input pin mediatype */
63 void gst_dshow_free_pin_mediatype (gpointer pt);
65 /* free memory of the input dshow mediatype */
66 void gst_dshow_free_mediatype (AM_MEDIA_TYPE * pmt);
68 /* create a new capture media type that handles dshow video caps of a capture pin */
69 GstCapturePinMediaType *gst_dshow_new_pin_mediatype (IPin * pin);
71 /* create a new capture media type from enum mediatype */
72 GstCapturePinMediaType * gst_dshow_new_pin_mediatype_from_enum_mediatypes (IPin * pin,
73 IEnumMediaTypes *enum_mediatypes);
75 /* create a new capture media type from streamcaps */
76 GstCapturePinMediaType *gst_dshow_new_pin_mediatype_from_streamcaps (IPin * pin,
77 gint id, IAMStreamConfig * streamcaps);
79 /* free the memory of all mediatypes of the input list if pin mediatype */
80 void gst_dshow_free_pins_mediatypes (GList * mediatypes);
82 /* allow to know what kind of media type we have */
83 gboolean gst_dshow_check_mediatype (AM_MEDIA_TYPE * media_type,
84 const GUID sub_type, const GUID format_type);
86 /* get a pin from directshow filter */
87 gboolean gst_dshow_get_pin_from_filter (IBaseFilter * filter,
88 PIN_DIRECTION pindir, IPin ** pin);
90 /* find and return a filter according to the input and output types */
91 gboolean gst_dshow_find_filter (CLSID input_majortype, CLSID input_subtype,
92 CLSID output_majortype, CLSID output_subtype,
93 gchar * prefered_filter_name, IBaseFilter ** filter);
95 /* get the dshow device path from device friendly name.
96 If friendly name is not set, it will return the first available device */
97 gchar *gst_dshow_getdevice_from_devicename (const GUID * device_category,
98 gchar ** device_name, gint * device_index);
100 /* show the capture filter property page (generally used to setup the device). the page is modal*/
101 gboolean gst_dshow_show_propertypage (IBaseFilter * base_filter);
103 /* translate GUID format to gsteamer video format */
104 GstVideoFormat gst_dshow_guid_to_gst_video_format (AM_MEDIA_TYPE *mediatype);
106 /* check if IPin is connected */
107 gboolean gst_dshow_is_pin_connected (IPin *pin);
109 /* transform a dshow video caps to a gstreamer video caps */
110 GstCaps *gst_dshow_new_video_caps (GstVideoFormat video_format,
111 const gchar * name, GstCapturePinMediaType * pin_mediatype);
113 /* configure the latency of the capture source */
114 bool gst_dshow_configure_latency (IPin *pCapturePin, guint bufSizeMS);
116 /* enumerate devices of a given category (i.e., audio or video) */
117 void gst_dshow_device_entry_free (DshowDeviceEntry *entry);
118 void gst_dshow_device_list_free (GList * devices);
119 GList * gst_dshow_enumerate_devices (const GUID * device_category, gboolean getcaps);
121 DshowDeviceEntry * gst_dshow_select_device (const GUID * device_category,
122 const gchar *device, const gchar *device_name, const gint device_index);
124 /* create capture filter from moniker */
125 IBaseFilter *gst_dshow_create_capture_filter (IMoniker *moniker);
127 #endif /* _GSTDSHOW_ */