Unified · Split
| @@ -745,6 +745,17 @@ fail: · 744 unmodified lines | |||
| 745 | return err; | 745 | return err; |
| 746 | } | 746 | } |
| 747 | 747 | ||
| 748 | int ff_hw_base_encode_free(FFHWBaseEncodePicture *pic) | ||
| 749 | { | ||
| 750 | av_frame_free(&pic->input_image); | ||
| 751 | av_frame_free(&pic->recon_image); | ||
| 752 | |||
| 753 | av_buffer_unref(&pic->opaque_ref); | ||
| 754 | av_freep(&pic->priv_data); | ||
| 755 | |||
| 756 | return 0; | ||
| 757 | } | ||
| 758 | |||
| 748 | int ff_hw_base_encode_init(AVCodecContext *avctx) | 759 | int ff_hw_base_encode_init(AVCodecContext *avctx) |
| 749 | { | 760 | { |
| 750 | FFHWBaseEncodeContext *ctx = avctx->priv_data; | 761 | FFHWBaseEncodeContext *ctx = avctx->priv_data; |
| @@ -224,6 +224,8 @@ int ff_hw_base_init_gop_structure(AVCodecContext *avctx, uint32_t ref_l0, uint32 · 223 unmodified lines | |||
| 224 | 224 | ||
| 225 | int ff_hw_base_get_recon_format(AVCodecContext *avctx, const void *hwconfig, enum AVPixelFormat *fmt); | 225 | int ff_hw_base_get_recon_format(AVCodecContext *avctx, const void *hwconfig, enum AVPixelFormat *fmt); |
| 226 | 226 | ||
| 227 | int ff_hw_base_encode_free(FFHWBaseEncodePicture *pic); | ||
| 228 | |||
| 227 | int ff_hw_base_encode_init(AVCodecContext *avctx); | 229 | int ff_hw_base_encode_init(AVCodecContext *avctx); |
| 228 | 230 | ||
| 229 | int ff_hw_base_encode_close(AVCodecContext *avctx); | 231 | int ff_hw_base_encode_close(AVCodecContext *avctx); |
| @@ -878,17 +878,13 @@ static int vaapi_encode_free(AVCodecContext *avctx, · 877 unmodified lines | |||
| 878 | av_freep(&pic->slices[i].codec_slice_params); | 878 | av_freep(&pic->slices[i].codec_slice_params); |
| 879 | } | 879 | } |
| 880 | 880 | ||
| 881 | av_frame_free(&base_pic->input_image); | 881 | ff_hw_base_encode_free(base_pic); |
| 882 | av_frame_free(&base_pic->recon_image); | ||
| 883 | |||
| 884 | av_buffer_unref(&base_pic->opaque_ref); | ||
| 885 | 882 | ||
| 886 | av_freep(&pic->param_buffers); | 883 | av_freep(&pic->param_buffers); |
| 887 | av_freep(&pic->slices); | 884 | av_freep(&pic->slices); |
| 888 | // Output buffer should already be destroyed. | 885 | // Output buffer should already be destroyed. |
| 889 | av_assert0(pic->output_buffer == VA_INVALID_ID); | 886 | av_assert0(pic->output_buffer == VA_INVALID_ID); |
| 890 | 887 | ||
| 891 | av_freep(&base_pic->priv_data); | ||
| 892 | av_freep(&pic->codec_picture_params); | 888 | av_freep(&pic->codec_picture_params); |
| 893 | av_freep(&pic->roi); | 889 | av_freep(&pic->roi); |
| 894 | 890 | ||