Suggested-by: James Almer <jamr...@gmail.com> Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc> --- libavcodec/decode.c | 2 +- libavcodec/internal.h | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/libavcodec/decode.c b/libavcodec/decode.c index cf9676e2ac..5976da78c8 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -434,7 +434,7 @@ static int decode_simple_internal(AVCodecContext *avctx, AVFrame *frame) if (!(avctx->codec->caps_internal & FF_CODEC_CAP_SETS_PKT_DTS)) frame->pkt_dts = pkt->dts; if (avctx->codec->type == AVMEDIA_TYPE_VIDEO) { - if(!avctx->has_b_frames) + if(!(avctx->codec->caps_internal & FF_CODEC_CAP_SETS_PKT_POS) && !avctx->has_b_frames) frame->pkt_pos = pkt->pos; //FIXME these should be under if(!avctx->has_b_frames) /* get_buffer is supposed to set frame parameters */ diff --git a/libavcodec/internal.h b/libavcodec/internal.h index 5f964148fd..f9e87eacc6 100644 --- a/libavcodec/internal.h +++ b/libavcodec/internal.h @@ -68,6 +68,13 @@ * Codec initializes slice-based threading with a main function */ #define FF_CODEC_CAP_SLICE_THREAD_HAS_MF (1 << 5) +/** + * Decoders marked with FF_CODEC_CAP_SETS_PKT_POS want to set + * AVFrame.pkt_pos manually. If the flag is set, decode.c won't overwrite + * this field. If it's unset, decode.c tries to guess the pkt_pos field + * from the input AVPacket. + */ +#define FF_CODEC_CAP_SETS_PKT_POS (1 << 6) #ifdef TRACE # define ff_tlog(ctx, ...) av_log(ctx, AV_LOG_TRACE, __VA_ARGS__) -- 2.23.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".