[SCM] libgroove/upstream: playlist: rename some variables for clearer code

andrewrk-guest at users.alioth.debian.org andrewrk-guest at users.alioth.debian.org
Sat May 31 19:00:02 UTC 2014


The following commit has been merged in the upstream branch:
commit a3575af19662f6da201c18613c57e8db32abd15d
Author: Andrew Kelley <superjoe30 at gmail.com>
Date:   Sun May 25 14:39:07 2014 -0700

    playlist: rename some variables for clearer code

diff --git a/groove/playlist.c b/groove/playlist.c
index 5cb1383..ead4980 100644
--- a/groove/playlist.c
+++ b/groove/playlist.c
@@ -709,15 +709,21 @@ static void *decode_thread(void *arg) {
     return NULL;
 }
 
-static int sink_formats_equal(const struct GrooveSink *a, const struct GrooveSink *b) {
-    if (b->buffer_sample_count != 0 && a->buffer_sample_count != b->buffer_sample_count)
+static int sink_formats_compatible(const struct GrooveSink *example_sink,
+        const struct GrooveSink *test_sink)
+{
+    // buffer_sample_count 0 means we don't care
+    if (test_sink->buffer_sample_count != 0 &&
+            example_sink->buffer_sample_count != test_sink->buffer_sample_count)
+    {
         return 0;
-    if (a->gain != b->gain)
+    }
+    if (example_sink->gain != test_sink->gain)
         return 0;
-    if (!b->disable_resample &&
-        (a->audio_format.sample_rate != b->audio_format.sample_rate ||
-        a->audio_format.channel_layout != b->audio_format.channel_layout ||
-        a->audio_format.sample_fmt != b->audio_format.sample_fmt))
+    if (!test_sink->disable_resample &&
+        (example_sink->audio_format.sample_rate != test_sink->audio_format.sample_rate ||
+        example_sink->audio_format.channel_layout != test_sink->audio_format.channel_layout ||
+        example_sink->audio_format.sample_fmt != test_sink->audio_format.sample_fmt))
     {
         return 0;
     }
@@ -781,14 +787,14 @@ static int add_sink_to_map(struct GroovePlaylist *playlist, struct GrooveSink *s
         // if our sink matches the example sink from this map entry,
         // push our sink onto the stack and we're done
         struct GrooveSink *example_sink = map_item->stack_head->sink;
-        if (sink_formats_equal(example_sink, sink)) {
+        if (sink_formats_compatible(example_sink, sink)) {
             stack_entry->next = map_item->stack_head->next;
             map_item->stack_head->next = stack_entry;
             return 0;
         }
         // maybe we need to swap the example sink with the new sink to make
         // it work
-        if (sink_formats_equal(sink, example_sink)) {
+        if (sink_formats_compatible(sink, example_sink)) {
             stack_entry->next = map_item->stack_head;
             map_item->stack_head = stack_entry;
             return 0;

-- 
libgroove packaging



More information about the pkg-multimedia-commits mailing list