2007-05-23 22:44:12 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 2007 Sebastien Moutte <sebastien@moutte.net>
|
|
|
|
*
|
|
|
|
* gstdshow.h:
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
2012-11-03 20:38:00 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2007-05-23 22:44:12 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _GSTDSHOW_
|
|
|
|
#define _GSTDSHOW_
|
|
|
|
|
2009-07-21 08:49:37 +00:00
|
|
|
#include <streams.h>
|
2007-05-23 22:44:12 +00:00
|
|
|
#include <windows.h>
|
2009-09-07 14:44:52 +00:00
|
|
|
#include <tchar.h>
|
2009-07-21 08:49:37 +00:00
|
|
|
#include <objbase.h>
|
|
|
|
#include <dshow.h>
|
|
|
|
#include <Rpc.h>
|
2007-05-23 22:44:12 +00:00
|
|
|
|
2009-09-03 15:12:26 +00:00
|
|
|
#include <gst/gst.h>
|
|
|
|
#include <gst/video/video.h>
|
2007-05-23 22:44:12 +00:00
|
|
|
|
|
|
|
typedef struct _GstCapturePinMediaType
|
|
|
|
{
|
|
|
|
AM_MEDIA_TYPE *mediatype;
|
|
|
|
IPin *capture_pin;
|
|
|
|
|
2009-09-04 14:29:53 +00:00
|
|
|
VIDEO_STREAM_CONFIG_CAPS vscc;
|
|
|
|
|
2009-09-04 10:08:02 +00:00
|
|
|
//default caps
|
2009-09-03 15:12:26 +00:00
|
|
|
gint defaultWidth;
|
|
|
|
gint defaultHeight;
|
|
|
|
gint defaultFPS;
|
|
|
|
|
2009-09-07 08:59:53 +00:00
|
|
|
gint granularityWidth; //will be removed when GST_TYPE_INT_RANGE_STEP exits
|
|
|
|
gint granularityHeight; //will be removed when GST_TYPE_INT_RANGE_STEP exits
|
2009-09-04 10:08:02 +00:00
|
|
|
} GstCapturePinMediaType;
|
2009-09-03 15:12:26 +00:00
|
|
|
|
2007-05-23 22:44:12 +00:00
|
|
|
/* free memory of the input pin mediatype */
|
|
|
|
void gst_dshow_free_pin_mediatype (gpointer pt);
|
|
|
|
|
|
|
|
/* free memory of the input dshow mediatype */
|
2009-09-07 08:59:53 +00:00
|
|
|
void gst_dshow_free_mediatype (AM_MEDIA_TYPE * pmt);
|
2007-05-23 22:44:12 +00:00
|
|
|
|
2009-09-04 14:29:53 +00:00
|
|
|
/* create a new capture media type that handles dshow video caps of a capture pin */
|
2009-09-09 10:41:17 +00:00
|
|
|
GstCapturePinMediaType *gst_dshow_new_pin_mediatype (IPin * pin);
|
|
|
|
|
|
|
|
/* create a new capture media type from enum mediatype */
|
|
|
|
GstCapturePinMediaType * gst_dshow_new_pin_mediatype_from_enum_mediatypes (IPin * pin,
|
|
|
|
IEnumMediaTypes *enum_mediatypes);
|
|
|
|
|
|
|
|
/* create a new capture media type from streamcaps */
|
|
|
|
GstCapturePinMediaType *gst_dshow_new_pin_mediatype_from_streamcaps (IPin * pin,
|
|
|
|
gint id, IAMStreamConfig * streamcaps);
|
2009-09-04 14:29:53 +00:00
|
|
|
|
2007-05-23 22:44:12 +00:00
|
|
|
/* free the memory of all mediatypes of the input list if pin mediatype */
|
2009-09-07 08:59:53 +00:00
|
|
|
void gst_dshow_free_pins_mediatypes (GList * mediatypes);
|
2007-05-23 22:44:12 +00:00
|
|
|
|
2009-08-10 14:03:17 +00:00
|
|
|
/* allow to know what kind of media type we have */
|
2009-09-07 08:59:53 +00:00
|
|
|
gboolean gst_dshow_check_mediatype (AM_MEDIA_TYPE * media_type,
|
|
|
|
const GUID sub_type, const GUID format_type);
|
2009-08-10 14:03:17 +00:00
|
|
|
|
2007-05-23 22:44:12 +00:00
|
|
|
/* get a pin from directshow filter */
|
2009-09-07 08:59:53 +00:00
|
|
|
gboolean gst_dshow_get_pin_from_filter (IBaseFilter * filter,
|
|
|
|
PIN_DIRECTION pindir, IPin ** pin);
|
2007-05-23 22:44:12 +00:00
|
|
|
|
|
|
|
/* find and return a filter according to the input and output types */
|
2009-09-07 08:59:53 +00:00
|
|
|
gboolean gst_dshow_find_filter (CLSID input_majortype, CLSID input_subtype,
|
|
|
|
CLSID output_majortype, CLSID output_subtype,
|
|
|
|
gchar * prefered_filter_name, IBaseFilter ** filter);
|
2007-05-23 22:44:12 +00:00
|
|
|
|
|
|
|
/* get the dshow device path from device friendly name.
|
|
|
|
If friendly name is not set, it will return the first available device */
|
2009-09-07 08:59:53 +00:00
|
|
|
gchar *gst_dshow_getdevice_from_devicename (const GUID * device_category,
|
2018-10-11 16:45:21 +00:00
|
|
|
gchar ** device_name, gint * device_index);
|
2007-05-23 22:44:12 +00:00
|
|
|
|
|
|
|
/* show the capture filter property page (generally used to setup the device). the page is modal*/
|
2009-09-07 08:59:53 +00:00
|
|
|
gboolean gst_dshow_show_propertypage (IBaseFilter * base_filter);
|
2009-09-03 15:12:26 +00:00
|
|
|
|
2009-09-09 10:41:17 +00:00
|
|
|
/* translate GUID format to gsteamer video format */
|
|
|
|
GstVideoFormat gst_dshow_guid_to_gst_video_format (AM_MEDIA_TYPE *mediatype);
|
|
|
|
|
2014-09-18 20:13:58 +00:00
|
|
|
/* check if IPin is connected */
|
|
|
|
gboolean gst_dshow_is_pin_connected (IPin *pin);
|
|
|
|
|
2009-09-07 08:59:53 +00:00
|
|
|
/* transform a dshow video caps to a gstreamer video caps */
|
|
|
|
GstCaps *gst_dshow_new_video_caps (GstVideoFormat video_format,
|
|
|
|
const gchar * name, GstCapturePinMediaType * pin_mediatype);
|
2009-09-03 15:12:26 +00:00
|
|
|
|
2013-06-11 09:54:41 +00:00
|
|
|
/* configure the latency of the capture source */
|
|
|
|
bool gst_dshow_configure_latency (IPin *pCapturePin, guint bufSizeMS);
|
|
|
|
|
2009-09-07 08:59:53 +00:00
|
|
|
#endif /* _GSTDSHOW_ */
|