changeset 3633:8c4633438785

Implement selective adding of subtunes.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 25 Sep 2007 22:34:52 +0300
parents 9038c338ebc2
children 1f7c00c1de22
files src/audacious/playlist.c src/audacious/tuple.c src/audacious/tuple.h
diffstat 3 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/playlist.c	Tue Sep 25 20:51:50 2007 +0930
+++ b/src/audacious/playlist.c	Tue Sep 25 22:34:52 2007 +0300
@@ -673,6 +673,7 @@
 			       InputPlugin * dec)
 {
     PlaylistEntry *entry;
+    Tuple *main_tuple = NULL;
     gint subtunes_num = 0, i = 0;
 
     g_return_if_fail(playlist != NULL);
@@ -680,11 +681,11 @@
 
     if (tuple != NULL)
     {
-        subtunes_num = tuple_get_int(tuple, FIELD_SUBSONG_NUM, NULL);
+        subtunes_num = tuple->nsubtunes;
         if (subtunes_num > 0)
         {
+            main_tuple = tuple;
             i = 1;
-            tuple_free(tuple); /* will be replaced by subtune tuples */
         }
     }
 
@@ -693,7 +694,7 @@
         gchar *filename_entry;
         if (subtunes_num > 0)
         {
-            filename_entry = g_strdup_printf("%s?%d", filename, i);
+            filename_entry = g_strdup_printf("%s?%d", filename, main_tuple->subtunes[i]);
             /* we're dealing with subtune, let's ask again tuple information
                to plugin, by passing the ?subsong suffix; this way we may get
                specific subtune information in the tuple, if available */
@@ -744,6 +745,9 @@
             entry->tuple = tuple;
         }
     }
+    
+    if (main_tuple)
+        tuple_free(main_tuple);
 
     if(tuple != NULL && tuple_get_int(tuple, FIELD_MTIME, NULL) == -1) { // kick the scanner thread only if mtime = -1 (uninitialized).
         g_mutex_lock(mutex_scan);
--- a/src/audacious/tuple.c	Tue Sep 25 20:51:50 2007 +0930
+++ b/src/audacious/tuple.c	Tue Sep 25 22:34:52 2007 +0300
@@ -112,6 +112,8 @@
             mowgli_heap_free(tuple_value_heap, value);
         }
     
+    g_free(tuple->subtunes);
+    
     mowgli_heap_free(tuple_heap, tuple);
     TUPLE_UNLOCK_WRITE();
 }
--- a/src/audacious/tuple.h	Tue Sep 25 20:51:50 2007 +0930
+++ b/src/audacious/tuple.h	Tue Sep 25 22:34:52 2007 +0300
@@ -82,6 +82,8 @@
     mowgli_object_t parent;
     mowgli_dictionary_t *dict;
     TupleValue *values[FIELD_LAST];
+    gint nsubtunes;
+    gint *subtunes;
 } Tuple;