Mercurial > audlegacy
comparison src/audacious/playlist.c @ 3923:e9fd46b0893b
- redefine playlist_incr_serial as a macro.
- refine serial notification.
author | Yoshiki Yazawa <yaz@cc.rim.or.jp> |
---|---|
date | Sat, 10 Nov 2007 15:55:12 +0900 |
parents | 23e5b148ae7c |
children | e924c9ee3958 |
comparison
equal
deleted
inserted
replaced
3922:23e5b148ae7c | 3923:e9fd46b0893b |
---|---|
141 | 141 |
142 static void playlist_recalc_total_time_nolock(Playlist *); | 142 static void playlist_recalc_total_time_nolock(Playlist *); |
143 static void playlist_recalc_total_time(Playlist *); | 143 static void playlist_recalc_total_time(Playlist *); |
144 static gboolean playlist_entry_get_info(PlaylistEntry * entry); | 144 static gboolean playlist_entry_get_info(PlaylistEntry * entry); |
145 | 145 |
146 static void playlist_incr_serial(Playlist *playlist); | |
147 | |
148 static mowgli_heap_t *playlist_entry_heap = NULL; | 146 static mowgli_heap_t *playlist_entry_heap = NULL; |
149 | 147 |
150 /* *********************** playlist entry code ********************** */ | 148 /* *********************** playlist entry code ********************** */ |
151 | 149 |
152 PlaylistEntry * | 150 PlaylistEntry * |
466 | 464 |
467 playlist_clear_only(playlist); | 465 playlist_clear_only(playlist); |
468 playlist_generate_shuffle_list(playlist); | 466 playlist_generate_shuffle_list(playlist); |
469 playlistwin_update_list(playlist); | 467 playlistwin_update_list(playlist); |
470 playlist_recalc_total_time(playlist); | 468 playlist_recalc_total_time(playlist); |
471 playlist_incr_serial(playlist); | 469 PLAYLIST_INCR_SERIAL(playlist); |
472 playlist_manager_update(); | 470 playlist_manager_update(); |
473 } | 471 } |
474 | 472 |
475 static void | 473 static void |
476 playlist_delete_node(Playlist * playlist, GList * node, gboolean * set_info_text, | 474 playlist_delete_node(Playlist * playlist, GList * node, gboolean * set_info_text, |
526 playlist->tail = g_list_last(playlist->entries); | 524 playlist->tail = g_list_last(playlist->entries); |
527 playlist_entry_free(entry); | 525 playlist_entry_free(entry); |
528 g_list_free_1(node); | 526 g_list_free_1(node); |
529 | 527 |
530 playlist_recalc_total_time_nolock(playlist); | 528 playlist_recalc_total_time_nolock(playlist); |
531 playlist_incr_serial(playlist); | 529 PLAYLIST_INCR_SERIAL(playlist); |
532 } | 530 } |
533 | 531 |
534 void | 532 void |
535 playlist_delete_index(Playlist *playlist, guint pos) | 533 playlist_delete_index(Playlist *playlist, guint pos) |
536 { | 534 { |
552 playlist_delete_node(playlist, node, &set_info_text, &restart_playing); | 550 playlist_delete_node(playlist, node, &set_info_text, &restart_playing); |
553 | 551 |
554 PLAYLIST_UNLOCK(playlist); | 552 PLAYLIST_UNLOCK(playlist); |
555 | 553 |
556 playlist_recalc_total_time(playlist); | 554 playlist_recalc_total_time(playlist); |
557 playlist_incr_serial(playlist); | 555 PLAYLIST_INCR_SERIAL(playlist); |
558 | 556 |
559 playlistwin_update_list(playlist); | 557 playlistwin_update_list(playlist); |
560 if (restart_playing) { | 558 if (restart_playing) { |
561 if (playlist->position) | 559 if (playlist->position) |
562 playback_initiate(); | 560 playback_initiate(); |
590 } | 588 } |
591 | 589 |
592 PLAYLIST_UNLOCK(playlist); | 590 PLAYLIST_UNLOCK(playlist); |
593 | 591 |
594 playlist_recalc_total_time(playlist); | 592 playlist_recalc_total_time(playlist); |
595 playlist_incr_serial(playlist); | 593 PLAYLIST_INCR_SERIAL(playlist); |
596 playlistwin_update_list(playlist); | 594 playlistwin_update_list(playlist); |
597 | 595 |
598 if (restart_playing) { | 596 if (restart_playing) { |
599 if (playlist->position) | 597 if (playlist->position) |
600 playback_initiate(); | 598 playback_initiate(); |
631 } | 629 } |
632 | 630 |
633 PLAYLIST_UNLOCK(playlist); | 631 PLAYLIST_UNLOCK(playlist); |
634 | 632 |
635 playlist_recalc_total_time(playlist); | 633 playlist_recalc_total_time(playlist); |
636 playlist_incr_serial(playlist); | 634 PLAYLIST_INCR_SERIAL(playlist); |
637 | 635 |
638 if (restart_playing) { | 636 if (restart_playing) { |
639 if (playlist->position) | 637 if (playlist->position) |
640 playback_initiate(); | 638 playback_initiate(); |
641 else | 639 else |
664 | 662 |
665 g_mutex_lock(mutex_scan); | 663 g_mutex_lock(mutex_scan); |
666 playlist_get_info_scan_active = TRUE; | 664 playlist_get_info_scan_active = TRUE; |
667 g_mutex_unlock(mutex_scan); | 665 g_mutex_unlock(mutex_scan); |
668 g_cond_signal(cond_scan); | 666 g_cond_signal(cond_scan); |
667 PLAYLIST_INCR_SERIAL(playlist); | |
669 } | 668 } |
670 | 669 |
671 static void | 670 static void |
672 __playlist_ins_with_info_tuple(Playlist * playlist, | 671 __playlist_ins_with_info_tuple(Playlist * playlist, |
673 const gchar * filename, | 672 const gchar * filename, |
756 g_mutex_lock(mutex_scan); | 755 g_mutex_lock(mutex_scan); |
757 playlist_get_info_scan_active = TRUE; | 756 playlist_get_info_scan_active = TRUE; |
758 g_mutex_unlock(mutex_scan); | 757 g_mutex_unlock(mutex_scan); |
759 g_cond_signal(cond_scan); | 758 g_cond_signal(cond_scan); |
760 } | 759 } |
760 PLAYLIST_INCR_SERIAL(playlist); | |
761 } | 761 } |
762 | 762 |
763 gboolean | 763 gboolean |
764 playlist_ins(Playlist * playlist, const gchar * filename, gint pos) | 764 playlist_ins(Playlist * playlist, const gchar * filename, gint pos) |
765 { | 765 { |
1026 | 1026 |
1027 g_list_free(list); | 1027 g_list_free(list); |
1028 g_free(path2); | 1028 g_free(path2); |
1029 | 1029 |
1030 playlist_recalc_total_time(playlist); | 1030 playlist_recalc_total_time(playlist); |
1031 playlist_incr_serial(playlist); | |
1032 playlist_generate_shuffle_list(playlist); | 1031 playlist_generate_shuffle_list(playlist); |
1033 playlistwin_update_list(playlist); | 1032 playlistwin_update_list(playlist); |
1034 playlist_manager_update(); | 1033 playlist_manager_update(); |
1035 return entries; | 1034 return entries; |
1036 } | 1035 } |
1085 | 1084 |
1086 string = tmp + 1; | 1085 string = tmp + 1; |
1087 } | 1086 } |
1088 | 1087 |
1089 playlist_recalc_total_time(playlist); | 1088 playlist_recalc_total_time(playlist); |
1090 playlist_incr_serial(playlist); | 1089 PLAYLIST_INCR_SERIAL(playlist); //probably necessary because there is no underlying __playlist_ins --yaz |
1091 playlist_generate_shuffle_list(playlist); | 1090 playlist_generate_shuffle_list(playlist); |
1092 playlistwin_update_list(playlist); | 1091 playlistwin_update_list(playlist); |
1093 | 1092 |
1094 playlist_manager_update(); | 1093 playlist_manager_update(); |
1095 | 1094 |
1150 playlist->position->title = g_strdup(title); | 1149 playlist->position->title = g_strdup(title); |
1151 playlist->position->length = length; | 1150 playlist->position->length = length; |
1152 } | 1151 } |
1153 | 1152 |
1154 playlist_recalc_total_time(playlist); | 1153 playlist_recalc_total_time(playlist); |
1154 PLAYLIST_INCR_SERIAL(playlist); //tentative --yaz | |
1155 | 1155 |
1156 mainwin_set_song_info(rate, freq, nch); | 1156 mainwin_set_song_info(rate, freq, nch); |
1157 | 1157 |
1158 if (playlist->position) | 1158 if (playlist->position) |
1159 hook_call( "playlist set info" , playlist->position ); | 1159 hook_call( "playlist set info" , playlist->position ); |
1851 new_len = playlist_get_length(playlist); | 1851 new_len = playlist_get_length(playlist); |
1852 | 1852 |
1853 playlist_generate_shuffle_list(playlist); | 1853 playlist_generate_shuffle_list(playlist); |
1854 playlistwin_update_list(playlist); | 1854 playlistwin_update_list(playlist); |
1855 playlist_manager_update(); | 1855 playlist_manager_update(); |
1856 playlist->serial++; | 1856 |
1857 playlist_recalc_total_time(playlist); //tentative --yaz | |
1858 PLAYLIST_INCR_SERIAL(playlist); | |
1859 | |
1857 return new_len - old_len; | 1860 return new_len - old_len; |
1858 } | 1861 } |
1859 | 1862 |
1860 GList * | 1863 GList * |
1861 get_playlist_nth(Playlist *playlist, guint nth) | 1864 get_playlist_nth(Playlist *playlist, guint nth) |
2795 PLAYLIST_UNLOCK(playlist); | 2798 PLAYLIST_UNLOCK(playlist); |
2796 | 2799 |
2797 playlist_generate_shuffle_list(playlist); | 2800 playlist_generate_shuffle_list(playlist); |
2798 playlistwin_update_list(playlist); | 2801 playlistwin_update_list(playlist); |
2799 playlist_recalc_total_time(playlist); | 2802 playlist_recalc_total_time(playlist); |
2800 playlist_incr_serial(playlist); | 2803 PLAYLIST_INCR_SERIAL(playlist); |
2801 playlist_manager_update(); | 2804 playlist_manager_update(); |
2802 } | 2805 } |
2803 | 2806 |
2804 | 2807 |
2805 static gint | 2808 static gint |
2915 | 2918 |
2916 PLAYLIST_UNLOCK(playlist); | 2919 PLAYLIST_UNLOCK(playlist); |
2917 | 2920 |
2918 playlistwin_update_list(playlist); | 2921 playlistwin_update_list(playlist); |
2919 playlist_recalc_total_time(playlist); | 2922 playlist_recalc_total_time(playlist); |
2920 playlist_incr_serial(playlist); | 2923 PLAYLIST_INCR_SERIAL(playlist); |
2921 | 2924 |
2922 playlist_manager_update(); | 2925 playlist_manager_update(); |
2923 } | 2926 } |
2924 | 2927 |
2925 void | 2928 void |
2933 *total_time = playlist->pl_total_time; | 2936 *total_time = playlist->pl_total_time; |
2934 *selection_time = playlist->pl_selection_time; | 2937 *selection_time = playlist->pl_selection_time; |
2935 *total_more = playlist->pl_total_more; | 2938 *total_more = playlist->pl_total_more; |
2936 *selection_more = playlist->pl_selection_more; | 2939 *selection_more = playlist->pl_selection_more; |
2937 PLAYLIST_UNLOCK(playlist); | 2940 PLAYLIST_UNLOCK(playlist); |
2938 } | |
2939 | |
2940 static void | |
2941 playlist_incr_serial(Playlist *playlist) | |
2942 { | |
2943 playlist->serial++; | |
2944 } | 2941 } |
2945 | 2942 |
2946 static void | 2943 static void |
2947 playlist_recalc_total_time_nolock(Playlist *playlist) | 2944 playlist_recalc_total_time_nolock(Playlist *playlist) |
2948 { | 2945 { |
3149 | 3146 |
3150 g_list_free( found_list ); | 3147 g_list_free( found_list ); |
3151 | 3148 |
3152 PLAYLIST_UNLOCK(playlist); | 3149 PLAYLIST_UNLOCK(playlist); |
3153 playlist_recalc_total_time(playlist); | 3150 playlist_recalc_total_time(playlist); |
3154 playlist_incr_serial(playlist); | 3151 // PLAYLIST_INCR_SERIAL(playlist); //unnecessary? --yaz |
3155 | 3152 |
3156 return num_of_entries_found; | 3153 return num_of_entries_found; |
3157 } | 3154 } |
3158 | 3155 |
3159 void | 3156 void |
3263 | 3260 |
3264 PLAYLIST_UNLOCK(playlist); | 3261 PLAYLIST_UNLOCK(playlist); |
3265 | 3262 |
3266 playlistwin_update_list(playlist); | 3263 playlistwin_update_list(playlist); |
3267 playlist_recalc_total_time(playlist); | 3264 playlist_recalc_total_time(playlist); |
3265 PLAYLIST_INCR_SERIAL(playlist); //tentative --yaz | |
3268 | 3266 |
3269 return retval; | 3267 return retval; |
3270 } | 3268 } |
3271 | 3269 |
3272 void | 3270 void |
3285 | 3283 |
3286 PLAYLIST_UNLOCK(playlist); | 3284 PLAYLIST_UNLOCK(playlist); |
3287 | 3285 |
3288 playlistwin_update_list(playlist); | 3286 playlistwin_update_list(playlist); |
3289 playlist_recalc_total_time(playlist); | 3287 playlist_recalc_total_time(playlist); |
3288 PLAYLIST_INCR_SERIAL(playlist); //tentative --yaz | |
3290 } | 3289 } |
3291 | 3290 |
3292 Playlist * | 3291 Playlist * |
3293 playlist_get_active(void) | 3292 playlist_get_active(void) |
3294 { | 3293 { |