Showing the changes to libavcodec (1 of 1 file). Show all
Unified · Split
| @@ -949,14 +949,28 @@ static const enum AVPixelFormat x265_csp_twelve[] = { · 948 unmodified lines | ||
| 949 | 949 | AV_PIX_FMT_NONE |
| 950 | 950 | }; |
| 951 | 951 | |
| 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) | |
| 953 | 957 | { |
| 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); | |
| 960 | 974 | } |
| 961 | 975 | |
| 962 | 976 | #define OFFSET(x) offsetof(libx265Context, x) |
| @@ -1013,7 +1027,7 @@ FFCodec ff_libx265_encoder = { · 50 unmodified lines | ||
| 1013 | 1027 | .p.priv_class = &class, |
| 1014 | 1028 | .p.wrapper_name = "libx265", |
| 1015 | 1029 | .init = libx265_encode_init, |
| 1016 | − .init_static_data = libx265_encode_init_csp, | |
| 1030 | + .get_supported_config = libx265_get_supported_config, | |
| 1017 | 1031 | FF_CODEC_ENCODE_CB(libx265_encode_frame), |
| 1018 | 1032 | .close = libx265_encode_close, |
| 1019 | 1033 | .priv_data_size = sizeof(libx265Context), |