summaryrefslogtreecommitdiffstats
path: root/apps/tagtree.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2013-07-14 07:59:39 -0400
committerMichael Sevakis <jethead71@rockbox.org>2014-03-10 04:12:30 +0100
commit31b712286721dd606940c7b557d03e3f714b9604 (patch)
tree8c4a4cc32e9000ea721ebb23aa3c0129ca97bf53 /apps/tagtree.c
parentdda54b85daa83b7803b4fb189ab45859f96ff3f9 (diff)
downloadrockbox-31b712286721dd606940c7b557d03e3f714b9604.tar.gz
rockbox-31b712286721dd606940c7b557d03e3f714b9604.tar.bz2
rockbox-31b712286721dd606940c7b557d03e3f714b9604.zip
Implement time-based resume and playback start.
This complements offset-based resume and playback start funcionality. The implementation is global on both HWCODEC and SWCODEC. Basically, if either the specified elapsed or offset are non-zero, it indicates a mid-track resume. To resume by time only, set elapsed to nonzero and offset to zero. To resume by offset only, set offset to nonzero and elapsed to zero. Which one the codec uses and which has priority is up to the codec; however, using an elapsed time covers more cases: * Codecs not able to use an offset such as VGM or other atomic formats * Starting playback at a nonzero elapsed time from a source that contains no offset, such as a cuesheet The change re-versions pretty much everything from tagcache to nvram. Change-Id: Ic7aebb24e99a03ae99585c5e236eba960d163f38 Reviewed-on: http://gerrit.rockbox.org/516 Reviewed-by: Michael Sevakis <jethead71@rockbox.org> Tested: Michael Sevakis <jethead71@rockbox.org>
Diffstat (limited to 'apps/tagtree.c')
-rw-r--r--apps/tagtree.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/apps/tagtree.c b/apps/tagtree.c
index 9eef38b5e6..ff364ec5e4 100644
--- a/apps/tagtree.c
+++ b/apps/tagtree.c
@@ -330,6 +330,7 @@ static int get_tag(int *tag)
{"playcount", tag_playcount},
{"rating", tag_rating},
{"lastplayed", tag_lastplayed},
+ {"lastelapsed", tag_lastelapsed},
{"lastoffset", tag_lastoffset},
{"commitid", tag_commitid},
{"entryage", tag_virt_entryage},
@@ -841,8 +842,16 @@ static void tagtree_buffer_event(void *data)
#if CONFIG_CODEC == SWCODEC
if (autoresume)
{
- /* Load current file resume offset if not already defined (by
+ /* Load current file resume info if not already defined (by
another resume mechanism) */
+ if (id3->elapsed == 0)
+ {
+ id3->elapsed = tagcache_get_numeric(&tcs, tag_lastelapsed);
+
+ logf("tagtree_buffer_event: Set elapsed for %s to %lX\n",
+ str_or_empty(id3->title), id3->elapsed);
+ }
+
if (id3->offset == 0)
{
id3->offset = tagcache_get_numeric(&tcs, tag_lastoffset);
@@ -940,12 +949,13 @@ static void tagtree_track_finish_event(void *data)
#if CONFIG_CODEC == SWCODEC
if (autoresume)
{
+ unsigned long elapsed = auto_skip ? 0 : id3->elapsed;
unsigned long offset = auto_skip ? 0 : id3->offset;
-
+ tagcache_update_numeric(tagcache_idx, tag_lastelapsed, elapsed);
tagcache_update_numeric(tagcache_idx, tag_lastoffset, offset);
- logf("tagtree_track_finish_event: Save offset for %s: %lX",
- str_or_empty(id3->title), offset);
+ logf("tagtree_track_finish_event: Save resume for %s: %lX %lX",
+ str_or_empty(id3->title), elapsed, offset);
}
#endif
}
@@ -2034,7 +2044,7 @@ static int tagtree_play_folder(struct tree_context* c)
c->selected_item = 0;
gui_synclist_select_item(&tree_lists, c->selected_item);
- playlist_start(c->selected_item,0);
+ playlist_start(c->selected_item, 0, 0);
playlist_get_current()->num_inserted_tracks = 0; /* make warn on playlist erase work */
return 0;
}