+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>
* gst/gstevent.c: (_gst_event_copy), (gst_event_new_custom),
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 *
gst_controller_suite (void)
{
tcase_add_test (tc, controller_param_twice);
tcase_add_test (tc, controller_finalize);
tcase_add_test (tc, controller_interpolate_none);
+ tcase_add_test (tc, controller_helper_any_gobject);
return s;
}
@Returns:
+<!-- ##### FUNCTION gst_caps_copy_nth ##### -->
+<para>
+
+</para>
+
+@caps:
+@nth:
+@Returns:
+
+
<!-- ##### FUNCTION gst_static_caps_get ##### -->
<para>
@pad:
+<!-- ##### FUNCTION gst_ghost_pad_set_target ##### -->
+<para>
+
+</para>
+
+@gpad:
+@newtarget:
+@Returns:
+
+
<!-- ##### SECTION Stability_Level ##### -->
+<!-- ##### STRUCT GstQuery ##### -->
+<para>
+
+</para>
+
+@mini_object:
+@type:
+@structure:
+
<!-- ##### ENUM GstQueryType ##### -->
<para>
Standard predefined Query types
@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 ##### -->
<para>
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
g_return_val_if_fail (controller, FALSE);
- ctrl = g_object_get_qdata (object, controller_key);
- g_return_val_if_fail (!ctrl, FALSE);
- g_object_set_qdata (object, controller_key, controller);
- return (TRUE);
+ if (!(ctrl = g_object_get_qdata (object, controller_key))) {
+ g_object_set_qdata (object, controller_key, controller);
+ return (TRUE);
+ }
+ return (FALSE);
}
/**
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE);
- ctrl = g_object_get_qdata (object, controller_key);
- g_return_val_if_fail (ctrl, FALSE);
- return gst_controller_sink_values (ctrl, timestamp);
+ if ((ctrl = g_object_get_qdata (object, controller_key))) {
+ return gst_controller_sink_values (ctrl, timestamp);
+ }
+ return (FALSE);
}
/**
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE);
- 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);
+ if ((ctrl = g_object_get_qdata (object, controller_key))) {
+ return gst_controller_get_value_arrays (ctrl, timestamp, value_arrays);
+ }
+ return (FALSE);
}
/**
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE);
- 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);
+ if ((ctrl = g_object_get_qdata (object, controller_key))) {
+ return gst_controller_get_value_array (ctrl, timestamp, value_array);
+ }
+ return (FALSE);
}
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
g_return_val_if_fail (controller, FALSE);
- ctrl = g_object_get_qdata (object, controller_key);
- g_return_val_if_fail (!ctrl, FALSE);
- g_object_set_qdata (object, controller_key, controller);
- return (TRUE);
+ if (!(ctrl = g_object_get_qdata (object, controller_key))) {
+ g_object_set_qdata (object, controller_key, controller);
+ return (TRUE);
+ }
+ return (FALSE);
}
/**
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE);
- ctrl = g_object_get_qdata (object, controller_key);
- g_return_val_if_fail (ctrl, FALSE);
- return gst_controller_sink_values (ctrl, timestamp);
+ if ((ctrl = g_object_get_qdata (object, controller_key))) {
+ return gst_controller_sink_values (ctrl, timestamp);
+ }
+ return (FALSE);
}
/**
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE);
- 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);
+ if ((ctrl = g_object_get_qdata (object, controller_key))) {
+ return gst_controller_get_value_arrays (ctrl, timestamp, value_arrays);
+ }
+ return (FALSE);
}
/**
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE);
- 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);
+ if ((ctrl = g_object_get_qdata (object, controller_key))) {
+ return gst_controller_get_value_array (ctrl, timestamp, value_array);
+ }
+ return (FALSE);
}
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 *
gst_controller_suite (void)
{
tcase_add_test (tc, controller_param_twice);
tcase_add_test (tc, controller_finalize);
tcase_add_test (tc, controller_interpolate_none);
+ tcase_add_test (tc, controller_helper_any_gobject);
return s;
}