diff options
author | Anton Khirnov <anton@khirnov.net> | 2023-01-04 18:11:19 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2023-01-29 09:23:17 +0100 |
commit | fbdba9a1a69fe4df413d9e9df1b11db522946e75 (patch) | |
tree | de85f263b1b99c869d40a1b27e7adb92926abf9c /libavcodec/vaapi_encode.c | |
parent | c44a3dba9eaebc200c2cf9e4cb30c20c2ebd4562 (diff) | |
download | ffmpeg-fbdba9a1a69fe4df413d9e9df1b11db522946e75.tar.gz |
lavc/vaapi_encode*: handle frame durations and AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
Except for the mjpeg_vaapi encoder, which is already handled
generically.
Diffstat (limited to 'libavcodec/vaapi_encode.c')
-rw-r--r-- | libavcodec/vaapi_encode.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c index 9a58661b51..6787b90e8d 100644 --- a/libavcodec/vaapi_encode.c +++ b/libavcodec/vaapi_encode.c @@ -695,6 +695,7 @@ static int vaapi_encode_output(AVCodecContext *avctx, pkt->flags |= AV_PKT_FLAG_KEY; pkt->pts = pic->pts; + pkt->duration = pic->input_image->duration; vas = vaUnmapBuffer(ctx->hwctx->display, pic->output_buffer); if (vas != VA_STATUS_SUCCESS) { @@ -704,6 +705,13 @@ static int vaapi_encode_output(AVCodecContext *avctx, goto fail; } + // for no-delay encoders this is handled in generic codec + if (avctx->codec->capabilities & AV_CODEC_CAP_DELAY) { + err = ff_encode_reordered_opaque(avctx, pkt, pic->input_image); + if (err < 0) + goto fail; + } + av_buffer_unref(&pic->output_buffer_ref); pic->output_buffer = VA_INVALID_ID; |