[SCM] libgroove/upstream: player: specify device by index rather than name. closes #44

andrewrk-guest at users.alioth.debian.org andrewrk-guest at users.alioth.debian.org
Tue May 13 03:19:10 UTC 2014


The following commit has been merged in the upstream branch:
commit f96a2cfb5d5575b4c9ddc25f7cb7767337ca03b6
Author: Andrew Kelley <superjoe30 at gmail.com>
Date:   Sun May 11 14:23:57 2014 -0700

    player: specify device by index rather than name. closes #44

diff --git a/grooveplayer/player.c b/grooveplayer/player.c
index d1b883d..c3aedc8 100644
--- a/grooveplayer/player.c
+++ b/grooveplayer/player.c
@@ -246,7 +246,8 @@ int groove_player_attach(struct GroovePlayer *player, struct GroovePlaylist *pla
     wanted_spec.callback = sdl_audio_callback;
     wanted_spec.userdata = player;
 
-    p->device_id = SDL_OpenAudioDevice(player->device_name, 0, &wanted_spec,
+    const char* device_name = SDL_GetAudioDeviceName(player->device_index, 0);
+    p->device_id = SDL_OpenAudioDevice(device_name, 0, &wanted_spec,
             &spec, SDL_AUDIO_ALLOW_ANY_CHANGE);
     if (p->device_id == 0) {
         av_log(NULL, AV_LOG_ERROR, "unable to open audio device: %s\n", SDL_GetError());
diff --git a/grooveplayer/player.h b/grooveplayer/player.h
index 5104ef2..652ec90 100644
--- a/grooveplayer/player.h
+++ b/grooveplayer/player.h
@@ -31,9 +31,10 @@ union GroovePlayerEvent {
 
 struct GroovePlayer {
     /* set this to the device you want to open
-     * NULL means default device
+     * -1 means default device
+     * -2 means dummy device
      */
-    char *device_name;
+    int device_index;
 
     /* The desired audio format settings with which to open the device.
      * groove_player_create defaults these to 44100 Hz,

-- 
libgroove packaging



More information about the pkg-multimedia-commits mailing list