add sizetype tests for fakesrc
authorThomas Vander Stichele <thomas@apestaart.org>
Fri, 5 Aug 2005 06:55:03 +0000 (06:55 +0000)
committerThomas Vander Stichele <thomas@apestaart.org>
Fri, 5 Aug 2005 06:55:03 +0000 (06:55 +0000)
Original commit message from CVS:
add sizetype tests for fakesrc

62 files changed:
ChangeLog
check/elements/gstfakesrc.c
docs/gst/tmpl/gst.sgml
docs/gst/tmpl/gstbasesink.sgml
docs/gst/tmpl/gstbasesrc.sgml
docs/gst/tmpl/gstbasetransform.sgml
docs/gst/tmpl/gstbin.sgml
docs/gst/tmpl/gstbuffer.sgml
docs/gst/tmpl/gstcaps.sgml
docs/gst/tmpl/gstclock.sgml
docs/gst/tmpl/gstcompat.sgml
docs/gst/tmpl/gstconfig.sgml
docs/gst/tmpl/gstelement.sgml
docs/gst/tmpl/gstelementdetails.sgml
docs/gst/tmpl/gstelementfactory.sgml
docs/gst/tmpl/gstenumtypes.sgml
docs/gst/tmpl/gsterror.sgml
docs/gst/tmpl/gstevent.sgml
docs/gst/tmpl/gstfakesink.sgml
docs/gst/tmpl/gstfakesrc.sgml
docs/gst/tmpl/gstfilesink.sgml
docs/gst/tmpl/gstfilesrc.sgml
docs/gst/tmpl/gstfilter.sgml
docs/gst/tmpl/gstformat.sgml
docs/gst/tmpl/gstghostpad.sgml
docs/gst/tmpl/gstimplementsinterface.sgml
docs/gst/tmpl/gstindex.sgml
docs/gst/tmpl/gstindexfactory.sgml
docs/gst/tmpl/gstinfo.sgml
docs/gst/tmpl/gstiterator.sgml
docs/gst/tmpl/gstmacros.sgml
docs/gst/tmpl/gstmemchunk.sgml
docs/gst/tmpl/gstminiobject.sgml
docs/gst/tmpl/gstobject.sgml
docs/gst/tmpl/gstpad.sgml
docs/gst/tmpl/gstpadtemplate.sgml
docs/gst/tmpl/gstparse.sgml
docs/gst/tmpl/gstpipeline.sgml
docs/gst/tmpl/gstplugin.sgml
docs/gst/tmpl/gstpluginfeature.sgml
docs/gst/tmpl/gstquery.sgml
docs/gst/tmpl/gstqueue.sgml
docs/gst/tmpl/gstregistry.sgml
docs/gst/tmpl/gstregistrypool.sgml
docs/gst/tmpl/gststructure.sgml
docs/gst/tmpl/gstsystemclock.sgml
docs/gst/tmpl/gsttaglist.sgml
docs/gst/tmpl/gsttagsetter.sgml
docs/gst/tmpl/gsttrace.sgml
docs/gst/tmpl/gsttrashstack.sgml
docs/gst/tmpl/gsttypefind.sgml
docs/gst/tmpl/gsttypefindfactory.sgml
docs/gst/tmpl/gsttypes.sgml
docs/gst/tmpl/gsturihandler.sgml
docs/gst/tmpl/gsturitype.sgml
docs/gst/tmpl/gstutils.sgml
docs/gst/tmpl/gstvalue.sgml
docs/gst/tmpl/gstversion.sgml
docs/gst/tmpl/gstxml.sgml
docs/libs/tmpl/gstdataprotocol.sgml
docs/libs/tmpl/gstgetbits.sgml
tests/check/elements/gstfakesrc.c

index cf978be..0da40db 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-08-05  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * check/elements/gstfakesrc.c: (setup_fakesrc), (cleanup_fakesrc),
+       (GST_START_TEST), (fakesrc_suite):
+         add tests for sizetype
+
 2005-08-04  Andy Wingo  <wingo@pobox.com>
 
        * gst/elements/gstcapsfilter.c: Reimplement using basetransform,
index febebea..e121684 100644 (file)
@@ -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;
 }
