This codec's capabilities should be set dynamically based on the value of strict_std_compliance, when available. This will allow us to finally get rid of the strictness hack in ffmpeg_filter.c.
Unified · Split
| @@ -640,7 +640,27 @@ static const AVClass mjpeg_class = { · 639 unmodified lines | |||
| 640 | .version = LIBAVUTIL_VERSION_INT, | 640 | .version = LIBAVUTIL_VERSION_INT, |
| 641 | }; | 641 | }; |
| 642 | 642 | ||
| 643 | const FFCodec ff_mjpeg_encoder = { | 643 | static int mjpeg_get_supported_config(const AVCodecContext *avctx, |
| 644 | const AVCodec *codec, | ||
| 645 | enum AVCodecConfig config, | ||
| 646 | unsigned flags, const void **out, | ||
| 647 | int *out_num) | ||
| 648 | { | ||
| 649 | if (config == AV_CODEC_CONFIG_COLOR_RANGE) { | ||
| 650 | static const enum AVColorRange mjpeg_ranges[] = { | ||
| 651 | AVCOL_RANGE_MPEG, AVCOL_RANGE_JPEG, AVCOL_RANGE_UNSPECIFIED, | ||
| 652 | }; | ||
| 653 | int strict = avctx ? avctx->strict_std_compliance : 0; | ||
| 654 | int index = strict > FF_COMPLIANCE_UNOFFICIAL ? 1 : 0; | ||
| 655 | *out = &mjpeg_ranges[index]; | ||
| 656 | *out_num = FF_ARRAY_ELEMS(mjpeg_ranges) - index - 1; | ||
| 657 | return 0; | ||
| 658 | } | ||
| 659 | |||
| 660 | return ff_default_get_supported_config(avctx, codec, config, flags, out, out_num); | ||
| 661 | } | ||
| 662 | |||
| 663 | FFCodec ff_mjpeg_encoder = { | ||
| 644 | .p.name = "mjpeg", | 664 | .p.name = "mjpeg", |
| 645 | CODEC_LONG_NAME("MJPEG (Motion JPEG)"), | 665 | CODEC_LONG_NAME("MJPEG (Motion JPEG)"), |
| 646 | .p.type = AVMEDIA_TYPE_VIDEO, | 666 | .p.type = AVMEDIA_TYPE_VIDEO, |
| @@ -657,9 +677,9 @@ const FFCodec ff_mjpeg_encoder = { · 10 unmodified lines | |||
| 657 | AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P, | 677 | AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P, |
| 658 | AV_PIX_FMT_NONE | 678 | AV_PIX_FMT_NONE |
| 659 | }, | 679 | }, |
| 660 | .color_ranges = AVCOL_RANGE_MPEG | AVCOL_RANGE_JPEG, | ||
| 661 | .p.priv_class = &mjpeg_class, | 680 | .p.priv_class = &mjpeg_class, |
| 662 | .p.profiles = NULL_IF_CONFIG_SMALL(ff_mjpeg_profiles), | 681 | .p.profiles = NULL_IF_CONFIG_SMALL(ff_mjpeg_profiles), |
| 682 | .get_supported_config = mjpeg_get_supported_config, | ||
| 663 | }; | 683 | }; |
| 664 | #endif | 684 | #endif |
| 665 | 685 | ||