mirror of
https://github.com/nyanmisaka/ffmpeg-rockchip.git
synced 2025-10-16 13:51:37 +08:00
avcodec/encode: Set AV_PKT_FLAG_KEY based upon AV_CODEC_PROP_INTRA_ONLY
Currently, the AV_PKT_FLAG_KEY is automatically set for audio encoders; yet this is wrong, as both MLP and TrueHD have non-keyframes. So set it based upon AV_CODEC_PROP_INTRA_ONLY (from the corresponding AVCodecDescriptor) instead. This also sets it for some video codecs, which is intended. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@@ -235,12 +235,9 @@ static int encode_simple_internal(AVCodecContext *avctx, AVPacket *avpkt)
|
||||
}
|
||||
}
|
||||
if (avctx->codec->type == AVMEDIA_TYPE_AUDIO) {
|
||||
/* NOTE: if we add any audio encoders which output non-keyframe packets,
|
||||
* this needs to be moved to the encoders, but for now we can do it
|
||||
* here to simplify things */
|
||||
avpkt->flags |= AV_PKT_FLAG_KEY;
|
||||
avpkt->dts = avpkt->pts;
|
||||
}
|
||||
avpkt->flags |= avci->intra_only_flag;
|
||||
}
|
||||
|
||||
if (avci->draining && !got_packet)
|
||||
@@ -553,6 +550,8 @@ int ff_encode_preinit(AVCodecContext *avctx)
|
||||
}
|
||||
avctx->sw_pix_fmt = frames_ctx->sw_format;
|
||||
}
|
||||
if (avctx->codec_descriptor->props & AV_CODEC_PROP_INTRA_ONLY)
|
||||
avctx->internal->intra_only_flag = AV_PKT_FLAG_KEY;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user