summaryrefslogtreecommitdiffstats
path: root/options/m_property.h
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2023-11-19 21:22:24 +0100
committerKacper Michajłow <kasper93@gmail.com>2024-03-21 03:50:11 +0100
commit8708f4dc918b1bc005149c50abb3d54d66ed3047 (patch)
treea542bb97e54ba7f6287c755ece5fe1d73bd4b910 /options/m_property.h
parentc84bb1ce67f2dd3adb974c49a66d28c0cf55d39d (diff)
downloadmpv-8708f4dc918b1bc005149c50abb3d54d66ed3047.tar.bz2
mpv-8708f4dc918b1bc005149c50abb3d54d66ed3047.tar.xz
m_property: add `>` for fixed precision floating-point expansion
This enhancement makes it easier to create constant width property expansions, useful for the `--term-status-msg`. Additionally, it changes to `%f` printing with manual zero trimming, which is easier to control than `%g`. With this method, we can directly specify precision, not just significant numbers. This approach also avoids overly high precision for values less than 1, which is not necessary for a generic floating-point print function. A new print helper function is added, which can be used with adjusted precision for specific cases where a different default is needed. This also unifies the code slightly.
Diffstat (limited to 'options/m_property.h')
-rw-r--r--options/m_property.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/options/m_property.h b/options/m_property.h
index 0dce24600c..9fa01e0ccc 100644
--- a/options/m_property.h
+++ b/options/m_property.h
@@ -48,6 +48,12 @@ enum mp_property_action {
// arg: char**
M_PROPERTY_PRINT,
+ // Get human readable fixed length string representing the current value.
+ // If unimplemented, the property wrapper uses the property type as
+ // fallback.
+ // arg: char**
+ M_PROPERTY_FIXED_LEN_PRINT,
+
// Like M_PROPERTY_GET_TYPE, but get a type that is compatible to the real
// type, but reflect practical limits, such as runtime-available values.
// This is mostly used for "UI" related things.