changeset 58:b1dd147434af libavformat

DV packet copy fix by Roman Shaposhnick
author bellard
date Thu, 06 Feb 2003 22:34:55 +0000
parents 821a7facb3e4
children 05be5bf0025e
files dv.c
diffstat 1 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/dv.c	Thu Feb 06 15:09:39 2003 +0000
+++ b/dv.c	Thu Feb 06 22:34:55 2003 +0000
@@ -53,7 +53,12 @@
     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 @@
 	    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)