diff options
author | wm4 <wm4@nowhere> | 2013-01-23 10:56:11 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-01-23 10:56:11 +0100 |
commit | 4c56baba4048f8a881253d4fe2f49c2715c77376 (patch) | |
tree | d75891df8cd30c404072f9b67b6da21188b79ba8 /core/m_option.h | |
parent | f2dcdca0c2dc5f904323659b65b29a2b6f00fd88 (diff) | |
download | mpv-4c56baba4048f8a881253d4fe2f49c2715c77376.tar.bz2 mpv-4c56baba4048f8a881253d4fe2f49c2715c77376.tar.xz |
options: move -geometry parsing to m_option.c
This also means the option is verified on program start, not when the VO
is created. The actual code becomes a bit more complex, because the
screen width/height is not available at program start.
The actual parsing code is still the same, with its unusual sscanf()
usage.
Diffstat (limited to 'core/m_option.h')
-rw-r--r-- | core/m_option.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/core/m_option.h b/core/m_option.h index f6c346521a..ca75d494bb 100644 --- a/core/m_option.h +++ b/core/m_option.h @@ -56,6 +56,7 @@ extern const m_option_type_t m_option_type_imgfmt; extern const m_option_type_t m_option_type_fourcc; extern const m_option_type_t m_option_type_afmt; extern const m_option_type_t m_option_type_color; +extern const m_option_type_t m_option_type_geometry; // Callback used by m_option_type_print_func options. typedef int (*m_opt_func_full_t)(const m_option_t *, const char *, const char *); @@ -77,6 +78,15 @@ struct m_color { uint8_t r, g, b, a; }; +struct m_geometry { + int x, y, w, h; + bool xy_valid : 1, wh_valid : 1; + bool x_sign : 1, y_sign : 1, x_per : 1, y_per : 1; +}; + +void m_geometry_apply(int *xpos, int *ypos, int *widw, int *widh, + int scrw, int scrh, struct m_geometry *gm); + // Extra definition needed for \ref m_option_type_obj_settings_list options. typedef struct { // Pointer to an array of pointer to some object type description struct. @@ -207,6 +217,7 @@ union m_option_value { double time; struct m_rel_time rel_time; struct m_color color; + struct m_geometry geometry; }; //////////////////////////////////////////////////////////////////////////// @@ -521,6 +532,7 @@ static inline void m_option_free(const m_option_t *opt, void *dst) #define OPT_TIME(...) OPT_GENERAL(__VA_ARGS__, .type = &m_option_type_time) #define OPT_REL_TIME(...) OPT_GENERAL(__VA_ARGS__, .type = &m_option_type_rel_time) #define OPT_COLOR(...) OPT_GENERAL(__VA_ARGS__, .type = &m_option_type_color) +#define OPT_GEOMETRY(...) OPT_GENERAL(__VA_ARGS__, .type = &m_option_type_geometry) #define OPT_TRACKCHOICE(name, var) OPT_CHOICE_OR_INT(name, var, 0, 0, 8190, ({"no", -2}, {"auto", -1})) |