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.
This commit is contained in:
nanahi 2023-11-10 23:53:10 -05:00 committed by Dudemanguy
parent ff7f105c85
commit 4ab4a88889
2 changed files with 9 additions and 0 deletions

View File

@ -2457,6 +2457,12 @@ Property list
``video-params/par``
Pixel aspect ratio.
``video-params/sar``
Storage aspect ratio.
``video-params/sar-name``
Storage aspect ratio name as string.
``video-params/colormatrix``
The colormatrix in use as string. (Exact values subject to change.)

View File

@ -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",