summaryrefslogtreecommitdiff
path: root/lib/rbcodec/codecs/wmapro.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 /lib/rbcodec/codecs/wmapro.c
parentdda54b85daa83b7803b4fb189ab45859f96ff3f9 (diff)
downloadrockbox-31b712286721dd606940c7b557d03e3f714b9604.tar.gz
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 'lib/rbcodec/codecs/wmapro.c')
-rw-r--r--lib/rbcodec/codecs/wmapro.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/rbcodec/codecs/wmapro.c b/lib/rbcodec/codecs/wmapro.c
index d99ca1aa9e..f15f36813d 100644
--- a/lib/rbcodec/codecs/wmapro.c
+++ b/lib/rbcodec/codecs/wmapro.c
@@ -55,6 +55,8 @@ enum codec_status codec_run(void)
55 int size; /* Size of the input frame to the decoder */ 55 int size; /* Size of the input frame to the decoder */
56 intptr_t param; 56 intptr_t param;
57 57
58 elapsedtime = ci->id3->elapsed;
59
58restart_track: 60restart_track:
59 if (codec_init()) { 61 if (codec_init()) {
60 LOGF("(WMA PRO) Error: Error initialising codec\n"); 62 LOGF("(WMA PRO) Error: Error initialising codec\n");
@@ -75,11 +77,17 @@ restart_track:
75 return CODEC_ERROR; 77 return CODEC_ERROR;
76 } 78 }
77 79
78 /* Now advance the file position to the first frame */ 80 if (elapsedtime) {
79 ci->seek_buffer(ci->id3->first_frame_offset); 81 elapsedtime = asf_seek(elapsedtime, &wfx);
82 if (elapsedtime < 1)
83 return CODEC_OK;
84 }
85 else {
86 /* Now advance the file position to the first frame */
87 ci->seek_buffer(ci->id3->first_frame_offset);
88 }
80 89
81 elapsedtime = 0; 90 ci->set_elapsed(elapsedtime);
82 ci->set_elapsed(0);
83 91
84 /* The main decoding loop */ 92 /* The main decoding loop */
85 93
@@ -95,6 +103,7 @@ restart_track:
95 if (param == 0) { 103 if (param == 0) {
96 ci->set_elapsed(0); 104 ci->set_elapsed(0);
97 ci->seek_complete(); 105 ci->seek_complete();
106 elapsedtime = 0;
98 goto restart_track; /* Pretend you never saw this... */ 107 goto restart_track; /* Pretend you never saw this... */
99 } 108 }
100 109