gst/gstutils.c: Added some more docs.

Original commit message from CVS:
* 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().
This commit is contained in:
Wim Taymans 2006-04-28 15:48:50 +00:00
parent 530851afcf
commit 14a89b387e
3 changed files with 50 additions and 1 deletions

View file

@ -1,3 +1,13 @@
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):

View file

@ -482,6 +482,7 @@ overflow:
* 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)
@ -528,7 +529,8 @@ do_int64:
*
* @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)
@ -3003,6 +3005,8 @@ static void
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);
}
/**

View file

@ -414,6 +414,40 @@ GST_START_TEST (test_parse_bin_from_description)
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)
{
@ -431,6 +465,7 @@ 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;
}