MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / ff_default_get_supported_config

Function ff_default_get_supported_config

libavcodec/avcodec.c:768–821  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

766};
767
768int ff_default_get_supported_config(const AVCodecContext *avctx,
769 const AVCodec *codec,
770 enum AVCodecConfig config,
771 unsigned flags,
772 const void **out_configs,
773 int *out_num_configs)
774{
775 const FFCodec *codec2 = ffcodec(codec);
776
777 switch (config) {
778FF_DISABLE_DEPRECATION_WARNINGS
779 case AV_CODEC_CONFIG_PIX_FORMAT:
780 WRAP_CONFIG(AVMEDIA_TYPE_VIDEO, pix_fmts, pix_fmt, enum AVPixelFormat, pix_fmt == AV_PIX_FMT_NONE);
781 case AV_CODEC_CONFIG_FRAME_RATE:
782 WRAP_CONFIG(AVMEDIA_TYPE_VIDEO, supported_framerates, framerate, AVRational, framerate.num == 0);
783 case AV_CODEC_CONFIG_SAMPLE_RATE:
784 WRAP_CONFIG(AVMEDIA_TYPE_AUDIO, supported_samplerates, samplerate, int, samplerate == 0);
785 case AV_CODEC_CONFIG_SAMPLE_FORMAT:
786 WRAP_CONFIG(AVMEDIA_TYPE_AUDIO, sample_fmts, sample_fmt, enum AVSampleFormat, sample_fmt == AV_SAMPLE_FMT_NONE);
787 case AV_CODEC_CONFIG_CHANNEL_LAYOUT:
788 WRAP_CONFIG(AVMEDIA_TYPE_AUDIO, ch_layouts, ch_layout, AVChannelLayout, ch_layout.nb_channels == 0);
789FF_ENABLE_DEPRECATION_WARNINGS
790
791 case AV_CODEC_CONFIG_COLOR_RANGE:
792 if (codec->type != AVMEDIA_TYPE_VIDEO)
793 return AVERROR(EINVAL);
794 unsigned color_ranges = codec2->color_ranges;
795 if (color_ranges)
796 *out_configs = color_range_tab + offset_tab[color_ranges];
797 else
798 *out_configs = NULL;
799 *out_num_configs = av_popcount(color_ranges);
800 return 0;
801
802 case AV_CODEC_CONFIG_COLOR_SPACE:
803 *out_configs = NULL;
804 *out_num_configs = 0;
805 return 0;
806
807 case AV_CODEC_CONFIG_ALPHA_MODE:
808 if (codec->type != AVMEDIA_TYPE_VIDEO)
809 return AVERROR(EINVAL);
810 unsigned alpha_modes = codec2->alpha_modes;
811 if (alpha_modes)
812 *out_configs = alpha_mode_tab + offset_tab[alpha_modes];
813 else
814 *out_configs = NULL;
815 *out_num_configs = av_popcount(alpha_modes);
816 return 0;
817
818 default:
819 return AVERROR(EINVAL);
820 }
821}
822
823int avcodec_get_supported_config(const AVCodecContext *avctx, const AVCodec *codec,
824 enum AVCodecConfig config, unsigned flags,

Callers 5

vp9_get_supported_configFunction · 0.85
av1_get_supported_configFunction · 0.85

Calls 1

ffcodecFunction · 0.85

Tested by

no test coverage detected