diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2011-04-27 03:08:23 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2011-04-27 03:08:23 +0000 |
commit | c537d5958e8b421ac4f9bef6c8b9e7425a6cf167 (patch) | |
tree | 7ed36518fb6524da7bbd913ba7619b85b5d15d23 /apps/codecs/wav_enc.c | |
parent | dcf0f8de4a37ff1d2ea510aef75fa67977a8bdcc (diff) | |
download | rockbox-c537d5958e8b421ac4f9bef6c8b9e7425a6cf167.tar.gz rockbox-c537d5958e8b421ac4f9bef6c8b9e7425a6cf167.zip |
Commit FS#12069 - Playback rework - first stages. Gives as thorough as possible a treatment of codec management, track change and metadata logic as possible while maintaining fairly narrow focus and not rewriting everything all at once. Please see the rockbox-dev mail archive on 2011-04-25 (Playback engine rework) for a more thorough manifest of what was addressed. Plugins and codecs become incompatible.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29785 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/wav_enc.c')
-rw-r--r-- | apps/codecs/wav_enc.c | 54 |
1 files changed, 28 insertions, 26 deletions
diff --git a/apps/codecs/wav_enc.c b/apps/codecs/wav_enc.c index ef1a88ec23..e4afeaf93c 100644 --- a/apps/codecs/wav_enc.c +++ b/apps/codecs/wav_enc.c | |||
@@ -345,40 +345,42 @@ static bool init_encoder(void) | |||
345 | return true; | 345 | return true; |
346 | } /* init_encoder */ | 346 | } /* init_encoder */ |
347 | 347 | ||
348 | /* main codec entry point */ | 348 | /* this is the codec entry point */ |
349 | enum codec_status codec_main(void) | 349 | enum codec_status codec_main(enum codec_entry_call_reason reason) |
350 | { | 350 | { |
351 | if (!init_encoder()) | 351 | if (reason == CODEC_LOAD) { |
352 | return CODEC_ERROR; | 352 | if (!init_encoder()) |
353 | return CODEC_ERROR; | ||
354 | } | ||
355 | else if (reason == CODEC_UNLOAD) { | ||
356 | /* reset parameters to initial state */ | ||
357 | ci->enc_set_parameters(NULL); | ||
358 | } | ||
353 | 359 | ||
360 | return CODEC_OK; | ||
361 | } | ||
362 | |||
363 | /* this is called for each file to process */ | ||
364 | enum codec_status codec_run(void) | ||
365 | { | ||
354 | /* main encoding loop */ | 366 | /* main encoding loop */ |
355 | while(!ci->stop_codec) | 367 | while(ci->get_command(NULL) != CODEC_ACTION_HALT) |
356 | { | 368 | { |
357 | uint32_t *src; | 369 | uint32_t *src = (uint32_t *)ci->enc_get_pcm_data(PCM_CHUNK_SIZE); |
370 | struct enc_chunk_hdr *chunk; | ||
358 | 371 | ||
359 | while ((src = (uint32_t *)ci->enc_get_pcm_data(PCM_CHUNK_SIZE)) != NULL) | 372 | if(src == NULL) |
360 | { | 373 | continue; |
361 | struct enc_chunk_hdr *chunk; | ||
362 | |||
363 | if (ci->stop_codec) | ||
364 | break; | ||
365 | 374 | ||
366 | chunk = ci->enc_get_chunk(); | 375 | chunk = ci->enc_get_chunk(); |
367 | chunk->enc_size = enc_size; | 376 | chunk->enc_size = enc_size; |
368 | chunk->num_pcm = PCM_SAMP_PER_CHUNK; | 377 | chunk->num_pcm = PCM_SAMP_PER_CHUNK; |
369 | chunk->enc_data = ENC_CHUNK_SKIP_HDR(chunk->enc_data, chunk); | 378 | chunk->enc_data = ENC_CHUNK_SKIP_HDR(chunk->enc_data, chunk); |
370 | 379 | ||
371 | chunk_to_wav_format(src, (uint32_t *)chunk->enc_data); | 380 | chunk_to_wav_format(src, (uint32_t *)chunk->enc_data); |
372 | 381 | ||
373 | ci->enc_finish_chunk(); | 382 | ci->enc_finish_chunk(); |
374 | ci->yield(); | ||
375 | } | ||
376 | |||
377 | ci->yield(); | ||
378 | } | 383 | } |
379 | 384 | ||
380 | /* reset parameters to initial state */ | ||
381 | ci->enc_set_parameters(NULL); | ||
382 | |||
383 | return CODEC_OK; | 385 | return CODEC_OK; |
384 | } /* codec_start */ | 386 | } |