diff options
author | Zhao Zhili <zhilizhao@tencent.com> | 2023-10-12 20:49:33 +0800 |
---|---|---|
committer | Zhao Zhili <zhilizhao@tencent.com> | 2023-10-18 23:02:12 +0800 |
commit | cbb6199ff864c6985efad1bb63cdad6e8a650b9b (patch) | |
tree | ddc6bf1f1919a9b3ea7110d3421fcf29444b658a /libavcodec/videotoolboxenc.c | |
parent | ade0612cfbd93274afc132c717af63ee617cddcd (diff) | |
download | ffmpeg-cbb6199ff864c6985efad1bb63cdad6e8a650b9b.tar.gz |
avcodec/videotoolboxenc: add hw_configs
Will be used in the following patch. With hw_config we can get
avctx->hw_frames_ctx, and with avctx->hw_frames_ctx we get
sw_pix_fmt. Otherwise sw_pix_fmt is none. I need sw_pix_fmt
before get the first frame to set hevc encoder profile.
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
Diffstat (limited to 'libavcodec/videotoolboxenc.c')
-rw-r--r-- | libavcodec/videotoolboxenc.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c index 1d1595329a..b685bf4cc4 100644 --- a/libavcodec/videotoolboxenc.c +++ b/libavcodec/videotoolboxenc.c @@ -37,6 +37,7 @@ #include "encode.h" #include "h264.h" #include "h264_sei.h" +#include "hwconfig.h" #include <dlfcn.h> #if !HAVE_KCMVIDEOCODECTYPE_HEVC @@ -2830,6 +2831,11 @@ static const enum AVPixelFormat prores_pix_fmts[] = { "Sets the maximum number of reference frames. This only has an effect when the value is less than the maximum allowed by the profile/level.", \ OFFSET(max_ref_frames), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE }, +static const AVCodecHWConfigInternal *const vt_encode_hw_configs[] = { + HW_CONFIG_ENCODER_FRAMES(VIDEOTOOLBOX, VIDEOTOOLBOX), + NULL, +}; + #define OFFSET(x) offsetof(VTEncContext, x) static const AVOption h264_options[] = { { "profile", "Profile", OFFSET(profile), AV_OPT_TYPE_INT, { .i64 = AV_PROFILE_UNKNOWN }, AV_PROFILE_UNKNOWN, INT_MAX, VE, "profile" }, @@ -2886,6 +2892,7 @@ const FFCodec ff_h264_videotoolbox_encoder = { .close = vtenc_close, .p.priv_class = &h264_videotoolbox_class, .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, + .hw_configs = vt_encode_hw_configs, }; static const AVOption hevc_options[] = { @@ -2923,6 +2930,7 @@ const FFCodec ff_hevc_videotoolbox_encoder = { .p.priv_class = &hevc_videotoolbox_class, .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, .p.wrapper_name = "videotoolbox", + .hw_configs = vt_encode_hw_configs, }; static const AVOption prores_options[] = { @@ -2961,4 +2969,5 @@ const FFCodec ff_prores_videotoolbox_encoder = { .p.priv_class = &prores_videotoolbox_class, .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, .p.wrapper_name = "videotoolbox", + .hw_configs = vt_encode_hw_configs, }; |