History

avcodec/libx265: switch to get_supported_config()

Niklas Haas committed 2 years ago

Commit de421ca1 parent 088108f1 file · +22 −8Browse files

Unified · Split

libavcodec/libx265.c+22−8
@@ -949,14 +949,28 @@ static const enum AVPixelFormat x265_csp_twelve[] = { · 948 unmodified lines
949949 AV_PIX_FMT_NONE
950950 };
951951
952−static av_cold void libx265_encode_init_csp(FFCodec *codec)
952+static int libx265_get_supported_config(const AVCodecContext *avctx,
953+ const AVCodec *codec,
954+ enum AVCodecConfig config,
955+ unsigned flags, const void **out,
956+ int *out_num)
953957 {
954− if (x265_api_get(12))
955− codec->p.pix_fmts = x265_csp_twelve;
956− else if (x265_api_get(10))
957− codec->p.pix_fmts = x265_csp_ten;
958− else if (x265_api_get(8))
959− codec->p.pix_fmts = x265_csp_eight;
958+ if (config == AV_CODEC_CONFIG_PIX_FORMAT) {
959+ if (x265_api_get(12)) {
960+ *out = x265_csp_twelve;
961+ *out_num = FF_ARRAY_ELEMS(x265_csp_twelve) - 1;
962+ } else if (x265_api_get(10)) {
963+ *out = x265_csp_ten;
964+ *out_num = FF_ARRAY_ELEMS(x265_csp_ten) - 1;
965+ } else if (x265_api_get(8)) {
966+ *out = x265_csp_eight;
967+ *out_num = FF_ARRAY_ELEMS(x265_csp_eight) - 1;
968+ } else
969+ return AVERROR_EXTERNAL;
970+ return 0;
971+ }
972+
973+ return ff_default_get_supported_config(avctx, codec, config, flags, out, out_num);
960974 }
961975
962976 #define OFFSET(x) offsetof(libx265Context, x)
@@ -1013,7 +1027,7 @@ FFCodec ff_libx265_encoder = { · 50 unmodified lines
10131027 .p.priv_class = &class,
10141028 .p.wrapper_name = "libx265",
10151029 .init = libx265_encode_init,
1016− .init_static_data = libx265_encode_init_csp,
1030+ .get_supported_config = libx265_get_supported_config,
10171031 FF_CODEC_ENCODE_CB(libx265_encode_frame),
10181032 .close = libx265_encode_close,
10191033 .priv_data_size = sizeof(libx265Context),

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