From 65109732230849eeb9eec2f56f9e046ad6b476c3 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Wed, 23 Feb 2011 14:31:13 +0000 Subject: Give playback engine better control over the codec. Codec simply follows commands and doesn't concern itself with audio state. Get track change notification in on the actual last buffer insert of the track because now audio simply waits for a track change notify from PCM on the last track and it must be sent reliably. This is still at an intermediate stage but works. Codecs and plugins become incompatible. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29387 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/test_codec.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'apps/plugins') diff --git a/apps/plugins/test_codec.c b/apps/plugins/test_codec.c index 9b00fdbb95..30757381bf 100644 --- a/apps/plugins/test_codec.c +++ b/apps/plugins/test_codec.c @@ -516,13 +516,6 @@ static bool request_next_track(void) } -/* Free the buffer area of the current codec after its loaded */ -static void discard_codec(void) -{ - /* ??? */ -} - - static void set_offset(size_t value) { /* ??? */ @@ -576,7 +569,6 @@ static void init_ci(void) ci.seek_buffer = seek_buffer; ci.seek_complete = seek_complete; ci.request_next_track = request_next_track; - ci.discard_codec = discard_codec; ci.set_offset = set_offset; ci.configure = configure; ci.dsp = (struct dsp_config *)rb->dsp_configure(NULL, DSP_MYDSP, @@ -636,12 +628,19 @@ static void init_ci(void) static void codec_thread(void) { const char* codecname; - int res; + void *handle; + int res = CODEC_ERROR; codecname = rb->get_codec_filename(track.id3.codectype); /* Load the codec and start decoding. */ - res = rb->codec_load_file(codecname,&ci); + handle = rb->codec_load_file(codecname,&ci); + + if (handle != NULL) + { + res = rb->codec_begin(handle); + rb->codec_close(handle); + } /* Signal to the main thread that we are done */ endtick = *rb->current_tick - rebuffertick; -- cgit v1.2.3