comparison src/audacious/playlist.c @ 3780:ec989c2cde74

Make selective subtunes support actually work.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 18 Oct 2007 01:30:05 +0300
parents b4fe7d2a0d0d
children a3fc112b10f1
comparison
equal deleted inserted replaced
3779:7f42752acf4d 3780:ec989c2cde74
667 Tuple *tuple, 667 Tuple *tuple,
668 InputPlugin * dec) 668 InputPlugin * dec)
669 { 669 {
670 PlaylistEntry *entry; 670 PlaylistEntry *entry;
671 Tuple *parent_tuple = NULL; 671 Tuple *parent_tuple = NULL;
672 gint nsubtunes = 0, i = 0; 672 gint nsubtunes, subtune;
673 gboolean add_flag = TRUE; 673 gboolean add_flag = TRUE;
674 674
675 g_return_if_fail(playlist != NULL); 675 g_return_if_fail(playlist != NULL);
676 g_return_if_fail(filename != NULL); 676 g_return_if_fail(filename != NULL);
677 677
678 if (tuple != NULL) { 678 if (tuple != NULL) {
679 nsubtunes = tuple->nsubtunes; 679 nsubtunes = tuple->nsubtunes;
680 if (nsubtunes > 0) { 680 if (nsubtunes > 0)
681 parent_tuple = tuple; 681 parent_tuple = tuple;
682 i = 1; 682 } else
683 } 683 nsubtunes = 0;
684 } 684
685 685 for (subtune = 0; add_flag && subtune < nsubtunes; subtune++) {
686 for (; add_flag && i <= nsubtunes; i++) {
687 gchar *filename_entry; 686 gchar *filename_entry;
688 687
689 if (nsubtunes > 0) { 688 if (nsubtunes > 0) {
690 filename_entry = g_strdup_printf("%s?%d", filename, 689 filename_entry = g_strdup_printf("%s?%d", filename,
691 parent_tuple->subtunes ? parent_tuple->subtunes[i] : i); 690 parent_tuple->subtunes ? parent_tuple->subtunes[subtune] : subtune + 1);
692 691
693 /* We're dealing with subtune, let's ask again tuple information 692 /* We're dealing with subtune, let's ask again tuple information
694 * to plugin, by passing the ?subtune suffix; this way we get 693 * to plugin, by passing the ?subtune suffix; this way we get
695 * specific subtune information in the tuple, if available. 694 * specific subtune information in the tuple, if available.
696 */ 695 */
707 if (!playlist->tail) 706 if (!playlist->tail)
708 playlist->tail = g_list_last(playlist->entries); 707 playlist->tail = g_list_last(playlist->entries);
709 708
710 PLAYLIST_LOCK(playlist); 709 PLAYLIST_LOCK(playlist);
711 710
712 if ((pos == -1) && (i < 2)) { // the common case 711 if (pos == -1 && subtune < 1 && nsubtunes < 1) { // the common case
713 GList *element; 712 GList *element;
714 element = g_list_alloc(); 713 element = g_list_alloc();
715 element->data = entry; 714 element->data = entry;
716 element->prev = playlist->tail; // NULL is allowed here. 715 element->prev = playlist->tail; // NULL is allowed here.
717 element->next = NULL; 716 element->next = NULL;