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

Unified · Split

libavcodec/videotoolboxenc.c+9−0
@@ -37,6 +37,7 @@ · 36 unmodified lines
37#include "encode.h"37#include "encode.h"
38#include "h264.h"38#include "h264.h"
39#include "h264_sei.h"39#include "h264_sei.h"
40#include "hwconfig.h"
40#include <dlfcn.h>41#include <dlfcn.h>
41 42
42#if !HAVE_KCMVIDEOCODECTYPE_HEVC43#if !HAVE_KCMVIDEOCODECTYPE_HEVC
@@ -2830,6 +2831,11 @@ static const enum AVPixelFormat prores_pix_fmts[] = { · 2787 unmodified lines
2830 "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.", \2831 "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.", \
2831 OFFSET(max_ref_frames), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },2832 OFFSET(max_ref_frames), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
2832 2833
2834static const AVCodecHWConfigInternal *const vt_encode_hw_configs[] = {
2835 HW_CONFIG_ENCODER_FRAMES(VIDEOTOOLBOX, VIDEOTOOLBOX),
2836 NULL,
2837};
2838
2833#define OFFSET(x) offsetof(VTEncContext, x)2839#define OFFSET(x) offsetof(VTEncContext, x)
2834static const AVOption h264_options[] = {2840static const AVOption h264_options[] = {
2835 { "profile", "Profile", OFFSET(profile), AV_OPT_TYPE_INT, { .i64 = AV_PROFILE_UNKNOWN }, AV_PROFILE_UNKNOWN, INT_MAX, VE, "profile" },2841 { "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
2886 .close = vtenc_close,2892 .close = vtenc_close,
2887 .p.priv_class = &h264_videotoolbox_class,2893 .p.priv_class = &h264_videotoolbox_class,
2888 .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,2894 .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
2895 .hw_configs = vt_encode_hw_configs,
2889};2896};
2890 2897
2891static const AVOption hevc_options[] = {2898static const AVOption hevc_options[] = {
@@ -2923,6 +2930,7 @@ const FFCodec ff_hevc_videotoolbox_encoder = { · 31 unmodified lines
2923 .p.priv_class = &hevc_videotoolbox_class,2930 .p.priv_class = &hevc_videotoolbox_class,
2924 .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,2931 .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
2925 .p.wrapper_name = "videotoolbox",2932 .p.wrapper_name = "videotoolbox",
2933 .hw_configs = vt_encode_hw_configs,
2926};2934};
2927 2935
2928static const AVOption prores_options[] = {2936static const AVOption prores_options[] = {
@@ -2961,4 +2969,5 @@ const FFCodec ff_prores_videotoolbox_encoder = { · 32 unmodified lines
2961 .p.priv_class = &prores_videotoolbox_class,2969 .p.priv_class = &prores_videotoolbox_class,
2962 .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,2970 .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
2963 .p.wrapper_name = "videotoolbox",2971 .p.wrapper_name = "videotoolbox",
2972 .hw_configs = vt_encode_hw_configs,
2964};2973};

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