diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/filetree.c | 2 | ||||
-rwxr-xr-x | apps/playlist.c | 41 | ||||
-rw-r--r-- | apps/playlist.h | 3 | ||||
-rw-r--r-- | apps/plugin.c | 14 | ||||
-rw-r--r-- | apps/plugin.h | 19 | ||||
-rw-r--r-- | apps/plugins/alarmclock.c | 3 | ||||
-rw-r--r-- | apps/plugins/lib/playback_control.c | 3 | ||||
-rw-r--r-- | apps/plugins/lrcplayer.c | 3 | ||||
-rw-r--r-- | apps/root_menu.c | 6 | ||||
-rw-r--r-- | apps/settings.h | 1 | ||||
-rw-r--r-- | apps/settings_list.c | 1 | ||||
-rw-r--r-- | apps/settings_list.h | 2 |
12 files changed, 74 insertions, 24 deletions
diff --git a/apps/filetree.c b/apps/filetree.c index 4e7c2745b4..2edcaf3a03 100644 --- a/apps/filetree.c +++ b/apps/filetree.c | |||
@@ -703,6 +703,8 @@ int ft_enter(struct tree_context* c) | |||
703 | /* the resume_index must always be the index in the | 703 | /* the resume_index must always be the index in the |
704 | shuffled list in case shuffle is enabled */ | 704 | shuffled list in case shuffle is enabled */ |
705 | global_status.resume_index = start_index; | 705 | global_status.resume_index = start_index; |
706 | global_status.resume_crc32 = | ||
707 | playlist_get_filename_crc32(NULL, start_index); | ||
706 | global_status.resume_offset = 0; | 708 | global_status.resume_offset = 0; |
707 | status_save(); | 709 | status_save(); |
708 | rc = GO_TO_WPS; | 710 | rc = GO_TO_WPS; |
diff --git a/apps/playlist.c b/apps/playlist.c index c5e2e83462..35b7e35baa 100755 --- a/apps/playlist.c +++ b/apps/playlist.c | |||
@@ -2514,6 +2514,44 @@ int playlist_shuffle(int random_seed, int start_index) | |||
2514 | return playlist->index; | 2514 | return playlist->index; |
2515 | } | 2515 | } |
2516 | 2516 | ||
2517 | /* returns the crc32 of the filename of the track at the specified index */ | ||
2518 | unsigned int playlist_get_filename_crc32(struct playlist_info *playlist, | ||
2519 | int index) | ||
2520 | { | ||
2521 | struct playlist_track_info track_info; | ||
2522 | if (playlist_get_track_info(playlist, index, &track_info) == -1) | ||
2523 | return -1; | ||
2524 | |||
2525 | return crc_32(track_info.filename, strlen(track_info.filename), -1); | ||
2526 | } | ||
2527 | |||
2528 | /* resume a playlist track with the given crc_32 of the track name. */ | ||
2529 | void playlist_resume_track(int start_index, unsigned int crc, int offset) | ||
2530 | { | ||
2531 | int i; | ||
2532 | unsigned int tmp_crc; | ||
2533 | struct playlist_info* playlist = ¤t_playlist; | ||
2534 | tmp_crc = playlist_get_filename_crc32(playlist, start_index); | ||
2535 | if (tmp_crc == crc) | ||
2536 | { | ||
2537 | playlist_start(start_index, offset); | ||
2538 | return; | ||
2539 | } | ||
2540 | |||
2541 | for (i = 0 ; i < playlist->amount; i++) | ||
2542 | { | ||
2543 | tmp_crc = playlist_get_filename_crc32(playlist, i); | ||
2544 | if (tmp_crc == crc) | ||
2545 | { | ||
2546 | playlist_start(i, offset); | ||
2547 | return; | ||
2548 | } | ||
2549 | } | ||
2550 | |||
2551 | /* If we got here the file wasnt found, so start from the beginning */ | ||
2552 | playlist_start(0,0); | ||
2553 | } | ||
2554 | |||
2517 | /* start playing current playlist at specified index/offset */ | 2555 | /* start playing current playlist at specified index/offset */ |
2518 | void playlist_start(int start_index, int offset) | 2556 | void playlist_start(int start_index, int offset) |
2519 | { | 2557 | { |
@@ -2726,7 +2764,9 @@ int playlist_update_resume_info(const struct mp3entry* id3) | |||
2726 | if (global_status.resume_index != playlist->index || | 2764 | if (global_status.resume_index != playlist->index || |
2727 | global_status.resume_offset != id3->offset) | 2765 | global_status.resume_offset != id3->offset) |
2728 | { | 2766 | { |
2767 | unsigned int crc = crc_32(id3->path, strlen(id3->path), -1); | ||
2729 | global_status.resume_index = playlist->index; | 2768 | global_status.resume_index = playlist->index; |
2769 | global_status.resume_crc32 = crc; | ||
2730 | global_status.resume_offset = id3->offset; | 2770 | global_status.resume_offset = id3->offset; |
2731 | status_save(); | 2771 | status_save(); |
2732 | } | 2772 | } |
@@ -2734,6 +2774,7 @@ int playlist_update_resume_info(const struct mp3entry* id3) | |||
2734 | else | 2774 | else |
2735 | { | 2775 | { |
2736 | global_status.resume_index = -1; | 2776 | global_status.resume_index = -1; |
2777 | global_status.resume_crc32 = -1; | ||
2737 | global_status.resume_offset = -1; | 2778 | global_status.resume_offset = -1; |
2738 | status_save(); | 2779 | status_save(); |
2739 | } | 2780 | } |
diff --git a/apps/playlist.h b/apps/playlist.h index d19d9a792a..d80d8aa2ee 100644 --- a/apps/playlist.h +++ b/apps/playlist.h | |||
@@ -131,6 +131,9 @@ int playlist_create(const char *dir, const char *file); | |||
131 | int playlist_resume(void); | 131 | int playlist_resume(void); |
132 | int playlist_add(const char *filename); | 132 | int playlist_add(const char *filename); |
133 | int playlist_shuffle(int random_seed, int start_index); | 133 | int playlist_shuffle(int random_seed, int start_index); |
134 | unsigned int playlist_get_filename_crc32(struct playlist_info *playlist, | ||
135 | int index); | ||
136 | void playlist_resume_track(int start_index, unsigned int crc, int offset); | ||
134 | void playlist_start(int start_index, int offset); | 137 | void playlist_start(int start_index, int offset); |
135 | bool playlist_check(int steps); | 138 | bool playlist_check(int steps); |
136 | const char *playlist_peek(int steps, char* buf, size_t buf_size); | 139 | const char *playlist_peek(int steps, char* buf, size_t buf_size); |
diff --git a/apps/plugin.c b/apps/plugin.c index 9992d85620..24443b58d9 100644 --- a/apps/plugin.c +++ b/apps/plugin.c | |||
@@ -155,6 +155,9 @@ static const struct plugin_api rockbox_api = { | |||
155 | lcd_double_height, | 155 | lcd_double_height, |
156 | #else | 156 | #else |
157 | &lcd_static_framebuffer[0][0], | 157 | &lcd_static_framebuffer[0][0], |
158 | lcd_set_viewport, | ||
159 | lcd_set_framebuffer, | ||
160 | lcd_bmp_part, | ||
158 | lcd_update_rect, | 161 | lcd_update_rect, |
159 | lcd_set_drawmode, | 162 | lcd_set_drawmode, |
160 | lcd_get_drawmode, | 163 | lcd_get_drawmode, |
@@ -287,6 +290,7 @@ static const struct plugin_api rockbox_api = { | |||
287 | #ifdef HAVE_LCD_BITMAP | 290 | #ifdef HAVE_LCD_BITMAP |
288 | viewportmanager_theme_enable, | 291 | viewportmanager_theme_enable, |
289 | viewportmanager_theme_undo, | 292 | viewportmanager_theme_undo, |
293 | viewport_set_fullscreen, | ||
290 | #endif | 294 | #endif |
291 | 295 | ||
292 | /* list */ | 296 | /* list */ |
@@ -583,6 +587,7 @@ static const struct plugin_api rockbox_api = { | |||
583 | mixer_channel_stop, | 587 | mixer_channel_stop, |
584 | mixer_channel_set_amplitude, | 588 | mixer_channel_set_amplitude, |
585 | mixer_channel_get_bytes_waiting, | 589 | mixer_channel_get_bytes_waiting, |
590 | mixer_channel_set_buffer_hook, | ||
586 | 591 | ||
587 | system_sound_play, | 592 | system_sound_play, |
588 | keyclick_click, | 593 | keyclick_click, |
@@ -590,6 +595,7 @@ static const struct plugin_api rockbox_api = { | |||
590 | /* playback control */ | 595 | /* playback control */ |
591 | playlist_amount, | 596 | playlist_amount, |
592 | playlist_resume, | 597 | playlist_resume, |
598 | playlist_resume_track, | ||
593 | playlist_start, | 599 | playlist_start, |
594 | playlist_add, | 600 | playlist_add, |
595 | playlist_sync, | 601 | playlist_sync, |
@@ -792,14 +798,6 @@ static const struct plugin_api rockbox_api = { | |||
792 | /* new stuff at the end, sort into place next time | 798 | /* new stuff at the end, sort into place next time |
793 | the API gets incompatible */ | 799 | the API gets incompatible */ |
794 | 800 | ||
795 | #ifdef HAVE_LCD_BITMAP | ||
796 | #if CONFIG_CODEC == SWCODEC | ||
797 | mixer_channel_set_buffer_hook, | ||
798 | #endif | ||
799 | lcd_set_viewport, | ||
800 | viewport_set_fullscreen, | ||
801 | lcd_set_framebuffer, | ||
802 | #endif | ||
803 | }; | 801 | }; |
804 | 802 | ||
805 | int plugin_load(const char* plugin, const void* parameter) | 803 | int plugin_load(const char* plugin, const void* parameter) |
diff --git a/apps/plugin.h b/apps/plugin.h index b34a5cf0de..cc00b9c60e 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -207,6 +207,10 @@ struct plugin_api { | |||
207 | void (*lcd_double_height)(bool on); | 207 | void (*lcd_double_height)(bool on); |
208 | #else /* HAVE_LCD_BITMAP */ | 208 | #else /* HAVE_LCD_BITMAP */ |
209 | fb_data* lcd_framebuffer; | 209 | fb_data* lcd_framebuffer; |
210 | void (*lcd_set_viewport)(struct viewport* vp); | ||
211 | void (*lcd_set_framebuffer)(fb_data *fb); | ||
212 | void (*lcd_bmp_part)(const struct bitmap *bm, int src_x, int src_y, | ||
213 | int x, int y, int width, int height); | ||
210 | void (*lcd_update_rect)(int x, int y, int width, int height); | 214 | void (*lcd_update_rect)(int x, int y, int width, int height); |
211 | void (*lcd_set_drawmode)(int mode); | 215 | void (*lcd_set_drawmode)(int mode); |
212 | int (*lcd_get_drawmode)(void); | 216 | int (*lcd_get_drawmode)(void); |
@@ -372,6 +376,8 @@ struct plugin_api { | |||
372 | void (*viewportmanager_theme_enable)(enum screen_type screen, bool enable, | 376 | void (*viewportmanager_theme_enable)(enum screen_type screen, bool enable, |
373 | struct viewport *viewport); | 377 | struct viewport *viewport); |
374 | void (*viewportmanager_theme_undo)(enum screen_type screen, bool force_redraw); | 378 | void (*viewportmanager_theme_undo)(enum screen_type screen, bool force_redraw); |
379 | void (*viewport_set_fullscreen)(struct viewport *vp, | ||
380 | const enum screen_type screen); | ||
375 | #endif | 381 | #endif |
376 | /* list */ | 382 | /* list */ |
377 | void (*gui_synclist_init)(struct gui_synclist * lists, | 383 | void (*gui_synclist_init)(struct gui_synclist * lists, |
@@ -707,6 +713,8 @@ struct plugin_api { | |||
707 | void (*mixer_channel_set_amplitude)(enum pcm_mixer_channel channel, | 713 | void (*mixer_channel_set_amplitude)(enum pcm_mixer_channel channel, |
708 | unsigned int amplitude); | 714 | unsigned int amplitude); |
709 | size_t (*mixer_channel_get_bytes_waiting)(enum pcm_mixer_channel channel); | 715 | size_t (*mixer_channel_get_bytes_waiting)(enum pcm_mixer_channel channel); |
716 | void (*mixer_channel_set_buffer_hook)(enum pcm_mixer_channel channel, | ||
717 | chan_buffer_hook_fn_type fn); | ||
710 | 718 | ||
711 | void (*system_sound_play)(enum system_sound sound); | 719 | void (*system_sound_play)(enum system_sound sound); |
712 | void (*keyclick_click)(bool rawbutton, int action); | 720 | void (*keyclick_click)(bool rawbutton, int action); |
@@ -715,6 +723,7 @@ struct plugin_api { | |||
715 | /* playback control */ | 723 | /* playback control */ |
716 | int (*playlist_amount)(void); | 724 | int (*playlist_amount)(void); |
717 | int (*playlist_resume)(void); | 725 | int (*playlist_resume)(void); |
726 | void (*playlist_resume_track)(int start_index, unsigned int crc, int offset); | ||
718 | void (*playlist_start)(int start_index, int offset); | 727 | void (*playlist_start)(int start_index, int offset); |
719 | int (*playlist_add)(const char *filename); | 728 | int (*playlist_add)(const char *filename); |
720 | void (*playlist_sync)(struct playlist_info* playlist); | 729 | void (*playlist_sync)(struct playlist_info* playlist); |
@@ -961,16 +970,6 @@ struct plugin_api { | |||
961 | /* new stuff at the end, sort into place next time | 970 | /* new stuff at the end, sort into place next time |
962 | the API gets incompatible */ | 971 | the API gets incompatible */ |
963 | 972 | ||
964 | #ifdef HAVE_LCD_BITMAP | ||
965 | #if CONFIG_CODEC == SWCODEC | ||
966 | void (*mixer_channel_set_buffer_hook)(enum pcm_mixer_channel channel, | ||
967 | chan_buffer_hook_fn_type fn); | ||
968 | #endif | ||
969 | void (*lcd_set_viewport)(struct viewport* vp); | ||
970 | void (*viewport_set_fullscreen)(struct viewport *vp, | ||
971 | const enum screen_type screen); | ||
972 | void (*lcd_set_framebuffer)(fb_data *fb); | ||
973 | #endif | ||
974 | }; | 973 | }; |
975 | 974 | ||
976 | /* plugin header */ | 975 | /* plugin header */ |
diff --git a/apps/plugins/alarmclock.c b/apps/plugins/alarmclock.c index 604c9ceac4..126b837390 100644 --- a/apps/plugins/alarmclock.c +++ b/apps/plugins/alarmclock.c | |||
@@ -107,7 +107,8 @@ static void play(void) | |||
107 | int audio_status = rb->audio_status(); | 107 | int audio_status = rb->audio_status(); |
108 | if (!audio_status && rb->global_status->resume_index != -1) { | 108 | if (!audio_status && rb->global_status->resume_index != -1) { |
109 | if (rb->playlist_resume() != -1) { | 109 | if (rb->playlist_resume() != -1) { |
110 | rb->playlist_start(rb->global_status->resume_index, | 110 | rb->playlist_resume_track(rb->global_status->resume_index, |
111 | rb->global_status->resume_crc32, | ||
111 | rb->global_status->resume_offset); | 112 | rb->global_status->resume_offset); |
112 | } | 113 | } |
113 | } | 114 | } |
diff --git a/apps/plugins/lib/playback_control.c b/apps/plugins/lib/playback_control.c index 7c28230642..47921e52f2 100644 --- a/apps/plugins/lib/playback_control.c +++ b/apps/plugins/lib/playback_control.c | |||
@@ -37,7 +37,8 @@ static bool play(void) | |||
37 | { | 37 | { |
38 | if (rb->playlist_resume() != -1) | 38 | if (rb->playlist_resume() != -1) |
39 | { | 39 | { |
40 | rb->playlist_start(rb->global_status->resume_index, | 40 | rb->playlist_resume_track(rb->global_status->resume_index, |
41 | rb->global_status->resume_crc32, | ||
41 | rb->global_status->resume_offset); | 42 | rb->global_status->resume_offset); |
42 | } | 43 | } |
43 | } | 44 | } |
diff --git a/apps/plugins/lrcplayer.c b/apps/plugins/lrcplayer.c index 97385ff047..051d7adbb2 100644 --- a/apps/plugins/lrcplayer.c +++ b/apps/plugins/lrcplayer.c | |||
@@ -2682,7 +2682,8 @@ static int handle_button(void) | |||
2682 | { | 2682 | { |
2683 | if (rb->playlist_resume() != -1) | 2683 | if (rb->playlist_resume() != -1) |
2684 | { | 2684 | { |
2685 | rb->playlist_start(rb->global_status->resume_index, | 2685 | rb->playlist_resume_track(rb->global_status->resume_index, |
2686 | rb->global_status->resume_crc32, | ||
2686 | rb->global_status->resume_offset); | 2687 | rb->global_status->resume_offset); |
2687 | } | 2688 | } |
2688 | } | 2689 | } |
diff --git a/apps/root_menu.c b/apps/root_menu.c index 2c72cc47f7..d03fee35f7 100644 --- a/apps/root_menu.c +++ b/apps/root_menu.c | |||
@@ -297,12 +297,14 @@ static int wpsscrn(void* param) | |||
297 | } | 297 | } |
298 | else if ( global_status.resume_index != -1 ) | 298 | else if ( global_status.resume_index != -1 ) |
299 | { | 299 | { |
300 | DEBUGF("Resume index %X offset %lX\n", | 300 | DEBUGF("Resume index %X crc32 %lX offset %lX\n", |
301 | global_status.resume_index, | 301 | global_status.resume_index, |
302 | (unsigned long)global_status.resume_crc32, | ||
302 | (unsigned long)global_status.resume_offset); | 303 | (unsigned long)global_status.resume_offset); |
303 | if (playlist_resume() != -1) | 304 | if (playlist_resume() != -1) |
304 | { | 305 | { |
305 | playlist_start(global_status.resume_index, | 306 | playlist_resume_track(global_status.resume_index, |
307 | global_status.resume_crc32, | ||
306 | global_status.resume_offset); | 308 | global_status.resume_offset); |
307 | ret_val = gui_wps_show(); | 309 | ret_val = gui_wps_show(); |
308 | } | 310 | } |
diff --git a/apps/settings.h b/apps/settings.h index 2af29ce423..53ad70b24f 100644 --- a/apps/settings.h +++ b/apps/settings.h | |||
@@ -262,6 +262,7 @@ bool set_option(const char* string, const void* variable, enum optiontype type, | |||
262 | struct system_status | 262 | struct system_status |
263 | { | 263 | { |
264 | int resume_index; /* index in playlist (-1 for no active resume) */ | 264 | int resume_index; /* index in playlist (-1 for no active resume) */ |
265 | uint32_t resume_crc32; /* crc32 of the name of the file */ | ||
265 | uint32_t resume_offset; /* byte offset in mp3 file */ | 266 | uint32_t resume_offset; /* byte offset in mp3 file */ |
266 | int runtime; /* current runtime since last charge */ | 267 | int runtime; /* current runtime since last charge */ |
267 | int topruntime; /* top known runtime */ | 268 | int topruntime; /* top known runtime */ |
diff --git a/apps/settings_list.c b/apps/settings_list.c index f27c13c4f1..ef9fe50ece 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c | |||
@@ -721,6 +721,7 @@ const struct settings_list settings[] = { | |||
721 | /* playback */ | 721 | /* playback */ |
722 | OFFON_SETTING(0, playlist_shuffle, LANG_SHUFFLE, false, "shuffle", NULL), | 722 | OFFON_SETTING(0, playlist_shuffle, LANG_SHUFFLE, false, "shuffle", NULL), |
723 | SYSTEM_SETTING(NVRAM(4), resume_index, -1), | 723 | SYSTEM_SETTING(NVRAM(4), resume_index, -1), |
724 | SYSTEM_SETTING(NVRAM(4), resume_crc32, -1), | ||
724 | SYSTEM_SETTING(NVRAM(4), resume_offset, -1), | 725 | SYSTEM_SETTING(NVRAM(4), resume_offset, -1), |
725 | CHOICE_SETTING(0, repeat_mode, LANG_REPEAT, REPEAT_OFF, "repeat", | 726 | CHOICE_SETTING(0, repeat_mode, LANG_REPEAT, REPEAT_OFF, "repeat", |
726 | "off,all,one,shuffle" | 727 | "off,all,one,shuffle" |
diff --git a/apps/settings_list.h b/apps/settings_list.h index 9f1805f169..5cefcf6dc2 100644 --- a/apps/settings_list.h +++ b/apps/settings_list.h | |||
@@ -142,7 +142,7 @@ struct custom_setting { | |||
142 | 142 | ||
143 | #define F_NVRAM_BYTES_MASK 0xE0000 /*0-4 bytes can be stored */ | 143 | #define F_NVRAM_BYTES_MASK 0xE0000 /*0-4 bytes can be stored */ |
144 | #define F_NVRAM_MASK_SHIFT 17 | 144 | #define F_NVRAM_MASK_SHIFT 17 |
145 | #define NVRAM_CONFIG_VERSION 6 | 145 | #define NVRAM_CONFIG_VERSION 7 |
146 | /* Above define should be bumped if | 146 | /* Above define should be bumped if |
147 | - a new NVRAM setting is added between 2 other NVRAM settings | 147 | - a new NVRAM setting is added between 2 other NVRAM settings |
148 | - number of bytes for a NVRAM setting is changed | 148 | - number of bytes for a NVRAM setting is changed |