diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/av_common.c | 7 | ||||
-rw-r--r-- | common/av_common.h | 2 |
2 files changed, 9 insertions, 0 deletions
diff --git a/common/av_common.c b/common/av_common.c index 3ea1ceb872..01428ff2f4 100644 --- a/common/av_common.c +++ b/common/av_common.c @@ -292,6 +292,13 @@ const char *mp_codec_from_av_codec_id(int codec_id) return name; } +bool mp_codec_is_lossless(const char *codec) +{ + const AVCodecDescriptor *desc = + avcodec_descriptor_get(mp_codec_to_av_codec_id(codec)); + return desc && (desc->props & AV_CODEC_PROP_LOSSLESS); +} + // kv is in the format as by OPT_KEYVALUELIST(): kv[0]=key0, kv[1]=val0, ... // Copy them to the dict. void mp_set_avdict(AVDictionary **dict, char **kv) diff --git a/common/av_common.h b/common/av_common.h index 4037afa0ad..1b3e468884 100644 --- a/common/av_common.h +++ b/common/av_common.h @@ -19,6 +19,7 @@ #define MP_AVCOMMON_H #include <inttypes.h> +#include <stdbool.h> #include <libavutil/avutil.h> #include <libavutil/rational.h> @@ -44,6 +45,7 @@ void mp_add_lavc_encoders(struct mp_decoder_list *list); char **mp_get_lavf_demuxers(void); int mp_codec_to_av_codec_id(const char *codec); const char *mp_codec_from_av_codec_id(int codec_id); +bool mp_codec_is_lossless(const char *codec); void mp_set_avdict(struct AVDictionary **dict, char **kv); void mp_avdict_print_unset(struct mp_log *log, int msgl, struct AVDictionary *d); int mp_set_avopts(struct mp_log *log, void *avobj, char **kv); |