diff options
author | Julien Isorce <julien.isorce@gmail.com> | 2009-08-10 16:35:36 +0200 |
---|---|---|
committer | Julien Isorce <julien.isorce@gmail.com> | 2009-08-10 16:35:36 +0200 |
commit | 8c37eed49162a3006753de0253d66bab3fabbf9b (patch) | |
tree | 12c1c52ea7dd77386272dd45134c15c6a98563df /sys | |
parent | ae6935e6a39a09c0b66302831e87b8af8b76c014 (diff) |
dshowsrcwrapper: can list more than 1 device
something like the following code now works:
vector<string> getVideoDeviceNames()
{
vector<string> l_name;
string property;
GstElement* videodevicesrc = create_element("dshowvideosrc", "videodevicesrc");
GstPropertyProbe* probe = GST_PROPERTY_PROBE (videodevicesrc);
GValueArray* va = gst_property_probe_get_values_name (probe, "device-name");
if (va)
{
for(size_t i=0; i < va->n_values; ++i)
{
GValue* v = g_value_array_get_nth(va, i);
string name(g_value_get_string(v));
l_name.push_back(name);
}
}
if (videodevicesrc)
gst_object_unref(GST_OBJECT (videodevicesrc));
return l_name;
}
Diffstat (limited to 'sys')
-rwxr-xr-x | sys/dshowsrcwrapper/gstdshowaudiosrc.cpp | 5 | ||||
-rwxr-xr-x | sys/dshowsrcwrapper/gstdshowvideosrc.cpp | 5 |
2 files changed, 4 insertions, 6 deletions
diff --git a/sys/dshowsrcwrapper/gstdshowaudiosrc.cpp b/sys/dshowsrcwrapper/gstdshowaudiosrc.cpp index f16f74789..03dab12de 100755 --- a/sys/dshowsrcwrapper/gstdshowaudiosrc.cpp +++ b/sys/dshowsrcwrapper/gstdshowaudiosrc.cpp @@ -264,15 +264,12 @@ static GValueArray * gst_dshowaudiosrc_get_device_name_values (GstDshowAudioSrc * src) { GValueArray *array = g_value_array_new (0); - GValue value = { 0 }; ICreateDevEnum *devices_enum = NULL; IEnumMoniker *moniker_enum = NULL; IMoniker *moniker = NULL; HRESULT hres = S_FALSE; ULONG fetched; - g_value_init (&value, G_TYPE_STRING); - hres = CoCreateInstance (CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER, IID_ICreateDevEnum, (LPVOID *) &devices_enum); if (hres != S_OK) { @@ -310,6 +307,8 @@ gst_dshowaudiosrc_get_device_name_values (GstDshowAudioSrc * src) g_utf16_to_utf8 ((const gunichar2 *) varFriendlyName.bstrVal, wcslen (varFriendlyName.bstrVal), NULL, NULL, NULL); + GValue value = { 0 };
+ g_value_init (&value, G_TYPE_STRING); g_value_set_string (&value, friendly_name); g_value_array_append (array, &value); g_value_unset (&value); diff --git a/sys/dshowsrcwrapper/gstdshowvideosrc.cpp b/sys/dshowsrcwrapper/gstdshowvideosrc.cpp index 4042408f0..86cb5eb76 100755 --- a/sys/dshowsrcwrapper/gstdshowvideosrc.cpp +++ b/sys/dshowsrcwrapper/gstdshowvideosrc.cpp @@ -353,15 +353,12 @@ static GValueArray * gst_dshowvideosrc_get_device_name_values (GstDshowVideoSrc * src) { GValueArray *array = g_value_array_new (0); - GValue value = { 0 }; ICreateDevEnum *devices_enum = NULL; IEnumMoniker *moniker_enum = NULL; IMoniker *moniker = NULL; HRESULT hres = S_FALSE; ULONG fetched; - g_value_init (&value, G_TYPE_STRING); - hres = CoCreateInstance (CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER, IID_ICreateDevEnum, (LPVOID *) &devices_enum); if (hres != S_OK) { @@ -400,6 +397,8 @@ gst_dshowvideosrc_get_device_name_values (GstDshowVideoSrc * src) g_utf16_to_utf8 ((const gunichar2 *) varFriendlyName.bstrVal, wcslen (varFriendlyName.bstrVal), NULL, NULL, NULL); + GValue value = { 0 };
+ g_value_init (&value, G_TYPE_STRING); g_value_set_string (&value, friendly_name); g_value_array_append (array, &value); g_value_unset (&value); |