dshowsrcwrapper: convert line ended characters to LF
This commit is contained in:
parent
d3c88d637d
commit
9844d73b37
@ -22,10 +22,10 @@
|
|||||||
#include "gstdshow.h"
|
#include "gstdshow.h"
|
||||||
#include "gstdshowfakesink.h"
|
#include "gstdshowfakesink.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
gst_dshow_free_mediatype (AM_MEDIA_TYPE *pmt)
|
gst_dshow_free_mediatype (AM_MEDIA_TYPE *pmt)
|
||||||
{
|
{
|
||||||
if (pmt != NULL) {
|
if (pmt != NULL) {
|
||||||
if (pmt->cbFormat != 0) {
|
if (pmt->cbFormat != 0) {
|
||||||
CoTaskMemFree((PVOID)pmt->pbFormat);
|
CoTaskMemFree((PVOID)pmt->pbFormat);
|
||||||
pmt->cbFormat = 0;
|
pmt->cbFormat = 0;
|
||||||
@ -41,7 +41,7 @@ gst_dshow_free_mediatype (AM_MEDIA_TYPE *pmt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gst_dshow_free_pin_mediatype (gpointer pt)
|
gst_dshow_free_pin_mediatype (gpointer pt)
|
||||||
{
|
{
|
||||||
GstCapturePinMediaType * pin_mediatype = (GstCapturePinMediaType *) pt;
|
GstCapturePinMediaType * pin_mediatype = (GstCapturePinMediaType *) pt;
|
||||||
@ -57,7 +57,7 @@ gst_dshow_free_pin_mediatype (gpointer pt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GstCapturePinMediaType *
|
GstCapturePinMediaType *
|
||||||
gst_dshow_new_pin_mediatype (IPin *pin, gint id, IAMStreamConfig * streamcaps)
|
gst_dshow_new_pin_mediatype (IPin *pin, gint id, IAMStreamConfig * streamcaps)
|
||||||
{
|
{
|
||||||
GstCapturePinMediaType *pin_mediatype = g_new0 (GstCapturePinMediaType, 1);
|
GstCapturePinMediaType *pin_mediatype = g_new0 (GstCapturePinMediaType, 1);
|
||||||
@ -74,7 +74,7 @@ gst_dshow_new_pin_mediatype (IPin *pin, gint id, IAMStreamConfig * streamcaps)
|
|||||||
return pin_mediatype;
|
return pin_mediatype;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gst_dshow_free_pins_mediatypes (GList *pins_mediatypes)
|
gst_dshow_free_pins_mediatypes (GList *pins_mediatypes)
|
||||||
{
|
{
|
||||||
guint i = 0;
|
guint i = 0;
|
||||||
@ -87,27 +87,27 @@ gst_dshow_free_pins_mediatypes (GList *pins_mediatypes)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gst_dshow_check_mediatype (AM_MEDIA_TYPE *media_type, const GUID sub_type,
|
gst_dshow_check_mediatype (AM_MEDIA_TYPE *media_type, const GUID sub_type,
|
||||||
const GUID format_type)
|
const GUID format_type)
|
||||||
{
|
{
|
||||||
RPC_STATUS rpcstatus;
|
RPC_STATUS rpcstatus;
|
||||||
|
|
||||||
g_return_val_if_fail (media_type != NULL, FALSE);
|
g_return_val_if_fail (media_type != NULL, FALSE);
|
||||||
|
|
||||||
return
|
return
|
||||||
UuidCompare (&media_type->subtype, (UUID *) &sub_type,
|
UuidCompare (&media_type->subtype, (UUID *) &sub_type,
|
||||||
&rpcstatus) == 0 && rpcstatus == RPC_S_OK &&
|
&rpcstatus) == 0 && rpcstatus == RPC_S_OK &&
|
||||||
UuidCompare (&media_type->formattype, (UUID *) &format_type,
|
UuidCompare (&media_type->formattype, (UUID *) &format_type,
|
||||||
&rpcstatus) == 0 && rpcstatus == RPC_S_OK;
|
&rpcstatus) == 0 && rpcstatus == RPC_S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gst_dshow_get_pin_from_filter (IBaseFilter *filter, PIN_DIRECTION pindir, IPin **pin)
|
gst_dshow_get_pin_from_filter (IBaseFilter *filter, PIN_DIRECTION pindir, IPin **pin)
|
||||||
{
|
{
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
IEnumPins *enumpins = NULL;
|
IEnumPins *enumpins = NULL;
|
||||||
IPin *pintmp = NULL;
|
IPin *pintmp = NULL;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
*pin = NULL;
|
*pin = NULL;
|
||||||
|
|
||||||
hres = filter->EnumPins (&enumpins);
|
hres = filter->EnumPins (&enumpins);
|
||||||
@ -131,8 +131,8 @@ gst_dshow_get_pin_from_filter (IBaseFilter *filter, PIN_DIRECTION pindir, IPin *
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean gst_dshow_find_filter(CLSID input_majortype, CLSID input_subtype,
|
gboolean gst_dshow_find_filter(CLSID input_majortype, CLSID input_subtype,
|
||||||
CLSID output_majortype, CLSID output_subtype,
|
CLSID output_majortype, CLSID output_subtype,
|
||||||
gchar * prefered_filter_name, IBaseFilter **filter)
|
gchar * prefered_filter_name, IBaseFilter **filter)
|
||||||
{
|
{
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
@ -156,24 +156,24 @@ gboolean gst_dshow_find_filter(CLSID input_majortype, CLSID input_subtype,
|
|||||||
_strupr (prefered_filter_upper);
|
_strupr (prefered_filter_upper);
|
||||||
}
|
}
|
||||||
|
|
||||||
hres = CoCreateInstance(CLSID_FilterMapper2, NULL, CLSCTX_INPROC,
|
hres = CoCreateInstance(CLSID_FilterMapper2, NULL, CLSCTX_INPROC,
|
||||||
IID_IFilterMapper2, (void **) &mapper);
|
IID_IFilterMapper2, (void **) &mapper);
|
||||||
if (FAILED(hres))
|
if (FAILED(hres))
|
||||||
goto clean;
|
goto clean;
|
||||||
|
|
||||||
memcpy(&arrayInTypes[0], &input_majortype, sizeof (CLSID));
|
memcpy(&arrayInTypes[0], &input_majortype, sizeof (CLSID));
|
||||||
memcpy(&arrayInTypes[1], &input_subtype, sizeof (CLSID));
|
memcpy(&arrayInTypes[1], &input_subtype, sizeof (CLSID));
|
||||||
memcpy(&arrayOutTypes[0], &output_majortype, sizeof (CLSID));
|
memcpy(&arrayOutTypes[0], &output_majortype, sizeof (CLSID));
|
||||||
memcpy(&arrayOutTypes[1], &output_subtype, sizeof (CLSID));
|
memcpy(&arrayOutTypes[1], &output_subtype, sizeof (CLSID));
|
||||||
|
|
||||||
hres = mapper->EnumMatchingFilters (&enum_moniker, 0, FALSE, MERIT_DO_NOT_USE+1,
|
hres = mapper->EnumMatchingFilters (&enum_moniker, 0, FALSE, MERIT_DO_NOT_USE+1,
|
||||||
TRUE, 1, arrayInTypes, NULL, NULL, FALSE,
|
TRUE, 1, arrayInTypes, NULL, NULL, FALSE,
|
||||||
TRUE, 1, arrayOutTypes, NULL, NULL);
|
TRUE, 1, arrayOutTypes, NULL, NULL);
|
||||||
if (FAILED(hres))
|
if (FAILED(hres))
|
||||||
goto clean;
|
goto clean;
|
||||||
|
|
||||||
enum_moniker->Reset ();
|
enum_moniker->Reset ();
|
||||||
|
|
||||||
while(hres = enum_moniker->Next (1, &moniker, &fetched),hres == S_OK
|
while(hres = enum_moniker->Next (1, &moniker, &fetched),hres == S_OK
|
||||||
&& !exit) {
|
&& !exit) {
|
||||||
IBaseFilter *filter_temp = NULL;
|
IBaseFilter *filter_temp = NULL;
|
||||||
@ -184,11 +184,11 @@ gboolean gst_dshow_find_filter(CLSID input_majortype, CLSID input_subtype,
|
|||||||
if(SUCCEEDED(hres) && property_bag) {
|
if(SUCCEEDED(hres) && property_bag) {
|
||||||
VARIANT varFriendlyName;
|
VARIANT varFriendlyName;
|
||||||
VariantInit (&varFriendlyName);
|
VariantInit (&varFriendlyName);
|
||||||
|
|
||||||
hres = property_bag->Read (L"FriendlyName", &varFriendlyName, NULL);
|
hres = property_bag->Read (L"FriendlyName", &varFriendlyName, NULL);
|
||||||
if(hres == S_OK && varFriendlyName.bstrVal) {
|
if(hres == S_OK && varFriendlyName.bstrVal) {
|
||||||
friendly_name = g_utf16_to_utf8((const gunichar2*)varFriendlyName.bstrVal,
|
friendly_name = g_utf16_to_utf8((const gunichar2*)varFriendlyName.bstrVal,
|
||||||
wcslen(varFriendlyName.bstrVal), NULL, NULL, NULL);
|
wcslen(varFriendlyName.bstrVal), NULL, NULL, NULL);
|
||||||
if (friendly_name)
|
if (friendly_name)
|
||||||
_strupr (friendly_name);
|
_strupr (friendly_name);
|
||||||
SysFreeString (varFriendlyName.bstrVal);
|
SysFreeString (varFriendlyName.bstrVal);
|
||||||
@ -196,7 +196,7 @@ gboolean gst_dshow_find_filter(CLSID input_majortype, CLSID input_subtype,
|
|||||||
property_bag->Release ();
|
property_bag->Release ();
|
||||||
}
|
}
|
||||||
|
|
||||||
hres = moniker->BindToObject(NULL, NULL, IID_IBaseFilter, (void**)&filter_temp);
|
hres = moniker->BindToObject(NULL, NULL, IID_IBaseFilter, (void**)&filter_temp);
|
||||||
if(SUCCEEDED(hres) && filter_temp) {
|
if(SUCCEEDED(hres) && filter_temp) {
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
if (filter) {
|
if (filter) {
|
||||||
@ -211,8 +211,8 @@ gboolean gst_dshow_find_filter(CLSID input_majortype, CLSID input_subtype,
|
|||||||
exit = TRUE;
|
exit = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if we just want to know if the formats are supported OR
|
/* if we just want to know if the formats are supported OR
|
||||||
if we don't care about what will be the filter used
|
if we don't care about what will be the filter used
|
||||||
=> we can stop enumeration */
|
=> we can stop enumeration */
|
||||||
if (!filter || !prefered_filter_upper)
|
if (!filter || !prefered_filter_upper)
|
||||||
exit = TRUE;
|
exit = TRUE;
|
||||||
@ -247,7 +247,7 @@ gst_dshow_getdevice_from_devicename (const GUID *device_category, gchar **devic
|
|||||||
HRESULT hres = S_FALSE;
|
HRESULT hres = S_FALSE;
|
||||||
ULONG fetched;
|
ULONG fetched;
|
||||||
gboolean bfound = FALSE;
|
gboolean bfound = FALSE;
|
||||||
|
|
||||||
hres = CoCreateInstance (CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER,
|
hres = CoCreateInstance (CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER,
|
||||||
IID_ICreateDevEnum, (void**)&devices_enum);
|
IID_ICreateDevEnum, (void**)&devices_enum);
|
||||||
if(hres != S_OK) {
|
if(hres != S_OK) {
|
||||||
@ -263,7 +263,7 @@ gst_dshow_getdevice_from_devicename (const GUID *device_category, gchar **devic
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum_moniker->Reset ();
|
enum_moniker->Reset ();
|
||||||
|
|
||||||
while(hres = enum_moniker->Next (1, &moniker, &fetched),hres == S_OK
|
while(hres = enum_moniker->Next (1, &moniker, &fetched),hres == S_OK
|
||||||
&& !bfound) {
|
&& !bfound) {
|
||||||
IPropertyBag *property_bag = NULL;
|
IPropertyBag *property_bag = NULL;
|
||||||
@ -271,10 +271,10 @@ gst_dshow_getdevice_from_devicename (const GUID *device_category, gchar **devic
|
|||||||
if(SUCCEEDED(hres) && property_bag) {
|
if(SUCCEEDED(hres) && property_bag) {
|
||||||
VARIANT varFriendlyName;
|
VARIANT varFriendlyName;
|
||||||
VariantInit (&varFriendlyName);
|
VariantInit (&varFriendlyName);
|
||||||
|
|
||||||
hres = property_bag->Read (L"FriendlyName", &varFriendlyName, NULL);
|
hres = property_bag->Read (L"FriendlyName", &varFriendlyName, NULL);
|
||||||
if(hres == S_OK && varFriendlyName.bstrVal) {
|
if(hres == S_OK && varFriendlyName.bstrVal) {
|
||||||
gchar * friendly_name = g_utf16_to_utf8((const gunichar2*)varFriendlyName.bstrVal,
|
gchar * friendly_name = g_utf16_to_utf8((const gunichar2*)varFriendlyName.bstrVal,
|
||||||
wcslen(varFriendlyName.bstrVal), NULL, NULL, NULL);
|
wcslen(varFriendlyName.bstrVal), NULL, NULL, NULL);
|
||||||
|
|
||||||
if (!*device_name) {
|
if (!*device_name) {
|
||||||
@ -285,7 +285,7 @@ gst_dshow_getdevice_from_devicename (const GUID *device_category, gchar **devic
|
|||||||
WCHAR *wszDisplayName = NULL;
|
WCHAR *wszDisplayName = NULL;
|
||||||
hres = moniker->GetDisplayName (NULL, NULL, &wszDisplayName);
|
hres = moniker->GetDisplayName (NULL, NULL, &wszDisplayName);
|
||||||
if(hres == S_OK && wszDisplayName) {
|
if(hres == S_OK && wszDisplayName) {
|
||||||
ret = g_utf16_to_utf8((const gunichar2*)wszDisplayName,
|
ret = g_utf16_to_utf8((const gunichar2*)wszDisplayName,
|
||||||
wcslen(wszDisplayName), NULL, NULL, NULL);
|
wcslen(wszDisplayName), NULL, NULL, NULL);
|
||||||
CoTaskMemFree (wszDisplayName);
|
CoTaskMemFree (wszDisplayName);
|
||||||
}
|
}
|
||||||
@ -310,19 +310,19 @@ clean:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gst_dshow_show_propertypage (IBaseFilter *base_filter)
|
gst_dshow_show_propertypage (IBaseFilter *base_filter)
|
||||||
{
|
{
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
ISpecifyPropertyPages *pProp = NULL;
|
ISpecifyPropertyPages *pProp = NULL;
|
||||||
HRESULT hres = base_filter->QueryInterface (IID_ISpecifyPropertyPages, (void **)&pProp);
|
HRESULT hres = base_filter->QueryInterface (IID_ISpecifyPropertyPages, (void **)&pProp);
|
||||||
if (SUCCEEDED(hres))
|
if (SUCCEEDED(hres))
|
||||||
{
|
{
|
||||||
/* Get the filter's name and IUnknown pointer.*/
|
/* Get the filter's name and IUnknown pointer.*/
|
||||||
FILTER_INFO FilterInfo;
|
FILTER_INFO FilterInfo;
|
||||||
CAUUID caGUID;
|
CAUUID caGUID;
|
||||||
IUnknown *pFilterUnk = NULL;
|
IUnknown *pFilterUnk = NULL;
|
||||||
hres = base_filter->QueryFilterInfo (&FilterInfo);
|
hres = base_filter->QueryFilterInfo (&FilterInfo);
|
||||||
base_filter->QueryInterface (IID_IUnknown, (void **)&pFilterUnk);
|
base_filter->QueryInterface (IID_IUnknown, (void **)&pFilterUnk);
|
||||||
|
|
||||||
/* Show the page. */
|
/* Show the page. */
|
||||||
@ -338,13 +338,13 @@ gst_dshow_show_propertypage (IBaseFilter *base_filter)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
GstCaps *gst_dshow_new_video_caps (GstVideoFormat video_format, const gchar* name,
|
GstCaps *gst_dshow_new_video_caps (GstVideoFormat video_format, const gchar* name,
|
||||||
GstCapturePinMediaType *pin_mediatype)
|
GstCapturePinMediaType *pin_mediatype)
|
||||||
{
|
{
|
||||||
GstCaps *video_caps = NULL;
|
GstCaps *video_caps = NULL;
|
||||||
GstStructure *video_structure = NULL;
|
GstStructure *video_structure = NULL;
|
||||||
VIDEOINFOHEADER *video_info = (VIDEOINFOHEADER *) pin_mediatype->mediatype->pbFormat;
|
VIDEOINFOHEADER *video_info = (VIDEOINFOHEADER *) pin_mediatype->mediatype->pbFormat;
|
||||||
|
|
||||||
pin_mediatype->defaultWidth = video_info->bmiHeader.biWidth;
|
pin_mediatype->defaultWidth = video_info->bmiHeader.biWidth;
|
||||||
pin_mediatype->defaultHeight = video_info->bmiHeader.biHeight;
|
pin_mediatype->defaultHeight = video_info->bmiHeader.biHeight;
|
||||||
pin_mediatype->defaultFPS = (gint) (10000000 / video_info->AvgTimePerFrame);
|
pin_mediatype->defaultFPS = (gint) (10000000 / video_info->AvgTimePerFrame);
|
||||||
@ -365,12 +365,12 @@ GstCaps *gst_dshow_new_video_caps (GstVideoFormat video_format, const gchar* nam
|
|||||||
/* other video format */
|
/* other video format */
|
||||||
if (!video_caps){
|
if (!video_caps){
|
||||||
if (g_strcasecmp (name, "video/x-dv, systemstream=FALSE") == 0) {
|
if (g_strcasecmp (name, "video/x-dv, systemstream=FALSE") == 0) {
|
||||||
video_caps = gst_caps_new_simple ("video/x-dv",
|
video_caps = gst_caps_new_simple ("video/x-dv",
|
||||||
"systemstream", G_TYPE_BOOLEAN, FALSE,
|
"systemstream", G_TYPE_BOOLEAN, FALSE,
|
||||||
"format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('d', 'v', 's', 'd'),
|
"format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('d', 'v', 's', 'd'),
|
||||||
NULL);
|
NULL);
|
||||||
} else if (g_strcasecmp (name, "video/x-dv, systemstream=TRUE") == 0) {
|
} else if (g_strcasecmp (name, "video/x-dv, systemstream=TRUE") == 0) {
|
||||||
video_caps = gst_caps_new_simple ("video/x-dv",
|
video_caps = gst_caps_new_simple ("video/x-dv",
|
||||||
"systemstream", G_TYPE_BOOLEAN, TRUE, NULL);
|
"systemstream", G_TYPE_BOOLEAN, TRUE, NULL);
|
||||||
return video_caps;
|
return video_caps;
|
||||||
}
|
}
|
||||||
@ -389,12 +389,12 @@ GstCaps *gst_dshow_new_video_caps (GstVideoFormat video_format, const gchar* nam
|
|||||||
|
|
||||||
/* For framerate we do not need a step (granularity) because */
|
/* For framerate we do not need a step (granularity) because */
|
||||||
/* "The IAMStreamConfig::SetFormat method will set the frame rate to the closest */
|
/* "The IAMStreamConfig::SetFormat method will set the frame rate to the closest */
|
||||||
/* value that the filter supports" as it said in the VIDEO_STREAM_CONFIG_CAPS dshwo doc */
|
/* value that the filter supports" as it said in the VIDEO_STREAM_CONFIG_CAPS dshwo doc */
|
||||||
|
|
||||||
gst_structure_set (video_structure,
|
gst_structure_set (video_structure,
|
||||||
"width", GST_TYPE_INT_RANGE, pin_mediatype->vscc.MinOutputSize.cx, pin_mediatype->vscc.MaxOutputSize.cx,
|
"width", GST_TYPE_INT_RANGE, pin_mediatype->vscc.MinOutputSize.cx, pin_mediatype->vscc.MaxOutputSize.cx,
|
||||||
"height", GST_TYPE_INT_RANGE, pin_mediatype->vscc.MinOutputSize.cy, pin_mediatype->vscc.MaxOutputSize.cy,
|
"height", GST_TYPE_INT_RANGE, pin_mediatype->vscc.MinOutputSize.cy, pin_mediatype->vscc.MaxOutputSize.cy,
|
||||||
"framerate", GST_TYPE_FRACTION_RANGE,
|
"framerate", GST_TYPE_FRACTION_RANGE,
|
||||||
(gint) (10000000 / pin_mediatype->vscc.MaxFrameInterval), 1,
|
(gint) (10000000 / pin_mediatype->vscc.MaxFrameInterval), 1,
|
||||||
(gint) (10000000 / pin_mediatype->vscc.MinFrameInterval), 1,
|
(gint) (10000000 / pin_mediatype->vscc.MinFrameInterval), 1,
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/* GStreamer
|
/* GStreamer
|
||||||
* Copyright (C) 2007 Sebastien Moutte <sebastien@moutte.net>
|
* Copyright (C) 2007 Sebastien Moutte <sebastien@moutte.net>
|
||||||
*
|
*
|
||||||
* gstdshowaudiosrc.c:
|
* gstdshowaudiosrc.c:
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Library General Public
|
* modify it under the terms of the GNU Library General Public
|
||||||
@ -172,7 +172,7 @@ gst_dshowaudiosrc_class_init (GstDshowAudioSrcClass * klass)
|
|||||||
g_object_class_install_property
|
g_object_class_install_property
|
||||||
(gobject_class, PROP_DEVICE_NAME,
|
(gobject_class, PROP_DEVICE_NAME,
|
||||||
g_param_spec_string ("device-name", "Device name",
|
g_param_spec_string ("device-name", "Device name",
|
||||||
"Human-readable name of the sound device", NULL,
|
"Human-readable name of the sound device", NULL,
|
||||||
static_cast<GParamFlags>(G_PARAM_READWRITE)));
|
static_cast<GParamFlags>(G_PARAM_READWRITE)));
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_INIT (dshowaudiosrc_debug, "dshowaudiosrc", 0,
|
GST_DEBUG_CATEGORY_INIT (dshowaudiosrc_debug, "dshowaudiosrc", 0,
|
||||||
@ -278,7 +278,7 @@ gst_dshowaudiosrc_get_device_name_values (GstDshowAudioSrc * src)
|
|||||||
goto clean;
|
goto clean;
|
||||||
}
|
}
|
||||||
|
|
||||||
hres = devices_enum->CreateClassEnumerator(CLSID_AudioInputDeviceCategory,
|
hres = devices_enum->CreateClassEnumerator(CLSID_AudioInputDeviceCategory,
|
||||||
&moniker_enum, 0);
|
&moniker_enum, 0);
|
||||||
if (hres != S_OK || !moniker_enum) {
|
if (hres != S_OK || !moniker_enum) {
|
||||||
GST_ERROR ("Can't get enumeration of audio devices (error=0x%x)", hres);
|
GST_ERROR ("Can't get enumeration of audio devices (error=0x%x)", hres);
|
||||||
@ -292,7 +292,7 @@ gst_dshowaudiosrc_get_device_name_values (GstDshowAudioSrc * src)
|
|||||||
hres == S_OK) {
|
hres == S_OK) {
|
||||||
IPropertyBag *property_bag = NULL;
|
IPropertyBag *property_bag = NULL;
|
||||||
|
|
||||||
hres = moniker->BindToStorage(NULL, NULL, IID_IPropertyBag,
|
hres = moniker->BindToStorage(NULL, NULL, IID_IPropertyBag,
|
||||||
(LPVOID *) &property_bag);
|
(LPVOID *) &property_bag);
|
||||||
if (SUCCEEDED (hres) && property_bag) {
|
if (SUCCEEDED (hres) && property_bag) {
|
||||||
VARIANT varFriendlyName;
|
VARIANT varFriendlyName;
|
||||||
@ -304,7 +304,7 @@ gst_dshowaudiosrc_get_device_name_values (GstDshowAudioSrc * src)
|
|||||||
g_utf16_to_utf8 ((const gunichar2 *) varFriendlyName.bstrVal,
|
g_utf16_to_utf8 ((const gunichar2 *) varFriendlyName.bstrVal,
|
||||||
wcslen (varFriendlyName.bstrVal), NULL, NULL, NULL);
|
wcslen (varFriendlyName.bstrVal), NULL, NULL, NULL);
|
||||||
|
|
||||||
GValue value = { 0 };
|
GValue value = { 0 };
|
||||||
g_value_init (&value, G_TYPE_STRING);
|
g_value_init (&value, G_TYPE_STRING);
|
||||||
g_value_set_string (&value, friendly_name);
|
g_value_set_string (&value, friendly_name);
|
||||||
g_value_array_append (array, &value);
|
g_value_array_append (array, &value);
|
||||||
@ -364,16 +364,16 @@ gst_dshowaudiosrc_set_property (GObject * object, guint prop_id,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PROP_DEVICE_NAME:
|
case PROP_DEVICE_NAME:
|
||||||
{
|
{
|
||||||
if (src->device_name) {
|
if (src->device_name) {
|
||||||
g_free (src->device_name);
|
g_free (src->device_name);
|
||||||
src->device_name = NULL;
|
src->device_name = NULL;
|
||||||
}
|
}
|
||||||
if (g_value_get_string (value)) {
|
if (g_value_get_string (value)) {
|
||||||
src->device_name = g_strdup (g_value_get_string (value));
|
src->device_name = g_strdup (g_value_get_string (value));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
@ -418,7 +418,7 @@ gst_dshowaudiosrc_get_caps (GstBaseSrc * basesrc)
|
|||||||
if (SUCCEEDED (hres)) {
|
if (SUCCEEDED (hres)) {
|
||||||
hres = MkParseDisplayName (lpbc, (LPCOLESTR) unidevice, &dwEaten, &audiom);
|
hres = MkParseDisplayName (lpbc, (LPCOLESTR) unidevice, &dwEaten, &audiom);
|
||||||
if (SUCCEEDED (hres)) {
|
if (SUCCEEDED (hres)) {
|
||||||
hres = audiom->BindToObject(lpbc, NULL, IID_IBaseFilter,
|
hres = audiom->BindToObject(lpbc, NULL, IID_IBaseFilter,
|
||||||
(LPVOID *) &src->audio_cap_filter);
|
(LPVOID *) &src->audio_cap_filter);
|
||||||
audiom->Release();
|
audiom->Release();
|
||||||
}
|
}
|
||||||
@ -616,7 +616,7 @@ gst_dshowaudiosrc_prepare (GstAudioSrc * asrc, GstRingBufferSpec * spec)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
hres = src->filter_graph->ConnectDirect(pin_mediatype->capture_pin,
|
hres = src->filter_graph->ConnectDirect(pin_mediatype->capture_pin,
|
||||||
input_pin, NULL);
|
input_pin, NULL);
|
||||||
input_pin->Release();
|
input_pin->Release();
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* Copyright (C) 2007 Sebastien Moutte <sebastien@moutte.net>
|
* Copyright (C) 2007 Sebastien Moutte <sebastien@moutte.net>
|
||||||
* Copyright (C) 2009 Julien Isorce <julien.isorce@gmail.com>
|
* Copyright (C) 2009 Julien Isorce <julien.isorce@gmail.com>
|
||||||
*
|
*
|
||||||
* gstdshowvideosrc.c:
|
* gstdshowvideosrc.c:
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Library General Public
|
* modify it under the terms of the GNU Library General Public
|
||||||
@ -179,13 +179,13 @@ gst_dshowvideosrc_class_init (GstDshowVideoSrcClass * klass)
|
|||||||
g_object_class_install_property
|
g_object_class_install_property
|
||||||
(gobject_class, PROP_DEVICE,
|
(gobject_class, PROP_DEVICE,
|
||||||
g_param_spec_string ("device", "Device",
|
g_param_spec_string ("device", "Device",
|
||||||
"Directshow device path (@..classID/name)", NULL,
|
"Directshow device path (@..classID/name)", NULL,
|
||||||
static_cast<GParamFlags>(G_PARAM_READWRITE)));
|
static_cast<GParamFlags>(G_PARAM_READWRITE)));
|
||||||
|
|
||||||
g_object_class_install_property
|
g_object_class_install_property
|
||||||
(gobject_class, PROP_DEVICE_NAME,
|
(gobject_class, PROP_DEVICE_NAME,
|
||||||
g_param_spec_string ("device-name", "Device name",
|
g_param_spec_string ("device-name", "Device name",
|
||||||
"Human-readable name of the sound device", NULL,
|
"Human-readable name of the sound device", NULL,
|
||||||
static_cast<GParamFlags>(G_PARAM_READWRITE)));
|
static_cast<GParamFlags>(G_PARAM_READWRITE)));
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_INIT (dshowvideosrc_debug, "dshowvideosrc", 0,
|
GST_DEBUG_CATEGORY_INIT (dshowvideosrc_debug, "dshowvideosrc", 0,
|
||||||
@ -361,7 +361,7 @@ gst_dshowvideosrc_get_device_name_values (GstDshowVideoSrc * src)
|
|||||||
goto clean;
|
goto clean;
|
||||||
}
|
}
|
||||||
|
|
||||||
hres = devices_enum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory,
|
hres = devices_enum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory,
|
||||||
&moniker_enum, 0);
|
&moniker_enum, 0);
|
||||||
if (hres != S_OK || !moniker_enum) {
|
if (hres != S_OK || !moniker_enum) {
|
||||||
GST_ERROR ("Can't get enumeration of video devices (error=0x%x)", hres);
|
GST_ERROR ("Can't get enumeration of video devices (error=0x%x)", hres);
|
||||||
@ -388,7 +388,7 @@ gst_dshowvideosrc_get_device_name_values (GstDshowVideoSrc * src)
|
|||||||
g_utf16_to_utf8 ((const gunichar2 *) varFriendlyName.bstrVal,
|
g_utf16_to_utf8 ((const gunichar2 *) varFriendlyName.bstrVal,
|
||||||
wcslen (varFriendlyName.bstrVal), NULL, NULL, NULL);
|
wcslen (varFriendlyName.bstrVal), NULL, NULL, NULL);
|
||||||
|
|
||||||
GValue value = { 0 };
|
GValue value = { 0 };
|
||||||
g_value_init (&value, G_TYPE_STRING);
|
g_value_init (&value, G_TYPE_STRING);
|
||||||
g_value_set_string (&value, friendly_name);
|
g_value_set_string (&value, friendly_name);
|
||||||
g_value_array_append (array, &value);
|
g_value_array_append (array, &value);
|
||||||
@ -502,7 +502,7 @@ gst_dshowvideosrc_get_caps (GstBaseSrc * basesrc)
|
|||||||
if (SUCCEEDED (hres)) {
|
if (SUCCEEDED (hres)) {
|
||||||
hres = MkParseDisplayName (lpbc, (LPCOLESTR) unidevice, &dwEaten, &videom);
|
hres = MkParseDisplayName (lpbc, (LPCOLESTR) unidevice, &dwEaten, &videom);
|
||||||
if (SUCCEEDED (hres)) {
|
if (SUCCEEDED (hres)) {
|
||||||
hres = videom->BindToObject(lpbc, NULL, IID_IBaseFilter,
|
hres = videom->BindToObject(lpbc, NULL, IID_IBaseFilter,
|
||||||
(LPVOID *) &src->video_cap_filter);
|
(LPVOID *) &src->video_cap_filter);
|
||||||
videom->Release();
|
videom->Release();
|
||||||
}
|
}
|
||||||
@ -622,7 +622,7 @@ gst_dshowvideosrc_start (GstBaseSrc * bsrc)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
hres = src->filter_graph->QueryInterface(IID_IMediaFilter,
|
hres = src->filter_graph->QueryInterface(IID_IMediaFilter,
|
||||||
(LPVOID *) &src->media_filter);
|
(LPVOID *) &src->media_filter);
|
||||||
if (hres != S_OK || !src->media_filter) {
|
if (hres != S_OK || !src->media_filter) {
|
||||||
GST_ERROR ("Can't get IMediacontrol interface from the graph manager (error=0x%x)", hres);
|
GST_ERROR ("Can't get IMediacontrol interface from the graph manager (error=0x%x)", hres);
|
||||||
@ -732,7 +732,7 @@ gst_dshowvideosrc_set_caps (GstBaseSrc * bsrc, GstCaps * caps)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
hres = src->filter_graph->ConnectDirect(pin_mediatype->capture_pin,
|
hres = src->filter_graph->ConnectDirect(pin_mediatype->capture_pin,
|
||||||
input_pin, pin_mediatype->mediatype);
|
input_pin, pin_mediatype->mediatype);
|
||||||
input_pin->Release();
|
input_pin->Release();
|
||||||
|
|
||||||
@ -880,12 +880,12 @@ gst_dshowvideosrc_getcaps_from_streamcaps (GstDshowVideoSrc * src, IPin * pin,
|
|||||||
caps = gst_caps_new_empty ();
|
caps = gst_caps_new_empty ();
|
||||||
|
|
||||||
for (; i < icount; i++) {
|
for (; i < icount; i++) {
|
||||||
|
|
||||||
GstCapturePinMediaType *pin_mediatype =
|
GstCapturePinMediaType *pin_mediatype =
|
||||||
gst_dshow_new_pin_mediatype (pin, i, streamcaps);
|
gst_dshow_new_pin_mediatype (pin, i, streamcaps);
|
||||||
|
|
||||||
if (pin_mediatype) {
|
if (pin_mediatype) {
|
||||||
|
|
||||||
GstCaps *mediacaps = NULL;
|
GstCaps *mediacaps = NULL;
|
||||||
|
|
||||||
if (gst_dshow_check_mediatype (pin_mediatype->mediatype, MEDIASUBTYPE_I420, FORMAT_VideoInfo)) {
|
if (gst_dshow_check_mediatype (pin_mediatype->mediatype, MEDIASUBTYPE_I420, FORMAT_VideoInfo)) {
|
||||||
@ -895,11 +895,11 @@ gst_dshowvideosrc_getcaps_from_streamcaps (GstDshowVideoSrc * src, IPin * pin,
|
|||||||
mediacaps = gst_dshow_new_video_caps (GST_VIDEO_FORMAT_BGR, NULL, pin_mediatype);
|
mediacaps = gst_dshow_new_video_caps (GST_VIDEO_FORMAT_BGR, NULL, pin_mediatype);
|
||||||
|
|
||||||
} else if (gst_dshow_check_mediatype (pin_mediatype->mediatype, MEDIASUBTYPE_dvsd, FORMAT_VideoInfo)) {
|
} else if (gst_dshow_check_mediatype (pin_mediatype->mediatype, MEDIASUBTYPE_dvsd, FORMAT_VideoInfo)) {
|
||||||
mediacaps = gst_dshow_new_video_caps (GST_VIDEO_FORMAT_UNKNOWN, "video/x-dv, systemstream=FALSE",
|
mediacaps = gst_dshow_new_video_caps (GST_VIDEO_FORMAT_UNKNOWN, "video/x-dv, systemstream=FALSE",
|
||||||
pin_mediatype);
|
pin_mediatype);
|
||||||
|
|
||||||
} else if (gst_dshow_check_mediatype (pin_mediatype->mediatype, MEDIASUBTYPE_dvsd, FORMAT_DvInfo)) {
|
} else if (gst_dshow_check_mediatype (pin_mediatype->mediatype, MEDIASUBTYPE_dvsd, FORMAT_DvInfo)) {
|
||||||
mediacaps = gst_dshow_new_video_caps (GST_VIDEO_FORMAT_UNKNOWN, "video/x-dv, systemstream=TRUE",
|
mediacaps = gst_dshow_new_video_caps (GST_VIDEO_FORMAT_UNKNOWN, "video/x-dv, systemstream=TRUE",
|
||||||
pin_mediatype);
|
pin_mediatype);
|
||||||
|
|
||||||
pin_mediatype->granularityWidth = 0;
|
pin_mediatype->granularityWidth = 0;
|
||||||
@ -949,7 +949,7 @@ gst_dshowvideosrc_push_buffer (byte * buffer, long size, gpointer src_object,
|
|||||||
GST_BUFFER_DURATION (buf) = stop - start;
|
GST_BUFFER_DURATION (buf) = stop - start;
|
||||||
|
|
||||||
if (src->is_rgb) {
|
if (src->is_rgb) {
|
||||||
/* FOR RGB directshow decoder will return bottom-up BITMAP
|
/* FOR RGB directshow decoder will return bottom-up BITMAP
|
||||||
* There is probably a way to get top-bottom video frames from
|
* There is probably a way to get top-bottom video frames from
|
||||||
* the decoder...
|
* the decoder...
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user