summaryrefslogtreecommitdiff
path: root/libavformat/dv.c
diff options
context:
space:
mode:
authorFabrice Bellard <fabrice@bellard.org>2003-02-06 22:34:55 +0000
committerFabrice Bellard <fabrice@bellard.org>2003-02-06 22:34:55 +0000
commitec820113409b8a755715129ecb43e775c68cfd3a (patch)
tree30f8c31e72cbf6b9571d559761105e079f90a3b7 /libavformat/dv.c
parentcc0799e5f8ec3aeb5348c1803e882528a047890e (diff)
DV packet copy fix by Roman Shaposhnick
Originally committed as revision 1548 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/dv.c')
-rw-r--r--libavformat/dv.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/libavformat/dv.c b/libavformat/dv.c
index 64cc0bef1b..c08bc05162 100644
--- a/libavformat/dv.c
+++ b/libavformat/dv.c
@@ -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)