Mercurial > libavformat.hg
comparison dv.c @ 58:b1dd147434af libavformat
DV packet copy fix by Roman Shaposhnick
author | bellard |
---|---|
date | Thu, 06 Feb 2003 22:34:55 +0000 |
parents | 8f76666c71c2 |
children | 16d27a2435e3 |
comparison
equal
deleted
inserted
replaced
57:821a7facb3e4 | 58:b1dd147434af |
---|---|
51 c->is_audio = 0; | 51 c->is_audio = 0; |
52 | 52 |
53 return 0; | 53 return 0; |
54 } | 54 } |
55 | 55 |
56 /* XXX: build fake audio stream when DV audio decoder will be finished */ | 56 static void __destruct_pkt(struct AVPacket *pkt) |
57 { | |
58 pkt->data = NULL; pkt->size = 0; | |
59 return; | |
60 } | |
61 | |
57 static int dv_read_packet(AVFormatContext *s, AVPacket *pkt) | 62 static int dv_read_packet(AVFormatContext *s, AVPacket *pkt) |
58 { | 63 { |
59 int ret, dsf; | 64 int ret, dsf; |
60 DVDemuxContext *c = s->priv_data; | 65 DVDemuxContext *c = s->priv_data; |
61 | 66 |
72 ret = get_buffer(&s->pb, c->buf + 4, c->size - 4); | 77 ret = get_buffer(&s->pb, c->buf + 4, c->size - 4); |
73 if (ret <= 0) | 78 if (ret <= 0) |
74 return -EIO; | 79 return -EIO; |
75 } | 80 } |
76 | 81 |
77 if (av_new_packet(pkt, c->size) < 0) | 82 av_init_packet(pkt); |
78 return -EIO; | 83 pkt->destruct = __destruct_pkt; |
79 | 84 pkt->data = c->buf; |
85 pkt->size = c->size; | |
80 pkt->stream_index = c->is_audio; | 86 pkt->stream_index = c->is_audio; |
87 | |
81 c->is_audio = !c->is_audio; | 88 c->is_audio = !c->is_audio; |
82 memcpy(pkt->data, c->buf, c->size); | 89 return c->size; |
83 return ret; | |
84 } | 90 } |
85 | 91 |
86 static int dv_read_close(AVFormatContext *s) | 92 static int dv_read_close(AVFormatContext *s) |
87 { | 93 { |
88 return 0; | 94 return 0; |