提交 e007d02c 编写于 作者: P Palana

Allow property list entries to be disabled

This allows, for example, disconnected devices for dshow/avcapture to
be listed (and to stay selected in the user config) while making them
unavailable for selection in new sources
上级 ed7b37b5
......@@ -34,6 +34,7 @@ struct int_data {
struct list_item {
char *name;
bool disabled;
union {
char *str;
......@@ -525,7 +526,7 @@ void obs_property_list_clear(obs_property_t p)
static size_t add_item(struct list_data *data, const char *name,
const void *val)
{
struct list_item item;
struct list_item item = { NULL };
item.name = bstrdup(name);
if (data->format == OBS_COMBO_FORMAT_INT)
......@@ -580,6 +581,21 @@ size_t obs_property_list_item_count(obs_property_t p)
return data ? data->items.num : 0;
}
bool obs_property_list_item_disabled(obs_property_t p, size_t idx)
{
struct list_data *data = get_list_data(p);
return (data && idx < data->items.num) ?
data->items.array[idx].disabled : false;
}
void obs_property_list_item_disable(obs_property_t p, size_t idx, bool disabled)
{
struct list_data *data = get_list_data(p);
if (!data || idx >= data->items.num)
return;
data->items.array[idx].disabled = disabled;
}
const char *obs_property_list_item_name(obs_property_t p, size_t idx)
{
struct list_data *data = get_list_data(p);
......
......@@ -166,6 +166,10 @@ EXPORT size_t obs_property_list_add_int(obs_property_t p,
EXPORT size_t obs_property_list_add_float(obs_property_t p,
const char *name, double val);
EXPORT void obs_property_list_item_disable(obs_property_t p, size_t idx,
bool disabled);
EXPORT bool obs_property_list_item_disabled(obs_property_t p, size_t idx);
EXPORT void obs_property_list_remove(obs_property_t p, size_t idx);
EXPORT size_t obs_property_list_item_count(obs_property_t p);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册