From cd2ffb67ad9e9fec1766c501ad33e85dc934eeed Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Tue, 20 Mar 2012 11:20:54 -0400 Subject: [PATCH] xa: fix timestamp calculation The packet duration is always 28 samples. --- libavformat/xa.c | 6 ++--- tests/ref/fate/maxis-xa | 60 ++++++++++++++++++++--------------------- 2 files changed, 32 insertions(+), 34 deletions(-) diff --git a/libavformat/xa.c b/libavformat/xa.c index c5e5cf5864..82b703f8c5 100644 --- a/libavformat/xa.c +++ b/libavformat/xa.c @@ -38,7 +38,6 @@ typedef struct MaxisXADemuxContext { uint32_t out_size; uint32_t sent_bytes; - uint32_t audio_frame_counter; } MaxisXADemuxContext; static int xa_probe(AVProbeData *p) @@ -87,6 +86,7 @@ static int xa_read_header(AVFormatContext *s) st->codec->bits_per_coded_sample = avio_rl16(pb); avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate); + st->start_time = 0; return 0; } @@ -111,9 +111,7 @@ static int xa_read_packet(AVFormatContext *s, pkt->stream_index = st->index; xa->sent_bytes += packet_size; - pkt->pts = xa->audio_frame_counter; - /* 14 bytes Samples per channel with 2 samples per byte */ - xa->audio_frame_counter += 28 * st->codec->channels; + pkt->duration = 28; return ret; } diff --git a/tests/ref/fate/maxis-xa b/tests/ref/fate/maxis-xa index debaaa5c81..c29738c868 100644 --- a/tests/ref/fate/maxis-xa +++ b/tests/ref/fate/maxis-xa @@ -1,31 +1,31 @@ #tb 0: 1/22050 -0, 0, 0, 0, 30, 0x51750711 -0, 56, 56, 0, 30, 0x9ca20c2a -0, 112, 112, 0, 30, 0x7551081f -0, 168, 168, 0, 30, 0x09540063 -0, 224, 224, 0, 30, 0x02c40018 -0, 280, 280, 0, 30, 0x0f6c0117 -0, 336, 336, 0, 30, 0x2aab0315 -0, 392, 392, 0, 30, 0x0e6d0117 -0, 448, 448, 0, 30, 0x04770036 -0, 504, 504, 0, 30, 0x939c090f -0, 560, 560, 0, 30, 0xde511116 -0, 616, 616, 0, 30, 0x2f0f13f5 -0, 672, 672, 0, 30, 0x65bb0630 -0, 728, 728, 0, 30, 0x1f7a0333 -0, 784, 784, 0, 30, 0xa3d71008 -0, 840, 840, 0, 30, 0x69120801 -0, 896, 896, 0, 30, 0x1e7b0207 -0, 952, 952, 0, 30, 0x02c40018 -0, 1008, 1008, 0, 30, 0x0d050126 -0, 1064, 1064, 0, 30, 0x41c10333 -0, 1120, 1120, 0, 30, 0x16a10207 -0, 1176, 1176, 0, 30, 0x0f210207 -0, 1232, 1232, 0, 30, 0x4e4b073e -0, 1288, 1288, 0, 30, 0xa6f20d1a -0, 1344, 1344, 0, 30, 0xe1e40ff9 -0, 1400, 1400, 0, 30, 0x868b090f -0, 1456, 1456, 0, 30, 0x8c85091e -0, 1512, 1512, 0, 30, 0x5a21094b -0, 1568, 1568, 0, 30, 0x993c0900 -0, 1624, 1624, 0, 30, 0x5b6b04e6 +0, 0, 0, 28, 30, 0x51750711 +0, 28, 28, 28, 30, 0x9ca20c2a +0, 56, 56, 28, 30, 0x7551081f +0, 84, 84, 28, 30, 0x09540063 +0, 112, 112, 28, 30, 0x02c40018 +0, 140, 140, 28, 30, 0x0f6c0117 +0, 168, 168, 28, 30, 0x2aab0315 +0, 196, 196, 28, 30, 0x0e6d0117 +0, 224, 224, 28, 30, 0x04770036 +0, 252, 252, 28, 30, 0x939c090f +0, 280, 280, 28, 30, 0xde511116 +0, 308, 308, 28, 30, 0x2f0f13f5 +0, 336, 336, 28, 30, 0x65bb0630 +0, 364, 364, 28, 30, 0x1f7a0333 +0, 392, 392, 28, 30, 0xa3d71008 +0, 420, 420, 28, 30, 0x69120801 +0, 448, 448, 28, 30, 0x1e7b0207 +0, 476, 476, 28, 30, 0x02c40018 +0, 504, 504, 28, 30, 0x0d050126 +0, 532, 532, 28, 30, 0x41c10333 +0, 560, 560, 28, 30, 0x16a10207 +0, 588, 588, 28, 30, 0x0f210207 +0, 616, 616, 28, 30, 0x4e4b073e +0, 644, 644, 28, 30, 0xa6f20d1a +0, 672, 672, 28, 30, 0xe1e40ff9 +0, 700, 700, 28, 30, 0x868b090f +0, 728, 728, 28, 30, 0x8c85091e +0, 756, 756, 28, 30, 0x5a21094b +0, 784, 784, 28, 30, 0x993c0900 +0, 812, 812, 28, 30, 0x5b6b04e6