mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 11:45:25 +00:00
Added some more useful functions to create props
Original commit message from CVS: Added some more useful functions to create props
This commit is contained in:
parent
4cebbc6821
commit
c78119cf6e
2 changed files with 64 additions and 9 deletions
|
@ -274,8 +274,15 @@ gst_props_entry_destroy (GstPropsEntry *entry)
|
||||||
g_mutex_unlock (_gst_props_entries_chunk_lock);
|
g_mutex_unlock (_gst_props_entries_chunk_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstProps*
|
/**
|
||||||
gst_props_alloc (void)
|
* gst_props_empty_new:
|
||||||
|
*
|
||||||
|
* Create a new empty property.
|
||||||
|
*
|
||||||
|
* Returns: the new property
|
||||||
|
*/
|
||||||
|
GstProps*
|
||||||
|
gst_props_empty_new (void)
|
||||||
{
|
{
|
||||||
GstProps *props;
|
GstProps *props;
|
||||||
|
|
||||||
|
@ -290,7 +297,14 @@ gst_props_alloc (void)
|
||||||
return props;
|
return props;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
/**
|
||||||
|
* gst_props_add_entry:
|
||||||
|
* @props: the property to add the entry to
|
||||||
|
* @entry: the entry to add
|
||||||
|
*
|
||||||
|
* Addes the given propsentry to the props
|
||||||
|
*/
|
||||||
|
void
|
||||||
gst_props_add_entry (GstProps *props, GstPropsEntry *entry)
|
gst_props_add_entry (GstProps *props, GstPropsEntry *entry)
|
||||||
{
|
{
|
||||||
g_return_if_fail (props);
|
g_return_if_fail (props);
|
||||||
|
@ -455,6 +469,40 @@ gst_props_add_to_int_list (GList * entries, GstPropsEntry * newentry)
|
||||||
return g_list_prepend (entries, newentry);
|
return g_list_prepend (entries, newentry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GstPropsEntry*
|
||||||
|
gst_props_entry_newv (const gchar *name, va_list var_args)
|
||||||
|
{
|
||||||
|
GstPropsEntry *entry;
|
||||||
|
|
||||||
|
entry = gst_props_alloc_entry ();
|
||||||
|
entry->propid = g_quark_from_string (name);
|
||||||
|
GST_PROPS_ENTRY_FILL (entry, var_args);
|
||||||
|
|
||||||
|
return entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_props_entry_new:
|
||||||
|
* @name: the name of the props entry
|
||||||
|
* @...: the value of the entry
|
||||||
|
*
|
||||||
|
* Create a new property entry with the given key/value.
|
||||||
|
*
|
||||||
|
* Returns: the new entry.
|
||||||
|
*/
|
||||||
|
GstPropsEntry*
|
||||||
|
gst_props_entry_new (const gchar *name, ...)
|
||||||
|
{
|
||||||
|
va_list var_args;
|
||||||
|
GstPropsEntry *entry;
|
||||||
|
|
||||||
|
va_start (var_args, name);
|
||||||
|
entry = gst_props_entry_newv (name, var_args);
|
||||||
|
va_end (var_args);
|
||||||
|
|
||||||
|
return entry;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_props_newv:
|
* gst_props_newv:
|
||||||
* @firstname: the first property name
|
* @firstname: the first property name
|
||||||
|
@ -487,7 +535,7 @@ gst_props_newv (const gchar *firstname, va_list var_args)
|
||||||
if (firstname == NULL)
|
if (firstname == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
props = gst_props_alloc ();
|
props = gst_props_empty_new ();
|
||||||
|
|
||||||
prop_name = firstname;
|
prop_name = firstname;
|
||||||
|
|
||||||
|
@ -599,6 +647,8 @@ gst_props_set (GstProps *props, const gchar *name, ...)
|
||||||
GQuark quark;
|
GQuark quark;
|
||||||
GList *lentry;
|
GList *lentry;
|
||||||
va_list var_args;
|
va_list var_args;
|
||||||
|
|
||||||
|
g_return_val_if_fail (props != NULL, NULL);
|
||||||
|
|
||||||
quark = g_quark_from_string (name);
|
quark = g_quark_from_string (name);
|
||||||
|
|
||||||
|
@ -622,6 +672,7 @@ gst_props_set (GstProps *props, const gchar *name, ...)
|
||||||
return props;
|
return props;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_props_unref:
|
* gst_props_unref:
|
||||||
* @props: the props to unref
|
* @props: the props to unref
|
||||||
|
@ -738,7 +789,7 @@ gst_props_copy (GstProps *props)
|
||||||
if (props == NULL)
|
if (props == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
new = gst_props_alloc ();
|
new = gst_props_empty_new ();
|
||||||
new->properties = gst_props_list_copy (props->properties);
|
new->properties = gst_props_list_copy (props->properties);
|
||||||
new->fixed = props->fixed;
|
new->fixed = props->fixed;
|
||||||
|
|
||||||
|
@ -1575,7 +1626,7 @@ gst_props_intersect (GstProps *props1, GstProps *props2)
|
||||||
GList *leftovers;
|
GList *leftovers;
|
||||||
GstPropsEntry *iprops = NULL;
|
GstPropsEntry *iprops = NULL;
|
||||||
|
|
||||||
intersection = gst_props_alloc ();
|
intersection = gst_props_empty_new ();
|
||||||
intersection->fixed = TRUE;
|
intersection->fixed = TRUE;
|
||||||
|
|
||||||
g_return_val_if_fail (props1 != NULL, NULL);
|
g_return_val_if_fail (props1 != NULL, NULL);
|
||||||
|
@ -1697,7 +1748,7 @@ gst_props_normalize (GstProps *props)
|
||||||
GstProps *newprops;
|
GstProps *newprops;
|
||||||
GList *lentry;
|
GList *lentry;
|
||||||
|
|
||||||
newprops = gst_props_alloc ();
|
newprops = gst_props_empty_new ();
|
||||||
newprops->properties = gst_props_list_copy (props->properties);
|
newprops->properties = gst_props_list_copy (props->properties);
|
||||||
lentry = g_list_find_custom (newprops->properties, GINT_TO_POINTER (list_entry->propid), props_find_func);
|
lentry = g_list_find_custom (newprops->properties, GINT_TO_POINTER (list_entry->propid), props_find_func);
|
||||||
if (lentry) {
|
if (lentry) {
|
||||||
|
@ -1940,7 +1991,7 @@ gst_props_load_thyself (xmlNodePtr parent)
|
||||||
xmlNodePtr field = parent->xmlChildrenNode;
|
xmlNodePtr field = parent->xmlChildrenNode;
|
||||||
gchar *prop;
|
gchar *prop;
|
||||||
|
|
||||||
props = gst_props_alloc ();
|
props = gst_props_empty_new ();
|
||||||
|
|
||||||
while (field) {
|
while (field) {
|
||||||
if (!strcmp (field->name, "list")) {
|
if (!strcmp (field->name, "list")) {
|
||||||
|
|
|
@ -87,6 +87,7 @@ void _gst_props_initialize (void);
|
||||||
|
|
||||||
GstProps* gst_props_new (const gchar *firstname, ...);
|
GstProps* gst_props_new (const gchar *firstname, ...);
|
||||||
GstProps* gst_props_newv (const gchar *firstname, va_list var_args);
|
GstProps* gst_props_newv (const gchar *firstname, va_list var_args);
|
||||||
|
GstProps* gst_props_empty_new (void);
|
||||||
|
|
||||||
void gst_props_unref (GstProps *props);
|
void gst_props_unref (GstProps *props);
|
||||||
void gst_props_ref (GstProps *props);
|
void gst_props_ref (GstProps *props);
|
||||||
|
@ -110,9 +111,12 @@ gboolean gst_props_has_property (GstProps *props, const gchar *name);
|
||||||
gboolean gst_props_has_property_typed (GstProps *props, const gchar *name, GstPropsType type);
|
gboolean gst_props_has_property_typed (GstProps *props, const gchar *name, GstPropsType type);
|
||||||
gboolean gst_props_has_fixed_property (GstProps *props, const gchar *name);
|
gboolean gst_props_has_fixed_property (GstProps *props, const gchar *name);
|
||||||
|
|
||||||
|
const GstPropsEntry* gst_props_get_entry (GstProps *props, const gchar *name);
|
||||||
|
void gst_props_add_entry (GstProps *props, GstPropsEntry *entry);
|
||||||
|
|
||||||
/* working with props entries */
|
/* working with props entries */
|
||||||
const GstPropsEntry* gst_props_get_entry (GstProps *props, const gchar *name);
|
GstPropsEntry* gst_props_entry_new (const gchar *name, ...);
|
||||||
|
|
||||||
GstPropsType gst_props_entry_get_type (const GstPropsEntry *entry);
|
GstPropsType gst_props_entry_get_type (const GstPropsEntry *entry);
|
||||||
const gchar* gst_props_entry_get_name (const GstPropsEntry *entry);
|
const gchar* gst_props_entry_get_name (const GstPropsEntry *entry);
|
||||||
gboolean gst_props_entry_is_fixed (const GstPropsEntry *entry);
|
gboolean gst_props_entry_is_fixed (const GstPropsEntry *entry);
|
||||||
|
|
Loading…
Reference in a new issue