fftools/ffmpeg_filter: check the codec's descriptor to see if it's lossless

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2020-05-18 12:38:35 -03:00
parent d3bedba97f
commit 0a3ba58b44
1 changed files with 2 additions and 1 deletions

View File

@ -99,7 +99,8 @@ void choose_sample_fmt(AVStream *st, AVCodec *codec)
break; break;
} }
if (*p == -1) { if (*p == -1) {
if((codec->capabilities & AV_CODEC_CAP_LOSSLESS) && av_get_sample_fmt_name(st->codecpar->format) > av_get_sample_fmt_name(codec->sample_fmts[0])) const AVCodecDescriptor *desc = avcodec_descriptor_get(codec->id);
if(desc && (desc->props & AV_CODEC_PROP_LOSSLESS) && av_get_sample_fmt_name(st->codecpar->format) > av_get_sample_fmt_name(codec->sample_fmts[0]))
av_log(NULL, AV_LOG_ERROR, "Conversion will not be lossless.\n"); av_log(NULL, AV_LOG_ERROR, "Conversion will not be lossless.\n");
if(av_get_sample_fmt_name(st->codecpar->format)) if(av_get_sample_fmt_name(st->codecpar->format))
av_log(NULL, AV_LOG_WARNING, av_log(NULL, AV_LOG_WARNING,