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/mpegvideo_enc.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/mpegvideo_enc.c')
-rw-r--r-- | libavcodec/mpegvideo_enc.c | 28 |
1 files changed, 1 insertions, 27 deletions
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 862e345017..1f8fc8d8b8 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -297,36 +297,10 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) { MpegEncContext *s = avctx->priv_data; AVCPBProperties *cpb_props; - int i, ret, format_supported; + int i, ret; mpv_encode_defaults(s); - switch (avctx->codec_id) { - case AV_CODEC_ID_MJPEG: - format_supported = 0; - /* JPEG color space */ - if (avctx->pix_fmt == AV_PIX_FMT_YUVJ420P || - avctx->pix_fmt == AV_PIX_FMT_YUVJ422P || - avctx->pix_fmt == AV_PIX_FMT_YUVJ444P || - (avctx->color_range == AVCOL_RANGE_JPEG && - (avctx->pix_fmt == AV_PIX_FMT_YUV420P || - avctx->pix_fmt == AV_PIX_FMT_YUV422P || - avctx->pix_fmt == AV_PIX_FMT_YUV444P))) - format_supported = 1; - /* MPEG color space */ - else if (avctx->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL && - (avctx->pix_fmt == AV_PIX_FMT_YUV420P || - avctx->pix_fmt == AV_PIX_FMT_YUV422P || - avctx->pix_fmt == AV_PIX_FMT_YUV444P)) - format_supported = 1; - - if (!format_supported) { - av_log(avctx, AV_LOG_ERROR, "colorspace not supported in jpeg\n"); - return AVERROR(EINVAL); - } - break; - } - switch (avctx->pix_fmt) { case AV_PIX_FMT_YUVJ444P: case AV_PIX_FMT_YUV444P: |