summaryrefslogtreecommitdiff
path: root/lib/rbcodec/codecs/vorbis.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/vorbis.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/vorbis.c')
-rw-r--r--lib/rbcodec/codecs/vorbis.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/rbcodec/codecs/vorbis.c b/lib/rbcodec/codecs/vorbis.c
index c09d2cea6d..ca9db9b802 100644
--- a/lib/rbcodec/codecs/vorbis.c
+++ b/lib/rbcodec/codecs/vorbis.c
@@ -126,7 +126,6 @@ enum codec_status codec_run(void)
126 long n; 126 long n;
127 int current_section; 127 int current_section;
128 int previous_section; 128 int previous_section;
129 int eof;
130 ogg_int64_t vf_offsets[2]; 129 ogg_int64_t vf_offsets[2];
131 ogg_int64_t vf_dataoffsets; 130 ogg_int64_t vf_dataoffsets;
132 ogg_uint32_t vf_serialnos; 131 ogg_uint32_t vf_serialnos;
@@ -193,16 +192,17 @@ enum codec_status codec_run(void)
193 if (ci->id3->offset) { 192 if (ci->id3->offset) {
194 ci->seek_buffer(ci->id3->offset); 193 ci->seek_buffer(ci->id3->offset);
195 ov_raw_seek(&vf, ci->id3->offset); 194 ov_raw_seek(&vf, ci->id3->offset);
196 ci->set_elapsed(ov_time_tell(&vf));
197 ci->set_offset(ov_raw_tell(&vf)); 195 ci->set_offset(ov_raw_tell(&vf));
198 } 196 }
199 else { 197 else if (ci->id3->elapsed) {
200 ci->set_elapsed(0); 198 ov_time_seek(&vf, ci->id3->elapsed);
201 } 199 }
202 200
201 ci->set_elapsed(ov_time_tell(&vf));
202
203 previous_section = -1; 203 previous_section = -1;
204 eof = 0; 204
205 while (!eof) { 205 while (1) {
206 enum codec_command_action action = ci->get_command(&param); 206 enum codec_command_action action = ci->get_command(&param);
207 207
208 if (action == CODEC_ACTION_HALT) 208 if (action == CODEC_ACTION_HALT)
@@ -230,7 +230,7 @@ enum codec_status codec_run(void)
230 } 230 }
231 231
232 if (n == 0) { 232 if (n == 0) {
233 eof = 1; 233 break;
234 } else if (n < 0) { 234 } else if (n < 0) {
235 DEBUGF("Vorbis: Error decoding frame\n"); 235 DEBUGF("Vorbis: Error decoding frame\n");
236 } else { 236 } else {