# HG changeset patch # User Matti Hamalainen # Date 1190748892 -10800 # Node ID 8c463343878562b516eccfbc00e483d1083a5daf # Parent 9038c338ebc250667356c01589c3d8d870c1f077 Implement selective adding of subtunes. diff -r 9038c338ebc2 -r 8c4633438785 src/audacious/playlist.c --- 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); diff -r 9038c338ebc2 -r 8c4633438785 src/audacious/tuple.c --- 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(); } diff -r 9038c338ebc2 -r 8c4633438785 src/audacious/tuple.h --- 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;