summaryrefslogtreecommitdiff
path: root/apps/codecs/aiff_enc.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2011-04-27 03:08:23 +0000
committerMichael Sevakis <jethead71@rockbox.org>2011-04-27 03:08:23 +0000
commitc537d5958e8b421ac4f9bef6c8b9e7425a6cf167 (patch)
tree7ed36518fb6524da7bbd913ba7619b85b5d15d23 /apps/codecs/aiff_enc.c
parentdcf0f8de4a37ff1d2ea510aef75fa67977a8bdcc (diff)
downloadrockbox-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/aiff_enc.c')
-rw-r--r--apps/codecs/aiff_enc.c54
1 files changed, 28 insertions, 26 deletions
diff --git a/apps/codecs/aiff_enc.c b/apps/codecs/aiff_enc.c
index 69496f70ac..fc44196eb0 100644
--- a/apps/codecs/aiff_enc.c
+++ b/apps/codecs/aiff_enc.c
@@ -359,40 +359,42 @@ static bool init_encoder(void)
359 return true; 359 return true;
360} /* init_encoder */ 360} /* init_encoder */
361 361
362/* main codec entry point */ 362/* this is the codec entry point */
363enum codec_status codec_main(void) 363enum codec_status codec_main(enum codec_entry_call_reason reason)
364{ 364{
365 if (!init_encoder()) 365 if (reason == CODEC_LOAD) {
366 return CODEC_ERROR; 366 if (!init_encoder())
367 return CODEC_ERROR;
368 }
369 else if (reason == CODEC_UNLOAD) {
370 /* reset parameters to initial state */
371 ci->enc_set_parameters(NULL);
372 }
367 373
374 return CODEC_OK;
375}
376
377/* this is called for each file to process */
378enum codec_status codec_run(void)
379{
368 /* main encoding loop */ 380 /* main encoding loop */
369 while(!ci->stop_codec) 381 while (ci->get_command(NULL) != CODEC_ACTION_HALT)
370 { 382 {
371 uint32_t *src; 383 uint32_t *src = (uint32_t *)ci->enc_get_pcm_data(PCM_CHUNK_SIZE);
384 struct enc_chunk_hdr *chunk;
372 385
373 while ((src = (uint32_t *)ci->enc_get_pcm_data(PCM_CHUNK_SIZE)) != NULL) 386 if (src == NULL)
374 { 387 continue;
375 struct enc_chunk_hdr *chunk;
376
377 if (ci->stop_codec)
378 break;
379 388
380 chunk = ci->enc_get_chunk(); 389 chunk = ci->enc_get_chunk();
381 chunk->enc_size = enc_size; 390 chunk->enc_size = enc_size;
382 chunk->num_pcm = PCM_SAMP_PER_CHUNK; 391 chunk->num_pcm = PCM_SAMP_PER_CHUNK;
383 chunk->enc_data = ENC_CHUNK_SKIP_HDR(chunk->enc_data, chunk); 392 chunk->enc_data = ENC_CHUNK_SKIP_HDR(chunk->enc_data, chunk);
384 393
385 chunk_to_aiff_format(src, (uint32_t *)chunk->enc_data); 394 chunk_to_aiff_format(src, (uint32_t *)chunk->enc_data);
386
387 ci->enc_finish_chunk();
388 ci->yield();
389 }
390 395
391 ci->yield(); 396 ci->enc_finish_chunk();
392 } 397 }
393 398
394 /* reset parameters to initial state */
395 ci->enc_set_parameters(NULL);
396
397 return CODEC_OK; 399 return CODEC_OK;
398} /* codec_start */ 400}