After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 753670 - directsoundsink: allow specifying audio playback device
directsoundsink: allow specifying audio playback device
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
1.5.2
Other Linux
: Normal enhancement
: 1.5.90
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-08-16 03:20 UTC by Dustin Spicuzza
Modified: 2015-08-17 11:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch (6.83 KB, patch)
2015-08-16 03:23 UTC, Dustin Spicuzza
none Details | Review
Patch (6.71 KB, patch)
2015-08-16 19:28 UTC, Dustin Spicuzza
committed Details | Review

Description Dustin Spicuzza 2015-08-16 03:20:46 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.
Comment 1 Dustin Spicuzza 2015-08-16 03:23:06 UTC
Created attachment 309344 [details] [review]
Patch
Comment 2 Sebastian Dröge (slomo) 2015-08-16 09:32:17 UTC
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
Comment 3 Dustin Spicuzza 2015-08-16 19:28:11 UTC
Created attachment 309377 [details] [review]
Patch

g_strdup0 doesn't exist, but I fixed the g_free issues mentioned.
Comment 4 Sebastian Dröge (slomo) 2015-08-17 11:58:22 UTC
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