diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-12-09 03:33:44 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-12-09 03:33:44 +0100 |
commit | 9e561410c08ebe128e0be86f7b4492dc7bc87bb2 (patch) | |
tree | b4656ae62fb64b3e5a77c9eb77e365b556085ea0 /libavformat/utils.c | |
parent | e86df0206f06b8d1e97e2b60db8f74a398d53127 (diff) | |
download | ffmpeg-9e561410c08ebe128e0be86f7b4492dc7bc87bb2.tar.gz |
avformat/utils: Pass the next pts/dts to compute_pkt_fields() when available
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r-- | libavformat/utils.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index 798c6123e0..f70223bfe2 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -974,7 +974,8 @@ static void update_initial_durations(AVFormatContext *s, AVStream *st, } static void compute_pkt_fields(AVFormatContext *s, AVStream *st, - AVCodecParserContext *pc, AVPacket *pkt) + AVCodecParserContext *pc, AVPacket *pkt, + int64_t next_dts, int64_t next_pts) { int num, den, presentation_delayed, delay, i; int64_t offset; @@ -1176,11 +1177,13 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt, int stream_index) got_output = 1; } else if (!size && st->parser->flags & PARSER_FLAG_COMPLETE_FRAMES) { // preserve 0-size sync packets - compute_pkt_fields(s, st, st->parser, pkt); + compute_pkt_fields(s, st, st->parser, pkt, AV_NOPTS_VALUE, AV_NOPTS_VALUE); } while (size > 0 || (pkt == &flush_pkt && got_output)) { int len; + int64_t next_pts = pkt->pts; + int64_t next_dts = pkt->dts; av_init_packet(&out_pkt); len = av_parser_parse2(st->parser, st->codec, @@ -1233,7 +1236,7 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt, int stream_index) if (st->parser->key_frame == -1 && st->parser->pict_type ==AV_PICTURE_TYPE_NONE && (pkt->flags&AV_PKT_FLAG_KEY)) out_pkt.flags |= AV_PKT_FLAG_KEY; - compute_pkt_fields(s, st, st->parser, &out_pkt); + compute_pkt_fields(s, st, st->parser, &out_pkt, next_dts, next_pts); if (out_pkt.data == pkt->data && out_pkt.size == pkt->size) { out_pkt.buf = pkt->buf; @@ -1352,7 +1355,7 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt) if (!st->need_parsing || !st->parser) { /* no parsing needed: we just output the packet as is */ *pkt = cur_pkt; - compute_pkt_fields(s, st, NULL, pkt); + compute_pkt_fields(s, st, NULL, pkt, AV_NOPTS_VALUE, AV_NOPTS_VALUE); if ((s->iformat->flags & AVFMT_GENERIC_INDEX) && (pkt->flags & AV_PKT_FLAG_KEY) && pkt->dts != AV_NOPTS_VALUE) { ff_reduce_index(s, st->index); |