summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMagnus Holmgren <magnushol@gmail.com>2010-04-24 14:10:28 +0000
committerMagnus Holmgren <magnushol@gmail.com>2010-04-24 14:10:28 +0000
commitd38093de2f96e5600e944edb20b626b494bd3717 (patch)
tree8f1ddab1488ae1e734a84e00f5aaff6230d98620
parent2970eb5b4c1cc2c3a1a8ff98f13ff2e4010464c3 (diff)
downloadrockbox-d38093de2f96e5600e944edb20b626b494bd3717.tar.gz
rockbox-d38093de2f96e5600e944edb20b626b494bd3717.tar.bz2
rockbox-d38093de2f96e5600e944edb20b626b494bd3717.zip
FS#11099 - Rewind before resume
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25706 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/lang/english.lang17
-rw-r--r--apps/menus/playback_menu.c5
-rw-r--r--apps/playback.c13
-rw-r--r--apps/settings.h4
-rw-r--r--apps/settings_list.c6
-rw-r--r--manual/configure_rockbox/playback_options.tex11
6 files changed, 56 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);
diff --git a/manual/configure_rockbox/playback_options.tex b/manual/configure_rockbox/playback_options.tex
index da6f6efa9b..7d9c8baa09 100644
--- a/manual/configure_rockbox/playback_options.tex
+++ b/manual/configure_rockbox/playback_options.tex
@@ -288,3 +288,14 @@ you to configure settings related to audio playback.
if a track ends, which can be achieved by combining this option with
\setting{Repeat} set to \setting{One}
+\opt{swcodec}{
+ \section{Rewind Before Resume}\index{Rewind Before Resume}
+ When resuming a track or a bookmark, a short rewind can be done before the
+ playback is started. This can be useful when listening to speech material,
+ to help remember what was being said just before playback was stopped.
+ The size of the rewind can be set to various values between 0 (off) and
+ 60 seconds.
+ \note{The rewind is not done when resuming a paused track.}
+ \note{The actual rewind distance may differ a little from the requested
+ value, depending on the file in question.}
+}%\opt{swcodec}