mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-02-04 06:08:26 +02:00
Merge commit 'd7705be9617ed691c7a2924a2088de2d96f38af1'
* commit 'd7705be9617ed691c7a2924a2088de2d96f38af1': mpegvideoenc: check color_range Conflicts: libavcodec/mpegvideo_enc.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
b3a647d9ce
@ -246,7 +246,7 @@ av_cold int ff_dct_encode_init(MpegEncContext *s) {
|
|||||||
av_cold int ff_MPV_encode_init(AVCodecContext *avctx)
|
av_cold int ff_MPV_encode_init(AVCodecContext *avctx)
|
||||||
{
|
{
|
||||||
MpegEncContext *s = avctx->priv_data;
|
MpegEncContext *s = avctx->priv_data;
|
||||||
int i, ret;
|
int i, ret, format_supported;
|
||||||
|
|
||||||
MPV_encode_defaults(s);
|
MPV_encode_defaults(s);
|
||||||
|
|
||||||
@ -261,13 +261,24 @@ av_cold int ff_MPV_encode_init(AVCodecContext *avctx)
|
|||||||
break;
|
break;
|
||||||
case AV_CODEC_ID_MJPEG:
|
case AV_CODEC_ID_MJPEG:
|
||||||
case AV_CODEC_ID_AMV:
|
case AV_CODEC_ID_AMV:
|
||||||
if (avctx->pix_fmt != AV_PIX_FMT_YUVJ420P &&
|
format_supported = 0;
|
||||||
avctx->pix_fmt != AV_PIX_FMT_YUVJ422P &&
|
/* JPEG color space */
|
||||||
avctx->pix_fmt != AV_PIX_FMT_YUVJ444P &&
|
if (avctx->pix_fmt == AV_PIX_FMT_YUVJ420P ||
|
||||||
((avctx->pix_fmt != AV_PIX_FMT_YUV420P &&
|
avctx->pix_fmt == AV_PIX_FMT_YUVJ422P ||
|
||||||
avctx->pix_fmt != AV_PIX_FMT_YUV422P &&
|
avctx->pix_fmt == AV_PIX_FMT_YUVJ444P ||
|
||||||
avctx->pix_fmt != AV_PIX_FMT_YUV444P) ||
|
(avctx->color_range == AVCOL_RANGE_JPEG &&
|
||||||
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;
|
||||||
|
/* 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");
|
av_log(avctx, AV_LOG_ERROR, "colorspace not supported in jpeg\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user