diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-06-11 02:57:08 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-06-11 02:57:08 +0200 |
commit | b3a647d9ce59cd75ccf4233eac871af91bebf0d0 (patch) | |
tree | 474a02180a0268c7508d802afd95914a3b6f4c63 /libavcodec/mpegvideo_enc.c | |
parent | 1290143fda931596f140dc1c31dd8a158710295e (diff) | |
parent | d7705be9617ed691c7a2924a2088de2d96f38af1 (diff) | |
download | ffmpeg-b3a647d9ce59cd75ccf4233eac871af91bebf0d0.tar.gz |
Merge commit 'd7705be9617ed691c7a2924a2088de2d96f38af1'
* commit 'd7705be9617ed691c7a2924a2088de2d96f38af1':
mpegvideoenc: check color_range
Conflicts:
libavcodec/mpegvideo_enc.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mpegvideo_enc.c')
-rw-r--r-- | libavcodec/mpegvideo_enc.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 9f36c8f3b7..ba17b2c6ce 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -246,7 +246,7 @@ av_cold int ff_dct_encode_init(MpegEncContext *s) { av_cold int ff_MPV_encode_init(AVCodecContext *avctx) { MpegEncContext *s = avctx->priv_data; - int i, ret; + int i, ret, format_supported; MPV_encode_defaults(s); @@ -261,13 +261,24 @@ av_cold int ff_MPV_encode_init(AVCodecContext *avctx) break; case AV_CODEC_ID_MJPEG: case AV_CODEC_ID_AMV: - if (avctx->pix_fmt != AV_PIX_FMT_YUVJ420P && - avctx->pix_fmt != AV_PIX_FMT_YUVJ422P && - avctx->pix_fmt != AV_PIX_FMT_YUVJ444P && - ((avctx->pix_fmt != AV_PIX_FMT_YUV420P && - avctx->pix_fmt != AV_PIX_FMT_YUV422P && - avctx->pix_fmt != AV_PIX_FMT_YUV444P) || - avctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL)) { + 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 -1; } |