comparison src/audacious/playlist.c @ 3633:8c4633438785

Implement selective adding of subtunes.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 25 Sep 2007 22:34:52 +0300
parents 2d6106656276
children b20e98407a30
comparison
equal deleted inserted replaced
3627:9038c338ebc2 3633:8c4633438785
671 gint pos, 671 gint pos,
672 Tuple *tuple, 672 Tuple *tuple,
673 InputPlugin * dec) 673 InputPlugin * dec)
674 { 674 {
675 PlaylistEntry *entry; 675 PlaylistEntry *entry;
676 Tuple *main_tuple = NULL;
676 gint subtunes_num = 0, i = 0; 677 gint subtunes_num = 0, i = 0;
677 678
678 g_return_if_fail(playlist != NULL); 679 g_return_if_fail(playlist != NULL);
679 g_return_if_fail(filename != NULL); 680 g_return_if_fail(filename != NULL);
680 681
681 if (tuple != NULL) 682 if (tuple != NULL)
682 { 683 {
683 subtunes_num = tuple_get_int(tuple, FIELD_SUBSONG_NUM, NULL); 684 subtunes_num = tuple->nsubtunes;
684 if (subtunes_num > 0) 685 if (subtunes_num > 0)
685 { 686 {
687 main_tuple = tuple;
686 i = 1; 688 i = 1;
687 tuple_free(tuple); /* will be replaced by subtune tuples */
688 } 689 }
689 } 690 }
690 691
691 for (; i <= subtunes_num; i++) 692 for (; i <= subtunes_num; i++)
692 { 693 {
693 gchar *filename_entry; 694 gchar *filename_entry;
694 if (subtunes_num > 0) 695 if (subtunes_num > 0)
695 { 696 {
696 filename_entry = g_strdup_printf("%s?%d", filename, i); 697 filename_entry = g_strdup_printf("%s?%d", filename, main_tuple->subtunes[i]);
697 /* we're dealing with subtune, let's ask again tuple information 698 /* we're dealing with subtune, let's ask again tuple information
698 to plugin, by passing the ?subsong suffix; this way we may get 699 to plugin, by passing the ?subsong suffix; this way we may get
699 specific subtune information in the tuple, if available */ 700 specific subtune information in the tuple, if available */
700 tuple = dec->get_song_tuple(filename_entry); 701 tuple = dec->get_song_tuple(filename_entry);
701 } 702 }
742 formatter : get_gentitle_format()); 743 formatter : get_gentitle_format());
743 entry->length = tuple_get_int(tuple, FIELD_LENGTH, NULL); 744 entry->length = tuple_get_int(tuple, FIELD_LENGTH, NULL);
744 entry->tuple = tuple; 745 entry->tuple = tuple;
745 } 746 }
746 } 747 }
748
749 if (main_tuple)
750 tuple_free(main_tuple);
747 751
748 if(tuple != NULL && tuple_get_int(tuple, FIELD_MTIME, NULL) == -1) { // kick the scanner thread only if mtime = -1 (uninitialized). 752 if(tuple != NULL && tuple_get_int(tuple, FIELD_MTIME, NULL) == -1) { // kick the scanner thread only if mtime = -1 (uninitialized).
749 g_mutex_lock(mutex_scan); 753 g_mutex_lock(mutex_scan);
750 playlist_get_info_scan_active = TRUE; 754 playlist_get_info_scan_active = TRUE;
751 g_mutex_unlock(mutex_scan); 755 g_mutex_unlock(mutex_scan);