vqa: set packet duration.
authorJustin Ruggles <justin.ruggles@gmail.com>
Mon, 23 Jan 2012 16:06:35 +0000 (11:06 -0500)
committerJustin Ruggles <justin.ruggles@gmail.com>
Tue, 24 Jan 2012 19:08:29 +0000 (14:08 -0500)
Also remove unused context field, audio_frame_counter.

libavformat/westwood_vqa.c

index fef6877..9a48263 100644 (file)
@@ -61,8 +61,6 @@ typedef struct WsVqaDemuxContext {
 
     int audio_stream_index;
     int video_stream_index;
 
     int audio_stream_index;
     int video_stream_index;
-
-    int64_t audio_frame_counter;
 } WsVqaDemuxContext;
 
 static int wsvqa_probe(AVProbeData *p)
 } WsVqaDemuxContext;
 
 static int wsvqa_probe(AVProbeData *p)
@@ -144,7 +142,6 @@ static int wsvqa_read_header(AVFormatContext *s,
         wsvqa->audio_stream_index = st->index;
         wsvqa->audio_samplerate = st->codec->sample_rate;
         wsvqa->audio_channels = st->codec->channels;
         wsvqa->audio_stream_index = st->index;
         wsvqa->audio_samplerate = st->codec->sample_rate;
         wsvqa->audio_channels = st->codec->channels;
-        wsvqa->audio_frame_counter = 0;
     }
 
     /* there are 0 or more chunks before the FINF chunk; iterate until
     }
 
     /* there are 0 or more chunks before the FINF chunk; iterate until
@@ -216,13 +213,14 @@ static int wsvqa_read_packet(AVFormatContext *s,
             if (chunk_type == SND2_TAG) {
                 pkt->stream_index = wsvqa->audio_stream_index;
                 /* 2 samples/byte, 1 or 2 samples per frame depending on stereo */
             if (chunk_type == SND2_TAG) {
                 pkt->stream_index = wsvqa->audio_stream_index;
                 /* 2 samples/byte, 1 or 2 samples per frame depending on stereo */
-                wsvqa->audio_frame_counter += (chunk_size * 2) / wsvqa->audio_channels;
+                pkt->duration = (chunk_size * 2) / wsvqa->audio_channels;
             } else if(chunk_type == SND1_TAG) {
                 pkt->stream_index = wsvqa->audio_stream_index;
                 /* unpacked size is stored in header */
             } else if(chunk_type == SND1_TAG) {
                 pkt->stream_index = wsvqa->audio_stream_index;
                 /* unpacked size is stored in header */
-                wsvqa->audio_frame_counter += AV_RL16(pkt->data) / wsvqa->audio_channels;
+                pkt->duration = AV_RL16(pkt->data) / wsvqa->audio_channels;
             } else {
                 pkt->stream_index = wsvqa->video_stream_index;
             } else {
                 pkt->stream_index = wsvqa->video_stream_index;
+                pkt->duration = 1;
             }
             /* stay on 16-bit alignment */
             if (skip_byte)
             }
             /* stay on 16-bit alignment */
             if (skip_byte)