diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/lang/english.lang | 17 | ||||
-rw-r--r-- | apps/menus/playback_menu.c | 5 | ||||
-rw-r--r-- | apps/playback.c | 13 | ||||
-rw-r--r-- | apps/settings.h | 4 | ||||
-rw-r--r-- | apps/settings_list.c | 6 |
5 files changed, 45 insertions, 0 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 1cd137ae3c..64d28422c1 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -13511,3 +13511,20 @@ *: none </voice> </phrase> +<phrase> + id: LANG_RESUME_REWIND + desc: in playback settings menu + user: core + <source> + *: none + swcodec: "Rewind Before Resume" + </source> + <dest> + *: none + swcodec: "Rewind Before Resume" + </dest> + <voice> + *: none + swcodec: "Rewind before resume" + </voice> +</phrase> diff --git a/apps/menus/playback_menu.c b/apps/menus/playback_menu.c index 5be7a8ca43..f0ebd1eed1 100644 --- a/apps/menus/playback_menu.c +++ b/apps/menus/playback_menu.c @@ -177,6 +177,7 @@ MAKE_MENU(unplug_menu, ID2P(LANG_HEADPHONE_UNPLUG), 0, Icon_NOICON, MENUITEM_SETTING(skip_length, &global_settings.skip_length, NULL); MENUITEM_SETTING(prevent_skip, &global_settings.prevent_skip, NULL); +MENUITEM_SETTING(resume_rewind, &global_settings.resume_rewind, NULL); MAKE_MENU(playback_settings,ID2P(LANG_PLAYBACK),0, Icon_Playback_menu, @@ -203,6 +204,10 @@ MAKE_MENU(playback_settings,ID2P(LANG_PLAYBACK),0, ,&unplug_menu #endif ,&skip_length, &prevent_skip, + +#if CONFIG_CODEC == SWCODEC + &resume_rewind, +#endif ); static int playback_callback(int action,const struct menu_item_ex *this_item) diff --git a/apps/playback.c b/apps/playback.c index dc854cbb24..ebe4932ae0 100644 --- a/apps/playback.c +++ b/apps/playback.c @@ -1344,6 +1344,17 @@ static void audio_finish_load_track(void) track_id3->elapsed = 0; offset = track_id3->offset; + size_t resume_rewind = (global_settings.resume_rewind * + track_id3->bitrate * 1000) / 8; + + if (offset < resume_rewind) + { + offset = 0; + } + else + { + offset -= resume_rewind; + } enum data_type type = TYPE_PACKET_AUDIO; @@ -1375,6 +1386,8 @@ static void audio_finish_load_track(void) break; } + track_id3->offset = offset; + logf("load track: %s", track_id3->path); if (file_offset > AUDIO_REBUFFER_GUESS_SIZE) diff --git a/apps/settings.h b/apps/settings.h index 723dfba176..fc44caae43 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -823,6 +823,10 @@ struct user_settings int hotkey_tree; #endif +#if CONFIG_CODEC == SWCODEC + /* When resuming playback (after a stop), rewind this number of seconds */ + int resume_rewind; +#endif }; /** global variables **/ diff --git a/apps/settings_list.c b/apps/settings_list.c index d52a82f8cc..044f9e8066 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c @@ -1683,6 +1683,12 @@ const struct settings_list settings[] = { #endif ID2P(LANG_ONPLAY_OPEN_WITH), ID2P(LANG_DELETE), ID2P(LANG_INSERT)), #endif + +#if CONFIG_CODEC == SWCODEC + INT_SETTING(0, resume_rewind, LANG_RESUME_REWIND, 0, + "resume rewind", UNIT_SEC, 0, 60, 5, + NULL, NULL, NULL), +#endif }; const int nb_settings = sizeof(settings)/sizeof(*settings); |