diff options
author | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2011-04-30 11:55:36 +0200 |
---|---|---|
committer | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2011-05-02 18:38:01 +0200 |
commit | 148ffcd2ce116cadb0efdbacc358851222c808d0 (patch) | |
tree | f86fb67aa87ef2182744366fdff342751a7f6654 /libavformat | |
parent | f97905e61d7cb86987d7d4f5fabcfc0d6b57ddbb (diff) | |
download | ffmpeg-148ffcd2ce116cadb0efdbacc358851222c808d0.tar.gz |
Make DV (sub) demuxer set proper pkt->pos values.
This makes the avi demuxer create packets with proper pos values
with the file from ticket #140.
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/avidec.c | 2 | ||||
-rw-r--r-- | libavformat/dv.c | 7 | ||||
-rw-r--r-- | libavformat/dv.h | 2 | ||||
-rw-r--r-- | libavformat/mov.c | 2 |
4 files changed, 8 insertions, 5 deletions
diff --git a/libavformat/avidec.c b/libavformat/avidec.c index c497b9a38e..27ae09aa73 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -973,7 +973,7 @@ resync: if (CONFIG_DV_DEMUXER && avi->dv_demux) { dstr = pkt->destruct; size = dv_produce_packet(avi->dv_demux, pkt, - pkt->data, pkt->size); + pkt->data, pkt->size, pkt->pos); pkt->destruct = dstr; pkt->flags |= AV_PKT_FLAG_KEY; if (size < 0) diff --git a/libavformat/dv.c b/libavformat/dv.c index 1e32125c23..750c950df8 100644 --- a/libavformat/dv.c +++ b/libavformat/dv.c @@ -316,7 +316,7 @@ int dv_get_packet(DVDemuxContext *c, AVPacket *pkt) } int dv_produce_packet(DVDemuxContext *c, AVPacket *pkt, - uint8_t* buf, int buf_size) + uint8_t* buf, int buf_size, int64_t pos) { int size, i; uint8_t *ppcm[4] = {0}; @@ -331,6 +331,7 @@ int dv_produce_packet(DVDemuxContext *c, AVPacket *pkt, /* FIXME: in case of no audio/bad audio we have to do something */ size = dv_extract_audio_info(c, buf); for (i = 0; i < c->ach; i++) { + c->audio_pkt[i].pos = pos; c->audio_pkt[i].size = size; c->audio_pkt[i].pts = c->abytes * 30000*8 / c->ast[i]->codec->bit_rate; ppcm[i] = c->audio_buf[i]; @@ -354,6 +355,7 @@ int dv_produce_packet(DVDemuxContext *c, AVPacket *pkt, size = dv_extract_video_info(c, buf); av_init_packet(pkt); pkt->data = buf; + pkt->pos = pos; pkt->size = size; pkt->flags |= AV_PKT_FLAG_KEY; pkt->stream_index = c->vst->id; @@ -452,13 +454,14 @@ static int dv_read_packet(AVFormatContext *s, AVPacket *pkt) size = dv_get_packet(c->dv_demux, pkt); if (size < 0) { + int64_t pos = avio_tell(s->pb); if (!c->dv_demux->sys) return AVERROR(EIO); size = c->dv_demux->sys->frame_size; if (avio_read(s->pb, c->buf, size) <= 0) return AVERROR(EIO); - size = dv_produce_packet(c->dv_demux, pkt, c->buf, size); + size = dv_produce_packet(c->dv_demux, pkt, c->buf, size, pos); } return size; diff --git a/libavformat/dv.h b/libavformat/dv.h index b8b43f1444..ce240c072c 100644 --- a/libavformat/dv.h +++ b/libavformat/dv.h @@ -33,7 +33,7 @@ typedef struct DVDemuxContext DVDemuxContext; DVDemuxContext* dv_init_demux(AVFormatContext* s); int dv_get_packet(DVDemuxContext*, AVPacket *); -int dv_produce_packet(DVDemuxContext*, AVPacket*, uint8_t*, int); +int dv_produce_packet(DVDemuxContext*, AVPacket*, uint8_t*, int, int64_t); void dv_offset_reset(DVDemuxContext *c, int64_t frame_offset); typedef struct DVMuxContext DVMuxContext; diff --git a/libavformat/mov.c b/libavformat/mov.c index fcb27359c4..cc120150c7 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -2458,7 +2458,7 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt) } #if CONFIG_DV_DEMUXER if (mov->dv_demux && sc->dv_audio_container) { - dv_produce_packet(mov->dv_demux, pkt, pkt->data, pkt->size); + dv_produce_packet(mov->dv_demux, pkt, pkt->data, pkt->size, pkt->pos); av_free(pkt->data); pkt->size = 0; ret = dv_get_packet(mov->dv_demux, pkt); |