bin: Switch g_warning()
s to GST_WARNING_OBJECT()
s when adding/removing an element to a bin fails
The failure conditions can be overidden by subclasses, and a boolean return value is provided to the caller whether adding/removing the child element has actually worked. The caller can then handle this accordingly but flooding stderr with this is not very useful. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1320>
This commit is contained in:
parent
5ac1a12927
commit
ddfd778c19
@ -1390,9 +1390,9 @@ adding_itself:
|
|||||||
}
|
}
|
||||||
duplicate_name:
|
duplicate_name:
|
||||||
{
|
{
|
||||||
g_warning ("Name '%s' is not unique in bin '%s', not adding",
|
|
||||||
elem_name, GST_ELEMENT_NAME (bin));
|
|
||||||
GST_OBJECT_UNLOCK (bin);
|
GST_OBJECT_UNLOCK (bin);
|
||||||
|
GST_WARNING_OBJECT (bin, "Name '%s' is not unique in bin, not adding",
|
||||||
|
elem_name);
|
||||||
g_free (elem_name);
|
g_free (elem_name);
|
||||||
gst_object_ref_sink (element);
|
gst_object_ref_sink (element);
|
||||||
gst_object_unref (element);
|
gst_object_unref (element);
|
||||||
@ -1400,8 +1400,8 @@ duplicate_name:
|
|||||||
}
|
}
|
||||||
had_parent:
|
had_parent:
|
||||||
{
|
{
|
||||||
g_warning ("Element '%s' already has parent", elem_name);
|
|
||||||
GST_OBJECT_UNLOCK (bin);
|
GST_OBJECT_UNLOCK (bin);
|
||||||
|
GST_WARNING_OBJECT (bin, "Element '%s' already has parent", elem_name);
|
||||||
g_free (elem_name);
|
g_free (elem_name);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -1548,8 +1548,7 @@ gst_bin_add (GstBin * bin, GstElement * element)
|
|||||||
/* ERROR handling */
|
/* ERROR handling */
|
||||||
no_function:
|
no_function:
|
||||||
{
|
{
|
||||||
g_warning ("adding elements to bin '%s' is not supported",
|
GST_WARNING_OBJECT (bin, "adding elements to bin is not supported");
|
||||||
GST_ELEMENT_NAME (bin));
|
|
||||||
gst_object_ref_sink (element);
|
gst_object_ref_sink (element);
|
||||||
gst_object_unref (element);
|
gst_object_unref (element);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -1844,10 +1843,9 @@ removing_itself:
|
|||||||
}
|
}
|
||||||
not_in_bin:
|
not_in_bin:
|
||||||
{
|
{
|
||||||
g_warning ("Element '%s' is not in bin '%s'", elem_name,
|
|
||||||
GST_ELEMENT_NAME (bin));
|
|
||||||
GST_OBJECT_UNLOCK (element);
|
GST_OBJECT_UNLOCK (element);
|
||||||
GST_OBJECT_UNLOCK (bin);
|
GST_OBJECT_UNLOCK (bin);
|
||||||
|
GST_WARNING_OBJECT (bin, "Element '%s' is not in bin", elem_name);
|
||||||
g_free (elem_name);
|
g_free (elem_name);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -1898,8 +1896,7 @@ gst_bin_remove (GstBin * bin, GstElement * element)
|
|||||||
/* ERROR handling */
|
/* ERROR handling */
|
||||||
no_function:
|
no_function:
|
||||||
{
|
{
|
||||||
g_warning ("removing elements from bin '%s' is not supported",
|
GST_WARNING_OBJECT (bin, "Removing elements from bin is not supported");
|
||||||
GST_ELEMENT_NAME (bin));
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user