index fc6631a..eb88667 100644 (file)
@@ -87,9 +87,6 @@ Check out both <ulink url="http://www.cse.ogi.edu/sysl/">OGI's
 pipeline</ulink> and Microsoft's DirectShow for some background.
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### FUNCTION gst_init ##### -->
 <para>
 
index 429222d..4ba69f2 100644 (file)
@@ -14,9 +14,6 @@ GstBaseSink
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GstBaseSink ##### -->
 <para>
 
index ada1af9..5b06188 100644 (file)
@@ -14,9 +14,6 @@ GstBaseSrc
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GstBaseSrc ##### -->
 <para>
 
index 4ae5603..d566f39 100644 (file)
@@ -14,9 +14,6 @@ GstBaseTransform
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GstBaseTransform ##### -->
 <para>
 
index 18938a4..2007814 100644 (file)
@@ -55,9 +55,6 @@ clock providers in the bin.
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GstBin ##### -->
 <para>
 
index 08d3c89..a8c176f 100644 (file)
@@ -85,9 +85,6 @@ Last reviewed on August 12th, 2004 (0.8.5)
 #GstPad, #GstMiniObject
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GstBuffer ##### -->
 <para>
 The basic structure of a buffer.
index fdc72d3..25ad066 100644 (file)
@@ -14,9 +14,6 @@ Structure describing sets of media formats
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GstCaps ##### -->
 <para>
 
index 231085a..052fe05 100644 (file)
@@ -22,9 +22,6 @@ a good measure of the current playback time in the pipeline.
 #GstSystemClock
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GstClock ##### -->
 <para>
 
index 402c11c..16c29cd 100644 (file)
@@ -16,6 +16,3 @@ This can be done in CFLAGS for compiling old code.
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
index 6e71764..ed05367 100644 (file)
@@ -37,9 +37,6 @@ If a subsystem is disabled in GStreamer, a value is defined in
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### MACRO GST_DISABLE_LOADSAVE_REGISTRY ##### -->
 <para>
 
index 703e7dd..4708c06 100644 (file)
@@ -65,9 +65,6 @@ and gst_element_set_clock().  You can wait for the clock to reach a given
 
 <!-- basic object functions -->
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GstElement ##### -->
 <para>
 
index 757ebbc..8c57fce 100644 (file)
@@ -14,9 +14,6 @@ Defines public information about a #GstElement
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GstElementDetails ##### -->
 <para>
 This struct is used to define public information about the element.  It
index c68b5b4..5e74564 100644 (file)
@@ -54,9 +54,6 @@ so that the autopluggers can select a plugin more appropriatly
 #GstElement, #GstPlugin, #GstPluginFeature, #GstPadTemplate.
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GstElementFactory ##### -->
 <para>
 
index 52ba68c..e9361f1 100644 (file)
@@ -14,6 +14,3 @@ all gstreamer core related enumerations
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
index 3b972c3..11701fc 100644 (file)
@@ -14,9 +14,6 @@ Categorized error messages
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### ENUM GstCoreError ##### -->
 <para>
 
index 4872e40..66277de 100644 (file)
@@ -27,9 +27,6 @@ gst_event_new_flush() creates a new flush event.
 #GstPad, #GstElement
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GstEvent ##### -->
 <para>
 
index bbf1d94..7755271 100644 (file)
@@ -14,9 +14,6 @@ GstFakeSink
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GstFakeSink ##### -->
 <para>
 
index ae77999..ad63acc 100644 (file)
@@ -14,9 +14,6 @@ GstFakeSrc
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GstFakeSrc ##### -->
 <para>
 
@@ -41,6 +38,7 @@ GstFakeSrc
 @:
 @:
 @:
+@:
 @: 
 
 <!-- ##### ARG GstFakeSrc:data ##### -->
index 9ec2717..e3bd8dd 100644 (file)
@@ -14,9 +14,6 @@ GstFileSink
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GstFileSink ##### -->
 <para>
 
index 806b545..e7d7274 100644 (file)
@@ -14,9 +14,6 @@ GstFileSrc
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GstFileSrc ##### -->
 <para>
 
