mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 10:37:38 -04:00
Enforce that codecs wait for their metadata in a proper-ish and consistent manner. Sort of a halfway patch; best would be to give them an internal copy of the current track information which lasts unaltered by playback until a track switch or unload.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29348 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
460d54977a
commit
85e40257dc
34 changed files with 171 additions and 125 deletions
|
@ -128,13 +128,15 @@ enum codec_status codec_main(void)
|
|||
ci->configure(DSP_SET_SAMPLE_DEPTH, 28);
|
||||
|
||||
next_track:
|
||||
retval = CODEC_OK;
|
||||
|
||||
if (codec_init()) {
|
||||
retval = CODEC_ERROR;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
while (!ci->taginfo_ready)
|
||||
ci->yield();
|
||||
if (codec_wait_taginfo() != 0)
|
||||
goto request_next_track;
|
||||
|
||||
ci->configure(DSP_SWITCH_FREQUENCY, ci->id3->frequency);
|
||||
codec_set_replaygain(ci->id3);
|
||||
|
@ -176,8 +178,8 @@ next_track:
|
|||
a52_decode_data(filebuf, filebuf + n);
|
||||
ci->advance_buffer(n);
|
||||
}
|
||||
retval = CODEC_OK;
|
||||
|
||||
request_next_track:
|
||||
if (ci->request_next_track())
|
||||
goto next_track;
|
||||
|
||||
|
|
|
@ -132,20 +132,24 @@ enum codec_status codec_main(void)
|
|||
uint8_t *filebuf;
|
||||
int retval, consumed, packet_offset;
|
||||
int playback_on = -1;
|
||||
size_t resume_offset = ci->id3->offset;
|
||||
size_t resume_offset;
|
||||
|
||||
/* Generic codec initialisation */
|
||||
ci->configure(DSP_SET_STEREO_MODE, STEREO_NONINTERLEAVED);
|
||||
ci->configure(DSP_SET_SAMPLE_DEPTH, 28);
|
||||
|
||||
next_track:
|
||||
retval = CODEC_OK;
|
||||
|
||||
if (codec_init()) {
|
||||
retval = CODEC_ERROR;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
while (!ci->taginfo_ready)
|
||||
ci->yield();
|
||||
if (codec_wait_taginfo() != 0)
|
||||
goto request_next_track;
|
||||
|
||||
resume_offset = ci->id3->offset;
|
||||
|
||||
ci->configure(DSP_SWITCH_FREQUENCY, ci->id3->frequency);
|
||||
codec_set_replaygain(ci->id3);
|
||||
|
@ -201,8 +205,7 @@ next_track:
|
|||
ci->advance_buffer(pkt.length);
|
||||
}
|
||||
|
||||
retval = CODEC_OK;
|
||||
|
||||
request_next_track:
|
||||
if (ci->request_next_track())
|
||||
goto next_track;
|
||||
|
||||
|
|
|
@ -78,8 +78,8 @@ next_track:
|
|||
goto exit;
|
||||
}
|
||||
|
||||
while (!*ci->taginfo_ready && !ci->stop_codec)
|
||||
ci->sleep(1);
|
||||
if (codec_wait_taginfo() != 0)
|
||||
goto done;
|
||||
|
||||
file_offset = ci->id3->offset;
|
||||
|
||||
|
@ -304,8 +304,6 @@ next_track:
|
|||
i++;
|
||||
}
|
||||
|
||||
err = CODEC_OK;
|
||||
|
||||
done:
|
||||
LOGF("AAC: Decoded %lu samples\n", (unsigned long)sound_samples_done);
|
||||
|
||||
|
|
|
@ -78,8 +78,8 @@ next_track:
|
|||
ch1_1=ch1_2=ch2_1=ch2_2=0;
|
||||
|
||||
/* wait for track info to load */
|
||||
while (!*ci->taginfo_ready && !ci->stop_codec)
|
||||
ci->sleep(1);
|
||||
if (codec_wait_taginfo() != 0)
|
||||
goto request_next_track;
|
||||
|
||||
codec_set_replaygain(ci->id3);
|
||||
|
||||
|
@ -385,6 +385,7 @@ next_track:
|
|||
1000LL/avgbytespersec);
|
||||
}
|
||||
|
||||
request_next_track:
|
||||
if (ci->request_next_track())
|
||||
goto next_track;
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ static const struct pcm_codec *get_codec(uint32_t formattag)
|
|||
|
||||
enum codec_status codec_main(void)
|
||||
{
|
||||
int status = CODEC_OK;
|
||||
int status;
|
||||
struct pcm_format format;
|
||||
uint32_t bytesdone, decodedsamples;
|
||||
uint32_t num_sample_frames = 0;
|
||||
|
@ -82,13 +82,15 @@ enum codec_status codec_main(void)
|
|||
ci->configure(DSP_SET_SAMPLE_DEPTH, PCM_OUTPUT_DEPTH-1);
|
||||
|
||||
next_track:
|
||||
status = CODEC_OK;
|
||||
|
||||
if (codec_init()) {
|
||||
status = CODEC_ERROR;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
while (!*ci->taginfo_ready && !ci->stop_codec)
|
||||
ci->sleep(1);
|
||||
if (codec_wait_taginfo() != 0)
|
||||
goto done;
|
||||
|
||||
codec_set_replaygain(ci->id3);
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ enum codec_status codec_main(void)
|
|||
ci->configure(DSP_SET_SAMPLE_DEPTH, ALAC_OUTPUT_DEPTH-1);
|
||||
|
||||
next_track:
|
||||
retval = CODEC_OK;
|
||||
|
||||
/* Clean and initialize decoder structures */
|
||||
memset(&demux_res , 0, sizeof(demux_res));
|
||||
|
@ -57,8 +58,8 @@ enum codec_status codec_main(void)
|
|||
goto exit;
|
||||
}
|
||||
|
||||
while (!*ci->taginfo_ready && !ci->stop_codec)
|
||||
ci->sleep(1);
|
||||
if (codec_wait_taginfo() != 0)
|
||||
goto done;
|
||||
|
||||
ci->configure(DSP_SWITCH_FREQUENCY, ci->id3->frequency);
|
||||
codec_set_replaygain(ci->id3);
|
||||
|
@ -145,7 +146,6 @@ enum codec_status codec_main(void)
|
|||
|
||||
i++;
|
||||
}
|
||||
retval = CODEC_OK;
|
||||
|
||||
done:
|
||||
LOGF("ALAC: Decoded %lu samples\n",(unsigned long)samplesdone);
|
||||
|
|
|
@ -150,21 +150,20 @@ enum codec_status codec_main(void)
|
|||
ci->configure(DSP_SET_SAMPLE_DEPTH, APE_OUTPUT_DEPTH-1);
|
||||
|
||||
next_track:
|
||||
|
||||
retval = CODEC_OK;
|
||||
|
||||
/* Remember the resume position - when the codec is opened, the
|
||||
playback engine will reset it. */
|
||||
resume_offset = ci->id3->offset;
|
||||
|
||||
if (codec_init()) {
|
||||
LOGF("APE: Error initialising codec\n");
|
||||
retval = CODEC_ERROR;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
while (!*ci->taginfo_ready && !ci->stop_codec)
|
||||
ci->sleep(1);
|
||||
if (codec_wait_taginfo() != 0)
|
||||
goto done;
|
||||
|
||||
/* Remember the resume position - when the codec is opened, the
|
||||
playback engine will reset it. */
|
||||
resume_offset = ci->id3->offset;
|
||||
|
||||
inbuffer = ci->request_buffer(&bytesleft, INPUT_CHUNKSIZE);
|
||||
|
||||
|
@ -319,8 +318,6 @@ frame_start:
|
|||
currentframe++;
|
||||
}
|
||||
|
||||
retval = CODEC_OK;
|
||||
|
||||
done:
|
||||
LOGF("APE: Decoded %lu samples\n",(unsigned long)samplesdone);
|
||||
|
||||
|
|
|
@ -44,8 +44,8 @@ next_track:
|
|||
return CODEC_ERROR;
|
||||
}
|
||||
|
||||
while (!*ci->taginfo_ready && !ci->stop_codec)
|
||||
ci->sleep(1);
|
||||
if (codec_wait_taginfo() != 0)
|
||||
goto request_next_track;
|
||||
|
||||
codec_set_replaygain(ci->id3);
|
||||
|
||||
|
@ -130,6 +130,7 @@ next_track:
|
|||
break;
|
||||
}
|
||||
|
||||
request_next_track:
|
||||
if (ci->request_next_track())
|
||||
goto next_track;
|
||||
|
||||
|
|
|
@ -40,15 +40,18 @@ enum codec_status codec_main(void)
|
|||
int datasize, res, frame_counter, total_frames, seek_frame_offset;
|
||||
uint8_t *bit_buffer;
|
||||
int elapsed = 0;
|
||||
size_t resume_offset = ci->id3->offset;
|
||||
size_t resume_offset;
|
||||
|
||||
next_track:
|
||||
if (codec_init()) {
|
||||
DEBUGF("codec init failed\n");
|
||||
return CODEC_ERROR;
|
||||
}
|
||||
while (!*ci->taginfo_ready && !ci->stop_codec)
|
||||
ci->sleep(1);
|
||||
|
||||
if (codec_wait_taginfo() != 0)
|
||||
goto done;
|
||||
|
||||
resume_offset = ci->id3->offset;
|
||||
|
||||
codec_set_replaygain(ci->id3);
|
||||
ci->memset(&q,0,sizeof(ATRAC3Context));
|
||||
|
|
|
@ -51,15 +51,18 @@ enum codec_status codec_main(void)
|
|||
uint32_t packet_count;
|
||||
int scrambling_unit_size, num_units, elapsed = 0;
|
||||
int playback_on = -1;
|
||||
size_t resume_offset = ci->id3->offset;
|
||||
size_t resume_offset;
|
||||
|
||||
next_track:
|
||||
if (codec_init()) {
|
||||
DEBUGF("codec init failed\n");
|
||||
return CODEC_ERROR;
|
||||
}
|
||||
while (!*ci->taginfo_ready && !ci->stop_codec)
|
||||
ci->sleep(1);
|
||||
|
||||
if (codec_wait_taginfo() != 0)
|
||||
goto done;
|
||||
|
||||
resume_offset = ci->id3->offset;
|
||||
|
||||
codec_set_replaygain(ci->id3);
|
||||
ci->memset(&rmctx,0,sizeof(RMContext));
|
||||
|
|
|
@ -108,7 +108,7 @@ static int convert_au_format(unsigned int encoding, struct pcm_format *fmt)
|
|||
/* this is the codec entry point */
|
||||
enum codec_status codec_main(void)
|
||||
{
|
||||
int status = CODEC_OK;
|
||||
int status;
|
||||
struct pcm_format format;
|
||||
uint32_t bytesdone, decodedsamples;
|
||||
size_t n;
|
||||
|
@ -124,14 +124,16 @@ enum codec_status codec_main(void)
|
|||
ci->configure(DSP_SET_SAMPLE_DEPTH, PCM_OUTPUT_DEPTH-1);
|
||||
|
||||
next_track:
|
||||
status = CODEC_OK;
|
||||
|
||||
if (codec_init()) {
|
||||
DEBUGF("codec_init() error\n");
|
||||
status = CODEC_ERROR;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
while (!*ci->taginfo_ready && !ci->stop_codec)
|
||||
ci->sleep(1);
|
||||
if (codec_wait_taginfo() != 0)
|
||||
goto done;
|
||||
|
||||
codec_set_replaygain(ci->id3);
|
||||
|
||||
|
@ -304,7 +306,6 @@ next_track:
|
|||
endofstream = 1;
|
||||
ci->set_elapsed(decodedsamples*1000LL/ci->id3->frequency);
|
||||
}
|
||||
status = CODEC_OK;
|
||||
|
||||
done:
|
||||
if (ci->request_next_track())
|
||||
|
|
|
@ -47,15 +47,18 @@ enum codec_status codec_main(void)
|
|||
uint16_t fs,sps,h;
|
||||
uint32_t packet_count;
|
||||
int scrambling_unit_size, num_units;
|
||||
size_t resume_offset = ci->id3->offset;
|
||||
size_t resume_offset;
|
||||
|
||||
next_track:
|
||||
if (codec_init()) {
|
||||
DEBUGF("codec init failed\n");
|
||||
return CODEC_ERROR;
|
||||
}
|
||||
while (!*ci->taginfo_ready && !ci->stop_codec)
|
||||
ci->sleep(1);
|
||||
|
||||
if (codec_wait_taginfo() != 0)
|
||||
goto done;
|
||||
|
||||
resume_offset = ci->id3->offset;
|
||||
|
||||
codec_set_replaygain(ci->id3);
|
||||
ci->memset(&rmctx,0,sizeof(RMContext));
|
||||
|
|
|
@ -434,9 +434,7 @@ enum codec_status codec_main(void)
|
|||
ci->configure(DSP_SET_SAMPLE_DEPTH, FLAC_OUTPUT_DEPTH-1);
|
||||
|
||||
next_track:
|
||||
|
||||
/* Need to save offset for later use (cleared indirectly by flac_init) */
|
||||
samplesdone=ci->id3->offset;
|
||||
retval = CODEC_OK;
|
||||
|
||||
if (codec_init()) {
|
||||
LOGF("FLAC: Error initialising codec\n");
|
||||
|
@ -444,8 +442,11 @@ enum codec_status codec_main(void)
|
|||
goto exit;
|
||||
}
|
||||
|
||||
while (!*ci->taginfo_ready && !ci->stop_codec)
|
||||
ci->sleep(1);
|
||||
if (codec_wait_taginfo() != 0)
|
||||
goto done;
|
||||
|
||||
/* Need to save offset for later use (cleared indirectly by flac_init) */
|
||||
samplesdone = ci->id3->offset;
|
||||
|
||||
if (!flac_init(&fc,ci->id3->first_frame_offset)) {
|
||||
LOGF("FLAC: Error initialising codec\n");
|
||||
|
|
|
@ -49,6 +49,19 @@ void codec_set_replaygain(struct mp3entry* id3)
|
|||
ci->configure(DSP_SET_ALBUM_PEAK, id3->album_peak);
|
||||
}
|
||||
|
||||
/* Note: codec really needs its own private metdata copy for the current
|
||||
track being processed in order to be stable. */
|
||||
int codec_wait_taginfo(void)
|
||||
{
|
||||
while (!*ci->taginfo_ready && !ci->stop_codec && !ci->new_track)
|
||||
ci->sleep(0);
|
||||
if (ci->stop_codec)
|
||||
return -1;
|
||||
if (ci->new_track)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Various "helper functions" common to all the xxx2wav decoder plugins */
|
||||
|
||||
|
||||
|
|
|
@ -157,6 +157,7 @@ static inline unsigned int bs_generic(unsigned int v, int mode)
|
|||
|
||||
int codec_init(void);
|
||||
void codec_set_replaygain(struct mp3entry* id3);
|
||||
int codec_wait_taginfo(void); /* 0 = success */
|
||||
|
||||
#ifdef RB_PROFILE
|
||||
void __cyg_profile_func_enter(void *this_fn, void *call_site)
|
||||
|
|
|
@ -1232,8 +1232,8 @@ next_track:
|
|||
return CODEC_ERROR;
|
||||
}
|
||||
|
||||
while (!*ci->taginfo_ready && !ci->stop_codec)
|
||||
ci->sleep(1);
|
||||
if (codec_wait_taginfo() != 0)
|
||||
goto request_next_track;
|
||||
|
||||
codec_set_replaygain(ci->id3);
|
||||
|
||||
|
@ -1305,6 +1305,7 @@ next_track:
|
|||
|
||||
}
|
||||
|
||||
request_next_track:
|
||||
if (ci->request_next_track())
|
||||
goto next_track;
|
||||
|
||||
|
|
|
@ -325,15 +325,14 @@ enum codec_status codec_main(void)
|
|||
return CODEC_ERROR;
|
||||
|
||||
next_track:
|
||||
|
||||
status = CODEC_OK;
|
||||
|
||||
/* Reinitializing seems to be necessary to avoid playback quircks when seeking. */
|
||||
init_mad();
|
||||
|
||||
file_end = 0;
|
||||
while (!*ci->taginfo_ready && !ci->stop_codec)
|
||||
ci->sleep(1);
|
||||
if (codec_wait_taginfo() != 0)
|
||||
goto request_next_track;
|
||||
|
||||
ci->configure(DSP_SWITCH_FREQUENCY, ci->id3->frequency);
|
||||
current_frequency = ci->id3->frequency;
|
||||
|
@ -505,6 +504,7 @@ next_track:
|
|||
framelength - stop_skip);
|
||||
}
|
||||
|
||||
request_next_track:
|
||||
if (ci->request_next_track())
|
||||
goto next_track;
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ enum codec_status codec_main(void)
|
|||
mpc_streaminfo info;
|
||||
mpc_frame_info frame;
|
||||
mpc_demux *demux = NULL;
|
||||
int retval = CODEC_OK;
|
||||
int retval;
|
||||
|
||||
frame.buffer = sample_buffer;
|
||||
|
||||
|
@ -79,14 +79,16 @@ enum codec_status codec_main(void)
|
|||
reader.get_size = get_size_impl;
|
||||
|
||||
next_track:
|
||||
retval = CODEC_OK;
|
||||
|
||||
if (codec_init())
|
||||
{
|
||||
retval = CODEC_ERROR;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
while (!*ci->taginfo_ready && !ci->stop_codec)
|
||||
ci->sleep(1);
|
||||
if (codec_wait_taginfo() != 0)
|
||||
goto done;
|
||||
|
||||
/* Initialize demux/decoder. */
|
||||
demux = mpc_demux_init(&reader);
|
||||
|
|
|
@ -4344,8 +4344,8 @@ next_track:
|
|||
|
||||
|
||||
/* wait for track info to load */
|
||||
while (!*ci->taginfo_ready && !ci->stop_codec)
|
||||
ci->sleep(1);
|
||||
if (codec_wait_taginfo() != 0)
|
||||
goto request_next_track;
|
||||
|
||||
codec_set_replaygain(ci->id3);
|
||||
|
||||
|
@ -4449,6 +4449,7 @@ init_nsf:
|
|||
|
||||
print_timers(last_path,track);
|
||||
|
||||
request_next_track:
|
||||
if (ci->request_next_track()) {
|
||||
if (ci->global_settings->repeat_mode==REPEAT_ONE) {
|
||||
/* in repeat one mode just advance to the next track */
|
||||
|
|
|
@ -56,7 +56,7 @@ enum codec_status codec_main(void)
|
|||
uint32_t s = 0; /* sample rate */
|
||||
unsigned char c = 0; /* channels */
|
||||
int playback_on = -1;
|
||||
size_t resume_offset = ci->id3->offset;
|
||||
size_t resume_offset;
|
||||
|
||||
/* Generic codec initialisation */
|
||||
ci->configure(DSP_SET_STEREO_MODE, STEREO_NONINTERLEAVED);
|
||||
|
@ -70,8 +70,10 @@ next_track:
|
|||
return CODEC_ERROR;
|
||||
}
|
||||
|
||||
while (!*ci->taginfo_ready && !ci->stop_codec)
|
||||
ci->sleep(1);
|
||||
if (codec_wait_taginfo() != 0)
|
||||
goto done;
|
||||
|
||||
resume_offset = ci->id3->offset;
|
||||
|
||||
ci->memset(&rmctx,0,sizeof(RMContext));
|
||||
ci->memset(&pkt,0,sizeof(RMPacket));
|
||||
|
@ -224,8 +226,6 @@ seek_start:
|
|||
ci->advance_buffer(pkt.length);
|
||||
}
|
||||
|
||||
err = CODEC_OK;
|
||||
|
||||
done:
|
||||
if (ci->request_next_track())
|
||||
goto next_track;
|
||||
|
|
|
@ -57,8 +57,8 @@ next_track:
|
|||
return CODEC_ERROR;
|
||||
}
|
||||
|
||||
while (!*ci->taginfo_ready)
|
||||
ci->yield();
|
||||
if (codec_wait_taginfo() != 0)
|
||||
goto request_next_track;
|
||||
|
||||
codec_set_replaygain(ci->id3);
|
||||
|
||||
|
@ -153,6 +153,7 @@ seek_start:
|
|||
sc.bitindex = sc.gb.index - 8*consumed;
|
||||
}
|
||||
|
||||
request_next_track:
|
||||
if (ci->request_next_track())
|
||||
goto next_track;
|
||||
|
||||
|
|
|
@ -1220,8 +1220,8 @@ next_track:
|
|||
return CODEC_ERROR;
|
||||
}
|
||||
|
||||
while (!*ci->taginfo_ready && !ci->stop_codec)
|
||||
ci->sleep(1);
|
||||
if (codec_wait_taginfo() != 0)
|
||||
goto request_next_track;
|
||||
|
||||
codec_set_replaygain(ci->id3);
|
||||
|
||||
|
@ -1306,6 +1306,7 @@ next_track:
|
|||
ci->pcmbuf_insert(samples, NULL, CHUNK_SIZE);
|
||||
}
|
||||
|
||||
request_next_track:
|
||||
if (ci->request_next_track())
|
||||
goto next_track;
|
||||
|
||||
|
|
|
@ -334,7 +334,7 @@ static uint8_t *read_buffer(size_t *realsize)
|
|||
|
||||
enum codec_status codec_main(void)
|
||||
{
|
||||
int status = CODEC_OK;
|
||||
int status;
|
||||
uint32_t decodedsamples;
|
||||
size_t n;
|
||||
int bufcount;
|
||||
|
@ -347,13 +347,15 @@ enum codec_status codec_main(void)
|
|||
ci->configure(DSP_SET_SAMPLE_DEPTH, PCM_OUTPUT_DEPTH-1);
|
||||
|
||||
next_track:
|
||||
status = CODEC_OK;
|
||||
|
||||
if (codec_init()) {
|
||||
status = CODEC_ERROR;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
while (!*ci->taginfo_ready && !ci->stop_codec)
|
||||
ci->sleep(1);
|
||||
if (codec_wait_taginfo() != 0)
|
||||
goto done;
|
||||
|
||||
codec_set_replaygain(ci->id3);
|
||||
|
||||
|
@ -479,7 +481,6 @@ next_track:
|
|||
|
||||
ci->set_elapsed(decodedsamples*1000LL/ci->id3->frequency);
|
||||
}
|
||||
status = CODEC_OK;
|
||||
|
||||
done:
|
||||
if (ci->request_next_track())
|
||||
|
|
|
@ -553,8 +553,8 @@ enum codec_status codec_main(void)
|
|||
ci->configure(DSP_SET_STEREO_MODE, STEREO_NONINTERLEAVED);
|
||||
|
||||
/* wait for track info to load */
|
||||
while (!*ci->taginfo_ready && !ci->stop_codec)
|
||||
ci->yield();
|
||||
if (codec_wait_taginfo() != 0)
|
||||
continue;
|
||||
|
||||
codec_set_replaygain(ci->id3);
|
||||
|
||||
|
|
|
@ -371,7 +371,7 @@ static void *process_header(spx_ogg_packet *op,
|
|||
enum codec_status codec_main(void)
|
||||
{
|
||||
SpeexBits bits;
|
||||
int error = 0;
|
||||
int error;
|
||||
int eof = 0;
|
||||
spx_ogg_sync_state oy;
|
||||
spx_ogg_page og;
|
||||
|
@ -395,16 +395,18 @@ enum codec_status codec_main(void)
|
|||
|
||||
/* Ogg handling still uses mallocs, so reset the malloc buffer per track */
|
||||
next_track:
|
||||
error = CODEC_OK;
|
||||
|
||||
if (codec_init()) {
|
||||
error = CODEC_ERROR;
|
||||
goto exit;
|
||||
}
|
||||
stereo = speex_stereo_state_init();
|
||||
strtoffset = ci->id3->offset;
|
||||
|
||||
while (!*ci->taginfo_ready && !ci->stop_codec)
|
||||
ci->sleep(1);
|
||||
if (codec_wait_taginfo() != 0)
|
||||
goto done;
|
||||
|
||||
strtoffset = ci->id3->offset;
|
||||
|
||||
spx_ogg_sync_init(&oy);
|
||||
spx_ogg_alloc_buffer(&oy,2*CHUNKSIZE);
|
||||
|
@ -569,8 +571,6 @@ done:
|
|||
goto next_track;
|
||||
}
|
||||
|
||||
error = CODEC_OK;
|
||||
|
||||
exit:
|
||||
speex_bits_destroy(&bits);
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ static int32_t samples[PCM_BUFFER_LENGTH * 2] IBSS_ATTR;
|
|||
enum codec_status codec_main(void)
|
||||
{
|
||||
tta_info info;
|
||||
int status = CODEC_OK;
|
||||
int status;
|
||||
unsigned int decodedsamples;
|
||||
int endofstream;
|
||||
int new_pos = 0;
|
||||
|
@ -47,6 +47,8 @@ enum codec_status codec_main(void)
|
|||
ci->configure(DSP_SET_SAMPLE_DEPTH, TTA_OUTPUT_DEPTH - 1);
|
||||
|
||||
next_track:
|
||||
status = CODEC_OK;
|
||||
|
||||
if (codec_init())
|
||||
{
|
||||
DEBUGF("codec_init() error\n");
|
||||
|
@ -54,8 +56,8 @@ next_track:
|
|||
goto exit;
|
||||
}
|
||||
|
||||
while (!*ci->taginfo_ready && !ci->stop_codec)
|
||||
ci->sleep(1);
|
||||
if (codec_wait_taginfo() != 0)
|
||||
goto done;
|
||||
|
||||
if (set_tta_info(&info) < 0 || player_init(&info) < 0)
|
||||
{
|
||||
|
@ -117,7 +119,7 @@ next_track:
|
|||
endofstream = 1;
|
||||
ci->set_elapsed((uint64_t)info.LENGTH * 1000 * decodedsamples / info.DATALENGTH);
|
||||
}
|
||||
status = CODEC_OK;
|
||||
|
||||
done:
|
||||
player_stop();
|
||||
if (ci->request_next_track())
|
||||
|
|
|
@ -136,10 +136,12 @@ enum codec_status codec_main(void)
|
|||
#endif
|
||||
|
||||
next_track:
|
||||
error = CODEC_OK;
|
||||
|
||||
ogg_malloc_init();
|
||||
|
||||
while (!*ci->taginfo_ready && !ci->stop_codec)
|
||||
ci->sleep(1);
|
||||
if (codec_wait_taginfo() != 0)
|
||||
goto done;
|
||||
|
||||
/* Create a decoder instance */
|
||||
callbacks.read_func = read_handler;
|
||||
|
@ -233,7 +235,6 @@ next_track:
|
|||
ci->set_elapsed(ov_time_tell(&vf));
|
||||
}
|
||||
}
|
||||
error = CODEC_OK;
|
||||
|
||||
done:
|
||||
#if 0 /* defined(SIMULATOR) */
|
||||
|
|
|
@ -46,7 +46,7 @@ static uint8_t *read_buffer(size_t *realsize)
|
|||
/* this is the codec entry point */
|
||||
enum codec_status codec_main(void)
|
||||
{
|
||||
int status = CODEC_OK;
|
||||
int status;
|
||||
uint32_t decodedsamples;
|
||||
size_t n;
|
||||
int bufcount;
|
||||
|
@ -59,14 +59,16 @@ enum codec_status codec_main(void)
|
|||
ci->configure(DSP_SET_SAMPLE_DEPTH, PCM_OUTPUT_DEPTH-1);
|
||||
|
||||
next_track:
|
||||
status = CODEC_OK;
|
||||
|
||||
if (codec_init()) {
|
||||
DEBUGF("codec_init() error\n");
|
||||
status = CODEC_ERROR;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
while (!*ci->taginfo_ready && !ci->stop_codec)
|
||||
ci->sleep(1);
|
||||
if (codec_wait_taginfo() != 0)
|
||||
goto done;
|
||||
|
||||
codec_set_replaygain(ci->id3);
|
||||
|
||||
|
@ -189,7 +191,6 @@ next_track:
|
|||
endofstream = 1;
|
||||
ci->set_elapsed(decodedsamples*1000LL/ci->id3->frequency);
|
||||
}
|
||||
status = CODEC_OK;
|
||||
|
||||
done:
|
||||
if (ci->request_next_track())
|
||||
|
|
|
@ -153,7 +153,7 @@ static uint8_t *read_buffer(size_t *realsize)
|
|||
/* this is the codec entry point */
|
||||
enum codec_status codec_main(void)
|
||||
{
|
||||
int status = CODEC_OK;
|
||||
int status;
|
||||
uint32_t decodedsamples;
|
||||
size_t n;
|
||||
int bufcount;
|
||||
|
@ -168,14 +168,16 @@ enum codec_status codec_main(void)
|
|||
ci->configure(DSP_SET_SAMPLE_DEPTH, PCM_OUTPUT_DEPTH-1);
|
||||
|
||||
next_track:
|
||||
status = CODEC_OK;
|
||||
|
||||
if (codec_init()) {
|
||||
DEBUGF("codec_init() error\n");
|
||||
status = CODEC_ERROR;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
while (!*ci->taginfo_ready && !ci->stop_codec)
|
||||
ci->sleep(1);
|
||||
if (codec_wait_taginfo() != 0)
|
||||
goto done;
|
||||
|
||||
codec_set_replaygain(ci->id3);
|
||||
|
||||
|
@ -437,7 +439,6 @@ next_track:
|
|||
endofstream = 1;
|
||||
ci->set_elapsed(decodedsamples*1000LL/ci->id3->frequency);
|
||||
}
|
||||
status = CODEC_OK;
|
||||
|
||||
done:
|
||||
if (ci->request_next_track())
|
||||
|
|
|
@ -161,7 +161,7 @@ static uint8_t *read_buffer(size_t *realsize)
|
|||
/* this is the codec entry point */
|
||||
enum codec_status codec_main(void)
|
||||
{
|
||||
int status = CODEC_OK;
|
||||
int status;
|
||||
uint32_t decodedsamples;
|
||||
size_t n;
|
||||
int bufcount;
|
||||
|
@ -176,14 +176,16 @@ enum codec_status codec_main(void)
|
|||
ci->configure(DSP_SET_SAMPLE_DEPTH, PCM_OUTPUT_DEPTH-1);
|
||||
|
||||
next_track:
|
||||
status = CODEC_OK;
|
||||
|
||||
if (codec_init()) {
|
||||
DEBUGF("codec_init() error\n");
|
||||
status = CODEC_ERROR;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
while (!*ci->taginfo_ready && !ci->stop_codec)
|
||||
ci->sleep(1);
|
||||
if (codec_wait_taginfo() != 0)
|
||||
goto done;
|
||||
|
||||
codec_set_replaygain(ci->id3);
|
||||
|
||||
|
|
|
@ -47,14 +47,15 @@ enum codec_status codec_main(void)
|
|||
ci->configure(DSP_SET_SAMPLE_DEPTH, 28);
|
||||
|
||||
next_track:
|
||||
retval = CODEC_OK;
|
||||
|
||||
if (codec_init()) {
|
||||
retval = CODEC_ERROR;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
while (!*ci->taginfo_ready && !ci->stop_codec)
|
||||
ci->sleep(1);
|
||||
if (codec_wait_taginfo() != 0)
|
||||
goto done;
|
||||
|
||||
/* Create a decoder instance */
|
||||
wpc = WavpackOpenFileInput (read_callback, error);
|
||||
|
@ -121,7 +122,6 @@ enum codec_status codec_main(void)
|
|||
ci->set_elapsed (WavpackGetSampleIndex (wpc) / sr_100 * 10);
|
||||
ci->yield ();
|
||||
}
|
||||
retval = CODEC_OK;
|
||||
|
||||
done:
|
||||
if (ci->request_next_track())
|
||||
|
|
|
@ -46,19 +46,22 @@ enum codec_status codec_main(void)
|
|||
ci->configure(DSP_SET_SAMPLE_DEPTH, 29);
|
||||
|
||||
next_track:
|
||||
retval = CODEC_OK;
|
||||
|
||||
/* Proper reset of the decoder context. */
|
||||
memset(&wmadec, 0, sizeof(wmadec));
|
||||
|
||||
/* Wait for the metadata to be read */
|
||||
while (!*ci->taginfo_ready && !ci->stop_codec)
|
||||
ci->sleep(1);
|
||||
|
||||
retval = CODEC_OK;
|
||||
if (codec_wait_taginfo() != 0)
|
||||
goto done;
|
||||
|
||||
/* Remember the resume position - when the codec is opened, the
|
||||
playback engine will reset it. */
|
||||
resume_offset = ci->id3->offset;
|
||||
|
||||
restart_track:
|
||||
retval = CODEC_OK;
|
||||
|
||||
if (codec_init()) {
|
||||
LOGF("WMA: Error initialising codec\n");
|
||||
retval = CODEC_ERROR;
|
||||
|
@ -176,7 +179,6 @@ new_packet:
|
|||
|
||||
ci->advance_buffer(packetlength);
|
||||
}
|
||||
retval = CODEC_OK;
|
||||
|
||||
done:
|
||||
/*LOGF("WMA: Decoded %ld samples\n",elapsedtime*wfx.rate/1000);*/
|
||||
|
|
|
@ -48,16 +48,18 @@ enum codec_status codec_main(void)
|
|||
|
||||
|
||||
next_track:
|
||||
retval = CODEC_OK;
|
||||
|
||||
/* Wait for the metadata to be read */
|
||||
while (!*ci->taginfo_ready && !ci->stop_codec)
|
||||
ci->sleep(1);
|
||||
|
||||
retval = CODEC_OK;
|
||||
if (codec_wait_taginfo() != 0)
|
||||
goto done;
|
||||
|
||||
/* Remember the resume position */
|
||||
resume_offset = ci->id3->offset;
|
||||
|
||||
restart_track:
|
||||
retval = CODEC_OK;
|
||||
|
||||
if (codec_init()) {
|
||||
LOGF("(WMA PRO) Error: Error initialising codec\n");
|
||||
retval = CODEC_ERROR;
|
||||
|
@ -149,7 +151,6 @@ next_track:
|
|||
/* Advance to the next logical packet */
|
||||
ci->advance_buffer(packetlength);
|
||||
}
|
||||
retval = CODEC_OK;
|
||||
|
||||
done:
|
||||
if (ci->request_next_track())
|
||||
|
|
|
@ -70,16 +70,17 @@ enum codec_status codec_main(void)
|
|||
|
||||
|
||||
next_track:
|
||||
retval = CODEC_OK;
|
||||
|
||||
/* Wait for the metadata to be read */
|
||||
while (!*ci->taginfo_ready && !ci->stop_codec)
|
||||
ci->sleep(1);
|
||||
|
||||
retval = CODEC_OK;
|
||||
if (codec_wait_taginfo() != 0)
|
||||
goto done;
|
||||
|
||||
/* Remember the resume position */
|
||||
resume_offset = ci->id3->offset;
|
||||
restart_track:
|
||||
retval = CODEC_OK;
|
||||
|
||||
if (codec_init()) {
|
||||
LOGF("(WMA Voice) Error: Error initialising codec\n");
|
||||
retval = CODEC_ERROR;
|
||||
|
@ -184,7 +185,6 @@ new_packet:
|
|||
/* Advance to the next logical packet */
|
||||
ci->advance_buffer(packetlength);
|
||||
}
|
||||
retval = CODEC_OK;
|
||||
|
||||
done:
|
||||
if (ci->request_next_track())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue