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

Function find_codec

fftools/ffmpeg_opt.c:806–837  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

804}
805
806int 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
839int assert_file_overwrite(const char *filename)
840{

Callers 3

choose_encoderFunction · 0.70
choose_decoderFunction · 0.70
ifile_openFunction · 0.70

Calls 6

avcodec_find_encoderFunction · 0.85
avcodec_find_decoderFunction · 0.85
av_logFunction · 0.85

Tested by

no test coverage detected