Unified · Split
| @@ -949,14 +949,28 @@ static const enum AVPixelFormat x265_csp_twelve[] = { · 948 unmodified lines | |||
| 949 | AV_PIX_FMT_NONE | 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)) | 958 | if (config == AV_CODEC_CONFIG_PIX_FORMAT) { |
| 955 | codec->p.pix_fmts = x265_csp_twelve; | 959 | if (x265_api_get(12)) { |
| 956 | else if (x265_api_get(10)) | 960 | *out = x265_csp_twelve; |
| 957 | codec->p.pix_fmts = x265_csp_ten; | 961 | *out_num = FF_ARRAY_ELEMS(x265_csp_twelve) - 1; |
| 958 | else if (x265_api_get(8)) | 962 | } else if (x265_api_get(10)) { |
| 959 | codec->p.pix_fmts = x265_csp_eight; | 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 | #define OFFSET(x) offsetof(libx265Context, x) | 976 | #define OFFSET(x) offsetof(libx265Context, x) |
| @@ -1013,7 +1027,7 @@ FFCodec ff_libx265_encoder = { · 50 unmodified lines | |||
| 1013 | .p.priv_class = &class, | 1027 | .p.priv_class = &class, |
| 1014 | .p.wrapper_name = "libx265", | 1028 | .p.wrapper_name = "libx265", |
| 1015 | .init = libx265_encode_init, | 1029 | .init = libx265_encode_init, |
| 1016 | .init_static_data = libx265_encode_init_csp, | 1030 | .get_supported_config = libx265_get_supported_config, |
| 1017 | FF_CODEC_ENCODE_CB(libx265_encode_frame), | 1031 | FF_CODEC_ENCODE_CB(libx265_encode_frame), |
| 1018 | .close = libx265_encode_close, | 1032 | .close = libx265_encode_close, |
| 1019 | .priv_data_size = sizeof(libx265Context), | 1033 | .priv_data_size = sizeof(libx265Context), |