summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2023-08-31 23:56:56 +0200
committerDudemanguy <random342@airmail.cc>2023-09-08 02:27:08 +0000
commit96c16625746c3253f47a3ad66e8455fcf2063f46 (patch)
treec38485e47602920b9009f55aa400893cc1aa9724 /player
parentfb6f92af7f437a6e44865188c4d22eaad19d4869 (diff)
downloadmpv-96c16625746c3253f47a3ad66e8455fcf2063f46.tar.bz2
mpv-96c16625746c3253f47a3ad66e8455fcf2063f46.tar.xz
player/command: mark video-params/crop- unavailable if empty
Diffstat (limited to 'player')
-rw-r--r--player/command.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/player/command.c b/player/command.c
index c0efeb767c..ea41ec1814 100644
--- a/player/command.c
+++ b/player/command.c
@@ -2280,6 +2280,7 @@ static int property_imgparams(struct mp_image_params p, int action, void *arg)
(desc.flags & MP_IMGFLAG_ALPHA) ? MP_ALPHA_STRAIGHT : MP_ALPHA_AUTO;
}
+ bool has_crop = mp_rect_w(p.crop) > 0 && mp_rect_h(p.crop) > 0;
const char *aspect_name = get_aspect_ratio_name(d_w / (double)d_h);
struct m_sub_property props[] = {
{"pixelformat", SUB_PROP_STR(mp_imgfmt_to_name(p.imgfmt))},
@@ -2291,10 +2292,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))},
+ {"crop-x", SUB_PROP_INT(p.crop.x0), .unavailable = !has_crop},
+ {"crop-y", SUB_PROP_INT(p.crop.y0), .unavailable = !has_crop},
+ {"crop-w", SUB_PROP_INT(mp_rect_w(p.crop)), .unavailable = !has_crop},
+ {"crop-h", SUB_PROP_INT(mp_rect_h(p.crop)), .unavailable = !has_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)},