summaryrefslogtreecommitdiff
path: root/sys/directsound
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2016-05-02 11:30:43 +0300
committerSebastian Dröge <sebastian@centricular.com>2016-05-03 16:59:33 +0300
commit65398a1596eff5d78d04ad39ee694c52db53f833 (patch)
treee8006114019f58e187076ba3876d90cece2dd576 /sys/directsound
parent619d198a2fc663c07e2e5d1da4f9d2f2452a7373 (diff)
downloadgstreamer-plugins-bad-65398a1596eff5d78d04ad39ee694c52db53f833.tar.gz
directsoundsrc: Convert Windows strings to UTF8 before comparing against UTF8 strings
The device name and descriptions returned are in the locale encoding, not UTF8. Our device name property is in UTF8 though, so we need to convert. https://bugzilla.gnome.org/show_bug.cgi?id=756948
Diffstat (limited to 'sys/directsound')
-rw-r--r--sys/directsound/gstdirectsoundsrc.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/sys/directsound/gstdirectsoundsrc.c b/sys/directsound/gstdirectsoundsrc.c
index e23486dd0..8687e86e3 100644
--- a/sys/directsound/gstdirectsoundsrc.c
+++ b/sys/directsound/gstdirectsoundsrc.c
@@ -339,19 +339,34 @@ gst_directsound_enum_callback (GUID * pGUID, TCHAR * strDesc,
TCHAR * strDrvName, VOID * pContext)
{
GstDirectSoundSrc *dsoundsrc = GST_DIRECTSOUND_SRC (pContext);
+ gchar *driver, *description;
+
+ description = g_locale_to_utf8 (strDesc, -1, NULL, NULL, NULL);
+ if (!description) {
+ GST_ERROR_OBJECT (dsoundsrc,
+ "Failed to convert description from locale encoding to UTF8");
+ return TRUE;
+ }
+
+ driver = g_locale_to_utf8 (strDrvName, -1, NULL, NULL, NULL);
if (pGUID && dsoundsrc && dsoundsrc->device_name &&
- !g_strcmp0 (dsoundsrc->device_name, strDesc)) {
+ !g_strcmp0 (dsoundsrc->device_name, description)) {
g_free (dsoundsrc->device_guid);
dsoundsrc->device_guid = (GUID *) g_malloc0 (sizeof (GUID));
memcpy (dsoundsrc->device_guid, pGUID, sizeof (GUID));
GST_INFO_OBJECT (dsoundsrc, "found the requested audio device :%s",
dsoundsrc->device_name);
+ g_free (description);
+ g_free (driver);
return FALSE;
}
GST_INFO_OBJECT (dsoundsrc, "sound device names: %s, %s, requested device:%s",
- strDesc, strDrvName, dsoundsrc->device_name);
+ description, driver, dsoundsrc->device_name);
+
+ g_free (description);
+ g_free (driver);
return TRUE;
}