[SCM] libgroove/upstream: playlist_get_position: always set seconds even when item is NULL

andrewrk-guest at users.alioth.debian.org andrewrk-guest at users.alioth.debian.org
Wed May 14 02:26:58 UTC 2014


The following commit has been merged in the upstream branch:
commit 3790514a414bea320646bf5c506810685db96e1c
Author: Andrew Kelley <superjoe30 at gmail.com>
Date:   Tue May 13 09:39:52 2014 -0700

    playlist_get_position: always set seconds even when item is NULL

diff --git a/groove/groove.h b/groove/groove.h
index 5a26631..7ce546a 100644
--- a/groove/groove.h
+++ b/groove/groove.h
@@ -217,6 +217,7 @@ void groove_playlist_remove(struct GroovePlaylist *playlist,
 /* get the position of the decode head
  * both the current playlist item and the position in seconds in the playlist
  * item are given. item will be set to NULL if the playlist is empty
+ * seconds will be set to -1.0 if item is NULL.
  * you may pass NULL for item or seconds
  * Note that typically you are more interested in the position of the play
  * head, not the decode head. For example, if you have a GroovePlayer attached,
diff --git a/groove/playlist.c b/groove/playlist.c
index 4a636fc..4e887fc 100644
--- a/groove/playlist.c
+++ b/groove/playlist.c
@@ -1216,10 +1216,14 @@ void groove_playlist_position(struct GroovePlaylist *playlist, struct GroovePlay
     if (item)
         *item = p->decode_head;
 
-    if (seconds && p->decode_head) {
-        struct GrooveFile *file = p->decode_head->file;
-        struct GrooveFilePrivate *f = (struct GrooveFilePrivate *) file;
-        *seconds = f->audio_clock;
+    if (seconds) {
+        if (p->decode_head) {
+            struct GrooveFile *file = p->decode_head->file;
+            struct GrooveFilePrivate *f = (struct GrooveFilePrivate *) file;
+            *seconds = f->audio_clock;
+        } else {
+            *seconds = -1.0;
+        }
     }
     pthread_mutex_unlock(&p->decode_head_mutex);
 }

-- 
libgroove packaging



More information about the pkg-multimedia-commits mailing list