From c9c9822289cd7369f3804728b4e973034518ce0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Fri, 25 Aug 2023 19:29:33 +0200 Subject: [PATCH] player/command: add video-params/crop-[w,h,x,y] --- DOCS/interface-changes.rst | 1 + DOCS/man/input.rst | 6 ++++++ player/command.c | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst index eeccd06851..172a57195f 100644 --- a/DOCS/interface-changes.rst +++ b/DOCS/interface-changes.rst @@ -55,6 +55,7 @@ Interface changes - change `--directory-mode` default to `lazy` - remove deprecated `video-aspect` property - add `--video-crop` + - add `video-params/crop-[w,h,x,y]` --- mpv 0.36.0 --- - add `--target-contrast` - Target luminance value is now also applied when ICC profile is used. diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst index 4abbce9f0a..3dfb367410 100644 --- a/DOCS/man/input.rst +++ b/DOCS/man/input.rst @@ -2410,6 +2410,12 @@ Property list ``video-params/dw``, ``video-params/dh`` Video size as integers, scaled for correct aspect ratio. + ``video-params/crop-x``, ``video-params/crop-y`` + Crop offset of the source video frame. + + ``video-params/crop-w``, ``video-params/crop-h`` + Video size after cropping. + ``video-params/aspect`` Display aspect ratio as float. diff --git a/player/command.c b/player/command.c index 55b0dd9449..c0efeb767c 100644 --- a/player/command.c +++ b/player/command.c @@ -2291,6 +2291,10 @@ static int property_imgparams(struct mp_image_params p, int action, void *arg) {"h", SUB_PROP_INT(p.h)}, {"dw", SUB_PROP_INT(d_w)}, {"dh", SUB_PROP_INT(d_h)}, + {"crop-x", SUB_PROP_INT(p.crop.x0)}, + {"crop-y", SUB_PROP_INT(p.crop.y0)}, + {"crop-w", SUB_PROP_INT(mp_rect_w(p.crop))}, + {"crop-h", SUB_PROP_INT(mp_rect_h(p.crop))}, {"aspect", SUB_PROP_FLOAT(d_w / (double)d_h)}, {"aspect-name", SUB_PROP_STR(aspect_name), .unavailable = !aspect_name}, {"par", SUB_PROP_FLOAT(p.p_w / (double)p.p_h)},