From e8007886c16f1cad8d6c60b84e96dec9eadbd2b0 Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Fri, 5 Aug 2005 06:55:03 +0000 Subject: [PATCH] add sizetype tests for fakesrc Original commit message from CVS: add sizetype tests for fakesrc --- ChangeLog | 6 ++ check/elements/gstfakesrc.c | 153 ++++++++++++++++++++++++++++-- docs/gst/tmpl/gst.sgml | 3 - docs/gst/tmpl/gstbasesink.sgml | 3 - docs/gst/tmpl/gstbasesrc.sgml | 3 - docs/gst/tmpl/gstbasetransform.sgml | 3 - docs/gst/tmpl/gstbin.sgml | 3 - docs/gst/tmpl/gstbuffer.sgml | 3 - docs/gst/tmpl/gstcaps.sgml | 3 - docs/gst/tmpl/gstclock.sgml | 3 - docs/gst/tmpl/gstcompat.sgml | 3 - docs/gst/tmpl/gstconfig.sgml | 3 - docs/gst/tmpl/gstelement.sgml | 3 - docs/gst/tmpl/gstelementdetails.sgml | 3 - docs/gst/tmpl/gstelementfactory.sgml | 3 - docs/gst/tmpl/gstenumtypes.sgml | 3 - docs/gst/tmpl/gsterror.sgml | 3 - docs/gst/tmpl/gstevent.sgml | 3 - docs/gst/tmpl/gstfakesink.sgml | 3 - docs/gst/tmpl/gstfakesrc.sgml | 4 +- docs/gst/tmpl/gstfilesink.sgml | 3 - docs/gst/tmpl/gstfilesrc.sgml | 3 - docs/gst/tmpl/gstfilter.sgml | 3 - docs/gst/tmpl/gstformat.sgml | 3 - docs/gst/tmpl/gstghostpad.sgml | 3 - docs/gst/tmpl/gstimplementsinterface.sgml | 3 - docs/gst/tmpl/gstindex.sgml | 3 - docs/gst/tmpl/gstindexfactory.sgml | 3 - docs/gst/tmpl/gstinfo.sgml | 3 - docs/gst/tmpl/gstiterator.sgml | 3 - docs/gst/tmpl/gstmacros.sgml | 3 - docs/gst/tmpl/gstmemchunk.sgml | 3 - docs/gst/tmpl/gstminiobject.sgml | 3 - docs/gst/tmpl/gstobject.sgml | 3 - docs/gst/tmpl/gstpad.sgml | 3 - docs/gst/tmpl/gstpadtemplate.sgml | 3 - docs/gst/tmpl/gstparse.sgml | 3 - docs/gst/tmpl/gstpipeline.sgml | 3 - docs/gst/tmpl/gstplugin.sgml | 3 - docs/gst/tmpl/gstpluginfeature.sgml | 3 - docs/gst/tmpl/gstquery.sgml | 3 - docs/gst/tmpl/gstqueue.sgml | 3 - docs/gst/tmpl/gstregistry.sgml | 3 - docs/gst/tmpl/gstregistrypool.sgml | 3 - docs/gst/tmpl/gststructure.sgml | 3 - docs/gst/tmpl/gstsystemclock.sgml | 3 - docs/gst/tmpl/gsttaglist.sgml | 3 - docs/gst/tmpl/gsttagsetter.sgml | 3 - docs/gst/tmpl/gsttrace.sgml | 3 - docs/gst/tmpl/gsttrashstack.sgml | 3 - docs/gst/tmpl/gsttypefind.sgml | 3 - docs/gst/tmpl/gsttypefindfactory.sgml | 3 - docs/gst/tmpl/gsttypes.sgml | 3 - docs/gst/tmpl/gsturihandler.sgml | 3 - docs/gst/tmpl/gsturitype.sgml | 3 - docs/gst/tmpl/gstutils.sgml | 3 - docs/gst/tmpl/gstvalue.sgml | 3 - docs/gst/tmpl/gstversion.sgml | 3 - docs/gst/tmpl/gstxml.sgml | 3 - docs/libs/tmpl/gstdataprotocol.sgml | 3 - docs/libs/tmpl/gstgetbits.sgml | 3 - tests/check/elements/gstfakesrc.c | 153 ++++++++++++++++++++++++++++-- 62 files changed, 299 insertions(+), 191 deletions(-) diff --git a/ChangeLog b/ChangeLog index cf978be..0da40db 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-08-05 Thomas Vander Stichele + + * check/elements/gstfakesrc.c: (setup_fakesrc), (cleanup_fakesrc), + (GST_START_TEST), (fakesrc_suite): + add tests for sizetype + 2005-08-04 Andy Wingo * gst/elements/gstcapsfilter.c: Reimplement using basetransform, diff --git a/check/elements/gstfakesrc.c b/check/elements/gstfakesrc.c index febebea..e121684 100644 --- a/check/elements/gstfakesrc.c +++ b/check/elements/gstfakesrc.c @@ -57,7 +57,8 @@ event_func (GstPad * pad, GstEvent * event) return FALSE; } -GST_START_TEST (test_num_buffers) +GstElement * +setup_fakesrc () { GstElement *src; GstPad *srcpad, *sinkpad; @@ -70,8 +71,6 @@ GST_START_TEST (test_num_buffers) "sink"); fail_if (sinkpad == NULL, "Could not create a sinkpad"); - g_object_set (G_OBJECT (src), "num-buffers", 3, NULL); - srcpad = gst_element_get_pad (src, "src"); fail_if (srcpad == NULL, "Could not get source pad from fakesrc"); gst_pad_set_caps (sinkpad, NULL); @@ -80,7 +79,41 @@ GST_START_TEST (test_num_buffers) fail_unless (gst_pad_link (srcpad, sinkpad) == GST_PAD_LINK_OK, "Could not link source and sink pads"); + return src; +} + +void +cleanup_fakesrc (GstElement * src) +{ + GstPad *srcpad, *sinkpad; + + fail_unless (gst_element_set_state (src, GST_STATE_NULL) == GST_STATE_SUCCESS, + "could not set to null"); + + srcpad = gst_element_get_pad (src, "src"); + sinkpad = gst_pad_get_peer (srcpad); + + ASSERT_OBJECT_REFCOUNT (src, "src", 1); + gst_object_unref (src); + + gst_pad_unlink (srcpad, sinkpad); + + /* pad refs held by both creator and this function (through _get) */ + ASSERT_OBJECT_REFCOUNT (srcpad, "srcpad", 2); + gst_object_unref (srcpad); + gst_object_unref (srcpad); + + ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 2); + gst_object_unref (sinkpad); + gst_object_unref (sinkpad); +} + +GST_START_TEST (test_num_buffers) +{ + GstElement *src; + src = setup_fakesrc (); + g_object_set (G_OBJECT (src), "num-buffers", 3, NULL); fail_unless (gst_element_set_state (src, GST_STATE_PLAYING) == GST_STATE_SUCCESS, "could not set to playing"); @@ -93,15 +126,118 @@ GST_START_TEST (test_num_buffers) g_list_free (buffers); /* cleanup */ - fail_unless (gst_element_set_state (src, GST_STATE_NULL) == GST_STATE_SUCCESS, - "could not set to null"); + cleanup_fakesrc (src); +} - gst_object_unref (src); - gst_object_unref (sinkpad); +GST_END_TEST; + +GST_START_TEST (test_sizetype_empty) +{ + GstElement *src; + GList *l; + + src = setup_fakesrc (); + + g_object_set (G_OBJECT (src), "sizetype", 1, NULL); + g_object_set (G_OBJECT (src), "num-buffers", 100, NULL); + + fail_unless (gst_element_set_state (src, + GST_STATE_PLAYING) == GST_STATE_SUCCESS, "could not set to playing"); + + while (!have_eos) { + g_usleep (1000); + } + + fail_unless (g_list_length (buffers) == 100); + l = buffers; + while (l) { + GstBuffer *buf = l->data; + + fail_unless (GST_BUFFER_SIZE (buf) == 0); + l = l->next; + } + g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL); + g_list_free (buffers); + + /* cleanup */ + cleanup_fakesrc (src); +} + +GST_END_TEST; + +GST_START_TEST (test_sizetype_fixed) +{ + GstElement *src; + GList *l; + + src = setup_fakesrc (); + + g_object_set (G_OBJECT (src), "sizetype", 2, NULL); + g_object_set (G_OBJECT (src), "sizemax", 8192, NULL); + g_object_set (G_OBJECT (src), "num-buffers", 100, NULL); + + fail_unless (gst_element_set_state (src, + GST_STATE_PLAYING) == GST_STATE_SUCCESS, "could not set to playing"); + + while (!have_eos) { + g_usleep (1000); + } + + fail_unless (g_list_length (buffers) == 100); + l = buffers; + while (l) { + GstBuffer *buf = l->data; + + fail_unless (GST_BUFFER_SIZE (buf) == 8192); + l = l->next; + } + g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL); + g_list_free (buffers); + + /* cleanup */ + cleanup_fakesrc (src); } GST_END_TEST; +GST_START_TEST (test_sizetype_random) +{ + GstElement *src; + GList *l; + + src = setup_fakesrc (); + + g_object_set (G_OBJECT (src), "sizetype", 3, NULL); + g_object_set (G_OBJECT (src), "sizemin", 4096, NULL); + g_object_set (G_OBJECT (src), "sizemax", 8192, NULL); + g_object_set (G_OBJECT (src), "num-buffers", 100, NULL); + + fail_unless (gst_element_set_state (src, + GST_STATE_PLAYING) == GST_STATE_SUCCESS, "could not set to playing"); + + while (!have_eos) { + g_usleep (1000); + } + + fail_unless (g_list_length (buffers) == 100); + l = buffers; + while (l) { + GstBuffer *buf = l->data; + + fail_if (GST_BUFFER_SIZE (buf) > 8192); + fail_if (GST_BUFFER_SIZE (buf) < 4096); + l = l->next; + } + g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL); + g_list_free (buffers); + + /* cleanup */ + cleanup_fakesrc (src); +} + +GST_END_TEST; + + Suite * fakesrc_suite (void) { @@ -110,6 +246,9 @@ fakesrc_suite (void) suite_add_tcase (s, tc_chain); tcase_add_test (tc_chain, test_num_buffers); + tcase_add_test (tc_chain, test_sizetype_empty); + tcase_add_test (tc_chain, test_sizetype_fixed); + tcase_add_test (tc_chain, test_sizetype_random); return s; } diff --git a/docs/gst/tmpl/gst.sgml b/docs/gst/tmpl/gst.sgml index fc6631a..eb88667 100644 --- a/docs/gst/tmpl/gst.sgml +++ b/docs/gst/tmpl/gst.sgml @@ -87,9 +87,6 @@ Check out both OGI's pipeline and Microsoft's DirectShow for some background. - - - diff --git a/docs/gst/tmpl/gstbasesink.sgml b/docs/gst/tmpl/gstbasesink.sgml index 429222d..4ba69f2 100644 --- a/docs/gst/tmpl/gstbasesink.sgml +++ b/docs/gst/tmpl/gstbasesink.sgml @@ -14,9 +14,6 @@ GstBaseSink - - - diff --git a/docs/gst/tmpl/gstbasesrc.sgml b/docs/gst/tmpl/gstbasesrc.sgml index ada1af9..5b06188 100644 --- a/docs/gst/tmpl/gstbasesrc.sgml +++ b/docs/gst/tmpl/gstbasesrc.sgml @@ -14,9 +14,6 @@ GstBaseSrc - - - diff --git a/docs/gst/tmpl/gstbasetransform.sgml b/docs/gst/tmpl/gstbasetransform.sgml index 4ae5603..d566f39 100644 --- a/docs/gst/tmpl/gstbasetransform.sgml +++ b/docs/gst/tmpl/gstbasetransform.sgml @@ -14,9 +14,6 @@ GstBaseTransform - - - diff --git a/docs/gst/tmpl/gstbin.sgml b/docs/gst/tmpl/gstbin.sgml index 18938a4..2007814 100644 --- a/docs/gst/tmpl/gstbin.sgml +++ b/docs/gst/tmpl/gstbin.sgml @@ -55,9 +55,6 @@ clock providers in the bin. - - - diff --git a/docs/gst/tmpl/gstbuffer.sgml b/docs/gst/tmpl/gstbuffer.sgml index 08d3c89..a8c176f 100644 --- a/docs/gst/tmpl/gstbuffer.sgml +++ b/docs/gst/tmpl/gstbuffer.sgml @@ -85,9 +85,6 @@ Last reviewed on August 12th, 2004 (0.8.5) #GstPad, #GstMiniObject - - - The basic structure of a buffer. diff --git a/docs/gst/tmpl/gstcaps.sgml b/docs/gst/tmpl/gstcaps.sgml index fdc72d3..25ad066 100644 --- a/docs/gst/tmpl/gstcaps.sgml +++ b/docs/gst/tmpl/gstcaps.sgml @@ -14,9 +14,6 @@ Structure describing sets of media formats - - - diff --git a/docs/gst/tmpl/gstclock.sgml b/docs/gst/tmpl/gstclock.sgml index 231085a..052fe05 100644 --- a/docs/gst/tmpl/gstclock.sgml +++ b/docs/gst/tmpl/gstclock.sgml @@ -22,9 +22,6 @@ a good measure of the current playback time in the pipeline. #GstSystemClock - - - diff --git a/docs/gst/tmpl/gstcompat.sgml b/docs/gst/tmpl/gstcompat.sgml index 402c11c..16c29cd 100644 --- a/docs/gst/tmpl/gstcompat.sgml +++ b/docs/gst/tmpl/gstcompat.sgml @@ -16,6 +16,3 @@ This can be done in CFLAGS for compiling old code. - - - diff --git a/docs/gst/tmpl/gstconfig.sgml b/docs/gst/tmpl/gstconfig.sgml index 6e71764..ed05367 100644 --- a/docs/gst/tmpl/gstconfig.sgml +++ b/docs/gst/tmpl/gstconfig.sgml @@ -37,9 +37,6 @@ If a subsystem is disabled in GStreamer, a value is defined in - - - diff --git a/docs/gst/tmpl/gstelement.sgml b/docs/gst/tmpl/gstelement.sgml index 703e7dd..4708c06 100644 --- a/docs/gst/tmpl/gstelement.sgml +++ b/docs/gst/tmpl/gstelement.sgml @@ -65,9 +65,6 @@ and gst_element_set_clock(). You can wait for the clock to reach a given - - - diff --git a/docs/gst/tmpl/gstelementdetails.sgml b/docs/gst/tmpl/gstelementdetails.sgml index 757ebbc..8c57fce 100644 --- a/docs/gst/tmpl/gstelementdetails.sgml +++ b/docs/gst/tmpl/gstelementdetails.sgml @@ -14,9 +14,6 @@ Defines public information about a #GstElement - - - This struct is used to define public information about the element. It diff --git a/docs/gst/tmpl/gstelementfactory.sgml b/docs/gst/tmpl/gstelementfactory.sgml index c68b5b4..5e74564 100644 --- a/docs/gst/tmpl/gstelementfactory.sgml +++ b/docs/gst/tmpl/gstelementfactory.sgml @@ -54,9 +54,6 @@ so that the autopluggers can select a plugin more appropriatly #GstElement, #GstPlugin, #GstPluginFeature, #GstPadTemplate. - - - diff --git a/docs/gst/tmpl/gstenumtypes.sgml b/docs/gst/tmpl/gstenumtypes.sgml index 52ba68c..e9361f1 100644 --- a/docs/gst/tmpl/gstenumtypes.sgml +++ b/docs/gst/tmpl/gstenumtypes.sgml @@ -14,6 +14,3 @@ all gstreamer core related enumerations - - - diff --git a/docs/gst/tmpl/gsterror.sgml b/docs/gst/tmpl/gsterror.sgml index 3b972c3..11701fc 100644 --- a/docs/gst/tmpl/gsterror.sgml +++ b/docs/gst/tmpl/gsterror.sgml @@ -14,9 +14,6 @@ Categorized error messages - - - diff --git a/docs/gst/tmpl/gstevent.sgml b/docs/gst/tmpl/gstevent.sgml index 4872e40..66277de 100644 --- a/docs/gst/tmpl/gstevent.sgml +++ b/docs/gst/tmpl/gstevent.sgml @@ -27,9 +27,6 @@ gst_event_new_flush() creates a new flush event. #GstPad, #GstElement - - - diff --git a/docs/gst/tmpl/gstfakesink.sgml b/docs/gst/tmpl/gstfakesink.sgml index bbf1d94..7755271 100644 --- a/docs/gst/tmpl/gstfakesink.sgml +++ b/docs/gst/tmpl/gstfakesink.sgml @@ -14,9 +14,6 @@ GstFakeSink - - - diff --git a/docs/gst/tmpl/gstfakesrc.sgml b/docs/gst/tmpl/gstfakesrc.sgml index ae77999..ad63acc 100644 --- a/docs/gst/tmpl/gstfakesrc.sgml +++ b/docs/gst/tmpl/gstfakesrc.sgml @@ -14,9 +14,6 @@ GstFakeSrc - - - @@ -41,6 +38,7 @@ GstFakeSrc @: @: @: +@: @: diff --git a/docs/gst/tmpl/gstfilesink.sgml b/docs/gst/tmpl/gstfilesink.sgml index 9ec2717..e3bd8dd 100644 --- a/docs/gst/tmpl/gstfilesink.sgml +++ b/docs/gst/tmpl/gstfilesink.sgml @@ -14,9 +14,6 @@ GstFileSink - - - diff --git a/docs/gst/tmpl/gstfilesrc.sgml b/docs/gst/tmpl/gstfilesrc.sgml index 806b545..e7d7274 100644 --- a/docs/gst/tmpl/gstfilesrc.sgml +++ b/docs/gst/tmpl/gstfilesrc.sgml @@ -14,9 +14,6 @@ GstFileSrc - - - diff --git a/docs/gst/tmpl/gstfilter.sgml b/docs/gst/tmpl/gstfilter.sgml index 49932ee..8f5a2fe 100644 --- a/docs/gst/tmpl/gstfilter.sgml +++ b/docs/gst/tmpl/gstfilter.sgml @@ -17,9 +17,6 @@ on its own. - - - diff --git a/docs/gst/tmpl/gstformat.sgml b/docs/gst/tmpl/gstformat.sgml index ae7b43d..99d947e 100644 --- a/docs/gst/tmpl/gstformat.sgml +++ b/docs/gst/tmpl/gstformat.sgml @@ -15,9 +15,6 @@ formats can be used to perform seeking or conversions/query operations. #GstPad, #GstElement - - - Standard predefined formats diff --git a/docs/gst/tmpl/gstghostpad.sgml b/docs/gst/tmpl/gstghostpad.sgml index b92fdbd..520c300 100644 --- a/docs/gst/tmpl/gstghostpad.sgml +++ b/docs/gst/tmpl/gstghostpad.sgml @@ -14,9 +14,6 @@ Pseudo link pads - - - diff --git a/docs/gst/tmpl/gstimplementsinterface.sgml b/docs/gst/tmpl/gstimplementsinterface.sgml index df7fb5f..5683450 100644 --- a/docs/gst/tmpl/gstimplementsinterface.sgml +++ b/docs/gst/tmpl/gstimplementsinterface.sgml @@ -14,9 +14,6 @@ Core interface implemented by #GstElements that allows runtime querying of inter - - - diff --git a/docs/gst/tmpl/gstindex.sgml b/docs/gst/tmpl/gstindex.sgml index 1eac0ee..74254d5 100644 --- a/docs/gst/tmpl/gstindex.sgml +++ b/docs/gst/tmpl/gstindex.sgml @@ -15,9 +15,6 @@ in a pipeline. #GstIndexFactory - - - diff --git a/docs/gst/tmpl/gstindexfactory.sgml b/docs/gst/tmpl/gstindexfactory.sgml index 7c86974..f458efd 100644 --- a/docs/gst/tmpl/gstindexfactory.sgml +++ b/docs/gst/tmpl/gstindexfactory.sgml @@ -14,9 +14,6 @@ GstIndexFactory is used to dynamically create GstIndex implementations. #GstIndex - - - The GstIndexFactory object diff --git a/docs/gst/tmpl/gstinfo.sgml b/docs/gst/tmpl/gstinfo.sgml index d2d2d58..be07e23 100644 --- a/docs/gst/tmpl/gstinfo.sgml +++ b/docs/gst/tmpl/gstinfo.sgml @@ -68,9 +68,6 @@ categories. These are explained at GST_DEBUG_CATEGORY_INIT(). and environment variables that affect the debugging output. - - - The level defines the importance of a debugging message. The more important a diff --git a/docs/gst/tmpl/gstiterator.sgml b/docs/gst/tmpl/gstiterator.sgml index 9bc68df..307d499 100644 --- a/docs/gst/tmpl/gstiterator.sgml +++ b/docs/gst/tmpl/gstiterator.sgml @@ -14,9 +14,6 @@ GstIterator - - - diff --git a/docs/gst/tmpl/gstmacros.sgml b/docs/gst/tmpl/gstmacros.sgml index 8149bca..49b0cc6 100644 --- a/docs/gst/tmpl/gstmacros.sgml +++ b/docs/gst/tmpl/gstmacros.sgml @@ -14,6 +14,3 @@ various portabillity helper macros - - - diff --git a/docs/gst/tmpl/gstmemchunk.sgml b/docs/gst/tmpl/gstmemchunk.sgml index 8ce3af2..af74215 100644 --- a/docs/gst/tmpl/gstmemchunk.sgml +++ b/docs/gst/tmpl/gstmemchunk.sgml @@ -21,9 +21,6 @@ The GstMemChunk is used to allocate critical resources for #GstBuffer and #GstBuffer, #GstEvent, #GstData - - - The memchunk structure diff --git a/docs/gst/tmpl/gstminiobject.sgml b/docs/gst/tmpl/gstminiobject.sgml index ff0a8f1..5481e39 100644 --- a/docs/gst/tmpl/gstminiobject.sgml +++ b/docs/gst/tmpl/gstminiobject.sgml @@ -14,9 +14,6 @@ GstMiniObject - - - diff --git a/docs/gst/tmpl/gstobject.sgml b/docs/gst/tmpl/gstobject.sgml index 583afec..ab9e443 100644 --- a/docs/gst/tmpl/gstobject.sgml +++ b/docs/gst/tmpl/gstobject.sgml @@ -67,9 +67,6 @@ object. - - - diff --git a/docs/gst/tmpl/gstpad.sgml b/docs/gst/tmpl/gstpad.sgml index fa5a64d..d215a3d 100644 --- a/docs/gst/tmpl/gstpad.sgml +++ b/docs/gst/tmpl/gstpad.sgml @@ -57,9 +57,6 @@ Last reviewed on December 13th, 2002 (0.5.0.1) #GstPadTemplate, #GstElement, #GstEvent - - - diff --git a/docs/gst/tmpl/gstpadtemplate.sgml b/docs/gst/tmpl/gstpadtemplate.sgml index 060a3d1..1ff9a28 100644 --- a/docs/gst/tmpl/gstpadtemplate.sgml +++ b/docs/gst/tmpl/gstpadtemplate.sgml @@ -73,9 +73,6 @@ The following example shows you how to add the padtemplate to an elementfactory: #GstPad, #GstElementFactory - - - The padtemplate object. diff --git a/docs/gst/tmpl/gstparse.sgml b/docs/gst/tmpl/gstparse.sgml index e43a2da..5b70820 100644 --- a/docs/gst/tmpl/gstparse.sgml +++ b/docs/gst/tmpl/gstparse.sgml @@ -14,9 +14,6 @@ get a pipeline from a text pipeline description - - - diff --git a/docs/gst/tmpl/gstpipeline.sgml b/docs/gst/tmpl/gstpipeline.sgml index 74912fa..bbd6ecd 100644 --- a/docs/gst/tmpl/gstpipeline.sgml +++ b/docs/gst/tmpl/gstpipeline.sgml @@ -21,9 +21,6 @@ the pipeline, use gst_object_unref() to free its resources. #GstBin - - - diff --git a/docs/gst/tmpl/gstplugin.sgml b/docs/gst/tmpl/gstplugin.sgml index 17a0ae7..cd93138 100644 --- a/docs/gst/tmpl/gstplugin.sgml +++ b/docs/gst/tmpl/gstplugin.sgml @@ -35,9 +35,6 @@ to bring the plugin into memory. #GstPluginFeature, #GstType, #GstAutoplug, #GstElementFactory - - - Get the error quark diff --git a/docs/gst/tmpl/gstpluginfeature.sgml b/docs/gst/tmpl/gstpluginfeature.sgml index 96a2e5e..6395293 100644 --- a/docs/gst/tmpl/gstpluginfeature.sgml +++ b/docs/gst/tmpl/gstpluginfeature.sgml @@ -14,9 +14,6 @@ This is a base class for anything that can be added to a #GstPlugin. #GstPlugin - - - diff --git a/docs/gst/tmpl/gstquery.sgml b/docs/gst/tmpl/gstquery.sgml index 3fcf8be..ed0755b 100644 --- a/docs/gst/tmpl/gstquery.sgml +++ b/docs/gst/tmpl/gstquery.sgml @@ -15,9 +15,6 @@ Query types can be used to perform queries on pads and elements. #GstPad, #GstElement - - - Standard predefined Query types diff --git a/docs/gst/tmpl/gstqueue.sgml b/docs/gst/tmpl/gstqueue.sgml index 3d2a500..71ce9c5 100644 --- a/docs/gst/tmpl/gstqueue.sgml +++ b/docs/gst/tmpl/gstqueue.sgml @@ -25,9 +25,6 @@ The queue blocks by default. - - - diff --git a/docs/gst/tmpl/gstregistry.sgml b/docs/gst/tmpl/gstregistry.sgml index be6b381..a554aee 100644 --- a/docs/gst/tmpl/gstregistry.sgml +++ b/docs/gst/tmpl/gstregistry.sgml @@ -15,6 +15,3 @@ All registries build the #GstRegistryPool. #GstPlugin, #GstPluginFeature - - - diff --git a/docs/gst/tmpl/gstregistrypool.sgml b/docs/gst/tmpl/gstregistrypool.sgml index 99de4f9..82b21c6 100644 --- a/docs/gst/tmpl/gstregistrypool.sgml +++ b/docs/gst/tmpl/gstregistrypool.sgml @@ -15,9 +15,6 @@ the system. GstRegistry - - - diff --git a/docs/gst/tmpl/gststructure.sgml b/docs/gst/tmpl/gststructure.sgml index 14fd72e..7bbb0bf 100644 --- a/docs/gst/tmpl/gststructure.sgml +++ b/docs/gst/tmpl/gststructure.sgml @@ -14,9 +14,6 @@ Generic structure containing fields of names and values - - - diff --git a/docs/gst/tmpl/gstsystemclock.sgml b/docs/gst/tmpl/gstsystemclock.sgml index 71c56fd..714c32c 100644 --- a/docs/gst/tmpl/gstsystemclock.sgml +++ b/docs/gst/tmpl/gstsystemclock.sgml @@ -15,9 +15,6 @@ system time. #GstClock - - - diff --git a/docs/gst/tmpl/gsttaglist.sgml b/docs/gst/tmpl/gsttaglist.sgml index b45b446..6dc2830 100644 --- a/docs/gst/tmpl/gsttaglist.sgml +++ b/docs/gst/tmpl/gsttaglist.sgml @@ -14,9 +14,6 @@ List of tags and values used to describe media metadata - - - diff --git a/docs/gst/tmpl/gsttagsetter.sgml b/docs/gst/tmpl/gsttagsetter.sgml index d80b667..4c55270 100644 --- a/docs/gst/tmpl/gsttagsetter.sgml +++ b/docs/gst/tmpl/gsttagsetter.sgml @@ -14,9 +14,6 @@ Element interface that allows setting and retrieval of media metadata - - - diff --git a/docs/gst/tmpl/gsttrace.sgml b/docs/gst/tmpl/gsttrace.sgml index b08a807..6ccaa79 100644 --- a/docs/gst/tmpl/gsttrace.sgml +++ b/docs/gst/tmpl/gsttrace.sgml @@ -14,9 +14,6 @@ Tracing functionality - - - diff --git a/docs/gst/tmpl/gsttrashstack.sgml b/docs/gst/tmpl/gsttrashstack.sgml index 27eeeeb..81bb80f 100644 --- a/docs/gst/tmpl/gsttrashstack.sgml +++ b/docs/gst/tmpl/gsttrashstack.sgml @@ -14,9 +14,6 @@ gsttrashstack - - - diff --git a/docs/gst/tmpl/gsttypefind.sgml b/docs/gst/tmpl/gsttypefind.sgml index eb4ab7e..d729fd0 100644 --- a/docs/gst/tmpl/gsttypefind.sgml +++ b/docs/gst/tmpl/gsttypefind.sgml @@ -14,9 +14,6 @@ typefinding subsystem - - - diff --git a/docs/gst/tmpl/gsttypefindfactory.sgml b/docs/gst/tmpl/gsttypefindfactory.sgml index 0ec2797..9aea96a 100644 --- a/docs/gst/tmpl/gsttypefindfactory.sgml +++ b/docs/gst/tmpl/gsttypefindfactory.sgml @@ -67,9 +67,6 @@ the given data. You can get quite a bit more complicated than that though. Writing typefind functions - - - Object that stores information about a typefind function diff --git a/docs/gst/tmpl/gsttypes.sgml b/docs/gst/tmpl/gsttypes.sgml index 58aaf1f..c83b048 100644 --- a/docs/gst/tmpl/gsttypes.sgml +++ b/docs/gst/tmpl/gsttypes.sgml @@ -14,9 +14,6 @@ various global enums and constants - - - These contants describe the state a #GstElement is in and transition scheduled for the #GstElement (the pending state). diff --git a/docs/gst/tmpl/gsturihandler.sgml b/docs/gst/tmpl/gsturihandler.sgml index 7a3b021..fb5512f 100644 --- a/docs/gst/tmpl/gsturihandler.sgml +++ b/docs/gst/tmpl/gsturihandler.sgml @@ -15,9 +15,6 @@ and the element property that can handle a given URI. - - - diff --git a/docs/gst/tmpl/gsturitype.sgml b/docs/gst/tmpl/gsturitype.sgml index 1c2391c..99e0afc 100644 --- a/docs/gst/tmpl/gsturitype.sgml +++ b/docs/gst/tmpl/gsturitype.sgml @@ -14,9 +14,6 @@ describes URI types - - - diff --git a/docs/gst/tmpl/gstutils.sgml b/docs/gst/tmpl/gstutils.sgml index 6d7d55a..44b2c6d 100644 --- a/docs/gst/tmpl/gstutils.sgml +++ b/docs/gst/tmpl/gstutils.sgml @@ -14,9 +14,6 @@ various utility functions - - - diff --git a/docs/gst/tmpl/gstvalue.sgml b/docs/gst/tmpl/gstvalue.sgml index 72251a3..ae47d26 100644 --- a/docs/gst/tmpl/gstvalue.sgml +++ b/docs/gst/tmpl/gstvalue.sgml @@ -14,9 +14,6 @@ GValue implementations specific to GStreamer - - - will transform four characters into a host-endiannness guint32 fourcc: diff --git a/docs/gst/tmpl/gstversion.sgml b/docs/gst/tmpl/gstversion.sgml index 4a17d3c..d6bcdfc 100644 --- a/docs/gst/tmpl/gstversion.sgml +++ b/docs/gst/tmpl/gstversion.sgml @@ -15,9 +15,6 @@ The version macros get defined by including "gst/gst.h". - - - The major version of GStreamer at compile time diff --git a/docs/gst/tmpl/gstxml.sgml b/docs/gst/tmpl/gstxml.sgml index 4ae6709..056f62e 100644 --- a/docs/gst/tmpl/gstxml.sgml +++ b/docs/gst/tmpl/gstxml.sgml @@ -14,9 +14,6 @@ XML save/restore operations of pipelines - - - diff --git a/docs/libs/tmpl/gstdataprotocol.sgml b/docs/libs/tmpl/gstdataprotocol.sgml index 1bb87c8..0cd1515 100644 --- a/docs/libs/tmpl/gstdataprotocol.sgml +++ b/docs/libs/tmpl/gstdataprotocol.sgml @@ -27,9 +27,6 @@ network connections also need a protocol to do this. #GstBuffer, #GstCaps, #GstEvent - - - diff --git a/docs/libs/tmpl/gstgetbits.sgml b/docs/libs/tmpl/gstgetbits.sgml index e3e087a..1d107d6 100644 --- a/docs/libs/tmpl/gstgetbits.sgml +++ b/docs/libs/tmpl/gstgetbits.sgml @@ -14,9 +14,6 @@ accelerated routines for getting bits from a data stream. - - - diff --git a/tests/check/elements/gstfakesrc.c b/tests/check/elements/gstfakesrc.c index febebea..e121684 100644 --- a/tests/check/elements/gstfakesrc.c +++ b/tests/check/elements/gstfakesrc.c @@ -57,7 +57,8 @@ event_func (GstPad * pad, GstEvent * event) return FALSE; } -GST_START_TEST (test_num_buffers) +GstElement * +setup_fakesrc () { GstElement *src; GstPad *srcpad, *sinkpad; @@ -70,8 +71,6 @@ GST_START_TEST (test_num_buffers) "sink"); fail_if (sinkpad == NULL, "Could not create a sinkpad"); - g_object_set (G_OBJECT (src), "num-buffers", 3, NULL); - srcpad = gst_element_get_pad (src, "src"); fail_if (srcpad == NULL, "Could not get source pad from fakesrc"); gst_pad_set_caps (sinkpad, NULL); @@ -80,7 +79,41 @@ GST_START_TEST (test_num_buffers) fail_unless (gst_pad_link (srcpad, sinkpad) == GST_PAD_LINK_OK, "Could not link source and sink pads"); + return src; +} + +void +cleanup_fakesrc (GstElement * src) +{ + GstPad *srcpad, *sinkpad; + + fail_unless (gst_element_set_state (src, GST_STATE_NULL) == GST_STATE_SUCCESS, + "could not set to null"); + + srcpad = gst_element_get_pad (src, "src"); + sinkpad = gst_pad_get_peer (srcpad); + + ASSERT_OBJECT_REFCOUNT (src, "src", 1); + gst_object_unref (src); + + gst_pad_unlink (srcpad, sinkpad); + + /* pad refs held by both creator and this function (through _get) */ + ASSERT_OBJECT_REFCOUNT (srcpad, "srcpad", 2); + gst_object_unref (srcpad); + gst_object_unref (srcpad); + + ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 2); + gst_object_unref (sinkpad); + gst_object_unref (sinkpad); +} + +GST_START_TEST (test_num_buffers) +{ + GstElement *src; + src = setup_fakesrc (); + g_object_set (G_OBJECT (src), "num-buffers", 3, NULL); fail_unless (gst_element_set_state (src, GST_STATE_PLAYING) == GST_STATE_SUCCESS, "could not set to playing"); @@ -93,15 +126,118 @@ GST_START_TEST (test_num_buffers) g_list_free (buffers); /* cleanup */ - fail_unless (gst_element_set_state (src, GST_STATE_NULL) == GST_STATE_SUCCESS, - "could not set to null"); + cleanup_fakesrc (src); +} - gst_object_unref (src); - gst_object_unref (sinkpad); +GST_END_TEST; + +GST_START_TEST (test_sizetype_empty) +{ + GstElement *src; + GList *l; + + src = setup_fakesrc (); + + g_object_set (G_OBJECT (src), "sizetype", 1, NULL); + g_object_set (G_OBJECT (src), "num-buffers", 100, NULL); + + fail_unless (gst_element_set_state (src, + GST_STATE_PLAYING) == GST_STATE_SUCCESS, "could not set to playing"); + + while (!have_eos) { + g_usleep (1000); + } + + fail_unless (g_list_length (buffers) == 100); + l = buffers; + while (l) { + GstBuffer *buf = l->data; + + fail_unless (GST_BUFFER_SIZE (buf) == 0); + l = l->next; + } + g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL); + g_list_free (buffers); + + /* cleanup */ + cleanup_fakesrc (src); +} + +GST_END_TEST; + +GST_START_TEST (test_sizetype_fixed) +{ + GstElement *src; + GList *l; + + src = setup_fakesrc (); + + g_object_set (G_OBJECT (src), "sizetype", 2, NULL); + g_object_set (G_OBJECT (src), "sizemax", 8192, NULL); + g_object_set (G_OBJECT (src), "num-buffers", 100, NULL); + + fail_unless (gst_element_set_state (src, + GST_STATE_PLAYING) == GST_STATE_SUCCESS, "could not set to playing"); + + while (!have_eos) { + g_usleep (1000); + } + + fail_unless (g_list_length (buffers) == 100); + l = buffers; + while (l) { + GstBuffer *buf = l->data; + + fail_unless (GST_BUFFER_SIZE (buf) == 8192); + l = l->next; + } + g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL); + g_list_free (buffers); + + /* cleanup */ + cleanup_fakesrc (src); } GST_END_TEST; +GST_START_TEST (test_sizetype_random) +{ + GstElement *src; + GList *l; + + src = setup_fakesrc (); + + g_object_set (G_OBJECT (src), "sizetype", 3, NULL); + g_object_set (G_OBJECT (src), "sizemin", 4096, NULL); + g_object_set (G_OBJECT (src), "sizemax", 8192, NULL); + g_object_set (G_OBJECT (src), "num-buffers", 100, NULL); + + fail_unless (gst_element_set_state (src, + GST_STATE_PLAYING) == GST_STATE_SUCCESS, "could not set to playing"); + + while (!have_eos) { + g_usleep (1000); + } + + fail_unless (g_list_length (buffers) == 100); + l = buffers; + while (l) { + GstBuffer *buf = l->data; + + fail_if (GST_BUFFER_SIZE (buf) > 8192); + fail_if (GST_BUFFER_SIZE (buf) < 4096); + l = l->next; + } + g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL); + g_list_free (buffers); + + /* cleanup */ + cleanup_fakesrc (src); +} + +GST_END_TEST; + + Suite * fakesrc_suite (void) { @@ -110,6 +246,9 @@ fakesrc_suite (void) suite_add_tcase (s, tc_chain); tcase_add_test (tc_chain, test_num_buffers); + tcase_add_test (tc_chain, test_sizetype_empty); + tcase_add_test (tc_chain, test_sizetype_fixed); + tcase_add_test (tc_chain, test_sizetype_random); return s; } -- 2.7.4