index 49932ee..8f5a2fe 100644 (file)
@@ -17,9 +17,6 @@ on its own.
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### USER_FUNCTION GstFilterFunc ##### -->
 <para>
 
index ae7b43d..99d947e 100644 (file)
@@ -15,9 +15,6 @@ formats can be used to perform seeking or conversions/query operations.
 #GstPad, #GstElement
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### ENUM GstFormat ##### -->
 <para>
 Standard predefined formats
index b92fdbd..520c300 100644 (file)
@@ -14,9 +14,6 @@ Pseudo link pads
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GstGhostPad ##### -->
 <para>
 
index df7fb5f..5683450 100644 (file)
@@ -14,9 +14,6 @@ Core interface implemented by #GstElements that allows runtime querying of inter
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GstImplementsInterface ##### -->
 <para>
 
index 1eac0ee..74254d5 100644 (file)
@@ -15,9 +15,6 @@ in a pipeline.
 #GstIndexFactory
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GstIndex ##### -->
 <para>
 
index 7c86974..f458efd 100644 (file)
@@ -14,9 +14,6 @@ GstIndexFactory is used to dynamically create GstIndex implementations.
 #GstIndex
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GstIndexFactory ##### -->
 <para>
 The GstIndexFactory object
index d2d2d58..be07e23 100644 (file)
@@ -68,9 +68,6 @@ categories. These are explained at GST_DEBUG_CATEGORY_INIT().
 and environment variables that affect the debugging output.
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### ENUM GstDebugLevel ##### -->
 <para>
 The level defines the importance of a debugging message. The more important a 
index 9bc68df..307d499 100644 (file)
@@ -14,9 +14,6 @@ GstIterator
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GstIterator ##### -->
 <para>
 
index 8149bca..49b0cc6 100644 (file)
@@ -14,6 +14,3 @@ various portabillity helper macros
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
index 8ce3af2..af74215 100644 (file)
@@ -21,9 +21,6 @@ The GstMemChunk is used to allocate critical resources for #GstBuffer and
 #GstBuffer, #GstEvent, #GstData
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GstMemChunk ##### -->
 <para>
 The memchunk structure
index ff0a8f1..5481e39 100644 (file)
@@ -14,9 +14,6 @@ GstMiniObject
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GstMiniObject ##### -->
 <para>
 
index 583afec..ab9e443 100644 (file)
@@ -67,9 +67,6 @@ object.
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GstObject ##### -->
 <para>
 
index fa5a64d..d215a3d 100644 (file)
@@ -57,9 +57,6 @@ Last reviewed on December 13th, 2002 (0.5.0.1)
 #GstPadTemplate, #GstElement, #GstEvent
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GstPad ##### -->
 <para>
 
index 060a3d1..1ff9a28 100644 (file)
@@ -73,9 +73,6 @@ The following example shows you how to add the padtemplate to an elementfactory:
 #GstPad, #GstElementFactory
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GstPadTemplate ##### -->
 <para>
 The padtemplate object.
index e43a2da..5b70820 100644 (file)
@@ -14,9 +14,6 @@ get a pipeline from a text pipeline description
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### FUNCTION gst_parse_error_quark ##### -->
 <para>
 
index 74912fa..bbd6ecd 100644 (file)
@@ -21,9 +21,6 @@ the pipeline, use gst_object_unref() to free its resources.
 #GstBin
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GstPipeline ##### -->
 <para>
 
index 17a0ae7..cd93138 100644 (file)
@@ -35,9 +35,6 @@ to bring the plugin into memory.
 #GstPluginFeature, #GstType, #GstAutoplug, #GstElementFactory
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### FUNCTION gst_plugin_error_quark ##### -->
 <para>
 Get the error quark
index 96a2e5e..6395293 100644 (file)
@@ -14,9 +14,6 @@ This is a base class for anything that can be added to a #GstPlugin.
 #GstPlugin
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GstPluginFeature ##### -->
 <para>
 
index 3fcf8be..ed0755b 100644 (file)
@@ -15,9 +15,6 @@ Query types can be used to perform queries on pads and elements.
 #GstPad, #GstElement
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### ENUM GstQueryType ##### -->
 <para>
 Standard predefined Query types
