[FFmpeg-devel] [crop support for matroska demuxer, V4 2/3] libavcodec: Public code to support container crop

Michael Niedermayer michael at niedermayer.cc
Fri Nov 4 17:34:22 EET 2022


On Fri, Nov 04, 2022 at 03:13:35PM +0100, OvchinnikovDmitrii wrote:
> Support both simple and receive_frame api
> The container crop information is applied additional to frame crop information
[...]
> +            av_log(avctx, AV_LOG_WARNING,
> +                "Apply container  and elementary stream corpping parametes error: "
> +                "container cropping parameters"
> +                "%"SIZE_SPECIFIER"/%"SIZE_SPECIFIER"/%"SIZE_SPECIFIER"/%"SIZE_SPECIFIER" "
> +                "elementary stream croping paramters"
> +                "%"SIZE_SPECIFIER"/%"SIZE_SPECIFIER"/%"SIZE_SPECIFIER"/%"SIZE_SPECIFIER" "
> +                "(frame size %dx%d). This is a bug, please report it\n",
> +                avctx->container_crop_left, avctx->container_crop_right, avctx->container_crop_top, avctx->container_crop_bottom,
> +                frame->crop_left, frame->crop_right, frame->crop_top, frame->crop_bottom,
> +                frame->width, frame->height);
> +            frame->crop_left   = 0;
> +            frame->crop_right  = 0;
> +            frame->crop_top    = 0;
> +            frame->crop_bottom = 0;
> +            return 0;
> +        }
> +
> +        frame->crop_top    += avctx->container_crop_top;
> +        frame->crop_left   += avctx->container_crop_left;
> +        frame->crop_bottom += avctx->container_crop_bottom;
> +        frame->crop_right  += avctx->container_crop_right;
> +    }else if (avctx->container_apply_cropping == FF_CONTAINER_CROPPING_OVERWRITE) {
> +
> +        /*check the croppping parameters from container are reasonable and correct*/
> +        if (avctx->container_crop_left >= INT_MAX - avctx->container_crop_right ||
> +            avctx->container_crop_top >= INT_MAX - avctx->container_crop_bottom ||
> +            (avctx->container_crop_left + avctx->container_crop_right) >= frame->width ||
> +            (avctx->container_crop_top + avctx->container_crop_bottom) >= frame->height) {

> +            av_log(avctx, AV_LOG_WARNING,
> +                "Invalid container cropping information set by a demuxer: "
> +                "%"SIZE_SPECIFIER"/%"SIZE_SPECIFIER"/%"SIZE_SPECIFIER"/%"SIZE_SPECIFIER" "
> +                "(frame size %dx%d). This is a bug, please report it\n",
> +                avctx->container_crop_left, avctx->container_crop_right, avctx->container_crop_top, avctx->container_crop_bottom,
> +                frame->width, frame->height);

The types seems mismatching

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I do not agree with what you have to say, but I'll defend to the death your
right to say it. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20221104/9775c5c8/attachment.sig>


More information about the ffmpeg-devel mailing list