]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
DV packet copy fix by Roman Shaposhnick
authorbellard <bellard@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Thu, 6 Feb 2003 22:34:55 +0000 (22:34 +0000)
committerbellard <bellard@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Thu, 6 Feb 2003 22:34:55 +0000 (22:34 +0000)
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@1548 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

libavformat/dv.c

index 64cc0bef1b4604fe915fa9b43dc9d1929f759907..c08bc0516248297230bd91527d5c4bb5492829c5 100644 (file)
@@ -53,7 +53,12 @@ static int dv_read_header(AVFormatContext *s,
     return 0;
 }
 
-/* XXX: build fake audio stream when DV audio decoder will be finished */
+static void __destruct_pkt(struct AVPacket *pkt)
+{
+    pkt->data = NULL; pkt->size = 0;
+    return;
+}
+
 static int dv_read_packet(AVFormatContext *s, AVPacket *pkt)
 {
     int ret, dsf;
@@ -74,13 +79,14 @@ static int dv_read_packet(AVFormatContext *s, AVPacket *pkt)
            return -EIO;
     }
     
-    if (av_new_packet(pkt, c->size) < 0)
-        return -EIO;
-
+    av_init_packet(pkt);
+    pkt->destruct = __destruct_pkt;
+    pkt->data     = c->buf;
+    pkt->size     = c->size;
     pkt->stream_index = c->is_audio;
+    
     c->is_audio = !c->is_audio;
-    memcpy(pkt->data, c->buf, c->size);
-    return ret;
+    return c->size;
 }
 
 static int dv_read_close(AVFormatContext *s)