diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2015-09-12 13:30:33 +0200 |
---|---|---|
committer | Hendrik Leppkes <h.leppkes@gmail.com> | 2015-09-12 13:30:33 +0200 |
commit | 264ff3dd2e5c0ca9963809730cb95614251b39d5 (patch) | |
tree | 7712f568c90cb95231890726ec9ea8382af941b9 | |
parent | 30fb54c23f520c4bd1f6563ea1821de96b8f4a17 (diff) | |
parent | 87a051f97633010f71dfc1d23d806856499bf231 (diff) | |
download | ffmpeg-264ff3dd2e5c0ca9963809730cb95614251b39d5.tar.gz |
Merge commit '87a051f97633010f71dfc1d23d806856499bf231'
* commit '87a051f97633010f71dfc1d23d806856499bf231':
lavc: allow asynchronous decoders to return correct pkt_dts values
Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
-rw-r--r-- | libavcodec/internal.h | 8 | ||||
-rw-r--r-- | libavcodec/mmaldec.c | 1 | ||||
-rw-r--r-- | libavcodec/utils.c | 3 |
3 files changed, 10 insertions, 2 deletions
diff --git a/libavcodec/internal.h b/libavcodec/internal.h index ce4cf753d6..89f5aa2715 100644 --- a/libavcodec/internal.h +++ b/libavcodec/internal.h @@ -46,7 +46,13 @@ * all. */ #define FF_CODEC_CAP_INIT_CLEANUP (1 << 1) - +/** + * Decoders marked with FF_CODEC_CAP_SETS_PKT_DTS want to set + * AVFrame.pkt_dts manually. If the flag is set, utils.c won't overwrite + * this field. If it's unset, utils.c tries to guess the pkt_dts field + * from the input AVPacket. + */ +#define FF_CODEC_CAP_SETS_PKT_DTS (1 << 2) #ifdef TRACE # define ff_tlog(ctx, ...) av_log(ctx, AV_LOG_TRACE, __VA_ARGS__) diff --git a/libavcodec/mmaldec.c b/libavcodec/mmaldec.c index b1b276a005..a70c51b8e3 100644 --- a/libavcodec/mmaldec.c +++ b/libavcodec/mmaldec.c @@ -790,6 +790,7 @@ AVCodec ff_h264_mmal_decoder = { .flush = ffmmal_flush, .priv_class = &ffmmaldec_class, .capabilities = AV_CODEC_CAP_DELAY, + .caps_internal = FF_CODEC_CAP_SETS_PKT_DTS, .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_MMAL, AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE}, diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 81bc2151ef..3e4cea531a 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -2095,7 +2095,8 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi else { ret = avctx->codec->decode(avctx, picture, got_picture_ptr, &tmp); - picture->pkt_dts = avpkt->dts; + if (!(avctx->codec->caps_internal & FF_CODEC_CAP_SETS_PKT_DTS)) + picture->pkt_dts = avpkt->dts; if(!avctx->has_b_frames){ av_frame_set_pkt_pos(picture, avpkt->pos); |