diff options
Diffstat (limited to 'core/m_option.h')
-rw-r--r-- | core/m_option.h | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/core/m_option.h b/core/m_option.h index c1aac93a82..5f95232076 100644 --- a/core/m_option.h +++ b/core/m_option.h @@ -93,18 +93,30 @@ struct m_geometry { void m_geometry_apply(int *xpos, int *ypos, int *widw, int *widh, int scrw, int scrh, struct m_geometry *gm); +struct m_obj_desc { + // Name which will be used in the option string + const char *name; + // Will be printed when "help" is passed + const char *description; + // Size of the private struct + int priv_size; + // If not NULL, default values for private struct + const void *priv_defaults; + // Options which refer to members in the private struct + const struct m_option *options; + // For free use by the implementer of m_obj_list.get_desc + const void *p; +}; + // 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. - void **list; - // Offset of the object type name (char*) in the description struct. - void *name_off; - // Offset of the object type info string (char*) in the description struct. - void *info_off; - // Offset of the object type parameter description (\ref m_struct_st) - // in the description struct. - void *desc_off; -} m_obj_list_t; +struct m_obj_list { + bool (*get_desc)(struct m_obj_desc *dst, int index); + const char *description; +}; + +// Find entry by name +bool m_obj_list_find(struct m_obj_desc *dst, const struct m_obj_list *list, + bstr name); // The data type used by \ref m_option_type_obj_settings_list. typedef struct m_obj_settings { @@ -559,7 +571,10 @@ int m_option_required_params(const m_option_t *opt); #define OPT_SETTINGSLIST(optname, varname, flags, objlist) \ OPT_GENERAL(m_obj_settings_t*, optname, varname, flags, \ .type = &m_option_type_obj_settings_list, \ - .priv = objlist) + .priv = (void*)MP_EXPECT_TYPE(const struct m_obj_list*, objlist)) + +#define OPT_IMAGEFORMAT(...) \ + OPT_GENERAL(int, __VA_ARGS__, .type = &m_option_type_imgfmt) #define OPT_AUDIOFORMAT(...) \ OPT_GENERAL(int, __VA_ARGS__, .type = &m_option_type_afmt) |