diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-02-22 12:21:28 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-02-22 14:31:23 +0100 |
commit | f288e1b67cbab43c0591483ea323ce1e83df74cb (patch) | |
tree | 56a790fd2c16efe5a561a5fc929ca8c225209f07 | |
parent | 8bcacd9f4262d70645adf8501add387f6aa3b164 (diff) | |
download | ffmpeg-streaming-f288e1b67cbab43c0591483ea323ce1e83df74cb.zip ffmpeg-streaming-f288e1b67cbab43c0591483ea323ce1e83df74cb.tar.gz |
avformat/utils: factorize h264/hevc checks out in compute_pkt_fields()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/utils.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index 04c10a0..cb048f9 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -1072,6 +1072,8 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st, int num, den, presentation_delayed, delay, i; int64_t offset; AVRational duration; + int onein_oneout = st->codec->codec_id != AV_CODEC_ID_H264 && + st->codec->codec_id != AV_CODEC_ID_HEVC; if (s->flags & AVFMT_FLAG_NOFILLIN) return; @@ -1154,8 +1156,7 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st, /* Interpolate PTS and DTS if they are not present. We skip H264 * currently because delay and has_b_frames are not reliably set. */ if ((delay == 0 || (delay == 1 && pc)) && - st->codec->codec_id != AV_CODEC_ID_H264 && - st->codec->codec_id != AV_CODEC_ID_HEVC) { + onein_oneout) { if (presentation_delayed) { /* DTS = decompression timestamp */ /* PTS = presentation timestamp */ @@ -1200,8 +1201,7 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st, pkt->dts = st->pts_buffer[0]; } // We skipped it above so we try here. - if (st->codec->codec_id == AV_CODEC_ID_H264 || - st->codec->codec_id == AV_CODEC_ID_HEVC) + if (!onein_oneout) // This should happen on the first packet update_initial_timestamps(s, pkt->stream_index, pkt->dts, pkt->pts, pkt); if (pkt->dts > st->cur_dts) |