From 801de5ac6d16ba87143ff42fe218558ebc37efd3 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 15 Feb 2014 16:49:28 +0100 Subject: m_property: add a mechanism to organize a list of sub-properties This automatically adds a "count" sub-property, and for each entry in the range [0, count), a numbered sub-property to access the item. --- options/m_property.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'options/m_property.h') diff --git a/options/m_property.h b/options/m_property.h index cb9f8b5a25..460f8a986c 100644 --- a/options/m_property.h +++ b/options/m_property.h @@ -167,4 +167,16 @@ struct m_sub_property { int m_property_read_sub(const struct m_sub_property *props, int action, void *arg); + +// Used with m_property_read_list(). +// Get an entry. item is the 0-based index of the item. This behaves like a +// top-level property request (but you must implement M_PROPERTY_GET_TYPE). +// item will be in range [0, count), for count see m_property_read_list() +// action, arg are for property access. +// ctx is userdata passed to m_property_read_list. +typedef int (*m_get_item_cb)(int item, int action, void *arg, void *ctx); + +int m_property_read_list(int action, void *arg, int count, + m_get_item_cb get_item, void *ctx); + #endif /* MPLAYER_M_PROPERTY_H */ -- cgit v1.2.3