Showing the changes to libavcodec/tests (1 of 1 file). Show all
Unified · Split
| @@ -41,6 +41,7 @@ int main(void){ · 40 unmodified lines | |||
| 41 | 41 | ||
| 42 | while (codec = av_codec_iterate(&iter)) { | 42 | while (codec = av_codec_iterate(&iter)) { |
| 43 | const AVCodecDescriptor *desc; | 43 | const AVCodecDescriptor *desc; |
| 44 | int is_decoder, is_encoder; | ||
| 44 | 45 | ||
| 45 | if (!codec->name) { | 46 | if (!codec->name) { |
| 46 | AV_LOG("Codec for format %s has no name\n", | 47 | AV_LOG("Codec for format %s has no name\n", |
| @@ -63,13 +64,33 @@ int main(void){ · 16 unmodified lines | |||
| 63 | ERR("Non-video codec %s has video-only fields set\n"); | 64 | ERR("Non-video codec %s has video-only fields set\n"); |
| 64 | } | 65 | } |
| 65 | 66 | ||
| 66 | if (av_codec_is_encoder(codec)) { | 67 | is_decoder = av_codec_is_decoder(codec); |
| 68 | is_encoder = av_codec_is_encoder(codec); | ||
| 69 | if (!!is_decoder + !!is_encoder != 1) { | ||
| 70 | ERR("Codec %s is decoder and encoder or neither.\n"); | ||
| 71 | continue; | ||
| 72 | } | ||
| 73 | if (is_encoder) { | ||
| 74 | if (codec->type == AVMEDIA_TYPE_SUBTITLE ^ !!codec->encode_sub) | ||
| 75 | ERR("Encoder %s is both subtitle encoder and not subtitle encoder."); | ||
| 76 | if (!!codec->encode_sub + !!codec->encode2 + !!codec->receive_packet != 1) | ||
| 77 | ERR("Encoder %s does not implement exactly one encode API.\n"); | ||
| 78 | if (codec->update_thread_context || codec->update_thread_context_for_user || codec->bsfs) | ||
| 79 | ERR("Encoder %s has decoder-only thread functions or bsf.\n"); | ||
| 67 | if (codec->type == AVMEDIA_TYPE_AUDIO) { | 80 | if (codec->type == AVMEDIA_TYPE_AUDIO) { |
| 68 | if (!codec->sample_fmts) { | 81 | if (!codec->sample_fmts) { |
| 69 | av_log(NULL, AV_LOG_FATAL, "Encoder %s is missing the sample_fmts field\n", codec->name); | 82 | av_log(NULL, AV_LOG_FATAL, "Encoder %s is missing the sample_fmts field\n", codec->name); |
| 70 | ret = 1; | 83 | ret = 1; |
| 71 | } | 84 | } |
| 72 | } | 85 | } |
| 86 | } else { | ||
| 87 | if (codec->type == AVMEDIA_TYPE_SUBTITLE && !codec->decode) | ||
| 88 | ERR("Subtitle decoder %s does not implement decode callback\n"); | ||
| 89 | if (codec->type == AVMEDIA_TYPE_SUBTITLE && codec->bsfs) | ||
| 90 | ERR("Automatic bitstream filtering unsupported for subtitles; " | ||
| 91 | "yet decoder %s has it set\n"); | ||
| 92 | if (!!codec->decode + !!codec->receive_frame != 1) | ||
| 93 | ERR("Decoder %s does not implement exactly one decode API.\n"); | ||
| 73 | } | 94 | } |
| 74 | if (!(desc = avcodec_descriptor_get(codec->id))) { | 95 | if (!(desc = avcodec_descriptor_get(codec->id))) { |
| 75 | ERR("Codec %s lacks a corresponding descriptor\n"); | 96 | ERR("Codec %s lacks a corresponding descriptor\n"); |