diff westwood.c @ 775:c5077fdab490 libavformat

AVPacket.pos
author michael
date Thu, 26 May 2005 20:17:12 +0000
parents 0fdc96c2f2fe
children feca73904e67
line wrap: on
line diff
--- a/westwood.c	Thu May 26 07:47:51 2005 +0000
+++ b/westwood.c	Thu May 26 20:17:12 2005 +0000
@@ -170,15 +170,12 @@
         return AVERROR_INVALIDDATA;
 
     chunk_size = LE_16(&preamble[0]);
-    if (av_new_packet(pkt, chunk_size))
+    ret= av_get_packet(pb, pkt, chunk_size);
+    if (ret != chunk_size)
         return AVERROR_IO;
     pkt->stream_index = wsaud->audio_stream_index;
     pkt->pts = wsaud->audio_frame_counter;
     pkt->pts /= wsaud->audio_samplerate;
-    if ((ret = get_buffer(pb, pkt->data, chunk_size)) != chunk_size) {
-        av_free_packet(pkt);
-        ret = AVERROR_IO;
-    }
 
     /* 2 samples/byte, 1 or 2 samples per frame depending on stereo */
     wsaud->audio_frame_counter += (chunk_size * 2) / wsaud->audio_channels;
@@ -322,11 +319,8 @@
 
     if ((chunk_type == SND2_TAG) || (chunk_type == VQFR_TAG)) {
 
-        if (av_new_packet(pkt, chunk_size))
-            return AVERROR_IO;
-        ret = get_buffer(pb, pkt->data, chunk_size);
+        av_get_packet(pb, pkt, chunk_size);
         if (ret != chunk_size) {
-            av_free_packet(pkt);
             ret = AVERROR_IO;
         }