projects
/
platform
/
upstream
/
gstreamer.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
gstinfo: clean up function pointer names hashtable
[platform/upstream/gstreamer.git]
/
gst
/
gstchildproxy.c
diff --git
a/gst/gstchildproxy.c
b/gst/gstchildproxy.c
index
2b3c480
..
22c5d1a
100644
(file)
--- a/
gst/gstchildproxy.c
+++ b/
gst/gstchildproxy.c
@@
-15,12
+15,13
@@
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
- * Free Software Foundation, Inc., 5
9 Temple Place - Suite 330
,
- * Boston, MA 0211
1-1307
, USA.
+ * Free Software Foundation, Inc., 5
1 Franklin St, Fifth Floor
,
+ * Boston, MA 0211
0-1301
, USA.
*/
/**
* SECTION:gstchildproxy
*/
/**
* SECTION:gstchildproxy
+ * @title: GstChildProxy
* @short_description: Interface for multi child elements.
* @see_also: #GstBin
*
* @short_description: Interface for multi child elements.
* @see_also: #GstBin
*
@@
-100,7
+101,7
@@
gst_child_proxy_default_get_child_by_name (GstChildProxy * parent,
/**
* gst_child_proxy_get_child_by_name:
* @parent: the parent object to get the child from
/**
* gst_child_proxy_get_child_by_name:
* @parent: the parent object to get the child from
- * @name: the childs name
+ * @name: the child
'
s name
*
* Looks up a child element by the given name.
*
*
* Looks up a child element by the given name.
*
@@
-108,39
+109,51
@@
gst_child_proxy_default_get_child_by_name (GstChildProxy * parent,
* together with gst_object_get_name(). If the interface is to be used with
* #GObjects, this methods needs to be overridden.
*
* together with gst_object_get_name(). If the interface is to be used with
* #GObjects, this methods needs to be overridden.
*
- * Returns: (transfer full)
: the child object or %NULL if not found. Unre
f
- * after usage.
+ * Returns: (transfer full)
(nullable): the child object or %NULL i
f
+ *
not found. Unref
after usage.
*
* MT safe.
*/
GObject *
gst_child_proxy_get_child_by_name (GstChildProxy * parent, const gchar * name)
{
*
* MT safe.
*/
GObject *
gst_child_proxy_get_child_by_name (GstChildProxy * parent, const gchar * name)
{
+ GstChildProxyInterface *iface;
+
g_return_val_if_fail (GST_IS_CHILD_PROXY (parent), 0);
g_return_val_if_fail (GST_IS_CHILD_PROXY (parent), 0);
- return (GST_CHILD_PROXY_GET_INTERFACE (parent)->get_child_by_name (parent,
- name));
+ iface = GST_CHILD_PROXY_GET_INTERFACE (parent);
+
+ if (iface->get_child_by_name != NULL)
+ return iface->get_child_by_name (parent, name);
+
+ return NULL;
}
/**
* gst_child_proxy_get_child_by_index:
* @parent: the parent object to get the child from
}
/**
* gst_child_proxy_get_child_by_index:
* @parent: the parent object to get the child from
- * @index: the childs position in the child list
+ * @index: the child
'
s position in the child list
*
* Fetches a child by its number.
*
*
* Fetches a child by its number.
*
- * Returns: (transfer full)
: the child object or %NULL if not found (index
- * too high). Unref after usage.
+ * Returns: (transfer full)
(nullable): the child object or %NULL if
+ *
not found (index
too high). Unref after usage.
*
* MT safe.
*/
GObject *
gst_child_proxy_get_child_by_index (GstChildProxy * parent, guint index)
{
*
* MT safe.
*/
GObject *
gst_child_proxy_get_child_by_index (GstChildProxy * parent, guint index)
{
+ GstChildProxyInterface *iface;
+
g_return_val_if_fail (GST_IS_CHILD_PROXY (parent), NULL);
g_return_val_if_fail (GST_IS_CHILD_PROXY (parent), NULL);
- return (GST_CHILD_PROXY_GET_INTERFACE (parent)->get_child_by_index (parent,
- index));
+ iface = GST_CHILD_PROXY_GET_INTERFACE (parent);
+
+ if (iface->get_child_by_index != NULL)
+ return iface->get_child_by_index (parent, index);
+
+ return NULL;
}
/**
}
/**
@@
-156,76
+169,87
@@
gst_child_proxy_get_child_by_index (GstChildProxy * parent, guint index)
guint
gst_child_proxy_get_children_count (GstChildProxy * parent)
{
guint
gst_child_proxy_get_children_count (GstChildProxy * parent)
{
+ GstChildProxyInterface *iface;
+
g_return_val_if_fail (GST_IS_CHILD_PROXY (parent), 0);
g_return_val_if_fail (GST_IS_CHILD_PROXY (parent), 0);
- return (GST_CHILD_PROXY_GET_INTERFACE (parent)->get_children_count (parent));
+ iface = GST_CHILD_PROXY_GET_INTERFACE (parent);
+
+ if (iface->get_children_count != NULL)
+ return iface->get_children_count (parent);
+
+ return 0;
}
/**
* gst_child_proxy_lookup:
}
/**
* gst_child_proxy_lookup:
- * @object: object to lookup the property in
+ * @object:
child proxy
object to lookup the property in
* @name: name of the property to look up
* @target: (out) (allow-none) (transfer full): pointer to a #GObject that
* takes the real object to set property on
* @name: name of the property to look up
* @target: (out) (allow-none) (transfer full): pointer to a #GObject that
* takes the real object to set property on
- * @pspec: (out) (allow-none) (transfer
full
): pointer to take the #GParamSpec
+ * @pspec: (out) (allow-none) (transfer
none
): pointer to take the #GParamSpec
* describing the property
*
* Looks up which object and #GParamSpec would be effected by the given @name.
*
* describing the property
*
* Looks up which object and #GParamSpec would be effected by the given @name.
*
- * Returns: TRUE if @target and @pspec could be found. FALSE otherwise. In that
- * case the values for @pspec and @target are not modified. Unref @target after
- * usage.
- *
* MT safe.
* MT safe.
+ *
+ * Returns: %TRUE if @target and @pspec could be found. %FALSE otherwise. In that
+ * case the values for @pspec and @target are not modified. Unref @target after
+ * usage. For plain GObjects @target is the same as @object.
*/
gboolean
*/
gboolean
-gst_child_proxy_lookup (G
Object
* object, const gchar * name,
+gst_child_proxy_lookup (G
stChildProxy
* object, const gchar * name,
GObject ** target, GParamSpec ** pspec)
{
GObject ** target, GParamSpec ** pspec)
{
+ GObject *obj;
gboolean res = FALSE;
gchar **names, **current;
gboolean res = FALSE;
gchar **names, **current;
- g_return_val_if_fail (GST_IS_
OBJECT
(object), FALSE);
+ g_return_val_if_fail (GST_IS_
CHILD_PROXY
(object), FALSE);
g_return_val_if_fail (name != NULL, FALSE);
g_return_val_if_fail (name != NULL, FALSE);
-
gst_object_ref (object
);
+
obj = G_OBJECT (g_object_ref (object)
);
current = names = g_strsplit (name, "::", -1);
current = names = g_strsplit (name, "::", -1);
+ /* find the owner of the property */
while (current[1]) {
GObject *next;
while (current[1]) {
GObject *next;
- if (!GST_IS_CHILD_PROXY (obj
ect
)) {
+ if (!GST_IS_CHILD_PROXY (obj)) {
GST_INFO
("object %s is not a parent, so you cannot request a child by name %s",
GST_INFO
("object %s is not a parent, so you cannot request a child by name %s",
-
GST_OBJECT_NAME (object
), current[0]);
+
(GST_IS_OBJECT (obj) ? GST_OBJECT_NAME (obj) : ""
), current[0]);
break;
}
break;
}
- next = gst_child_proxy_get_child_by_name (GST_CHILD_PROXY (obj
ect
),
+ next = gst_child_proxy_get_child_by_name (GST_CHILD_PROXY (obj),
current[0]);
if (!next) {
GST_INFO ("no such object %s", current[0]);
break;
}
current[0]);
if (!next) {
GST_INFO ("no such object %s", current[0]);
break;
}
- g
st_object_unref (object
);
- obj
ect
= next;
+ g
_object_unref (obj
);
+ obj = next;
current++;
}
current++;
}
+
+ /* look for psec */
if (current[1] == NULL) {
GParamSpec *spec =
if (current[1] == NULL) {
GParamSpec *spec =
- g_object_class_find_property (G_OBJECT_GET_CLASS (obj
ect
), current[0]);
+ g_object_class_find_property (G_OBJECT_GET_CLASS (obj), current[0]);
if (spec == NULL) {
GST_INFO ("no param spec named %s", current[0]);
} else {
if (pspec)
*pspec = spec;
if (target) {
if (spec == NULL) {
GST_INFO ("no param spec named %s", current[0]);
} else {
if (pspec)
*pspec = spec;
if (target) {
- g
st_object_ref (object
);
- *target = obj
ect
;
+ g
_object_ref (obj
);
+ *target = obj;
}
res = TRUE;
}
}
}
res = TRUE;
}
}
- g
st_object_unref (object
);
+ g
_object_unref (obj
);
g_strfreev (names);
return res;
}
g_strfreev (names);
return res;
}
@@
-240,27
+264,28
@@
gst_child_proxy_lookup (GObject * object, const gchar * name,
* You are responsible for freeing it by calling g_value_unset()
*/
void
* You are responsible for freeing it by calling g_value_unset()
*/
void
-gst_child_proxy_get_property (G
Object
* object, const gchar * name,
+gst_child_proxy_get_property (G
stChildProxy
* object, const gchar * name,
GValue * value)
{
GParamSpec *pspec;
GObject *target;
GValue * value)
{
GParamSpec *pspec;
GObject *target;
- g_return_if_fail (GST_IS_
OBJECT
(object));
+ g_return_if_fail (GST_IS_
CHILD_PROXY
(object));
g_return_if_fail (name != NULL);
g_return_if_fail (G_IS_VALUE (value));
if (!gst_child_proxy_lookup (object, name, &target, &pspec))
goto not_found;
g_return_if_fail (name != NULL);
g_return_if_fail (G_IS_VALUE (value));
if (!gst_child_proxy_lookup (object, name, &target, &pspec))
goto not_found;
- g_object_get_property (
G_OBJECT (target)
, pspec->name, value);
- g
st
_object_unref (target);
+ g_object_get_property (
target
, pspec->name, value);
+ g_object_unref (target);
return;
not_found:
{
return;
not_found:
{
- g_warning ("no property %s in object %s", name, GST_OBJECT_NAME (object));
+ g_warning ("no property %s in object %s", name,
+ (GST_IS_OBJECT (object) ? GST_OBJECT_NAME (object) : ""));
return;
}
}
return;
}
}
@@
-269,12
+294,12
@@
not_found:
* gst_child_proxy_get_valist:
* @object: the object to query
* @first_property_name: name of the first property to get
* gst_child_proxy_get_valist:
* @object: the object to query
* @first_property_name: name of the first property to get
- * @var_args: return location for the first property, followed optionally by more name/return location pairs, followed by NULL
+ * @var_args: return location for the first property, followed optionally by more name/return location pairs, followed by
%
NULL
*
* Gets properties of the parent object and its children.
*/
void
*
* Gets properties of the parent object and its children.
*/
void
-gst_child_proxy_get_valist (G
Object
* object,
+gst_child_proxy_get_valist (G
stChildProxy
* object,
const gchar * first_property_name, va_list var_args)
{
const gchar *name;
const gchar * first_property_name, va_list var_args)
{
const gchar *name;
@@
-283,7
+308,7
@@
gst_child_proxy_get_valist (GObject * object,
GParamSpec *pspec;
GObject *target;
GParamSpec *pspec;
GObject *target;
- g_return_if_fail (G
_IS_OBJECT
(object));
+ g_return_if_fail (G
ST_IS_CHILD_PROXY
(object));
name = first_property_name;
name = first_property_name;
@@
-293,8
+318,8
@@
gst_child_proxy_get_valist (GObject * object,
goto not_found;
g_value_init (&value, pspec->value_type);
goto not_found;
g_value_init (&value, pspec->value_type);
- g_object_get_property (
G_OBJECT (target)
, pspec->name, &value);
- g
st
_object_unref (target);
+ g_object_get_property (
target
, pspec->name, &value);
+ g_object_unref (target);
G_VALUE_LCOPY (&value, var_args, 0, &error);
if (error)
G_VALUE_LCOPY (&value, var_args, 0, &error);
if (error)
@@
-306,13
+331,14
@@
gst_child_proxy_get_valist (GObject * object,
not_found:
{
not_found:
{
- g_warning ("no property %s in object %s", name, GST_OBJECT_NAME (object));
+ g_warning ("no property %s in object %s", name,
+ (GST_IS_OBJECT (object) ? GST_OBJECT_NAME (object) : ""));
return;
}
cant_copy:
{
g_warning ("error copying value %s in object %s: %s", pspec->name,
return;
}
cant_copy:
{
g_warning ("error copying value %s in object %s: %s", pspec->name,
-
GST_OBJECT_NAME (object
), error);
+
(GST_IS_OBJECT (object) ? GST_OBJECT_NAME (object) : ""
), error);
g_value_unset (&value);
return;
}
g_value_unset (&value);
return;
}
@@
-322,16
+348,17
@@
cant_copy:
* gst_child_proxy_get:
* @object: the parent object
* @first_property_name: name of the first property to get
* gst_child_proxy_get:
* @object: the parent object
* @first_property_name: name of the first property to get
- * @...: return location for the first property, followed optionally by more name/return location pairs, followed by NULL
+ * @...: return location for the first property, followed optionally by more name/return location pairs, followed by
%
NULL
*
* Gets properties of the parent object and its children.
*/
void
*
* Gets properties of the parent object and its children.
*/
void
-gst_child_proxy_get (GObject * object, const gchar * first_property_name, ...)
+gst_child_proxy_get (GstChildProxy * object, const gchar * first_property_name,
+ ...)
{
va_list var_args;
{
va_list var_args;
- g_return_if_fail (GST_IS_
OBJECT
(object));
+ g_return_if_fail (GST_IS_
CHILD_PROXY
(object));
va_start (var_args, first_property_name);
gst_child_proxy_get_valist (object, first_property_name, var_args);
va_start (var_args, first_property_name);
gst_child_proxy_get_valist (object, first_property_name, var_args);
@@
-347,27
+374,27
@@
gst_child_proxy_get (GObject * object, const gchar * first_property_name, ...)
* Sets a single property using the GstChildProxy mechanism.
*/
void
* Sets a single property using the GstChildProxy mechanism.
*/
void
-gst_child_proxy_set_property (G
Object
* object, const gchar * name,
+gst_child_proxy_set_property (G
stChildProxy
* object, const gchar * name,
const GValue * value)
{
GParamSpec *pspec;
GObject *target;
const GValue * value)
{
GParamSpec *pspec;
GObject *target;
- g_return_if_fail (GST_IS_
OBJECT
(object));
+ g_return_if_fail (GST_IS_
CHILD_PROXY
(object));
g_return_if_fail (name != NULL);
g_return_if_fail (G_IS_VALUE (value));
if (!gst_child_proxy_lookup (object, name, &target, &pspec))
goto not_found;
g_return_if_fail (name != NULL);
g_return_if_fail (G_IS_VALUE (value));
if (!gst_child_proxy_lookup (object, name, &target, &pspec))
goto not_found;
- g_object_set_property (
G_OBJECT (target)
, pspec->name, value);
- g
st
_object_unref (target);
+ g_object_set_property (
target
, pspec->name, value);
+ g_object_unref (target);
return;
not_found:
{
g_warning ("cannot set property %s on object %s", name,
return;
not_found:
{
g_warning ("cannot set property %s on object %s", name,
-
GST_OBJECT_NAME (object
));
+
(GST_IS_OBJECT (object) ? GST_OBJECT_NAME (object) : ""
));
return;
}
}
return;
}
}
@@
-376,12
+403,12
@@
not_found:
* gst_child_proxy_set_valist:
* @object: the parent object
* @first_property_name: name of the first property to set
* gst_child_proxy_set_valist:
* @object: the parent object
* @first_property_name: name of the first property to set
- * @var_args: value for the first property, followed optionally by more name/value pairs, followed by NULL
+ * @var_args: value for the first property, followed optionally by more name/value pairs, followed by
%
NULL
*
* Sets properties of the parent object and its children.
*/
void
*
* Sets properties of the parent object and its children.
*/
void
-gst_child_proxy_set_valist (G
Object
* object,
+gst_child_proxy_set_valist (G
stChildProxy
* object,
const gchar * first_property_name, va_list var_args)
{
const gchar *name;
const gchar * first_property_name, va_list var_args)
{
const gchar *name;
@@
-390,7
+417,7
@@
gst_child_proxy_set_valist (GObject * object,
GParamSpec *pspec;
GObject *target;
GParamSpec *pspec;
GObject *target;
- g_return_if_fail (G
_IS_OBJECT
(object));
+ g_return_if_fail (G
ST_IS_CHILD_PROXY
(object));
name = first_property_name;
name = first_property_name;
@@
-405,8
+432,8
@@
gst_child_proxy_set_valist (GObject * object,
if (error)
goto cant_copy;
if (error)
goto cant_copy;
- g_object_set_property (
G_OBJECT (target)
, pspec->name, &value);
- g
st
_object_unref (target);
+ g_object_set_property (
target
, pspec->name, &value);
+ g_object_unref (target);
g_value_unset (&value);
name = va_arg (var_args, gchar *);
g_value_unset (&value);
name = va_arg (var_args, gchar *);
@@
-415,15
+442,17
@@
gst_child_proxy_set_valist (GObject * object,
not_found:
{
not_found:
{
- g_warning ("no property %s in object %s", name, GST_OBJECT_NAME (object));
+ g_warning ("no property %s in object %s", name,
+ (GST_IS_OBJECT (object) ? GST_OBJECT_NAME (object) : ""));
return;
}
cant_copy:
{
g_warning ("error copying value %s in object %s: %s", pspec->name,
return;
}
cant_copy:
{
g_warning ("error copying value %s in object %s: %s", pspec->name,
-
GST_OBJECT_NAME (object
), error);
+
(GST_IS_OBJECT (object) ? GST_OBJECT_NAME (object) : ""
), error);
g_value_unset (&value);
g_value_unset (&value);
- gst_object_unref (target);
+ g_object_unref (target);
+ g_free (error);
return;
}
}
return;
}
}
@@
-432,16
+461,17
@@
cant_copy:
* gst_child_proxy_set:
* @object: the parent object
* @first_property_name: name of the first property to set
* gst_child_proxy_set:
* @object: the parent object
* @first_property_name: name of the first property to set
- * @...: value for the first property, followed optionally by more name/value pairs, followed by NULL
+ * @...: value for the first property, followed optionally by more name/value pairs, followed by
%
NULL
*
* Sets properties of the parent object and its children.
*/
void
*
* Sets properties of the parent object and its children.
*/
void
-gst_child_proxy_set (GObject * object, const gchar * first_property_name, ...)
+gst_child_proxy_set (GstChildProxy * object, const gchar * first_property_name,
+ ...)
{
va_list var_args;
{
va_list var_args;
- g_return_if_fail (GST_IS_
OBJECT
(object));
+ g_return_if_fail (GST_IS_
CHILD_PROXY
(object));
va_start (var_args, first_property_name);
gst_child_proxy_set_valist (object, first_property_name, var_args);
va_start (var_args, first_property_name);
gst_child_proxy_set_valist (object, first_property_name, var_args);
@@
-450,32
+480,32
@@
gst_child_proxy_set (GObject * object, const gchar * first_property_name, ...)
/**
* gst_child_proxy_child_added:
/**
* gst_child_proxy_child_added:
- * @
objec
t: the parent object
+ * @
paren
t: the parent object
* @child: the newly added child
* @name: the name of the new child
*
* Emits the "child-added" signal.
*/
void
* @child: the newly added child
* @name: the name of the new child
*
* Emits the "child-added" signal.
*/
void
-gst_child_proxy_child_added (G
Object * objec
t, GObject * child,
+gst_child_proxy_child_added (G
stChildProxy * paren
t, GObject * child,
const gchar * name)
{
const gchar * name)
{
- g_signal_emit (
G_OBJECT (object)
, signals[CHILD_ADDED], 0, child, name);
+ g_signal_emit (
parent
, signals[CHILD_ADDED], 0, child, name);
}
/**
* gst_child_proxy_child_removed:
}
/**
* gst_child_proxy_child_removed:
- * @
objec
t: the parent object
+ * @
paren
t: the parent object
* @child: the removed child
* @name: the name of the old child
*
* Emits the "child-removed" signal.
*/
void
* @child: the removed child
* @name: the name of the old child
*
* Emits the "child-removed" signal.
*/
void
-gst_child_proxy_child_removed (G
Object * objec
t, GObject * child,
+gst_child_proxy_child_removed (G
stChildProxy * paren
t, GObject * child,
const gchar * name)
{
const gchar * name)
{
- g_signal_emit (
G_OBJECT (object)
, signals[CHILD_REMOVED], 0, child, name);
+ g_signal_emit (
parent
, signals[CHILD_REMOVED], 0, child, name);
}
/* gobject methods */
}
/* gobject methods */
@@
-549,7
+579,7
@@
gst_child_proxy_get_type (void)
_type =
g_type_register_static (G_TYPE_INTERFACE, "GstChildProxy", &info, 0);
_type =
g_type_register_static (G_TYPE_INTERFACE, "GstChildProxy", &info, 0);
- g_type_interface_add_prerequisite (_type, G
ST
_TYPE_OBJECT);
+ g_type_interface_add_prerequisite (_type, G_TYPE_OBJECT);
g_once_init_leave (&type, (gsize) _type);
}
return type;
g_once_init_leave (&type, (gsize) _type);
}
return type;