diff wav.c @ 1756:5d72afc6c8aa libavformat

better generic index building and seeking code
author michael
date Mon, 05 Feb 2007 23:04:48 +0000
parents ba58d49d4685
children ce4617062f7b
line wrap: on
line diff
--- a/wav.c	Mon Feb 05 02:08:57 2007 +0000
+++ b/wav.c	Mon Feb 05 23:04:48 2007 +0000
@@ -188,13 +188,11 @@
         size = (size / st->codec->block_align) * st->codec->block_align;
     }
     size= FFMIN(size, left);
-    if (av_new_packet(pkt, size))
+    ret= av_get_packet(&s->pb, pkt, size);
+    if (ret <= 0)
         return AVERROR_IO;
     pkt->stream_index = 0;
 
-    ret = get_buffer(&s->pb, pkt->data, pkt->size);
-    if (ret < 0)
-        av_free_packet(pkt);
     /* note: we need to modify the packet size here to handle the last
        packet */
     pkt->size = ret;
@@ -235,6 +233,7 @@
     wav_read_packet,
     wav_read_close,
     wav_read_seek,
+    .flags= AVFMT_GENERIC_INDEX,
     .codec_tag= (const AVCodecTag*[]){codec_wav_tags, 0},
 };
 #endif