[FFmpeg-cvslog] aud: fix time stamp calculation for ADPCM IMA WS

Justin Ruggles git at videolan.org
Tue Jan 24 23:12:55 CET 2012


ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Tue Jan 24 11:43:54 2012 -0500| [be14a37066cc99e2b769ee5e044a34caecd24938] | committer: Justin Ruggles

aud: fix time stamp calculation for ADPCM IMA WS

also allows for removing some unused context fields

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=be14a37066cc99e2b769ee5e044a34caecd24938
---

 libavformat/westwood_aud.c |   10 +---------
 1 files changed, 1 insertions(+), 9 deletions(-)

diff --git a/libavformat/westwood_aud.c b/libavformat/westwood_aud.c
index 79f2198..2195acc 100644
--- a/libavformat/westwood_aud.c
+++ b/libavformat/westwood_aud.c
@@ -42,10 +42,7 @@
 #define AUD_CHUNK_SIGNATURE 0x0000DEAF
 
 typedef struct WsAudDemuxContext {
-    int audio_channels;
-    int audio_samplerate;
     int audio_stream_index;
-    int64_t audio_frame_counter;
 } WsAudDemuxContext;
 
 static int wsaud_probe(AVProbeData *p)
@@ -131,10 +128,7 @@ static int wsaud_read_header(AVFormatContext *s,
     st->codec->channels    = channels;
     st->codec->sample_rate = sample_rate;
 
-    wsaud->audio_channels = channels;
-    wsaud->audio_samplerate = sample_rate;
     wsaud->audio_stream_index = st->index;
-    wsaud->audio_frame_counter = 0;
 
     return 0;
 }
@@ -177,11 +171,9 @@ static int wsaud_read_packet(AVFormatContext *s,
         ret = av_get_packet(pb, pkt, chunk_size);
         if (ret != chunk_size)
             return AVERROR(EIO);
-        pkt->pts = wsaud->audio_frame_counter;
-        pkt->pts /= wsaud->audio_samplerate;
 
         /* 2 samples/byte, 1 or 2 samples per frame depending on stereo */
-        wsaud->audio_frame_counter += (chunk_size * 2) / wsaud->audio_channels;
+        pkt->duration = (chunk_size * 2) / st->codec->channels;
     }
     pkt->stream_index = st->index;
 



More information about the ffmpeg-cvslog mailing list