| 804 | } |
| 805 | |
| 806 | int find_codec(void *logctx, const char *name, |
| 807 | enum AVMediaType type, int encoder, const AVCodec **pcodec) |
| 808 | { |
| 809 | const AVCodecDescriptor *desc; |
| 810 | const char *codec_string = encoder ? "encoder" : "decoder"; |
| 811 | const AVCodec *codec; |
| 812 | |
| 813 | codec = encoder ? |
| 814 | avcodec_find_encoder_by_name(name) : |
| 815 | avcodec_find_decoder_by_name(name); |
| 816 | |
| 817 | if (!codec && (desc = avcodec_descriptor_get_by_name(name))) { |
| 818 | codec = encoder ? avcodec_find_encoder(desc->id) : |
| 819 | avcodec_find_decoder(desc->id); |
| 820 | if (codec) |
| 821 | av_log(logctx, AV_LOG_VERBOSE, "Matched %s '%s' for codec '%s'.\n", |
| 822 | codec_string, codec->name, desc->name); |
| 823 | } |
| 824 | |
| 825 | if (!codec) { |
| 826 | av_log(logctx, AV_LOG_FATAL, "Unknown %s '%s'\n", codec_string, name); |
| 827 | return encoder ? AVERROR_ENCODER_NOT_FOUND : |
| 828 | AVERROR_DECODER_NOT_FOUND; |
| 829 | } |
| 830 | if (codec->type != type && !recast_media) { |
| 831 | av_log(logctx, AV_LOG_FATAL, "Invalid %s type '%s'\n", codec_string, name); |
| 832 | return AVERROR(EINVAL); |
| 833 | } |
| 834 | |
| 835 | *pcodec = codec; |
| 836 | return 0;; |
| 837 | } |
| 838 | |
| 839 | int assert_file_overwrite(const char *filename) |
| 840 | { |
no test coverage detected