summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2015-09-12 13:30:33 +0200
committerHendrik Leppkes <h.leppkes@gmail.com>2015-09-12 13:30:33 +0200
commit264ff3dd2e5c0ca9963809730cb95614251b39d5 (patch)
tree7712f568c90cb95231890726ec9ea8382af941b9 /libavcodec
parent30fb54c23f520c4bd1f6563ea1821de96b8f4a17 (diff)
parent87a051f97633010f71dfc1d23d806856499bf231 (diff)
Merge commit '87a051f97633010f71dfc1d23d806856499bf231'
* commit '87a051f97633010f71dfc1d23d806856499bf231': lavc: allow asynchronous decoders to return correct pkt_dts values Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/internal.h8
-rw-r--r--libavcodec/mmaldec.c1
-rw-r--r--libavcodec/utils.c3
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);