mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-05 14:02:26 +00:00
dshowaudiosrc: converts code to C++
This commit is contained in:
parent
779ac0d98e
commit
0efde4cb70
2 changed files with 71 additions and 93 deletions
|
@ -166,13 +166,14 @@ gst_dshowaudiosrc_class_init (GstDshowAudioSrcClass * 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 reference (classID/name)",
|
"Directshow device reference (classID/name)", NULL,
|
||||||
NULL, 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, G_PARAM_READWRITE));
|
"Human-readable name of the sound device", NULL,
|
||||||
|
static_cast<GParamFlags>(G_PARAM_READWRITE)));
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_INIT (dshowaudiosrc_debug, "dshowaudiosrc", 0,
|
GST_DEBUG_CATEGORY_INIT (dshowaudiosrc_debug, "dshowaudiosrc", 0,
|
||||||
"Directshow audio source");
|
"Directshow audio source");
|
||||||
|
@ -234,9 +235,8 @@ gst_dshowaudiosrc_dispose (GObject * gobject)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* clean dshow */
|
/* clean dshow */
|
||||||
if (src->audio_cap_filter) {
|
if (src->audio_cap_filter)
|
||||||
IBaseFilter_Release (src->audio_cap_filter);
|
src->audio_cap_filter->Release();
|
||||||
}
|
|
||||||
|
|
||||||
CoUninitialize ();
|
CoUninitialize ();
|
||||||
|
|
||||||
|
@ -273,8 +273,8 @@ gst_dshowaudiosrc_get_device_name_values (GstDshowAudioSrc * src)
|
||||||
|
|
||||||
g_value_init (&value, G_TYPE_STRING);
|
g_value_init (&value, G_TYPE_STRING);
|
||||||
|
|
||||||
hres = CoCreateInstance (&CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER,
|
hres = CoCreateInstance (CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER,
|
||||||
&IID_ICreateDevEnum, (void **) &devices_enum);
|
IID_ICreateDevEnum, (LPVOID *) &devices_enum);
|
||||||
if (hres != S_OK) {
|
if (hres != S_OK) {
|
||||||
GST_CAT_ERROR (dshowaudiosrc_debug,
|
GST_CAT_ERROR (dshowaudiosrc_debug,
|
||||||
"Can't create an instance of the system device enumerator (error=%d)",
|
"Can't create an instance of the system device enumerator (error=%d)",
|
||||||
|
@ -283,9 +283,8 @@ gst_dshowaudiosrc_get_device_name_values (GstDshowAudioSrc * src)
|
||||||
goto clean;
|
goto clean;
|
||||||
}
|
}
|
||||||
|
|
||||||
hres =
|
hres = devices_enum->CreateClassEnumerator(CLSID_AudioInputDeviceCategory,
|
||||||
ICreateDevEnum_CreateClassEnumerator (devices_enum,
|
&moniker_enum, 0);
|
||||||
&CLSID_AudioInputDeviceCategory, &moniker_enum, 0);
|
|
||||||
if (hres != S_OK || !moniker_enum) {
|
if (hres != S_OK || !moniker_enum) {
|
||||||
GST_CAT_ERROR (dshowaudiosrc_debug,
|
GST_CAT_ERROR (dshowaudiosrc_debug,
|
||||||
"Can't get enumeration of audio devices (error=%d)", hres);
|
"Can't get enumeration of audio devices (error=%d)", hres);
|
||||||
|
@ -293,22 +292,19 @@ gst_dshowaudiosrc_get_device_name_values (GstDshowAudioSrc * src)
|
||||||
goto clean;
|
goto clean;
|
||||||
}
|
}
|
||||||
|
|
||||||
IEnumMoniker_Reset (moniker_enum);
|
moniker_enum->Reset();
|
||||||
|
|
||||||
while (hres = IEnumMoniker_Next (moniker_enum, 1, &moniker, &fetched),
|
while (hres = moniker_enum->Next(1, &moniker, &fetched),
|
||||||
hres == S_OK) {
|
hres == S_OK) {
|
||||||
IPropertyBag *property_bag = NULL;
|
IPropertyBag *property_bag = NULL;
|
||||||
|
|
||||||
hres =
|
hres = moniker->BindToStorage(NULL, NULL, IID_IPropertyBag,
|
||||||
IMoniker_BindToStorage (moniker, NULL, NULL, &IID_IPropertyBag,
|
(LPVOID *) &property_bag);
|
||||||
(void **) &property_bag);
|
|
||||||
if (SUCCEEDED (hres) && property_bag) {
|
if (SUCCEEDED (hres) && property_bag) {
|
||||||
VARIANT varFriendlyName;
|
VARIANT varFriendlyName;
|
||||||
|
|
||||||
VariantInit (&varFriendlyName);
|
VariantInit (&varFriendlyName);
|
||||||
hres =
|
hres = property_bag->Read(L"FriendlyName", &varFriendlyName, NULL);
|
||||||
IPropertyBag_Read (property_bag, L"FriendlyName", &varFriendlyName,
|
|
||||||
NULL);
|
|
||||||
if (hres == S_OK && varFriendlyName.bstrVal) {
|
if (hres == S_OK && varFriendlyName.bstrVal) {
|
||||||
gchar *friendly_name =
|
gchar *friendly_name =
|
||||||
g_utf16_to_utf8 ((const gunichar2 *) varFriendlyName.bstrVal,
|
g_utf16_to_utf8 ((const gunichar2 *) varFriendlyName.bstrVal,
|
||||||
|
@ -320,19 +316,17 @@ gst_dshowaudiosrc_get_device_name_values (GstDshowAudioSrc * src)
|
||||||
g_free (friendly_name);
|
g_free (friendly_name);
|
||||||
SysFreeString (varFriendlyName.bstrVal);
|
SysFreeString (varFriendlyName.bstrVal);
|
||||||
}
|
}
|
||||||
IPropertyBag_Release (property_bag);
|
property_bag->Release();
|
||||||
}
|
}
|
||||||
IMoniker_Release (moniker);
|
moniker->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
if (moniker_enum) {
|
if (moniker_enum)
|
||||||
IEnumMoniker_Release (moniker_enum);
|
moniker_enum->Release();
|
||||||
}
|
|
||||||
|
|
||||||
if (devices_enum) {
|
if (devices_enum)
|
||||||
ICreateDevEnum_Release (devices_enum);
|
devices_enum->Release();
|
||||||
}
|
|
||||||
|
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
@ -415,14 +409,13 @@ gst_dshowaudiosrc_get_caps (GstBaseSrc * basesrc)
|
||||||
if (!src->audio_cap_filter) {
|
if (!src->audio_cap_filter) {
|
||||||
hres = CreateBindCtx (0, &lpbc);
|
hres = CreateBindCtx (0, &lpbc);
|
||||||
if (SUCCEEDED (hres)) {
|
if (SUCCEEDED (hres)) {
|
||||||
hres = MkParseDisplayName (lpbc, unidevice, &dwEaten, &audiom);
|
hres = MkParseDisplayName (lpbc, (LPCOLESTR) unidevice, &dwEaten, &audiom);
|
||||||
if (SUCCEEDED (hres)) {
|
if (SUCCEEDED (hres)) {
|
||||||
hres =
|
hres = audiom->BindToObject(lpbc, NULL, IID_IBaseFilter,
|
||||||
IMoniker_BindToObject (audiom, lpbc, NULL, &IID_IBaseFilter,
|
(LPVOID *) &src->audio_cap_filter);
|
||||||
&src->audio_cap_filter);
|
audiom->Release();
|
||||||
IMoniker_Release (audiom);
|
|
||||||
}
|
}
|
||||||
IBindCtx_Release (lpbc);
|
lpbc->Release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -432,21 +425,19 @@ gst_dshowaudiosrc_get_caps (GstBaseSrc * basesrc)
|
||||||
IEnumPins *enumpins = NULL;
|
IEnumPins *enumpins = NULL;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
hres = IBaseFilter_EnumPins (src->audio_cap_filter, &enumpins);
|
hres = src->audio_cap_filter->EnumPins(&enumpins);
|
||||||
if (SUCCEEDED (hres)) {
|
if (SUCCEEDED (hres)) {
|
||||||
while (IEnumPins_Next (enumpins, 1, &capture_pin, NULL) == S_OK) {
|
while (enumpins->Next(1, &capture_pin, NULL) == S_OK) {
|
||||||
IKsPropertySet *pKs = NULL;
|
IKsPropertySet *pKs = NULL;
|
||||||
|
|
||||||
hres =
|
hres = capture_pin->QueryInterface(IID_IKsPropertySet, (LPVOID *) &pKs);
|
||||||
IPin_QueryInterface (capture_pin, &IID_IKsPropertySet,
|
|
||||||
(void **) &pKs);
|
|
||||||
if (SUCCEEDED (hres) && pKs) {
|
if (SUCCEEDED (hres) && pKs) {
|
||||||
DWORD cbReturned;
|
DWORD cbReturned;
|
||||||
GUID pin_category;
|
GUID pin_category;
|
||||||
RPC_STATUS rpcstatus;
|
RPC_STATUS rpcstatus;
|
||||||
|
|
||||||
hres =
|
hres =
|
||||||
IKsPropertySet_Get (pKs, &ROPSETID_Pin,
|
pKs->Get(AMPROPSETID_Pin,
|
||||||
AMPROPERTY_PIN_CATEGORY, NULL, 0, &pin_category, sizeof (GUID),
|
AMPROPERTY_PIN_CATEGORY, NULL, 0, &pin_category, sizeof (GUID),
|
||||||
&cbReturned);
|
&cbReturned);
|
||||||
|
|
||||||
|
@ -455,19 +446,18 @@ gst_dshowaudiosrc_get_caps (GstBaseSrc * basesrc)
|
||||||
&rpcstatus) == 0) {
|
&rpcstatus) == 0) {
|
||||||
IAMStreamConfig *streamcaps = NULL;
|
IAMStreamConfig *streamcaps = NULL;
|
||||||
|
|
||||||
if (SUCCEEDED (IPin_QueryInterface (capture_pin,
|
if (SUCCEEDED (capture_pin->QueryInterface(IID_IAMStreamConfig, (LPVOID *) &streamcaps))) {
|
||||||
&IID_IAMStreamConfig, (void **) &streamcaps))) {
|
|
||||||
src->caps =
|
src->caps =
|
||||||
gst_dshowaudiosrc_getcaps_from_streamcaps (src, capture_pin,
|
gst_dshowaudiosrc_getcaps_from_streamcaps (src, capture_pin,
|
||||||
streamcaps);
|
streamcaps);
|
||||||
IAMStreamConfig_Release (streamcaps);
|
streamcaps->Release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
IKsPropertySet_Release (pKs);
|
pKs->Release();
|
||||||
}
|
}
|
||||||
IPin_Release (capture_pin);
|
capture_pin->Release();
|
||||||
}
|
}
|
||||||
IEnumPins_Release (enumpins);
|
enumpins->Release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -495,7 +485,7 @@ gst_dshowaudiosrc_change_state (GstElement * element, GstStateChange transition)
|
||||||
break;
|
break;
|
||||||
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
||||||
if (src->media_filter)
|
if (src->media_filter)
|
||||||
hres = IMediaFilter_Run (src->media_filter, 0);
|
hres = src->media_filter->Run(0);
|
||||||
if (hres != S_OK) {
|
if (hres != S_OK) {
|
||||||
GST_CAT_ERROR (dshowaudiosrc_debug,
|
GST_CAT_ERROR (dshowaudiosrc_debug,
|
||||||
"Can't RUN the directshow capture graph (error=%d)", hres);
|
"Can't RUN the directshow capture graph (error=%d)", hres);
|
||||||
|
@ -507,7 +497,7 @@ gst_dshowaudiosrc_change_state (GstElement * element, GstStateChange transition)
|
||||||
break;
|
break;
|
||||||
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
||||||
if (src->media_filter)
|
if (src->media_filter)
|
||||||
hres = IMediaFilter_Stop (src->media_filter);
|
hres = src->media_filter->Stop();
|
||||||
if (hres != S_OK) {
|
if (hres != S_OK) {
|
||||||
GST_CAT_ERROR (dshowaudiosrc_debug,
|
GST_CAT_ERROR (dshowaudiosrc_debug,
|
||||||
"Can't STOP the directshow capture graph (error=%d)", hres);
|
"Can't STOP the directshow capture graph (error=%d)", hres);
|
||||||
|
@ -533,8 +523,8 @@ gst_dshowaudiosrc_open (GstAudioSrc * asrc)
|
||||||
HRESULT hres = S_FALSE;
|
HRESULT hres = S_FALSE;
|
||||||
GstDshowAudioSrc *src = GST_DSHOWAUDIOSRC (asrc);
|
GstDshowAudioSrc *src = GST_DSHOWAUDIOSRC (asrc);
|
||||||
|
|
||||||
hres = CoCreateInstance (&CLSID_FilterGraph, NULL, CLSCTX_INPROC,
|
hres = CoCreateInstance (CLSID_FilterGraph, NULL, CLSCTX_INPROC,
|
||||||
&IID_IFilterGraph, (LPVOID *) & src->filter_graph);
|
IID_IFilterGraph, (LPVOID *) & src->filter_graph);
|
||||||
if (hres != S_OK || !src->filter_graph) {
|
if (hres != S_OK || !src->filter_graph) {
|
||||||
GST_CAT_ERROR (dshowaudiosrc_debug,
|
GST_CAT_ERROR (dshowaudiosrc_debug,
|
||||||
"Can't create an instance of the directshow graph manager (error=%d)",
|
"Can't create an instance of the directshow graph manager (error=%d)",
|
||||||
|
@ -542,8 +532,7 @@ gst_dshowaudiosrc_open (GstAudioSrc * asrc)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
hres = IFilterGraph_QueryInterface (src->filter_graph, &IID_IMediaFilter,
|
hres = src->filter_graph->QueryInterface(IID_IMediaFilter, (LPVOID *) &src->media_filter);
|
||||||
(void **) &src->media_filter);
|
|
||||||
if (hres != S_OK || !src->media_filter) {
|
if (hres != S_OK || !src->media_filter) {
|
||||||
GST_CAT_ERROR (dshowaudiosrc_debug,
|
GST_CAT_ERROR (dshowaudiosrc_debug,
|
||||||
"Can't get IMediacontrol interface from the graph manager (error=%d)",
|
"Can't get IMediacontrol interface from the graph manager (error=%d)",
|
||||||
|
@ -551,17 +540,15 @@ gst_dshowaudiosrc_open (GstAudioSrc * asrc)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
hres = CoCreateInstance (&CLSID_DshowFakeSink, NULL, CLSCTX_INPROC,
|
hres = CoCreateInstance (CLSID_DshowFakeSink, NULL, CLSCTX_INPROC,
|
||||||
&IID_IBaseFilter, (LPVOID *) & src->dshow_fakesink);
|
IID_IBaseFilter, (LPVOID *) & src->dshow_fakesink);
|
||||||
if (hres != S_OK || !src->dshow_fakesink) {
|
if (hres != S_OK || !src->dshow_fakesink) {
|
||||||
GST_CAT_ERROR (dshowaudiosrc_debug,
|
GST_CAT_ERROR (dshowaudiosrc_debug,
|
||||||
"Can't create an instance of the directshow fakesink (error=%d)", hres);
|
"Can't create an instance of the directshow fakesink (error=%d)", hres);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
hres =
|
hres = src->filter_graph->AddFilter(src->audio_cap_filter, L"capture");
|
||||||
IFilterGraph_AddFilter (src->filter_graph, src->audio_cap_filter,
|
|
||||||
L"capture");
|
|
||||||
if (hres != S_OK) {
|
if (hres != S_OK) {
|
||||||
GST_CAT_ERROR (dshowaudiosrc_debug,
|
GST_CAT_ERROR (dshowaudiosrc_debug,
|
||||||
"Can't add the directshow capture filter to the graph (error=%d)",
|
"Can't add the directshow capture filter to the graph (error=%d)",
|
||||||
|
@ -569,9 +556,7 @@ gst_dshowaudiosrc_open (GstAudioSrc * asrc)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
hres =
|
hres = src->filter_graph->AddFilter(src->dshow_fakesink, L"fakesink");
|
||||||
IFilterGraph_AddFilter (src->filter_graph, src->dshow_fakesink,
|
|
||||||
L"fakesink");
|
|
||||||
if (hres != S_OK) {
|
if (hres != S_OK) {
|
||||||
GST_CAT_ERROR (dshowaudiosrc_debug,
|
GST_CAT_ERROR (dshowaudiosrc_debug,
|
||||||
"Can't add our fakesink filter to the graph (error=%d)", hres);
|
"Can't add our fakesink filter to the graph (error=%d)", hres);
|
||||||
|
@ -582,16 +567,16 @@ gst_dshowaudiosrc_open (GstAudioSrc * asrc)
|
||||||
|
|
||||||
error:
|
error:
|
||||||
if (src->dshow_fakesink) {
|
if (src->dshow_fakesink) {
|
||||||
IBaseFilter_Release (src->dshow_fakesink);
|
src->dshow_fakesink->Release();
|
||||||
src->dshow_fakesink = NULL;
|
src->dshow_fakesink = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (src->media_filter) {
|
if (src->media_filter) {
|
||||||
IMediaFilter_Release (src->media_filter);
|
src->media_filter->Release();
|
||||||
src->media_filter = NULL;
|
src->media_filter = NULL;
|
||||||
}
|
}
|
||||||
if (src->filter_graph) {
|
if (src->filter_graph) {
|
||||||
IFilterGraph_Release (src->filter_graph);
|
src->filter_graph->Release();
|
||||||
src->filter_graph = NULL;
|
src->filter_graph = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -628,9 +613,7 @@ gst_dshowaudiosrc_prepare (GstAudioSrc * asrc, GstRingBufferSpec * spec)
|
||||||
if (type) {
|
if (type) {
|
||||||
pin_mediatype = (GstCapturePinMediaType *) type->data;
|
pin_mediatype = (GstCapturePinMediaType *) type->data;
|
||||||
|
|
||||||
hres =
|
hres = src->dshow_fakesink->QueryInterface(IID_IGstDshowInterface, (LPVOID *) &srcinterface);
|
||||||
IBaseFilter_QueryInterface (src->dshow_fakesink,
|
|
||||||
&IID_IGstDshowInterface, (void **) &srcinterface);
|
|
||||||
if (hres != S_OK || !srcinterface) {
|
if (hres != S_OK || !srcinterface) {
|
||||||
GST_CAT_ERROR (dshowaudiosrc_debug,
|
GST_CAT_ERROR (dshowaudiosrc_debug,
|
||||||
"Can't get IGstDshowInterface interface from our dshow fakesink filter (error=%d)",
|
"Can't get IGstDshowInterface interface from our dshow fakesink filter (error=%d)",
|
||||||
|
@ -638,14 +621,12 @@ gst_dshowaudiosrc_prepare (GstAudioSrc * asrc, GstRingBufferSpec * spec)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
IGstDshowInterface_gst_set_media_type (srcinterface,
|
srcinterface->gst_set_media_type(pin_mediatype->mediatype);
|
||||||
pin_mediatype->mediatype);
|
srcinterface->gst_set_buffer_callback(
|
||||||
IGstDshowInterface_gst_set_buffer_callback (srcinterface,
|
(push_buffer_func) gst_dshowaudiosrc_push_buffer, (byte *) src);
|
||||||
(byte *) gst_dshowaudiosrc_push_buffer, (byte *) src);
|
|
||||||
|
|
||||||
if (srcinterface) {
|
if (srcinterface)
|
||||||
IGstDshowInterface_Release (srcinterface);
|
srcinterface->Release();
|
||||||
}
|
|
||||||
|
|
||||||
gst_dshow_get_pin_from_filter (src->dshow_fakesink, PINDIR_INPUT,
|
gst_dshow_get_pin_from_filter (src->dshow_fakesink, PINDIR_INPUT,
|
||||||
&input_pin);
|
&input_pin);
|
||||||
|
@ -655,10 +636,9 @@ gst_dshowaudiosrc_prepare (GstAudioSrc * asrc, GstRingBufferSpec * spec)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
hres =
|
hres = src->filter_graph->ConnectDirect(pin_mediatype->capture_pin,
|
||||||
IFilterGraph_ConnectDirect (src->filter_graph,
|
input_pin, NULL);
|
||||||
pin_mediatype->capture_pin, input_pin, NULL);
|
input_pin->Release();
|
||||||
IPin_Release (input_pin);
|
|
||||||
|
|
||||||
if (hres != S_OK) {
|
if (hres != S_OK) {
|
||||||
GST_CAT_ERROR (dshowaudiosrc_debug,
|
GST_CAT_ERROR (dshowaudiosrc_debug,
|
||||||
|
@ -676,9 +656,8 @@ gst_dshowaudiosrc_prepare (GstAudioSrc * asrc, GstRingBufferSpec * spec)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
if (srcinterface) {
|
if (srcinterface)
|
||||||
IGstDshowInterface_Release (srcinterface);
|
srcinterface->Release();
|
||||||
}
|
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -694,14 +673,14 @@ gst_dshowaudiosrc_unprepare (GstAudioSrc * asrc)
|
||||||
gst_dshow_get_pin_from_filter (src->audio_cap_filter, PINDIR_OUTPUT,
|
gst_dshow_get_pin_from_filter (src->audio_cap_filter, PINDIR_OUTPUT,
|
||||||
&output_pin);
|
&output_pin);
|
||||||
if (output_pin) {
|
if (output_pin) {
|
||||||
hres = IFilterGraph_Disconnect (src->filter_graph, output_pin);
|
hres = src->filter_graph->Disconnect(output_pin);
|
||||||
IPin_Release (output_pin);
|
output_pin->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_dshow_get_pin_from_filter (src->dshow_fakesink, PINDIR_INPUT, &input_pin);
|
gst_dshow_get_pin_from_filter (src->dshow_fakesink, PINDIR_INPUT, &input_pin);
|
||||||
if (input_pin) {
|
if (input_pin) {
|
||||||
hres = IFilterGraph_Disconnect (src->filter_graph, input_pin);
|
hres = src->filter_graph->Disconnect(input_pin);
|
||||||
IPin_Release (input_pin);
|
input_pin->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -716,19 +695,19 @@ gst_dshowaudiosrc_close (GstAudioSrc * asrc)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
/*remove filters from the graph */
|
/*remove filters from the graph */
|
||||||
IFilterGraph_RemoveFilter (src->filter_graph, src->audio_cap_filter);
|
src->filter_graph->RemoveFilter(src->audio_cap_filter);
|
||||||
IFilterGraph_RemoveFilter (src->filter_graph, src->dshow_fakesink);
|
src->filter_graph->RemoveFilter(src->dshow_fakesink);
|
||||||
|
|
||||||
/*release our gstreamer dshow sink */
|
/*release our gstreamer dshow sink */
|
||||||
IBaseFilter_Release (src->dshow_fakesink);
|
src->dshow_fakesink->Release();
|
||||||
src->dshow_fakesink = NULL;
|
src->dshow_fakesink = NULL;
|
||||||
|
|
||||||
/*release media filter interface */
|
/*release media filter interface */
|
||||||
IMediaFilter_Release (src->media_filter);
|
src->media_filter->Release();
|
||||||
src->media_filter = NULL;
|
src->media_filter = NULL;
|
||||||
|
|
||||||
/*release the filter graph manager */
|
/*release the filter graph manager */
|
||||||
IFilterGraph_Release (src->filter_graph);
|
src->filter_graph->Release();
|
||||||
src->filter_graph = NULL;
|
src->filter_graph = NULL;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -805,7 +784,7 @@ gst_dshowaudiosrc_getcaps_from_streamcaps (GstDshowAudioSrc * src, IPin * pin,
|
||||||
if (!streamcaps)
|
if (!streamcaps)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
IAMStreamConfig_GetNumberOfCapabilities (streamcaps, &icount, &isize);
|
streamcaps->GetNumberOfCapabilities(&icount, &isize);
|
||||||
|
|
||||||
if (isize != sizeof (ascc))
|
if (isize != sizeof (ascc))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -813,11 +792,10 @@ gst_dshowaudiosrc_getcaps_from_streamcaps (GstDshowAudioSrc * src, IPin * pin,
|
||||||
for (; i < icount; i++) {
|
for (; i < icount; i++) {
|
||||||
GstCapturePinMediaType *pin_mediatype = g_new0 (GstCapturePinMediaType, 1);
|
GstCapturePinMediaType *pin_mediatype = g_new0 (GstCapturePinMediaType, 1);
|
||||||
|
|
||||||
IPin_AddRef (pin);
|
pin->AddRef();
|
||||||
pin_mediatype->capture_pin = pin;
|
pin_mediatype->capture_pin = pin;
|
||||||
|
|
||||||
hres =
|
hres = streamcaps->GetStreamCaps(i, &pin_mediatype->mediatype,
|
||||||
IAMStreamConfig_GetStreamCaps (streamcaps, i, &pin_mediatype->mediatype,
|
|
||||||
(BYTE *) & ascc);
|
(BYTE *) & ascc);
|
||||||
if (hres == S_OK && pin_mediatype->mediatype) {
|
if (hres == S_OK && pin_mediatype->mediatype) {
|
||||||
GstCaps *mediacaps = NULL;
|
GstCaps *mediacaps = NULL;
|
|
@ -224,7 +224,7 @@
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\sys\dshowsrcwrapper\gstdshowaudiosrc.c"
|
RelativePath="..\..\sys\dshowsrcwrapper\gstdshowaudiosrc.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
|
|
Loading…
Reference in a new issue