mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 06:58:56 +00:00
gracefully handle helper method calls to objects that are not beeing controlled, added test case for that
Original commit message from CVS: * check/gst-libs/controller.c: (GST_START_TEST), (gst_controller_suite): * docs/gst/tmpl/gstcaps.sgml: * docs/gst/tmpl/gstghostpad.sgml: * docs/gst/tmpl/gstquery.sgml: * docs/gst/tmpl/gstutils.sgml: * libs/gst/controller/gst-helper.c: (gst_object_set_controller), (gst_object_sink_values), (gst_object_get_value_arrays), (gst_object_get_value_array): gracefully handle helper method calls to objects that are not beeing controlled, added test case for that
This commit is contained in:
parent
bc3dfd5d55
commit
da9c04e2f0
9 changed files with 159 additions and 32 deletions
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
||||||
|
2005-08-24 Stefan Kost <ensonic@users.sf.net>
|
||||||
|
|
||||||
|
* check/gst-libs/controller.c: (GST_START_TEST),
|
||||||
|
(gst_controller_suite):
|
||||||
|
* docs/gst/tmpl/gstcaps.sgml:
|
||||||
|
* docs/gst/tmpl/gstghostpad.sgml:
|
||||||
|
* docs/gst/tmpl/gstquery.sgml:
|
||||||
|
* docs/gst/tmpl/gstutils.sgml:
|
||||||
|
* libs/gst/controller/gst-helper.c: (gst_object_set_controller),
|
||||||
|
(gst_object_sink_values), (gst_object_get_value_arrays),
|
||||||
|
(gst_object_get_value_array):
|
||||||
|
gracefully handle helper method calls to objects that are not beeing
|
||||||
|
controlled, added test case for that
|
||||||
|
|
||||||
2005-08-23 Wim Taymans <wim@fluendo.com>
|
2005-08-23 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
* gst/gstevent.c: (_gst_event_copy), (gst_event_new_custom),
|
* gst/gstevent.c: (_gst_event_copy), (gst_event_new_custom),
|
||||||
|
|
|
@ -330,8 +330,24 @@ GST_START_TEST (controller_interpolate_none)
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
|
||||||
/* @TODO write more tests (using an internal element that has controlable params)
|
/* tests if we can run helper methods against any GObject */
|
||||||
*/
|
GST_START_TEST (controller_helper_any_gobject)
|
||||||
|
{
|
||||||
|
GstElement *elem;
|
||||||
|
gboolean res;
|
||||||
|
|
||||||
|
elem = gst_element_factory_make ("bin", "test_elem");
|
||||||
|
|
||||||
|
/* that element is not controllable */
|
||||||
|
res = gst_object_sink_values (G_OBJECT (elem), 0LL);
|
||||||
|
fail_unless (res == FALSE, NULL);
|
||||||
|
|
||||||
|
g_object_unref (elem);
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_END_TEST;
|
||||||
|
|
||||||
|
|
||||||
Suite *
|
Suite *
|
||||||
gst_controller_suite (void)
|
gst_controller_suite (void)
|
||||||
{
|
{
|
||||||
|
@ -346,6 +362,7 @@ gst_controller_suite (void)
|
||||||
tcase_add_test (tc, controller_param_twice);
|
tcase_add_test (tc, controller_param_twice);
|
||||||
tcase_add_test (tc, controller_finalize);
|
tcase_add_test (tc, controller_finalize);
|
||||||
tcase_add_test (tc, controller_interpolate_none);
|
tcase_add_test (tc, controller_interpolate_none);
|
||||||
|
tcase_add_test (tc, controller_helper_any_gobject);
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,6 +160,16 @@ templates.
|
||||||
@Returns:
|
@Returns:
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ##### FUNCTION gst_caps_copy_nth ##### -->
|
||||||
|
<para>
|
||||||
|
|
||||||
|
</para>
|
||||||
|
|
||||||
|
@caps:
|
||||||
|
@nth:
|
||||||
|
@Returns:
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION gst_static_caps_get ##### -->
|
<!-- ##### FUNCTION gst_static_caps_get ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
|
|
|
@ -35,3 +35,13 @@ Pseudo link pads
|
||||||
@pad:
|
@pad:
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ##### FUNCTION gst_ghost_pad_set_target ##### -->
|
||||||
|
<para>
|
||||||
|
|
||||||
|
</para>
|
||||||
|
|
||||||
|
@gpad:
|
||||||
|
@newtarget:
|
||||||
|
@Returns:
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,15 @@ Query types can be used to perform queries on pads and elements.
|
||||||
<!-- ##### SECTION Stability_Level ##### -->
|
<!-- ##### SECTION Stability_Level ##### -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ##### STRUCT GstQuery ##### -->
|
||||||
|
<para>
|
||||||
|
|
||||||
|
</para>
|
||||||
|
|
||||||
|
@mini_object:
|
||||||
|
@type:
|
||||||
|
@structure:
|
||||||
|
|
||||||
<!-- ##### ENUM GstQueryType ##### -->
|
<!-- ##### ENUM GstQueryType ##### -->
|
||||||
<para>
|
<para>
|
||||||
Standard predefined Query types
|
Standard predefined Query types
|
||||||
|
|
|
@ -65,6 +65,50 @@ various utility functions
|
||||||
@element:
|
@element:
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ##### FUNCTION gst_bin_watch_for_state_change ##### -->
|
||||||
|
<para>
|
||||||
|
|
||||||
|
</para>
|
||||||
|
|
||||||
|
@bin:
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ##### MACRO GST_BOILERPLATE_WITH_INTERFACE ##### -->
|
||||||
|
<para>
|
||||||
|
|
||||||
|
</para>
|
||||||
|
|
||||||
|
@type:
|
||||||
|
@type_as_function:
|
||||||
|
@parent_type:
|
||||||
|
@\
|
||||||
|
parent_type_as_macro:
|
||||||
|
@\
|
||||||
|
parent_type_as_macro:
|
||||||
|
@\
|
||||||
|
parent_type_as_macro:
|
||||||
|
@\
|
||||||
|
parent_type_as_macro:
|
||||||
|
@\
|
||||||
|
parent_type_as_macro:
|
||||||
|
@\
|
||||||
|
parent_type_as_macro:
|
||||||
|
@interface_type:
|
||||||
|
@interface_type_as_macro:
|
||||||
|
@\
|
||||||
|
interface_as_function:
|
||||||
|
@\
|
||||||
|
interface_as_function:
|
||||||
|
@\
|
||||||
|
interface_as_function:
|
||||||
|
@\
|
||||||
|
interface_as_function:
|
||||||
|
@\
|
||||||
|
interface_as_function:
|
||||||
|
@\
|
||||||
|
interface_as_function:
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO GST_BOILERPLATE_FULL ##### -->
|
<!-- ##### MACRO GST_BOILERPLATE_FULL ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
|
|
|
@ -131,10 +131,11 @@ gst_object_set_controller (GObject * object, GstController * controller)
|
||||||
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
|
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
|
||||||
g_return_val_if_fail (controller, FALSE);
|
g_return_val_if_fail (controller, FALSE);
|
||||||
|
|
||||||
ctrl = g_object_get_qdata (object, controller_key);
|
if (!(ctrl = g_object_get_qdata (object, controller_key))) {
|
||||||
g_return_val_if_fail (!ctrl, FALSE);
|
g_object_set_qdata (object, controller_key, controller);
|
||||||
g_object_set_qdata (object, controller_key, controller);
|
return (TRUE);
|
||||||
return (TRUE);
|
}
|
||||||
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -155,9 +156,10 @@ gst_object_sink_values (GObject * object, GstClockTime timestamp)
|
||||||
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
|
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
|
||||||
g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE);
|
g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE);
|
||||||
|
|
||||||
ctrl = g_object_get_qdata (object, controller_key);
|
if ((ctrl = g_object_get_qdata (object, controller_key))) {
|
||||||
g_return_val_if_fail (ctrl, FALSE);
|
return gst_controller_sink_values (ctrl, timestamp);
|
||||||
return gst_controller_sink_values (ctrl, timestamp);
|
}
|
||||||
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -187,9 +189,10 @@ gst_object_get_value_arrays (GObject * object, GstClockTime timestamp,
|
||||||
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
|
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
|
||||||
g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE);
|
g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE);
|
||||||
|
|
||||||
ctrl = g_object_get_qdata (object, controller_key);
|
if ((ctrl = g_object_get_qdata (object, controller_key))) {
|
||||||
g_return_val_if_fail (ctrl, FALSE);
|
return gst_controller_get_value_arrays (ctrl, timestamp, value_arrays);
|
||||||
return gst_controller_get_value_arrays (ctrl, timestamp, value_arrays);
|
}
|
||||||
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -217,8 +220,8 @@ gst_object_get_value_array (GObject * object, GstClockTime timestamp,
|
||||||
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
|
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
|
||||||
g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE);
|
g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE);
|
||||||
|
|
||||||
ctrl = g_object_get_qdata (object, controller_key);
|
if ((ctrl = g_object_get_qdata (object, controller_key))) {
|
||||||
g_return_val_if_fail (ctrl, FALSE);
|
return gst_controller_get_value_array (ctrl, timestamp, value_array);
|
||||||
|
}
|
||||||
return gst_controller_get_value_array (ctrl, timestamp, value_array);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,10 +131,11 @@ gst_object_set_controller (GObject * object, GstController * controller)
|
||||||
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
|
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
|
||||||
g_return_val_if_fail (controller, FALSE);
|
g_return_val_if_fail (controller, FALSE);
|
||||||
|
|
||||||
ctrl = g_object_get_qdata (object, controller_key);
|
if (!(ctrl = g_object_get_qdata (object, controller_key))) {
|
||||||
g_return_val_if_fail (!ctrl, FALSE);
|
g_object_set_qdata (object, controller_key, controller);
|
||||||
g_object_set_qdata (object, controller_key, controller);
|
return (TRUE);
|
||||||
return (TRUE);
|
}
|
||||||
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -155,9 +156,10 @@ gst_object_sink_values (GObject * object, GstClockTime timestamp)
|
||||||
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
|
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
|
||||||
g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE);
|
g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE);
|
||||||
|
|
||||||
ctrl = g_object_get_qdata (object, controller_key);
|
if ((ctrl = g_object_get_qdata (object, controller_key))) {
|
||||||
g_return_val_if_fail (ctrl, FALSE);
|
return gst_controller_sink_values (ctrl, timestamp);
|
||||||
return gst_controller_sink_values (ctrl, timestamp);
|
}
|
||||||
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -187,9 +189,10 @@ gst_object_get_value_arrays (GObject * object, GstClockTime timestamp,
|
||||||
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
|
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
|
||||||
g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE);
|
g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE);
|
||||||
|
|
||||||
ctrl = g_object_get_qdata (object, controller_key);
|
if ((ctrl = g_object_get_qdata (object, controller_key))) {
|
||||||
g_return_val_if_fail (ctrl, FALSE);
|
return gst_controller_get_value_arrays (ctrl, timestamp, value_arrays);
|
||||||
return gst_controller_get_value_arrays (ctrl, timestamp, value_arrays);
|
}
|
||||||
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -217,8 +220,8 @@ gst_object_get_value_array (GObject * object, GstClockTime timestamp,
|
||||||
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
|
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
|
||||||
g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE);
|
g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE);
|
||||||
|
|
||||||
ctrl = g_object_get_qdata (object, controller_key);
|
if ((ctrl = g_object_get_qdata (object, controller_key))) {
|
||||||
g_return_val_if_fail (ctrl, FALSE);
|
return gst_controller_get_value_array (ctrl, timestamp, value_array);
|
||||||
|
}
|
||||||
return gst_controller_get_value_array (ctrl, timestamp, value_array);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -330,8 +330,24 @@ GST_START_TEST (controller_interpolate_none)
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
|
||||||
/* @TODO write more tests (using an internal element that has controlable params)
|
/* tests if we can run helper methods against any GObject */
|
||||||
*/
|
GST_START_TEST (controller_helper_any_gobject)
|
||||||
|
{
|
||||||
|
GstElement *elem;
|
||||||
|
gboolean res;
|
||||||
|
|
||||||
|
elem = gst_element_factory_make ("bin", "test_elem");
|
||||||
|
|
||||||
|
/* that element is not controllable */
|
||||||
|
res = gst_object_sink_values (G_OBJECT (elem), 0LL);
|
||||||
|
fail_unless (res == FALSE, NULL);
|
||||||
|
|
||||||
|
g_object_unref (elem);
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_END_TEST;
|
||||||
|
|
||||||
|
|
||||||
Suite *
|
Suite *
|
||||||
gst_controller_suite (void)
|
gst_controller_suite (void)
|
||||||
{
|
{
|
||||||
|
@ -346,6 +362,7 @@ gst_controller_suite (void)
|
||||||
tcase_add_test (tc, controller_param_twice);
|
tcase_add_test (tc, controller_param_twice);
|
||||||
tcase_add_test (tc, controller_finalize);
|
tcase_add_test (tc, controller_finalize);
|
||||||
tcase_add_test (tc, controller_interpolate_none);
|
tcase_add_test (tc, controller_interpolate_none);
|
||||||
|
tcase_add_test (tc, controller_helper_any_gobject);
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue