+2006-04-28 Wim Taymans <wim@fluendo.com>
+
+ * gst/gstutils.c: (push_and_ref):
+ Added some more docs.
+ Fix refcount issue whith gst_element_found_tags() helper
+ function. Fixes #338335
+
+ * tests/check/gst/gstutils.c: (GST_START_TEST), (gst_utils_suite):
+ Added testsuite for gst_element_found_tags().
+
2006-04-28 Michael Smith <msmith@fluendo.com>
* gst/gstvalue.c: (gst_value_serialize_flags):
* This function can potentially be very slow if denom > G_MAXUINT32.
*
* Returns: @val * @num / @denom, trying to avoid overflows.
+ * In the case of an overflow, this function returns G_MAXUINT64.
*/
guint64
gst_util_uint64_scale (guint64 val, guint64 num, guint64 denom)
*
* @num and @denom must be positive integers. @denom cannot be 0.
*
- * Returns: @val * @num / @denom, avoiding overflow and loss of precision
+ * Returns: @val * @num / @denom, avoiding overflow and loss of precision.
+ * In the case of an overflow, this function returns G_MAXUINT64.
*/
guint64
gst_util_uint64_scale_int (guint64 val, gint num, gint denom)
push_and_ref (GstPad * pad, GstEvent * event)
{
gst_pad_push_event (pad, gst_event_ref (event));
+ /* iterator refs pad, we unref when we are done with it */
+ gst_object_unref (pad);
}
/**
GST_END_TEST;
#endif
+GST_START_TEST (test_element_found_tags)
+{
+ GstElement *pipeline, *fakesrc, *fakesink;
+ GstTagList *list;
+ GstBus *bus;
+ GstMessage *message;
+
+ pipeline = gst_element_factory_make ("pipeline", NULL);
+ fakesrc = gst_element_factory_make ("fakesrc", NULL);
+ fakesink = gst_element_factory_make ("fakesink", NULL);
+ list = gst_tag_list_new ();
+
+ g_object_set (fakesrc, "num-buffers", (int) 10, NULL);
+
+ gst_bin_add_many (GST_BIN (pipeline), fakesrc, fakesink, NULL);
+ gst_element_link (fakesrc, fakesink);
+
+ gst_element_set_state (pipeline, GST_STATE_PLAYING);
+
+ gst_element_found_tags (GST_ELEMENT (fakesrc), list);
+
+ bus = gst_element_get_bus (pipeline);
+ message = gst_bus_poll (bus, GST_MESSAGE_EOS, -1);
+ gst_message_unref (message);
+ gst_object_unref (bus);
+
+ /* FIXME: maybe also check if the fakesink receives the message */
+
+ gst_element_set_state (pipeline, GST_STATE_NULL);
+ gst_object_unref (pipeline);
+}
+
+GST_END_TEST;
+
Suite *
gst_utils_suite (void)
{
#ifndef GST_DISABLE_PARSE
tcase_add_test (tc_chain, test_parse_bin_from_description);
#endif
+ tcase_add_test (tc_chain, test_element_found_tags);
return s;
}