History

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.

Zhao Zhili committed 3 years ago

Commit cbb61991 parent ade06121 file · +9 −0Browse files

Showing the changes to libavcodec (1 of 1 file). Show all

Unified · Split

libavcodec/videotoolboxenc.c+9−0
@@ -37,6 +37,7 @@ · 36 unmodified lines
3737 #include "encode.h"
3838 #include "h264.h"
3939 #include "h264_sei.h"
40+#include "hwconfig.h"
4041 #include <dlfcn.h>
4142
4243 #if !HAVE_KCMVIDEOCODECTYPE_HEVC
@@ -2830,6 +2831,11 @@ static const enum AVPixelFormat prores_pix_fmts[] = { · 2787 unmodified lines
28302831 "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.", \
28312832 OFFSET(max_ref_frames), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
28322833
2834+static const AVCodecHWConfigInternal *const vt_encode_hw_configs[] = {
2835+ HW_CONFIG_ENCODER_FRAMES(VIDEOTOOLBOX, VIDEOTOOLBOX),
2836+ NULL,
2837+};
2838+
28332839 #define OFFSET(x) offsetof(VTEncContext, x)
28342840 static const AVOption h264_options[] = {
28352841 { "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 = { · 50 unmodified lines
28862892 .close = vtenc_close,
28872893 .p.priv_class = &h264_videotoolbox_class,
28882894 .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
2895+ .hw_configs = vt_encode_hw_configs,
28892896 };
28902897
28912898 static const AVOption hevc_options[] = {
@@ -2923,6 +2930,7 @@ const FFCodec ff_hevc_videotoolbox_encoder = { · 31 unmodified lines
29232930 .p.priv_class = &hevc_videotoolbox_class,
29242931 .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
29252932 .p.wrapper_name = "videotoolbox",
2933+ .hw_configs = vt_encode_hw_configs,
29262934 };
29272935
29282936 static const AVOption prores_options[] = {
@@ -2961,4 +2969,5 @@ const FFCodec ff_prores_videotoolbox_encoder = { · 32 unmodified lines
29612969 .p.priv_class = &prores_videotoolbox_class,
29622970 .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
29632971 .p.wrapper_name = "videotoolbox",
2972+ .hw_configs = vt_encode_hw_configs,
29642973 };

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t