mirror of https://github.com/mpv-player/mpv
av_common: allow calling mp_codec_to_av_codec_id() with NULL
Helps reducing special cases.
This commit is contained in:
parent
2adb1aaa5d
commit
5ac50f88c9
|
@ -75,6 +75,7 @@ void mp_add_lavc_decoders(struct mp_decoder_list *list, enum AVMediaType type)
|
||||||
int mp_codec_to_av_codec_id(const char *codec)
|
int mp_codec_to_av_codec_id(const char *codec)
|
||||||
{
|
{
|
||||||
int id = AV_CODEC_ID_NONE;
|
int id = AV_CODEC_ID_NONE;
|
||||||
|
if (codec) {
|
||||||
const AVCodecDescriptor *desc = avcodec_descriptor_get_by_name(codec);
|
const AVCodecDescriptor *desc = avcodec_descriptor_get_by_name(codec);
|
||||||
if (desc)
|
if (desc)
|
||||||
id = desc->id;
|
id = desc->id;
|
||||||
|
@ -83,6 +84,7 @@ int mp_codec_to_av_codec_id(const char *codec)
|
||||||
if (avcodec)
|
if (avcodec)
|
||||||
id = avcodec->id;
|
id = avcodec->id;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue