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

Function main

libavcodec/tests/avcodec.c:83–244  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81} while (0)
82
83int main(void){
84 void *iter = NULL;
85 const AVCodec *codec = NULL;
86 int ret = 0;
87
88 while (codec = av_codec_iterate(&iter)) {
89 const FFCodec *const codec2 = ffcodec(codec);
90 const AVCodecDescriptor *desc;
91 int is_decoder = 0, is_encoder = 0;
92
93 if (!codec->name) {
94 AV_LOG("Codec for format %s has no name\n",
95 avcodec_get_name(codec->id));
96 ret = 1;
97 continue;
98 }
99 if (codec->type != AVMEDIA_TYPE_VIDEO &&
100 codec->type != AVMEDIA_TYPE_AUDIO &&
101 codec->type != AVMEDIA_TYPE_SUBTITLE)
102 ERR_EXT("Codec %s has unsupported type %s\n",
103 get_type_string(codec->type));
104 if (codec->type != AVMEDIA_TYPE_AUDIO) {
105FF_DISABLE_DEPRECATION_WARNINGS
106 if (codec->ch_layouts || codec->sample_fmts ||
107 codec->supported_samplerates)
108 ERR("Non-audio codec %s has audio-only fields set\n");
109FF_ENABLE_DEPRECATION_WARNINGS
110 if (codec->capabilities & (AV_CODEC_CAP_SMALL_LAST_FRAME |
111 AV_CODEC_CAP_CHANNEL_CONF |
112 AV_CODEC_CAP_VARIABLE_FRAME_SIZE))
113 ERR("Non-audio codec %s has audio-only capabilities set\n");
114 } else {
115FF_DISABLE_DEPRECATION_WARNINGS
116 ARRAY_CHECK(supported_samplerates, sample_rate, int, sample_rate == 0,
117 sample_rate > 0, 1);
118 ARRAY_CHECK(sample_fmts, sample_fmt, enum AVSampleFormat, sample_fmt == AV_SAMPLE_FMT_NONE,
119 (unsigned)sample_fmt < AV_SAMPLE_FMT_NB, 1);
120 static const AVChannelLayout zero_channel_layout = { 0 };
121 ARRAY_CHECK(ch_layouts, ch_layout, AVChannelLayout, ch_layout.nb_channels == 0,
122 av_channel_layout_check(&ch_layout), !memcmp(ptr, &zero_channel_layout, sizeof(ch_layout)));
123FF_ENABLE_DEPRECATION_WARNINGS
124 }
125 if (codec->type != AVMEDIA_TYPE_VIDEO) {
126FF_DISABLE_DEPRECATION_WARNINGS
127 if (codec->pix_fmts || codec->supported_framerates ||
128 codec2->color_ranges || codec2->alpha_modes)
129 ERR("Non-video codec %s has video-only fields set\n");
130FF_ENABLE_DEPRECATION_WARNINGS
131 if (codec2->caps_internal & FF_CODEC_CAP_EXPORTS_CROPPING)
132 ERR("Non-video codec %s exports cropping\n");
133 }
134 if (codec2->caps_internal & FF_CODEC_CAP_SLICE_THREAD_HAS_MF &&
135 !(codec->capabilities & AV_CODEC_CAP_SLICE_THREADS))
136 ERR("Codec %s wants mainfunction despite not being "
137 "slice-threading capable");
138 if (codec2->caps_internal & FF_CODEC_CAP_AUTO_THREADS &&
139 !(codec->capabilities & (AV_CODEC_CAP_FRAME_THREADS |
140 AV_CODEC_CAP_SLICE_THREADS |

Callers

nothing calls this directly

Calls 11

av_codec_iterateFunction · 0.85
ffcodecFunction · 0.85
avcodec_get_nameFunction · 0.85
get_type_stringFunction · 0.85
av_codec_is_decoderFunction · 0.85
av_codec_is_encoderFunction · 0.85
av_logFunction · 0.85
ARRAY_CHECKFunction · 0.85
av_pix_fmt_desc_getFunction · 0.85
priv_data_size_wrongFunction · 0.85
avcodec_descriptor_getFunction · 0.85

Tested by

no test coverage detected