summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
authornanahi <130121847+na-na-hi@users.noreply.github.com>2023-11-10 23:53:10 -0500
committerDudemanguy <random342@airmail.cc>2023-11-14 15:00:23 +0000
commit4ab4a888892192caeab64b7efbddce2c8881e095 (patch)
treec1651cbd452f8c5c5401c4ecfe0364336d1423fc /player/command.c
parentff7f105c85287c413993c4ea43a556c90e6d7dde (diff)
downloadmpv-4ab4a888892192caeab64b7efbddce2c8881e095.tar.bz2
mpv-4ab4a888892192caeab64b7efbddce2c8881e095.tar.xz
command: export storage aspect ratio (sar) properties
Display aspect ratio (aspect) and pixel aspect ratio (par) are already exported, but storage aspect ratio (sar) isn't. This value is needed to display the storage aspect ratio for non-square pixel sources in stats.lua. This exports two new properties: video-params/sar and video-params/sar-name. Docmentation is updated accordingly.
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/player/command.c b/player/command.c
index bf4b029b3e..937831107f 100644
--- a/player/command.c
+++ b/player/command.c
@@ -2299,6 +2299,7 @@ static int property_imgparams(struct mp_image_params p, int action, void *arg)
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);
+ const char *sar_name = get_aspect_ratio_name(p.w / (double)p.h);
struct m_sub_property props[] = {
{"pixelformat", SUB_PROP_STR(mp_imgfmt_to_name(p.imgfmt))},
{"hw-pixelformat", SUB_PROP_STR(mp_imgfmt_to_name(p.hw_subfmt)),
@@ -2316,6 +2317,8 @@ static int property_imgparams(struct mp_image_params p, int action, void *arg)
{"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)},
+ {"sar", SUB_PROP_FLOAT(p.w / (double)p.h)},
+ {"sar-name", SUB_PROP_STR(sar_name), .unavailable = !sar_name},
{"colormatrix",
SUB_PROP_STR(m_opt_choice_str(mp_csp_names, p.color.space))},
{"colorlevels",