mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
Commit work started in FS#12153 to put timing/position information in PCM
buffer chunks. * Samples and position indication is closely associated with audio data instead of compensating by a latency constant. Alleviates problems with using the elapsed as a track indicator where it could be off by several steps. * Timing is accurate throughout track even if resampling for pitch shift, whereas before it updated during transition latency at the normal 1:1 rate. * Simpler PCM buffer with a constant chunk size, no linked lists. In converting crossfade, a minor change was made to not change the WPS until the fade-in of the incoming track, whereas before it would change upon the start of the fade-out of the outgoing track possibly having the WPS change with far too much lead time. Codec changes are to set elapsed times *before* writing next PCM frame because time and position data last set are saved in the next committed PCM chunk. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30366 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
463b3ed8b2
commit
7ad2cad173
32 changed files with 969 additions and 830 deletions
|
@ -77,9 +77,10 @@ struct codec_load_info
|
|||
static int codec_type = AFMT_UNKNOWN; /* Codec type (C,A-) */
|
||||
|
||||
/* Private interfaces to main playback control */
|
||||
extern void audio_codec_update_elapsed(unsigned long value);
|
||||
extern void audio_codec_update_offset(size_t value);
|
||||
extern void audio_queue_post(long id, intptr_t data);
|
||||
extern void audio_codec_update_elapsed(unsigned long elapsed);
|
||||
extern void audio_codec_update_offset(size_t offset);
|
||||
extern void audio_codec_complete(int status);
|
||||
extern void audio_codec_seek_complete(void);
|
||||
extern struct codec_api ci; /* from codecs.c */
|
||||
|
||||
/* Codec thread */
|
||||
|
@ -251,7 +252,7 @@ static void codec_pcmbuf_insert_callback(
|
|||
if (out_count <= 0)
|
||||
return;
|
||||
|
||||
pcmbuf_write_complete(out_count);
|
||||
pcmbuf_write_complete(out_count, ci.id3->elapsed, ci.id3->offset);
|
||||
|
||||
count -= inp_count;
|
||||
}
|
||||
|
@ -334,9 +335,11 @@ static void codec_seek_complete_callback(void)
|
|||
/* Clear DSP */
|
||||
dsp_configure(ci.dsp, DSP_FLUSH, 0);
|
||||
|
||||
/* Sync position */
|
||||
audio_codec_update_offset(ci.curpos);
|
||||
|
||||
/* Post notification to audio thread */
|
||||
LOGFQUEUE("audio > Q_AUDIO_CODEC_SEEK_COMPLETE");
|
||||
audio_queue_post(Q_AUDIO_CODEC_SEEK_COMPLETE, 0);
|
||||
audio_codec_seek_complete();
|
||||
|
||||
/* Wait for urgent or go message */
|
||||
do
|
||||
|
@ -521,8 +524,7 @@ static void run_codec(void)
|
|||
|
||||
/* Notify audio that we're done for better or worse - advise of the
|
||||
status */
|
||||
LOGFQUEUE("codec > audio Q_AUDIO_CODEC_COMPLETE: %d", status);
|
||||
audio_queue_post(Q_AUDIO_CODEC_COMPLETE, status);
|
||||
audio_codec_complete(status);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue