summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKelvie Wong <kelvie@ieee.org>2009-12-15 20:49:16 -0800
committerKelvie Wong <kelvie@ieee.org>2009-12-15 20:49:16 -0800
commitbf59cde213a99c76fd6d8740d1f819b45e2ae984 (patch)
treea005cf6fd795e435bd0b7e973f6af76dac3b3abd /src
parent55e59f17a96caf51cdad116e5990a79df75d2339 (diff)
downloadxine-lib-bf59cde213a99c76fd6d8740d1f819b45e2ae984.tar.gz
xine-lib-bf59cde213a99c76fd6d8740d1f819b45e2ae984.tar.bz2
TTA demux: Fix the calculation of the stream length.
Its resolution was in frames (+/- ~1 second), now it is calculated from the number of samples, as it should be.
Diffstat (limited to 'src')
-rw-r--r--src/demuxers/demux_tta.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/demuxers/demux_tta.c b/src/demuxers/demux_tta.c
index 3158a9ed6..7462cd874 100644
--- a/src/demuxers/demux_tta.c
+++ b/src/demuxers/demux_tta.c
@@ -64,7 +64,7 @@ typedef struct {
uint16_t channels;
uint16_t bits_per_sample;
uint32_t samplerate;
- uint32_t data_length;
+ uint32_t data_length; /* Number of samples */
uint32_t crc32;
} XINE_PACKED tta;
uint8_t buffer[22]; /* This is the size of the header */
@@ -130,7 +130,7 @@ static int demux_tta_send_chunk(demux_plugin_t *this_gen) {
buf = this->audio_fifo->buffer_pool_alloc(this->audio_fifo);
buf->type = BUF_AUDIO_TTA;
buf->pts = 0;
- buf->extra_info->total_time = (int)(FRAME_TIME * this->totalframes)*1000;
+ 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 */
@@ -281,7 +281,7 @@ static int demux_tta_get_status (demux_plugin_t *this_gen) {
static int demux_tta_get_stream_length (demux_plugin_t *this_gen) {
demux_tta_t *this = (demux_tta_t *) this_gen;
- return (int)(FRAME_TIME * this->totalframes * 1000);
+ return le2me_32(this->header.tta.data_length) * 1000.0 / le2me_32(this->header.tta.samplerate); /* milliseconds */
}
static uint32_t demux_tta_get_capabilities(demux_plugin_t *this_gen) {