diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-04-06 03:01:14 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-04-10 03:48:41 +0200 |
commit | 059fc2d9da5364627613fb3e6424079e14dbdfd3 (patch) | |
tree | ed91afb8711dd2a9f62327cdad8deda50b07f2f7 /libavcodec/ljpegenc.c | |
parent | 48cda7d02b768d965db6582271a2f8591f2a3a10 (diff) |
avcodec/mjpegenc: Include all supported pix_fmts in mpegenc pix_fmts
Currently said list contains only the pixel formats that are always
supported irrespective of the range and the value of
strict_std_compliance. This makes the MJPEG encoder an outlier as all
other codecs put all potentially supported pixel formats into said list
and error out if the chosen pixel format is unsupported. This commit
brings it therefore in line with the other encoders.
The behaviour of fftools/ffmpeg_filter.c has been preserved. A more
informed decision would be possible if colour range were available
at this point, but it isn't.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/ljpegenc.c')
-rw-r--r-- | libavcodec/ljpegenc.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/libavcodec/ljpegenc.c b/libavcodec/ljpegenc.c index dd91c729d4..74a2cdcc46 100644 --- a/libavcodec/ljpegenc.c +++ b/libavcodec/ljpegenc.c @@ -289,19 +289,11 @@ static av_cold int ljpeg_encode_close(AVCodecContext *avctx) static av_cold int ljpeg_encode_init(AVCodecContext *avctx) { + int ret = ff_mjpeg_encode_check_pix_fmt(avctx); LJpegEncContext *s = avctx->priv_data; - if ((avctx->pix_fmt == AV_PIX_FMT_YUV420P || - avctx->pix_fmt == AV_PIX_FMT_YUV422P || - avctx->pix_fmt == AV_PIX_FMT_YUV444P || - avctx->color_range == AVCOL_RANGE_MPEG) && - avctx->color_range != AVCOL_RANGE_JPEG && - avctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL) { - av_log(avctx, AV_LOG_ERROR, - "Non full-range YUV is non-standard, set strict_std_compliance " - "to at most unofficial to use it.\n"); - return AVERROR(EINVAL); - } + if (ret < 0) + return ret; #if FF_API_CODED_FRAME FF_DISABLE_DEPRECATION_WARNINGS |