All encoders using ff_mpv_encode_init() already have pix_fmts set so that the pixel format is already checked in ff_encode_preinit(). The one exception to this is MJPEG whose check remains. (Btw: The AVCodec.pix_fmts check for AMV is stricter than the check in ff_mpv_encode_init().)
Unified · Split
| @@ -302,16 +302,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) · 301 unmodified lines | ||
| 302 | 302 | mpv_encode_defaults(s); |
| 303 | 303 | |
| 304 | 304 | switch (avctx->codec_id) { |
| 305 | − case AV_CODEC_ID_MPEG2VIDEO: | |
| 306 | − if (avctx->pix_fmt != AV_PIX_FMT_YUV420P && | |
| 307 | − avctx->pix_fmt != AV_PIX_FMT_YUV422P) { | |
| 308 | − av_log(avctx, AV_LOG_ERROR, | |
| 309 | − "only YUV420 and YUV422 are supported\n"); | |
| 310 | − return AVERROR(EINVAL); | |
| 311 | − } | |
| 312 | − break; | |
| 313 | 305 | case AV_CODEC_ID_MJPEG: |
| 314 | − case AV_CODEC_ID_AMV: | |
| 315 | 306 | format_supported = 0; |
| 316 | 307 | /* JPEG color space */ |
| 317 | 308 | if (avctx->pix_fmt == AV_PIX_FMT_YUVJ420P || |
| @@ -334,20 +325,6 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) · 16 unmodified lines | ||
| 334 | 325 | return AVERROR(EINVAL); |
| 335 | 326 | } |
| 336 | 327 | break; |
| 337 | − case AV_CODEC_ID_SPEEDHQ: | |
| 338 | − if (avctx->pix_fmt != AV_PIX_FMT_YUV420P && | |
| 339 | − avctx->pix_fmt != AV_PIX_FMT_YUV422P && | |
| 340 | − avctx->pix_fmt != AV_PIX_FMT_YUV444P) { | |
| 341 | − av_log(avctx, AV_LOG_ERROR, | |
| 342 | − "only YUV420/YUV422/YUV444 are supported (no alpha support yet)\n"); | |
| 343 | − return AVERROR(EINVAL); | |
| 344 | − } | |
| 345 | − break; | |
| 346 | − default: | |
| 347 | − if (avctx->pix_fmt != AV_PIX_FMT_YUV420P) { | |
| 348 | − av_log(avctx, AV_LOG_ERROR, "only YUV420 is supported\n"); | |
| 349 | − return AVERROR(EINVAL); | |
| 350 | − } | |
| 351 | 328 | } |
| 352 | 329 | |
| 353 | 330 | switch (avctx->pix_fmt) { |