mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-02 14:36:41 +00:00
childproxy: make gst_child_proxy_lookup() a proper GstChildProxy method
No longer accept any old GObjects. This makes things nicer for bindings. If a utility function that handles both nicely is deemed worthwhile, we can still add one to gstutils. https://bugzilla.gnome.org/show_bug.cgi?id=681681
This commit is contained in:
parent
718a10edda
commit
ffa60dc3ee
2 changed files with 12 additions and 11 deletions
|
@ -163,7 +163,7 @@ gst_child_proxy_get_children_count (GstChildProxy * parent)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_child_proxy_lookup:
|
* gst_child_proxy_lookup:
|
||||||
* @object: object to lookup the property in
|
* @childproxy: child proxy object to lookup the property in
|
||||||
* @name: name of the property to look up
|
* @name: name of the property to look up
|
||||||
* @target: (out) (allow-none) (transfer full): pointer to a #GObject that
|
* @target: (out) (allow-none) (transfer full): pointer to a #GObject that
|
||||||
* takes the real object to set property on
|
* takes the real object to set property on
|
||||||
|
@ -179,19 +179,20 @@ gst_child_proxy_get_children_count (GstChildProxy * parent)
|
||||||
* usage. For plain GObjects @target is the same as @object.
|
* usage. For plain GObjects @target is the same as @object.
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
gst_child_proxy_lookup (GObject * object, const gchar * name,
|
gst_child_proxy_lookup (GstChildProxy * childproxy, const gchar * name,
|
||||||
GObject ** target, GParamSpec ** pspec)
|
GObject ** target, GParamSpec ** pspec)
|
||||||
{
|
{
|
||||||
|
GObject *object;
|
||||||
gboolean res = FALSE;
|
gboolean res = FALSE;
|
||||||
gchar **names, **current;
|
gchar **names, **current;
|
||||||
|
|
||||||
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
|
g_return_val_if_fail (GST_IS_CHILD_PROXY (childproxy), FALSE);
|
||||||
g_return_val_if_fail (name != NULL, FALSE);
|
g_return_val_if_fail (name != NULL, FALSE);
|
||||||
|
|
||||||
g_object_ref (object);
|
object = g_object_ref (childproxy);
|
||||||
|
|
||||||
current = names = g_strsplit (name, "::", -1);
|
current = names = g_strsplit (name, "::", -1);
|
||||||
// find the owner of the property
|
/* find the owner of the property */
|
||||||
while (current[1]) {
|
while (current[1]) {
|
||||||
GObject *next;
|
GObject *next;
|
||||||
|
|
||||||
|
@ -212,7 +213,7 @@ gst_child_proxy_lookup (GObject * object, const gchar * name,
|
||||||
current++;
|
current++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// look for psec
|
/* look for psec */
|
||||||
if (current[1] == NULL) {
|
if (current[1] == NULL) {
|
||||||
GParamSpec *spec =
|
GParamSpec *spec =
|
||||||
g_object_class_find_property (G_OBJECT_GET_CLASS (object), current[0]);
|
g_object_class_find_property (G_OBJECT_GET_CLASS (object), current[0]);
|
||||||
|
@ -253,7 +254,7 @@ gst_child_proxy_get_property (GstChildProxy * object, const gchar * name,
|
||||||
g_return_if_fail (name != NULL);
|
g_return_if_fail (name != NULL);
|
||||||
g_return_if_fail (G_IS_VALUE (value));
|
g_return_if_fail (G_IS_VALUE (value));
|
||||||
|
|
||||||
if (!gst_child_proxy_lookup ((GObject *) object, name, &target, &pspec))
|
if (!gst_child_proxy_lookup (object, name, &target, &pspec))
|
||||||
goto not_found;
|
goto not_found;
|
||||||
|
|
||||||
g_object_get_property (target, pspec->name, value);
|
g_object_get_property (target, pspec->name, value);
|
||||||
|
@ -293,7 +294,7 @@ gst_child_proxy_get_valist (GstChildProxy * object,
|
||||||
|
|
||||||
/* iterate over pairs */
|
/* iterate over pairs */
|
||||||
while (name) {
|
while (name) {
|
||||||
if (!gst_child_proxy_lookup ((GObject *) object, name, &target, &pspec))
|
if (!gst_child_proxy_lookup (object, name, &target, &pspec))
|
||||||
goto not_found;
|
goto not_found;
|
||||||
|
|
||||||
g_value_init (&value, pspec->value_type);
|
g_value_init (&value, pspec->value_type);
|
||||||
|
@ -363,7 +364,7 @@ gst_child_proxy_set_property (GstChildProxy * object, const gchar * name,
|
||||||
g_return_if_fail (name != NULL);
|
g_return_if_fail (name != NULL);
|
||||||
g_return_if_fail (G_IS_VALUE (value));
|
g_return_if_fail (G_IS_VALUE (value));
|
||||||
|
|
||||||
if (!gst_child_proxy_lookup ((GObject *) object, name, &target, &pspec))
|
if (!gst_child_proxy_lookup (object, name, &target, &pspec))
|
||||||
goto not_found;
|
goto not_found;
|
||||||
|
|
||||||
g_object_set_property (target, pspec->name, value);
|
g_object_set_property (target, pspec->name, value);
|
||||||
|
@ -402,7 +403,7 @@ gst_child_proxy_set_valist (GstChildProxy * object,
|
||||||
|
|
||||||
/* iterate over pairs */
|
/* iterate over pairs */
|
||||||
while (name) {
|
while (name) {
|
||||||
if (!gst_child_proxy_lookup ((GObject *) object, name, &target, &pspec))
|
if (!gst_child_proxy_lookup (object, name, &target, &pspec))
|
||||||
goto not_found;
|
goto not_found;
|
||||||
|
|
||||||
G_VALUE_COLLECT_INIT (&value, pspec->value_type, var_args,
|
G_VALUE_COLLECT_INIT (&value, pspec->value_type, var_args,
|
||||||
|
|
|
@ -74,7 +74,7 @@ GObject * gst_child_proxy_get_child_by_name (GstChildProxy * parent, const gcha
|
||||||
guint gst_child_proxy_get_children_count (GstChildProxy * parent);
|
guint gst_child_proxy_get_children_count (GstChildProxy * parent);
|
||||||
GObject * gst_child_proxy_get_child_by_index (GstChildProxy * parent, guint index);
|
GObject * gst_child_proxy_get_child_by_index (GstChildProxy * parent, guint index);
|
||||||
|
|
||||||
gboolean gst_child_proxy_lookup (GObject *object, const gchar *name,
|
gboolean gst_child_proxy_lookup (GstChildProxy *object, const gchar *name,
|
||||||
GObject **target, GParamSpec **pspec);
|
GObject **target, GParamSpec **pspec);
|
||||||
|
|
||||||
void gst_child_proxy_get_property (GstChildProxy * object, const gchar *name,
|
void gst_child_proxy_get_property (GstChildProxy * object, const gchar *name,
|
||||||
|
|
Loading…
Reference in a new issue