summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/plugins/pictureflow/pictureflow.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/apps/plugins/pictureflow/pictureflow.c b/apps/plugins/pictureflow/pictureflow.c
index cd8ef1a29f..0e337ef63c 100644
--- a/apps/plugins/pictureflow/pictureflow.c
+++ b/apps/plugins/pictureflow/pictureflow.c
@@ -38,6 +38,11 @@ PLUGIN_HEADER
38 38
39/******************************* Globals ***********************************/ 39/******************************* Globals ***********************************/
40 40
41/*
42 * Targets which use plugin_get_audio_buffer() can't have playback from
43 * within pictureflow itself, as the whole core audio buffer is occupied */
44#define PF_PLAYBACK_CAPABLE (PLUGIN_BUFFER_SIZE > 0x10000)
45
41#define PF_PREV ACTION_STD_PREV 46#define PF_PREV ACTION_STD_PREV
42#define PF_PREV_REPEAT ACTION_STD_PREVREPEAT 47#define PF_PREV_REPEAT ACTION_STD_PREVREPEAT
43#define PF_NEXT ACTION_STD_NEXT 48#define PF_NEXT ACTION_STD_NEXT
@@ -254,7 +259,10 @@ struct track_data {
254 uint32_t sort; 259 uint32_t sort;
255 int name_idx; /* offset to the track name */ 260 int name_idx; /* offset to the track name */
256 long seek; 261 long seek;
257 int filename_idx; /* offset to the filename in the string */ 262#if PF_PLAYBACK_CAPABLE
263 /* offset to the filename in the string, needed for playlist generation */
264 int filename_idx;
265#endif
258}; 266};
259 267
260struct rect { 268struct rect {
@@ -757,14 +765,14 @@ char* get_track_name(const int track_index)
757 return track_names + tracks[track_index].name_idx; 765 return track_names + tracks[track_index].name_idx;
758 return 0; 766 return 0;
759} 767}
760 768#if PF_PLAYBACK_CAPABLE
761char* get_track_filename(const int track_index) 769char* get_track_filename(const int track_index)
762{ 770{
763 if ( track_index < track_count ) 771 if ( track_index < track_count )
764 return track_names + tracks[track_index].filename_idx; 772 return track_names + tracks[track_index].filename_idx;
765 return 0; 773 return 0;
766} 774}
767 775#endif
768/** 776/**
769 Compare two unsigned ints passed via pointers. 777 Compare two unsigned ints passed via pointers.
770 */ 778 */
@@ -798,7 +806,7 @@ void create_track_index(const int slide_index)
798 tracks = (struct track_data*)(track_names + borrowed); 806 tracks = (struct track_data*)(track_names + borrowed);
799 while (rb->tagcache_get_next(&tcs)) 807 while (rb->tagcache_get_next(&tcs))
800 { 808 {
801 int len = 0, fn_idx = 0, remain; 809 int len = 0, fn_idx = 0;
802 810
803 avail -= sizeof(struct track_data); 811 avail -= sizeof(struct track_data);
804 track_num = rb->tagcache_get_numeric(&tcs, tag_tracknumber) - 1; 812 track_num = rb->tagcache_get_numeric(&tcs, tag_tracknumber) - 1;
@@ -824,7 +832,8 @@ retry:
824 } 832 }
825 if (fn_idx <= 0) 833 if (fn_idx <= 0)
826 goto fail; 834 goto fail;
827 remain = avail - fn_idx; 835#if PF_PLAYBACK_CAPABLE
836 int remain = avail - fn_idx;
828 if (remain >= MAX_PATH) 837 if (remain >= MAX_PATH)
829 { /* retrieve filename for building the playlist */ 838 { /* retrieve filename for building the playlist */
830 rb->tagcache_retrieve(&tcs, tcs.idx_id, tag_filename, 839 rb->tagcache_retrieve(&tcs, tcs.idx_id, tag_filename,
@@ -837,6 +846,9 @@ retry:
837 } 846 }
838 else /* request more buffer so that track and filename fit */ 847 else /* request more buffer so that track and filename fit */
839 len = (avail - remain) + MAX_PATH; 848 len = (avail - remain) + MAX_PATH;
849#else
850 len = fn_idx;
851#endif
840 if (len > avail) 852 if (len > avail)
841 { 853 {
842 while (len > avail) 854 while (len > avail)
@@ -863,7 +875,9 @@ retry:
863 tracks->sort = ((disc_num - 1) << 24) + (track_num << 14) + track_count; 875 tracks->sort = ((disc_num - 1) << 24) + (track_num << 14) + track_count;
864 tracks->name_idx = string_index; 876 tracks->name_idx = string_index;
865 tracks->seek = tcs.result_seek; 877 tracks->seek = tcs.result_seek;
878#if PF_PLAYBACK_CAPABLE
866 tracks->filename_idx = fn_idx + string_index; 879 tracks->filename_idx = fn_idx + string_index;
880#endif
867 track_count++; 881 track_count++;
868 string_index += len; 882 string_index += len;
869 } 883 }
@@ -2325,6 +2339,7 @@ void select_prev_track(void)
2325 } 2339 }
2326} 2340}
2327 2341
2342#if PF_PLAYBACK_CAPABLE
2328/* 2343/*
2329 * Puts the current tracklist into a newly created playlist and starts playling 2344 * Puts the current tracklist into a newly created playlist and starts playling
2330 */ 2345 */
@@ -2367,7 +2382,7 @@ play:
2367 old_playlist = center_slide.slide_index; 2382 old_playlist = center_slide.slide_index;
2368 old_shuffle = shuffle; 2383 old_shuffle = shuffle;
2369} 2384}
2370 2385#endif
2371/** 2386/**
2372 Draw the current album name 2387 Draw the current album name
2373 */ 2388 */
@@ -2671,7 +2686,9 @@ int main(void)
2671 pf_state = pf_cover_in; 2686 pf_state = pf_cover_in;
2672 } 2687 }
2673 else if ( pf_state == pf_show_tracks ) { 2688 else if ( pf_state == pf_show_tracks ) {
2689#if PF_PLAYBACK_CAPABLE
2674 start_playback(); 2690 start_playback();
2691#endif
2675 } 2692 }
2676 break; 2693 break;
2677 2694
@@ -2700,7 +2717,7 @@ enum plugin_status plugin_start(const void *parameter)
2700#ifdef HAVE_ADJUSTABLE_CPU_FREQ 2717#ifdef HAVE_ADJUSTABLE_CPU_FREQ
2701 rb->cpu_boost(true); 2718 rb->cpu_boost(true);
2702#endif 2719#endif
2703#if PLUGIN_BUFFER_SIZE > 0x10000 2720#if PF_PLAYBACK_CAPABLE
2704 buf = rb->plugin_get_buffer(&buf_size); 2721 buf = rb->plugin_get_buffer(&buf_size);
2705#else 2722#else
2706 buf = rb->plugin_get_audio_buffer(&buf_size); 2723 buf = rb->plugin_get_audio_buffer(&buf_size);