GNOME Bugzilla – Bug 753670
directsoundsink: allow specifying audio playback device
Last modified: 2015-08-17 11:58:22 UTC
This is a very simple patch that only allows you to set the device id for the directsoundsink, so you can use it with an audio device of the user's choosing. I've gutted the patch at https://bugzilla.gnome.org/show_bug.cgi?id=584980 even further, and created a patch and tested against 1.4.5. It applies cleanly against 1.5.2, I can't imagine it wouldn't work for it. Tested with: gst-launch.exe playbin uri=file:///c:/tmp/jaq.mp3 audio-sink="directsoundsink device="{BB7E6F52-BAAD-40FB-9946-F733C352C6A8}"" If you want to get your own guids and try it out, I wrote a python script to retrieve them: https://gist.github.com/virtuald/bacc4bafabf267a0831e I just noticed that someone added a functionality to the directsoundsrc (https://bugzilla.gnome.org/show_bug.cgi?id=706574) to do something similar, but that one sets the device by name. IMHO that's the wrong approach, as the name is human readable and is definitely not unique. This patch allows you to set the device id by GUID, which should be reasonably unique. At some point someone will care enough about this to implement the GstDeviceMonitor et al, but that time is not now.
Created attachment 309344 [details] [review] Patch
Review of attachment 309344 [details] [review]: Looks good, just a small style related comment ::: sys/directsound/gstdirectsoundsink.c @@ +413,3 @@ + return NULL; + + out = g_malloc (sizeof (GUID)); You could also use g_new(GUID, 1) @@ +442,3 @@ DXGetErrorString9 (hRes)), (NULL)); + if (lpGuid) + g_free (lpGuid); g_free() is NULL-safe, you can call it with NULL. Also in other places @@ +943,3 @@ + g_free (dsoundsink->device_id); + } + dsoundsink->device_id = g_strdup (device_id); g_strdup0(). device_id might be NULL
Created attachment 309377 [details] [review] Patch g_strdup0 doesn't exist, but I fixed the g_free issues mentioned.
commit 5c680333ba676d86dfd66ca4e12e87868bef67f6 Author: Dustin Spicuzza <dustin@virtualroadside.com> Date: Sun Aug 16 15:21:51 2015 -0400 directsoundsink: allow specifying audio playback device https://bugzilla.gnome.org/show_bug.cgi?id=753670