diff options
author | Tong Wu <tong1.wu@intel.com> | 2024-04-18 10:30:36 +0800 |
---|---|---|
committer | Lynne <dev@lynne.ee> | 2024-07-02 14:15:12 +0200 |
commit | 1242abdcee257f0cfefc7aabf118d23253f37769 (patch) | |
tree | 9722f32c43249fb50de4b263b0b71f2835214f12 /libavcodec/vaapi_encode_mjpeg.c | |
parent | aa82340b0ccdde4955fba41b8de5e45348ecd11d (diff) | |
download | ffmpeg-1242abdcee257f0cfefc7aabf118d23253f37769.tar.gz |
avcodec/vaapi_encode: extract the init and close function to base layer
Related parameters such as device context, frame context are also moved
to base layer.
Signed-off-by: Tong Wu <tong1.wu@intel.com>
Diffstat (limited to 'libavcodec/vaapi_encode_mjpeg.c')
-rw-r--r-- | libavcodec/vaapi_encode_mjpeg.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libavcodec/vaapi_encode_mjpeg.c b/libavcodec/vaapi_encode_mjpeg.c index 4c31881e6a..48dc677bec 100644 --- a/libavcodec/vaapi_encode_mjpeg.c +++ b/libavcodec/vaapi_encode_mjpeg.c @@ -222,6 +222,7 @@ static int vaapi_encode_mjpeg_write_extra_buffer(AVCodecContext *avctx, static int vaapi_encode_mjpeg_init_picture_params(AVCodecContext *avctx, VAAPIEncodePicture *vaapi_pic) { + FFHWBaseEncodeContext *base_ctx = avctx->priv_data; VAAPIEncodeMJPEGContext *priv = avctx->priv_data; const FFHWBaseEncodePicture *pic = &vaapi_pic->base; JPEGRawFrameHeader *fh = &priv->frame_header; @@ -235,7 +236,7 @@ static int vaapi_encode_mjpeg_init_picture_params(AVCodecContext *avctx, av_assert0(pic->type == FF_HW_PICTURE_TYPE_IDR); - desc = av_pix_fmt_desc_get(priv->common.input_frames->sw_format); + desc = av_pix_fmt_desc_get(base_ctx->input_frames->sw_format); av_assert0(desc); if (desc->flags & AV_PIX_FMT_FLAG_RGB) components = components_rgb; @@ -437,10 +438,11 @@ static int vaapi_encode_mjpeg_init_slice_params(AVCodecContext *avctx, static av_cold int vaapi_encode_mjpeg_get_encoder_caps(AVCodecContext *avctx) { + FFHWBaseEncodeContext *base_ctx = avctx->priv_data; VAAPIEncodeContext *ctx = avctx->priv_data; const AVPixFmtDescriptor *desc; - desc = av_pix_fmt_desc_get(ctx->input_frames->sw_format); + desc = av_pix_fmt_desc_get(base_ctx->input_frames->sw_format); av_assert0(desc); ctx->surface_width = FFALIGN(avctx->width, 8 << desc->log2_chroma_w); |