index 3d2a500..71ce9c5 100644 (file)
@@ -25,9 +25,6 @@ The queue blocks by default.
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GstQueue ##### -->
 <para>
 
index be6b381..a554aee 100644 (file)
@@ -15,6 +15,3 @@ All registries build the #GstRegistryPool.
 #GstPlugin, #GstPluginFeature
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
index 99de4f9..82b21c6 100644 (file)
@@ -15,9 +15,6 @@ the system.
 GstRegistry
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### FUNCTION gst_registry_pool_list ##### -->
 <para>
 
index 14fd72e..7bbb0bf 100644 (file)
@@ -14,9 +14,6 @@ Generic structure containing fields of names and values
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GstStructure ##### -->
 <para>
 
index 71c56fd..714c32c 100644 (file)
@@ -15,9 +15,6 @@ system time.
 #GstClock
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GstSystemClock ##### -->
 <para>
 
index b45b446..6dc2830 100644 (file)
@@ -14,9 +14,6 @@ List of tags and values used to describe media metadata
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### TYPEDEF GstTagList ##### -->
 <para>
 
index d80b667..4c55270 100644 (file)
@@ -14,9 +14,6 @@ Element interface that allows setting and retrieval of media metadata
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GstTagSetter ##### -->
 <para>
 
index b08a807..6ccaa79 100644 (file)
@@ -14,9 +14,6 @@ Tracing functionality
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GstTrace ##### -->
 <para>
 
index 27eeeeb..81bb80f 100644 (file)
@@ -14,9 +14,6 @@ gsttrashstack
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GstTrashStack ##### -->
 <para>
 
index eb4ab7e..d729fd0 100644 (file)
@@ -14,9 +14,6 @@ typefinding subsystem
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GstTypeFind ##### -->
 <para>
 
index 0ec2797..9aea96a 100644 (file)
@@ -67,9 +67,6 @@ the given data. You can get quite a bit more complicated than that though.
 <link linkend="gstreamer-Writing-typefind-functions">Writing typefind functions</link>
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GstTypeFindFactory ##### -->
 <para>
 Object that stores information about a typefind function
index 58aaf1f..c83b048 100644 (file)
@@ -14,9 +14,6 @@ various global enums and constants
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### ENUM GstElementState ##### -->
 <para>
 These contants describe the state a #GstElement is in and transition scheduled for the #GstElement (the pending state).
index 7a3b021..fb5512f 100644 (file)
@@ -15,9 +15,6 @@ and the element property that can handle a given URI.
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GstURIHandler ##### -->
 <para>
 
index 1c2391c..99e0afc 100644 (file)
@@ -14,9 +14,6 @@ describes URI types
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### ENUM GstURIType ##### -->
 <para>
 
index 6d7d55a..44b2c6d 100644 (file)
@@ -14,9 +14,6 @@ various utility functions
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### FUNCTION gst_util_set_value_from_string ##### -->
 <para>
 
index 72251a3..ae47d26 100644 (file)
@@ -14,9 +14,6 @@ GValue implementations specific to GStreamer
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### MACRO GST_MAKE_FOURCC ##### -->
 <para>
 will transform four characters into a host-endiannness guint32 fourcc:
index 4a17d3c..d6bcdfc 100644 (file)
@@ -15,9 +15,6 @@ The version macros get defined by including "gst/gst.h".
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### MACRO GST_VERSION_MAJOR ##### -->
 <para>
 The major version of GStreamer at compile time
index 4ae6709..056f62e 100644 (file)
@@ -14,9 +14,6 @@ XML save/restore operations of pipelines
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT GstXML ##### -->
 <para>
 
index 1bb87c8..0cd1515 100644 (file)
@@ -27,9 +27,6 @@ network connections also need a protocol to do this.
 #GstBuffer, #GstCaps, #GstEvent
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### ENUM GstDPHeaderFlag ##### -->
 <para>
 
index e3e087a..1d107d6 100644 (file)
@@ -14,9 +14,6 @@ accelerated routines for getting bits from a data stream.
 
 </para>
 
-<!-- ##### SECTION Stability_Level ##### -->
-
-
 <!-- ##### STRUCT gst_getbits_t ##### -->
 <para>
 
index febebea..e121684 100644 (file)
@@ -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;
 }