diff options
author | Kelvie Wong <kelvie@ieee.org> | 2009-12-16 00:27:52 -0800 |
---|---|---|
committer | Kelvie Wong <kelvie@ieee.org> | 2009-12-16 00:27:52 -0800 |
commit | 2bdbfec226e39c0875f9771ffb6a33732f9ed7af (patch) | |
tree | 0f1c9020a7ad5030cdf954365e40de2ffad5b256 | |
parent | 0db9edf88fd4ebce5581c7bb22402dc312bffc69 (diff) | |
download | xine-lib-2bdbfec226e39c0875f9771ffb6a33732f9ed7af.tar.gz xine-lib-2bdbfec226e39c0875f9771ffb6a33732f9ed7af.tar.bz2 |
TTA demux: use _x_demux_send_data
To reduce code duplication.
-rw-r--r-- | src/demuxers/demux_tta.c | 44 |
1 files changed, 11 insertions, 33 deletions
diff --git a/src/demuxers/demux_tta.c b/src/demuxers/demux_tta.c index 10229ed64..57d2c8357 100644 --- a/src/demuxers/demux_tta.c +++ b/src/demuxers/demux_tta.c @@ -122,39 +122,17 @@ static int demux_tta_send_chunk(demux_plugin_t *this_gen) { bytes_to_read = le2me_32(this->seektable[this->currentframe]); - while(bytes_to_read) { - off_t bytes_read = 0; - buf_element_t *buf = NULL; - - /* Get a buffer */ - buf = this->audio_fifo->buffer_pool_alloc(this->audio_fifo); - buf->type = BUF_AUDIO_TTA; - buf->pts = (int64_t)(FRAME_TIME * this->currentframe * 90000); - buf->extra_info->total_time = (int)(le2me_32(this->header.tta.data_length) * 1000.0 / le2me_32(this->header.tta.samplerate)); /* milliseconds */ - buf->decoder_flags = 0; - - /* Set normalised position */ - buf->extra_info->input_normpos = - (int) ((double) this->currentframe * 65535 / this->totalframes); - - /* Set time */ - buf->extra_info->input_time = (int)(FRAME_TIME * this->currentframe * 1000); - - bytes_read = this->input->read(this->input, buf->content, ( bytes_to_read > buf->max_size ) ? buf->max_size : bytes_to_read); - if (bytes_read < 0) { - this->status = DEMUX_FINISHED; - break; - } - - buf->size = bytes_read; - - bytes_to_read -= bytes_read; - - if ( bytes_to_read <= 0 ) - buf->decoder_flags |= BUF_FLAG_FRAME_END; - - this->audio_fifo->put(this->audio_fifo, buf); - } + _x_demux_read_send_data(this->audio_fifo, + this->input, + bytes_to_read, + (int64_t)(FRAME_TIME * this->currentframe * 90000), + BUF_AUDIO_TTA, + /*decoder_flags*/ 0, + (int) ((double) this->currentframe * 65535.0 / this->totalframes), + (int)(FRAME_TIME * this->currentframe * 1000), + (int)(le2me_32(this->header.tta.data_length) * 1000.0 / + le2me_32(this->header.tta.samplerate)), + this->currentframe); this->currentframe++; |