mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-08 06:09:50 +00:00
avcodec/hw_base_encode: avoid getting FFHWBaseEncodeContext from avctx
This patch is to make FFHWBaseEncodeContext a standalone component and avoid getting FFHWBaseEncodeContext from avctx->priv_data. This patch also removes some unnecessary AVCodecContext arguments. For receive_packet call, a small wrapper is introduced. Signed-off-by: Tong Wu <tong1.wu@intel.com>
This commit is contained in:
parent
0ba10f2d75
commit
e783e45e29
14 changed files with 76 additions and 65 deletions
|
|
@ -811,7 +811,7 @@ static int vaapi_encode_output(AVCodecContext *avctx,
|
|||
av_log(avctx, AV_LOG_DEBUG, "Output read for pic %"PRId64"/%"PRId64".\n",
|
||||
base_pic->display_order, base_pic->encode_order);
|
||||
|
||||
ff_hw_base_encode_set_output_property(avctx, (FFHWBaseEncodePicture*)base_pic, pkt_ptr,
|
||||
ff_hw_base_encode_set_output_property(base_ctx, avctx, (FFHWBaseEncodePicture*)base_pic, pkt_ptr,
|
||||
ctx->codec->flags & FLAG_TIMESTAMP_NO_DELAY);
|
||||
|
||||
end:
|
||||
|
|
@ -1658,7 +1658,8 @@ static av_cold int vaapi_encode_init_gop_structure(AVCodecContext *avctx)
|
|||
}
|
||||
#endif
|
||||
|
||||
err = ff_hw_base_init_gop_structure(avctx, ref_l0, ref_l1, ctx->codec->flags, prediction_pre_only);
|
||||
err = ff_hw_base_init_gop_structure(base_ctx, avctx, ref_l0, ref_l1,
|
||||
ctx->codec->flags, prediction_pre_only);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
|
@ -2059,7 +2060,7 @@ static av_cold int vaapi_encode_create_recon_frames(AVCodecContext *avctx)
|
|||
}
|
||||
hwconfig->config_id = ctx->va_config;
|
||||
|
||||
err = ff_hw_base_get_recon_format(avctx, (const void*)hwconfig, &recon_format);
|
||||
err = ff_hw_base_get_recon_format(base_ctx, (const void*)hwconfig, &recon_format);
|
||||
if (err < 0)
|
||||
goto fail;
|
||||
|
||||
|
|
@ -2098,6 +2099,11 @@ static const FFHWEncodePictureOperation vaapi_op = {
|
|||
.free = &vaapi_encode_free,
|
||||
};
|
||||
|
||||
int ff_vaapi_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
|
||||
{
|
||||
return ff_hw_base_encode_receive_packet(avctx->priv_data, avctx, pkt);
|
||||
}
|
||||
|
||||
av_cold int ff_vaapi_encode_init(AVCodecContext *avctx)
|
||||
{
|
||||
FFHWBaseEncodeContext *base_ctx = avctx->priv_data;
|
||||
|
|
@ -2106,7 +2112,7 @@ av_cold int ff_vaapi_encode_init(AVCodecContext *avctx)
|
|||
VAStatus vas;
|
||||
int err;
|
||||
|
||||
err = ff_hw_base_encode_init(avctx);
|
||||
err = ff_hw_base_encode_init(avctx, base_ctx);
|
||||
if (err < 0)
|
||||
goto fail;
|
||||
|
||||
|
|
@ -2313,7 +2319,7 @@ av_cold int ff_vaapi_encode_close(AVCodecContext *avctx)
|
|||
av_freep(&ctx->codec_sequence_params);
|
||||
av_freep(&ctx->codec_picture_params);
|
||||
|
||||
ff_hw_base_encode_close(avctx);
|
||||
ff_hw_base_encode_close(base_ctx);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue