diff --git a/common b/common index 4edc214072..d1911d4b3d 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 4edc214072fe07d2aade96bc336493425654d7b4 +Subproject commit d1911d4b3d6267f9cd9dfb68fcef2afe4d098092 diff --git a/docs/gst/tmpl/gst.sgml b/docs/gst/tmpl/gst.sgml index 7d5a9b5bee..7bb76bbe7c 100644 --- a/docs/gst/tmpl/gst.sgml +++ b/docs/gst/tmpl/gst.sgml @@ -87,6 +87,9 @@ Check out both OGI's pipeline and Microsoft's DirectShow for some background. + + + diff --git a/docs/gst/tmpl/gstatomic.sgml b/docs/gst/tmpl/gstatomic.sgml index 700218c83c..acf82a1fd4 100644 --- a/docs/gst/tmpl/gstatomic.sgml +++ b/docs/gst/tmpl/gstatomic.sgml @@ -19,6 +19,9 @@ as external methods. #GstMemChunk + + + diff --git a/docs/gst/tmpl/gstbin.sgml b/docs/gst/tmpl/gstbin.sgml index 933d0113e2..1b153dafdd 100644 --- a/docs/gst/tmpl/gstbin.sgml +++ b/docs/gst/tmpl/gstbin.sgml @@ -55,6 +55,9 @@ clock providers in the bin. + + + diff --git a/docs/gst/tmpl/gstbuffer.sgml b/docs/gst/tmpl/gstbuffer.sgml index 56000aaafd..7a67c02557 100644 --- a/docs/gst/tmpl/gstbuffer.sgml +++ b/docs/gst/tmpl/gstbuffer.sgml @@ -84,6 +84,9 @@ Last reviewed on August 12th, 2004 (0.8.5) #GstBufferPool, #GstPad, #GstData + + + The basic structure of a buffer. diff --git a/docs/gst/tmpl/gstcaps.sgml b/docs/gst/tmpl/gstcaps.sgml index 39812d240e..c52205b19c 100644 --- a/docs/gst/tmpl/gstcaps.sgml +++ b/docs/gst/tmpl/gstcaps.sgml @@ -14,6 +14,9 @@ Structure describing sets of media formats + + + Flags that this caps has no specific content, but can contain anything. diff --git a/docs/gst/tmpl/gstchildproxy.sgml b/docs/gst/tmpl/gstchildproxy.sgml index 6c579e84e4..c1f3ba4362 100644 --- a/docs/gst/tmpl/gstchildproxy.sgml +++ b/docs/gst/tmpl/gstchildproxy.sgml @@ -14,6 +14,9 @@ GstChildProxy + + + diff --git a/docs/gst/tmpl/gstclock.sgml b/docs/gst/tmpl/gstclock.sgml index e53ff15730..02e209c72d 100644 --- a/docs/gst/tmpl/gstclock.sgml +++ b/docs/gst/tmpl/gstclock.sgml @@ -21,6 +21,9 @@ clock so that the clock is always a good measure of the time in the pipeline. #GstSystemClock + + + diff --git a/docs/gst/tmpl/gstcompat.sgml b/docs/gst/tmpl/gstcompat.sgml index ba67b5bd3a..ce5e793830 100644 --- a/docs/gst/tmpl/gstcompat.sgml +++ b/docs/gst/tmpl/gstcompat.sgml @@ -15,3 +15,6 @@ One would have to add this to the CFLAGS when compiling old code. + + + diff --git a/docs/gst/tmpl/gstconfig.sgml b/docs/gst/tmpl/gstconfig.sgml index b73394c8f4..a0a2d96e04 100644 --- a/docs/gst/tmpl/gstconfig.sgml +++ b/docs/gst/tmpl/gstconfig.sgml @@ -37,6 +37,9 @@ If a subsystem is disabled in GStreamer, a value is defined in + + + diff --git a/docs/gst/tmpl/gstcpu.sgml b/docs/gst/tmpl/gstcpu.sgml index d374782ab5..1cbace40f1 100644 --- a/docs/gst/tmpl/gstcpu.sgml +++ b/docs/gst/tmpl/gstcpu.sgml @@ -19,6 +19,9 @@ You'll get a bitmask of flags with gst_cpu_get_flags(). + + + Flags that represent cpu capabilities diff --git a/docs/gst/tmpl/gstdata.sgml b/docs/gst/tmpl/gstdata.sgml index dee2ae8846..d24786e5f2 100644 --- a/docs/gst/tmpl/gstdata.sgml +++ b/docs/gst/tmpl/gstdata.sgml @@ -16,6 +16,9 @@ GstData provides refcounting, freeing and copying for its child classes. #GstBuffer, #GstBufferPool, #GstEvent + + + Cast a pointer to a GstData diff --git a/docs/gst/tmpl/gstelement.sgml b/docs/gst/tmpl/gstelement.sgml index 3c746988ec..8f2f067fce 100644 --- a/docs/gst/tmpl/gstelement.sgml +++ b/docs/gst/tmpl/gstelement.sgml @@ -14,6 +14,9 @@ GstElement + + + diff --git a/docs/gst/tmpl/gstelementdetails.sgml b/docs/gst/tmpl/gstelementdetails.sgml index 0a6856e6f4..64b47651dc 100644 --- a/docs/gst/tmpl/gstelementdetails.sgml +++ b/docs/gst/tmpl/gstelementdetails.sgml @@ -14,6 +14,9 @@ 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 aac5b9f99e..05feae2dda 100644 --- a/docs/gst/tmpl/gstelementfactory.sgml +++ b/docs/gst/tmpl/gstelementfactory.sgml @@ -54,6 +54,9 @@ so that the autopluggers can select a plugin more appropriatly #GstElement, #GstPlugin, #GstPluginFeature, #GstPadTemplate. + + + diff --git a/docs/gst/tmpl/gsterror.sgml b/docs/gst/tmpl/gsterror.sgml index 661024e5fc..0bb265f1b5 100644 --- a/docs/gst/tmpl/gsterror.sgml +++ b/docs/gst/tmpl/gsterror.sgml @@ -14,6 +14,9 @@ Categorized error messages + + + diff --git a/docs/gst/tmpl/gstevent.sgml b/docs/gst/tmpl/gstevent.sgml index 1dcba86d2c..7a8683ad50 100644 --- a/docs/gst/tmpl/gstevent.sgml +++ b/docs/gst/tmpl/gstevent.sgml @@ -27,6 +27,9 @@ gst_event_new_flush() creates a new flush event. #GstPad, #GstElement + + + diff --git a/docs/gst/tmpl/gstfilter.sgml b/docs/gst/tmpl/gstfilter.sgml index 8f5a2fea6f..49932eec1a 100644 --- a/docs/gst/tmpl/gstfilter.sgml +++ b/docs/gst/tmpl/gstfilter.sgml @@ -17,6 +17,9 @@ on its own. + + + diff --git a/docs/gst/tmpl/gstformat.sgml b/docs/gst/tmpl/gstformat.sgml index 6b21fedbdd..73554bbf56 100644 --- a/docs/gst/tmpl/gstformat.sgml +++ b/docs/gst/tmpl/gstformat.sgml @@ -15,6 +15,9 @@ 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 10d99b3889..3a580a6a2b 100644 --- a/docs/gst/tmpl/gstghostpad.sgml +++ b/docs/gst/tmpl/gstghostpad.sgml @@ -14,6 +14,9 @@ Pseudo link pads + + + diff --git a/docs/gst/tmpl/gstimplementsinterface.sgml b/docs/gst/tmpl/gstimplementsinterface.sgml index 5683450aeb..df7fb5fbb1 100644 --- a/docs/gst/tmpl/gstimplementsinterface.sgml +++ b/docs/gst/tmpl/gstimplementsinterface.sgml @@ -14,6 +14,9 @@ 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 d65dbddbfa..ea8d0df1af 100644 --- a/docs/gst/tmpl/gstindex.sgml +++ b/docs/gst/tmpl/gstindex.sgml @@ -15,6 +15,9 @@ in a pipeline. #GstIndexFactory + + + diff --git a/docs/gst/tmpl/gstindexfactory.sgml b/docs/gst/tmpl/gstindexfactory.sgml index f458efdc31..7c86974bf3 100644 --- a/docs/gst/tmpl/gstindexfactory.sgml +++ b/docs/gst/tmpl/gstindexfactory.sgml @@ -14,6 +14,9 @@ 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 be07e23962..d2d2d58f8a 100644 --- a/docs/gst/tmpl/gstinfo.sgml +++ b/docs/gst/tmpl/gstinfo.sgml @@ -68,6 +68,9 @@ 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/gstmacros.sgml b/docs/gst/tmpl/gstmacros.sgml index 49b0cc647f..8149bca8d2 100644 --- a/docs/gst/tmpl/gstmacros.sgml +++ b/docs/gst/tmpl/gstmacros.sgml @@ -14,3 +14,6 @@ various portabillity helper macros + + + diff --git a/docs/gst/tmpl/gstmemchunk.sgml b/docs/gst/tmpl/gstmemchunk.sgml index 1d3bd10d6e..5c7eaa75ef 100644 --- a/docs/gst/tmpl/gstmemchunk.sgml +++ b/docs/gst/tmpl/gstmemchunk.sgml @@ -21,6 +21,9 @@ The GstMemChunk is used to allocate critical resources for #GstBuffer and #GstAtomic, #GstBuffer, #GstEvent, #GstData + + + The memchunk structure diff --git a/docs/gst/tmpl/gstobject.sgml b/docs/gst/tmpl/gstobject.sgml index 7e215939b7..9dbf1758b0 100644 --- a/docs/gst/tmpl/gstobject.sgml +++ b/docs/gst/tmpl/gstobject.sgml @@ -67,6 +67,9 @@ object. + + + diff --git a/docs/gst/tmpl/gstpad.sgml b/docs/gst/tmpl/gstpad.sgml index a197ae597a..6a3cffe353 100644 --- a/docs/gst/tmpl/gstpad.sgml +++ b/docs/gst/tmpl/gstpad.sgml @@ -57,6 +57,9 @@ 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 61056c3b29..2591894b68 100644 --- a/docs/gst/tmpl/gstpadtemplate.sgml +++ b/docs/gst/tmpl/gstpadtemplate.sgml @@ -73,6 +73,9 @@ 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 5b7082087a..e43a2dac2c 100644 --- a/docs/gst/tmpl/gstparse.sgml +++ b/docs/gst/tmpl/gstparse.sgml @@ -14,6 +14,9 @@ get a pipeline from a text pipeline description + + + diff --git a/docs/gst/tmpl/gstpipeline.sgml b/docs/gst/tmpl/gstpipeline.sgml index 847df88d57..bf31f2799c 100644 --- a/docs/gst/tmpl/gstpipeline.sgml +++ b/docs/gst/tmpl/gstpipeline.sgml @@ -21,6 +21,9 @@ 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 0f9fe5482c..278395f5ed 100644 --- a/docs/gst/tmpl/gstplugin.sgml +++ b/docs/gst/tmpl/gstplugin.sgml @@ -35,6 +35,9 @@ to bring the plugin into memory. #GstPluginFeature, #GstType, #GstAutoplug, #GstElementFactory + + + Get the error quark @@ -344,13 +347,12 @@ to get a list of plugins that match certain criteria. @Returns: - + -@name: -@Returns: +@plugin: @@ -361,3 +363,4 @@ to get a list of plugins that match certain criteria. @name: @Returns: + diff --git a/docs/gst/tmpl/gstpluginfeature.sgml b/docs/gst/tmpl/gstpluginfeature.sgml index 63952932fc..96a2e5e5cd 100644 --- a/docs/gst/tmpl/gstpluginfeature.sgml +++ b/docs/gst/tmpl/gstpluginfeature.sgml @@ -14,6 +14,9 @@ This is a base class for anything that can be added to a #GstPlugin. #GstPlugin + + + diff --git a/docs/gst/tmpl/gstprobe.sgml b/docs/gst/tmpl/gstprobe.sgml index cd8411c538..79616cd446 100644 --- a/docs/gst/tmpl/gstprobe.sgml +++ b/docs/gst/tmpl/gstprobe.sgml @@ -19,6 +19,9 @@ enumerate all registered probes to signal them. + + + The probe structure diff --git a/docs/gst/tmpl/gstquery.sgml b/docs/gst/tmpl/gstquery.sgml index 1e4494d502..7c5508dce8 100644 --- a/docs/gst/tmpl/gstquery.sgml +++ b/docs/gst/tmpl/gstquery.sgml @@ -15,6 +15,9 @@ 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 71ce9c54d9..3d2a500a26 100644 --- a/docs/gst/tmpl/gstqueue.sgml +++ b/docs/gst/tmpl/gstqueue.sgml @@ -25,6 +25,9 @@ The queue blocks by default. + + + diff --git a/docs/gst/tmpl/gstrealpad.sgml b/docs/gst/tmpl/gstrealpad.sgml index 94cf055c36..e0624348db 100644 --- a/docs/gst/tmpl/gstrealpad.sgml +++ b/docs/gst/tmpl/gstrealpad.sgml @@ -14,3 +14,6 @@ Real link pads + + + diff --git a/docs/gst/tmpl/gstregistry.sgml b/docs/gst/tmpl/gstregistry.sgml index ac1a7336e2..94696898b9 100644 --- a/docs/gst/tmpl/gstregistry.sgml +++ b/docs/gst/tmpl/gstregistry.sgml @@ -15,6 +15,9 @@ All registries build the #GstRegistryPool. #GstPlugin, #GstPluginFeature + + + diff --git a/docs/gst/tmpl/gstregistrypool.sgml b/docs/gst/tmpl/gstregistrypool.sgml index 82b21c6f2e..99de4f98c9 100644 --- a/docs/gst/tmpl/gstregistrypool.sgml +++ b/docs/gst/tmpl/gstregistrypool.sgml @@ -15,6 +15,9 @@ the system. GstRegistry + + + diff --git a/docs/gst/tmpl/gstscheduler.sgml b/docs/gst/tmpl/gstscheduler.sgml index bb737169d4..2d76954999 100644 --- a/docs/gst/tmpl/gstscheduler.sgml +++ b/docs/gst/tmpl/gstscheduler.sgml @@ -14,6 +14,9 @@ This is a base class for custom schedulers. + + + diff --git a/docs/gst/tmpl/gstschedulerfactory.sgml b/docs/gst/tmpl/gstschedulerfactory.sgml index a9a53134d5..bda06b070d 100644 --- a/docs/gst/tmpl/gstschedulerfactory.sgml +++ b/docs/gst/tmpl/gstschedulerfactory.sgml @@ -31,6 +31,9 @@ Use gst_scheduler_factory_destroy() to remove the factory from the global list. + + + diff --git a/docs/gst/tmpl/gststructure.sgml b/docs/gst/tmpl/gststructure.sgml index a0b2b7eab4..af31c9c8b3 100644 --- a/docs/gst/tmpl/gststructure.sgml +++ b/docs/gst/tmpl/gststructure.sgml @@ -14,6 +14,9 @@ Generic structure containing fields of names and values + + + diff --git a/docs/gst/tmpl/gstsystemclock.sgml b/docs/gst/tmpl/gstsystemclock.sgml index 1f5f6ebf0b..cbe61a5dca 100644 --- a/docs/gst/tmpl/gstsystemclock.sgml +++ b/docs/gst/tmpl/gstsystemclock.sgml @@ -15,6 +15,9 @@ system time. #GstClock + + + diff --git a/docs/gst/tmpl/gsttaglist.sgml b/docs/gst/tmpl/gsttaglist.sgml index 607fd4fcf8..e6b2a065d5 100644 --- a/docs/gst/tmpl/gsttaglist.sgml +++ b/docs/gst/tmpl/gsttaglist.sgml @@ -14,6 +14,9 @@ GstTagList + + + diff --git a/docs/gst/tmpl/gsttagsetter.sgml b/docs/gst/tmpl/gsttagsetter.sgml index 4c55270c64..d80b667cf6 100644 --- a/docs/gst/tmpl/gsttagsetter.sgml +++ b/docs/gst/tmpl/gsttagsetter.sgml @@ -14,6 +14,9 @@ Element interface that allows setting and retrieval of media metadata + + + diff --git a/docs/gst/tmpl/gstthread.sgml b/docs/gst/tmpl/gstthread.sgml index 53de65a449..9f4702069d 100644 --- a/docs/gst/tmpl/gstthread.sgml +++ b/docs/gst/tmpl/gstthread.sgml @@ -18,6 +18,9 @@ A Thread can act as a toplevel bin as it has its own scheduler. #GstBin, #GstPipeline + + + diff --git a/docs/gst/tmpl/gsttrace.sgml b/docs/gst/tmpl/gsttrace.sgml index 6ccaa7925c..b08a8079f9 100644 --- a/docs/gst/tmpl/gsttrace.sgml +++ b/docs/gst/tmpl/gsttrace.sgml @@ -14,6 +14,9 @@ Tracing functionality + + + diff --git a/docs/gst/tmpl/gsttrashstack.sgml b/docs/gst/tmpl/gsttrashstack.sgml index 81bb80fdc3..27eeeeb113 100644 --- a/docs/gst/tmpl/gsttrashstack.sgml +++ b/docs/gst/tmpl/gsttrashstack.sgml @@ -14,6 +14,9 @@ gsttrashstack + + + diff --git a/docs/gst/tmpl/gsttypefind.sgml b/docs/gst/tmpl/gsttypefind.sgml index d729fd0487..eb4ab7eb09 100644 --- a/docs/gst/tmpl/gsttypefind.sgml +++ b/docs/gst/tmpl/gsttypefind.sgml @@ -14,6 +14,9 @@ typefinding subsystem + + + diff --git a/docs/gst/tmpl/gsttypefindfactory.sgml b/docs/gst/tmpl/gsttypefindfactory.sgml index 9aea96a320..0ec2797535 100644 --- a/docs/gst/tmpl/gsttypefindfactory.sgml +++ b/docs/gst/tmpl/gsttypefindfactory.sgml @@ -67,6 +67,9 @@ 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 75548b547c..66498bb328 100644 --- a/docs/gst/tmpl/gsttypes.sgml +++ b/docs/gst/tmpl/gsttypes.sgml @@ -14,6 +14,9 @@ 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 fb5512f4bb..7a3b021117 100644 --- a/docs/gst/tmpl/gsturihandler.sgml +++ b/docs/gst/tmpl/gsturihandler.sgml @@ -15,6 +15,9 @@ 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 99e0afcb1b..1c2391cf6d 100644 --- a/docs/gst/tmpl/gsturitype.sgml +++ b/docs/gst/tmpl/gsturitype.sgml @@ -14,6 +14,9 @@ describes URI types + + + diff --git a/docs/gst/tmpl/gstutils.sgml b/docs/gst/tmpl/gstutils.sgml index 44b2c6dae0..6d7d55a386 100644 --- a/docs/gst/tmpl/gstutils.sgml +++ b/docs/gst/tmpl/gstutils.sgml @@ -14,6 +14,9 @@ various utility functions + + + diff --git a/docs/gst/tmpl/gstvalue.sgml b/docs/gst/tmpl/gstvalue.sgml index 26bfc0c51d..97e3caa792 100644 --- a/docs/gst/tmpl/gstvalue.sgml +++ b/docs/gst/tmpl/gstvalue.sgml @@ -14,6 +14,9 @@ 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 d6bcdfcef2..4a17d3cc52 100644 --- a/docs/gst/tmpl/gstversion.sgml +++ b/docs/gst/tmpl/gstversion.sgml @@ -15,6 +15,9 @@ 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 056f62e03e..4ae6709065 100644 --- a/docs/gst/tmpl/gstxml.sgml +++ b/docs/gst/tmpl/gstxml.sgml @@ -14,6 +14,9 @@ XML save/restore operations of pipelines + + + diff --git a/docs/libs/tmpl/gstbytestream.sgml b/docs/libs/tmpl/gstbytestream.sgml index 48660ff0bc..f6401e05c2 100644 --- a/docs/libs/tmpl/gstbytestream.sgml +++ b/docs/libs/tmpl/gstbytestream.sgml @@ -14,6 +14,9 @@ exposes a stream interface on pads. + + + diff --git a/docs/libs/tmpl/gstcontrol.sgml b/docs/libs/tmpl/gstcontrol.sgml index afc9feb4b5..9d81b913c2 100644 --- a/docs/libs/tmpl/gstcontrol.sgml +++ b/docs/libs/tmpl/gstcontrol.sgml @@ -33,6 +33,9 @@ The next step is to get hold of the GstDParamManager instance of a GstElement. + + + diff --git a/docs/libs/tmpl/gstdataprotocol.sgml b/docs/libs/tmpl/gstdataprotocol.sgml index 0cd1515e94..1bb87c8d3e 100644 --- a/docs/libs/tmpl/gstdataprotocol.sgml +++ b/docs/libs/tmpl/gstdataprotocol.sgml @@ -27,6 +27,9 @@ network connections also need a protocol to do this. #GstBuffer, #GstCaps, #GstEvent + + + diff --git a/docs/libs/tmpl/gstdparam.sgml b/docs/libs/tmpl/gstdparam.sgml index 349dbe5b87..c02944e943 100644 --- a/docs/libs/tmpl/gstdparam.sgml +++ b/docs/libs/tmpl/gstdparam.sgml @@ -14,6 +14,9 @@ dynamic parameter instance + + + diff --git a/docs/libs/tmpl/gstdplinint.sgml b/docs/libs/tmpl/gstdplinint.sgml index ca453e18f5..c76ea7d24e 100644 --- a/docs/libs/tmpl/gstdplinint.sgml +++ b/docs/libs/tmpl/gstdplinint.sgml @@ -14,6 +14,9 @@ linear interpolation dynamic parameter + + + diff --git a/docs/libs/tmpl/gstdpman.sgml b/docs/libs/tmpl/gstdpman.sgml index b6a4d43aee..fd3927d0c9 100644 --- a/docs/libs/tmpl/gstdpman.sgml +++ b/docs/libs/tmpl/gstdpman.sgml @@ -20,6 +20,9 @@ are for applications that use elements with dparams. + + + diff --git a/docs/libs/tmpl/gstdpsmooth.sgml b/docs/libs/tmpl/gstdpsmooth.sgml index bfd5e8333e..17dd2a5065 100644 --- a/docs/libs/tmpl/gstdpsmooth.sgml +++ b/docs/libs/tmpl/gstdpsmooth.sgml @@ -14,6 +14,9 @@ realtime smoothed dynamic parameter + + + diff --git a/docs/libs/tmpl/gstgetbits.sgml b/docs/libs/tmpl/gstgetbits.sgml index 1d107d65fa..e3e087a241 100644 --- a/docs/libs/tmpl/gstgetbits.sgml +++ b/docs/libs/tmpl/gstgetbits.sgml @@ -14,6 +14,9 @@ accelerated routines for getting bits from a data stream. + + + diff --git a/docs/libs/tmpl/gstunitconvert.sgml b/docs/libs/tmpl/gstunitconvert.sgml index e06b2e4891..71efed7142 100644 --- a/docs/libs/tmpl/gstunitconvert.sgml +++ b/docs/libs/tmpl/gstunitconvert.sgml @@ -14,6 +14,9 @@ conversion between units of measurement + + + diff --git a/plugins/elements/.gitignore b/plugins/elements/.gitignore deleted file mode 100644 index 76f92715ad..0000000000 --- a/plugins/elements/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -Makefile -Makefile.in -*.o -*.lo -*.la -.deps -.libs -*.bb -*.bbg -*.da -*.def diff --git a/plugins/elements/Makefile.am b/plugins/elements/Makefile.am deleted file mode 100644 index dc18de4fc0..0000000000 --- a/plugins/elements/Makefile.am +++ /dev/null @@ -1,72 +0,0 @@ -# FIXME: -# need to get gstbufferstore.[ch] into its own lib, preferrably -# libs/gst/buifferstore -# This requires building libs/gst before this dir, which we currently don't -# do. - -plugin_LTLIBRARIES = libgstelements.la -AS_LIBTOOL_LIB = libgstelements - -EXTRA_DIST = $(as_libtool_EXTRA_DIST) -noinst_DATA = $(as_libtool_noinst_DATA_files) - -# FIXME: -# Disable multifilesrc on Windows, cause it uses mmap excessively -# and I don't feel like fixing it yet. See also the disablement -# in gstelements.c. -if AS_LIBTOOL_WIN32 -multifilesrc = -pipefilter = -else -multifilesrc = gstmultifilesrc.c -pipefilter = gstpipefilter.c -endif - -libgstelements_la_DEPENDENCIES = ../libgstreamer-@GST_MAJORMINOR@.la -libgstelements_la_SOURCES = \ - gstaggregator.c \ - gstbufferstore.c \ - gstelements.c \ - gstfakesink.c \ - gstfakesrc.c \ - gstfilesink.c \ - gstfilesrc.c \ - gstfdsink.c \ - gstfdsrc.c \ - gstidentity.c \ - gstmd5sink.c \ - $(multifilesrc) \ - $(pipefilter) \ - gstshaper.c \ - gststatistics.c \ - gsttee.c \ - gsttypefindelement.c - -libgstelements_la_CFLAGS = $(GST_OBJ_CFLAGS) -libgstelements_la_LIBADD = $(GST_OBJ_LIBS) -libgstelements_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) $(as_libtool_LDFLAGS) - -noinst_HEADERS = \ - gstaggregator.h \ - gstbufferstore.h \ - gstfakesink.h \ - gstfakesrc.h \ - gstfdsink.h \ - gstfdsrc.h \ - gstfilesink.h \ - gstfilesrc.h \ - gstidentity.h \ - gstmd5sink.h \ - gstmultifilesrc.h \ - gstpipefilter.h \ - gstshaper.h \ - gststatistics.h \ - gsttee.h \ - gsttypefindelement.h - -install-data-local: as-libtool-install-data-local - -uninstall-local: as-libtool-uninstall-local - -include $(top_srcdir)/common/as-libtool.mak - diff --git a/plugins/elements/gstaggregator.c b/plugins/elements/gstaggregator.c deleted file mode 100644 index aefa5bf2d3..0000000000 --- a/plugins/elements/gstaggregator.c +++ /dev/null @@ -1,378 +0,0 @@ -/* GStreamer - * Copyright (C) 1999,2000 Erik Walthinsen - * 2000 Wim Taymans - * - * gstaggregator.c: Aggregator element, N in 1 out - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include "gstaggregator.h" - -static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - -GST_DEBUG_CATEGORY_STATIC (gst_aggregator_debug); -#define GST_CAT_DEFAULT gst_aggregator_debug - -GstElementDetails gst_aggregator_details = -GST_ELEMENT_DETAILS ("Aggregator pipe fitting", - "Generic", - "N-to-1 pipe fitting", - "Wim Taymans "); - -/* Aggregator signals and args */ -enum -{ - /* FILL ME */ - LAST_SIGNAL -}; - -enum -{ - ARG_0, - ARG_NUM_PADS, - ARG_SILENT, - ARG_SCHED, - ARG_LAST_MESSAGE - /* FILL ME */ -}; - -GstStaticPadTemplate aggregator_src_template = -GST_STATIC_PAD_TEMPLATE ("sink%d", - GST_PAD_SINK, - GST_PAD_REQUEST, - GST_STATIC_CAPS_ANY); - -#define GST_TYPE_AGGREGATOR_SCHED (gst_aggregator_sched_get_type()) -static GType -gst_aggregator_sched_get_type (void) -{ - static GType aggregator_sched_type = 0; - static GEnumValue aggregator_sched[] = { - {AGGREGATOR_LOOP, "1", "Loop Based"}, - {AGGREGATOR_LOOP_SELECT, "3", "Loop Based Select"}, - {AGGREGATOR_CHAIN, "4", "Chain Based"}, - {0, NULL, NULL}, - }; - - if (!aggregator_sched_type) { - aggregator_sched_type = - g_enum_register_static ("GstAggregatorSched", aggregator_sched); - } - return aggregator_sched_type; -} - -#define AGGREGATOR_IS_LOOP_BASED(ag) ((ag)->sched != AGGREGATOR_CHAIN) - -static GstPad *gst_aggregator_request_new_pad (GstElement * element, - GstPadTemplate * temp, const gchar * unused); -static void gst_aggregator_update_functions (GstAggregator * aggregator); - -static void gst_aggregator_finalize (GObject * object); -static void gst_aggregator_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec); -static void gst_aggregator_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec); - -static void gst_aggregator_chain (GstPad * pad, GstData * _data); -static void gst_aggregator_loop (GstElement * element); - -#define _do_init(bla) \ - GST_DEBUG_CATEGORY_INIT (gst_aggregator_debug, "aggregator", 0, "aggregator element"); - -GST_BOILERPLATE_FULL (GstAggregator, gst_aggregator, GstElement, - GST_TYPE_ELEMENT, _do_init); - -static void -gst_aggregator_base_init (gpointer g_class) -{ - GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&aggregator_src_template)); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&srctemplate)); - gst_element_class_set_details (gstelement_class, &gst_aggregator_details); -} - -static void -gst_aggregator_finalize (GObject * object) -{ - GstAggregator *aggregator; - - aggregator = GST_AGGREGATOR (object); - - g_list_free (aggregator->sinkpads); - g_free (aggregator->last_message); - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static void -gst_aggregator_class_init (GstAggregatorClass * klass) -{ - GObjectClass *gobject_class; - GstElementClass *gstelement_class; - - gobject_class = (GObjectClass *) klass; - gstelement_class = (GstElementClass *) klass; - - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_PADS, - g_param_spec_int ("num_pads", "Num pads", "The number of source pads", - 0, G_MAXINT, 0, G_PARAM_READABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SILENT, - g_param_spec_boolean ("silent", "Silent", "Don't produce messages", - FALSE, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SCHED, - g_param_spec_enum ("sched", "Scheduling", - "The type of scheduling this element should use", - GST_TYPE_AGGREGATOR_SCHED, AGGREGATOR_CHAIN, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LAST_MESSAGE, - g_param_spec_string ("last_message", "Last message", - "The current state of the element", NULL, G_PARAM_READABLE)); - - gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_aggregator_finalize); - gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_aggregator_set_property); - gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_aggregator_get_property); - - gstelement_class->request_new_pad = - GST_DEBUG_FUNCPTR (gst_aggregator_request_new_pad); -} - -static void -gst_aggregator_init (GstAggregator * aggregator) -{ - aggregator->srcpad = - gst_pad_new_from_template (gst_static_pad_template_get (&srctemplate), - "src"); - gst_pad_set_getcaps_function (aggregator->srcpad, gst_pad_proxy_getcaps); - gst_element_add_pad (GST_ELEMENT (aggregator), aggregator->srcpad); - - aggregator->numsinkpads = 0; - aggregator->sinkpads = NULL; - aggregator->silent = FALSE; - aggregator->sched = AGGREGATOR_LOOP; - aggregator->last_message = NULL; - - gst_aggregator_update_functions (aggregator); -} - -static GstPad * -gst_aggregator_request_new_pad (GstElement * element, GstPadTemplate * templ, - const gchar * unused) -{ - gchar *name; - GstPad *sinkpad; - GstAggregator *aggregator; - - g_return_val_if_fail (GST_IS_AGGREGATOR (element), NULL); - - if (templ->direction != GST_PAD_SINK) { - g_warning ("gstaggregator: request new pad that is not a sink pad\n"); - return NULL; - } - - aggregator = GST_AGGREGATOR (element); - - name = g_strdup_printf ("sink%d", aggregator->numsinkpads); - - sinkpad = gst_pad_new_from_template (templ, name); - g_free (name); - - if (!AGGREGATOR_IS_LOOP_BASED (aggregator)) { - gst_pad_set_chain_function (sinkpad, gst_aggregator_chain); - } - gst_pad_set_getcaps_function (sinkpad, gst_pad_proxy_getcaps); - gst_element_add_pad (GST_ELEMENT (aggregator), sinkpad); - - aggregator->sinkpads = g_list_prepend (aggregator->sinkpads, sinkpad); - aggregator->numsinkpads++; - - return sinkpad; -} - -static void -gst_aggregator_update_functions (GstAggregator * aggregator) -{ - GList *pads; - - if (AGGREGATOR_IS_LOOP_BASED (aggregator)) { - gst_element_set_loop_function (GST_ELEMENT (aggregator), - GST_DEBUG_FUNCPTR (gst_aggregator_loop)); - } else { - gst_element_set_loop_function (GST_ELEMENT (aggregator), NULL); - } - - pads = aggregator->sinkpads; - while (pads) { - GstPad *pad = GST_PAD (pads->data); - - if (AGGREGATOR_IS_LOOP_BASED (aggregator)) { - gst_pad_set_get_function (pad, NULL); - } else { - gst_element_set_loop_function (GST_ELEMENT (aggregator), NULL); - } - pads = g_list_next (pads); - } -} - -static void -gst_aggregator_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec) -{ - GstAggregator *aggregator; - - /* it's not null if we got it, but it might not be ours */ - g_return_if_fail (GST_IS_AGGREGATOR (object)); - - aggregator = GST_AGGREGATOR (object); - - switch (prop_id) { - case ARG_SILENT: - aggregator->silent = g_value_get_boolean (value); - break; - case ARG_SCHED: - aggregator->sched = g_value_get_enum (value); - gst_aggregator_update_functions (aggregator); - break; - default: - break; - } -} - -static void -gst_aggregator_get_property (GObject * object, guint prop_id, GValue * value, - GParamSpec * pspec) -{ - GstAggregator *aggregator; - - /* it's not null if we got it, but it might not be ours */ - g_return_if_fail (GST_IS_AGGREGATOR (object)); - - aggregator = GST_AGGREGATOR (object); - - switch (prop_id) { - case ARG_NUM_PADS: - g_value_set_int (value, aggregator->numsinkpads); - break; - case ARG_SILENT: - g_value_set_boolean (value, aggregator->silent); - break; - case ARG_SCHED: - g_value_set_enum (value, aggregator->sched); - break; - case ARG_LAST_MESSAGE: - g_value_set_string (value, aggregator->last_message); - break; - default: - break; - } -} - -static void -gst_aggregator_push (GstAggregator * aggregator, GstPad * pad, GstBuffer * buf, - guchar * debug) -{ - if (!aggregator->silent) { - g_free (aggregator->last_message); - - aggregator->last_message = - g_strdup_printf ("%10.10s ******* (%s:%s)a (%d bytes, %" - G_GUINT64_FORMAT ")", debug, GST_DEBUG_PAD_NAME (pad), - GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf)); - - g_object_notify (G_OBJECT (aggregator), "last_message"); - } - - gst_pad_push (aggregator->srcpad, GST_DATA (buf)); -} - -static void -gst_aggregator_loop (GstElement * element) -{ - GstAggregator *aggregator; - GstBuffer *buf; - guchar *debug; - - aggregator = GST_AGGREGATOR (element); - - if (aggregator->sched == AGGREGATOR_LOOP) { - GList *pads = aggregator->sinkpads; - - /* we'll loop over all pads and try to pull from all - * active ones */ - while (pads) { - GstPad *pad = GST_PAD (pads->data); - - pads = g_list_next (pads); - - /* we need to check is the pad is usable. IS_USABLE will check - * if the pad is linked, if it is enabled (the element is - * playing and the app didn't gst_pad_set_enabled (pad, FALSE)) - * and that the peer pad is also enabled. - */ - if (GST_PAD_IS_USABLE (pad)) { - buf = GST_BUFFER (gst_pad_pull (pad)); - debug = (guchar *) "loop"; - - /* then push it forward */ - gst_aggregator_push (aggregator, pad, buf, debug); - } - } - } else { - if (aggregator->sched == AGGREGATOR_LOOP_SELECT) { - GstPad *pad; - - debug = (guchar *) "loop_select"; - - buf = GST_BUFFER (gst_pad_collectv (&pad, aggregator->sinkpads)); - - gst_aggregator_push (aggregator, pad, buf, debug); - } else { - g_assert_not_reached (); - } - } -} - -/** - * gst_aggregator_chain: - * @pad: the pad to follow - * @buf: the buffer to pass - * - * Chain a buffer on a pad. - */ -static void -gst_aggregator_chain (GstPad * pad, GstData * _data) -{ - GstBuffer *buf = GST_BUFFER (_data); - GstAggregator *aggregator; - - g_return_if_fail (pad != NULL); - g_return_if_fail (GST_IS_PAD (pad)); - g_return_if_fail (buf != NULL); - - aggregator = GST_AGGREGATOR (gst_pad_get_parent (pad)); -/* gst_trace_add_entry (NULL, 0, buf, "aggregator buffer");*/ - - gst_aggregator_push (aggregator, pad, buf, (guchar *) "chain"); -} diff --git a/plugins/elements/gstaggregator.h b/plugins/elements/gstaggregator.h deleted file mode 100644 index 24af881da6..0000000000 --- a/plugins/elements/gstaggregator.h +++ /dev/null @@ -1,74 +0,0 @@ -/* GStreamer - * Copyright (C) 1999,2000 Erik Walthinsen - * 2000 Wim Taymans - * - * gstaggregator.h: Header for GstAggregator element - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - -#ifndef __GST_AGGREGATOR_H__ -#define __GST_AGGREGATOR_H__ - -#include - -G_BEGIN_DECLS - - -typedef enum { - AGGREGATOR_LOOP = 1, - AGGREGATOR_LOOP_SELECT, - AGGREGATOR_CHAIN -} GstAggregatorSchedType; - -#define GST_TYPE_AGGREGATOR \ - (gst_aggregator_get_type()) -#define GST_AGGREGATOR(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AGGREGATOR,GstAggregator)) -#define GST_AGGREGATOR_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AGGREGATOR,GstAggregatorClass)) -#define GST_IS_AGGREGATOR(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AGGREGATOR)) -#define GST_IS_AGGREGATOR_CLASS(obj) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AGGREGATOR)) - -typedef struct _GstAggregator GstAggregator; -typedef struct _GstAggregatorClass GstAggregatorClass; - -struct _GstAggregator { - GstElement element; - - GstPad *srcpad; - - gboolean silent; - GstAggregatorSchedType sched; - - gint numsinkpads; - GList *sinkpads; - - gchar *last_message; -}; - -struct _GstAggregatorClass { - GstElementClass parent_class; -}; - -GType gst_aggregator_get_type (void); - -G_END_DECLS - -#endif /* __GST_AGGREGATOR_H__ */ diff --git a/plugins/elements/gstbufferstore.c b/plugins/elements/gstbufferstore.c deleted file mode 100644 index f3d8e55089..0000000000 --- a/plugins/elements/gstbufferstore.c +++ /dev/null @@ -1,468 +0,0 @@ -/* GStreamer - * Copyright (C) 2003 Benjamin Otte - * - * gstbufferstore.c: keep an easily accessible list of all buffers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif -#include "gstbufferstore.h" -#include -#include - -GST_DEBUG_CATEGORY_STATIC (gst_buffer_store_debug); -#define GST_CAT_DEFAULT gst_buffer_store_debug - -enum -{ - CLEARED, - BUFFER_ADDED, - LAST_SIGNAL -}; -enum -{ - ARG_0 -}; - - -static void gst_buffer_store_dispose (GObject * object); - -static gboolean gst_buffer_store_add_buffer_func (GstBufferStore * store, - GstBuffer * buffer); -static void gst_buffer_store_cleared_func (GstBufferStore * store); - -static guint gst_buffer_store_signals[LAST_SIGNAL] = { 0 }; - -#define _do_init(bla) \ - GST_DEBUG_CATEGORY_INIT (gst_buffer_store_debug, "GstBufferStore", 0, "buffer store helper"); - -GST_BOILERPLATE_FULL (GstBufferStore, gst_buffer_store, GObject, G_TYPE_OBJECT, - _do_init); - - -G_GNUC_UNUSED static void -debug_buffers (GstBufferStore * store) -{ - GList *walk = store->buffers; - - g_printerr ("BUFFERS in store:\n"); - while (walk) { - g_print ("%15" G_GUINT64_FORMAT " - %7u\n", GST_BUFFER_OFFSET (walk->data), - GST_BUFFER_SIZE (walk->data)); - walk = g_list_next (walk); - } - g_printerr ("\n"); -} - -static gboolean -continue_accu (GSignalInvocationHint * ihint, GValue * return_accu, - const GValue * handler_return, gpointer data) -{ - gboolean do_continue = g_value_get_boolean (handler_return); - - g_value_set_boolean (return_accu, do_continue); - - return do_continue; -} -static void -gst_buffer_store_base_init (gpointer g_class) -{ -} -static void -gst_buffer_store_class_init (GstBufferStoreClass * store_class) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (store_class); - - gobject_class->dispose = gst_buffer_store_dispose; - - gst_buffer_store_signals[CLEARED] = g_signal_new ("cleared", - G_TYPE_FROM_CLASS (store_class), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GstBufferStoreClass, cleared), NULL, NULL, - gst_marshal_VOID__VOID, G_TYPE_NONE, 0); - gst_buffer_store_signals[BUFFER_ADDED] = g_signal_new ("buffer-added", - G_TYPE_FROM_CLASS (store_class), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GstBufferStoreClass, buffer_added), continue_accu, NULL, - gst_marshal_BOOLEAN__POINTER, G_TYPE_BOOLEAN, 1, GST_TYPE_BUFFER); - - store_class->cleared = gst_buffer_store_cleared_func; - store_class->buffer_added = gst_buffer_store_add_buffer_func; -} -static void -gst_buffer_store_init (GstBufferStore * store) -{ - store->buffers = NULL; -} -static void -gst_buffer_store_dispose (GObject * object) -{ - GstBufferStore *store = GST_BUFFER_STORE (object); - - gst_buffer_store_clear (store); - - parent_class->dispose (object); -} - -static gboolean -gst_buffer_store_add_buffer_func (GstBufferStore * store, GstBuffer * buffer) -{ - g_assert (buffer != NULL); - - if (!GST_BUFFER_OFFSET_IS_VALID (buffer) && - store->buffers && GST_BUFFER_OFFSET_IS_VALID (store->buffers->data)) { - /* we assumed valid offsets, but suddenly they are not anymore */ - GST_DEBUG_OBJECT (store, - "attempting to add buffer %p with invalid offset to store with valid offset, abort", - buffer); - return FALSE; - } else if (!store->buffers - || !GST_BUFFER_OFFSET_IS_VALID (store->buffers->data)) { - /* the starting buffer had an invalid offset, in that case we assume continuous buffers */ - GST_LOG_OBJECT (store, "adding buffer %p with invalid offset and size %u", - buffer, GST_BUFFER_SIZE (buffer)); - gst_data_ref (GST_DATA (buffer)); - store->buffers = g_list_append (store->buffers, buffer); - return TRUE; - } else { - /* both list and buffer have valid offsets, we can really go wild */ - GList *walk, *current_list = NULL; - GstBuffer *current; - - g_assert (GST_BUFFER_OFFSET_IS_VALID (buffer)); - GST_LOG_OBJECT (store, - "attempting to add buffer %p with offset %" G_GUINT64_FORMAT - " and size %u", buffer, GST_BUFFER_OFFSET (buffer), - GST_BUFFER_SIZE (buffer)); - /* we keep a sorted list of non-overlapping buffers */ - walk = store->buffers; - while (walk) { - current = GST_BUFFER (walk->data); - current_list = walk; - walk = g_list_next (walk); - if (GST_BUFFER_OFFSET (current) < GST_BUFFER_OFFSET (buffer)) { - continue; - } else if (GST_BUFFER_OFFSET (current) == GST_BUFFER_OFFSET (buffer)) { - guint needed_size; - - if (walk) { - needed_size = MIN (GST_BUFFER_SIZE (buffer), - GST_BUFFER_OFFSET (walk->data) - GST_BUFFER_OFFSET (current)); - } else { - needed_size = GST_BUFFER_SIZE (buffer); - } - if (needed_size <= GST_BUFFER_SIZE (current)) { - buffer = NULL; - break; - } else { - if (needed_size < GST_BUFFER_SIZE (buffer)) { - /* need to create subbuffer to not have overlapping data */ - GstBuffer *sub = gst_buffer_create_sub (buffer, 0, needed_size); - - g_assert (sub); - buffer = sub; - } else { - gst_data_ref (GST_DATA (buffer)); - } - /* replace current buffer with new one */ - GST_INFO_OBJECT (store, - "replacing buffer %p with buffer %p with offset %" G_GINT64_FORMAT - " and size %u", current_list->data, buffer, - GST_BUFFER_OFFSET (buffer), GST_BUFFER_SIZE (buffer)); - gst_data_unref (GST_DATA (current_list->data)); - current_list->data = buffer; - buffer = NULL; - break; - } - } else if (GST_BUFFER_OFFSET (current) > GST_BUFFER_OFFSET (buffer)) { - GList *previous = g_list_previous (current_list); - guint64 start_offset = previous ? - GST_BUFFER_OFFSET (previous->data) + - GST_BUFFER_SIZE (previous->data) : 0; - - if (start_offset == GST_BUFFER_OFFSET (current)) { - buffer = NULL; - break; - } else { - /* we have data to insert */ - if (start_offset > GST_BUFFER_OFFSET (buffer) || - GST_BUFFER_OFFSET (buffer) + GST_BUFFER_SIZE (buffer) > - GST_BUFFER_OFFSET (current)) { - GstBuffer *sub; - - /* need a subbuffer */ - start_offset = GST_BUFFER_OFFSET (buffer) > start_offset ? 0 : - start_offset - GST_BUFFER_OFFSET (buffer); - sub = gst_buffer_create_sub (buffer, start_offset, - MIN (GST_BUFFER_SIZE (buffer) - start_offset, - GST_BUFFER_OFFSET (current) - start_offset - - GST_BUFFER_OFFSET (buffer))); - g_assert (sub); - GST_BUFFER_OFFSET (sub) = start_offset + GST_BUFFER_OFFSET (buffer); - buffer = sub; - } else { - gst_data_ref (GST_DATA (buffer)); - } - GST_INFO_OBJECT (store, - "adding buffer %p with offset %" G_GINT64_FORMAT " and size %u", - buffer, GST_BUFFER_OFFSET (buffer), GST_BUFFER_SIZE (buffer)); - store->buffers = - g_list_insert_before (store->buffers, current_list, buffer); - buffer = NULL; - break; - } - } - } - if (buffer) { - gst_data_ref (GST_DATA (buffer)); - GST_INFO_OBJECT (store, - "adding buffer %p with offset %" G_GINT64_FORMAT " and size %u", - buffer, GST_BUFFER_OFFSET (buffer), GST_BUFFER_SIZE (buffer)); - if (current_list) { - g_list_append (current_list, buffer); - } else { - g_assert (store->buffers == NULL); - store->buffers = g_list_prepend (NULL, buffer); - } - } - return TRUE; - } -} -static void -gst_buffer_store_cleared_func (GstBufferStore * store) -{ - g_list_foreach (store->buffers, (GFunc) gst_data_unref, NULL); - g_list_free (store->buffers); - store->buffers = NULL; -} - -/** - * gst_buffer_store_new: - * - * Creates a new bufferstore. - * - * Returns: the new bufferstore. - */ -GstBufferStore * -gst_buffer_store_new (void) -{ - return GST_BUFFER_STORE (g_object_new (GST_TYPE_BUFFER_STORE, NULL)); -} - -/** - * gst_buffer_store_clear: - * @store: a bufferstore - * - * Clears the buffer store. All buffers are removed and the buffer store - * behaves like it was just created. - */ -/* FIXME: call this function _reset ? */ -void -gst_buffer_store_clear (GstBufferStore * store) -{ - g_return_if_fail (GST_IS_BUFFER_STORE (store)); - - g_signal_emit (store, gst_buffer_store_signals[CLEARED], 0, NULL); -} - -/** - * gst_buffer_store_add_buffer: - * @store: a bufferstore - * @buffer: the buffer to add - * - * Adds a buffer to the buffer store. - * - * Returns: TRUE, if the buffer was added, FALSE if an error occured. - */ -gboolean -gst_buffer_store_add_buffer (GstBufferStore * store, GstBuffer * buffer) -{ - gboolean ret; - - g_return_val_if_fail (GST_IS_BUFFER_STORE (store), FALSE); - g_return_val_if_fail (GST_IS_BUFFER (buffer), FALSE); - - if (store->buffers && - GST_BUFFER_OFFSET_IS_VALID (store->buffers->data) && - !GST_BUFFER_OFFSET_IS_VALID (buffer)) - return FALSE; - - g_signal_emit (store, gst_buffer_store_signals[BUFFER_ADDED], 0, buffer, - &ret); - - return ret; -} - -/** - * gst_buffer_store_get_buffer: - * @store: a bufferstore - * @offset: starting offset of returned buffer - * @size: size of returned buffer - * - * Returns a buffer that corresponds to the given area of data. If part of the - * data is not available inside the store, NULL is returned. You have to unref - * the buffer after use. - * - * Returns: a buffer with the requested data or NULL if the data was not - * available. - */ -GstBuffer * -gst_buffer_store_get_buffer (GstBufferStore * store, guint64 offset, guint size) -{ - GstBuffer *current; - GList *walk; - guint8 *data; - guint tmp; - gboolean have_offset; - guint64 cur_offset = 0; - GstBuffer *ret = NULL; - - g_return_val_if_fail (GST_IS_BUFFER_STORE (store), NULL); - - walk = store->buffers; - if (!walk) - return NULL; - if (GST_BUFFER_OFFSET_IS_VALID (walk->data)) { - have_offset = TRUE; - } else { - have_offset = FALSE; - } - while (walk) { - current = GST_BUFFER (walk->data); - if (have_offset) { - cur_offset = GST_BUFFER_OFFSET (current); - } - walk = g_list_next (walk); - if (cur_offset > offset) { - /* #include - do_nothing_loop (); */ - } else if (cur_offset == offset && GST_BUFFER_SIZE (current) == size) { - GST_LOG_OBJECT (store, - "found matching buffer %p for offset %" G_GUINT64_FORMAT - " and size %u", current, offset, size); - ret = current; - gst_data_ref (GST_DATA (ret)); - GST_LOG_OBJECT (store, "refcount %d", GST_DATA_REFCOUNT_VALUE (ret)); - break; - } else if (cur_offset + GST_BUFFER_SIZE (current) > offset) { - if (cur_offset + GST_BUFFER_SIZE (current) >= offset + size) { - ret = gst_buffer_create_sub (current, offset - cur_offset, size); - GST_LOG_OBJECT (store, - "created subbuffer %p from buffer %p for offset %llu and size %u", - ret, current, offset, size); - break; - } - /* uh, the requested data spans some buffers */ - ret = gst_buffer_new_and_alloc (size); - GST_BUFFER_OFFSET (ret) = offset; - GST_LOG_OBJECT (store, "created buffer %p for offset %" G_GUINT64_FORMAT - " and size %u, will fill with data now", ret, offset, size); - data = GST_BUFFER_DATA (ret); - tmp = GST_BUFFER_SIZE (current) - offset + cur_offset; - memcpy (data, GST_BUFFER_DATA (current) + offset - cur_offset, tmp); - data += tmp; - size -= tmp; - while (size) { - if (walk == NULL || - (have_offset && - GST_BUFFER_OFFSET (current) + GST_BUFFER_SIZE (current) != - GST_BUFFER_OFFSET (walk->data))) { - GST_DEBUG_OBJECT (store, - "not all data for offset %" G_GUINT64_FORMAT - " and remaining size %u available, aborting", offset, size); - gst_data_unref (GST_DATA (ret)); - ret = NULL; - goto out; - } - current = GST_BUFFER (walk->data); - walk = g_list_next (walk); - tmp = MIN (GST_BUFFER_SIZE (current), size); - memcpy (data, GST_BUFFER_DATA (current), tmp); - data += tmp; - size -= tmp; - } - goto out; - } - if (!have_offset) { - cur_offset += GST_BUFFER_SIZE (current); - } - } -out: - - return ret; -} - -/** - * gst_buffer_store_get_size: - * @store: a bufferstore - * @offset: desired offset - * - * Calculates the number of bytes available starting from offset. This allows - * to query a buffer with the returned size. - * - * Returns: the number of continuous bytes in the bufferstore starting at - * offset. - */ -guint -gst_buffer_store_get_size (GstBufferStore * store, guint64 offset) -{ - GList *walk; - gboolean have_offset; - gboolean counting = FALSE; - guint64 cur_offset = 0; - GstBuffer *current = NULL; - guint ret = 0; - - g_return_val_if_fail (GST_IS_BUFFER_STORE (store), 0); - - walk = store->buffers; - if (!walk) - return 0; - if (GST_BUFFER_OFFSET_IS_VALID (walk->data)) { - have_offset = TRUE; - } else { - have_offset = FALSE; - } - while (walk) { - if (have_offset && counting && - cur_offset + GST_BUFFER_SIZE (current) != - GST_BUFFER_OFFSET (walk->data)) { - break; - } - current = GST_BUFFER (walk->data); - if (have_offset) { - cur_offset = GST_BUFFER_OFFSET (current); - } - walk = g_list_next (walk); - if (counting) { - ret += GST_BUFFER_SIZE (current); - } else { - if (cur_offset > offset) - return 0; - if (cur_offset + GST_BUFFER_SIZE (current) > offset) { - /* we have at least some bytes */ - ret = cur_offset + GST_BUFFER_SIZE (current) - offset; - counting = TRUE; - } - } - if (!have_offset) { - cur_offset += GST_BUFFER_SIZE (current); - } - } - - return ret; -} diff --git a/plugins/elements/gstbufferstore.h b/plugins/elements/gstbufferstore.h deleted file mode 100644 index 15fff8e6a1..0000000000 --- a/plugins/elements/gstbufferstore.h +++ /dev/null @@ -1,73 +0,0 @@ -/* GStreamer - * Copyright (C) 2003 Benjamin Otte - * - * gsttypefind.h: keep an easily accessible list of all buffers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - -#ifndef __GST_BUFFER_STORE_H__ -#define __GST_BUFFER_STORE_H__ - -#include -#include -#include - -G_BEGIN_DECLS - -#define GST_TYPE_BUFFER_STORE (gst_buffer_store_get_type ()) -#define GST_BUFFER_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_BUFFER_STORE, GstBufferStore)) -#define GST_IS_BUFFER_STORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_BUFFER_STORE)) -#define GST_BUFFER_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_BUFFER_STORE, GstBufferStoreClass)) -#define GST_IS_BUFFER_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_BUFFER_STORE)) -#define GST_BUFFER_STORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_BUFFER_STORE, GstBufferStoreClass)) - -typedef struct _GstBufferStore GstBufferStore; -typedef struct _GstBufferStoreClass GstBufferStoreClass; - -struct _GstBufferStore { - GObject object; - - GList * buffers; -}; - -struct _GstBufferStoreClass { - GObjectClass parent_class; - - /* signals */ - void (* cleared) (GstBufferStore * store); - gboolean (* buffer_added) (GstBufferStore * store, - GstBuffer * buffer); -}; - -GType gst_buffer_store_get_type (void); - -GstBufferStore * gst_buffer_store_new (void); -void gst_buffer_store_clear (GstBufferStore * store); - -gboolean gst_buffer_store_add_buffer (GstBufferStore * store, - GstBuffer * buffer); - -GstBuffer * gst_buffer_store_get_buffer (GstBufferStore * store, - guint64 offset, - guint size); -guint gst_buffer_store_get_size (GstBufferStore * store, - guint64 offset); - -G_END_DECLS - -#endif /* __GST_BUFFER_STORE_H__ */ diff --git a/plugins/elements/gstelements.c b/plugins/elements/gstelements.c deleted file mode 100644 index 065bfdad6a..0000000000 --- a/plugins/elements/gstelements.c +++ /dev/null @@ -1,97 +0,0 @@ -/* GStreamer - * Copyright (C) 1999,2000 Erik Walthinsen - * 2000 Wim Taymans - * - * gstelements.c: - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include - -#include "gstaggregator.h" -#include "gstfakesink.h" -#include "gstfakesrc.h" -#include "gstfdsink.h" -#include "gstfdsrc.h" -#include "gstfilesink.h" -#include "gstfilesrc.h" -#include "gstidentity.h" -#include "gstmd5sink.h" -#include "gstmultifilesrc.h" -#include "gstpipefilter.h" -#include "gstshaper.h" -#include "gststatistics.h" -#include "gsttee.h" -#include "gsttypefindelement.h" - -struct _elements_entry -{ - gchar *name; - guint rank; - GType (*type) (void); -}; - - -extern GType gst_filesrc_get_type (void); -extern GstElementDetails gst_filesrc_details; - -static struct _elements_entry _elements[] = { - {"aggregator", GST_RANK_NONE, gst_aggregator_get_type}, - {"fakesrc", GST_RANK_NONE, gst_fakesrc_get_type}, - {"fakesink", GST_RANK_NONE, gst_fakesink_get_type}, - {"fdsink", GST_RANK_NONE, gst_fdsink_get_type}, - {"fdsrc", GST_RANK_NONE, gst_fdsrc_get_type}, - {"filesrc", GST_RANK_PRIMARY, gst_filesrc_get_type}, - {"filesink", GST_RANK_NONE, gst_filesink_get_type}, - {"identity", GST_RANK_NONE, gst_identity_get_type}, - {"md5sink", GST_RANK_NONE, gst_md5sink_get_type}, -#ifndef HAVE_WIN32 - {"multifilesrc", GST_RANK_NONE, gst_multifilesrc_get_type}, - {"pipefilter", GST_RANK_NONE, gst_pipefilter_get_type}, -#endif - {"shaper", GST_RANK_NONE, gst_shaper_get_type}, - {"statistics", GST_RANK_NONE, gst_statistics_get_type}, - {"tee", GST_RANK_NONE, gst_tee_get_type}, - {"typefind", GST_RANK_NONE, gst_type_find_element_get_type}, - {NULL, 0}, -}; - -static gboolean -plugin_init (GstPlugin * plugin) -{ - struct _elements_entry *my_elements = _elements; - - while ((*my_elements).name) { - if (!gst_element_register (plugin, (*my_elements).name, (*my_elements).rank, - ((*my_elements).type) ())) - return FALSE; - my_elements++; - } - - return TRUE; -} - -GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "gstelements", - "standard GStreamer elements", - plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN) diff --git a/plugins/elements/gstfakesink.c b/plugins/elements/gstfakesink.c deleted file mode 100644 index c06ecf51e7..0000000000 --- a/plugins/elements/gstfakesink.c +++ /dev/null @@ -1,423 +0,0 @@ -/* GStreamer - * Copyright (C) 1999,2000 Erik Walthinsen - * 2000 Wim Taymans - * - * gstfakesink.c: - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include "gstfakesink.h" -#include - -static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - -GST_DEBUG_CATEGORY_STATIC (gst_fakesink_debug); -#define GST_CAT_DEFAULT gst_fakesink_debug - -GstElementDetails gst_fakesink_details = GST_ELEMENT_DETAILS ("Fake Sink", - "Sink", - "Black hole for data", - "Erik Walthinsen "); - - -/* FakeSink signals and args */ -enum -{ - /* FILL ME */ - SIGNAL_HANDOFF, - LAST_SIGNAL -}; - -enum -{ - ARG_0, - ARG_STATE_ERROR, - ARG_NUM_SINKS, - ARG_SILENT, - ARG_DUMP, - ARG_SYNC, - ARG_SIGNAL_HANDOFFS, - ARG_LAST_MESSAGE -}; - -GstStaticPadTemplate fakesink_sink_template = GST_STATIC_PAD_TEMPLATE ("sink%d", - GST_PAD_SINK, - GST_PAD_REQUEST, - GST_STATIC_CAPS_ANY); - -#define GST_TYPE_FAKESINK_STATE_ERROR (gst_fakesink_state_error_get_type()) -static GType -gst_fakesink_state_error_get_type (void) -{ - static GType fakesink_state_error_type = 0; - static GEnumValue fakesink_state_error[] = { - {FAKESINK_STATE_ERROR_NONE, "0", "No state change errors"}, - {FAKESINK_STATE_ERROR_NULL_READY, "1", - "Fail state change from NULL to READY"}, - {FAKESINK_STATE_ERROR_READY_PAUSED, "2", - "Fail state change from READY to PAUSED"}, - {FAKESINK_STATE_ERROR_PAUSED_PLAYING, "3", - "Fail state change from PAUSED to PLAYING"}, - {FAKESINK_STATE_ERROR_PLAYING_PAUSED, "4", - "Fail state change from PLAYING to PAUSED"}, - {FAKESINK_STATE_ERROR_PAUSED_READY, "5", - "Fail state change from PAUSED to READY"}, - {FAKESINK_STATE_ERROR_READY_NULL, "6", - "Fail state change from READY to NULL"}, - {0, NULL, NULL}, - }; - - if (!fakesink_state_error_type) { - fakesink_state_error_type = - g_enum_register_static ("GstFakeSinkStateError", fakesink_state_error); - } - return fakesink_state_error_type; -} - -#define _do_init(bla) \ - GST_DEBUG_CATEGORY_INIT (gst_fakesink_debug, "fakesink", 0, "fakesink element"); - -GST_BOILERPLATE_FULL (GstFakeSink, gst_fakesink, GstElement, GST_TYPE_ELEMENT, - _do_init); - -static void gst_fakesink_set_clock (GstElement * element, GstClock * clock); -static GstPad *gst_fakesink_request_new_pad (GstElement * element, - GstPadTemplate * templ, const gchar * unused); - -static void gst_fakesink_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec); -static void gst_fakesink_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec); - -static GstElementStateReturn gst_fakesink_change_state (GstElement * element); - -static void gst_fakesink_chain (GstPad * pad, GstData * _data); - -static guint gst_fakesink_signals[LAST_SIGNAL] = { 0 }; - -static void -gst_fakesink_base_init (gpointer g_class) -{ - GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&sinktemplate)); - gst_element_class_set_details (gstelement_class, &gst_fakesink_details); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&fakesink_sink_template)); -} - -static void -gst_fakesink_class_init (GstFakeSinkClass * klass) -{ - GObjectClass *gobject_class; - GstElementClass *gstelement_class; - - gobject_class = (GObjectClass *) klass; - gstelement_class = (GstElementClass *) klass; - - - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_SINKS, - g_param_spec_int ("num_sinks", "Number of sinks", - "The number of sinkpads", 1, G_MAXINT, 1, G_PARAM_READABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_STATE_ERROR, - g_param_spec_enum ("state_error", "State Error", - "Generate a state change error", GST_TYPE_FAKESINK_STATE_ERROR, - FAKESINK_STATE_ERROR_NONE, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LAST_MESSAGE, - g_param_spec_string ("last_message", "Last Message", - "The message describing current status", NULL, G_PARAM_READABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SYNC, - g_param_spec_boolean ("sync", "Sync", "Sync on the clock", FALSE, - G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SIGNAL_HANDOFFS, - g_param_spec_boolean ("signal-handoffs", "Signal handoffs", - "Send a signal before unreffing the buffer", FALSE, - G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SILENT, - g_param_spec_boolean ("silent", "Silent", - "Don't produce last_message events", FALSE, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DUMP, - g_param_spec_boolean ("dump", "Dump", "Dump received bytes to stdout", - FALSE, G_PARAM_READWRITE)); - - gst_fakesink_signals[SIGNAL_HANDOFF] = - g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GstFakeSinkClass, handoff), NULL, NULL, - gst_marshal_VOID__BOXED_OBJECT, G_TYPE_NONE, 2, - GST_TYPE_BUFFER | G_SIGNAL_TYPE_STATIC_SCOPE, GST_TYPE_PAD); - - gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_fakesink_set_property); - gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_fakesink_get_property); - - gstelement_class->request_new_pad = - GST_DEBUG_FUNCPTR (gst_fakesink_request_new_pad); - gstelement_class->set_clock = GST_DEBUG_FUNCPTR (gst_fakesink_set_clock); - gstelement_class->change_state = - GST_DEBUG_FUNCPTR (gst_fakesink_change_state); -} - -static void -gst_fakesink_init (GstFakeSink * fakesink) -{ - GstPad *pad; - - pad = - gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate), - "sink"); - gst_element_add_pad (GST_ELEMENT (fakesink), pad); - gst_pad_set_chain_function (pad, GST_DEBUG_FUNCPTR (gst_fakesink_chain)); - - fakesink->silent = FALSE; - fakesink->dump = FALSE; - fakesink->sync = FALSE; - fakesink->last_message = NULL; - fakesink->state_error = FAKESINK_STATE_ERROR_NONE; - fakesink->signal_handoffs = FALSE; - - GST_FLAG_SET (fakesink, GST_ELEMENT_EVENT_AWARE); -} - -static void -gst_fakesink_set_clock (GstElement * element, GstClock * clock) -{ - GstFakeSink *sink; - - sink = GST_FAKESINK (element); - - sink->clock = clock; -} - -static GstPad * -gst_fakesink_request_new_pad (GstElement * element, GstPadTemplate * templ, - const gchar * unused) -{ - gchar *name; - GstPad *sinkpad; - GstFakeSink *fakesink; - - g_return_val_if_fail (GST_IS_FAKESINK (element), NULL); - - if (templ->direction != GST_PAD_SINK) { - g_warning ("gstfakesink: request new pad that is not a SINK pad\n"); - return NULL; - } - - fakesink = GST_FAKESINK (element); - - name = g_strdup_printf ("sink%d", GST_ELEMENT (fakesink)->numsinkpads); - - sinkpad = gst_pad_new_from_template (templ, name); - g_free (name); - gst_pad_set_chain_function (sinkpad, GST_DEBUG_FUNCPTR (gst_fakesink_chain)); - - gst_element_add_pad (GST_ELEMENT (fakesink), sinkpad); - - return sinkpad; -} - -static void -gst_fakesink_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec) -{ - GstFakeSink *sink; - - /* it's not null if we got it, but it might not be ours */ - sink = GST_FAKESINK (object); - - switch (prop_id) { - case ARG_SILENT: - sink->silent = g_value_get_boolean (value); - break; - case ARG_STATE_ERROR: - sink->state_error = g_value_get_enum (value); - break; - case ARG_DUMP: - sink->dump = g_value_get_boolean (value); - break; - case ARG_SYNC: - sink->sync = g_value_get_boolean (value); - break; - case ARG_SIGNAL_HANDOFFS: - sink->signal_handoffs = g_value_get_boolean (value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_fakesink_get_property (GObject * object, guint prop_id, GValue * value, - GParamSpec * pspec) -{ - GstFakeSink *sink; - - /* it's not null if we got it, but it might not be ours */ - g_return_if_fail (GST_IS_FAKESINK (object)); - - sink = GST_FAKESINK (object); - - switch (prop_id) { - case ARG_NUM_SINKS: - g_value_set_int (value, GST_ELEMENT (sink)->numsinkpads); - break; - case ARG_STATE_ERROR: - g_value_set_enum (value, sink->state_error); - break; - case ARG_SILENT: - g_value_set_boolean (value, sink->silent); - break; - case ARG_DUMP: - g_value_set_boolean (value, sink->dump); - break; - case ARG_SYNC: - g_value_set_boolean (value, sink->sync); - break; - case ARG_SIGNAL_HANDOFFS: - g_value_set_boolean (value, sink->signal_handoffs); - break; - case ARG_LAST_MESSAGE: - g_value_set_string (value, sink->last_message); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_fakesink_chain (GstPad * pad, GstData * _data) -{ - GstBuffer *buf = GST_BUFFER (_data); - GstFakeSink *fakesink; - - g_return_if_fail (pad != NULL); - g_return_if_fail (GST_IS_PAD (pad)); - g_return_if_fail (buf != NULL); - - fakesink = GST_FAKESINK (GST_OBJECT_PARENT (pad)); - - if (GST_IS_EVENT (buf)) { - GstEvent *event = GST_EVENT (buf); - - if (!fakesink->silent) { - g_free (fakesink->last_message); - - fakesink->last_message = - g_strdup_printf ("chain ******* (%s:%s)E (type: %d) %p", - GST_DEBUG_PAD_NAME (pad), GST_EVENT_TYPE (event), event); - - g_object_notify (G_OBJECT (fakesink), "last_message"); - } - - switch (GST_EVENT_TYPE (event)) { - case GST_EVENT_DISCONTINUOUS: - if (fakesink->sync && fakesink->clock) { - gint64 value = GST_EVENT_DISCONT_OFFSET (event, 0).value; - - gst_element_set_time (GST_ELEMENT (fakesink), value); - } - default: - gst_pad_event_default (pad, event); - break; - } - return; - } - - if (fakesink->sync && fakesink->clock) { - gst_element_wait (GST_ELEMENT (fakesink), GST_BUFFER_TIMESTAMP (buf)); - } - - if (!fakesink->silent) { - g_free (fakesink->last_message); - - fakesink->last_message = - g_strdup_printf ("chain ******* (%s:%s)< (%d bytes, timestamp: %" - GST_TIME_FORMAT ", duration: %" GST_TIME_FORMAT ", offset: %" - G_GINT64_FORMAT ", offset_end: %" G_GINT64_FORMAT ", flags: %d) %p", - GST_DEBUG_PAD_NAME (pad), GST_BUFFER_SIZE (buf), - GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)), - GST_TIME_ARGS (GST_BUFFER_DURATION (buf)), GST_BUFFER_OFFSET (buf), - GST_BUFFER_OFFSET_END (buf), GST_BUFFER_FLAGS (buf), buf); - - g_object_notify (G_OBJECT (fakesink), "last_message"); - } - - if (fakesink->signal_handoffs) - g_signal_emit (G_OBJECT (fakesink), gst_fakesink_signals[SIGNAL_HANDOFF], 0, - buf, pad); - - if (fakesink->dump) { - gst_util_dump_mem (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf)); - } - - gst_buffer_unref (buf); -} - -static GstElementStateReturn -gst_fakesink_change_state (GstElement * element) -{ - GstFakeSink *fakesink = GST_FAKESINK (element); - - switch (GST_STATE_TRANSITION (element)) { - case GST_STATE_NULL_TO_READY: - if (fakesink->state_error == FAKESINK_STATE_ERROR_NULL_READY) - goto error; - break; - case GST_STATE_READY_TO_PAUSED: - if (fakesink->state_error == FAKESINK_STATE_ERROR_READY_PAUSED) - goto error; - break; - case GST_STATE_PAUSED_TO_PLAYING: - if (fakesink->state_error == FAKESINK_STATE_ERROR_PAUSED_PLAYING) - goto error; - break; - case GST_STATE_PLAYING_TO_PAUSED: - if (!GST_FLAG_IS_SET (fakesink, GST_ELEMENT_IN_ERROR) && - fakesink->state_error == FAKESINK_STATE_ERROR_PLAYING_PAUSED) - goto error; - break; - case GST_STATE_PAUSED_TO_READY: - if (fakesink->state_error == FAKESINK_STATE_ERROR_PAUSED_READY) - goto error; - break; - case GST_STATE_READY_TO_NULL: - if (fakesink->state_error == FAKESINK_STATE_ERROR_READY_NULL) - goto error; - g_free (fakesink->last_message); - fakesink->last_message = NULL; - break; - } - - if (GST_ELEMENT_CLASS (parent_class)->change_state) - return GST_ELEMENT_CLASS (parent_class)->change_state (element); - - return GST_STATE_SUCCESS; - -error: - GST_ELEMENT_ERROR (element, CORE, STATE_CHANGE, (NULL), (NULL)); - return GST_STATE_FAILURE; -} diff --git a/plugins/elements/gstfakesink.h b/plugins/elements/gstfakesink.h deleted file mode 100644 index f41ad61d75..0000000000 --- a/plugins/elements/gstfakesink.h +++ /dev/null @@ -1,80 +0,0 @@ -/* GStreamer - * Copyright (C) 1999,2000 Erik Walthinsen - * 2000 Wim Taymans - * - * gstfakesink.h: - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - -#ifndef __GST_FAKESINK_H__ -#define __GST_FAKESINK_H__ - -#include - -G_BEGIN_DECLS - - -#define GST_TYPE_FAKESINK \ - (gst_fakesink_get_type()) -#define GST_FAKESINK(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FAKESINK,GstFakeSink)) -#define GST_FAKESINK_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FAKESINK,GstFakeSinkClass)) -#define GST_IS_FAKESINK(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FAKESINK)) -#define GST_IS_FAKESINK_CLASS(obj) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FAKESINK)) - -typedef enum { - FAKESINK_STATE_ERROR_NONE = 0, - FAKESINK_STATE_ERROR_NULL_READY, - FAKESINK_STATE_ERROR_READY_PAUSED, - FAKESINK_STATE_ERROR_PAUSED_PLAYING, - FAKESINK_STATE_ERROR_PLAYING_PAUSED, - FAKESINK_STATE_ERROR_PAUSED_READY, - FAKESINK_STATE_ERROR_READY_NULL -} GstFakeSinkStateError; - -typedef struct _GstFakeSink GstFakeSink; -typedef struct _GstFakeSinkClass GstFakeSinkClass; - -struct _GstFakeSink { - GstElement element; - - gboolean silent; - gboolean dump; - gboolean sync; - gboolean signal_handoffs; - GstClock *clock; - GstFakeSinkStateError state_error; - - gchar *last_message; -}; - -struct _GstFakeSinkClass { - GstElementClass parent_class; - - /* signals */ - void (*handoff) (GstElement *element, GstBuffer *buf, GstPad *pad); -}; - -GType gst_fakesink_get_type(void); - -G_END_DECLS - -#endif /* __GST_FAKESINK_H__ */ diff --git a/plugins/elements/gstfakesrc.c b/plugins/elements/gstfakesrc.c deleted file mode 100644 index 0b64860e90..0000000000 --- a/plugins/elements/gstfakesrc.c +++ /dev/null @@ -1,948 +0,0 @@ -/* GStreamer - * Copyright (C) 1999,2000 Erik Walthinsen - * 2000 Wim Taymans - * - * gstfakesrc.c: - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - -#include -#include - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include "gstfakesrc.h" -#include - -#define DEFAULT_SIZEMIN 0 -#define DEFAULT_SIZEMAX 4096 -#define DEFAULT_PARENTSIZE 4096*10 -#define DEFAULT_DATARATE 0 -#define DEFAULT_SYNC FALSE - -static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - -GST_DEBUG_CATEGORY_STATIC (gst_fakesrc_debug); -#define GST_CAT_DEFAULT gst_fakesrc_debug - -GstElementDetails gst_fakesrc_details = GST_ELEMENT_DETAILS ("Fake Source", - "Source", - "Push empty (no data) buffers around", - "Erik Walthinsen , " - "Wim Taymans "); - - -/* FakeSrc signals and args */ -enum -{ - /* FILL ME */ - SIGNAL_HANDOFF, - LAST_SIGNAL -}; - -enum -{ - ARG_0, - ARG_NUM_SOURCES, - ARG_LOOP_BASED, - ARG_OUTPUT, - ARG_DATA, - ARG_SIZETYPE, - ARG_SIZEMIN, - ARG_SIZEMAX, - ARG_FILLTYPE, - ARG_DATARATE, - ARG_SYNC, - ARG_PATTERN, - ARG_NUM_BUFFERS, - ARG_EOS, - ARG_SIGNAL_HANDOFFS, - ARG_SILENT, - ARG_DUMP, - ARG_PARENTSIZE, - ARG_LAST_MESSAGE -}; - -GstStaticPadTemplate fakesrc_src_template = GST_STATIC_PAD_TEMPLATE ("src%d", - GST_PAD_SRC, - GST_PAD_REQUEST, - GST_STATIC_CAPS_ANY); - -#define GST_TYPE_FAKESRC_OUTPUT (gst_fakesrc_output_get_type()) -static GType -gst_fakesrc_output_get_type (void) -{ - static GType fakesrc_output_type = 0; - static GEnumValue fakesrc_output[] = { - {FAKESRC_FIRST_LAST_LOOP, "1", "First-Last loop"}, - {FAKESRC_LAST_FIRST_LOOP, "2", "Last-First loop"}, - {FAKESRC_PING_PONG, "3", "Ping-Pong"}, - {FAKESRC_ORDERED_RANDOM, "4", "Ordered Random"}, - {FAKESRC_RANDOM, "5", "Random"}, - {FAKESRC_PATTERN_LOOP, "6", "Patttern loop"}, - {FAKESRC_PING_PONG_PATTERN, "7", "Ping-Pong Pattern"}, - {FAKESRC_GET_ALWAYS_SUCEEDS, "8", "'_get' Always succeeds"}, - {0, NULL, NULL}, - }; - - if (!fakesrc_output_type) { - fakesrc_output_type = - g_enum_register_static ("GstFakeSrcOutput", fakesrc_output); - } - return fakesrc_output_type; -} - -#define GST_TYPE_FAKESRC_DATA (gst_fakesrc_data_get_type()) -static GType -gst_fakesrc_data_get_type (void) -{ - static GType fakesrc_data_type = 0; - static GEnumValue fakesrc_data[] = { - {FAKESRC_DATA_ALLOCATE, "1", "Allocate data"}, - {FAKESRC_DATA_SUBBUFFER, "2", "Subbuffer data"}, - {0, NULL, NULL}, - }; - - if (!fakesrc_data_type) { - fakesrc_data_type = g_enum_register_static ("GstFakeSrcData", fakesrc_data); - } - return fakesrc_data_type; -} - -#define GST_TYPE_FAKESRC_SIZETYPE (gst_fakesrc_sizetype_get_type()) -static GType -gst_fakesrc_sizetype_get_type (void) -{ - static GType fakesrc_sizetype_type = 0; - static GEnumValue fakesrc_sizetype[] = { - {FAKESRC_SIZETYPE_NULL, "1", "Send empty buffers"}, - {FAKESRC_SIZETYPE_FIXED, "2", "Fixed size buffers (sizemax sized)"}, - {FAKESRC_SIZETYPE_RANDOM, "3", - "Random sized buffers (sizemin <= size <= sizemax)"}, - {0, NULL, NULL}, - }; - - if (!fakesrc_sizetype_type) { - fakesrc_sizetype_type = - g_enum_register_static ("GstFakeSrcSizeType", fakesrc_sizetype); - } - return fakesrc_sizetype_type; -} - -#define GST_TYPE_FAKESRC_FILLTYPE (gst_fakesrc_filltype_get_type()) -static GType -gst_fakesrc_filltype_get_type (void) -{ - static GType fakesrc_filltype_type = 0; - static GEnumValue fakesrc_filltype[] = { - {FAKESRC_FILLTYPE_NOTHING, "1", "Leave data as malloced"}, - {FAKESRC_FILLTYPE_NULL, "2", "Fill buffers with zeros"}, - {FAKESRC_FILLTYPE_RANDOM, "3", "Fill buffers with random crap"}, - {FAKESRC_FILLTYPE_PATTERN, "4", "Fill buffers with pattern 0x00 -> 0xff"}, - {FAKESRC_FILLTYPE_PATTERN_CONT, "5", - "Fill buffers with pattern 0x00 -> 0xff that spans buffers"}, - {0, NULL, NULL}, - }; - - if (!fakesrc_filltype_type) { - fakesrc_filltype_type = - g_enum_register_static ("GstFakeSrcFillType", fakesrc_filltype); - } - return fakesrc_filltype_type; -} - -#define _do_init(bla) \ - GST_DEBUG_CATEGORY_INIT (gst_fakesrc_debug, "fakesrc", 0, "fakesrc element"); - -GST_BOILERPLATE_FULL (GstFakeSrc, gst_fakesrc, GstElement, GST_TYPE_ELEMENT, - _do_init); - -static GstPad *gst_fakesrc_request_new_pad (GstElement * element, - GstPadTemplate * templ, const gchar * unused); -static void gst_fakesrc_update_functions (GstFakeSrc * src); -static void gst_fakesrc_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec); -static void gst_fakesrc_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec); -static void gst_fakesrc_set_clock (GstElement * element, GstClock * clock); - -static GstElementStateReturn gst_fakesrc_change_state (GstElement * element); - -static GstData *gst_fakesrc_get (GstPad * pad); -static void gst_fakesrc_loop (GstElement * element); - -static guint gst_fakesrc_signals[LAST_SIGNAL] = { 0 }; - -static void -gst_fakesrc_base_init (gpointer g_class) -{ - GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&srctemplate)); - gst_element_class_set_details (gstelement_class, &gst_fakesrc_details); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&fakesrc_src_template)); -} - -static void -gst_fakesrc_class_init (GstFakeSrcClass * klass) -{ - GObjectClass *gobject_class; - GstElementClass *gstelement_class; - - gobject_class = (GObjectClass *) klass; - gstelement_class = (GstElementClass *) klass; - - - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_SOURCES, - g_param_spec_int ("num-sources", "num-sources", "Number of sources", - 1, G_MAXINT, 1, G_PARAM_READABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOOP_BASED, - g_param_spec_boolean ("loop-based", "loop-based", - "Enable loop-based operation", FALSE, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_OUTPUT, - g_param_spec_enum ("output", "output", "Output method (currently unused)", - GST_TYPE_FAKESRC_OUTPUT, FAKESRC_FIRST_LAST_LOOP, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DATA, - g_param_spec_enum ("data", "data", "Data allocation method", - GST_TYPE_FAKESRC_DATA, FAKESRC_DATA_ALLOCATE, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SIZETYPE, - g_param_spec_enum ("sizetype", "sizetype", - "How to determine buffer sizes", GST_TYPE_FAKESRC_SIZETYPE, - FAKESRC_SIZETYPE_NULL, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SIZEMIN, - g_param_spec_int ("sizemin", "sizemin", "Minimum buffer size", 0, - G_MAXINT, DEFAULT_SIZEMIN, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SIZEMAX, - g_param_spec_int ("sizemax", "sizemax", "Maximum buffer size", 0, - G_MAXINT, DEFAULT_SIZEMAX, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PARENTSIZE, - g_param_spec_int ("parentsize", "parentsize", - "Size of parent buffer for sub-buffered allocation", 0, G_MAXINT, - DEFAULT_PARENTSIZE, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FILLTYPE, - g_param_spec_enum ("filltype", "filltype", - "How to fill the buffer, if at all", GST_TYPE_FAKESRC_FILLTYPE, - FAKESRC_FILLTYPE_NULL, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DATARATE, - g_param_spec_int ("datarate", "Datarate", - "Timestamps buffers with number of bytes per second (0 = none)", 0, - G_MAXINT, DEFAULT_DATARATE, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SYNC, - g_param_spec_boolean ("sync", "Sync", "Sync to the clock to the datarate", - DEFAULT_SYNC, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PATTERN, - g_param_spec_string ("pattern", "pattern", "pattern", NULL, - G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_BUFFERS, - g_param_spec_int ("num-buffers", "num-buffers", - "Number of buffers to output before sending EOS", -1, G_MAXINT, 0, - G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_EOS, - g_param_spec_boolean ("eos", "eos", "Send out the EOS event?", TRUE, - G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LAST_MESSAGE, - g_param_spec_string ("last-message", "last-message", - "The last status message", NULL, G_PARAM_READABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SILENT, - g_param_spec_boolean ("silent", "Silent", - "Don't produce last_message events", FALSE, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SIGNAL_HANDOFFS, - g_param_spec_boolean ("signal-handoffs", "Signal handoffs", - "Send a signal before pushing the buffer", FALSE, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DUMP, - g_param_spec_boolean ("dump", "Dump", "Dump produced bytes to stdout", - FALSE, G_PARAM_READWRITE)); - - gst_fakesrc_signals[SIGNAL_HANDOFF] = - g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GstFakeSrcClass, handoff), NULL, NULL, - gst_marshal_VOID__BOXED_OBJECT, G_TYPE_NONE, 2, - GST_TYPE_BUFFER | G_SIGNAL_TYPE_STATIC_SCOPE, GST_TYPE_PAD); - - gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_fakesrc_set_property); - gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_fakesrc_get_property); - - gstelement_class->request_new_pad = - GST_DEBUG_FUNCPTR (gst_fakesrc_request_new_pad); - gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_fakesrc_change_state); - gstelement_class->set_clock = GST_DEBUG_FUNCPTR (gst_fakesrc_set_clock); -} - -static void -gst_fakesrc_init (GstFakeSrc * fakesrc) -{ - GstPad *pad; - - /* create our first output pad */ - pad = - gst_pad_new_from_template (gst_static_pad_template_get (&srctemplate), - "src"); - gst_element_add_pad (GST_ELEMENT (fakesrc), pad); - - fakesrc->loop_based = FALSE; - gst_fakesrc_update_functions (fakesrc); - - fakesrc->output = FAKESRC_FIRST_LAST_LOOP; - fakesrc->segment_start = -1; - fakesrc->segment_end = -1; - fakesrc->num_buffers = -1; - fakesrc->rt_num_buffers = -1; - fakesrc->buffer_count = 0; - fakesrc->silent = FALSE; - fakesrc->signal_handoffs = FALSE; - fakesrc->dump = FALSE; - fakesrc->pattern_byte = 0x00; - fakesrc->need_flush = FALSE; - fakesrc->data = FAKESRC_DATA_ALLOCATE; - fakesrc->sizetype = FAKESRC_SIZETYPE_NULL; - fakesrc->filltype = FAKESRC_FILLTYPE_NOTHING; - fakesrc->sizemin = DEFAULT_SIZEMIN; - fakesrc->sizemax = DEFAULT_SIZEMAX; - fakesrc->parent = NULL; - fakesrc->parentsize = DEFAULT_PARENTSIZE; - fakesrc->last_message = NULL; - fakesrc->datarate = DEFAULT_DATARATE; - fakesrc->sync = DEFAULT_SYNC; -} - -static void -gst_fakesrc_set_clock (GstElement * element, GstClock * clock) -{ - GstFakeSrc *src; - - src = GST_FAKESRC (element); - - src->clock = clock; -} - - -static GstPad * -gst_fakesrc_request_new_pad (GstElement * element, GstPadTemplate * templ, - const gchar * unused) -{ - gchar *name; - GstPad *srcpad; - GstFakeSrc *fakesrc; - - g_return_val_if_fail (GST_IS_FAKESRC (element), NULL); - - if (templ->direction != GST_PAD_SRC) { - g_warning ("gstfakesrc: request new pad that is not a SRC pad\n"); - return NULL; - } - - fakesrc = GST_FAKESRC (element); - - name = g_strdup_printf ("src%d", GST_ELEMENT (fakesrc)->numsrcpads); - - srcpad = gst_pad_new_from_template (templ, name); - gst_element_add_pad (GST_ELEMENT (fakesrc), srcpad); - gst_fakesrc_update_functions (fakesrc); - - g_free (name); - - return srcpad; -} - -static const GstFormat * -gst_fakesrc_get_formats (GstPad * pad) -{ - static const GstFormat formats[] = { - GST_FORMAT_DEFAULT, - 0, - }; - - return formats; -} - -static const GstQueryType * -gst_fakesrc_get_query_types (GstPad * pad) -{ - static const GstQueryType types[] = { - GST_QUERY_TOTAL, - GST_QUERY_POSITION, - GST_QUERY_START, - GST_QUERY_SEGMENT_END, - 0, - }; - - return types; -} - -static gboolean -gst_fakesrc_query (GstPad * pad, GstQueryType type, - GstFormat * format, gint64 * value) -{ - GstFakeSrc *src = GST_FAKESRC (GST_PAD_PARENT (pad)); - - switch (type) { - case GST_QUERY_TOTAL: - *value = src->num_buffers; - break; - case GST_QUERY_POSITION: - *value = src->buffer_count; - break; - case GST_QUERY_START: - *value = src->segment_start; - break; - case GST_QUERY_SEGMENT_END: - *value = src->segment_end; - break; - default: - return FALSE; - } - return TRUE; -} - -static const GstEventMask * -gst_fakesrc_get_event_mask (GstPad * pad) -{ - static const GstEventMask masks[] = { - {GST_EVENT_SEEK, GST_SEEK_FLAG_FLUSH}, - {GST_EVENT_SEEK_SEGMENT, GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_SEGMENT_LOOP}, - {GST_EVENT_FLUSH, 0}, - {0, 0}, - }; - - return masks; -} - -static gboolean -gst_fakesrc_event_handler (GstPad * pad, GstEvent * event) -{ - GstFakeSrc *src; - - src = GST_FAKESRC (gst_pad_get_parent (pad)); - - switch (GST_EVENT_TYPE (event)) { - case GST_EVENT_SEEK: - src->buffer_count = GST_EVENT_SEEK_OFFSET (event); - - if (!GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_FLUSH) { - break; - } - /* else we do a flush too */ - case GST_EVENT_SEEK_SEGMENT: - src->segment_start = GST_EVENT_SEEK_OFFSET (event); - src->segment_end = GST_EVENT_SEEK_ENDOFFSET (event); - src->buffer_count = src->segment_start; - src->segment_loop = - GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_SEGMENT_LOOP; - break; - case GST_EVENT_FLUSH: - src->need_flush = TRUE; - break; - default: - break; - } - gst_event_unref (event); - - return TRUE; -} - -static void -gst_fakesrc_update_functions (GstFakeSrc * src) -{ - GList *pads; - - if (src->loop_based) { - gst_element_set_loop_function (GST_ELEMENT (src), - GST_DEBUG_FUNCPTR (gst_fakesrc_loop)); - } else { - gst_element_set_loop_function (GST_ELEMENT (src), NULL); - } - - pads = GST_ELEMENT (src)->pads; - while (pads) { - GstPad *pad = GST_PAD (pads->data); - - if (src->loop_based) { - gst_pad_set_get_function (pad, NULL); - } else { - gst_pad_set_get_function (pad, GST_DEBUG_FUNCPTR (gst_fakesrc_get)); - } - - gst_pad_set_event_function (pad, gst_fakesrc_event_handler); - gst_pad_set_event_mask_function (pad, gst_fakesrc_get_event_mask); - gst_pad_set_query_function (pad, gst_fakesrc_query); - gst_pad_set_query_type_function (pad, gst_fakesrc_get_query_types); - gst_pad_set_formats_function (pad, gst_fakesrc_get_formats); - pads = g_list_next (pads); - } -} - -static void -gst_fakesrc_alloc_parent (GstFakeSrc * src) -{ - GstBuffer *buf; - - buf = gst_buffer_new (); - GST_BUFFER_DATA (buf) = g_malloc (src->parentsize); - GST_BUFFER_SIZE (buf) = src->parentsize; - - src->parent = buf; - src->parentoffset = 0; -} - -static void -gst_fakesrc_set_property (GObject * object, guint prop_id, const GValue * value, - GParamSpec * pspec) -{ - GstFakeSrc *src; - - /* it's not null if we got it, but it might not be ours */ - src = GST_FAKESRC (object); - - switch (prop_id) { - case ARG_LOOP_BASED: - src->loop_based = g_value_get_boolean (value); - gst_fakesrc_update_functions (src); - break; - case ARG_OUTPUT: - g_warning ("not yet implemented"); - break; - case ARG_DATA: - src->data = g_value_get_enum (value); - - if (src->data == FAKESRC_DATA_SUBBUFFER) { - if (!src->parent) - gst_fakesrc_alloc_parent (src); - } else { - if (src->parent) { - gst_buffer_unref (src->parent); - src->parent = NULL; - } - } - break; - case ARG_SIZETYPE: - src->sizetype = g_value_get_enum (value); - break; - case ARG_SIZEMIN: - src->sizemin = g_value_get_int (value); - break; - case ARG_SIZEMAX: - src->sizemax = g_value_get_int (value); - break; - case ARG_PARENTSIZE: - src->parentsize = g_value_get_int (value); - break; - case ARG_FILLTYPE: - src->filltype = g_value_get_enum (value); - break; - case ARG_DATARATE: - src->datarate = g_value_get_int (value); - break; - case ARG_SYNC: - src->sync = g_value_get_boolean (value); - break; - case ARG_PATTERN: - break; - case ARG_NUM_BUFFERS: - src->num_buffers = g_value_get_int (value); - break; - case ARG_EOS: - src->eos = g_value_get_boolean (value); - GST_INFO ("will EOS on next buffer"); - break; - case ARG_SILENT: - src->silent = g_value_get_boolean (value); - break; - case ARG_SIGNAL_HANDOFFS: - src->signal_handoffs = g_value_get_boolean (value); - break; - case ARG_DUMP: - src->dump = g_value_get_boolean (value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_fakesrc_get_property (GObject * object, guint prop_id, GValue * value, - GParamSpec * pspec) -{ - GstFakeSrc *src; - - /* it's not null if we got it, but it might not be ours */ - g_return_if_fail (GST_IS_FAKESRC (object)); - - src = GST_FAKESRC (object); - - switch (prop_id) { - case ARG_NUM_SOURCES: - g_value_set_int (value, GST_ELEMENT (src)->numsrcpads); - break; - case ARG_LOOP_BASED: - g_value_set_boolean (value, src->loop_based); - break; - case ARG_OUTPUT: - g_value_set_enum (value, src->output); - break; - case ARG_DATA: - g_value_set_enum (value, src->data); - break; - case ARG_SIZETYPE: - g_value_set_enum (value, src->sizetype); - break; - case ARG_SIZEMIN: - g_value_set_int (value, src->sizemin); - break; - case ARG_SIZEMAX: - g_value_set_int (value, src->sizemax); - break; - case ARG_PARENTSIZE: - g_value_set_int (value, src->parentsize); - break; - case ARG_FILLTYPE: - g_value_set_enum (value, src->filltype); - break; - case ARG_DATARATE: - g_value_set_int (value, src->datarate); - break; - case ARG_SYNC: - g_value_set_boolean (value, src->sync); - break; - case ARG_PATTERN: - g_value_set_string (value, src->pattern); - break; - case ARG_NUM_BUFFERS: - g_value_set_int (value, src->num_buffers); - break; - case ARG_EOS: - g_value_set_boolean (value, src->eos); - break; - case ARG_SILENT: - g_value_set_boolean (value, src->silent); - break; - case ARG_SIGNAL_HANDOFFS: - g_value_set_boolean (value, src->signal_handoffs); - break; - case ARG_DUMP: - g_value_set_boolean (value, src->dump); - break; - case ARG_LAST_MESSAGE: - g_value_set_string (value, src->last_message); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_fakesrc_prepare_buffer (GstFakeSrc * src, GstBuffer * buf) -{ - if (GST_BUFFER_SIZE (buf) == 0) - return; - - switch (src->filltype) { - case FAKESRC_FILLTYPE_NULL: - memset (GST_BUFFER_DATA (buf), 0, GST_BUFFER_SIZE (buf)); - break; - case FAKESRC_FILLTYPE_RANDOM: - { - gint i; - guint8 *ptr = GST_BUFFER_DATA (buf); - - for (i = GST_BUFFER_SIZE (buf); i; i--) { - *ptr++ = (gint8) ((255.0) * rand () / (RAND_MAX)); - } - break; - } - case FAKESRC_FILLTYPE_PATTERN: - src->pattern_byte = 0x00; - case FAKESRC_FILLTYPE_PATTERN_CONT: - { - gint i; - guint8 *ptr = GST_BUFFER_DATA (buf); - - for (i = GST_BUFFER_SIZE (buf); i; i--) { - *ptr++ = src->pattern_byte++; - } - break; - } - case FAKESRC_FILLTYPE_NOTHING: - default: - break; - } -} - -static GstBuffer * -gst_fakesrc_alloc_buffer (GstFakeSrc * src, guint size) -{ - GstBuffer *buf; - - buf = gst_buffer_new (); - GST_BUFFER_SIZE (buf) = size; - - if (size != 0) { - switch (src->filltype) { - case FAKESRC_FILLTYPE_NOTHING: - GST_BUFFER_DATA (buf) = g_malloc (size); - break; - case FAKESRC_FILLTYPE_NULL: - GST_BUFFER_DATA (buf) = g_malloc0 (size); - break; - case FAKESRC_FILLTYPE_RANDOM: - case FAKESRC_FILLTYPE_PATTERN: - case FAKESRC_FILLTYPE_PATTERN_CONT: - default: - GST_BUFFER_DATA (buf) = g_malloc (size); - gst_fakesrc_prepare_buffer (src, buf); - break; - } - } - - return buf; -} - -static guint -gst_fakesrc_get_size (GstFakeSrc * src) -{ - guint size; - - switch (src->sizetype) { - case FAKESRC_SIZETYPE_FIXED: - size = src->sizemax; - break; - case FAKESRC_SIZETYPE_RANDOM: - size = - src->sizemin + - (guint8) (((gfloat) src->sizemax) * rand () / (RAND_MAX + - (gfloat) src->sizemin)); - break; - case FAKESRC_SIZETYPE_NULL: - default: - size = 0; - break; - } - - return size; -} - -static GstBuffer * -gst_fakesrc_create_buffer (GstFakeSrc * src) -{ - GstBuffer *buf; - guint size; - gboolean dump = src->dump; - - size = gst_fakesrc_get_size (src); - if (size == 0) - return gst_buffer_new (); - - switch (src->data) { - case FAKESRC_DATA_ALLOCATE: - buf = gst_fakesrc_alloc_buffer (src, size); - break; - case FAKESRC_DATA_SUBBUFFER: - /* see if we have a parent to subbuffer */ - if (!src->parent) { - gst_fakesrc_alloc_parent (src); - g_assert (src->parent); - } - /* see if it's large enough */ - if ((GST_BUFFER_SIZE (src->parent) - src->parentoffset) >= size) { - buf = gst_buffer_create_sub (src->parent, src->parentoffset, size); - src->parentoffset += size; - } else { - /* the parent is useless now */ - gst_buffer_unref (src->parent); - src->parent = NULL; - /* try again (this will allocate a new parent) */ - return gst_fakesrc_create_buffer (src); - } - gst_fakesrc_prepare_buffer (src, buf); - break; - default: - g_warning ("fakesrc: dunno how to allocate buffers !"); - buf = gst_buffer_new (); - break; - } - if (dump) { - gst_util_dump_mem (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf)); - } - - return buf; -} - -static GstData * -gst_fakesrc_get (GstPad * pad) -{ - GstFakeSrc *src; - GstBuffer *buf; - GstClockTime time; - - g_return_val_if_fail (pad != NULL, NULL); - - src = GST_FAKESRC (GST_OBJECT_PARENT (pad)); - - g_return_val_if_fail (GST_IS_FAKESRC (src), NULL); - - if (src->need_flush) { - src->need_flush = FALSE; - return GST_DATA (gst_event_new (GST_EVENT_FLUSH)); - } - - if (src->buffer_count == src->segment_end) { - if (src->segment_loop) { - return GST_DATA (gst_event_new (GST_EVENT_SEGMENT_DONE)); - } else { - gst_element_set_eos (GST_ELEMENT (src)); - return GST_DATA (gst_event_new (GST_EVENT_EOS)); - } - } - - if (src->rt_num_buffers == 0) { - gst_element_set_eos (GST_ELEMENT (src)); - return GST_DATA (gst_event_new (GST_EVENT_EOS)); - } else { - if (src->rt_num_buffers > 0) - src->rt_num_buffers--; - } - - if (src->eos) { - GST_INFO ("fakesrc is setting eos on pad"); - gst_element_set_eos (GST_ELEMENT (src)); - return GST_DATA (gst_event_new (GST_EVENT_EOS)); - } - - buf = gst_fakesrc_create_buffer (src); - GST_BUFFER_OFFSET (buf) = src->buffer_count++; - - time = GST_CLOCK_TIME_NONE; - - if (src->datarate > 0) { - time = (src->bytes_sent * GST_SECOND) / src->datarate; - if (src->sync) { - gst_element_wait (GST_ELEMENT (src), time); - } - - GST_BUFFER_DURATION (buf) = - GST_BUFFER_SIZE (buf) * GST_SECOND / src->datarate; - } - GST_BUFFER_TIMESTAMP (buf) = time; - - if (!src->silent) { - g_free (src->last_message); - - src->last_message = - g_strdup_printf ("get ******* (%s:%s)> (%d bytes, %" - G_GUINT64_FORMAT " ) %p", GST_DEBUG_PAD_NAME (pad), - GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf), buf); - - g_object_notify (G_OBJECT (src), "last_message"); - } - - if (src->signal_handoffs) { - GST_LOG_OBJECT (src, "pre handoff emit"); - g_signal_emit (G_OBJECT (src), gst_fakesrc_signals[SIGNAL_HANDOFF], 0, - buf, pad); - GST_LOG_OBJECT (src, "post handoff emit"); - } - - src->bytes_sent += GST_BUFFER_SIZE (buf); - - return GST_DATA (buf); -} - -/** - * gst_fakesrc_loop: - * @element: the faksesrc to loop - * - * generate an empty buffer and push it to the next element. - */ -static void -gst_fakesrc_loop (GstElement * element) -{ - GstFakeSrc *src; - const GList *pads; - - g_return_if_fail (element != NULL); - g_return_if_fail (GST_IS_FAKESRC (element)); - - src = GST_FAKESRC (element); - - pads = gst_element_get_pad_list (element); - - while (pads) { - GstPad *pad = GST_PAD (pads->data); - GstData *data; - - data = gst_fakesrc_get (pad); - gst_pad_push (pad, data); - - if (src->eos) { - return; - } - - pads = g_list_next (pads); - } -} - -static GstElementStateReturn -gst_fakesrc_change_state (GstElement * element) -{ - GstFakeSrc *fakesrc; - - g_return_val_if_fail (GST_IS_FAKESRC (element), GST_STATE_FAILURE); - - fakesrc = GST_FAKESRC (element); - - switch (GST_STATE_TRANSITION (element)) { - case GST_STATE_NULL_TO_READY: - break; - case GST_STATE_READY_TO_PAUSED: - fakesrc->buffer_count = 0; - fakesrc->pattern_byte = 0x00; - fakesrc->need_flush = FALSE; - fakesrc->eos = FALSE; - fakesrc->bytes_sent = 0; - fakesrc->rt_num_buffers = fakesrc->num_buffers; - break; - case GST_STATE_PAUSED_TO_PLAYING: - case GST_STATE_PLAYING_TO_PAUSED: - break; - case GST_STATE_PAUSED_TO_READY: - if (fakesrc->parent) { - gst_buffer_unref (fakesrc->parent); - fakesrc->parent = NULL; - } - g_free (fakesrc->last_message); - fakesrc->last_message = NULL; - break; - case GST_STATE_READY_TO_NULL: - break; - default: - break; - } - - if (GST_ELEMENT_CLASS (parent_class)->change_state) - return GST_ELEMENT_CLASS (parent_class)->change_state (element); - - return GST_STATE_SUCCESS; -} diff --git a/plugins/elements/gstfakesrc.h b/plugins/elements/gstfakesrc.h deleted file mode 100644 index 5214f0bb7c..0000000000 --- a/plugins/elements/gstfakesrc.h +++ /dev/null @@ -1,125 +0,0 @@ -/* GStreamer - * Copyright (C) 1999,2000 Erik Walthinsen - * 2000 Wim Taymans - * - * gstfakesrc.h: - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - -#ifndef __GST_FAKESRC_H__ -#define __GST_FAKESRC_H__ - -#include - -G_BEGIN_DECLS - - -typedef enum { - FAKESRC_FIRST_LAST_LOOP = 1, - FAKESRC_LAST_FIRST_LOOP, - FAKESRC_PING_PONG, - FAKESRC_ORDERED_RANDOM, - FAKESRC_RANDOM, - FAKESRC_PATTERN_LOOP, - FAKESRC_PING_PONG_PATTERN, - FAKESRC_GET_ALWAYS_SUCEEDS -} GstFakeSrcOutputType; - -typedef enum { - FAKESRC_DATA_ALLOCATE = 1, - FAKESRC_DATA_SUBBUFFER -} GstFakeSrcDataType; - -typedef enum { - FAKESRC_SIZETYPE_NULL = 1, - FAKESRC_SIZETYPE_FIXED, - FAKESRC_SIZETYPE_RANDOM -} GstFakeSrcSizeType; - -typedef enum { - FAKESRC_FILLTYPE_NOTHING = 1, - FAKESRC_FILLTYPE_NULL, - FAKESRC_FILLTYPE_RANDOM, - FAKESRC_FILLTYPE_PATTERN, - FAKESRC_FILLTYPE_PATTERN_CONT -} GstFakeSrcFillType; - -#define GST_TYPE_FAKESRC \ - (gst_fakesrc_get_type()) -#define GST_FAKESRC(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FAKESRC,GstFakeSrc)) -#define GST_FAKESRC_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FAKESRC,GstFakeSrcClass)) -#define GST_IS_FAKESRC(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FAKESRC)) -#define GST_IS_FAKESRC_CLASS(obj) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FAKESRC)) - -typedef struct _GstFakeSrc GstFakeSrc; -typedef struct _GstFakeSrcClass GstFakeSrcClass; - -struct _GstFakeSrc { - GstElement element; - - gboolean loop_based; - gboolean eos; - - GstFakeSrcOutputType output; - GstFakeSrcDataType data; - GstFakeSrcSizeType sizetype; - GstFakeSrcFillType filltype; - - guint sizemin; - guint sizemax; - GstBuffer *parent; - guint parentsize; - guint parentoffset; - guint8 pattern_byte; - gchar *pattern; - GList *patternlist; - gint datarate; - gboolean sync; - GstClock *clock; - gint64 segment_start; - gint64 segment_end; - gboolean segment_loop; - gint num_buffers; - gint rt_num_buffers; /* we are going to change this at runtime */ - guint64 buffer_count; - gboolean silent; - gboolean signal_handoffs; - gboolean dump; - gboolean need_flush; - - guint64 bytes_sent; - - gchar *last_message; -}; - -struct _GstFakeSrcClass { - GstElementClass parent_class; - - /* signals */ - void (*handoff) (GstElement *element, GstBuffer *buf, GstPad *pad); -}; - -GType gst_fakesrc_get_type(void); - -G_END_DECLS - -#endif /* __GST_FAKESRC_H__ */ diff --git a/plugins/elements/gstfdsink.c b/plugins/elements/gstfdsink.c deleted file mode 100644 index 0d7baff1ff..0000000000 --- a/plugins/elements/gstfdsink.c +++ /dev/null @@ -1,176 +0,0 @@ -/* GStreamer - * Copyright (C) 1999,2000 Erik Walthinsen - * 2000 Wim Taymans - * - * gstfdsink.c: - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include "gstfdsink.h" -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef _MSC_VER -#include -#endif - -static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - -GST_DEBUG_CATEGORY_STATIC (gst_fdsink_debug); -#define GST_CAT_DEFAULT gst_fdsink_debug - -GstElementDetails gst_fdsink_details = -GST_ELEMENT_DETAILS ("Filedescriptor Sink", - "Sink/File", - "Write data to a file descriptor", - "Erik Walthinsen "); - - -/* FdSink signals and args */ -enum -{ - /* FILL ME */ - LAST_SIGNAL -}; - -enum -{ - ARG_0, - ARG_FD -}; - - -#define _do_init(bla) \ - GST_DEBUG_CATEGORY_INIT (gst_fdsink_debug, "fdsink", 0, "fdsink element"); - -GST_BOILERPLATE_FULL (GstFdSink, gst_fdsink, GstElement, GST_TYPE_ELEMENT, - _do_init); - -static void gst_fdsink_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec); -static void gst_fdsink_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec); - -static void gst_fdsink_chain (GstPad * pad, GstData * _data); - - -static void -gst_fdsink_base_init (gpointer g_class) -{ - GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&sinktemplate)); - gst_element_class_set_details (gstelement_class, &gst_fdsink_details); -} -static void -gst_fdsink_class_init (GstFdSinkClass * klass) -{ - GObjectClass *gobject_class; - - gobject_class = G_OBJECT_CLASS (klass); - - - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FD, - g_param_spec_int ("fd", "fd", "An open file descriptor to write to", - 0, G_MAXINT, 1, G_PARAM_READWRITE)); - - gobject_class->set_property = gst_fdsink_set_property; - gobject_class->get_property = gst_fdsink_get_property; -} - -static void -gst_fdsink_init (GstFdSink * fdsink) -{ - fdsink->sinkpad = - gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate), - "sink"); - gst_element_add_pad (GST_ELEMENT (fdsink), fdsink->sinkpad); - gst_pad_set_chain_function (fdsink->sinkpad, gst_fdsink_chain); - - fdsink->fd = 1; -} - -static void -gst_fdsink_chain (GstPad * pad, GstData * _data) -{ - GstBuffer *buf = GST_BUFFER (_data); - GstFdSink *fdsink; - - g_return_if_fail (pad != NULL); - g_return_if_fail (GST_IS_PAD (pad)); - g_return_if_fail (buf != NULL); - - fdsink = GST_FDSINK (gst_pad_get_parent (pad)); - - g_return_if_fail (fdsink->fd >= 0); - - if (GST_BUFFER_DATA (buf)) { - GST_DEBUG ("writing %d bytes to file descriptor %d", GST_BUFFER_SIZE (buf), - fdsink->fd); - write (fdsink->fd, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf)); - } - - gst_buffer_unref (buf); -} - -static void -gst_fdsink_set_property (GObject * object, guint prop_id, const GValue * value, - GParamSpec * pspec) -{ - GstFdSink *fdsink; - - /* it's not null if we got it, but it might not be ours */ - g_return_if_fail (GST_IS_FDSINK (object)); - - fdsink = GST_FDSINK (object); - - switch (prop_id) { - case ARG_FD: - fdsink->fd = g_value_get_int (value); - break; - default: - break; - } -} - -static void -gst_fdsink_get_property (GObject * object, guint prop_id, GValue * value, - GParamSpec * pspec) -{ - GstFdSink *fdsink; - - /* it's not null if we got it, but it might not be ours */ - g_return_if_fail (GST_IS_FDSINK (object)); - - fdsink = GST_FDSINK (object); - - switch (prop_id) { - case ARG_FD: - g_value_set_int (value, fdsink->fd); - break; - default: - break; - } -} diff --git a/plugins/elements/gstfdsink.h b/plugins/elements/gstfdsink.h deleted file mode 100644 index 838705a724..0000000000 --- a/plugins/elements/gstfdsink.h +++ /dev/null @@ -1,62 +0,0 @@ -/* GStreamer - * Copyright (C) 1999,2000 Erik Walthinsen - * 2000 Wim Taymans - * - * gstfdsink.h: - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - -#ifndef __GST_FDSINK_H__ -#define __GST_FDSINK_H__ - -#include - -G_BEGIN_DECLS - - -#define GST_TYPE_FDSINK \ - (gst_fdsink_get_type()) -#define GST_FDSINK(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FDSINK,GstFdSink)) -#define GST_FDSINK_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FDSINK,GstFdSinkClass)) -#define GST_IS_FDSINK(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FDSINK)) -#define GST_IS_FDSINK_CLASS(obj) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FDSINK)) - -typedef struct _GstFdSink GstFdSink; -typedef struct _GstFdSinkClass GstFdSinkClass; - -struct _GstFdSink { - GstElement element; - - GstPad *sinkpad; - - int fd; -}; - -struct _GstFdSinkClass { - GstElementClass parent_class; -}; - -GType gst_fdsink_get_type(void); - -G_END_DECLS - -#endif /* __GST_FDSINK_H__ */ diff --git a/plugins/elements/gstfdsrc.c b/plugins/elements/gstfdsrc.c deleted file mode 100644 index fdeac10707..0000000000 --- a/plugins/elements/gstfdsrc.c +++ /dev/null @@ -1,396 +0,0 @@ -/* GStreamer - * Copyright (C) 1999,2000 Erik Walthinsen - * 2000 Wim Taymans - * - * gstfdsrc.c: - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif -#include "gst/gst_private.h" - -#ifndef HAVE_WIN32 -#include -#endif - -#include -#include -#include -#include -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef _MSC_VER -#include -#endif -#include -#include - -#include "gstfdsrc.h" - -#define DEFAULT_BLOCKSIZE 4096 - -static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - -GST_DEBUG_CATEGORY_STATIC (gst_fdsrc_debug); -#define GST_CAT_DEFAULT gst_fdsrc_debug - -GstElementDetails gst_fdsrc_details = GST_ELEMENT_DETAILS ("Disk Source", - "Source/File", - "Synchronous read from a file", - "Erik Walthinsen "); - - -/* FdSrc signals and args */ -enum -{ - SIGNAL_TIMEOUT, - LAST_SIGNAL -}; - -enum -{ - ARG_0, - ARG_FD, - ARG_BLOCKSIZE, - ARG_TIMEOUT -}; - -static guint gst_fdsrc_signals[LAST_SIGNAL] = { 0 }; - -static void gst_fdsrc_uri_handler_init (gpointer g_iface, gpointer iface_data); - -static void -_do_init (GType fdsrc_type) -{ - static const GInterfaceInfo urihandler_info = { - gst_fdsrc_uri_handler_init, - NULL, - NULL - }; - - g_type_add_interface_static (fdsrc_type, GST_TYPE_URI_HANDLER, - &urihandler_info); - - GST_DEBUG_CATEGORY_INIT (gst_fdsrc_debug, "fdsrc", 0, "fdsrc element"); -} - -GST_BOILERPLATE_FULL (GstFdSrc, gst_fdsrc, GstElement, GST_TYPE_ELEMENT, - _do_init); - -static void gst_fdsrc_dispose (GObject * obj); -static void gst_fdsrc_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec); -static void gst_fdsrc_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec); - -static GstElementStateReturn gst_fdsrc_change_state (GstElement * element); -static gboolean gst_fdsrc_release_locks (GstElement * element); -static GstData *gst_fdsrc_get (GstPad * pad); - - -static void -gst_fdsrc_base_init (gpointer g_class) -{ - GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&srctemplate)); - gst_element_class_set_details (gstelement_class, &gst_fdsrc_details); -} -static void -gst_fdsrc_class_init (GstFdSrcClass * klass) -{ - GObjectClass *gobject_class; - GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass); - - gobject_class = G_OBJECT_CLASS (klass); - - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FD, - g_param_spec_int ("fd", "fd", "An open file descriptor to read from", - 0, G_MAXINT, 0, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BLOCKSIZE, - g_param_spec_ulong ("blocksize", "Block size", - "Size in bytes to read per buffer", 1, G_MAXULONG, DEFAULT_BLOCKSIZE, - G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TIMEOUT, - g_param_spec_uint64 ("timeout", "Timeout", "Read timeout in nanoseconds", - 0, G_MAXUINT64, 0, G_PARAM_READWRITE)); - - gst_fdsrc_signals[SIGNAL_TIMEOUT] = - g_signal_new ("timeout", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GstFdSrcClass, timeout), NULL, NULL, - g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); - - gobject_class->set_property = gst_fdsrc_set_property; - gobject_class->get_property = gst_fdsrc_get_property; - gobject_class->dispose = gst_fdsrc_dispose; - - gstelement_class->change_state = gst_fdsrc_change_state; - gstelement_class->release_locks = gst_fdsrc_release_locks; -} - -static void -gst_fdsrc_dispose (GObject * obj) -{ - GstFdSrc *src = GST_FDSRC (obj); - - g_free (src->uri); - src->uri = NULL; - - G_OBJECT_CLASS (parent_class)->dispose (obj); -} - -static void -gst_fdsrc_init (GstFdSrc * fdsrc) -{ - fdsrc->srcpad = - gst_pad_new_from_template (gst_static_pad_template_get (&srctemplate), - "src"); - - gst_pad_set_get_function (fdsrc->srcpad, gst_fdsrc_get); - gst_element_add_pad (GST_ELEMENT (fdsrc), fdsrc->srcpad); - - fdsrc->fd = 0; - fdsrc->uri = g_strdup_printf ("fd://%d", fdsrc->fd); - fdsrc->curoffset = 0; - fdsrc->blocksize = DEFAULT_BLOCKSIZE; - fdsrc->timeout = 0; - fdsrc->seq = 0; -} - -static GstElementStateReturn -gst_fdsrc_change_state (GstElement * element) -{ - GstFdSrc *src = GST_FDSRC (element); - - switch (GST_STATE_TRANSITION (element)) { - case GST_STATE_READY_TO_PAUSED: - src->curoffset = 0; - break; - default: - break; - } - - /* in any case, an interrupt succeeds if we get here */ - src->interrupted = FALSE; - - if (GST_ELEMENT_CLASS (parent_class)->change_state) - return GST_ELEMENT_CLASS (parent_class)->change_state (element); - - return GST_STATE_SUCCESS; -} - - -static void -gst_fdsrc_set_property (GObject * object, guint prop_id, const GValue * value, - GParamSpec * pspec) -{ - GstFdSrc *src; - - /* it's not null if we got it, but it might not be ours */ - g_return_if_fail (GST_IS_FDSRC (object)); - - src = GST_FDSRC (object); - - switch (prop_id) { - case ARG_FD: - src->fd = g_value_get_int (value); - g_free (src->uri); - src->uri = g_strdup_printf ("fd://%d", src->fd); - break; - case ARG_BLOCKSIZE: - src->blocksize = g_value_get_ulong (value); - break; - case ARG_TIMEOUT: - src->timeout = g_value_get_uint64 (value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_fdsrc_get_property (GObject * object, guint prop_id, GValue * value, - GParamSpec * pspec) -{ - GstFdSrc *src; - - /* it's not null if we got it, but it might not be ours */ - g_return_if_fail (GST_IS_FDSRC (object)); - - src = GST_FDSRC (object); - - switch (prop_id) { - case ARG_BLOCKSIZE: - g_value_set_ulong (value, src->blocksize); - break; - case ARG_FD: - g_value_set_int (value, src->fd); - break; - case ARG_TIMEOUT: - g_value_set_uint64 (value, src->timeout); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static gboolean -gst_fdsrc_release_locks (GstElement * element) -{ - GstFdSrc *src = GST_FDSRC (element); - - src->interrupted = TRUE; - - return TRUE; -} - -static GstData * -gst_fdsrc_get (GstPad * pad) -{ - GstFdSrc *src; - GstBuffer *buf; - glong readbytes; - -#ifndef HAVE_WIN32 - fd_set readfds; - struct timeval t; - gint retval; -#endif - - src = GST_FDSRC (gst_pad_get_parent (pad)); - - /* create the buffer */ - buf = gst_buffer_new_and_alloc (src->blocksize); - -#ifndef HAVE_WIN32 - FD_ZERO (&readfds); - FD_SET (src->fd, &readfds); - - /* loop until data is available, or a timeout is set. Re-enter - * loop if we got a timeout without a timeout set, or if we - * received an interrupt event. */ - do { - if (src->timeout != 0) { - GST_TIME_TO_TIMEVAL (src->timeout, t); - } else { - GST_TIME_TO_TIMEVAL (1000000000, t); - } - - retval = select (src->fd + 1, &readfds, NULL, NULL, &t); - } while (!src->interrupted && - ((retval == -1 && errno == EINTR) || (retval == 0 && src->timeout == 0))); - - if (src->interrupted) { - GST_DEBUG_OBJECT (src, "received interrupt"); - return GST_DATA (gst_event_new (GST_EVENT_INTERRUPT)); - } else if (retval == -1) { - GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL), - ("select on file descriptor: %s.", g_strerror (errno))); - gst_element_set_eos (GST_ELEMENT (src)); - return GST_DATA (gst_event_new (GST_EVENT_EOS)); - } else if (retval == 0) { - g_signal_emit (G_OBJECT (src), gst_fdsrc_signals[SIGNAL_TIMEOUT], 0); - gst_element_set_eos (GST_ELEMENT (src)); - return GST_DATA (gst_event_new (GST_EVENT_EOS)); - } -#endif - - do { - readbytes = read (src->fd, GST_BUFFER_DATA (buf), src->blocksize); - } while (readbytes == -1 && errno == EINTR); /* retry if interrupted */ - - if (readbytes > 0) { - GST_BUFFER_OFFSET (buf) = src->curoffset; - GST_BUFFER_SIZE (buf) = readbytes; - GST_BUFFER_TIMESTAMP (buf) = GST_CLOCK_TIME_NONE; - src->curoffset += readbytes; - - /* we're done, return the buffer */ - return GST_DATA (buf); - } else if (readbytes == 0) { - gst_element_set_eos (GST_ELEMENT (src)); - return GST_DATA (gst_event_new (GST_EVENT_EOS)); - } else { - GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL), - ("read on file descriptor: %s.", g_strerror (errno))); - gst_element_set_eos (GST_ELEMENT (src)); - return GST_DATA (gst_event_new (GST_EVENT_EOS)); - } -} - -/*** GSTURIHANDLER INTERFACE *************************************************/ - -static guint -gst_fdsrc_uri_get_type (void) -{ - return GST_URI_SRC; -} -static gchar ** -gst_fdsrc_uri_get_protocols (void) -{ - static gchar *protocols[] = { "fd", NULL }; - - return protocols; -} -static const gchar * -gst_fdsrc_uri_get_uri (GstURIHandler * handler) -{ - GstFdSrc *src = GST_FDSRC (handler); - - return src->uri; -} - -static gboolean -gst_fdsrc_uri_set_uri (GstURIHandler * handler, const gchar * uri) -{ - gchar *protocol; - GstFdSrc *src = GST_FDSRC (handler); - gint fd = src->fd; - - protocol = gst_uri_get_protocol (uri); - if (strcmp (protocol, "fd") != 0) { - g_free (protocol); - return FALSE; - } - g_free (protocol); - sscanf (uri, "fd://%d", &fd); - src->fd = fd; - g_free (src->uri); - src->uri = g_strdup (uri); - - return TRUE; -} - -static void -gst_fdsrc_uri_handler_init (gpointer g_iface, gpointer iface_data) -{ - GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_iface; - - iface->get_type = gst_fdsrc_uri_get_type; - iface->get_protocols = gst_fdsrc_uri_get_protocols; - iface->get_uri = gst_fdsrc_uri_get_uri; - iface->set_uri = gst_fdsrc_uri_set_uri; -} diff --git a/plugins/elements/gstfdsrc.h b/plugins/elements/gstfdsrc.h deleted file mode 100644 index 89e87682b8..0000000000 --- a/plugins/elements/gstfdsrc.h +++ /dev/null @@ -1,75 +0,0 @@ -/* GStreamer - * Copyright (C) 1999,2000 Erik Walthinsen - * 2000 Wim Taymans - * - * gstfdsrc.h: - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - -#ifndef __GST_FDSRC_H__ -#define __GST_FDSRC_H__ - -#include - -G_BEGIN_DECLS - - -#define GST_TYPE_FDSRC \ - (gst_fdsrc_get_type()) -#define GST_FDSRC(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FDSRC,GstFdSrc)) -#define GST_FDSRC_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FDSRC,GstFdSrcClass)) -#define GST_IS_FDSRC(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FDSRC)) -#define GST_IS_FDSRC_CLASS(obj) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FDSRC)) - - -typedef struct _GstFdSrc GstFdSrc; -typedef struct _GstFdSrcClass GstFdSrcClass; - -struct _GstFdSrc { - GstElement element; - /* pads */ - GstPad *srcpad; - - /* fd */ - gint fd; - gboolean interrupted; - gchar *uri; - - gulong curoffset; /* current offset in file */ - gulong blocksize; /* bytes per read */ - guint64 timeout; /* read timeout, in nanoseconds */ - - gulong seq; /* buffer sequence number */ -}; - -struct _GstFdSrcClass { - GstElementClass parent_class; - - /* signals */ - void (*timeout) (GstElement *element); -}; - -GType gst_fdsrc_get_type(void); - -G_END_DECLS - -#endif /* __GST_FDSRC_H__ */ diff --git a/plugins/elements/gstfilesink.c b/plugins/elements/gstfilesink.c deleted file mode 100644 index a575d5a363..0000000000 --- a/plugins/elements/gstfilesink.c +++ /dev/null @@ -1,546 +0,0 @@ -/* GStreamer - * Copyright (C) 1999,2000 Erik Walthinsen - * 2000 Wim Taymans - * - * gstfilesink.c: - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include "../gst-i18n-lib.h" - -#include -#include -#include "gstfilesink.h" -#include -#include -#include -#ifdef HAVE_UNISTD_H -#include -#endif - - -static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - -GST_DEBUG_CATEGORY_STATIC (gst_filesink_debug); -#define GST_CAT_DEFAULT gst_filesink_debug - -GstElementDetails gst_filesink_details = GST_ELEMENT_DETAILS ("File Sink", - "Sink/File", - "Write stream to a file", - "Thomas "); - - -/* FileSink signals and args */ -enum -{ - /* FILL ME */ - SIGNAL_HANDOFF, - LAST_SIGNAL -}; - -enum -{ - ARG_0, - ARG_LOCATION -}; - -static const GstFormat * -gst_filesink_get_formats (GstPad * pad) -{ - static const GstFormat formats[] = { - GST_FORMAT_BYTES, - 0, - }; - - return formats; -} - -static const GstQueryType * -gst_filesink_get_query_types (GstPad * pad) -{ - static const GstQueryType types[] = { - GST_QUERY_TOTAL, - GST_QUERY_POSITION, - 0 - }; - - return types; -} - -static void gst_filesink_dispose (GObject * object); - -static void gst_filesink_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec); -static void gst_filesink_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec); - -static gboolean gst_filesink_open_file (GstFileSink * sink); -static void gst_filesink_close_file (GstFileSink * sink); - -static gboolean gst_filesink_handle_event (GstPad * pad, GstEvent * event); -static gboolean gst_filesink_pad_query (GstPad * pad, GstQueryType type, - GstFormat * format, gint64 * value); -static void gst_filesink_chain (GstPad * pad, GstData * _data); - -static void gst_filesink_uri_handler_init (gpointer g_iface, - gpointer iface_data); - -static GstElementStateReturn gst_filesink_change_state (GstElement * element); - -static guint gst_filesink_signals[LAST_SIGNAL] = { 0 }; - -static void -_do_init (GType filesink_type) -{ - static const GInterfaceInfo urihandler_info = { - gst_filesink_uri_handler_init, - NULL, - NULL - }; - - g_type_add_interface_static (filesink_type, GST_TYPE_URI_HANDLER, - &urihandler_info); - GST_DEBUG_CATEGORY_INIT (gst_filesink_debug, "filesink", 0, - "filesink element"); -} - -GST_BOILERPLATE_FULL (GstFileSink, gst_filesink, GstElement, GST_TYPE_ELEMENT, - _do_init); - - -static void -gst_filesink_base_init (gpointer g_class) -{ - GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); - - gstelement_class->change_state = gst_filesink_change_state; - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&sinktemplate)); - gst_element_class_set_details (gstelement_class, &gst_filesink_details); -} -static void -gst_filesink_class_init (GstFileSinkClass * klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - - - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOCATION, - g_param_spec_string ("location", "File Location", - "Location of the file to write", NULL, G_PARAM_READWRITE)); - - gst_filesink_signals[SIGNAL_HANDOFF] = - g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GstFileSinkClass, handoff), NULL, NULL, - g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); - - gobject_class->set_property = gst_filesink_set_property; - gobject_class->get_property = gst_filesink_get_property; - gobject_class->dispose = gst_filesink_dispose; -} -static void -gst_filesink_init (GstFileSink * filesink) -{ - GstPad *pad; - - pad = - gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate), - "sink"); - gst_element_add_pad (GST_ELEMENT (filesink), pad); - gst_pad_set_chain_function (pad, gst_filesink_chain); - - GST_FLAG_SET (GST_ELEMENT (filesink), GST_ELEMENT_EVENT_AWARE); - - gst_pad_set_query_function (pad, gst_filesink_pad_query); - gst_pad_set_query_type_function (pad, gst_filesink_get_query_types); - gst_pad_set_formats_function (pad, gst_filesink_get_formats); - - filesink->filename = NULL; - filesink->file = NULL; -} -static void -gst_filesink_dispose (GObject * object) -{ - GstFileSink *sink = GST_FILESINK (object); - - G_OBJECT_CLASS (parent_class)->dispose (object); - - g_free (sink->uri); - sink->uri = NULL; - g_free (sink->filename); - sink->filename = NULL; -} - -static gboolean -gst_filesink_set_location (GstFileSink * sink, const gchar * location) -{ - /* the element must be stopped or paused in order to do this */ - if (GST_STATE (sink) > GST_STATE_PAUSED) - return FALSE; - if (GST_STATE (sink) == GST_STATE_PAUSED && - GST_FLAG_IS_SET (sink, GST_FILESINK_OPEN)) - return FALSE; - - g_free (sink->filename); - g_free (sink->uri); - if (location != NULL) { - sink->filename = g_strdup (location); - sink->uri = gst_uri_construct ("file", location); - } else { - sink->filename = NULL; - sink->uri = NULL; - } - - if (GST_STATE (sink) == GST_STATE_PAUSED) - gst_filesink_open_file (sink); - - return TRUE; -} -static void -gst_filesink_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec) -{ - GstFileSink *sink; - - /* it's not null if we got it, but it might not be ours */ - sink = GST_FILESINK (object); - - switch (prop_id) { - case ARG_LOCATION: - gst_filesink_set_location (sink, g_value_get_string (value)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_filesink_get_property (GObject * object, guint prop_id, GValue * value, - GParamSpec * pspec) -{ - GstFileSink *sink; - - /* it's not null if we got it, but it might not be ours */ - g_return_if_fail (GST_IS_FILESINK (object)); - - sink = GST_FILESINK (object); - - switch (prop_id) { - case ARG_LOCATION: - g_value_set_string (value, sink->filename); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static gboolean -gst_filesink_open_file (GstFileSink * sink) -{ - g_return_val_if_fail (!GST_FLAG_IS_SET (sink, GST_FILESINK_OPEN), FALSE); - - /* open the file */ - if (sink->filename == NULL || sink->filename[0] == '\0') { - GST_ELEMENT_ERROR (sink, RESOURCE, NOT_FOUND, - (_("No file name specified for writing.")), (NULL)); - return FALSE; - } - - sink->file = fopen (sink->filename, "wb"); - if (sink->file == NULL) { - GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE, - (_("Could not open file \"%s\" for writing."), sink->filename), - GST_ERROR_SYSTEM); - return FALSE; - } - - GST_FLAG_SET (sink, GST_FILESINK_OPEN); - - sink->data_written = 0; - - return TRUE; -} - -static void -gst_filesink_close_file (GstFileSink * sink) -{ - g_return_if_fail (GST_FLAG_IS_SET (sink, GST_FILESINK_OPEN)); - - if (fclose (sink->file) != 0) { - GST_ELEMENT_ERROR (sink, RESOURCE, CLOSE, - (_("Error closing file \"%s\"."), sink->filename), GST_ERROR_SYSTEM); - } else { - GST_FLAG_UNSET (sink, GST_FILESINK_OPEN); - } -} - -static gboolean -gst_filesink_pad_query (GstPad * pad, GstQueryType type, - GstFormat * format, gint64 * value) -{ - GstFileSink *sink = GST_FILESINK (GST_PAD_PARENT (pad)); - - switch (type) { - case GST_QUERY_TOTAL: - switch (*format) { - case GST_FORMAT_BYTES: - if (GST_FLAG_IS_SET (GST_ELEMENT (sink), GST_FILESINK_OPEN)) { - *value = sink->data_written; /* FIXME - doesn't the kernel provide - such a function? */ - break; - } - default: - return FALSE; - } - break; - case GST_QUERY_POSITION: - switch (*format) { - case GST_FORMAT_BYTES: - if (GST_FLAG_IS_SET (GST_ELEMENT (sink), GST_FILESINK_OPEN)) { - *value = ftell (sink->file); - break; - } - default: - return FALSE; - } - break; - default: - return FALSE; - } - - return TRUE; -} - -/* handle events (search) */ -static gboolean -gst_filesink_handle_event (GstPad * pad, GstEvent * event) -{ - GstEventType type; - GstFileSink *filesink; - - filesink = GST_FILESINK (gst_pad_get_parent (pad)); - - if (!(GST_FLAG_IS_SET (filesink, GST_FILESINK_OPEN))) { - gst_event_unref (event); - return FALSE; - } - - type = event ? GST_EVENT_TYPE (event) : GST_EVENT_UNKNOWN; - - switch (type) { - case GST_EVENT_SEEK: - if (GST_EVENT_SEEK_FORMAT (event) != GST_FORMAT_BYTES) { - gst_event_unref (event); - return FALSE; - } - - if (GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_FLUSH) { - if (fflush (filesink->file)) { - gst_event_unref (event); - GST_ELEMENT_ERROR (filesink, RESOURCE, WRITE, - (_("Error while writing to file \"%s\"."), filesink->filename), - GST_ERROR_SYSTEM); - return FALSE; - } - } - - switch (GST_EVENT_SEEK_METHOD (event)) { - case GST_SEEK_METHOD_SET: - fseek (filesink->file, GST_EVENT_SEEK_OFFSET (event), SEEK_SET); - break; - case GST_SEEK_METHOD_CUR: - fseek (filesink->file, GST_EVENT_SEEK_OFFSET (event), SEEK_CUR); - break; - case GST_SEEK_METHOD_END: - fseek (filesink->file, GST_EVENT_SEEK_OFFSET (event), SEEK_END); - break; - default: - g_warning ("unknown seek method!"); - break; - } - gst_event_unref (event); - break; - case GST_EVENT_DISCONTINUOUS: - { - gint64 offset; - - if (gst_event_discont_get_value (event, GST_FORMAT_BYTES, &offset)) - fseek (filesink->file, offset, SEEK_SET); - - gst_event_unref (event); - break; - } - case GST_EVENT_FLUSH: - if (fflush (filesink->file)) { - gst_event_unref (event); - GST_ELEMENT_ERROR (filesink, RESOURCE, WRITE, - (_("Error while writing to file \"%s\"."), filesink->filename), - GST_ERROR_SYSTEM); - } - break; - case GST_EVENT_EOS: - gst_event_unref (event); - gst_filesink_close_file (filesink); - gst_element_set_eos (GST_ELEMENT (filesink)); - break; - default: - gst_pad_event_default (pad, event); - break; - } - - return TRUE; -} - -/** - * gst_filesink_chain: - * @pad: the pad this filesink is connected to - * @buf: the buffer that has to be absorbed - * - * take the buffer from the pad and write to file if it's open - */ -static void -gst_filesink_chain (GstPad * pad, GstData * _data) -{ - GstBuffer *buf = GST_BUFFER (_data); - GstFileSink *filesink; - - g_return_if_fail (pad != NULL); - g_return_if_fail (GST_IS_PAD (pad)); - g_return_if_fail (buf != NULL); - - filesink = GST_FILESINK (gst_pad_get_parent (pad)); - - if (GST_IS_EVENT (buf)) { - gst_filesink_handle_event (pad, GST_EVENT (buf)); - return; - } - - if (GST_FLAG_IS_SET (filesink, GST_FILESINK_OPEN)) { - guint bytes_written = 0, back_pending = 0; - - if (ftell (filesink->file) < filesink->data_written) - back_pending = filesink->data_written - ftell (filesink->file); - while (bytes_written < GST_BUFFER_SIZE (buf)) { - size_t wrote = fwrite (GST_BUFFER_DATA (buf) + bytes_written, 1, - GST_BUFFER_SIZE (buf) - bytes_written, - filesink->file); - - if (wrote <= 0) { - GST_ELEMENT_ERROR (filesink, RESOURCE, WRITE, - (_("Error while writing to file \"%s\"."), filesink->filename), - ("Only %d of %d bytes written: %s", - bytes_written, GST_BUFFER_SIZE (buf), strerror (errno))); - break; - } - bytes_written += wrote; - } - - filesink->data_written += bytes_written - back_pending; - } - - gst_buffer_unref (buf); - - g_signal_emit (G_OBJECT (filesink), - gst_filesink_signals[SIGNAL_HANDOFF], 0, filesink); -} - -static GstElementStateReturn -gst_filesink_change_state (GstElement * element) -{ - g_return_val_if_fail (GST_IS_FILESINK (element), GST_STATE_FAILURE); - - switch (GST_STATE_TRANSITION (element)) { - case GST_STATE_PAUSED_TO_READY: - if (GST_FLAG_IS_SET (element, GST_FILESINK_OPEN)) - gst_filesink_close_file (GST_FILESINK (element)); - break; - - case GST_STATE_READY_TO_PAUSED: - if (!GST_FLAG_IS_SET (element, GST_FILESINK_OPEN)) { - if (!gst_filesink_open_file (GST_FILESINK (element))) - return GST_STATE_FAILURE; - } - break; - } - - if (GST_ELEMENT_CLASS (parent_class)->change_state) - return GST_ELEMENT_CLASS (parent_class)->change_state (element); - - return GST_STATE_SUCCESS; -} - -/*** GSTURIHANDLER INTERFACE *************************************************/ - -static guint -gst_filesink_uri_get_type (void) -{ - return GST_URI_SINK; -} -static gchar ** -gst_filesink_uri_get_protocols (void) -{ - static gchar *protocols[] = { "file", NULL }; - - return protocols; -} -static const gchar * -gst_filesink_uri_get_uri (GstURIHandler * handler) -{ - GstFileSink *sink = GST_FILESINK (handler); - - return sink->uri; -} - -static gboolean -gst_filesink_uri_set_uri (GstURIHandler * handler, const gchar * uri) -{ - gchar *protocol, *location; - gboolean ret; - GstFileSink *sink = GST_FILESINK (handler); - - protocol = gst_uri_get_protocol (uri); - if (strcmp (protocol, "file") != 0) { - g_free (protocol); - return FALSE; - } - g_free (protocol); - location = gst_uri_get_location (uri); - ret = gst_filesink_set_location (sink, location); - g_free (location); - - return ret; -} - -static void -gst_filesink_uri_handler_init (gpointer g_iface, gpointer iface_data) -{ - GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_iface; - - iface->get_type = gst_filesink_uri_get_type; - iface->get_protocols = gst_filesink_uri_get_protocols; - iface->get_uri = gst_filesink_uri_get_uri; - iface->set_uri = gst_filesink_uri_set_uri; -} diff --git a/plugins/elements/gstfilesink.h b/plugins/elements/gstfilesink.h deleted file mode 100644 index bd85a1d012..0000000000 --- a/plugins/elements/gstfilesink.h +++ /dev/null @@ -1,73 +0,0 @@ -/* GStreamer - * Copyright (C) 1999,2000 Erik Walthinsen - * 2000 Wim Taymans - * - * gstfilesink.h: - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - -#ifndef __GST_FILESINK_H__ -#define __GST_FILESINK_H__ - -#include - -G_BEGIN_DECLS - - -#define GST_TYPE_FILESINK \ - (gst_filesink_get_type()) -#define GST_FILESINK(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FILESINK,GstFileSink)) -#define GST_FILESINK_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FILESINK,GstFileSinkClass)) -#define GST_IS_FILESINK(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FILESINK)) -#define GST_IS_FILESINK_CLASS(obj) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FILESINK)) - -typedef struct _GstFileSink GstFileSink; -typedef struct _GstFileSinkClass GstFileSinkClass; - -typedef enum { - GST_FILESINK_OPEN = GST_ELEMENT_FLAG_LAST, - - GST_FILESINK_FLAG_LAST = GST_ELEMENT_FLAG_LAST + 2 -} GstFileSinkFlags; - -struct _GstFileSink { - GstElement element; - - gchar *filename; - gchar *uri; - FILE *file; - - guint64 data_written; -}; - -struct _GstFileSinkClass { - GstElementClass parent_class; - - /* signals */ - void (*handoff) (GstElement *element, GstPad *pad); -}; - -GType gst_filesink_get_type(void); - -G_END_DECLS - -#endif /* __GST_FILESINK_H__ */ diff --git a/plugins/elements/gstfilesrc.c b/plugins/elements/gstfilesrc.c deleted file mode 100644 index db3b5d40f1..0000000000 --- a/plugins/elements/gstfilesrc.c +++ /dev/null @@ -1,1082 +0,0 @@ -/* GStreamer - * Copyright (C) 1999,2000 Erik Walthinsen - * 2000 Wim Taymans - * - * gstfilesrc.c: - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include "gstfilesrc.h" - -#include -#include -#include -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef _MSC_VER -#include -#endif -#ifdef HAVE_MMAP -#include -#endif -#include -#include - -#include "../gst-i18n-lib.h" - -static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - -/* FIXME we should be using glib for this */ -#ifndef S_ISREG -#define S_ISREG(mode) ((mode)&_S_IFREG) -#endif -#ifndef S_ISDIR -#define S_ISDIR(mode) ((mode)&_S_IFDIR) -#endif -#ifndef S_ISSOCK -#define S_ISSOCK(x) (0) -#endif -#ifndef O_BINARY -#define O_BINARY (0) -#endif - - -/********************************************************************** - * GStreamer Default File Source - * Theory of Operation - * - * This source uses mmap(2) to efficiently load data from a file. - * To do this without seriously polluting the applications' memory - * space, it must do so in smaller chunks, say 1-4MB at a time. - * Buffers are then subdivided from these mmap'd chunks, to directly - * make use of the mmap. - * - * To handle refcounting so that the mmap can be freed at the appropriate - * time, a buffer will be created for each mmap'd region, and all new - * buffers will be sub-buffers of this top-level buffer. As they are - * freed, the refcount goes down on the mmap'd buffer and its free() - * function is called, which will call munmap(2) on itself. - * - * If a buffer happens to cross the boundaries of an mmap'd region, we - * have to decide whether it's more efficient to copy the data into a - * new buffer, or mmap() just that buffer. There will have to be a - * breakpoint size to determine which will be done. The mmap() size - * has a lot to do with this as well, because you end up in double- - * jeopardy: the larger the outgoing buffer, the more data to copy when - * it overlaps, *and* the more frequently you'll have buffers that *do* - * overlap. - * - * Seeking is another tricky aspect to do efficiently. The initial - * implementation of this source won't make use of these features, however. - * The issue is that if an application seeks backwards in a file, *and* - * that region of the file is covered by an mmap that hasn't been fully - * deallocated, we really should re-use it. But keeping track of these - * regions is tricky because we have to lock the structure that holds - * them. We need to settle on a locking primitive (GMutex seems to be - * a really good option...), then we can do that. - */ - - -GST_DEBUG_CATEGORY_STATIC (gst_filesrc_debug); -#define GST_CAT_DEFAULT gst_filesrc_debug - -GstElementDetails gst_filesrc_details = GST_ELEMENT_DETAILS ("File Source", - "Source/File", - "Read from arbitrary point in a file", - "Erik Walthinsen "); - -#define DEFAULT_BLOCKSIZE 4*1024 -#define DEFAULT_MMAPSIZE 4*1024*1024 - -/* FileSrc signals and args */ -enum -{ - /* FILL ME */ - LAST_SIGNAL -}; - -enum -{ - ARG_0, - ARG_LOCATION, - ARG_FD, - ARG_BLOCKSIZE, - ARG_MMAPSIZE, - ARG_TOUCH -}; - -static const GstEventMask * -gst_filesrc_get_event_mask (GstPad * pad) -{ - static const GstEventMask masks[] = { - {GST_EVENT_SEEK, GST_SEEK_METHOD_CUR | - GST_SEEK_METHOD_SET | GST_SEEK_METHOD_END | GST_SEEK_FLAG_FLUSH}, - {GST_EVENT_FLUSH, 0}, - {GST_EVENT_SIZE, 0}, - {0, 0} - }; - - return masks; -} - -static const GstQueryType * -gst_filesrc_get_query_types (GstPad * pad) -{ - static const GstQueryType types[] = { - GST_QUERY_TOTAL, - GST_QUERY_POSITION, - 0 - }; - - return types; -} - -static const GstFormat * -gst_filesrc_get_formats (GstPad * pad) -{ - static const GstFormat formats[] = { - GST_FORMAT_BYTES, - 0, - }; - - return formats; -} - -static void gst_filesrc_dispose (GObject * object); - -static void gst_filesrc_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec); -static void gst_filesrc_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec); - -static gboolean gst_filesrc_check_filesize (GstFileSrc * src); -static GstData *gst_filesrc_get (GstPad * pad); -static gboolean gst_filesrc_srcpad_event (GstPad * pad, GstEvent * event); -static gboolean gst_filesrc_srcpad_query (GstPad * pad, GstQueryType type, - GstFormat * format, gint64 * value); - -static GstElementStateReturn gst_filesrc_change_state (GstElement * element); - -static void gst_filesrc_uri_handler_init (gpointer g_iface, - gpointer iface_data); - -static void -_do_init (GType filesrc_type) -{ - static const GInterfaceInfo urihandler_info = { - gst_filesrc_uri_handler_init, - NULL, - NULL - }; - - g_type_add_interface_static (filesrc_type, GST_TYPE_URI_HANDLER, - &urihandler_info); - GST_DEBUG_CATEGORY_INIT (gst_filesrc_debug, "filesrc", 0, "filesrc element"); -} - -GST_BOILERPLATE_FULL (GstFileSrc, gst_filesrc, GstElement, GST_TYPE_ELEMENT, - _do_init); - -static void -gst_filesrc_base_init (gpointer g_class) -{ - GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&srctemplate)); - gst_element_class_set_details (gstelement_class, &gst_filesrc_details); -} -static void -gst_filesrc_class_init (GstFileSrcClass * klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass); - - gobject_class = (GObjectClass *) klass; - - - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FD, - g_param_spec_int ("fd", "File-descriptor", - "File-descriptor for the file being mmap()d", 0, G_MAXINT, 0, - G_PARAM_READABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOCATION, - g_param_spec_string ("location", "File Location", - "Location of the file to read", NULL, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BLOCKSIZE, - g_param_spec_ulong ("blocksize", "Block size", - "Size in bytes to read per buffer", 1, G_MAXULONG, DEFAULT_BLOCKSIZE, - G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MMAPSIZE, - g_param_spec_ulong ("mmapsize", "mmap() Block Size", - "Size in bytes of mmap()d regions", 0, G_MAXULONG, DEFAULT_MMAPSIZE, - G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TOUCH, - g_param_spec_boolean ("touch", "Touch read data", - "Touch data to force disk read", FALSE, G_PARAM_READWRITE)); - - gobject_class->dispose = gst_filesrc_dispose; - gobject_class->set_property = gst_filesrc_set_property; - gobject_class->get_property = gst_filesrc_get_property; - - gstelement_class->change_state = gst_filesrc_change_state; -} - -static void -gst_filesrc_init (GstFileSrc * src) -{ - src->srcpad = - gst_pad_new_from_template (gst_static_pad_template_get (&srctemplate), - "src"); - gst_pad_set_get_function (src->srcpad, gst_filesrc_get); - gst_pad_set_event_function (src->srcpad, gst_filesrc_srcpad_event); - gst_pad_set_event_mask_function (src->srcpad, gst_filesrc_get_event_mask); - gst_pad_set_query_function (src->srcpad, gst_filesrc_srcpad_query); - gst_pad_set_query_type_function (src->srcpad, gst_filesrc_get_query_types); - gst_pad_set_formats_function (src->srcpad, gst_filesrc_get_formats); - gst_element_add_pad (GST_ELEMENT (src), src->srcpad); - -#ifdef HAVE_MMAP - src->pagesize = getpagesize (); -#endif - - src->filename = NULL; - src->fd = 0; - src->filelen = 0; - src->uri = NULL; - - src->curoffset = 0; - src->lastoffset = 0; - src->block_size = DEFAULT_BLOCKSIZE; - src->touch = FALSE; - - src->mapbuf = NULL; - src->mapsize = DEFAULT_MMAPSIZE; /* default is 4MB */ - - src->is_regular = FALSE; -} - -static void -gst_filesrc_dispose (GObject * object) -{ - GstFileSrc *src; - - src = GST_FILESRC (object); - - g_free (src->filename); - g_free (src->uri); - - /* dispose may be called multiple times */ - src->filename = NULL; - src->uri = NULL; - - G_OBJECT_CLASS (parent_class)->dispose (object); -} - -static gboolean -gst_filesrc_set_location (GstFileSrc * src, const gchar * location) -{ - /* the element must be stopped in order to do this */ - if (GST_STATE (src) != GST_STATE_READY && GST_STATE (src) != GST_STATE_NULL) - return FALSE; - - g_free (src->filename); - g_free (src->uri); - - /* clear the filename if we get a NULL (is that possible?) */ - if (location == NULL) { - src->filename = NULL; - src->uri = NULL; - } else { - src->filename = g_strdup (location); - src->uri = gst_uri_construct ("file", src->filename); - } - g_object_notify (G_OBJECT (src), "location"); - gst_uri_handler_new_uri (GST_URI_HANDLER (src), src->uri); - - return TRUE; -} - -static void -gst_filesrc_set_property (GObject * object, guint prop_id, const GValue * value, - GParamSpec * pspec) -{ - GstFileSrc *src; - gulong ul; - - /* it's not null if we got it, but it might not be ours */ - g_return_if_fail (GST_IS_FILESRC (object)); - - src = GST_FILESRC (object); - - switch (prop_id) { - case ARG_LOCATION: - gst_filesrc_set_location (src, g_value_get_string (value)); - break; - case ARG_BLOCKSIZE: - src->block_size = g_value_get_ulong (value); - break; - case ARG_MMAPSIZE: - ul = g_value_get_ulong (value); - if ((ul % src->pagesize) == 0) { - src->mapsize = ul; - } else { - GST_INFO_OBJECT (src, - "invalid mapsize %d, must be a multiple of pagesize, which is %d", - ul, src->pagesize); - } - break; - case ARG_TOUCH: - src->touch = g_value_get_boolean (value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_filesrc_get_property (GObject * object, guint prop_id, GValue * value, - GParamSpec * pspec) -{ - GstFileSrc *src; - - /* it's not null if we got it, but it might not be ours */ - g_return_if_fail (GST_IS_FILESRC (object)); - - src = GST_FILESRC (object); - - switch (prop_id) { - case ARG_LOCATION: - g_value_set_string (value, src->filename); - break; - case ARG_FD: - g_value_set_int (value, src->fd); - break; - case ARG_BLOCKSIZE: - g_value_set_ulong (value, src->block_size); - break; - case ARG_MMAPSIZE: - g_value_set_ulong (value, src->mapsize); - break; - case ARG_TOUCH: - g_value_set_boolean (value, src->touch); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -#ifdef HAVE_MMAP -static void -gst_filesrc_free_parent_mmap (GstBuffer * buf) -{ - GST_LOG ("freeing mmap()d buffer at %" G_GUINT64_FORMAT "+%u", - GST_BUFFER_OFFSET (buf), GST_BUFFER_SIZE (buf)); - -#ifdef MADV_DONTNEED - /* madvise to tell the kernel what to do with it */ - madvise (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf), MADV_DONTNEED); -#endif - /* now unmap the memory */ - munmap (GST_BUFFER_DATA (buf), GST_BUFFER_MAXSIZE (buf)); - /* cast to unsigned long, since there's no gportable way to print - * guint64 as hex */ - GST_LOG ("unmapped region %08lx+%08lx at %p", - (unsigned long) GST_BUFFER_OFFSET (buf), - (unsigned long) GST_BUFFER_MAXSIZE (buf), GST_BUFFER_DATA (buf)); - - GST_BUFFER_DATA (buf) = NULL; -} -#endif - -#ifdef HAVE_MMAP -static GstBuffer * -gst_filesrc_map_region (GstFileSrc * src, off_t offset, size_t size) -{ - GstBuffer *buf; - gint retval; - void *mmapregion; - - g_return_val_if_fail (offset >= 0, NULL); - - GST_LOG_OBJECT (src, "mapping region %08llx+%08lx from file into memory", - offset, (unsigned long) size); - mmapregion = mmap (NULL, size, PROT_READ, MAP_SHARED, src->fd, offset); - - if (mmapregion == NULL) { - GST_ELEMENT_ERROR (src, RESOURCE, TOO_LAZY, (NULL), ("mmap call failed.")); - return NULL; - } else if (mmapregion == MAP_FAILED) { - GST_WARNING_OBJECT (src, "mmap (0x%08lx, %d, 0x%llx) failed: %s", - (unsigned long) size, src->fd, (unsigned long long) offset, - strerror (errno)); - return NULL; - } - GST_LOG_OBJECT (src, "mapped region %08lx+%08lx from file into memory at %p", - (unsigned long) offset, (unsigned long) size, mmapregion); - - /* time to allocate a new mapbuf */ - buf = gst_buffer_new (); - /* mmap() the data into this new buffer */ - GST_BUFFER_DATA (buf) = mmapregion; - -#ifdef MADV_SEQUENTIAL - /* madvise to tell the kernel what to do with it */ - retval = - madvise (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf), MADV_SEQUENTIAL); -#endif - /* fill in the rest of the fields */ - GST_BUFFER_FLAG_SET (buf, GST_BUFFER_READONLY); - GST_BUFFER_FLAG_SET (buf, GST_BUFFER_ORIGINAL); - GST_BUFFER_SIZE (buf) = size; - GST_BUFFER_MAXSIZE (buf) = size; - GST_BUFFER_OFFSET (buf) = offset; - GST_BUFFER_OFFSET_END (buf) = offset + size; - GST_BUFFER_TIMESTAMP (buf) = GST_CLOCK_TIME_NONE; - GST_BUFFER_PRIVATE (buf) = src; - GST_BUFFER_FREE_DATA_FUNC (buf) = gst_filesrc_free_parent_mmap; - - return buf; -} -#endif - -#ifdef HAVE_MMAP -static GstBuffer * -gst_filesrc_map_small_region (GstFileSrc * src, off_t offset, size_t size) -{ - size_t mapsize; - off_t mod, mapbase; - GstBuffer *map; - -/* printf("attempting to map a small buffer at %d+%d\n",offset,size); */ - - /* if the offset starts at a non-page boundary, we have to special case */ - if ((mod = offset % src->pagesize)) { - GstBuffer *ret; - - mapbase = offset - mod; - mapsize = - ((size + mod + src->pagesize - 1) / src->pagesize) * src->pagesize; -/* printf("not on page boundaries, resizing map to %d+%d\n",mapbase,mapsize);*/ - map = gst_filesrc_map_region (src, mapbase, mapsize); - if (map == NULL) - return NULL; - - ret = gst_buffer_create_sub (map, offset - mapbase, size); - GST_BUFFER_OFFSET (ret) = GST_BUFFER_OFFSET (map) + offset - mapbase; - - gst_buffer_unref (map); - - return ret; - } - - return gst_filesrc_map_region (src, offset, size); -} -#endif - -#ifdef HAVE_MMAP -/** - * gst_filesrc_get_mmap: - * @src: #GstElement to get data from - * - * Returns: a new #GstData from the mmap'd source. - */ -static GstData * -gst_filesrc_get_mmap (GstFileSrc * src) -{ - GstBuffer *buf = NULL; - size_t readsize, mapsize; - off_t readend, mapstart, mapend; - int i; - - /* calculate end pointers so we don't have to do so repeatedly later */ - readsize = src->block_size; - readend = src->curoffset + src->block_size; /* note this is the byte *after* the read */ - mapstart = GST_BUFFER_OFFSET (src->mapbuf); - mapsize = GST_BUFFER_SIZE (src->mapbuf); - mapend = mapstart + mapsize; /* note this is the byte *after* the map */ - - /* check to see if we're going to overflow the end of the file */ - if (src->is_regular) { - if (readend > src->filelen) { - if (!gst_filesrc_check_filesize (src) || readend > src->filelen) { - readsize = src->filelen - src->curoffset; - readend = src->curoffset + readsize; - } - } - } - - GST_LOG ("attempting to read %08lx, %08lx, %08lx, %08lx", - (unsigned long) readsize, (unsigned long) readend, - (unsigned long) mapstart, (unsigned long) mapend); - - /* if the start is past the mapstart */ - if (src->curoffset >= mapstart) { - /* if the end is before the mapend, the buffer is in current mmap region... */ - /* ('cause by definition if readend is in the buffer, so's readstart) */ - if (readend <= mapend) { - GST_LOG_OBJECT (src, - "read buf %llu+%d lives in current mapbuf %lld+%d, creating subbuffer of mapbuf", - src->curoffset, (int) readsize, mapstart, mapsize); - buf = - gst_buffer_create_sub (src->mapbuf, src->curoffset - mapstart, - readsize); - GST_BUFFER_OFFSET (buf) = src->curoffset; - - /* if the start actually is within the current mmap region, map an overlap buffer */ - } else if (src->curoffset < mapend) { - GST_LOG_OBJECT (src, - "read buf %llu+%d starts in mapbuf %d+%d but ends outside, creating new mmap", - (unsigned long long) src->curoffset, (gint) readsize, (gint) mapstart, - (gint) mapsize); - buf = gst_filesrc_map_small_region (src, src->curoffset, readsize); - if (buf == NULL) - return NULL; - } - - /* the only other option is that buffer is totally outside, which means we search for it */ - - /* now we can assume that the start is *before* the current mmap region */ - /* if the readend is past mapstart, we have two options */ - } else if (readend >= mapstart) { - /* either the read buffer overlaps the start of the mmap region */ - /* or the read buffer fully contains the current mmap region */ - /* either way, it's really not relevant, we just create a new region anyway */ - GST_LOG_OBJECT (src, - "read buf %llu+%d starts before mapbuf %d+%d, but overlaps it", - (unsigned long long) src->curoffset, (gint) readsize, (gint) mapstart, - (gint) mapsize); - buf = gst_filesrc_map_small_region (src, src->curoffset, readsize); - if (buf == NULL) - return NULL; - } - - /* then deal with the case where the read buffer is totally outside */ - if (buf == NULL) { - /* first check to see if there's a map that covers the right region already */ - GST_LOG_OBJECT (src, "searching for mapbuf to cover %llu+%d", - src->curoffset, (int) readsize); - - /* if the read buffer crosses a mmap region boundary, create a one-off region */ - if ((src->curoffset / src->mapsize) != (readend / src->mapsize)) { - GST_LOG_OBJECT (src, - "read buf %llu+%d crosses a %d-byte boundary, creating a one-off", - src->curoffset, (int) readsize, (int) src->mapsize); - buf = gst_filesrc_map_small_region (src, src->curoffset, readsize); - if (buf == NULL) - return NULL; - - /* otherwise we will create a new mmap region and set it to the default */ - } else { - size_t mapsize; - - off_t nextmap = src->curoffset - (src->curoffset % src->mapsize); - - GST_LOG_OBJECT (src, - "read buf %llu+%d in new mapbuf at %llu+%d, mapping and subbuffering", - src->curoffset, readsize, nextmap, src->mapsize); - /* first, we're done with the old mapbuf */ - gst_buffer_unref (src->mapbuf); - mapsize = src->mapsize; - - /* double the mapsize as long as the readsize is smaller */ - while (readsize + src->curoffset > nextmap + mapsize) { - GST_LOG_OBJECT (src, "readsize smaller then mapsize %08x %d", - readsize, (int) mapsize); - mapsize <<= 1; - } - /* create a new one */ - src->mapbuf = gst_filesrc_map_region (src, nextmap, mapsize); - if (src->mapbuf == NULL) - return NULL; - - /* subbuffer it */ - buf = - gst_buffer_create_sub (src->mapbuf, src->curoffset - nextmap, - readsize); - GST_BUFFER_OFFSET (buf) = - GST_BUFFER_OFFSET (src->mapbuf) + src->curoffset - nextmap; - } - } - - /* if we need to touch the buffer (to bring it into memory), do so */ - if (src->touch) { - volatile guchar *p = GST_BUFFER_DATA (buf), c; - - for (i = 0; i < GST_BUFFER_SIZE (buf); i += src->pagesize) - c = p[i]; - } - - /* we're done, return the buffer */ - g_assert (src->curoffset == GST_BUFFER_OFFSET (buf)); - src->curoffset += GST_BUFFER_SIZE (buf); - return GST_DATA (buf); -} -#endif - -static GstData * -gst_filesrc_get_read (GstFileSrc * src) -{ - GstBuffer *buf = NULL; - size_t readsize; - int ret; - - readsize = src->block_size; - /* for regular files, we can use the filesize to check how much we - can read */ - if (src->is_regular) { - if (src->curoffset + readsize > src->filelen) { - if (!gst_filesrc_check_filesize (src) - || src->curoffset + readsize > src->filelen) { - readsize = src->filelen - src->curoffset; - } - } - } - - buf = gst_buffer_new_and_alloc (readsize); - g_return_val_if_fail (buf != NULL, NULL); - - GST_LOG_OBJECT (src, "Seeking at location %d", src->curoffset); - if (src->lastoffset != src->curoffset) { - ret = lseek (src->fd, src->curoffset, SEEK_SET); - if (ret < 0) { - GST_ELEMENT_ERROR (src, RESOURCE, SEEK, (NULL), GST_ERROR_SYSTEM); - return NULL; - } - } - - GST_LOG_OBJECT (src, "Reading %d bytes", readsize); - ret = read (src->fd, GST_BUFFER_DATA (buf), readsize); - if (ret < 0) { - GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL), GST_ERROR_SYSTEM); - return NULL; - } - /* regular files should have given us what we expected */ - if (ret < readsize && src->is_regular) { - GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL), - ("unexpected end of file.")); - return NULL; - } - /* other files should eos if they read 0 */ - if (ret == 0) { - GST_DEBUG ("non-regular file hits EOS"); - gst_buffer_unref (buf); - gst_element_set_eos (GST_ELEMENT (src)); - return GST_DATA (gst_event_new (GST_EVENT_EOS)); - } - readsize = ret; - - GST_BUFFER_SIZE (buf) = readsize; - GST_BUFFER_MAXSIZE (buf) = readsize; - GST_BUFFER_OFFSET (buf) = src->curoffset; - GST_BUFFER_OFFSET_END (buf) = src->curoffset + readsize; - src->curoffset += readsize; - src->lastoffset = src->curoffset; - - return GST_DATA (buf); -} - -static GstData * -gst_filesrc_get (GstPad * pad) -{ - GstFileSrc *src; - - g_return_val_if_fail (pad != NULL, NULL); - src = GST_FILESRC (gst_pad_get_parent (pad)); - g_return_val_if_fail (GST_FLAG_IS_SET (src, GST_FILESRC_OPEN), NULL); - - /* check for flush */ - if (src->need_flush) { - src->need_flush = FALSE; - GST_DEBUG_OBJECT (src, "sending flush"); - return GST_DATA (gst_event_new_flush ()); - } - /* check for seek */ - if (src->need_discont) { - GstEvent *event; - - GST_DEBUG_OBJECT (src, "sending discont"); - event = - gst_event_new_discontinuous (src->need_discont > 1, GST_FORMAT_BYTES, - (guint64) src->curoffset, GST_FORMAT_UNDEFINED); - src->need_discont = 0; - return GST_DATA (event); - } - - /* check for EOF if it's a regular file */ - if (src->is_regular) { - g_assert (src->curoffset <= src->filelen); - if (src->curoffset == src->filelen) { - if (!gst_filesrc_check_filesize (src) || src->curoffset >= src->filelen) { - GST_DEBUG_OBJECT (src, "eos %" G_GINT64_FORMAT " %" G_GINT64_FORMAT, - src->curoffset, src->filelen); - gst_element_set_eos (GST_ELEMENT (src)); - return GST_DATA (gst_event_new (GST_EVENT_EOS)); - } - } - } -#ifdef HAVE_MMAP - if (src->using_mmap) { - return gst_filesrc_get_mmap (src); - } else { - return gst_filesrc_get_read (src); - } -#else - return gst_filesrc_get_read (src); -#endif -} - -/* TRUE if the filesize of the file was updated */ -static gboolean -gst_filesrc_check_filesize (GstFileSrc * src) -{ - struct stat stat_results; - - g_return_val_if_fail (GST_FLAG_IS_SET (src, GST_FILESRC_OPEN), FALSE); - - fstat (src->fd, &stat_results); - GST_DEBUG_OBJECT (src, - "checked filesize on %s (was %" G_GUINT64_FORMAT ", is %" G_GUINT64_FORMAT - ")", src->filename, src->filelen, (guint64) stat_results.st_size); - if (src->filelen == (guint64) stat_results.st_size) - return FALSE; - src->filelen = stat_results.st_size; - return TRUE; -} - -/* open the file and mmap it, necessary to go to READY state */ -static gboolean -gst_filesrc_open_file (GstFileSrc * src) -{ - g_return_val_if_fail (!GST_FLAG_IS_SET (src, GST_FILESRC_OPEN), FALSE); - - if (src->filename == NULL || src->filename[0] == '\0') { - GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, - (_("No file name specified for reading.")), (NULL)); - return FALSE; - } - - - GST_INFO_OBJECT (src, "opening file %s", src->filename); - - /* open the file */ - src->fd = open (src->filename, O_RDONLY | O_BINARY); - if (src->fd < 0) { - if (errno == ENOENT) - GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, (NULL), - ("No such file \"%s\"", src->filename)); - else - GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, - (_("Could not open file \"%s\" for reading."), src->filename), - GST_ERROR_SYSTEM); - return FALSE; - } else { - /* check if it is a regular file, otherwise bail out */ - struct stat stat_results; - - fstat (src->fd, &stat_results); - - if (S_ISDIR (stat_results.st_mode)) { - GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, - (_("\"%s\" is a directory."), src->filename), (NULL)); - close (src->fd); - return FALSE; - } - if (S_ISSOCK (stat_results.st_mode)) { - GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, - (_("File \"%s\" is a socket."), src->filename), (NULL)); - close (src->fd); - return FALSE; - } - - /* find the file length */ - src->filelen = stat_results.st_size; - - src->using_mmap = FALSE; - - /* record if it's a regular (hence seekable and lengthable) file */ - if (S_ISREG (stat_results.st_mode)) - src->is_regular = TRUE; -#ifdef HAVE_MMAP - /* FIXME: maybe we should only try to mmap if it's a regular file */ - /* allocate the first mmap'd region if it's a regular file ? */ - src->mapbuf = gst_filesrc_map_region (src, 0, src->mapsize); - if (src->mapbuf != NULL) { - GST_DEBUG_OBJECT (src, "using mmap for file"); - src->using_mmap = TRUE; - } -#endif - - src->curoffset = 0; - src->lastoffset = 0; - - GST_FLAG_SET (src, GST_FILESRC_OPEN); - } - return TRUE; -} - -/* unmap and close the file */ -static void -gst_filesrc_close_file (GstFileSrc * src) -{ - g_return_if_fail (GST_FLAG_IS_SET (src, GST_FILESRC_OPEN)); - - /* close the file */ - close (src->fd); - - /* zero out a lot of our state */ - src->fd = 0; - src->filelen = 0; - src->curoffset = 0; - src->lastoffset = 0; - src->is_regular = FALSE; - - if (src->mapbuf) { - gst_buffer_unref (src->mapbuf); - src->mapbuf = NULL; - } - - GST_FLAG_UNSET (src, GST_FILESRC_OPEN); -} - - -static GstElementStateReturn -gst_filesrc_change_state (GstElement * element) -{ - GstFileSrc *src = GST_FILESRC (element); - - switch (GST_STATE_TRANSITION (element)) { - case GST_STATE_NULL_TO_READY: - break; - case GST_STATE_READY_TO_NULL: - break; - case GST_STATE_READY_TO_PAUSED: - if (!GST_FLAG_IS_SET (element, GST_FILESRC_OPEN)) { - if (!gst_filesrc_open_file (GST_FILESRC (element))) - return GST_STATE_FAILURE; - } - src->need_discont = 2; - break; - case GST_STATE_PAUSED_TO_READY: - if (GST_FLAG_IS_SET (element, GST_FILESRC_OPEN)) - gst_filesrc_close_file (GST_FILESRC (element)); - break; - default: - break; - } - - if (GST_ELEMENT_CLASS (parent_class)->change_state) - return GST_ELEMENT_CLASS (parent_class)->change_state (element); - - return GST_STATE_SUCCESS; -} - -static gboolean -gst_filesrc_srcpad_query (GstPad * pad, GstQueryType type, - GstFormat * format, gint64 * value) -{ - GstFileSrc *src = GST_FILESRC (GST_PAD_PARENT (pad)); - - if (*format == GST_FORMAT_DEFAULT) - *format = GST_FORMAT_BYTES; - - switch (type) { - case GST_QUERY_TOTAL: - if (*format != GST_FORMAT_BYTES) { - return FALSE; - } - if (!src->is_regular) - return FALSE; - gst_filesrc_check_filesize (src); - *value = src->filelen; - break; - case GST_QUERY_POSITION: - switch (*format) { - case GST_FORMAT_BYTES: - *value = src->curoffset; - break; - case GST_FORMAT_PERCENT: - if (src->filelen == 0) - return FALSE; - if (!src->is_regular) - return FALSE; - *value = src->curoffset * GST_FORMAT_PERCENT_MAX / src->filelen; - break; - default: - return FALSE; - } - break; - default: - return FALSE; - break; - } - return TRUE; -} - -static gboolean -gst_filesrc_srcpad_event (GstPad * pad, GstEvent * event) -{ - GstFileSrc *src = GST_FILESRC (GST_PAD_PARENT (pad)); - - GST_DEBUG_OBJECT (src, "received event type %d", GST_EVENT_TYPE (event)); - - switch (GST_EVENT_TYPE (event)) { - case GST_EVENT_SEEK: - { - gint64 offset; - - if (GST_EVENT_SEEK_FORMAT (event) != GST_FORMAT_BYTES && - GST_EVENT_SEEK_FORMAT (event) != GST_FORMAT_DEFAULT) { - goto error; - } - if (!src->is_regular) { - GST_DEBUG ("can't handle seek on a non-regular file"); - goto error; - } - - offset = GST_EVENT_SEEK_OFFSET (event); - - switch (GST_EVENT_SEEK_METHOD (event)) { - case GST_SEEK_METHOD_SET: - if (offset < 0) { - goto error; - } else if (offset > src->filelen && (!gst_filesrc_check_filesize (src) - || offset > src->filelen)) { - src->curoffset = src->filelen; - } else { - src->curoffset = offset; - } - GST_DEBUG_OBJECT (src, "seek set pending to %" G_GINT64_FORMAT, - src->curoffset); - break; - case GST_SEEK_METHOD_CUR: - if (offset + src->curoffset > src->filelen && - (!gst_filesrc_check_filesize (src) - || offset + src->curoffset > src->filelen)) { - src->curoffset = src->filelen; - } else if (offset + src->curoffset < 0) { - src->curoffset = 0; - } else { - src->curoffset += offset; - } - GST_DEBUG_OBJECT (src, "seek cur pending to %" G_GINT64_FORMAT, - src->curoffset); - break; - case GST_SEEK_METHOD_END: - if (offset > 0) { - goto error; - } else if (offset > src->filelen && (!gst_filesrc_check_filesize (src) - || offset > src->filelen)) { - src->curoffset = 0; - } else { - src->curoffset = src->filelen + offset; - } - GST_DEBUG_OBJECT (src, "seek end pending to %" G_GINT64_FORMAT, - src->curoffset); - break; - default: - goto error; - break; - } - src->need_discont = 1; - src->need_flush = GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_FLUSH; - break; - } - case GST_EVENT_SIZE: - if (GST_EVENT_SIZE_FORMAT (event) != GST_FORMAT_BYTES) { - goto error; - } - src->block_size = GST_EVENT_SIZE_VALUE (event); - g_object_notify (G_OBJECT (src), "blocksize"); - break; - case GST_EVENT_FLUSH: - src->need_flush = TRUE; - break; - default: - goto error; - break; - } - gst_event_unref (event); - return TRUE; - -error: - gst_event_unref (event); - return FALSE; -} - -/*** GSTURIHANDLER INTERFACE *************************************************/ - -static guint -gst_filesrc_uri_get_type (void) -{ - return GST_URI_SRC; -} -static gchar ** -gst_filesrc_uri_get_protocols (void) -{ - static gchar *protocols[] = { "file", NULL }; - - return protocols; -} -static const gchar * -gst_filesrc_uri_get_uri (GstURIHandler * handler) -{ - GstFileSrc *src = GST_FILESRC (handler); - - return src->uri; -} - -static gboolean -gst_filesrc_uri_set_uri (GstURIHandler * handler, const gchar * uri) -{ - gchar *protocol, *location; - gboolean ret; - GstFileSrc *src = GST_FILESRC (handler); - - protocol = gst_uri_get_protocol (uri); - if (strcmp (protocol, "file") != 0) { - g_free (protocol); - return FALSE; - } - g_free (protocol); - location = gst_uri_get_location (uri); - ret = gst_filesrc_set_location (src, location); - g_free (location); - - return ret; -} - -static void -gst_filesrc_uri_handler_init (gpointer g_iface, gpointer iface_data) -{ - GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_iface; - - iface->get_type = gst_filesrc_uri_get_type; - iface->get_protocols = gst_filesrc_uri_get_protocols; - iface->get_uri = gst_filesrc_uri_get_uri; - iface->set_uri = gst_filesrc_uri_set_uri; -} diff --git a/plugins/elements/gstfilesrc.h b/plugins/elements/gstfilesrc.h deleted file mode 100644 index a5f2183fc3..0000000000 --- a/plugins/elements/gstfilesrc.h +++ /dev/null @@ -1,88 +0,0 @@ -/* GStreamer - * Copyright (C) 1999,2000 Erik Walthinsen - * 2000 Wim Taymans - * - * gstfilesrc.h: - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - -#ifndef __GST_FILESRC_H__ -#define __GST_FILESRC_H__ - - -#include -#include - -G_BEGIN_DECLS - - -#define GST_TYPE_FILESRC \ - (gst_filesrc_get_type()) -#define GST_FILESRC(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FILESRC,GstFileSrc)) -#define GST_FILESRC_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FILESRC,GstFileSrcClass)) -#define GST_IS_FILESRC(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FILESRC)) -#define GST_IS_FILESRC_CLASS(obj) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FILESRC)) - -typedef enum { - GST_FILESRC_OPEN = GST_ELEMENT_FLAG_LAST, - - GST_FILESRC_FLAG_LAST = GST_ELEMENT_FLAG_LAST + 2 -} GstFileSrcFlags; - -typedef struct _GstFileSrc GstFileSrc; -typedef struct _GstFileSrcClass GstFileSrcClass; - -struct _GstFileSrc { - GstElement element; - GstPad *srcpad; - - guint pagesize; /* system page size*/ - - gchar *filename; /* filename */ - gchar *uri; /* caching the URI */ - gint fd; /* open file descriptor*/ - off_t filelen; /* what's the file length?*/ - - off_t curoffset; /* current offset in file*/ - off_t lastoffset; /* last offset seen in file*/ - off_t block_size; /* bytes per read */ - gboolean touch; /* whether to touch every page */ - gboolean using_mmap; /* whether we opened it with mmap */ - gboolean is_regular; /* whether it's (symlink to) - a regular file */ - - GstBuffer *mapbuf; - size_t mapsize; - - gint need_discont; - gboolean need_flush; -}; - -struct _GstFileSrcClass { - GstElementClass parent_class; -}; - -GType gst_filesrc_get_type(void); - -G_END_DECLS - -#endif /* __GST_FILESRC_H__ */ diff --git a/plugins/elements/gstidentity.c b/plugins/elements/gstidentity.c deleted file mode 100644 index 5221b6f41a..0000000000 --- a/plugins/elements/gstidentity.c +++ /dev/null @@ -1,544 +0,0 @@ -/* GStreamer - * Copyright (C) 1999,2000 Erik Walthinsen - * 2000 Wim Taymans - * - * gstidentity.c: - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - -#include - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include "../gst-i18n-lib.h" -#include "gstidentity.h" -#include - -static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - -static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - -GST_DEBUG_CATEGORY_STATIC (gst_identity_debug); -#define GST_CAT_DEFAULT gst_identity_debug - -GstElementDetails gst_identity_details = GST_ELEMENT_DETAILS ("Identity", - "Generic", - "Pass data without modification", - "Erik Walthinsen "); - - -/* Identity signals and args */ -enum -{ - SIGNAL_HANDOFF, - /* FILL ME */ - LAST_SIGNAL -}; - -#define DEFAULT_LOOP_BASED FALSE -#define DEFAULT_SLEEP_TIME 0 -#define DEFAULT_DUPLICATE 1 -#define DEFAULT_ERROR_AFTER -1 -#define DEFAULT_DROP_PROBABILITY 0.0 -#define DEFAULT_DATARATE 0 -#define DEFAULT_SILENT FALSE -#define DEFAULT_DUMP FALSE -#define DEFAULT_SYNC FALSE -#define DEFAULT_CHECK_PERFECT FALSE - -enum -{ - ARG_0, - ARG_LOOP_BASED, - ARG_SLEEP_TIME, - ARG_DUPLICATE, - ARG_ERROR_AFTER, - ARG_DROP_PROBABILITY, - ARG_DATARATE, - ARG_SILENT, - ARG_LAST_MESSAGE, - ARG_DUMP, - ARG_SYNC, - ARG_CHECK_PERFECT -}; - - -#define _do_init(bla) \ - GST_DEBUG_CATEGORY_INIT (gst_identity_debug, "identity", 0, "identity element"); - -GST_BOILERPLATE_FULL (GstIdentity, gst_identity, GstElement, GST_TYPE_ELEMENT, - _do_init); - -static void gst_identity_finalize (GObject * object); -static void gst_identity_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec); -static void gst_identity_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec); -static GstElementStateReturn gst_identity_change_state (GstElement * element); - -static void gst_identity_chain (GstPad * pad, GstData * _data); -static void gst_identity_set_clock (GstElement * element, GstClock * clock); - - -static guint gst_identity_signals[LAST_SIGNAL] = { 0 }; - -static void -gst_identity_base_init (gpointer g_class) -{ - GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&srctemplate)); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&sinktemplate)); - gst_element_class_set_details (gstelement_class, &gst_identity_details); -} - -static void -gst_identity_finalize (GObject * object) -{ - GstIdentity *identity; - - identity = GST_IDENTITY (object); - - g_free (identity->last_message); - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static void -gst_identity_class_init (GstIdentityClass * klass) -{ - GObjectClass *gobject_class; - GstElementClass *gstelement_class; - - gobject_class = G_OBJECT_CLASS (klass); - gstelement_class = GST_ELEMENT_CLASS (klass); - - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOOP_BASED, - g_param_spec_boolean ("loop-based", "Loop-based", - "Set to TRUE to use loop-based rather than chain-based scheduling", - DEFAULT_LOOP_BASED, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SLEEP_TIME, - g_param_spec_uint ("sleep-time", "Sleep time", - "Microseconds to sleep between processing", 0, G_MAXUINT, - DEFAULT_SLEEP_TIME, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DUPLICATE, - g_param_spec_uint ("duplicate", "Duplicate Buffers", - "Push the buffers N times", 0, G_MAXUINT, DEFAULT_DUPLICATE, - G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ERROR_AFTER, - g_param_spec_int ("error_after", "Error After", "Error after N buffers", - G_MININT, G_MAXINT, DEFAULT_ERROR_AFTER, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DROP_PROBABILITY, - g_param_spec_float ("drop_probability", "Drop Probability", - "The Probability a buffer is dropped", 0.0, 1.0, - DEFAULT_DROP_PROBABILITY, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DATARATE, - g_param_spec_int ("datarate", "Datarate", - "(Re)timestamps buffers with number of bytes per second (0 = inactive)", - 0, G_MAXINT, DEFAULT_DATARATE, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SILENT, - g_param_spec_boolean ("silent", "silent", "silent", DEFAULT_SILENT, - G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LAST_MESSAGE, - g_param_spec_string ("last-message", "last-message", "last-message", NULL, - G_PARAM_READABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DUMP, - g_param_spec_boolean ("dump", "Dump", "Dump buffer contents", - DEFAULT_DUMP, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SYNC, - g_param_spec_boolean ("sync", "Synchronize", - "Synchronize to pipeline clock", DEFAULT_SYNC, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_CHECK_PERFECT, - g_param_spec_boolean ("check-perfect", "Check For Perfect Stream", - "Verify that the stream is time- and data-contiguous", - DEFAULT_CHECK_PERFECT, G_PARAM_READWRITE)); - - gst_identity_signals[SIGNAL_HANDOFF] = - g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GstIdentityClass, handoff), NULL, NULL, - gst_marshal_VOID__BOXED, G_TYPE_NONE, 1, - GST_TYPE_BUFFER | G_SIGNAL_TYPE_STATIC_SCOPE); - - gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_identity_finalize); - gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_identity_set_property); - gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_identity_get_property); - - gstelement_class->set_clock = GST_DEBUG_FUNCPTR (gst_identity_set_clock); - gstelement_class->change_state = - GST_DEBUG_FUNCPTR (gst_identity_change_state); - -} - -static void -gst_identity_init (GstIdentity * identity) -{ - identity->sinkpad = - gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate), - "sink"); - gst_element_add_pad (GST_ELEMENT (identity), identity->sinkpad); - gst_pad_set_chain_function (identity->sinkpad, - GST_DEBUG_FUNCPTR (gst_identity_chain)); - gst_pad_set_link_function (identity->sinkpad, gst_pad_proxy_pad_link); - gst_pad_set_getcaps_function (identity->sinkpad, gst_pad_proxy_getcaps); - - identity->srcpad = - gst_pad_new_from_template (gst_static_pad_template_get (&srctemplate), - "src"); - gst_element_add_pad (GST_ELEMENT (identity), identity->srcpad); - gst_pad_set_link_function (identity->srcpad, gst_pad_proxy_pad_link); - gst_pad_set_getcaps_function (identity->srcpad, gst_pad_proxy_getcaps); - - identity->loop_based = DEFAULT_LOOP_BASED; - identity->sleep_time = DEFAULT_SLEEP_TIME; - identity->duplicate = DEFAULT_DUPLICATE; - identity->error_after = DEFAULT_ERROR_AFTER; - identity->drop_probability = DEFAULT_DROP_PROBABILITY; - identity->datarate = DEFAULT_DATARATE; - identity->silent = DEFAULT_SILENT; - identity->sync = DEFAULT_SYNC; - identity->check_perfect = DEFAULT_CHECK_PERFECT; - identity->dump = DEFAULT_DUMP; - identity->last_message = NULL; - identity->srccaps = NULL; - - GST_FLAG_SET (identity, GST_ELEMENT_EVENT_AWARE); - GST_FLAG_SET (identity, GST_ELEMENT_WORK_IN_PLACE); - -} - -static void -gst_identity_set_clock (GstElement * element, GstClock * clock) -{ - GstIdentity *identity = GST_IDENTITY (element); - - gst_object_replace ((GstObject **) & identity->clock, (GstObject *) clock); -} - - -static void -gst_identity_chain (GstPad * pad, GstData * _data) -{ - GstBuffer *buf = GST_BUFFER (_data); - GstIdentity *identity; - guint i; - - g_return_if_fail (pad != NULL); - g_return_if_fail (GST_IS_PAD (pad)); - g_return_if_fail (buf != NULL); - - identity = GST_IDENTITY (gst_pad_get_parent (pad)); - - if (GST_IS_EVENT (buf)) { - GstEvent *event = GST_EVENT (buf); - - if (!identity->silent) { - g_free (identity->last_message); - - identity->last_message = - g_strdup_printf ("chain ******* (%s:%s)E (type: %d) %p", - GST_DEBUG_PAD_NAME (pad), GST_EVENT_TYPE (event), event); - - g_object_notify (G_OBJECT (identity), "last_message"); - } - gst_pad_event_default (pad, event); - return; - } - - /* see if we need to do perfect stream checking */ - /* invalid timestamp drops us out of check. FIXME: maybe warn ? */ - if (identity->check_perfect && - GST_BUFFER_TIMESTAMP (buf) != GST_CLOCK_TIME_NONE) { - /* check if we had a previous buffer to compare to */ - if (identity->prev_timestamp != GST_CLOCK_TIME_NONE) { - if (identity->prev_timestamp + identity->prev_duration != - GST_BUFFER_TIMESTAMP (buf)) { - GST_WARNING_OBJECT (identity, - "Buffer not time-contiguous with previous one: " "prev ts %" - GST_TIME_FORMAT ", prev dur %" GST_TIME_FORMAT ", new ts %" - GST_TIME_FORMAT, GST_TIME_ARGS (identity->prev_timestamp), - GST_TIME_ARGS (identity->prev_duration), - GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf))); - } - if (identity->prev_offset_end != GST_BUFFER_OFFSET (buf)) { - GST_WARNING_OBJECT (identity, - "Buffer not data-contiguous with previous one: " - "prev offset_end %" G_GINT64_FORMAT ", new offset %" - G_GINT64_FORMAT, identity->prev_offset_end, - GST_BUFFER_OFFSET (buf)); - } - } - /* update prev values */ - identity->prev_timestamp = GST_BUFFER_TIMESTAMP (buf); - identity->prev_duration = GST_BUFFER_DURATION (buf); - identity->prev_offset_end = GST_BUFFER_OFFSET_END (buf); - } - - if (identity->error_after >= 0) { - identity->error_after--; - if (identity->error_after == 0) { - gst_buffer_unref (buf); - GST_ELEMENT_ERROR (identity, CORE, FAILED, - (_("Failed after iterations as requested.")), (NULL)); - return; - } - } - - if (identity->drop_probability > 0.0) { - if ((gfloat) (1.0 * rand () / (RAND_MAX)) < identity->drop_probability) { - g_free (identity->last_message); - identity->last_message = - g_strdup_printf ("dropping ******* (%s:%s)i (%d bytes, timestamp: %" - GST_TIME_FORMAT ", duration: %" GST_TIME_FORMAT ", offset: %" - G_GINT64_FORMAT ", offset_end: % " G_GINT64_FORMAT ", flags: %d) %p", - GST_DEBUG_PAD_NAME (identity->sinkpad), GST_BUFFER_SIZE (buf), - GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)), - GST_TIME_ARGS (GST_BUFFER_DURATION (buf)), GST_BUFFER_OFFSET (buf), - GST_BUFFER_OFFSET_END (buf), GST_BUFFER_FLAGS (buf), buf); - g_object_notify (G_OBJECT (identity), "last-message"); - gst_buffer_unref (buf); - return; - } - } - if (identity->dump) { - gst_util_dump_mem (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf)); - } - - for (i = identity->duplicate; i; i--) { - GstClockTime time; - - if (!identity->silent) { - g_free (identity->last_message); - identity->last_message = - g_strdup_printf ("chain ******* (%s:%s)i (%d bytes, timestamp: %" - GST_TIME_FORMAT ", duration: %" GST_TIME_FORMAT ", offset: %" - G_GINT64_FORMAT ", offset_end: % " G_GINT64_FORMAT ", flags: %d) %p", - GST_DEBUG_PAD_NAME (identity->sinkpad), GST_BUFFER_SIZE (buf), - GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)), - GST_TIME_ARGS (GST_BUFFER_DURATION (buf)), GST_BUFFER_OFFSET (buf), - GST_BUFFER_OFFSET_END (buf), GST_BUFFER_FLAGS (buf), buf); - g_object_notify (G_OBJECT (identity), "last-message"); - } - - time = GST_BUFFER_TIMESTAMP (buf); - - if (identity->datarate > 0) { - time = identity->bytes_handled * GST_SECOND / identity->datarate; - - GST_BUFFER_TIMESTAMP (buf) = time; - GST_BUFFER_DURATION (buf) = - GST_BUFFER_SIZE (buf) * GST_SECOND / identity->datarate; - } - - g_signal_emit (G_OBJECT (identity), gst_identity_signals[SIGNAL_HANDOFF], 0, - buf); - - if (i > 1) - gst_buffer_ref (buf); - - if (identity->sync) { - if (identity->clock) { - gst_element_wait (GST_ELEMENT (identity), time); - } - } - - identity->bytes_handled += GST_BUFFER_SIZE (buf); - gst_pad_push (identity->srcpad, GST_DATA (buf)); - - if (identity->sleep_time) - g_usleep (identity->sleep_time); - } -} - -static void -gst_identity_loop (GstElement * element) -{ - GstIdentity *identity; - GstBuffer *buf; - - g_return_if_fail (element != NULL); - g_return_if_fail (GST_IS_IDENTITY (element)); - - identity = GST_IDENTITY (element); - - buf = GST_BUFFER (gst_pad_pull (identity->sinkpad)); - if (GST_IS_EVENT (buf)) { - GstEvent *event = GST_EVENT (buf); - - if (GST_EVENT_IS_INTERRUPT (event)) { - gst_event_unref (event); - } else { - gst_pad_event_default (identity->sinkpad, event); - } - } else { - gst_identity_chain (identity->sinkpad, GST_DATA (buf)); - } -} - -static void -gst_identity_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec) -{ - GstIdentity *identity; - - /* it's not null if we got it, but it might not be ours */ - g_return_if_fail (GST_IS_IDENTITY (object)); - - identity = GST_IDENTITY (object); - - switch (prop_id) { - case ARG_LOOP_BASED: - identity->loop_based = g_value_get_boolean (value); - if (identity->loop_based) { - gst_element_set_loop_function (GST_ELEMENT (identity), - gst_identity_loop); - gst_pad_set_chain_function (identity->sinkpad, NULL); - } else { - gst_pad_set_chain_function (identity->sinkpad, gst_identity_chain); - gst_element_set_loop_function (GST_ELEMENT (identity), NULL); - } - break; - case ARG_SLEEP_TIME: - identity->sleep_time = g_value_get_uint (value); - break; - case ARG_SILENT: - identity->silent = g_value_get_boolean (value); - break; - case ARG_DUPLICATE: - identity->duplicate = g_value_get_uint (value); - break; - case ARG_DUMP: - identity->dump = g_value_get_boolean (value); - break; - case ARG_ERROR_AFTER: - identity->error_after = g_value_get_int (value); - break; - case ARG_DROP_PROBABILITY: - identity->drop_probability = g_value_get_float (value); - break; - case ARG_DATARATE: - identity->datarate = g_value_get_int (value); - break; - case ARG_SYNC: - identity->sync = g_value_get_boolean (value); - break; - case ARG_CHECK_PERFECT: - identity->check_perfect = g_value_get_boolean (value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_identity_get_property (GObject * object, guint prop_id, GValue * value, - GParamSpec * pspec) -{ - GstIdentity *identity; - - /* it's not null if we got it, but it might not be ours */ - g_return_if_fail (GST_IS_IDENTITY (object)); - - identity = GST_IDENTITY (object); - - switch (prop_id) { - case ARG_LOOP_BASED: - g_value_set_boolean (value, identity->loop_based); - break; - case ARG_SLEEP_TIME: - g_value_set_uint (value, identity->sleep_time); - break; - case ARG_DUPLICATE: - g_value_set_uint (value, identity->duplicate); - break; - case ARG_ERROR_AFTER: - g_value_set_int (value, identity->error_after); - break; - case ARG_DROP_PROBABILITY: - g_value_set_float (value, identity->drop_probability); - break; - case ARG_DATARATE: - g_value_set_int (value, identity->datarate); - break; - case ARG_SILENT: - g_value_set_boolean (value, identity->silent); - break; - case ARG_DUMP: - g_value_set_boolean (value, identity->dump); - break; - case ARG_LAST_MESSAGE: - g_value_set_string (value, identity->last_message); - break; - case ARG_SYNC: - g_value_set_boolean (value, identity->sync); - break; - case ARG_CHECK_PERFECT: - g_value_set_boolean (value, identity->check_perfect); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static GstElementStateReturn -gst_identity_change_state (GstElement * element) -{ - GstIdentity *identity; - - g_return_val_if_fail (GST_IS_IDENTITY (element), GST_STATE_FAILURE); - - identity = GST_IDENTITY (element); - - switch (GST_STATE_TRANSITION (element)) { - case GST_STATE_NULL_TO_READY: - break; - case GST_STATE_READY_TO_PAUSED: - identity->bytes_handled = 0; - identity->prev_timestamp = GST_CLOCK_TIME_NONE; - identity->prev_duration = GST_CLOCK_TIME_NONE; - identity->prev_offset_end = -1; - break; - case GST_STATE_PAUSED_TO_PLAYING: - case GST_STATE_PLAYING_TO_PAUSED: - break; - case GST_STATE_PAUSED_TO_READY: - g_free (identity->last_message); - identity->last_message = NULL; - break; - case GST_STATE_READY_TO_NULL: - break; - default: - break; - } - - if (GST_ELEMENT_CLASS (parent_class)->change_state) - return GST_ELEMENT_CLASS (parent_class)->change_state (element); - - return GST_STATE_SUCCESS; -} diff --git a/plugins/elements/gstidentity.h b/plugins/elements/gstidentity.h deleted file mode 100644 index 00203beed5..0000000000 --- a/plugins/elements/gstidentity.h +++ /dev/null @@ -1,84 +0,0 @@ -/* GStreamer - * Copyright (C) 1999,2000 Erik Walthinsen - * 2000 Wim Taymans - * - * gstidentity.h: - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - -#ifndef __GST_IDENTITY_H__ -#define __GST_IDENTITY_H__ - - -#include - -G_BEGIN_DECLS - - -#define GST_TYPE_IDENTITY \ - (gst_identity_get_type()) -#define GST_IDENTITY(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_IDENTITY,GstIdentity)) -#define GST_IDENTITY_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_IDENTITY,GstIdentityClass)) -#define GST_IS_IDENTITY(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_IDENTITY)) -#define GST_IS_IDENTITY_CLASS(obj) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_IDENTITY)) - -typedef struct _GstIdentity GstIdentity; -typedef struct _GstIdentityClass GstIdentityClass; - -struct _GstIdentity { - GstElement element; - - GstPad *sinkpad; - GstPad *srcpad; - - gboolean loop_based; - guint duplicate; - gint error_after; - gfloat drop_probability; - gint datarate; - guint sleep_time; - gboolean silent; - gboolean dump; - gboolean sync; - gboolean check_perfect; - GstClockTime prev_timestamp; - GstClockTime prev_duration; - guint64 prev_offset_end; - GstClock *clock; - gchar *last_message; - GstCaps *srccaps; - - guint64 bytes_handled; -}; - -struct _GstIdentityClass { - GstElementClass parent_class; - - /* signals */ - void (*handoff) (GstElement *element, GstBuffer *buf); -}; - -GType gst_identity_get_type(void); - -G_END_DECLS - -#endif /* __GST_IDENTITY_H__ */ diff --git a/plugins/elements/gstmd5sink.c b/plugins/elements/gstmd5sink.c deleted file mode 100644 index 611abb6fea..0000000000 --- a/plugins/elements/gstmd5sink.c +++ /dev/null @@ -1,498 +0,0 @@ -/* GStreamer - * Copyright (C) 2002 Erik Walthinsen - * 2002 Wim Taymans - * - * gstmd5sink.c: A sink computing an md5 checksum from a stream - * - * The md5 code was taken from glibc-2.2.3/crypt/md5.c and slightly - * modified. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include "gstmd5sink.h" - -GST_DEBUG_CATEGORY_STATIC (gst_md5sink_debug); -#define GST_CAT_DEFAULT gst_md5sink_debug - -GstElementDetails gst_md5sink_details = GST_ELEMENT_DETAILS ("MD5 Sink", - "Sink", - "compute MD5 for incoming data", - "Benjamin Otte "); - -/* MD5Sink signals and args */ -enum -{ - /* FILL ME */ - LAST_SIGNAL -}; - -enum -{ - ARG_0, - ARG_MD5 - /* FILL ME */ -}; - -GstStaticPadTemplate md5_sink_template = GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - -#define _do_init(bla) \ - GST_DEBUG_CATEGORY_INIT (gst_md5sink_debug, "md5sink", 0, "md5sink element"); - -GST_BOILERPLATE_FULL (GstMD5Sink, gst_md5sink, GstElement, GST_TYPE_ELEMENT, - _do_init); - -/* GObject stuff */ -/*static void gst_md5sink_set_property (GObject *object, guint prop_id, - const GValue *value, GParamSpec *pspec);*/ -static void gst_md5sink_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec); - -static void gst_md5sink_chain (GstPad * pad, GstData * _data); -static GstElementStateReturn gst_md5sink_change_state (GstElement * element); - - -/* MD5 stuff */ -static void md5_init_ctx (GstMD5Sink * ctx); -static gpointer md5_read_ctx (GstMD5Sink * ctx, gpointer resbuf); -static gpointer md5_finish_ctx (GstMD5Sink * ctx, gpointer resbuf); -static void md5_process_bytes (const void *buffer, size_t len, - GstMD5Sink * ctx); -static void md5_process_block (const void *buffer, size_t len, - GstMD5Sink * ctx); - -/* This array contains the bytes used to pad the buffer to the next - 64-byte boundary. (RFC 1321, 3.1: Step 1) */ -static const guchar fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ }; - -/* MD5 functions */ -/* Initialize structure containing state of computation. - (RFC 1321, 3.3: Step 3) */ -static void -md5_init_ctx (GstMD5Sink * ctx) -{ - ctx->A = 0x67452301; - ctx->B = 0xefcdab89; - ctx->C = 0x98badcfe; - ctx->D = 0x10325476; - - ctx->total[0] = ctx->total[1] = 0; - ctx->buflen = 0; -} - -/* Process the remaining bytes in the internal buffer and the usual - prolog according to the standard and write the result to RESBUF. - - IMPORTANT: On some systems it is required that RESBUF is correctly - aligned for a 32 bits value. */ -static gpointer -md5_finish_ctx (GstMD5Sink * ctx, gpointer resbuf) -{ - /* Take yet unprocessed bytes into account. */ - guint32 bytes = ctx->buflen; - size_t pad; - - /* Now count remaining bytes. */ - ctx->total[0] += bytes; - if (ctx->total[0] < bytes) - ++ctx->total[1]; - - pad = bytes >= 56 ? 64 + 56 - bytes : 56 - bytes; - memcpy (&ctx->buffer[bytes], fillbuf, pad); - - /* Put the 64-bit file length in *bits* at the end of the buffer. */ - *(guint32 *) & ctx->buffer[bytes + pad] = GUINT32_TO_LE (ctx->total[0] << 3); - *(guint32 *) & ctx->buffer[bytes + pad + 4] = - GUINT32_TO_LE ((ctx->total[1] << 3) | (ctx->total[0] >> 29)); - - /* Process last bytes. */ - md5_process_block (ctx->buffer, bytes + pad + 8, ctx); - - return md5_read_ctx (ctx, resbuf); -} - -/* Put result from CTX in first 16 bytes following RESBUF. The result - must be in little endian byte order. - - IMPORTANT: On some systems it is required that RESBUF is correctly - aligned for a 32 bits value. */ -static gpointer -md5_read_ctx (GstMD5Sink * ctx, gpointer resbuf) -{ - ((guint32 *) resbuf)[0] = GUINT32_TO_LE (ctx->A); - ((guint32 *) resbuf)[1] = GUINT32_TO_LE (ctx->B); - ((guint32 *) resbuf)[2] = GUINT32_TO_LE (ctx->C); - ((guint32 *) resbuf)[3] = GUINT32_TO_LE (ctx->D); - - return resbuf; -} - -static void -md5_process_bytes (const void *buffer, size_t len, GstMD5Sink * ctx) -{ - /*const void aligned_buffer = buffer; */ - - /* When we already have some bits in our internal buffer concatenate - both inputs first. */ - if (ctx->buflen != 0) { - size_t left_over = ctx->buflen; - size_t add = 128 - left_over > len ? len : 128 - left_over; - - /* Only put full words in the buffer. */ - /* Forcing alignment here appears to be only an optimization. - * The glibc source uses __alignof__, which seems to be a - * gratuitous usage of a GCC extension, when sizeof() will - * work fine. (And don't question the sanity of using - * sizeof(guint32) instead of 4. */ - /* add -= add % __alignof__ (guint32); */ - add -= add % sizeof (guint32); - - memcpy (&ctx->buffer[left_over], buffer, add); - ctx->buflen += add; - - if (ctx->buflen > 64) { - md5_process_block (ctx->buffer, ctx->buflen & ~63, ctx); - - ctx->buflen &= 63; - /* The regions in the following copy operation cannot overlap. */ - memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63], ctx->buflen); - } - - buffer = (const char *) buffer + add; - len -= add; - } - - /* Process available complete blocks. */ - if (len > 64) { - md5_process_block (buffer, len & ~63, ctx); - buffer = (const char *) buffer + (len & ~63); - len &= 63; - } - - /* Move remaining bytes in internal buffer. */ - if (len > 0) { - size_t left_over = ctx->buflen; - - memcpy (&ctx->buffer[left_over], buffer, len); - left_over += len; - if (left_over >= 64) { - md5_process_block (ctx->buffer, 64, ctx); - left_over -= 64; - memcpy (ctx->buffer, &ctx->buffer[64], left_over); - } - ctx->buflen = left_over; - } -} - - -/* These are the four functions used in the four steps of the MD5 algorithm - and defined in the RFC 1321. The first function is a little bit optimized - (as found in Colin Plumbs public domain implementation). */ -/* #define FF(b, c, d) ((b & c) | (~b & d)) */ -#define FF(b, c, d) (d ^ (b & (c ^ d))) -#define FG(b, c, d) FF (d, b, c) -#define FH(b, c, d) (b ^ c ^ d) -#define FI(b, c, d) (c ^ (b | ~d)) - -/* Process LEN bytes of BUFFER, accumulating context into CTX. - It is assumed that LEN % 64 == 0. */ -static void -md5_process_block (const void *buffer, size_t len, GstMD5Sink * ctx) -{ - guint32 correct_words[16]; - const guint32 *words = buffer; - size_t nwords = len / sizeof (guint32); - const guint32 *endp = words + nwords; - guint32 A = ctx->A; - guint32 B = ctx->B; - guint32 C = ctx->C; - guint32 D = ctx->D; - - /* First increment the byte count. RFC 1321 specifies the possible - length of the file up to 2^64 bits. Here we only compute the - number of bytes. Do a double word increment. */ - ctx->total[0] += len; - if (ctx->total[0] < len) - ++ctx->total[1]; - - /* Process all bytes in the buffer with 64 bytes in each round of - the loop. */ - while (words < endp) { - guint32 *cwp = correct_words; - guint32 A_save = A; - guint32 B_save = B; - guint32 C_save = C; - guint32 D_save = D; - - /* First round: using the given function, the context and a constant - the next context is computed. Because the algorithms processing - unit is a 32-bit word and it is determined to work on words in - little endian byte order we perhaps have to change the byte order - before the computation. To reduce the work for the next steps - we store the swapped words in the array CORRECT_WORDS. */ - -#define OP(a, b, c, d, s, T) \ - do \ - { \ - a += FF (b, c, d) + (*cwp++ = GUINT32_TO_LE (*words)) + T; \ - ++words; \ - CYCLIC (a, s); \ - a += b; \ - } \ - while (0) - - /* It is unfortunate that C does not provide an operator for - cyclic rotation. Hope the C compiler is smart enough. */ -#define CYCLIC(w, s) (w = (w << s) | (w >> (32 - s))) - - /* Before we start, one word to the strange constants. - They are defined in RFC 1321 as - - T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64 - */ - - /* Round 1. */ - OP (A, B, C, D, 7, 0xd76aa478); - OP (D, A, B, C, 12, 0xe8c7b756); - OP (C, D, A, B, 17, 0x242070db); - OP (B, C, D, A, 22, 0xc1bdceee); - OP (A, B, C, D, 7, 0xf57c0faf); - OP (D, A, B, C, 12, 0x4787c62a); - OP (C, D, A, B, 17, 0xa8304613); - OP (B, C, D, A, 22, 0xfd469501); - OP (A, B, C, D, 7, 0x698098d8); - OP (D, A, B, C, 12, 0x8b44f7af); - OP (C, D, A, B, 17, 0xffff5bb1); - OP (B, C, D, A, 22, 0x895cd7be); - OP (A, B, C, D, 7, 0x6b901122); - OP (D, A, B, C, 12, 0xfd987193); - OP (C, D, A, B, 17, 0xa679438e); - OP (B, C, D, A, 22, 0x49b40821); - - /* For the second to fourth round we have the possibly swapped words - in CORRECT_WORDS. Redefine the macro to take an additional first - argument specifying the function to use. */ -#undef OP -#define OP(f, a, b, c, d, k, s, T) \ - do \ - { \ - a += f (b, c, d) + correct_words[k] + T; \ - CYCLIC (a, s); \ - a += b; \ - } \ - while (0) - - /* Round 2. */ - OP (FG, A, B, C, D, 1, 5, 0xf61e2562); - OP (FG, D, A, B, C, 6, 9, 0xc040b340); - OP (FG, C, D, A, B, 11, 14, 0x265e5a51); - OP (FG, B, C, D, A, 0, 20, 0xe9b6c7aa); - OP (FG, A, B, C, D, 5, 5, 0xd62f105d); - OP (FG, D, A, B, C, 10, 9, 0x02441453); - OP (FG, C, D, A, B, 15, 14, 0xd8a1e681); - OP (FG, B, C, D, A, 4, 20, 0xe7d3fbc8); - OP (FG, A, B, C, D, 9, 5, 0x21e1cde6); - OP (FG, D, A, B, C, 14, 9, 0xc33707d6); - OP (FG, C, D, A, B, 3, 14, 0xf4d50d87); - OP (FG, B, C, D, A, 8, 20, 0x455a14ed); - OP (FG, A, B, C, D, 13, 5, 0xa9e3e905); - OP (FG, D, A, B, C, 2, 9, 0xfcefa3f8); - OP (FG, C, D, A, B, 7, 14, 0x676f02d9); - OP (FG, B, C, D, A, 12, 20, 0x8d2a4c8a); - - /* Round 3. */ - OP (FH, A, B, C, D, 5, 4, 0xfffa3942); - OP (FH, D, A, B, C, 8, 11, 0x8771f681); - OP (FH, C, D, A, B, 11, 16, 0x6d9d6122); - OP (FH, B, C, D, A, 14, 23, 0xfde5380c); - OP (FH, A, B, C, D, 1, 4, 0xa4beea44); - OP (FH, D, A, B, C, 4, 11, 0x4bdecfa9); - OP (FH, C, D, A, B, 7, 16, 0xf6bb4b60); - OP (FH, B, C, D, A, 10, 23, 0xbebfbc70); - OP (FH, A, B, C, D, 13, 4, 0x289b7ec6); - OP (FH, D, A, B, C, 0, 11, 0xeaa127fa); - OP (FH, C, D, A, B, 3, 16, 0xd4ef3085); - OP (FH, B, C, D, A, 6, 23, 0x04881d05); - OP (FH, A, B, C, D, 9, 4, 0xd9d4d039); - OP (FH, D, A, B, C, 12, 11, 0xe6db99e5); - OP (FH, C, D, A, B, 15, 16, 0x1fa27cf8); - OP (FH, B, C, D, A, 2, 23, 0xc4ac5665); - - /* Round 4. */ - OP (FI, A, B, C, D, 0, 6, 0xf4292244); - OP (FI, D, A, B, C, 7, 10, 0x432aff97); - OP (FI, C, D, A, B, 14, 15, 0xab9423a7); - OP (FI, B, C, D, A, 5, 21, 0xfc93a039); - OP (FI, A, B, C, D, 12, 6, 0x655b59c3); - OP (FI, D, A, B, C, 3, 10, 0x8f0ccc92); - OP (FI, C, D, A, B, 10, 15, 0xffeff47d); - OP (FI, B, C, D, A, 1, 21, 0x85845dd1); - OP (FI, A, B, C, D, 8, 6, 0x6fa87e4f); - OP (FI, D, A, B, C, 15, 10, 0xfe2ce6e0); - OP (FI, C, D, A, B, 6, 15, 0xa3014314); - OP (FI, B, C, D, A, 13, 21, 0x4e0811a1); - OP (FI, A, B, C, D, 4, 6, 0xf7537e82); - OP (FI, D, A, B, C, 11, 10, 0xbd3af235); - OP (FI, C, D, A, B, 2, 15, 0x2ad7d2bb); - OP (FI, B, C, D, A, 9, 21, 0xeb86d391); - - /* Add the starting values of the context. */ - A += A_save; - B += B_save; - C += C_save; - D += D_save; - } - - /* Put checksum in context given as argument. */ - ctx->A = A; - ctx->B = B; - ctx->C = C; - ctx->D = D; -} - -static void -gst_md5sink_base_init (gpointer g_class) -{ - GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_set_details (gstelement_class, &gst_md5sink_details); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&md5_sink_template)); -} - -static void -gst_md5sink_class_init (GstMD5SinkClass * klass) -{ - GObjectClass *gobject_class; - GstElementClass *gstelement_class; - - gobject_class = (GObjectClass *) klass; - gstelement_class = (GstElementClass *) klass; - - - gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_md5sink_get_property); - - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MD5, - g_param_spec_string ("md5", "md5", "current value of the md5 sum", - "", G_PARAM_READABLE)); - - gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_md5sink_change_state); -} - -static void -gst_md5sink_init (GstMD5Sink * md5sink) -{ - GstPad *pad; - - pad = - gst_pad_new_from_template (gst_static_pad_template_get - (&md5_sink_template), "sink"); - gst_element_add_pad (GST_ELEMENT (md5sink), pad); - gst_pad_set_chain_function (pad, GST_DEBUG_FUNCPTR (gst_md5sink_chain)); - - md5_init_ctx (md5sink); -} - -static GstElementStateReturn -gst_md5sink_change_state (GstElement * element) -{ - GstMD5Sink *sink; - - /* element check */ - sink = GST_MD5SINK (element); - - g_return_val_if_fail (GST_IS_MD5SINK (sink), GST_STATE_FAILURE); - - switch (GST_STATE_TRANSITION (element)) { - case GST_STATE_READY_TO_PAUSED: - md5_init_ctx (sink); - g_object_notify (G_OBJECT (element), "md5"); - break; - case GST_STATE_PAUSED_TO_READY: - md5_finish_ctx (sink, sink->md5); - g_object_notify (G_OBJECT (element), "md5"); - break; - default: - break; - } - - if ((GST_ELEMENT_CLASS (parent_class)->change_state)) - return GST_ELEMENT_CLASS (parent_class)->change_state (element); - - return GST_STATE_SUCCESS; -} - -static void -gst_md5sink_get_property (GObject * object, guint prop_id, GValue * value, - GParamSpec * pspec) -{ - GstMD5Sink *sink; - - /* it's not null if we got it, but it might not be ours */ - g_return_if_fail (GST_IS_MD5SINK (object)); - - sink = GST_MD5SINK (object); - - switch (prop_id) { - case ARG_MD5: - { - /* you could actually get a value for the current md5. - * This is currently disabled. - * md5_read_ctx (sink, sink->md5); */ - /* md5 is a guchar[16] */ - int i; - gchar *md5string = g_malloc0 (33); - - for (i = 0; i < 16; ++i) - sprintf (md5string + i * 2, "%02x", sink->md5[i]); - g_value_set_string (value, md5string); - g_free (md5string); - } - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_md5sink_chain (GstPad * pad, GstData * _data) -{ - GstBuffer *buf = GST_BUFFER (_data); - GstMD5Sink *md5sink; - - g_return_if_fail (pad != NULL); - g_return_if_fail (GST_IS_PAD (pad)); - g_return_if_fail (buf != NULL); - - md5sink = GST_MD5SINK (gst_pad_get_parent (pad)); - - if (GST_IS_BUFFER (buf)) { - md5_process_bytes (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf), md5sink); - } - - gst_buffer_unref (buf); -} diff --git a/plugins/elements/gstmd5sink.h b/plugins/elements/gstmd5sink.h deleted file mode 100644 index d2b8109a8a..0000000000 --- a/plugins/elements/gstmd5sink.h +++ /dev/null @@ -1,74 +0,0 @@ -/* GStreamer - * Copyright (C) 2002 Erik Walthinsen - * 2002 Wim Taymans - * - * gstmd5sink.h: - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - -#ifndef __GST_MD5SINK_H__ -#define __GST_MD5SINK_H__ - - -#include - -G_BEGIN_DECLS - - -#define GST_TYPE_MD5SINK \ - (gst_md5sink_get_type()) -#define GST_MD5SINK(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MD5SINK,GstMD5Sink)) -#define GST_MD5SINK_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MD5SINK,GstMD5SinkClass)) -#define GST_IS_MD5SINK(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MD5SINK)) -#define GST_IS_MD5SINK_CLASS(obj) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MD5SINK)) - -typedef struct _GstMD5Sink GstMD5Sink; -typedef struct _GstMD5SinkClass GstMD5SinkClass; - -struct _GstMD5Sink { - GstElement element; - - /* md5 information */ - guint32 A; - guint32 B; - guint32 C; - guint32 D; - - guint32 total[2]; - guint32 buflen; - gchar buffer[128]; - - /* latest md5 */ - guchar md5[16]; - -}; - -struct _GstMD5SinkClass { - GstElementClass parent_class; - -}; - -GType gst_md5sink_get_type (void); - -G_END_DECLS - -#endif /* __GST_MD5SINK_H__ */ diff --git a/plugins/elements/gstmultifilesrc.c b/plugins/elements/gstmultifilesrc.c deleted file mode 100644 index f781844865..0000000000 --- a/plugins/elements/gstmultifilesrc.c +++ /dev/null @@ -1,366 +0,0 @@ -/* GStreamer - * Copyright (C) 1999,2000 Erik Walthinsen - * 2000 Wim Taymans - * 2001 Dominic Ludlam - * - * gstmultifilesrc.c: - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include -#include -#include -#include -#include -#include -#include - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include "../gst-i18n-lib.h" - -#include "gstmultifilesrc.h" - -static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - -GST_DEBUG_CATEGORY_STATIC (gst_multifilesrc_debug); -#define GST_CAT_DEFAULT gst_multifilesrc_debug - -GstElementDetails gst_multifilesrc_details = -GST_ELEMENT_DETAILS ("Multi File Source", - "Source/File", - "Read from multiple files in order", - "Dominic Ludlam "); - -/* FileSrc signals and args */ -enum -{ - NEW_FILE, - LAST_SIGNAL -}; - -enum -{ - ARG_0, - ARG_LOCATIONS, - ARG_HAVENEWMEDIA -}; - -#define _do_init(bla) \ - GST_DEBUG_CATEGORY_INIT (gst_multifilesrc_debug, "multifilesrc", 0, "multifilesrc element"); - -GST_BOILERPLATE_FULL (GstMultiFileSrc, gst_multifilesrc, GstElement, - GST_TYPE_ELEMENT, _do_init); - -static void gst_multifilesrc_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec); -static void gst_multifilesrc_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec); - -static GstData *gst_multifilesrc_get (GstPad * pad); - -/*static GstBuffer * gst_multifilesrc_get_region (GstPad *pad,GstRegionType type,guint64 offset,guint64 len);*/ - -static GstElementStateReturn gst_multifilesrc_change_state (GstElement * - element); - -static gboolean gst_multifilesrc_open_file (GstMultiFileSrc * src, - GstPad * srcpad); -static void gst_multifilesrc_close_file (GstMultiFileSrc * src); - -static guint gst_multifilesrc_signals[LAST_SIGNAL] = { 0 }; - -static void -gst_multifilesrc_base_init (gpointer g_class) -{ - GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&srctemplate)); - gst_element_class_set_details (gstelement_class, &gst_multifilesrc_details); -} -static void -gst_multifilesrc_class_init (GstMultiFileSrcClass * klass) -{ - GObjectClass *gobject_class; - GstElementClass *gstelement_class; - - gobject_class = (GObjectClass *) klass; - gstelement_class = (GstElementClass *) klass; - - - gst_multifilesrc_signals[NEW_FILE] = - g_signal_new ("new-file", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GstMultiFileSrcClass, new_file), NULL, NULL, - g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING); - - - - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOCATIONS, g_param_spec_pointer ("locations", "locations", "locations", G_PARAM_READWRITE)); /* CHECKME */ - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_HAVENEWMEDIA, - g_param_spec_boolean ("newmedia", "newmedia", - "generate new media events?", FALSE, G_PARAM_READWRITE)); - - - gobject_class->set_property = gst_multifilesrc_set_property; - gobject_class->get_property = gst_multifilesrc_get_property; - - gstelement_class->change_state = gst_multifilesrc_change_state; -} - -static void -gst_multifilesrc_init (GstMultiFileSrc * multifilesrc) -{ -/* GST_FLAG_SET (filesrc, GST_SRC_); */ - - multifilesrc->srcpad = - gst_pad_new_from_template (gst_static_pad_template_get (&srctemplate), - "src"); - gst_pad_set_get_function (multifilesrc->srcpad, gst_multifilesrc_get); -/* gst_pad_set_getregion_function (multifilesrc->srcpad,gst_multifilesrc_get_region); */ - gst_element_add_pad (GST_ELEMENT (multifilesrc), multifilesrc->srcpad); - - multifilesrc->listptr = NULL; - multifilesrc->currentfilename = NULL; - multifilesrc->fd = 0; - multifilesrc->size = 0; - multifilesrc->map = NULL; - multifilesrc->new_seek = FALSE; - multifilesrc->have_newmedia_events = FALSE; -} - -static void -gst_multifilesrc_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec) -{ - GstMultiFileSrc *src; - - /* it's not null if we got it, but it might not be ours */ - g_return_if_fail (GST_IS_MULTIFILESRC (object)); - - src = GST_MULTIFILESRC (object); - - switch (prop_id) { - case ARG_LOCATIONS: - /* the element must be stopped in order to do this */ - g_return_if_fail (GST_STATE (src) < GST_STATE_PLAYING); - - /* clear the filename if we get a NULL */ - if (g_value_get_pointer (value) == NULL) { - gst_element_set_state (GST_ELEMENT (object), GST_STATE_NULL); - src->listptr = NULL; - /* otherwise set the new filenames */ - } else { - src->listptr = g_value_get_pointer (value); - } - break; - case ARG_HAVENEWMEDIA: - src->have_newmedia_events = g_value_get_boolean (value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_multifilesrc_get_property (GObject * object, guint prop_id, GValue * value, - GParamSpec * pspec) -{ - GstMultiFileSrc *src; - - /* it's not null if we got it, but it might not be ours */ - g_return_if_fail (GST_IS_MULTIFILESRC (object)); - - src = GST_MULTIFILESRC (object); - - switch (prop_id) { - case ARG_LOCATIONS: - g_value_set_pointer (value, src->listptr); - break; - case ARG_HAVENEWMEDIA: - g_value_set_boolean (value, src->have_newmedia_events); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -/** - * gst_filesrc_get: - * @pad: #GstPad to push a buffer from - * - * Push a new buffer from the filesrc at the current offset. - */ -static GstData * -gst_multifilesrc_get (GstPad * pad) -{ - GstMultiFileSrc *src; - GstBuffer *buf; - GstEvent *newmedia; - GSList *list; - - - g_return_val_if_fail (pad != NULL, NULL); - src = GST_MULTIFILESRC (gst_pad_get_parent (pad)); - - GST_DEBUG ("curfileindex = %d newmedia flag = %s", src->curfileindex, - GST_FLAG_IS_SET (src, GST_MULTIFILESRC_NEWFILE) ? "true" : "false"); - - switch (GST_FLAG_IS_SET (src, GST_MULTIFILESRC_NEWFILE)) { - case FALSE: - if (GST_FLAG_IS_SET (src, GST_MULTIFILESRC_OPEN)) - gst_multifilesrc_close_file (src); - - if (!src->listptr) { - GST_DEBUG ("sending EOS event"); - gst_element_set_eos (GST_ELEMENT (src)); - return GST_DATA (gst_event_new (GST_EVENT_EOS)); - } - - list = src->listptr; - src->currentfilename = (gchar *) list->data; - src->listptr = src->listptr->next; - - if (!gst_multifilesrc_open_file (src, pad)) - return NULL; - src->curfileindex++; - /* emitted after the open, as the user may free the list and string from here */ - g_signal_emit (G_OBJECT (src), gst_multifilesrc_signals[NEW_FILE], 0, - list); - if (src->have_newmedia_events) { - newmedia = - gst_event_new_discontinuous (TRUE, GST_FORMAT_TIME, (gint64) 0, - GST_FORMAT_UNDEFINED); - GST_FLAG_SET (src, GST_MULTIFILESRC_NEWFILE); - - GST_DEBUG ("sending new media event"); - return GST_DATA (newmedia); - } - default: - if (GST_FLAG_IS_SET (src, GST_MULTIFILESRC_NEWFILE)) - GST_FLAG_UNSET (src, GST_MULTIFILESRC_NEWFILE); - /* create the buffer */ - /* FIXME: should eventually use a bufferpool for this */ - buf = gst_buffer_new (); - - g_return_val_if_fail (buf != NULL, NULL); - - /* simply set the buffer to point to the correct region of the file */ - GST_BUFFER_DATA (buf) = src->map; - GST_BUFFER_SIZE (buf) = src->size; - GST_BUFFER_OFFSET (buf) = 0; - GST_BUFFER_FLAG_SET (buf, GST_BUFFER_DONTFREE); - - if (src->new_seek) { - /* fixme, do something here */ - src->new_seek = FALSE; - } - - /* we're done, return the buffer */ - GST_DEBUG ("sending buffer"); - return GST_DATA (buf); - } - - /* should not reach here */ - g_assert_not_reached (); - return NULL; -} - -/* open the file and mmap it, necessary to go to READY state */ -static gboolean -gst_multifilesrc_open_file (GstMultiFileSrc * src, GstPad * srcpad) -{ - g_return_val_if_fail (!GST_FLAG_IS_SET (src, GST_MULTIFILESRC_OPEN), FALSE); - - if (src->currentfilename == NULL || src->currentfilename[0] == '\0') { - GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, - (_("No file name specified for reading.")), (NULL)); - return FALSE; - } - - /* open the file. FIXME: do we need to use O_LARGEFILE here? */ - src->fd = open ((const char *) src->currentfilename, O_RDONLY); - if (src->fd < 0) { - GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, - (_("Could not open file \"%s\" for reading."), src->currentfilename), - GST_ERROR_SYSTEM); - return FALSE; - - } else { - /* find the file length */ - src->size = lseek (src->fd, 0, SEEK_END); - lseek (src->fd, 0, SEEK_SET); - /* map the file into memory. - * FIXME: don't map the whole file at once, there might - * be restrictions set. Get max size via getrlimit - * or re-try with smaller size if mmap fails with ENOMEM? */ - src->map = mmap (NULL, src->size, PROT_READ, MAP_SHARED, src->fd, 0); - madvise (src->map, src->size, MADV_SEQUENTIAL); - /* collapse state if that failed */ - if (src->map == NULL) { - close (src->fd); - GST_ELEMENT_ERROR (src, RESOURCE, TOO_LAZY, (NULL), - ("mmap call failed.")); - return FALSE; - } - GST_FLAG_SET (src, GST_MULTIFILESRC_OPEN); - src->new_seek = TRUE; - } - return TRUE; -} - -/* unmap and close the file */ -static void -gst_multifilesrc_close_file (GstMultiFileSrc * src) -{ - g_return_if_fail (GST_FLAG_IS_SET (src, GST_MULTIFILESRC_OPEN)); - - /* unmap the file from memory and close the file */ - munmap (src->map, src->size); - close (src->fd); - - /* zero out a lot of our state */ - src->fd = 0; - src->size = 0; - src->map = NULL; - src->new_seek = FALSE; - - GST_FLAG_UNSET (src, GST_MULTIFILESRC_OPEN); -} - -static GstElementStateReturn -gst_multifilesrc_change_state (GstElement * element) -{ - g_return_val_if_fail (GST_IS_MULTIFILESRC (element), GST_STATE_FAILURE); - - if (GST_STATE_PENDING (element) == GST_STATE_NULL) { - if (GST_FLAG_IS_SET (element, GST_MULTIFILESRC_OPEN)) - gst_multifilesrc_close_file (GST_MULTIFILESRC (element)); - } - - if (GST_ELEMENT_CLASS (parent_class)->change_state) - return GST_ELEMENT_CLASS (parent_class)->change_state (element); - - return GST_STATE_SUCCESS; -} diff --git a/plugins/elements/gstmultifilesrc.h b/plugins/elements/gstmultifilesrc.h deleted file mode 100644 index 077d69eca7..0000000000 --- a/plugins/elements/gstmultifilesrc.h +++ /dev/null @@ -1,85 +0,0 @@ -/* GStreamer - * Copyright (C) 1999,2000 Erik Walthinsen - * 2000 Wim Taymans - * 2001 Dominic Ludlam - * - * gstmultifilesrc.h: - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __GST_MULTIFILESRC_H__ -#define __GST_MULTIFILESRC_H__ - -#include - -G_BEGIN_DECLS - - -#define GST_TYPE_MULTIFILESRC \ - (gst_multifilesrc_get_type()) -#define GST_MULTIFILESRC(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MULTIFILESRC,GstMultiFileSrc)) -#define GST_MULTIFILESRC_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MULTIFILESRC,GstMultiFileSrcClass)) -#define GST_IS_MULTIFILESRC(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MULTIFILESRC)) -#define GST_IS_MULTIFILESRC_CLASS(obj) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MULTIFILESRC)) - -typedef enum { - GST_MULTIFILESRC_OPEN = GST_ELEMENT_FLAG_LAST, - GST_MULTIFILESRC_NEWFILE = GST_ELEMENT_FLAG_LAST + 2, - - GST_MULTIFILESRC_FLAG_LAST = GST_ELEMENT_FLAG_LAST + 4 -} GstMultiFileSrcFlags; - -typedef struct _GstMultiFileSrc GstMultiFileSrc; -typedef struct _GstMultiFileSrcClass GstMultiFileSrcClass; - -struct _GstMultiFileSrc { - GstElement element; - /* pads */ - GstPad *srcpad; - - /* current file details */ - gchar *currentfilename; - GSList *listptr; - - /* mapping parameters */ - gint fd; - gulong size; /* how long is the file? */ - guchar *map; /* where the file is mapped to */ - - gint curfileindex; /* how many files have we done so far */ - - gboolean have_newmedia_events; /* tunable parameter to say whether new media - disconts should be generated */ - - gboolean new_seek; -}; - -struct _GstMultiFileSrcClass { - GstElementClass parent_class; - - void (*new_file) (GstMultiFileSrc *multifilesrc, gchar *newfilename); -}; - -GType gst_multifilesrc_get_type(void); - -G_END_DECLS - -#endif /* __GST_MULTIFILESRC_H__ */ diff --git a/plugins/elements/gstpipefilter.c b/plugins/elements/gstpipefilter.c deleted file mode 100644 index 4b361ae43e..0000000000 --- a/plugins/elements/gstpipefilter.c +++ /dev/null @@ -1,371 +0,0 @@ -/* GStreamer - * Copyright (C) 1999,2000 Erik Walthinsen - * 2000 Wim Taymans - * - * gstpipefilter.c: - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include -#include -#include -#include -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef _MSC_VER -#include -#include -#endif -#include - -#include "../gst-i18n-lib.h" -#include "gstpipefilter.h" - -static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - -static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - -GST_DEBUG_CATEGORY_STATIC (gst_pipefilter_debug); -#define GST_CAT_DEFAULT gst_pipefilter_debug - -GstElementDetails gst_pipefilter_details = GST_ELEMENT_DETAILS ("Pipefilter", - "Filter", - "Interoperate with an external program using stdin and stdout", - "Erik Walthinsen , " - "Wim Taymans "); - - -/* Pipefilter signals and args */ -enum -{ - /* FILL ME */ - LAST_SIGNAL -}; - -enum -{ - ARG_0, - ARG_COMMAND -}; - - -#define _do_init(bla) \ - GST_DEBUG_CATEGORY_INIT (gst_pipefilter_debug, "pipefilter", 0, "pipefilter element"); - -GST_BOILERPLATE_FULL (GstPipefilter, gst_pipefilter, GstElement, - GST_TYPE_ELEMENT, _do_init); - -static void gst_pipefilter_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec); -static void gst_pipefilter_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec); - -static GstData *gst_pipefilter_get (GstPad * pad); -static void gst_pipefilter_chain (GstPad * pad, GstData * _data); -static gboolean gst_pipefilter_handle_event (GstPad * pad, GstEvent * event); - -static GstElementStateReturn gst_pipefilter_change_state (GstElement * element); - -static void -gst_pipefilter_base_init (gpointer g_class) -{ - GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&srctemplate)); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&sinktemplate)); - gst_element_class_set_details (gstelement_class, &gst_pipefilter_details); -} -static void -gst_pipefilter_class_init (GstPipefilterClass * klass) -{ - GObjectClass *gobject_class; - GstElementClass *gstelement_class; - - gobject_class = (GObjectClass *) klass; - gstelement_class = (GstElementClass *) klass; - - - gobject_class->set_property = gst_pipefilter_set_property; - gobject_class->get_property = gst_pipefilter_get_property; - - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_COMMAND, g_param_spec_string ("command", "command", "command", NULL, G_PARAM_READWRITE)); /* CHECKME */ - - gstelement_class->change_state = gst_pipefilter_change_state; -} - -static void -gst_pipefilter_init (GstPipefilter * pipefilter) -{ - GST_FLAG_SET (pipefilter, GST_ELEMENT_DECOUPLED); - - pipefilter->sinkpad = - gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate), - "sink"); - gst_element_add_pad (GST_ELEMENT (pipefilter), pipefilter->sinkpad); - gst_pad_set_chain_function (pipefilter->sinkpad, gst_pipefilter_chain); - - pipefilter->srcpad = - gst_pad_new_from_template (gst_static_pad_template_get (&srctemplate), - "src"); - gst_element_add_pad (GST_ELEMENT (pipefilter), pipefilter->srcpad); - gst_pad_set_get_function (pipefilter->srcpad, gst_pipefilter_get); - - pipefilter->command = NULL; - pipefilter->curoffset = 0; - pipefilter->bytes_per_read = 4096; - pipefilter->seq = 0; -} - -static gboolean -gst_pipefilter_handle_event (GstPad * pad, GstEvent * event) -{ - GstPipefilter *pipefilter; - - pipefilter = GST_PIPEFILTER (gst_pad_get_parent (pad)); - - GST_DEBUG ("pipefilter: %s received event", GST_ELEMENT_NAME (pipefilter)); - - switch (GST_EVENT_TYPE (event)) { - case GST_EVENT_EOS: - if (close (pipefilter->fdin[1]) < 0) - perror ("close"); - if (close (pipefilter->fdout[0]) < 0) - perror ("close"); - break; - default: - break; - } - - gst_pad_event_default (pad, event); - - return TRUE; -} - -static GstData * -gst_pipefilter_get (GstPad * pad) -{ - GstPipefilter *pipefilter; - GstBuffer *newbuf; - glong readbytes; - - pipefilter = GST_PIPEFILTER (gst_pad_get_parent (pad)); - - /* create the buffer */ - /* FIXME: should eventually use a bufferpool for this */ - newbuf = gst_buffer_new (); - g_return_val_if_fail (newbuf, NULL); - - /* allocate the space for the buffer data */ - GST_BUFFER_DATA (newbuf) = g_malloc (pipefilter->bytes_per_read); - g_return_val_if_fail (GST_BUFFER_DATA (newbuf) != NULL, NULL); - - /* read it in from the file */ - GST_DEBUG ("attemting to read %ld bytes", pipefilter->bytes_per_read); - readbytes = - read (pipefilter->fdout[0], GST_BUFFER_DATA (newbuf), - pipefilter->bytes_per_read); - GST_DEBUG ("read %ld bytes", readbytes); - if (readbytes < 0) { - GST_ELEMENT_ERROR (pipefilter, RESOURCE, READ, (NULL), GST_ERROR_SYSTEM); - return NULL; - } - /* if we didn't get as many bytes as we asked for, we're at EOF */ - if (readbytes == 0) { - return GST_DATA (gst_event_new (GST_EVENT_EOS)); - - } - - GST_BUFFER_OFFSET (newbuf) = pipefilter->curoffset; - GST_BUFFER_SIZE (newbuf) = readbytes; - pipefilter->curoffset += readbytes; - - return GST_DATA (newbuf); -} - -static void -gst_pipefilter_chain (GstPad * pad, GstData * _data) -{ - GstBuffer *buf; - GstPipefilter *pipefilter; - glong writebytes; - guchar *data; - gulong size; - - g_return_if_fail (pad != NULL); - g_return_if_fail (GST_IS_PAD (pad)); - - if (GST_IS_EVENT (_data)) { - gst_pipefilter_handle_event (pad, GST_EVENT (_data)); - return; - } - - pipefilter = GST_PIPEFILTER (gst_pad_get_parent (pad)); - - buf = GST_BUFFER (_data); - data = GST_BUFFER_DATA (buf); - size = GST_BUFFER_SIZE (buf); - - GST_DEBUG ("attemting to write %ld bytes", size); - writebytes = write (pipefilter->fdin[1], data, size); - GST_DEBUG ("written %ld bytes", writebytes); - if (writebytes < 0) { - GST_ELEMENT_ERROR (pipefilter, RESOURCE, WRITE, (NULL), GST_ERROR_SYSTEM); - return; - } - gst_buffer_unref (buf); -} - -static void -gst_pipefilter_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec) -{ - GstPipefilter *pipefilter; - - /* it's not null if we got it, but it might not be ours */ - g_return_if_fail (GST_IS_PIPEFILTER (object)); - pipefilter = GST_PIPEFILTER (object); - - switch (prop_id) { - case ARG_COMMAND: - pipefilter->orig_command = g_strdup (g_value_get_string (value)); - pipefilter->command = g_strsplit (g_value_get_string (value), " ", 0); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_pipefilter_get_property (GObject * object, guint prop_id, GValue * value, - GParamSpec * pspec) -{ - GstPipefilter *pipefilter; - - /* it's not null if we got it, but it might not be ours */ - g_return_if_fail (GST_IS_PIPEFILTER (object)); - pipefilter = GST_PIPEFILTER (object); - - switch (prop_id) { - case ARG_COMMAND: - g_value_set_string (value, pipefilter->orig_command); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -/* open the file, necessary to go to RUNNING state */ -static gboolean -gst_pipefilter_open_file (GstPipefilter * src) -{ - g_return_val_if_fail (!GST_FLAG_IS_SET (src, GST_PIPEFILTER_OPEN), FALSE); - - pipe (src->fdin); - pipe (src->fdout); - -#ifdef _MSC_VER - src->childpid = 0; -#else - if ((src->childpid = fork ()) == -1) { - GST_ELEMENT_ERROR (src, RESOURCE, TOO_LAZY, (NULL), GST_ERROR_SYSTEM); - return FALSE; - } -#endif - - if (src->childpid == 0) { - close (src->fdin[1]); - close (src->fdout[0]); - /* child */ -#ifdef _MSC_VER - dup2 (src->fdin[0], fileno (stdin)); /* set the childs input stream */ - dup2 (src->fdout[1], fileno (stdout)); /* set the childs output stream */ -#else - dup2 (src->fdin[0], STDIN_FILENO); /* set the childs input stream */ - dup2 (src->fdout[1], STDOUT_FILENO); /* set the childs output stream */ -#endif - execvp (src->command[0], &src->command[0]); - /* will only be reached if execvp has an error */ - GST_ELEMENT_ERROR (src, RESOURCE, TOO_LAZY, (NULL), GST_ERROR_SYSTEM); - return FALSE; - - } else { - close (src->fdin[0]); - close (src->fdout[1]); - } - - GST_FLAG_SET (src, GST_PIPEFILTER_OPEN); - return TRUE; -} - -/* close the file */ -static void -gst_pipefilter_close_file (GstPipefilter * src) -{ - g_return_if_fail (GST_FLAG_IS_SET (src, GST_PIPEFILTER_OPEN)); - - /* close the file */ - close (src->fdout[0]); - close (src->fdout[1]); - close (src->fdin[0]); - close (src->fdin[1]); - - /* zero out a lot of our state */ - src->curoffset = 0; - src->seq = 0; - - GST_FLAG_UNSET (src, GST_PIPEFILTER_OPEN); -} - -static GstElementStateReturn -gst_pipefilter_change_state (GstElement * element) -{ - g_return_val_if_fail (GST_IS_PIPEFILTER (element), FALSE); - - /* if going down into NULL state, close the file if it's open */ - if (GST_STATE_PENDING (element) == GST_STATE_NULL) { - if (GST_FLAG_IS_SET (element, GST_PIPEFILTER_OPEN)) - gst_pipefilter_close_file (GST_PIPEFILTER (element)); - /* otherwise (READY or higher) we need to open the file */ - } else { - if (!GST_FLAG_IS_SET (element, GST_PIPEFILTER_OPEN)) { - if (!gst_pipefilter_open_file (GST_PIPEFILTER (element))) - return GST_STATE_FAILURE; - } - } - - if (GST_ELEMENT_CLASS (parent_class)->change_state) - return GST_ELEMENT_CLASS (parent_class)->change_state (element); - return GST_STATE_SUCCESS; -} diff --git a/plugins/elements/gstpipefilter.h b/plugins/elements/gstpipefilter.h deleted file mode 100644 index d392e91499..0000000000 --- a/plugins/elements/gstpipefilter.h +++ /dev/null @@ -1,85 +0,0 @@ -/* GStreamer - * Copyright (C) 1999,2000 Erik Walthinsen - * 2000 Wim Taymans - * - * gstpipefilter.h: - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - -#ifndef __GST_PIPEFILTER_H__ -#define __GST_PIPEFILTER_H__ - -#include -#include - -G_BEGIN_DECLS - - -#define GST_TYPE_PIPEFILTER \ - (gst_pipefilter_get_type()) -#define GST_PIPEFILTER(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PIPEFILTER,GstPipefilter)) -#define GST_PIPEFILTER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PIPEFILTER,GstPipefilterClass)) -#define GST_IS_PIPEFILTER(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PIPEFILTER)) -#define GST_IS_PIPEFILTER_CLASS(obj) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PIPEFILTER)) - -typedef enum { - GST_PIPEFILTER_OPEN = GST_ELEMENT_FLAG_LAST, - - GST_PIPEFILTER_FLAG_LAST = GST_ELEMENT_FLAG_LAST + 2 -} GstPipeFilterFlags; - -typedef struct _GstPipefilter GstPipefilter; -typedef struct _GstPipefilterClass GstPipefilterClass; - -struct _GstPipefilter { - GstElement element; - - GstPad *sinkpad; - GstPad *srcpad; - - /* command */ - gchar **command; - gchar *orig_command; - /* fd */ - gint fdout[2]; - gint fdin[2]; -#ifdef _MSC_VER - int childpid; -#else - pid_t childpid; -#endif - - gulong curoffset; /* current offset in file */ - gulong bytes_per_read; /* bytes per read */ - - gulong seq; /* buffer sequence number */ -}; - -struct _GstPipefilterClass { - GstElementClass parent_class; -}; - -GType gst_pipefilter_get_type(void); - -G_END_DECLS - -#endif /* __GST_PIPEFILTER_H__ */ diff --git a/plugins/elements/gstqueue.c b/plugins/elements/gstqueue.c deleted file mode 100644 index 0d388cf5a4..0000000000 --- a/plugins/elements/gstqueue.c +++ /dev/null @@ -1,1251 +0,0 @@ -/* GStreamer - * Copyright (C) 1999,2000 Erik Walthinsen - * 2000 Wim Taymans - * 2003 Colin Walters - * - * gstqueue.c: - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - -#include "gst_private.h" - -#include "gstqueue.h" -#include "gstscheduler.h" -#include "gstevent.h" -#include "gstinfo.h" -#include "gsterror.h" - -static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - -static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - -GST_DEBUG_CATEGORY_STATIC (queue_dataflow); -#define GST_CAT_DEFAULT (queue_dataflow) - -#define STATUS(queue, msg) \ - GST_CAT_LOG_OBJECT (queue_dataflow, queue, \ - "(%s:%s) " msg ": %u of %u-%u buffers, %u of %u-%u " \ - "bytes, %" G_GUINT64_FORMAT " of %" G_GUINT64_FORMAT \ - "-%" G_GUINT64_FORMAT " ns, %u elements", \ - GST_DEBUG_PAD_NAME (pad), \ - queue->cur_level.buffers, \ - queue->min_threshold.buffers, \ - queue->max_size.buffers, \ - queue->cur_level.bytes, \ - queue->min_threshold.bytes, \ - queue->max_size.bytes, \ - queue->cur_level.time, \ - queue->min_threshold.time, \ - queue->max_size.time, \ - queue->queue->length) - -static GstElementDetails gst_queue_details = GST_ELEMENT_DETAILS ("Queue", - "Generic", - "Simple data queue", - "Erik Walthinsen "); - - -/* Queue signals and args */ -enum -{ - SIGNAL_UNDERRUN, - SIGNAL_RUNNING, - SIGNAL_OVERRUN, - LAST_SIGNAL -}; - -enum -{ - ARG_0, - /* FIXME: don't we have another way of doing this - * "Gstreamer format" (frame/byte/time) queries? */ - ARG_CUR_LEVEL_BUFFERS, - ARG_CUR_LEVEL_BYTES, - ARG_CUR_LEVEL_TIME, - ARG_MAX_SIZE_BUFFERS, - ARG_MAX_SIZE_BYTES, - ARG_MAX_SIZE_TIME, - ARG_MIN_THRESHOLD_BUFFERS, - ARG_MIN_THRESHOLD_BYTES, - ARG_MIN_THRESHOLD_TIME, - ARG_LEAKY, - ARG_MAY_DEADLOCK, - ARG_BLOCK_TIMEOUT - /* FILL ME */ -}; - -#define GST_QUEUE_MUTEX_LOCK G_STMT_START { \ - GST_CAT_LOG_OBJECT (queue_dataflow, queue, \ - "locking qlock from thread %p", \ - g_thread_self ()); \ - g_mutex_lock (queue->qlock); \ - GST_CAT_LOG_OBJECT (queue_dataflow, queue, \ - "locked qlock from thread %p", \ - g_thread_self ()); \ -} G_STMT_END - -#define GST_QUEUE_MUTEX_UNLOCK G_STMT_START { \ - GST_CAT_LOG_OBJECT (queue_dataflow, queue, \ - "unlocking qlock from thread %p", \ - g_thread_self ()); \ - g_mutex_unlock (queue->qlock); \ -} G_STMT_END - - -typedef struct _GstQueueEventResponse -{ - GstEvent *event; - gboolean ret, handled; -} -GstQueueEventResponse; - -static void gst_queue_base_init (GstQueueClass * klass); -static void gst_queue_class_init (GstQueueClass * klass); -static void gst_queue_init (GstQueue * queue); -static void gst_queue_finalize (GObject * object); - -static void gst_queue_set_property (GObject * object, - guint prop_id, const GValue * value, GParamSpec * pspec); -static void gst_queue_get_property (GObject * object, - guint prop_id, GValue * value, GParamSpec * pspec); - -static void gst_queue_chain (GstPad * pad, GstData * data); -static GstData *gst_queue_get (GstPad * pad); - -static gboolean gst_queue_handle_src_event (GstPad * pad, GstEvent * event); -static gboolean gst_queue_handle_src_query (GstPad * pad, - GstQueryType type, GstFormat * fmt, gint64 * value); - -static GstCaps *gst_queue_getcaps (GstPad * pad); -static GstPadLinkReturn -gst_queue_link_sink (GstPad * pad, const GstCaps * caps); -static GstPadLinkReturn gst_queue_link_src (GstPad * pad, const GstCaps * caps); -static void gst_queue_locked_flush (GstQueue * queue); - -static GstElementStateReturn gst_queue_change_state (GstElement * element); -static gboolean gst_queue_release_locks (GstElement * element); - - -#define GST_TYPE_QUEUE_LEAKY (queue_leaky_get_type ()) - -static GType -queue_leaky_get_type (void) -{ - static GType queue_leaky_type = 0; - static GEnumValue queue_leaky[] = { - {GST_QUEUE_NO_LEAK, "0", "Not Leaky"}, - {GST_QUEUE_LEAK_UPSTREAM, "1", "Leaky on Upstream"}, - {GST_QUEUE_LEAK_DOWNSTREAM, "2", "Leaky on Downstream"}, - {0, NULL, NULL}, - }; - - if (!queue_leaky_type) { - queue_leaky_type = g_enum_register_static ("GstQueueLeaky", queue_leaky); - } - return queue_leaky_type; -} - -static GstElementClass *parent_class = NULL; -static guint gst_queue_signals[LAST_SIGNAL] = { 0 }; - -GType -gst_queue_get_type (void) -{ - static GType queue_type = 0; - - if (!queue_type) { - static const GTypeInfo queue_info = { - sizeof (GstQueueClass), - (GBaseInitFunc) gst_queue_base_init, - NULL, - (GClassInitFunc) gst_queue_class_init, - NULL, - NULL, - sizeof (GstQueue), - 0, - (GInstanceInitFunc) gst_queue_init, - NULL - }; - - queue_type = g_type_register_static (GST_TYPE_ELEMENT, - "GstQueue", &queue_info, 0); - GST_DEBUG_CATEGORY_INIT (queue_dataflow, "queue_dataflow", 0, - "dataflow inside the queue element"); - } - - return queue_type; -} - -static void -gst_queue_base_init (GstQueueClass * klass) -{ - GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass); - - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&srctemplate)); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&sinktemplate)); - gst_element_class_set_details (gstelement_class, &gst_queue_details); -} - -static void -gst_queue_class_init (GstQueueClass * klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass); - - parent_class = g_type_class_peek_parent (klass); - - /* signals */ - gst_queue_signals[SIGNAL_UNDERRUN] = - g_signal_new ("underrun", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (GstQueueClass, underrun), NULL, NULL, - g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); - gst_queue_signals[SIGNAL_RUNNING] = - g_signal_new ("running", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (GstQueueClass, running), NULL, NULL, - g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); - gst_queue_signals[SIGNAL_OVERRUN] = - g_signal_new ("overrun", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (GstQueueClass, overrun), NULL, NULL, - g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); - - /* properties */ - g_object_class_install_property (gobject_class, ARG_CUR_LEVEL_BYTES, - g_param_spec_uint ("current-level-bytes", "Current level (kB)", - "Current amount of data in the queue (bytes)", - 0, G_MAXUINT, 0, G_PARAM_READABLE)); - g_object_class_install_property (gobject_class, ARG_CUR_LEVEL_BUFFERS, - g_param_spec_uint ("current-level-buffers", "Current level (buffers)", - "Current number of buffers in the queue", - 0, G_MAXUINT, 0, G_PARAM_READABLE)); - g_object_class_install_property (gobject_class, ARG_CUR_LEVEL_TIME, - g_param_spec_uint64 ("current-level-time", "Current level (ns)", - "Current amount of data in the queue (in ns)", - 0, G_MAXUINT64, 0, G_PARAM_READABLE)); - - g_object_class_install_property (gobject_class, ARG_MAX_SIZE_BYTES, - g_param_spec_uint ("max-size-bytes", "Max. size (kB)", - "Max. amount of data in the queue (bytes, 0=disable)", - 0, G_MAXUINT, 0, G_PARAM_READWRITE)); - g_object_class_install_property (gobject_class, ARG_MAX_SIZE_BUFFERS, - g_param_spec_uint ("max-size-buffers", "Max. size (buffers)", - "Max. number of buffers in the queue (0=disable)", - 0, G_MAXUINT, 0, G_PARAM_READWRITE)); - g_object_class_install_property (gobject_class, ARG_MAX_SIZE_TIME, - g_param_spec_uint64 ("max-size-time", "Max. size (ns)", - "Max. amount of data in the queue (in ns, 0=disable)", - 0, G_MAXUINT64, 0, G_PARAM_READWRITE)); - - g_object_class_install_property (gobject_class, ARG_MIN_THRESHOLD_BYTES, - g_param_spec_uint ("min-threshold-bytes", "Min. threshold (kB)", - "Min. amount of data in the queue to allow reading (bytes, 0=disable)", - 0, G_MAXUINT, 0, G_PARAM_READWRITE)); - g_object_class_install_property (gobject_class, ARG_MIN_THRESHOLD_BUFFERS, - g_param_spec_uint ("min-threshold-buffers", "Min. threshold (buffers)", - "Min. number of buffers in the queue to allow reading (0=disable)", - 0, G_MAXUINT, 0, G_PARAM_READWRITE)); - g_object_class_install_property (gobject_class, ARG_MIN_THRESHOLD_TIME, - g_param_spec_uint64 ("min-threshold-time", "Min. threshold (ns)", - "Min. amount of data in the queue to allow reading (in ns, 0=disable)", - 0, G_MAXUINT64, 0, G_PARAM_READWRITE)); - - g_object_class_install_property (gobject_class, ARG_LEAKY, - g_param_spec_enum ("leaky", "Leaky", - "Where the queue leaks, if at all", - GST_TYPE_QUEUE_LEAKY, GST_QUEUE_NO_LEAK, G_PARAM_READWRITE)); - g_object_class_install_property (gobject_class, ARG_MAY_DEADLOCK, - g_param_spec_boolean ("may_deadlock", "May Deadlock", - "The queue may deadlock if it's full and not PLAYING", - TRUE, G_PARAM_READWRITE)); - g_object_class_install_property (gobject_class, ARG_BLOCK_TIMEOUT, - g_param_spec_uint64 ("block_timeout", "Timeout for Block", - "Nanoseconds until blocked queue times out and returns filler event. " - "Value of -1 disables timeout", - 0, G_MAXUINT64, -1, G_PARAM_READWRITE)); - - /* set several parent class virtual functions */ - gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_queue_finalize); - gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_queue_set_property); - gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_queue_get_property); - - gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_queue_change_state); - gstelement_class->release_locks = GST_DEBUG_FUNCPTR (gst_queue_release_locks); -} - -static void -gst_queue_init (GstQueue * queue) -{ - /* scheduling on this kind of element is, well, interesting */ - GST_FLAG_SET (queue, GST_ELEMENT_DECOUPLED); - GST_FLAG_SET (queue, GST_ELEMENT_EVENT_AWARE); - - queue->sinkpad = - gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate), - "sink"); - gst_pad_set_chain_function (queue->sinkpad, - GST_DEBUG_FUNCPTR (gst_queue_chain)); - gst_element_add_pad (GST_ELEMENT (queue), queue->sinkpad); - gst_pad_set_link_function (queue->sinkpad, - GST_DEBUG_FUNCPTR (gst_queue_link_sink)); - gst_pad_set_getcaps_function (queue->sinkpad, - GST_DEBUG_FUNCPTR (gst_queue_getcaps)); - gst_pad_set_active (queue->sinkpad, TRUE); - - queue->srcpad = - gst_pad_new_from_template (gst_static_pad_template_get (&srctemplate), - "src"); - gst_pad_set_get_function (queue->srcpad, GST_DEBUG_FUNCPTR (gst_queue_get)); - gst_element_add_pad (GST_ELEMENT (queue), queue->srcpad); - gst_pad_set_link_function (queue->srcpad, - GST_DEBUG_FUNCPTR (gst_queue_link_src)); - gst_pad_set_getcaps_function (queue->srcpad, - GST_DEBUG_FUNCPTR (gst_queue_getcaps)); - gst_pad_set_event_function (queue->srcpad, - GST_DEBUG_FUNCPTR (gst_queue_handle_src_event)); - gst_pad_set_query_function (queue->srcpad, - GST_DEBUG_FUNCPTR (gst_queue_handle_src_query)); - gst_pad_set_active (queue->srcpad, TRUE); - - queue->cur_level.buffers = 0; /* no content */ - queue->cur_level.bytes = 0; /* no content */ - queue->cur_level.time = 0; /* no content */ - queue->max_size.buffers = 100; /* 100 buffers */ - queue->max_size.bytes = 10 * 1024 * 1024; /* 10 MB */ - queue->max_size.time = GST_SECOND; /* 1 s. */ - queue->min_threshold.buffers = 0; /* no threshold */ - queue->min_threshold.bytes = 0; /* no threshold */ - queue->min_threshold.time = 0; /* no threshold */ - - queue->leaky = GST_QUEUE_NO_LEAK; - queue->may_deadlock = TRUE; - queue->block_timeout = GST_CLOCK_TIME_NONE; - queue->interrupt = FALSE; - queue->flush = FALSE; - - queue->qlock = g_mutex_new (); - queue->item_add = g_cond_new (); - queue->item_del = g_cond_new (); - queue->event_done = g_cond_new (); - queue->events = g_queue_new (); - queue->event_lock = g_mutex_new (); - queue->queue = g_queue_new (); - - GST_CAT_DEBUG_OBJECT (GST_CAT_THREAD, queue, - "initialized queue's not_empty & not_full conditions"); - - GST_FLAG_SET (queue, GST_ELEMENT_WORK_IN_PLACE); -} - -/* called only once, as opposed to dispose */ -static void -gst_queue_finalize (GObject * object) -{ - GstQueue *queue = GST_QUEUE (object); - - GST_DEBUG_OBJECT (queue, "finalizing queue"); - - while (!g_queue_is_empty (queue->queue)) { - GstData *data = g_queue_pop_head (queue->queue); - - gst_data_unref (data); - } - g_queue_free (queue->queue); - g_mutex_free (queue->qlock); - g_cond_free (queue->item_add); - g_cond_free (queue->item_del); - g_cond_free (queue->event_done); - g_mutex_lock (queue->event_lock); - while (!g_queue_is_empty (queue->events)) { - GstQueueEventResponse *er = g_queue_pop_head (queue->events); - - gst_event_unref (er->event); - g_free (er); - } - g_mutex_unlock (queue->event_lock); - g_mutex_free (queue->event_lock); - g_queue_free (queue->events); - - if (G_OBJECT_CLASS (parent_class)->finalize) - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static GstCaps * -gst_queue_getcaps (GstPad * pad) -{ - GstQueue *queue; - - queue = GST_QUEUE (gst_pad_get_parent (pad)); - - if (pad == queue->srcpad && queue->cur_level.bytes > 0) { - return gst_caps_copy (queue->negotiated_caps); - } - - return gst_pad_proxy_getcaps (pad); -} - -static GstPadLinkReturn -gst_queue_link_sink (GstPad * pad, const GstCaps * caps) -{ - GstQueue *queue; - GstPadLinkReturn link_ret; - - queue = GST_QUEUE (gst_pad_get_parent (pad)); - - if (queue->cur_level.bytes > 0) { - if (gst_caps_is_equal (caps, queue->negotiated_caps)) { - return GST_PAD_LINK_OK; - } else if (GST_STATE (queue) != GST_STATE_PLAYING) { - return GST_PAD_LINK_DELAYED; - } - - /* Wait until the queue is empty before attempting the pad - negotiation. */ - GST_QUEUE_MUTEX_LOCK; - - STATUS (queue, "waiting for queue to get empty"); - while (queue->cur_level.bytes > 0) { - g_cond_wait (queue->item_del, queue->qlock); - if (queue->interrupt) { - GST_QUEUE_MUTEX_UNLOCK; - return GST_PAD_LINK_DELAYED; - } - } - STATUS (queue, "queue is now empty"); - - GST_QUEUE_MUTEX_UNLOCK; - } - - link_ret = gst_pad_proxy_pad_link (pad, caps); - - if (GST_PAD_LINK_SUCCESSFUL (link_ret)) { - /* we store an extra copy of the negotiated caps, just in case - * the pads become unnegotiated while we have buffers */ - gst_caps_replace (&queue->negotiated_caps, gst_caps_copy (caps)); - } - - return link_ret; -} - -static GstPadLinkReturn -gst_queue_link_src (GstPad * pad, const GstCaps * caps) -{ - GstQueue *queue; - GstPadLinkReturn link_ret; - - queue = GST_QUEUE (gst_pad_get_parent (pad)); - - if (queue->cur_level.bytes > 0) { - if (gst_caps_is_equal (caps, queue->negotiated_caps)) { - return GST_PAD_LINK_OK; - } - return GST_PAD_LINK_REFUSED; - } - - link_ret = gst_pad_proxy_pad_link (pad, caps); - - if (GST_PAD_LINK_SUCCESSFUL (link_ret)) { - /* we store an extra copy of the negotiated caps, just in case - * the pads become unnegotiated while we have buffers */ - gst_caps_replace (&queue->negotiated_caps, gst_caps_copy (caps)); - } - - return link_ret; -} - -static void -gst_queue_locked_flush (GstQueue * queue) -{ - GST_CAT_LOG_OBJECT (queue_dataflow, queue, "Flushing contents..."); - - while (!g_queue_is_empty (queue->queue)) { - GstData *data = g_queue_pop_head (queue->queue); - - /* First loose the reference we added when putting that data in the queue */ - gst_data_unref (data); - /* Then loose another reference because we are supposed to destroy that - data when flushing */ - gst_data_unref (data); - } - queue->timeval = NULL; - queue->cur_level.buffers = 0; - queue->cur_level.bytes = 0; - queue->cur_level.time = 0; - - /* make sure any pending buffers to be added are flushed too */ - queue->flush = TRUE; - - /* we deleted something... */ - g_cond_signal (queue->item_del); -} - -static void -gst_queue_handle_pending_events (GstQueue * queue) -{ - /* check for events to send upstream */ - /* g_queue_get_length is glib 2.4, so don't depend on it yet, use ->length */ - GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, - "handling pending events, events queue of size %d", - queue->events->length); - g_mutex_lock (queue->event_lock); - while (!g_queue_is_empty (queue->events)) { - GstQueueEventResponse *er; - gboolean need_response; - - er = g_queue_pop_head (queue->events); - - GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, - "sending event %p (%d) from event response %p upstream", - er->event, GST_EVENT_TYPE (er->event), er); - if (er->handled) { - /* change this to an assert when this file gets reviewed properly. */ - GST_ELEMENT_ERROR (queue, CORE, EVENT, (NULL), - ("already handled event %p (%d) from event response %p upstream", - er->event, GST_EVENT_TYPE (er->event), er)); - break; - } - g_mutex_unlock (queue->event_lock); - - need_response = - GST_DATA_FLAG_IS_SET (GST_DATA (er->event), - GST_EVENT_COMMON_FLAG_NEED_RESPONSE); - er->ret = gst_pad_event_default (queue->srcpad, er->event); - if (need_response) { - er->handled = TRUE; - g_cond_signal (queue->event_done); - } else { - g_free (er); - } - g_mutex_lock (queue->event_lock); - GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, "event sent"); - } - g_mutex_unlock (queue->event_lock); -} - -static void -gst_queue_chain (GstPad * pad, GstData * data) -{ - GstQueue *queue; - - g_return_if_fail (pad != NULL); - g_return_if_fail (GST_IS_PAD (pad)); - g_return_if_fail (data != NULL); - - queue = GST_QUEUE (GST_OBJECT_PARENT (pad)); - -restart: - /* we have to lock the queue since we span threads */ - GST_QUEUE_MUTEX_LOCK; - - gst_queue_handle_pending_events (queue); - - /* assume don't need to flush this buffer when the queue is filled */ - queue->flush = FALSE; - - if (GST_IS_EVENT (data)) { - switch (GST_EVENT_TYPE (data)) { - case GST_EVENT_FLUSH: - STATUS (queue, "received flush event"); - gst_queue_locked_flush (queue); - STATUS (queue, "after flush"); - break; - case GST_EVENT_EOS: - STATUS (queue, "received EOS"); - break; - default: - /* we put the event in the queue, we don't have to act ourselves */ - GST_CAT_LOG_OBJECT (queue_dataflow, queue, - "adding event %p of type %d", data, GST_EVENT_TYPE (data)); - break; - } - } - - if (GST_IS_BUFFER (data)) - GST_CAT_LOG_OBJECT (queue_dataflow, queue, - "adding buffer %p of size %d and time %" GST_TIME_FORMAT, - data, GST_BUFFER_SIZE (data), - GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (data))); - - /* We make space available if we're "full" according to whatever - * the user defined as "full". Note that this only applies to buffers, - * and filler events with a duration - * We always handle events and they don't count in our statistics. */ - if ((GST_IS_BUFFER (data) || - (GST_IS_EVENT (data) && GST_EVENT_TYPE (data) == GST_EVENT_FILLER && - gst_event_filler_get_duration (GST_EVENT (data)) != - GST_CLOCK_TIME_NONE)) && ((queue->max_size.buffers > 0 - && queue->cur_level.buffers >= queue->max_size.buffers) - || (queue->max_size.bytes > 0 - && queue->cur_level.bytes >= queue->max_size.bytes) - || (queue->max_size.time > 0 - && queue->cur_level.time >= queue->max_size.time))) { - GST_QUEUE_MUTEX_UNLOCK; - g_signal_emit (G_OBJECT (queue), gst_queue_signals[SIGNAL_OVERRUN], 0); - GST_QUEUE_MUTEX_LOCK; - - /* how are we going to make space for this buffer? */ - switch (queue->leaky) { - /* leak current buffer */ - case GST_QUEUE_LEAK_UPSTREAM: - GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, - "queue is full, leaking buffer on upstream end"); - /* now we can clean up and exit right away */ - GST_QUEUE_MUTEX_UNLOCK; - goto out_unref; - - /* leak first buffer in the queue */ - case GST_QUEUE_LEAK_DOWNSTREAM:{ - /* this is a bit hacky. We'll manually iterate the list - * and find the first buffer from the head on. We'll - * unref that and "fix up" the GQueue object... */ - GList *item; - GstData *leak = NULL; - - GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, - "queue is full, leaking buffer on downstream end"); - - for (item = queue->queue->head; item != NULL; item = item->next) { - if (GST_IS_BUFFER (item->data)) { - leak = item->data; - break; - } - } - - /* if we didn't find anything, it means we have no buffers - * in here. That cannot happen, since we had >= 1 bufs */ - g_assert (leak); - - /* Now remove it from the list, fixing up the GQueue - * CHECKME: is a queue->head the first or the last item? */ - item = g_list_delete_link (queue->queue->head, item); - queue->queue->head = g_list_first (item); - queue->queue->tail = g_list_last (item); - queue->queue->length--; - - /* and unref the data at the end. Twice, because we keep a ref - * to make things read-only. Also keep our list uptodate. */ - queue->cur_level.bytes -= GST_BUFFER_SIZE (data); - queue->cur_level.buffers--; - if (GST_BUFFER_DURATION (data) != GST_CLOCK_TIME_NONE) - queue->cur_level.time -= GST_BUFFER_DURATION (data); - - gst_data_unref (data); - gst_data_unref (data); - break; - } - - default: - g_warning ("Unknown leaky type, using default"); - /* fall-through */ - - /* don't leak. Instead, wait for space to be available */ - case GST_QUEUE_NO_LEAK: - STATUS (queue, "pre-full wait"); - - while ((queue->max_size.buffers > 0 && - queue->cur_level.buffers >= queue->max_size.buffers) || - (queue->max_size.bytes > 0 && - queue->cur_level.bytes >= queue->max_size.bytes) || - (queue->max_size.time > 0 && - queue->cur_level.time >= queue->max_size.time)) { - /* if there's a pending state change for this queue - * or its manager, switch back to iterator so bottom - * half of state change executes */ - if (queue->interrupt) { - GstScheduler *sched; - - GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, "interrupted"); - sched = gst_pad_get_scheduler (queue->sinkpad); - if (!sched || gst_scheduler_interrupt (sched, GST_ELEMENT (queue))) { - goto ignore_interrupt; - } - GST_QUEUE_MUTEX_UNLOCK; - /* if we got here because we were unlocked after a - * flush, we don't need to add the buffer to the - * queue again */ - if (queue->flush) { - GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, - "not adding pending buffer after flush"); - goto out_unref; - } - GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, - "adding pending buffer after interrupt"); - goto restart; - } - - if (GST_STATE (queue) != GST_STATE_PLAYING) { - /* this means the other end is shut down. Try to - * signal to resolve the error */ - if (!queue->may_deadlock) { - GST_QUEUE_MUTEX_UNLOCK; - gst_data_unref (data); - GST_ELEMENT_ERROR (queue, CORE, THREAD, (NULL), - ("deadlock found, shutting down source pad elements")); - /* we don't go to out_unref here, since we want to - * unref the buffer *before* calling GST_ELEMENT_ERROR */ - return; - } else { - GST_CAT_WARNING_OBJECT (queue_dataflow, queue, - "%s: waiting for the app to restart " - "source pad elements", GST_ELEMENT_NAME (queue)); - } - } - - ignore_interrupt: - /* OK, we've got a serious issue here. Imagine the situation - * where the puller (next element) is sending an event here, - * so it cannot pull events from the queue, and we cannot - * push data further because the queue is 'full' and therefore, - * we wait here (and do not handle events): deadlock! to solve - * that, we handle pending upstream events here, too. */ - gst_queue_handle_pending_events (queue); - - if (!queue->interrupt) { - STATUS (queue, - "waiting for item_del signal from thread using qlock"); - g_cond_wait (queue->item_del, queue->qlock); - STATUS (queue, "received item_del signal from thread using qlock"); - } else { - queue->interrupt = FALSE; - GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, - "Not waiting, just adding buffer, after interrupt (bad!)"); - break; - } - } - - STATUS (queue, "post-full wait"); - GST_QUEUE_MUTEX_UNLOCK; - g_signal_emit (G_OBJECT (queue), gst_queue_signals[SIGNAL_RUNNING], 0); - GST_QUEUE_MUTEX_LOCK; - break; - } - } - - /* put the buffer on the tail of the list. We keep a reference, - * so that the data is read-only while in here. There's a good - * reason to do so: we have a size and time counter, and any - * modification to the content could change any of the two. */ - gst_data_ref (data); - g_queue_push_tail (queue->queue, data); - - /* Note that we only add buffers (not events) to the statistics */ - if (GST_IS_BUFFER (data)) { - queue->cur_level.buffers++; - queue->cur_level.bytes += GST_BUFFER_SIZE (data); - if (GST_BUFFER_DURATION (data) != GST_CLOCK_TIME_NONE) - queue->cur_level.time += GST_BUFFER_DURATION (data); - } - if (GST_IS_EVENT (data) && GST_EVENT_TYPE (data) == GST_EVENT_FILLER) { - gint64 dur = gst_event_filler_get_duration (GST_EVENT (data)); - - if (dur != GST_CLOCK_TIME_NONE) { - queue->cur_level.time += dur; - } - } - - - STATUS (queue, "+ level"); - - GST_CAT_LOG_OBJECT (queue_dataflow, queue, "signalling item_add"); - g_cond_signal (queue->item_add); - GST_QUEUE_MUTEX_UNLOCK; - - return; - -out_unref: - gst_data_unref (data); - return; -} - -static GstData * -gst_queue_get (GstPad * pad) -{ - GstQueue *queue; - GstData *data; - - g_return_val_if_fail (pad != NULL, NULL); - g_return_val_if_fail (GST_IS_PAD (pad), NULL); - - queue = GST_QUEUE (gst_pad_get_parent (pad)); - -restart: - /* have to lock for thread-safety */ - GST_QUEUE_MUTEX_LOCK; - - if (queue->queue->length == 0 || - (queue->min_threshold.buffers > 0 && - queue->cur_level.buffers < queue->min_threshold.buffers) || - (queue->min_threshold.bytes > 0 && - queue->cur_level.bytes < queue->min_threshold.bytes) || - (queue->min_threshold.time > 0 && - queue->cur_level.time < queue->min_threshold.time)) { - GST_QUEUE_MUTEX_UNLOCK; - g_signal_emit (G_OBJECT (queue), gst_queue_signals[SIGNAL_UNDERRUN], 0); - GST_QUEUE_MUTEX_LOCK; - - STATUS (queue, "pre-empty wait"); - while (queue->queue->length == 0 || - (queue->min_threshold.buffers > 0 && - queue->cur_level.buffers < queue->min_threshold.buffers) || - (queue->min_threshold.bytes > 0 && - queue->cur_level.bytes < queue->min_threshold.bytes) || - (queue->min_threshold.time > 0 && - queue->cur_level.time < queue->min_threshold.time)) { - /* if there's a pending state change for this queue or its - * manager, switch back to iterator so bottom half of state - * change executes. */ - if (queue->interrupt) { - GstScheduler *sched; - - GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, "interrupted"); - GST_QUEUE_MUTEX_UNLOCK; - sched = gst_pad_get_scheduler (queue->srcpad); - queue->interrupt = FALSE; - if (!sched || gst_scheduler_interrupt (sched, GST_ELEMENT (queue))) - return GST_DATA (gst_event_new (GST_EVENT_INTERRUPT)); - goto restart; - } - if (GST_STATE (queue) != GST_STATE_PLAYING) { - /* this means the other end is shut down */ - if (!queue->may_deadlock) { - GST_QUEUE_MUTEX_UNLOCK; - GST_ELEMENT_ERROR (queue, CORE, THREAD, (NULL), - ("deadlock found, shutting down sink pad elements")); - goto restart; - } else { - GST_CAT_WARNING_OBJECT (queue_dataflow, queue, - "%s: waiting for the app to restart " - "source pad elements", GST_ELEMENT_NAME (queue)); - } - } - - STATUS (queue, "waiting for item_add"); - - if (queue->block_timeout != GST_CLOCK_TIME_NONE) { - GTimeVal timeout; - - g_get_current_time (&timeout); - g_time_val_add (&timeout, queue->block_timeout / 1000); - GST_LOG_OBJECT (queue, "g_cond_time_wait using qlock from thread %p", - g_thread_self ()); - if (!g_cond_timed_wait (queue->item_add, queue->qlock, &timeout)) { - GST_QUEUE_MUTEX_UNLOCK; - GST_CAT_WARNING_OBJECT (queue_dataflow, queue, - "Sending filler event"); - return GST_DATA (gst_event_new_filler ()); - } - } else { - GST_LOG_OBJECT (queue, "doing g_cond_wait using qlock from thread %p", - g_thread_self ()); - g_cond_wait (queue->item_add, queue->qlock); - GST_LOG_OBJECT (queue, "done g_cond_wait using qlock from thread %p", - g_thread_self ()); - } - STATUS (queue, "got item_add signal"); - } - - STATUS (queue, "post-empty wait"); - GST_QUEUE_MUTEX_UNLOCK; - g_signal_emit (G_OBJECT (queue), gst_queue_signals[SIGNAL_RUNNING], 0); - GST_QUEUE_MUTEX_LOCK; - } - - /* There's something in the list now, whatever it is */ - data = g_queue_pop_head (queue->queue); - GST_CAT_LOG_OBJECT (queue_dataflow, queue, - "retrieved data %p from queue", data); - - if (data == NULL) - return NULL; - - if (GST_IS_BUFFER (data)) { - /* Update statistics */ - queue->cur_level.buffers--; - queue->cur_level.bytes -= GST_BUFFER_SIZE (data); - if (GST_BUFFER_DURATION (data) != GST_CLOCK_TIME_NONE) - queue->cur_level.time -= GST_BUFFER_DURATION (data); - GST_CAT_LOG_OBJECT (queue_dataflow, queue, - "Got buffer of time %" GST_TIME_FORMAT, - GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (data))); - } - if (GST_IS_EVENT (data) && GST_EVENT_TYPE (data) == GST_EVENT_FILLER) { - gint64 dur = gst_event_filler_get_duration (GST_EVENT (data)); - - if (dur != GST_CLOCK_TIME_NONE) { - queue->cur_level.time -= dur; - } - } - - /* Now that we're done, we can lose our own reference to - * the item, since we're no longer in danger. */ - gst_data_unref (data); - - STATUS (queue, "after _get()"); - - GST_CAT_LOG_OBJECT (queue_dataflow, queue, "signalling item_del"); - g_cond_signal (queue->item_del); - GST_QUEUE_MUTEX_UNLOCK; - - /* FIXME: I suppose this needs to be locked, since the EOS - * bit affects the pipeline state. However, that bit is - * locked too so it'd cause a deadlock. */ - if (GST_IS_EVENT (data)) { - GstEvent *event = GST_EVENT (data); - - switch (GST_EVENT_TYPE (event)) { - case GST_EVENT_EOS: - GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, - "queue \"%s\" eos", GST_ELEMENT_NAME (queue)); - gst_element_set_eos (GST_ELEMENT (queue)); - break; - default: - break; - } - } - - return data; -} - - -static gboolean -gst_queue_handle_src_event (GstPad * pad, GstEvent * event) -{ - GstQueue *queue = GST_QUEUE (gst_pad_get_parent (pad)); - gboolean res; - GstQueueEventResponse *er = NULL; - - GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, "got event %p (%d)", - event, GST_EVENT_TYPE (event)); - GST_QUEUE_MUTEX_LOCK; - - if (gst_element_get_state (GST_ELEMENT (queue)) == GST_STATE_PLAYING) { - gboolean need_response = GST_DATA_FLAG_IS_SET (GST_DATA (event), - GST_EVENT_COMMON_FLAG_NEED_RESPONSE); - - er = g_new (GstQueueEventResponse, 1); - - /* push the event to the queue and wait for upstream consumption */ - er->event = event; - er->handled = FALSE; - - g_mutex_lock (queue->event_lock); - GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, - "putting event %p (%d) on internal queue", event, - GST_EVENT_TYPE (event)); - g_queue_push_tail (queue->events, er); - g_mutex_unlock (queue->event_lock); - - if (!need_response) { - /* Leave for upstream to delete */ - er = NULL; - res = TRUE; - goto handled; - } - - GST_CAT_WARNING_OBJECT (queue_dataflow, queue, - "Preparing for loop for event handler"); - /* see the chain function on why this is here - it prevents a deadlock */ - g_cond_signal (queue->item_del); - while (!er->handled) { - GTimeVal timeout; - - g_get_current_time (&timeout); - g_time_val_add (&timeout, 500 * 1000); /* half a second */ - GST_LOG_OBJECT (queue, "doing g_cond_wait using qlock from thread %p", - g_thread_self ()); - if (!g_cond_timed_wait (queue->event_done, queue->qlock, &timeout) && - !er->handled) { - GST_CAT_WARNING_OBJECT (queue_dataflow, queue, - "timeout in upstream event handling, dropping event %p (%d)", - er->event, GST_EVENT_TYPE (er->event)); - g_mutex_lock (queue->event_lock); - /* since this queue is for src events (ie upstream), this thread is - * the only one that is pushing stuff on it, so we're sure that - * it's still the tail element. FIXME: But in practice, we should use - * GList instead of GQueue for this so we can remove any element in - * the list. */ - g_queue_pop_tail (queue->events); - g_mutex_unlock (queue->event_lock); - gst_event_unref (er->event); - res = FALSE; - goto handled; - } - } - GST_CAT_WARNING_OBJECT (queue_dataflow, queue, "Event handled"); - res = er->ret; - } else { - res = gst_pad_event_default (pad, event); - - switch (GST_EVENT_TYPE (event)) { - case GST_EVENT_FLUSH: - GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, - "FLUSH event, flushing queue\n"); - gst_queue_locked_flush (queue); - break; - case GST_EVENT_SEEK: - if (GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_FLUSH) { - gst_queue_locked_flush (queue); - } - break; - default: - break; - } - } -handled: - GST_QUEUE_MUTEX_UNLOCK; - - if (er) - g_free (er); - - return res; -} - -static gboolean -gst_queue_handle_src_query (GstPad * pad, - GstQueryType type, GstFormat * fmt, gint64 * value) -{ - GstQueue *queue = GST_QUEUE (gst_pad_get_parent (pad)); - gboolean res; - - if (!GST_PAD_PEER (queue->sinkpad)) - return FALSE; - res = gst_pad_query (GST_PAD_PEER (queue->sinkpad), type, fmt, value); - if (!res) - return FALSE; - - if (type == GST_QUERY_POSITION) { - /* FIXME: this code assumes that there's no discont in the queue */ - switch (*fmt) { - case GST_FORMAT_BYTES: - if (*value >= queue->cur_level.bytes) - *value -= queue->cur_level.bytes; - else - *value = 0; - break; - case GST_FORMAT_TIME: - if (*value >= queue->cur_level.time) - *value -= queue->cur_level.time; - else - *value = 0; - break; - default: - /* FIXME */ - break; - } - } - - return TRUE; -} - -static gboolean -gst_queue_release_locks (GstElement * element) -{ - GstQueue *queue; - - queue = GST_QUEUE (element); - - GST_QUEUE_MUTEX_LOCK; - queue->interrupt = TRUE; - g_cond_signal (queue->item_add); - g_cond_signal (queue->item_del); - GST_QUEUE_MUTEX_UNLOCK; - - return TRUE; -} - -static GstElementStateReturn -gst_queue_change_state (GstElement * element) -{ - GstQueue *queue; - GstElementStateReturn ret = GST_STATE_SUCCESS; - - queue = GST_QUEUE (element); - - GST_CAT_LOG_OBJECT (GST_CAT_STATES, element, - "starting state change 0x%x", GST_STATE_TRANSITION (element)); - - /* lock the queue so another thread (not in sync with this thread's state) - * can't call this queue's _get (or whatever) - */ - GST_QUEUE_MUTEX_LOCK; - - switch (GST_STATE_TRANSITION (element)) { - case GST_STATE_NULL_TO_READY: - gst_queue_locked_flush (queue); - break; - case GST_STATE_PAUSED_TO_PLAYING: - if (!GST_PAD_IS_LINKED (queue->sinkpad)) { - GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, queue, - "queue %s is not linked", GST_ELEMENT_NAME (queue)); - /* FIXME can this be? */ - g_cond_signal (queue->item_add); - - ret = GST_STATE_FAILURE; - goto unlock; - } else { - GstScheduler *src_sched, *sink_sched; - - src_sched = gst_pad_get_scheduler (GST_PAD (queue->srcpad)); - sink_sched = gst_pad_get_scheduler (GST_PAD (queue->sinkpad)); - - if (src_sched == sink_sched) { - GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, queue, - "queue %s does not connect different schedulers", - GST_ELEMENT_NAME (queue)); - - g_warning ("queue %s does not connect different schedulers", - GST_ELEMENT_NAME (queue)); - - ret = GST_STATE_FAILURE; - goto unlock; - } - } - queue->interrupt = FALSE; - break; - case GST_STATE_PAUSED_TO_READY: - gst_queue_locked_flush (queue); - gst_caps_replace (&queue->negotiated_caps, NULL); - break; - default: - break; - } - - GST_QUEUE_MUTEX_UNLOCK; - - if (GST_ELEMENT_CLASS (parent_class)->change_state) - ret = GST_ELEMENT_CLASS (parent_class)->change_state (element); - - /* this is an ugly hack to make sure our pads are always active. - * Reason for this is that pad activation for the queue element - * depends on 2 schedulers (ugh) */ - gst_pad_set_active (queue->sinkpad, TRUE); - gst_pad_set_active (queue->srcpad, TRUE); - - GST_CAT_LOG_OBJECT (GST_CAT_STATES, element, "done with state change"); - - return ret; - -unlock: - GST_QUEUE_MUTEX_UNLOCK; - - GST_CAT_LOG_OBJECT (GST_CAT_STATES, element, "done with state change"); - - return ret; -} - - -static void -gst_queue_set_property (GObject * object, - guint prop_id, const GValue * value, GParamSpec * pspec) -{ - GstQueue *queue = GST_QUEUE (object); - - /* someone could change levels here, and since this - * affects the get/put funcs, we need to lock for safety. */ - GST_QUEUE_MUTEX_LOCK; - - switch (prop_id) { - case ARG_MAX_SIZE_BYTES: - queue->max_size.bytes = g_value_get_uint (value); - break; - case ARG_MAX_SIZE_BUFFERS: - queue->max_size.buffers = g_value_get_uint (value); - break; - case ARG_MAX_SIZE_TIME: - queue->max_size.time = g_value_get_uint64 (value); - break; - case ARG_MIN_THRESHOLD_BYTES: - queue->min_threshold.bytes = g_value_get_uint (value); - break; - case ARG_MIN_THRESHOLD_BUFFERS: - queue->min_threshold.buffers = g_value_get_uint (value); - break; - case ARG_MIN_THRESHOLD_TIME: - queue->min_threshold.time = g_value_get_uint64 (value); - break; - case ARG_LEAKY: - queue->leaky = g_value_get_enum (value); - break; - case ARG_MAY_DEADLOCK: - queue->may_deadlock = g_value_get_boolean (value); - break; - case ARG_BLOCK_TIMEOUT: - queue->block_timeout = g_value_get_uint64 (value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } - - GST_QUEUE_MUTEX_UNLOCK; -} - -static void -gst_queue_get_property (GObject * object, - guint prop_id, GValue * value, GParamSpec * pspec) -{ - GstQueue *queue = GST_QUEUE (object); - - switch (prop_id) { - case ARG_CUR_LEVEL_BYTES: - g_value_set_uint (value, queue->cur_level.bytes); - break; - case ARG_CUR_LEVEL_BUFFERS: - g_value_set_uint (value, queue->cur_level.buffers); - break; - case ARG_CUR_LEVEL_TIME: - g_value_set_uint64 (value, queue->cur_level.time); - break; - case ARG_MAX_SIZE_BYTES: - g_value_set_uint (value, queue->max_size.bytes); - break; - case ARG_MAX_SIZE_BUFFERS: - g_value_set_uint (value, queue->max_size.buffers); - break; - case ARG_MAX_SIZE_TIME: - g_value_set_uint64 (value, queue->max_size.time); - break; - case ARG_MIN_THRESHOLD_BYTES: - g_value_set_uint (value, queue->min_threshold.bytes); - break; - case ARG_MIN_THRESHOLD_BUFFERS: - g_value_set_uint (value, queue->min_threshold.buffers); - break; - case ARG_MIN_THRESHOLD_TIME: - g_value_set_uint64 (value, queue->min_threshold.time); - break; - case ARG_LEAKY: - g_value_set_enum (value, queue->leaky); - break; - case ARG_MAY_DEADLOCK: - g_value_set_boolean (value, queue->may_deadlock); - break; - case ARG_BLOCK_TIMEOUT: - g_value_set_uint64 (value, queue->block_timeout); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} diff --git a/plugins/elements/gstqueue.h b/plugins/elements/gstqueue.h deleted file mode 100644 index e473f404ef..0000000000 --- a/plugins/elements/gstqueue.h +++ /dev/null @@ -1,119 +0,0 @@ -/* GStreamer - * Copyright (C) 1999,2000 Erik Walthinsen - * 2000 Wim Taymans - * - * gstqueue.h: - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - -#ifndef __GST_QUEUE_H__ -#define __GST_QUEUE_H__ - - -#include - - -G_BEGIN_DECLS - -#define GST_TYPE_QUEUE \ - (gst_queue_get_type()) -#define GST_QUEUE(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_QUEUE,GstQueue)) -#define GST_QUEUE_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_QUEUE,GstQueueClass)) -#define GST_IS_QUEUE(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_QUEUE)) -#define GST_IS_QUEUE_CLASS(obj) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_QUEUE)) - -enum { - GST_QUEUE_NO_LEAK = 0, - GST_QUEUE_LEAK_UPSTREAM = 1, - GST_QUEUE_LEAK_DOWNSTREAM = 2 -}; - -typedef struct _GstQueue GstQueue; -typedef struct _GstQueueSize GstQueueSize; -typedef struct _GstQueueClass GstQueueClass; - -struct _GstQueueSize { - guint buffers; /* no. of buffers */ - guint bytes; /* no. of bytes */ - guint64 time; /* amount of time */ -}; - -struct _GstQueue { - GstElement element; - - GstPad *sinkpad; - GstPad *srcpad; - - /* the queue of data we're keeping our grubby hands on */ - GQueue *queue; - - GstQueueSize - cur_level, /* currently in the queue */ - max_size, /* max. amount of data allowed in the queue */ - min_threshold; /* min. amount of data required to wake reader */ - - /* whether we leak data, and at which end */ - gint leaky; - - /* number of nanoseconds until a blocked queue 'times out' - * to receive data and returns a filler event. -1 = disable */ - guint64 block_timeout; - - /* it the queue should fail on possible deadlocks */ - gboolean may_deadlock; - - gboolean interrupt; - gboolean flush; - - GMutex *qlock; /* lock for queue (vs object lock) */ - GCond *item_add; /* signals buffers now available for reading */ - GCond *item_del; /* signals space now available for writing */ - GCond *event_done; /* upstream event signaller */ - - GTimeVal *timeval; /* the timeout for the queue locking */ - GQueue *events; /* upstream events get decoupled here */ - - GstCaps *negotiated_caps; - - GMutex *event_lock; /* lock when handling the events queue */ - - gpointer _gst_reserved[GST_PADDING - 1]; -}; - -struct _GstQueueClass { - GstElementClass parent_class; - - /* signals - 'running' is called from both sides - * which might make it sort of non-useful... */ - void (*underrun) (GstQueue *queue); - void (*running) (GstQueue *queue); - void (*overrun) (GstQueue *queue); - - gpointer _gst_reserved[GST_PADDING]; -}; - -GType gst_queue_get_type (void); - -G_END_DECLS - - -#endif /* __GST_QUEUE_H__ */ diff --git a/plugins/elements/gstshaper.c b/plugins/elements/gstshaper.c deleted file mode 100644 index 9b4f19bb6d..0000000000 --- a/plugins/elements/gstshaper.c +++ /dev/null @@ -1,374 +0,0 @@ -/* GStreamer - * Copyright (C) 1999,2000 Erik Walthinsen - * 2000 Wim Taymans - * - * gstshaper.c: - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - -#include - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include "gstshaper.h" - -GST_DEBUG_CATEGORY_STATIC (gst_shaper_debug); -#define GST_CAT_DEFAULT gst_shaper_debug - -GstElementDetails gst_shaper_details = GST_ELEMENT_DETAILS ("Shaper", - "Generic", - "Synchronizes streams on different pads", - "Wim Taymans "); - - -/* Shaper signals and args */ -enum -{ - /* FILL ME */ - LAST_SIGNAL -}; - -enum -{ - ARG_0, - ARG_POLICY, - ARG_SILENT, - ARG_LAST_MESSAGE -}; - -typedef struct -{ - GstPad *sinkpad; - GstPad *srcpad; - GstBuffer *buffer; -} -GstShaperConnection; - -GstStaticPadTemplate shaper_src_template = GST_STATIC_PAD_TEMPLATE ("src%d", - GST_PAD_SRC, - GST_PAD_SOMETIMES, - GST_STATIC_CAPS_ANY); - -GstStaticPadTemplate shaper_sink_template = GST_STATIC_PAD_TEMPLATE ("sink%d", - GST_PAD_SINK, - GST_PAD_REQUEST, - GST_STATIC_CAPS_ANY); - -#define GST_TYPE_SHAPER_POLICY (gst_shaper_policy_get_type()) -static GType -gst_shaper_policy_get_type (void) -{ - static GType shaper_policy_type = 0; - static GEnumValue shaper_policy[] = { - {SHAPER_POLICY_TIMESTAMPS, "1", "sync on timestamps"}, - {SHAPER_POLICY_BUFFERSIZE, "2", "sync on buffer size"}, - {0, NULL, NULL}, - }; - - if (!shaper_policy_type) { - shaper_policy_type = - g_enum_register_static ("GstShaperPolicy", shaper_policy); - } - return shaper_policy_type; -} - -#define _do_init(bla) \ - GST_DEBUG_CATEGORY_INIT (gst_shaper_debug, "shaper", 0, "shaper element"); - -GST_BOILERPLATE_FULL (GstShaper, gst_shaper, GstElement, GST_TYPE_ELEMENT, - _do_init); - -static void gst_shaper_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec); -static void gst_shaper_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec); - -static GstPad *gst_shaper_request_new_pad (GstElement * element, - GstPadTemplate * templ, const gchar * unused); - -static void gst_shaper_loop (GstElement * element); - - -static void -gst_shaper_base_init (gpointer g_class) -{ - GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_set_details (gstelement_class, &gst_shaper_details); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&shaper_src_template)); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&shaper_sink_template)); -} - -static void -gst_shaper_class_init (GstShaperClass * klass) -{ - GObjectClass *gobject_class; - GstElementClass *gstelement_class; - - gobject_class = (GObjectClass *) klass; - gstelement_class = (GstElementClass *) klass; - - - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_POLICY, - g_param_spec_enum ("policy", "Policy", "Shaper policy", - GST_TYPE_SHAPER_POLICY, SHAPER_POLICY_TIMESTAMPS, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SILENT, - g_param_spec_boolean ("silent", "silent", "silent", - FALSE, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LAST_MESSAGE, - g_param_spec_string ("last-message", "last-message", "last-message", - NULL, G_PARAM_READABLE)); - - gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_shaper_set_property); - gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_shaper_get_property); - - gstelement_class->request_new_pad = - GST_DEBUG_FUNCPTR (gst_shaper_request_new_pad); -} - -static GstCaps * -gst_shaper_getcaps (GstPad * pad) -{ - GstPad *otherpad; - GstShaperConnection *connection; - - connection = gst_pad_get_element_private (pad); - - otherpad = - (pad == connection->srcpad ? connection->sinkpad : connection->srcpad); - - if (GST_PAD_PEER (otherpad)) { - return gst_pad_get_caps (GST_PAD_PEER (otherpad)); - } else { - return gst_caps_new_any (); - } -} - -static GList * -gst_shaper_get_internal_link (GstPad * pad) -{ - GList *res = NULL; - GstShaperConnection *connection; - GstPad *otherpad; - - connection = gst_pad_get_element_private (pad); - - otherpad = - (pad == connection->srcpad ? connection->sinkpad : connection->srcpad); - - res = g_list_prepend (res, otherpad); - - return res; -} - -static GstPadLinkReturn -gst_shaper_link (GstPad * pad, const GstCaps * caps) -{ - GstPad *otherpad; - GstShaperConnection *connection; - - connection = gst_pad_get_element_private (pad); - - otherpad = - (pad == connection->srcpad ? connection->sinkpad : connection->srcpad); - - return gst_pad_try_set_caps (otherpad, caps); -} - -static GstShaperConnection * -gst_shaper_create_connection (GstShaper * shaper) -{ - GstShaperConnection *connection; - gchar *padname; - - shaper->nconnections++; - - connection = g_new0 (GstShaperConnection, 1); - - padname = g_strdup_printf ("sink%d", shaper->nconnections); - connection->sinkpad = - gst_pad_new_from_template (gst_static_pad_template_get - (&shaper_sink_template), padname); - g_free (padname); - gst_pad_set_getcaps_function (connection->sinkpad, gst_shaper_getcaps); - gst_pad_set_internal_link_function (connection->sinkpad, - gst_shaper_get_internal_link); - gst_pad_set_link_function (connection->sinkpad, gst_shaper_link); - gst_pad_set_element_private (connection->sinkpad, connection); - gst_element_add_pad (GST_ELEMENT (shaper), connection->sinkpad); - - padname = g_strdup_printf ("src%d", shaper->nconnections); - connection->srcpad = - gst_pad_new_from_template (gst_static_pad_template_get - (&shaper_src_template), padname); - g_free (padname); - gst_pad_set_getcaps_function (connection->srcpad, gst_shaper_getcaps); - gst_pad_set_internal_link_function (connection->srcpad, - gst_shaper_get_internal_link); - gst_pad_set_link_function (connection->srcpad, gst_shaper_link); - gst_pad_set_element_private (connection->srcpad, connection); - gst_element_add_pad (GST_ELEMENT (shaper), connection->srcpad); - - shaper->connections = g_slist_prepend (shaper->connections, connection); - - return connection; -} - -static GstPad * -gst_shaper_request_new_pad (GstElement * element, GstPadTemplate * templ, - const gchar * unused) -{ - GstShaper *shaper = GST_SHAPER (element); - GstShaperConnection *connection; - - connection = gst_shaper_create_connection (shaper); - - return connection->sinkpad; -} - -static void -gst_shaper_init (GstShaper * shaper) -{ - gst_element_set_loop_function (GST_ELEMENT (shaper), gst_shaper_loop); - - shaper->policy = SHAPER_POLICY_TIMESTAMPS; - shaper->connections = NULL; - shaper->nconnections = 0; - shaper->silent = FALSE; - shaper->last_message = NULL; -} - -static void -gst_shaper_loop (GstElement * element) -{ - GstShaper *shaper; - GSList *connections; - gboolean eos = TRUE; - GstShaperConnection *min = NULL; - - shaper = GST_SHAPER (element); - - /* first make sure we have a buffer on all pads */ - connections = shaper->connections; - while (connections) { - GstShaperConnection *connection = (GstShaperConnection *) connections->data; - - /* try to fill a connection without a buffer on a pad that is - * active */ - if (connection->buffer == NULL && GST_PAD_IS_USABLE (connection->sinkpad)) { - GstBuffer *buffer; - - buffer = GST_BUFFER (gst_pad_pull (connection->sinkpad)); - - /* events are simply pushed ASAP */ - if (GST_IS_EVENT (buffer)) { - /* save event type as it will be unreffed after the next push */ - GstEventType type = GST_EVENT_TYPE (buffer); - - gst_pad_push (connection->srcpad, GST_DATA (buffer)); - - switch (type) { - /* on EOS we disable the pad so that we don't pull on - * it again and never get more data */ - case GST_EVENT_EOS: - gst_pad_set_active (connection->sinkpad, FALSE); - break; - default: - break; - } - } else { - /* we store the buffer */ - connection->buffer = buffer; - } - } - /* FIXME policy stuff goes here */ - /* find connection with lowest timestamp */ - if (min == NULL || (connection->buffer != NULL && - (GST_BUFFER_TIMESTAMP (connection->buffer) < - GST_BUFFER_TIMESTAMP (min->buffer)))) { - min = connection; - } - connections = g_slist_next (connections); - } - /* if we have a connection with a buffer, push it */ - if (min != NULL && min->buffer) { - gst_pad_push (min->srcpad, GST_DATA (min->buffer)); - min->buffer = NULL; - /* since we pushed a buffer, it's not EOS */ - eos = FALSE; - } - - if (eos) { - gst_element_set_eos (element); - } -} - -static void -gst_shaper_set_property (GObject * object, guint prop_id, const GValue * value, - GParamSpec * pspec) -{ - GstShaper *shaper; - - /* it's not null if we got it, but it might not be ours */ - g_return_if_fail (GST_IS_SHAPER (object)); - - shaper = GST_SHAPER (object); - - switch (prop_id) { - case ARG_POLICY: - shaper->policy = g_value_get_enum (value); - break; - case ARG_SILENT: - shaper->silent = g_value_get_boolean (value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_shaper_get_property (GObject * object, guint prop_id, GValue * value, - GParamSpec * pspec) -{ - GstShaper *shaper; - - /* it's not null if we got it, but it might not be ours */ - g_return_if_fail (GST_IS_SHAPER (object)); - - shaper = GST_SHAPER (object); - - switch (prop_id) { - case ARG_POLICY: - g_value_set_enum (value, shaper->policy); - break; - case ARG_SILENT: - g_value_set_boolean (value, shaper->silent); - break; - case ARG_LAST_MESSAGE: - g_value_set_string (value, shaper->last_message); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} diff --git a/plugins/elements/gstshaper.h b/plugins/elements/gstshaper.h deleted file mode 100644 index 1fe84e5158..0000000000 --- a/plugins/elements/gstshaper.h +++ /dev/null @@ -1,72 +0,0 @@ -/* GStreamer - * Copyright (C) 1999,2000 Erik Walthinsen - * 2000 Wim Taymans - * - * gstshaper.h: - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - -#ifndef __GST_SHAPER_H__ -#define __GST_SHAPER_H__ - - -#include - -G_BEGIN_DECLS - - -#define GST_TYPE_SHAPER \ - (gst_shaper_get_type()) -#define GST_SHAPER(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SHAPER,GstShaper)) -#define GST_SHAPER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SHAPER,GstShaperClass)) -#define GST_IS_SHAPER(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SHAPER)) -#define GST_IS_SHAPER_CLASS(obj) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SHAPER)) - -typedef enum { - SHAPER_POLICY_TIMESTAMPS = 1, - SHAPER_POLICY_BUFFERSIZE -} GstShaperPolicyType; - -typedef struct _GstShaper GstShaper; -typedef struct _GstShaperClass GstShaperClass; - -struct _GstShaper { - GstElement element; - - GSList *connections; - gint nconnections; - - GstShaperPolicyType policy; - - gboolean silent; - gchar *last_message; -}; - -struct _GstShaperClass { - GstElementClass parent_class; -}; - -GType gst_shaper_get_type (void); - -G_END_DECLS - -#endif /* __GST_SHAPER_H__ */ diff --git a/plugins/elements/gststatistics.c b/plugins/elements/gststatistics.c deleted file mode 100644 index 82744ff6f4..0000000000 --- a/plugins/elements/gststatistics.c +++ /dev/null @@ -1,416 +0,0 @@ -/* GStreamer - * Copyright (C) 1999,2000 Erik Walthinsen - * 2000 Wim Taymans - * - * gststatistics.c: - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include "gststatistics.h" - -static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - -static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - -GST_DEBUG_CATEGORY_STATIC (gst_statistics_debug); -#define GST_CAT_DEFAULT gst_statistics_debug - -GstElementDetails gst_statistics_details = GST_ELEMENT_DETAILS ("Statistics", - "Generic", - "Statistics on buffers/bytes/events", - "David I. Lehn "); - - -/* Statistics signals and args */ -enum -{ - SIGNAL_UPDATE, - LAST_SIGNAL -}; - -enum -{ - ARG_0, - ARG_BUFFERS, - ARG_BYTES, - ARG_EVENTS, - ARG_BUFFER_UPDATE_FREQ, - ARG_BYTES_UPDATE_FREQ, - ARG_EVENT_UPDATE_FREQ, - ARG_UPDATE_ON_EOS, - ARG_UPDATE, - ARG_SILENT -}; - - -#define _do_init(bla) \ - GST_DEBUG_CATEGORY_INIT (gst_statistics_debug, "statistics", 0, "statistics element"); - -GST_BOILERPLATE_FULL (GstStatistics, gst_statistics, GstElement, - GST_TYPE_ELEMENT, _do_init); - -static void gst_statistics_finalize (GObject * object); -static void gst_statistics_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec); -static void gst_statistics_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec); - -static void gst_statistics_chain (GstPad * pad, GstData * _data); -static void gst_statistics_reset (GstStatistics * statistics); -static void gst_statistics_print (GstStatistics * statistics); - -static guint gst_statistics_signals[LAST_SIGNAL] = { 0, }; - -static stats zero_stats = { 0, }; - - -static void -gst_statistics_base_init (gpointer g_class) -{ - GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&srctemplate)); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&sinktemplate)); - gst_element_class_set_details (gstelement_class, &gst_statistics_details); -} - -static void -gst_statistics_finalize (GObject * object) -{ - GstStatistics *statistics; - - statistics = GST_STATISTICS (object); - - if (statistics->timer) - g_timer_destroy (statistics->timer); - - if (statistics->last_timer) - g_timer_destroy (statistics->last_timer); - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static void -gst_statistics_class_init (GstStatisticsClass * klass) -{ - GObjectClass *gobject_class; - - gobject_class = G_OBJECT_CLASS (klass); - - - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BUFFERS, - g_param_spec_int64 ("buffers", "buffers", "total buffers count", - 0, G_MAXINT64, 0, G_PARAM_READABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BYTES, - g_param_spec_int64 ("bytes", "bytes", "total bytes count", - 0, G_MAXINT64, 0, G_PARAM_READABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_EVENTS, - g_param_spec_int64 ("events", "events", "total event count", - 0, G_MAXINT64, 0, G_PARAM_READABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), - ARG_BUFFER_UPDATE_FREQ, g_param_spec_int64 ("buffer_update_freq", - "buffer update freq", "buffer update frequency", 0, G_MAXINT64, 0, - G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), - ARG_BYTES_UPDATE_FREQ, g_param_spec_int64 ("bytes_update_freq", - "bytes update freq", "bytes update frequency", 0, G_MAXINT64, 0, - G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), - ARG_EVENT_UPDATE_FREQ, g_param_spec_int64 ("event_update_freq", - "event update freq", "event update frequency", 0, G_MAXINT64, 0, - G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_UPDATE_ON_EOS, - g_param_spec_boolean ("update_on_eos", "update on EOS", - "update on EOS event", TRUE, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_UPDATE, - g_param_spec_boolean ("update", "update", "update", TRUE, - G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SILENT, - g_param_spec_boolean ("silent", "silent", "silent", TRUE, - G_PARAM_READWRITE)); - - gst_statistics_signals[SIGNAL_UPDATE] = - g_signal_new ("update", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GstStatisticsClass, update), NULL, NULL, - g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); - - gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_statistics_finalize); - gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_statistics_set_property); - gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_statistics_get_property); -} - -static void -gst_statistics_init (GstStatistics * statistics) -{ - statistics->sinkpad = - gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate), - "sink"); - gst_element_add_pad (GST_ELEMENT (statistics), statistics->sinkpad); - gst_pad_set_chain_function (statistics->sinkpad, - GST_DEBUG_FUNCPTR (gst_statistics_chain)); - - statistics->srcpad = - gst_pad_new_from_template (gst_static_pad_template_get (&srctemplate), - "src"); - gst_element_add_pad (GST_ELEMENT (statistics), statistics->srcpad); - - statistics->timer = NULL; - statistics->last_timer = NULL; - gst_statistics_reset (statistics); -} - -static void -gst_statistics_reset (GstStatistics * statistics) -{ - g_return_if_fail (statistics != NULL); - g_return_if_fail (GST_IS_STATISTICS (statistics)); - - statistics->stats.buffers = 0; - statistics->stats.bytes = 0; - statistics->stats.events = 0; - - statistics->last_stats.buffers = 0; - statistics->last_stats.bytes = 0; - statistics->last_stats.events = 0; - - statistics->update_count.buffers = 0; - statistics->update_count.bytes = 0; - statistics->update_count.events = 0; - - statistics->update_freq.buffers = 0; - statistics->update_freq.bytes = 0; - statistics->update_freq.events = 0; - - statistics->update_on_eos = TRUE; - statistics->update = TRUE; - statistics->silent = FALSE; - - if (!statistics->timer) { - statistics->timer = g_timer_new (); - } - if (!statistics->last_timer) { - statistics->last_timer = g_timer_new (); - } -} - -static void -print_stats (gboolean first, const gchar * name, const gchar * type, - stats * base, stats * final, double time) -{ - const gchar *header0 = "statistics"; - const gchar *headerN = " "; - stats delta; - - delta.buffers = final->buffers - base->buffers; - delta.bytes = final->bytes - base->bytes; - delta.events = final->events - base->events; - - g_print ("%s: (%s) %s: s:%g buffers:%" G_GINT64_FORMAT - " bytes:%" G_GINT64_FORMAT - " events:%" G_GINT64_FORMAT "\n", - first ? header0 : headerN, - name, type, time, final->buffers, final->bytes, final->events); - g_print ("%s: (%s) %s: buf/s:%g B/s:%g e/s:%g B/buf:%g\n", - headerN, - name, type, - delta.buffers / time, - delta.bytes / time, - delta.events / time, ((double) delta.bytes / (double) delta.buffers)); -} - -static void -gst_statistics_print (GstStatistics * statistics) -{ - const gchar *name; - double elapsed; - double last_elapsed; - - g_return_if_fail (statistics != NULL); - g_return_if_fail (GST_IS_STATISTICS (statistics)); - - name = gst_object_get_name (GST_OBJECT (statistics)); - if (!name) { - name = ""; - } - - elapsed = g_timer_elapsed (statistics->timer, NULL); - last_elapsed = g_timer_elapsed (statistics->last_timer, NULL); - - print_stats (1, name, "total", &zero_stats, &statistics->stats, elapsed); - print_stats (0, name, "last", &statistics->last_stats, &statistics->stats, - last_elapsed); - statistics->last_stats = statistics->stats; - g_timer_reset (statistics->last_timer); -} - -static void -gst_statistics_chain (GstPad * pad, GstData * _data) -{ - GstBuffer *buf = GST_BUFFER (_data); - GstStatistics *statistics; - gboolean update = FALSE; - - g_return_if_fail (pad != NULL); - g_return_if_fail (GST_IS_PAD (pad)); - g_return_if_fail (buf != NULL); - - statistics = GST_STATISTICS (gst_pad_get_parent (pad)); - - if (GST_IS_EVENT (buf)) { - GstEvent *event = GST_EVENT (buf); - - statistics->stats.events += 1; - if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) { - gst_element_set_eos (GST_ELEMENT (statistics)); - if (statistics->update_on_eos) { - update = TRUE; - } - } - if (statistics->update_freq.events) { - statistics->update_count.events += 1; - if (statistics->update_count.events == statistics->update_freq.events) { - statistics->update_count.events = 0; - update = TRUE; - } - } - } else { - statistics->stats.buffers += 1; - if (statistics->update_freq.buffers) { - statistics->update_count.buffers += 1; - if (statistics->update_count.buffers == statistics->update_freq.buffers) { - statistics->update_count.buffers = 0; - update = TRUE; - } - } - - statistics->stats.bytes += GST_BUFFER_SIZE (buf); - if (statistics->update_freq.bytes) { - statistics->update_count.bytes += GST_BUFFER_SIZE (buf); - if (statistics->update_count.bytes >= statistics->update_freq.bytes) { - statistics->update_count.bytes = 0; - update = TRUE; - } - } - } - - if (update) { - if (statistics->update) { - GST_DEBUG ("[%s]: pre update emit", GST_ELEMENT_NAME (statistics)); - g_signal_emit (G_OBJECT (statistics), - gst_statistics_signals[SIGNAL_UPDATE], 0); - GST_DEBUG ("[%s]: post update emit", GST_ELEMENT_NAME (statistics)); - } - if (!statistics->silent) { - gst_statistics_print (statistics); - } - } - gst_pad_push (statistics->srcpad, GST_DATA (buf)); -} - -static void -gst_statistics_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec) -{ - GstStatistics *statistics; - - /* it's not null if we got it, but it might not be ours */ - g_return_if_fail (GST_IS_STATISTICS (object)); - - statistics = GST_STATISTICS (object); - - switch (prop_id) { - case ARG_BUFFER_UPDATE_FREQ: - statistics->update_freq.buffers = g_value_get_int64 (value); - break; - case ARG_BYTES_UPDATE_FREQ: - statistics->update_freq.bytes = g_value_get_int64 (value); - break; - case ARG_EVENT_UPDATE_FREQ: - statistics->update_freq.events = g_value_get_int64 (value); - break; - case ARG_UPDATE_ON_EOS: - statistics->update_on_eos = g_value_get_boolean (value); - break; - case ARG_UPDATE: - statistics->update = g_value_get_boolean (value); - break; - case ARG_SILENT: - statistics->silent = g_value_get_boolean (value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_statistics_get_property (GObject * object, guint prop_id, GValue * value, - GParamSpec * pspec) -{ - GstStatistics *statistics; - - /* it's not null if we got it, but it might not be ours */ - g_return_if_fail (GST_IS_STATISTICS (object)); - - statistics = GST_STATISTICS (object); - - switch (prop_id) { - case ARG_BUFFERS: - g_value_set_int64 (value, statistics->stats.buffers); - break; - case ARG_BYTES: - g_value_set_int64 (value, statistics->stats.bytes); - break; - case ARG_EVENTS: - g_value_set_int64 (value, statistics->stats.events); - break; - case ARG_BUFFER_UPDATE_FREQ: - g_value_set_int64 (value, statistics->update_freq.buffers); - break; - case ARG_BYTES_UPDATE_FREQ: - g_value_set_int64 (value, statistics->update_freq.bytes); - break; - case ARG_EVENT_UPDATE_FREQ: - g_value_set_int64 (value, statistics->update_freq.events); - break; - case ARG_UPDATE_ON_EOS: - g_value_set_boolean (value, statistics->update_on_eos); - break; - case ARG_UPDATE: - g_value_set_boolean (value, statistics->update); - break; - case ARG_SILENT: - g_value_set_boolean (value, statistics->silent); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} diff --git a/plugins/elements/gststatistics.h b/plugins/elements/gststatistics.h deleted file mode 100644 index 4c1ab57a3e..0000000000 --- a/plugins/elements/gststatistics.h +++ /dev/null @@ -1,84 +0,0 @@ -/* GStreamer - * Copyright (C) 2001 David I. Lehn - * - * gststatistics.h: - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - -#ifndef __GST_STATISTICS_H__ -#define __GST_STATISTICS_H__ - - -#include - -G_BEGIN_DECLS - - -#define GST_TYPE_STATISTICS \ - (gst_statistics_get_type()) -#define GST_STATISTICS(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_STATISTICS,GstStatistics)) -#define GST_STATISTICS_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_STATISTICS,GstStatisticsClass)) -#define GST_IS_STATISTICS(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_STATISTICS)) -#define GST_IS_STATISTICS_CLASS(obj) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_STATISTICS)) - -typedef struct _GstStatistics GstStatistics; -typedef struct _GstStatisticsClass GstStatisticsClass; - -typedef struct _stats stats; - -struct _stats { - gint64 buffers; - gint64 bytes; - gint64 events; -}; - -struct _GstStatistics { - GstElement element; - - GstPad *sinkpad; - GstPad *srcpad; - - GTimer *timer; - GTimer *last_timer; - - stats stats; - stats last_stats; - stats update_count; - stats update_freq; - - gboolean update_on_eos; - gboolean update; - gboolean silent; -}; - -struct _GstStatisticsClass { - GstElementClass parent_class; - - /* signals */ - void (*update) (GstElement *element); -}; - -GType gst_statistics_get_type(void); - -G_END_DECLS - -#endif /* __GST_STATISTICS_H__ */ diff --git a/plugins/elements/gsttee.c b/plugins/elements/gsttee.c deleted file mode 100644 index a046ed3635..0000000000 --- a/plugins/elements/gsttee.c +++ /dev/null @@ -1,362 +0,0 @@ -/* GStreamer - * Copyright (C) 1999,2000 Erik Walthinsen - * 2000 Wim Taymans - * - * gsttee.c: Tee element, one in N out - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include "gsttee.h" - -#include - -static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - -GST_DEBUG_CATEGORY_STATIC (gst_tee_debug); -#define GST_CAT_DEFAULT gst_tee_debug - -GstElementDetails gst_tee_details = GST_ELEMENT_DETAILS ("Tee pipe fitting", - "Generic", - "1-to-N pipe fitting", - "Erik Walthinsen , " - "Wim Taymans "); - -/* Tee signals and args */ -enum -{ - /* FILL ME */ - LAST_SIGNAL -}; - -enum -{ - ARG_0, - ARG_SILENT, - ARG_NUM_PADS, - ARG_LAST_MESSAGE - /* FILL ME */ -}; - -GstStaticPadTemplate tee_src_template = GST_STATIC_PAD_TEMPLATE ("src%d", - GST_PAD_SRC, - GST_PAD_REQUEST, - GST_STATIC_CAPS_ANY); - -#define _do_init(bla) \ - GST_DEBUG_CATEGORY_INIT (gst_tee_debug, "tee", 0, "tee element"); - -GST_BOILERPLATE_FULL (GstTee, gst_tee, GstElement, GST_TYPE_ELEMENT, _do_init); - -static GstPad *gst_tee_request_new_pad (GstElement * element, - GstPadTemplate * temp, const gchar * unused); - -static void gst_tee_finalize (GObject * object); -static void gst_tee_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec); -static void gst_tee_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec); - -static void gst_tee_chain (GstPad * pad, GstData * _data); - - -static void -gst_tee_base_init (gpointer g_class) -{ - GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&sinktemplate)); - gst_element_class_set_details (gstelement_class, &gst_tee_details); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&tee_src_template)); -} - -static void -gst_tee_finalize (GObject * object) -{ - GstTee *tee; - - tee = GST_TEE (object); - - g_free (tee->last_message); - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static void -gst_tee_class_init (GstTeeClass * klass) -{ - GObjectClass *gobject_class; - GstElementClass *gstelement_class; - - gobject_class = (GObjectClass *) klass; - gstelement_class = (GstElementClass *) klass; - - - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_PADS, - g_param_spec_int ("num_pads", "num_pads", "num_pads", - 0, G_MAXINT, 0, G_PARAM_READABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SILENT, - g_param_spec_boolean ("silent", "silent", "silent", - TRUE, G_PARAM_CONSTRUCT | G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LAST_MESSAGE, - g_param_spec_string ("last_message", "last_message", "last_message", - NULL, G_PARAM_READABLE)); - - - gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_tee_finalize); - gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_tee_set_property); - gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_tee_get_property); - - gstelement_class->request_new_pad = - GST_DEBUG_FUNCPTR (gst_tee_request_new_pad); -} - -static void -gst_tee_init (GstTee * tee) -{ - tee->sinkpad = - gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate), - "sink"); - gst_element_add_pad (GST_ELEMENT (tee), tee->sinkpad); - gst_pad_set_chain_function (tee->sinkpad, GST_DEBUG_FUNCPTR (gst_tee_chain)); - gst_pad_set_link_function (tee->sinkpad, - GST_DEBUG_FUNCPTR (gst_pad_proxy_pad_link)); - gst_pad_set_getcaps_function (tee->sinkpad, - GST_DEBUG_FUNCPTR (gst_pad_proxy_getcaps)); - - tee->last_message = NULL; -} - -/* helper compare function */ -gint -name_pad_compare (gconstpointer a, gconstpointer b) -{ - GstPad *pad = (GstPad *) a; - gchar *name = (gchar *) b; - - g_assert (GST_IS_PAD (pad)); - - return strcmp (name, gst_pad_get_name (pad)); /* returns 0 if match */ -} - -static GstCaps * -gst_tee_getcaps (GstPad * _pad) -{ - GstTee *tee = GST_TEE (gst_pad_get_parent (_pad)); - GstCaps *caps = gst_caps_new_any (), *tmp, *res; - GstPad *pad; - const GList *pads; - - for (pads = gst_element_get_pad_list (GST_ELEMENT (tee)); - pads != NULL; pads = pads->next) { - pad = GST_PAD (pads->data); - if (pad == _pad) - continue; - - tmp = gst_pad_get_allowed_caps (pad); - res = gst_caps_intersect (caps, tmp); - gst_caps_free (tmp); - gst_caps_free (caps); - caps = res; - } - - return caps; -} - -static GstPadLinkReturn -gst_tee_link (GstPad * _pad, const GstCaps * caps) -{ - GstTee *tee = GST_TEE (gst_pad_get_parent (_pad)); - GstPadLinkReturn res; - GstPad *pad; - const GList *pads; - - GST_DEBUG_OBJECT (tee, "Forwarding link to all other pads"); - - for (pads = gst_element_get_pad_list (GST_ELEMENT (tee)); - pads != NULL; pads = pads->next) { - pad = GST_PAD (pads->data); - if (pad == _pad) - continue; - - res = gst_pad_try_set_caps (pad, caps); - GST_DEBUG_OBJECT (tee, "Pad %s:%s gave response %d", - GST_DEBUG_PAD_NAME (pad), res); - if (GST_PAD_LINK_FAILED (res)) - return res; - } - - return GST_PAD_LINK_OK; -} - -static GstPad * -gst_tee_request_new_pad (GstElement * element, GstPadTemplate * templ, - const gchar * unused) -{ - gchar *name; - GstPad *srcpad; - GstTee *tee; - gint i = 0; - const GList *pads; - - g_return_val_if_fail (GST_IS_TEE (element), NULL); - - if (templ->direction != GST_PAD_SRC) { - g_warning ("gsttee: request new pad that is not a SRC pad\n"); - return NULL; - } - - tee = GST_TEE (element); - - /* try names in order and find one that's not in use atm */ - pads = gst_element_get_pad_list (element); - - name = NULL; - while (!name) { - name = g_strdup_printf ("src%d", i); - if (g_list_find_custom ((GList *) pads, (gconstpointer) name, - name_pad_compare) != NULL) { - /* this name is taken, use the next one */ - ++i; - g_free (name); - name = NULL; - } - } - if (!tee->silent) { - g_free (tee->last_message); - tee->last_message = g_strdup_printf ("new pad %s", name); - g_object_notify (G_OBJECT (tee), "last_message"); - } - - srcpad = gst_pad_new_from_template (templ, name); - g_free (name); - gst_pad_set_link_function (srcpad, GST_DEBUG_FUNCPTR (gst_tee_link)); - gst_pad_set_getcaps_function (srcpad, GST_DEBUG_FUNCPTR (gst_tee_getcaps)); - gst_element_add_pad (GST_ELEMENT (tee), srcpad); - GST_PAD_ELEMENT_PRIVATE (srcpad) = NULL; - - if (GST_PAD_CAPS (tee->sinkpad)) { - gst_pad_try_set_caps (srcpad, GST_PAD_CAPS (tee->sinkpad)); - } - - return srcpad; -} - -static void -gst_tee_set_property (GObject * object, guint prop_id, const GValue * value, - GParamSpec * pspec) -{ - GstTee *tee; - - /* it's not null if we got it, but it might not be ours */ - g_return_if_fail (GST_IS_TEE (object)); - - tee = GST_TEE (object); - - switch (prop_id) { - case ARG_SILENT: - tee->silent = g_value_get_boolean (value); - g_object_notify (G_OBJECT (tee), "silent"); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_tee_get_property (GObject * object, guint prop_id, GValue * value, - GParamSpec * pspec) -{ - GstTee *tee; - - /* it's not null if we got it, but it might not be ours */ - g_return_if_fail (GST_IS_TEE (object)); - - tee = GST_TEE (object); - - switch (prop_id) { - case ARG_NUM_PADS: - g_value_set_int (value, GST_ELEMENT (tee)->numsrcpads); - break; - case ARG_SILENT: - g_value_set_boolean (value, tee->silent); - break; - case ARG_LAST_MESSAGE: - g_value_set_string (value, tee->last_message); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -/** - * gst_tee_chain: - * @pad: the pad to follow - * @buf: the buffer to pass - * - * Chain a buffer on a pad. - */ -static void -gst_tee_chain (GstPad * pad, GstData * _data) -{ - GstBuffer *buf = GST_BUFFER (_data); - GstTee *tee; - const GList *pads; - - g_return_if_fail (pad != NULL); - g_return_if_fail (GST_IS_PAD (pad)); - g_return_if_fail (buf != NULL); - - tee = GST_TEE (gst_pad_get_parent (pad)); - - gst_buffer_ref_by_count (buf, GST_ELEMENT (tee)->numsrcpads - 1); - - pads = gst_element_get_pad_list (GST_ELEMENT (tee)); - - while (pads) { - GstPad *outpad = GST_PAD (pads->data); - - pads = g_list_next (pads); - - if (GST_PAD_DIRECTION (outpad) != GST_PAD_SRC) - continue; - - if (!tee->silent) { - g_free (tee->last_message); - tee->last_message = - g_strdup_printf ("chain ******* (%s:%s)t (%d bytes, %" - G_GUINT64_FORMAT ") %p", GST_DEBUG_PAD_NAME (outpad), - GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf), buf); - g_object_notify (G_OBJECT (tee), "last_message"); - } - - if (GST_PAD_IS_USABLE (outpad)) - gst_pad_push (outpad, GST_DATA (buf)); - else - gst_buffer_unref (buf); - } -} diff --git a/plugins/elements/gsttee.h b/plugins/elements/gsttee.h deleted file mode 100644 index f28b09d9d5..0000000000 --- a/plugins/elements/gsttee.h +++ /dev/null @@ -1,63 +0,0 @@ -/* GStreamer - * Copyright (C) 1999,2000 Erik Walthinsen - * 2000 Wim Taymans - * - * gsttee.h: Header for GstTee element - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - -#ifndef __GST_TEE_H__ -#define __GST_TEE_H__ - -#include - -G_BEGIN_DECLS - - -#define GST_TYPE_TEE \ - (gst_tee_get_type()) -#define GST_TEE(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TEE,GstTee)) -#define GST_TEE_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TEE,GstTeeClass)) -#define GST_IS_TEE(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TEE)) -#define GST_IS_TEE_CLASS(obj) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TEE)) - -typedef struct _GstTee GstTee; -typedef struct _GstTeeClass GstTeeClass; - -struct _GstTee { - GstElement element; - - GstPad *sinkpad; - - gboolean silent; - gchar *last_message; -}; - -struct _GstTeeClass { - GstElementClass parent_class; -}; - -GType gst_tee_get_type (void); - -G_END_DECLS - -#endif /* __GST_TEE_H__ */ diff --git a/plugins/elements/gsttypefindelement.c b/plugins/elements/gsttypefindelement.c deleted file mode 100644 index 8c0c001c6f..0000000000 --- a/plugins/elements/gsttypefindelement.c +++ /dev/null @@ -1,845 +0,0 @@ -/* GStreamer - * Copyright (C) 2003 Benjamin Otte - * - * gsttypefind.c: element that detects type of stream - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* FIXME: need a better solution for non-seekable streams */ - -/* way of operation: - * 1) get a list of all typefind functions sorted best to worst - * 2) if all elements have been called with all requested data goto 8 - * 3) call all functions once with all available data - * 4) if a function returns a value >= ARG_MAXIMUM goto 8 - * 5) all functions with a result > ARG_MINIMUM or functions that did not get - * all requested data (where peek returned NULL) stay in list - * 6) seek to requested offset of best function that still has open data - * requests - * 7) goto 2 - * 8) take best available result and use its caps - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include "gsttypefindelement.h" -#include "gst/gst_private.h" -#include "gst/gst-i18n-lib.h" - -#include -#include -#include - -GST_DEBUG_CATEGORY_STATIC (gst_type_find_element_debug); -#define GST_CAT_DEFAULT gst_type_find_element_debug - -GstElementDetails gst_type_find_element_details = -GST_ELEMENT_DETAILS ("TypeFind", - "Generic", - "Finds the media type of a stream", - "Benjamin Otte "); - -/* generic templates */ -GstStaticPadTemplate type_find_element_sink_template = -GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - -GstStaticPadTemplate type_find_element_src_template = -GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - -/* TypeFind signals and args */ -enum -{ - HAVE_TYPE, - LAST_SIGNAL -}; -enum -{ - ARG_0, - ARG_CAPS, - ARG_MINIMUM, - ARG_MAXIMUM -}; -enum -{ - MODE_NORMAL, /* act as identity */ - MODE_TRANSITION, /* wait for the discont between the two - * other modes */ - MODE_TYPEFIND /* do typefinding */ -}; - - -#define _do_init(bla) \ - GST_DEBUG_CATEGORY_INIT (gst_type_find_element_debug, "typefind", \ - GST_DEBUG_BG_YELLOW | GST_DEBUG_FG_GREEN, "type finding element"); - -GST_BOILERPLATE_FULL (GstTypeFindElement, gst_type_find_element, GstElement, - GST_TYPE_ELEMENT, _do_init); - -static void gst_type_find_element_dispose (GObject * object); -static void gst_type_find_element_set_property (GObject * object, - guint prop_id, const GValue * value, GParamSpec * pspec); -static void gst_type_find_element_get_property (GObject * object, - guint prop_id, GValue * value, GParamSpec * pspec); - -static const GstEventMask *gst_type_find_element_src_event_mask (GstPad * pad); -static gboolean gst_type_find_element_src_event (GstPad * pad, - GstEvent * event); -static gboolean gst_type_find_handle_src_query (GstPad * pad, - GstQueryType type, GstFormat * fmt, gint64 * value); -static void push_buffer_store (GstTypeFindElement * typefind); - -static void gst_type_find_element_chain (GstPad * sinkpad, GstData * data); -static GstElementStateReturn -gst_type_find_element_change_state (GstElement * element); - -static guint gst_type_find_element_signals[LAST_SIGNAL] = { 0 }; - -static void -gst_type_find_element_have_type (GstTypeFindElement * typefind, - guint probability, const GstCaps * caps) -{ - g_assert (typefind->caps == NULL); - g_assert (caps != NULL); - - GST_INFO_OBJECT (typefind, "found caps %" GST_PTR_FORMAT, caps); - typefind->caps = gst_caps_copy (caps); - gst_pad_set_explicit_caps (typefind->src, caps); -} -static void -gst_type_find_element_base_init (gpointer g_class) -{ - GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&type_find_element_src_template)); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&type_find_element_sink_template)); - gst_element_class_set_details (gstelement_class, - &gst_type_find_element_details); -} -static void -gst_type_find_element_class_init (GstTypeFindElementClass * typefind_class) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (typefind_class); - GstElementClass *gstelement_class = GST_ELEMENT_CLASS (typefind_class); - - gobject_class->set_property = - GST_DEBUG_FUNCPTR (gst_type_find_element_set_property); - gobject_class->get_property = - GST_DEBUG_FUNCPTR (gst_type_find_element_get_property); - gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_type_find_element_dispose); - - typefind_class->have_type = gst_type_find_element_have_type; - - g_object_class_install_property (gobject_class, ARG_CAPS, - g_param_spec_boxed ("caps", _("stream type"), - _("detected type of stream"), gst_caps_get_type (), - G_PARAM_READABLE)); - g_object_class_install_property (gobject_class, ARG_MINIMUM, - g_param_spec_uint ("minimum", _("minimum"), - "minimum probability required to accept caps", GST_TYPE_FIND_MINIMUM, - GST_TYPE_FIND_MAXIMUM, GST_TYPE_FIND_MINIMUM, G_PARAM_READWRITE)); - g_object_class_install_property (gobject_class, ARG_MINIMUM, - g_param_spec_uint ("maximum", _("maximum"), - "probability to stop typefinding", GST_TYPE_FIND_MINIMUM, - GST_TYPE_FIND_MAXIMUM, GST_TYPE_FIND_MAXIMUM, G_PARAM_READWRITE)); - - gst_type_find_element_signals[HAVE_TYPE] = g_signal_new ("have_type", - G_TYPE_FROM_CLASS (typefind_class), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GstTypeFindElementClass, have_type), NULL, NULL, - gst_marshal_VOID__UINT_BOXED, G_TYPE_NONE, 2, - G_TYPE_UINT, GST_TYPE_CAPS | G_SIGNAL_TYPE_STATIC_SCOPE); - - gstelement_class->change_state = - GST_DEBUG_FUNCPTR (gst_type_find_element_change_state); -} -static void -gst_type_find_element_init (GstTypeFindElement * typefind) -{ - /* sinkpad */ - typefind->sink = - gst_pad_new_from_template (gst_static_pad_template_get - (&type_find_element_sink_template), "sink"); - gst_pad_set_chain_function (typefind->sink, gst_type_find_element_chain); - gst_element_add_pad (GST_ELEMENT (typefind), typefind->sink); - /* srcpad */ - typefind->src = - gst_pad_new_from_template (gst_static_pad_template_get - (&type_find_element_src_template), "src"); - gst_pad_set_event_function (typefind->src, gst_type_find_element_src_event); - gst_pad_set_event_mask_function (typefind->src, - gst_type_find_element_src_event_mask); - gst_pad_set_query_function (typefind->src, - GST_DEBUG_FUNCPTR (gst_type_find_handle_src_query)); - gst_pad_use_explicit_caps (typefind->src); - gst_element_add_pad (GST_ELEMENT (typefind), typefind->src); - - typefind->caps = NULL; - typefind->pending_events = NULL; - typefind->min_probability = 1; - typefind->max_probability = GST_TYPE_FIND_MAXIMUM; - - typefind->store = gst_buffer_store_new (); - - GST_FLAG_SET (typefind, GST_ELEMENT_EVENT_AWARE); -} -static void -gst_type_find_element_dispose (GObject * object) -{ - GstTypeFindElement *typefind = GST_TYPE_FIND_ELEMENT (object); - - G_OBJECT_CLASS (parent_class)->dispose (object); - - if (typefind->store) { - g_object_unref (typefind->store); - typefind->store = NULL; - } -} -static void -gst_type_find_element_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec) -{ - GstTypeFindElement *typefind; - - g_return_if_fail (GST_IS_TYPE_FIND_ELEMENT (object)); - - typefind = GST_TYPE_FIND_ELEMENT (object); - - switch (prop_id) { - case ARG_MINIMUM: - typefind->min_probability = g_value_get_uint (value); - g_object_notify (object, "minimum"); - break; - case ARG_MAXIMUM: - typefind->max_probability = g_value_get_uint (value); - g_object_notify (object, "maximum"); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} -static void -gst_type_find_element_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec) -{ - GstTypeFindElement *typefind; - - g_return_if_fail (GST_IS_TYPE_FIND_ELEMENT (object)); - - typefind = GST_TYPE_FIND_ELEMENT (object); - - switch (prop_id) { - case ARG_CAPS: - g_value_set_boxed (value, typefind->caps); - break; - case ARG_MINIMUM: - g_value_set_uint (value, typefind->min_probability); - break; - case ARG_MAXIMUM: - g_value_set_uint (value, typefind->max_probability); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static gboolean -gst_type_find_handle_src_query (GstPad * pad, - GstQueryType type, GstFormat * fmt, gint64 * value) -{ - GstTypeFindElement *typefind = - GST_TYPE_FIND_ELEMENT (gst_pad_get_parent (pad)); - gboolean res; - - res = gst_pad_query (GST_PAD_PEER (typefind->sink), type, fmt, value); - if (!res) - return FALSE; - - if (type == GST_QUERY_POSITION && typefind->store != NULL) { - /* FIXME: this code assumes that there's no discont in the queue */ - switch (*fmt) { - case GST_FORMAT_BYTES: - *value -= gst_buffer_store_get_size (typefind->store, 0); - break; - default: - /* FIXME */ - break; - } - } - - return TRUE; -} - -static const GstEventMask * -gst_type_find_element_src_event_mask (GstPad * pad) -{ - static const GstEventMask mask[] = { - {GST_EVENT_SEEK, - GST_SEEK_METHOD_SET | GST_SEEK_METHOD_CUR | GST_SEEK_METHOD_END | - GST_SEEK_FLAG_FLUSH}, - /* add more if you want, event masks suck and need to die anyway */ - {0,} - }; - - return mask; -} - -static gboolean -gst_type_find_element_src_event (GstPad * pad, GstEvent * event) -{ - GstTypeFindElement *typefind = GST_TYPE_FIND_ELEMENT (GST_PAD_PARENT (pad)); - - if (typefind->mode != MODE_NORMAL) { - /* need to do more? */ - gst_data_unref (GST_DATA (event)); - return FALSE; - } - return gst_pad_event_default (pad, event); -} -typedef struct -{ - GstTypeFindFactory *factory; - gint probability; - GstCaps *caps; - gint64 requested_offset; - guint requested_size; - - GList *buffers; - GstTypeFindElement *self; -} -TypeFindEntry; - -static inline TypeFindEntry * -new_entry (void) -{ - return g_new0 (TypeFindEntry, 1); -} -static void -free_entry_buffers (TypeFindEntry * entry) -{ - g_list_foreach (entry->buffers, (GFunc) gst_data_unref, NULL); - g_list_free (entry->buffers); - entry->buffers = NULL; -} -static void -free_entry (TypeFindEntry * entry) -{ - free_entry_buffers (entry); - - if (entry->caps) - gst_caps_free (entry->caps); - g_free (entry); -} -static void -start_typefinding (GstTypeFindElement * typefind) -{ - g_assert (typefind->possibilities == NULL); - - GST_DEBUG_OBJECT (typefind, "starting typefinding"); - gst_pad_unnegotiate (typefind->src); - if (typefind->caps) { - gst_caps_replace (&typefind->caps, NULL); - } - typefind->mode = MODE_TYPEFIND; - typefind->stream_length_available = TRUE; - typefind->stream_length = 0; -} -static void -stop_typefinding (GstTypeFindElement * typefind) -{ - /* stop all typefinding and set mode back to normal */ - gboolean push_cached_buffers = - gst_element_get_state (GST_ELEMENT (typefind)) == GST_STATE_PLAYING; - - GST_DEBUG_OBJECT (typefind, "stopping typefinding%s", - push_cached_buffers ? " and pushing cached buffers" : ""); - if (typefind->possibilities != NULL) { - /* this should only happen on PAUSED => READY or EOS */ - GST_LOG_OBJECT (typefind, "freeing remaining %u typefind functions", - g_list_length (typefind->possibilities)); - g_list_foreach (typefind->possibilities, (GFunc) free_entry, NULL); - g_list_free (typefind->possibilities); - typefind->possibilities = NULL; - } - - typefind->mode = MODE_TRANSITION; - - if (!push_cached_buffers) { - gst_buffer_store_clear (typefind->store); - } else { - guint size = gst_buffer_store_get_size (typefind->store, 0); - - GST_DEBUG_OBJECT (typefind, "seeking back to current position %u", size); - if (!gst_pad_send_event (GST_PAD_PEER (typefind->sink), - gst_event_new_seek (GST_SEEK_METHOD_SET | GST_FORMAT_BYTES, - size))) { - GST_WARNING_OBJECT (typefind, - "could not seek to required position %u, hope for the best", size); - typefind->mode = MODE_NORMAL; - /* push out our queued buffers here */ - push_buffer_store (typefind); - } else { - typefind->waiting_for_discont_offset = size; - } - } -} - -static void -push_buffer_store (GstTypeFindElement * typefind) -{ - guint size = gst_buffer_store_get_size (typefind->store, 0); - GstBuffer *buffer; - const GList *item; - - /* handle pending events */ - for (item = typefind->pending_events; item; item = item->next) { - GstEvent *e = item->data; - - gst_pad_push (typefind->src, GST_DATA (e)); - } - g_list_free (typefind->pending_events); - typefind->pending_events = NULL; - - /* data */ - gst_pad_push (typefind->src, GST_DATA (gst_event_new_discontinuous (TRUE, - GST_FORMAT_DEFAULT, (guint64) 0, GST_FORMAT_BYTES, (guint64) 0, - GST_FORMAT_UNDEFINED))); - if (size && (buffer = gst_buffer_store_get_buffer (typefind->store, 0, size))) { - GST_DEBUG_OBJECT (typefind, "pushing cached data (%u bytes)", size); - gst_pad_push (typefind->src, GST_DATA (buffer)); - } else { - /* FIXME: shouldn't we throw an error here? */ - size = 0; - } - - gst_buffer_store_clear (typefind->store); -} - -static guint64 -find_element_get_length (gpointer data) -{ - TypeFindEntry *entry = (TypeFindEntry *) data; - GstTypeFindElement *typefind = entry->self; - GstFormat format = GST_FORMAT_BYTES; - - if (!typefind->stream_length_available) { - GST_LOG_OBJECT (entry->self, - "'%s' called get_length () but we know it's not available", - GST_PLUGIN_FEATURE_NAME (entry->factory)); - return 0; - } - if (entry->self->stream_length == 0) { - typefind->stream_length_available = - gst_pad_query (GST_PAD_PEER (entry->self->sink), GST_QUERY_TOTAL, - &format, (gint64 *) & entry->self->stream_length); - if (format != GST_FORMAT_BYTES) - typefind->stream_length_available = FALSE; - if (!typefind->stream_length_available) { - GST_DEBUG_OBJECT (entry->self, - "'%s' called get_length () but it's not available", - GST_PLUGIN_FEATURE_NAME (entry->factory)); - return 0; - } else { - GST_DEBUG_OBJECT (entry->self, - "'%s' called get_length () and it's %" G_GUINT64_FORMAT " bytes", - GST_PLUGIN_FEATURE_NAME (entry->factory), entry->self->stream_length); - } - } - - return entry->self->stream_length; -} -static void -gst_type_find_element_handle_event (GstPad * pad, GstEvent * event) -{ - TypeFindEntry *entry; - GstTypeFindElement *typefind = GST_TYPE_FIND_ELEMENT (GST_PAD_PARENT (pad)); - - GST_DEBUG_OBJECT (typefind, "got event %d in mode %d", GST_EVENT_TYPE (event), - typefind->mode); - - switch (typefind->mode) { - case MODE_TYPEFIND: - switch (GST_EVENT_TYPE (event)) { - case GST_EVENT_EOS: - /* this should only happen when we got all available data */ - entry = - (TypeFindEntry *) typefind->possibilities ? typefind-> - possibilities->data : NULL; - if (entry && entry->probability >= typefind->min_probability) { - GST_INFO_OBJECT (typefind, - "'%s' is the best typefind left after we got all data, using it now (probability %u)", - GST_PLUGIN_FEATURE_NAME (entry->factory), entry->probability); - g_signal_emit (typefind, gst_type_find_element_signals[HAVE_TYPE], - 0, entry->probability, entry->caps); - stop_typefinding (typefind); - push_buffer_store (typefind); - gst_pad_event_default (pad, event); - } else { - gst_pad_event_default (pad, event); - GST_ELEMENT_ERROR (typefind, STREAM, TYPE_NOT_FOUND, (NULL), - (NULL)); - stop_typefinding (typefind); - } - break; - case GST_EVENT_DISCONTINUOUS: - case GST_EVENT_FLUSH: - gst_event_unref (event); - break; - default: - typefind->pending_events = g_list_append (typefind->pending_events, - event); - break; - } - break; - case MODE_TRANSITION: - if (GST_EVENT_TYPE (event) == GST_EVENT_DISCONTINUOUS) { - if (GST_EVENT_DISCONT_NEW_MEDIA (event)) { - start_typefinding (typefind); - gst_event_unref (event); - } else { - gint64 off; - - if (gst_event_discont_get_value (event, GST_FORMAT_BYTES, &off) && - off == typefind->waiting_for_discont_offset) { - typefind->mode = MODE_NORMAL; - push_buffer_store (typefind); - } - gst_event_unref (event); - } - } else if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) { - push_buffer_store (typefind); - gst_pad_event_default (pad, event); - } else { - gst_event_unref (event); - } - break; - case MODE_NORMAL: - if (GST_EVENT_TYPE (event) == GST_EVENT_DISCONTINUOUS && - GST_EVENT_DISCONT_NEW_MEDIA (event)) { - start_typefinding (typefind); - gst_event_unref (event); - } else { - gst_pad_event_default (pad, event); - } - break; - default: - g_assert_not_reached (); - } -} -static guint8 * -find_peek (gpointer data, gint64 offset, guint size) -{ - GstBuffer *buf; - TypeFindEntry *entry = (TypeFindEntry *) data; - - GST_LOG_OBJECT (entry->self, "'%s' called peek (%" G_GINT64_FORMAT ", %u)", - GST_PLUGIN_FEATURE_NAME (entry->factory), offset, size); - if (offset >= 0) { - buf = gst_buffer_store_get_buffer (entry->self->store, offset, size); - } else { - /* FIXME: can we do this easily without querying length? */ - guint64 length = find_element_get_length (data); - - if (length == 0) { - buf = NULL; - } else { - buf = - gst_buffer_store_get_buffer (entry->self->store, length + offset, - size); - } - } - - if (buf) { - entry->buffers = g_list_prepend (entry->buffers, buf); - return GST_BUFFER_DATA (buf); - } else { - if (entry->requested_size == 0) { - GST_LOG_OBJECT (entry->self, - "setting requested peek (%" G_GINT64_FORMAT ", %u) on '%s'", offset, - size, GST_PLUGIN_FEATURE_NAME (entry->factory)); - entry->requested_offset = offset; - entry->requested_size = size; - } - return NULL; - } -} -static void -find_suggest (gpointer data, guint probability, const GstCaps * caps) -{ - TypeFindEntry *entry = (TypeFindEntry *) data; - - GST_LOG_OBJECT (entry->self, "'%s' called suggest (%u, %" GST_PTR_FORMAT ")", - GST_PLUGIN_FEATURE_NAME (entry->factory), probability, caps); - if (((gint) probability) > entry->probability) { - entry->probability = probability; - gst_caps_replace (&entry->caps, gst_caps_copy (caps)); - } -} -static gint -compare_type_find_entry (gconstpointer a, gconstpointer b) -{ - TypeFindEntry *one = (TypeFindEntry *) a; - TypeFindEntry *two = (TypeFindEntry *) b; - - if (one->probability == two->probability) { - /* FIXME: can be improved by analyzing requests */ - return 0; - } else { - return two->probability - one->probability; - } -} -static gint -compare_type_find_factory (gconstpointer fac1, gconstpointer fac2) -{ - return GST_PLUGIN_FEATURE (fac1)->rank - GST_PLUGIN_FEATURE (fac2)->rank; -} -static void -gst_type_find_element_chain (GstPad * pad, GstData * data) -{ - GstTypeFindElement *typefind; - GList *entries; - TypeFindEntry *entry; - GList *walk; - GstTypeFind find = { find_peek, find_suggest, NULL, find_element_get_length }; - - typefind = GST_TYPE_FIND_ELEMENT (GST_PAD_PARENT (pad)); - if (GST_IS_EVENT (data)) { - gst_type_find_element_handle_event (pad, GST_EVENT (data)); - return; - } - switch (typefind->mode) { - case MODE_NORMAL: - gst_pad_push (typefind->src, data); - return; - case MODE_TRANSITION: - gst_data_unref (data); - return; - case MODE_TYPEFIND:{ - guint64 current_offset; - - gst_buffer_store_add_buffer (typefind->store, GST_BUFFER (data)); - current_offset = GST_BUFFER_OFFSET_IS_VALID (data) ? - GST_BUFFER_OFFSET (data) + GST_BUFFER_SIZE (data) : - gst_buffer_store_get_size (typefind->store, 0); - gst_data_unref (data); - if (typefind->possibilities == NULL) { - /* not yet started, get all typefinding functions into our "queue" */ - GList *all_factories = gst_type_find_factory_get_list (); - - GST_INFO_OBJECT (typefind, "starting with %u typefinding functions", - g_list_length ((GList *) all_factories)); - - all_factories = g_list_sort (all_factories, compare_type_find_factory); - walk = all_factories; - while (all_factories) { - entry = new_entry (); - - entry->factory = GST_TYPE_FIND_FACTORY (all_factories->data); - entry->self = typefind; - entry->probability = 0; - typefind->possibilities = - g_list_prepend (typefind->possibilities, entry); - all_factories = g_list_next (all_factories); - } - g_list_free (all_factories); - } - /* call every typefind function once */ - walk = entries = typefind->possibilities; - GST_INFO_OBJECT (typefind, "iterating %u typefinding functions", - g_list_length (entries)); - typefind->possibilities = NULL; - while (walk) { - find.data = entry = (TypeFindEntry *) walk->data; - walk = g_list_next (walk); - entry->probability = 0; - entry->requested_offset = 0; - entry->requested_size = 0; - gst_type_find_factory_call_function (entry->factory, &find); - free_entry_buffers (entry); - if (entry->probability == 0 && entry->requested_size == 0) { - GST_DEBUG_OBJECT (typefind, - "'%s' was removed - no chance of being the right plugin", - GST_PLUGIN_FEATURE_NAME (entry->factory)); - free_entry (entry); - } else if (entry->probability >= typefind->max_probability) { - /* wooha, got caps */ - GstCaps *found_caps = entry->caps; - guint probability = entry->probability; - - GST_INFO_OBJECT (typefind, - "'%s' returned %u/%u probability, using it NOW", - GST_PLUGIN_FEATURE_NAME (entry->factory), probability, - typefind->max_probability); - while (walk) { - free_entry ((TypeFindEntry *) walk->data); - walk = g_list_next (walk); - } - walk = typefind->possibilities; - while (walk) { - free_entry (walk->data); - walk = g_list_next (walk); - } - typefind->possibilities = NULL; - g_list_free (typefind->possibilities); - g_signal_emit (typefind, gst_type_find_element_signals[HAVE_TYPE], 0, - probability, found_caps); - free_entry (entry); - } else { - typefind->possibilities = - g_list_prepend (typefind->possibilities, entry); - } - } - g_list_free (entries); - /* we may now already have caps or we might be left without functions to try */ - if (typefind->caps) { - stop_typefinding (typefind); - } else if (typefind->possibilities == NULL) { - error: - GST_ELEMENT_ERROR (typefind, STREAM, TYPE_NOT_FOUND, (NULL), (NULL)); - stop_typefinding (typefind); - } else { - /* set up typefind element for next iteration */ - typefind->possibilities = - g_list_sort (typefind->possibilities, compare_type_find_entry); - - /* look for typefind functions that require data without seeking */ - for (walk = typefind->possibilities; walk; walk = g_list_next (walk)) { - entry = (TypeFindEntry *) walk->data; - if (entry->requested_offset <= current_offset && - entry->requested_offset + entry->requested_size > current_offset) - break; - } - if (!walk) { - /* find out if we should seek */ - restart: - for (walk = typefind->possibilities; walk; walk = g_list_next (walk)) { - entry = (TypeFindEntry *) walk->data; - if (entry->requested_size > 0) { - /* FIXME: need heuristic to find out if we should seek */ - gint64 seek_offset; - GstEvent *event; - - seek_offset = - entry->requested_offset > - 0 ? entry-> - requested_offset : find_element_get_length (entry) + - entry->requested_offset; - seek_offset += - gst_buffer_store_get_size (typefind->store, seek_offset); - event = - gst_event_new_seek (GST_FORMAT_BYTES | GST_SEEK_METHOD_SET, - seek_offset); - if (gst_pad_send_event (GST_PAD_PEER (typefind->sink), event)) { - /* done seeking */ - GST_DEBUG_OBJECT (typefind, - "'%s' was reset - seeked to %" G_GINT64_FORMAT, - GST_PLUGIN_FEATURE_NAME (entry->factory), seek_offset); - break; - } else if (entry->requested_offset < 0) { - /* impossible to seek */ - GST_DEBUG_OBJECT (typefind, - "'%s' was reset - couldn't seek to %" G_GINT64_FORMAT, - GST_PLUGIN_FEATURE_NAME (entry->factory), seek_offset); - if (entry->probability == 0) { - free_entry (entry); - typefind->possibilities = - g_list_delete_link (typefind->possibilities, walk); - /* FIXME: too many gotos */ - if (!typefind->possibilities) - goto error; - /* we modified the list, let's restart */ - goto restart; - } else { - entry->requested_size = 0; - entry->requested_offset = 0; - } - } - } - } - } - /* throw out all entries that can't get more data */ - walk = g_list_next (typefind->possibilities); - while (walk) { - GList *cur = walk; - - entry = (TypeFindEntry *) walk->data; - walk = g_list_next (walk); - if (entry->requested_size == 0) { - GST_DEBUG_OBJECT (typefind, - "'%s' was removed - higher possibilities available", - GST_PLUGIN_FEATURE_NAME (entry->factory)); - free_entry (entry); - typefind->possibilities = - g_list_delete_link (typefind->possibilities, cur); - } - } - if (g_list_next (typefind->possibilities) == NULL) { - entry = (TypeFindEntry *) typefind->possibilities->data; - if (entry->probability > typefind->min_probability) { - GST_INFO_OBJECT (typefind, - "'%s' is the only typefind left, using it now (probability %u)", - GST_PLUGIN_FEATURE_NAME (entry->factory), entry->probability); - g_signal_emit (typefind, gst_type_find_element_signals[HAVE_TYPE], - 0, entry->probability, entry->caps); - free_entry (entry); - g_list_free (typefind->possibilities); - typefind->possibilities = NULL; - stop_typefinding (typefind); - } - } - } - break; - } - default: - g_assert_not_reached (); - return; - } -} -static GstElementStateReturn -gst_type_find_element_change_state (GstElement * element) -{ - GstTypeFindElement *typefind; - - typefind = GST_TYPE_FIND_ELEMENT (element); - - switch (GST_STATE_TRANSITION (element)) { - case GST_STATE_READY_TO_PAUSED: - start_typefinding (typefind); - break; - case GST_STATE_PAUSED_TO_READY: - stop_typefinding (typefind); - gst_caps_replace (&typefind->caps, NULL); - g_list_foreach (typefind->pending_events, (GFunc) gst_data_unref, NULL); - g_list_free (typefind->pending_events); - typefind->pending_events = NULL; - break; - default: - break; - } - - return GST_ELEMENT_CLASS (parent_class)->change_state (element); -} diff --git a/plugins/elements/gsttypefindelement.h b/plugins/elements/gsttypefindelement.h deleted file mode 100644 index 0b243dbd94..0000000000 --- a/plugins/elements/gsttypefindelement.h +++ /dev/null @@ -1,78 +0,0 @@ -/* GStreamer - * Copyright (C) 2003 Benjamin Otte - * - * gsttypefind.h: element that detects type of stream - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - -#ifndef __GST_TYPE_FIND_ELEMENT_H__ -#define __GST_TYPE_FIND_ELEMENT_H__ - -#include -#include -/* #include */ -#include "gstbufferstore.h" - -G_BEGIN_DECLS - - - -#define GST_TYPE_TYPE_FIND_ELEMENT (gst_type_find_element_get_type ()) -#define GST_TYPE_FIND_ELEMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TYPE_FIND_ELEMENT, GstTypeFindElement)) -#define GST_IS_TYPE_FIND_ELEMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TYPE_FIND_ELEMENT)) -#define GST_TYPE_FIND_ELEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_TYPE_FIND_ELEMENT, GstTypeFindElementClass)) -#define GST_IS_TYPE_FIND_ELEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_TYPE_FIND_ELEMENT)) -#define GST_TYPE_FIND_ELEMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_TYPE_FIND_ELEMENT, GstTypeFindElementClass)) - -typedef struct _GstTypeFindElement GstTypeFindElement; -typedef struct _GstTypeFindElementClass GstTypeFindElementClass; - -struct _GstTypeFindElement { - GstElement element; - - GstPad * sink; - GstPad * src; - - guint min_probability; - guint max_probability; - GstCaps * caps; - GList * pending_events; - - guint mode; - guint64 waiting_for_discont_offset; - GstBufferStore * store; - guint64 stream_length; - gboolean stream_length_available; - - GList * possibilities; -}; - -struct _GstTypeFindElementClass { - GstElementClass parent_class; - - /* signals */ - void (*have_type) (GstTypeFindElement *element, - guint probability, - const GstCaps * caps); -}; - -GType gst_type_find_element_get_type (void); - -G_END_DECLS - -#endif /* __GST_TYPE_FIND_ELEMENT_H__ */ diff --git a/plugins/indexers/.gitignore b/plugins/indexers/.gitignore deleted file mode 100644 index e202f03864..0000000000 --- a/plugins/indexers/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -*.bb -*.bbg -*.da -*.def diff --git a/plugins/indexers/Makefile.am b/plugins/indexers/Makefile.am deleted file mode 100644 index 1e5a677334..0000000000 --- a/plugins/indexers/Makefile.am +++ /dev/null @@ -1,25 +0,0 @@ - -plugin_LTLIBRARIES = libgstindexers.la -AS_LIBTOOL_LIB = libgstindexers - -EXTRA_DIST = $(as_libtool_EXTRA_DIST) -noinst_DATA = $(as_libtool_noinst_DATA_files) - -# file index uses xml -if GST_DISABLE_LOADSAVE -GST_LOADSAVE_SRC = -else -GST_LOADSAVE_SRC = gstfileindex.c -endif - -libgstindexers_la_SOURCES = gstindexers.c gstmemindex.c $(GST_LOADSAVE_SRC) -libgstindexers_la_CFLAGS = $(GST_OBJ_CFLAGS) -libgstindexers_la_LIBADD = $(GST_OBJ_LIBS) -libgstindexers_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) $(as_libtool_LDFLAGS) - -install-data-local: as-libtool-install-data-local - -uninstall-local: as-libtool-uninstall-local - -include $(top_srcdir)/common/as-libtool.mak - diff --git a/plugins/indexers/gstfileindex.c b/plugins/indexers/gstfileindex.c deleted file mode 100644 index f6adac7dcf..0000000000 --- a/plugins/indexers/gstfileindex.c +++ /dev/null @@ -1,1002 +0,0 @@ -/* GStreamer - * Copyright (C) 2003 Erik Walthinsen - * 2003 Joshua N Pritikin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include - -#include -#include -#include -#include -#include -#include - -#define GST_TYPE_FILE_INDEX \ - (gst_file_index_get_type ()) -#define GST_FILE_INDEX(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_FILE_INDEX, GstFileIndex)) -#define GST_FILE_INDEX_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_FILE_INDEX, GstFileIndexClass)) -#define GST_IS_FILE_INDEX(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_FILE_INDEX)) -#define GST_IS_FILE_INDEX_CLASS(obj) \ - (GST_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_FILE_INDEX)) - -/* - * Object model: - * - * We build an index to each entry for each id. - * - * - * fileindex - * -----------------------------... - * ! ! - * id1 id2 - * ! - * GArray - * - * The fileindex creates a FileIndexId object for each writer id, a - * Hashtable is kept to map the id to the FileIndexId - * - * The FileIndexId also keeps all the values in a sorted GArray. - * - * Finding a value for an id/format requires locating the correct GArray, - * then do a binary search to get the required value. - * - * Unlike gstmemindex: All formats are assumed to sort to the - * same order. All formats are assumed to be available from - * any entry. - */ - -/* - * Each array element is (32bits flags, nformats * 64bits) - */ -typedef struct -{ - gint id; - gchar *id_desc; - gint nformats; - GstFormat *format; - GArray *array; -} -GstFileIndexId; - -typedef struct _GstFileIndex GstFileIndex; -typedef struct _GstFileIndexClass GstFileIndexClass; - -#define ARRAY_ROW_SIZE(_ii) \ - (sizeof (gint32) + (_ii)->nformats * sizeof (gint64)) -#define ARRAY_TOTAL_SIZE(_ii) \ - (_ii->array->len * ARRAY_ROW_SIZE(_ii)) - -/* don't forget to convert to/from BE byte-order */ -#define ARRAY_ROW_FLAGS(_row) \ - (*((gint32*) (_row))) -#define ARRAY_ROW_VALUE(_row,_vx) \ - (*(gint64*) (((gchar*)(_row)) + sizeof (gint32) + (_vx) * sizeof (gint64))) - -GST_DEBUG_CATEGORY_STATIC (DC); -#define GST_CAT_DEFAULT DC - -struct _GstFileIndex -{ - GstIndex parent; - - gchar *location; - gboolean is_loaded; - GSList *unresolved; - gint next_id; - GHashTable *id_index; - - GstIndexEntry *ret_entry; /* hack to avoid leaking memory */ -}; - -struct _GstFileIndexClass -{ - GstIndexClass parent_class; -}; - -enum -{ - ARG_0, - ARG_LOCATION, -}; - -static void gst_file_index_class_init (GstFileIndexClass * klass); -static void gst_file_index_init (GstFileIndex * index); -static void gst_file_index_dispose (GObject * object); - -static void -gst_file_index_set_property (GObject * object, - guint prop_id, const GValue * value, GParamSpec * pspec); -static void -gst_file_index_get_property (GObject * object, - guint prop_id, GValue * value, GParamSpec * pspec); - -static gboolean -gst_file_index_get_writer_id (GstIndex * _index, gint * id, - gchar * writer_string); - -static void gst_file_index_commit (GstIndex * index, gint writer_id); -static void gst_file_index_add_entry (GstIndex * index, GstIndexEntry * entry); -static GstIndexEntry *gst_file_index_get_assoc_entry (GstIndex * index, gint id, - GstIndexLookupMethod method, - GstAssocFlags flags, - GstFormat format, gint64 value, GCompareDataFunc func, gpointer user_data); - -#define CLASS(file_index) GST_FILE_INDEX_CLASS (G_OBJECT_GET_CLASS (file_index)) - -static GstIndex *parent_class = NULL; - -GType -gst_file_index_get_type (void) -{ - static GType file_index_type = 0; - - if (!file_index_type) { - static const GTypeInfo file_index_info = { - sizeof (GstFileIndexClass), - NULL, - NULL, - (GClassInitFunc) gst_file_index_class_init, - NULL, - NULL, - sizeof (GstFileIndex), - 1, - (GInstanceInitFunc) gst_file_index_init, - NULL - }; - - file_index_type = - g_type_register_static (GST_TYPE_INDEX, "GstFileIndex", - &file_index_info, 0); - } - return file_index_type; -} - -static void -gst_file_index_class_init (GstFileIndexClass * klass) -{ - GObjectClass *gobject_class; - GstIndexClass *gstindex_class; - - gobject_class = (GObjectClass *) klass; - gstindex_class = (GstIndexClass *) klass; - - parent_class = g_type_class_ref (GST_TYPE_INDEX); - - gobject_class->dispose = gst_file_index_dispose; - gobject_class->set_property = gst_file_index_set_property; - gobject_class->get_property = gst_file_index_get_property; - - gstindex_class->add_entry = gst_file_index_add_entry; - gstindex_class->get_assoc_entry = gst_file_index_get_assoc_entry; - gstindex_class->commit = gst_file_index_commit; - gstindex_class->get_writer_id = gst_file_index_get_writer_id; - - g_object_class_install_property (gobject_class, ARG_LOCATION, - g_param_spec_string ("location", "File Location", - "Location of the index file", NULL, G_PARAM_READWRITE)); -} - -static void -gst_file_index_init (GstFileIndex * index) -{ - GST_DEBUG ("created new file index"); - - index->id_index = g_hash_table_new (g_int_hash, g_int_equal); -} - -static void -_file_index_id_free (GstFileIndexId * index_id, gboolean is_mmapped) -{ - if (index_id->id_desc) - g_free (index_id->id_desc); - if (index_id->format) - g_free (index_id->format); - if (index_id->array) { - if (is_mmapped) - munmap (index_id->array->data, ARRAY_TOTAL_SIZE (index_id)); - g_array_free (index_id->array, !is_mmapped); - } - g_free (index_id); -} - -static gboolean -_id_index_free_helper (gpointer _key, GstFileIndexId * index_id, - GstFileIndex * index) -{ - _file_index_id_free (index_id, index->is_loaded); - return TRUE; -} - -static void -gst_file_index_dispose (GObject * object) -{ - GstFileIndex *index = GST_FILE_INDEX (object); - - if (index->location) { - g_free (index->location); - index->location = NULL; - } - - { - GSList *elem; - - for (elem = index->unresolved; elem; elem = g_slist_next (elem)) - _file_index_id_free (elem->data, index->is_loaded); - g_slist_free (index->unresolved); - index->unresolved = NULL; - } - - g_hash_table_foreach_steal (index->id_index, - (GHRFunc) _id_index_free_helper, index); - g_hash_table_destroy (index->id_index); - index->id_index = NULL; - - gst_index_entry_free (index->ret_entry); /* hack */ - - G_OBJECT_CLASS (parent_class)->dispose (object); -} - -struct fi_find_writer_context -{ - const gchar *writer_string; - GstFileIndexId *ii; -}; - -void -_fi_find_writer (gpointer key, gpointer val, gpointer data) -{ - struct fi_find_writer_context *cx = data; - GstFileIndexId *ii = val; - - if (strcmp (ii->id_desc, cx->writer_string) == 0) - cx->ii = ii; -} - -static gboolean -gst_file_index_get_writer_id (GstIndex * _index, - gint * id, gchar * writer_string) -{ - GstFileIndex *index = GST_FILE_INDEX (_index); - GSList *pending = index->unresolved; - gboolean match = FALSE; - GSList *elem; - - if (!index->is_loaded) - return FALSE; - - g_return_val_if_fail (id, FALSE); - g_return_val_if_fail (writer_string, FALSE); - - index->unresolved = NULL; - - for (elem = pending; elem; elem = g_slist_next (elem)) { - GstFileIndexId *ii = elem->data; - - if (strcmp (ii->id_desc, writer_string) != 0) { - index->unresolved = g_slist_prepend (index->unresolved, ii); - continue; - } - - if (match) { - GST_WARNING_OBJECT (index, "Duplicate matches for writer '%s'", - writer_string); - continue; - } - - ii->id = *id = ++index->next_id; - g_hash_table_insert (index->id_index, &ii->id, ii); - match = TRUE; - } - - g_slist_free (pending); - - if (!match) { - struct fi_find_writer_context cx; - - cx.writer_string = writer_string; - cx.ii = NULL; - g_hash_table_foreach (index->id_index, _fi_find_writer, &cx); - - if (cx.ii) { - match = TRUE; - GST_DEBUG_OBJECT (index, "Resolved writer '%s' again", writer_string); - } else - GST_WARNING_OBJECT (index, "Can't resolve writer '%s'", writer_string); - } - - return match; -} - -static void -_fc_alloc_array (GstFileIndexId * id_index) -{ - g_assert (!id_index->array); - id_index->array = - g_array_sized_new (FALSE, FALSE, ARRAY_ROW_SIZE (id_index), 0); -} - -static void -gst_file_index_load (GstFileIndex * index) -{ - xmlDocPtr doc; - xmlNodePtr root, part; - xmlChar *val; - - g_assert (index->location); - g_return_if_fail (!index->is_loaded); - - { - gchar *path = g_strdup_printf ("%s/gstindex.xml", index->location); - GError *err = NULL; - gchar *buf; - gsize len; - - g_file_get_contents (path, &buf, &len, &err); - g_free (path); - if (err) { - GST_ERROR_OBJECT (index, "%s", err->message); - return; - } - - doc = xmlParseMemory (buf, len); - g_free (buf); - } - - //xmlDocFormatDump (stderr, doc, TRUE); - - root = doc->xmlRootNode; - if (strcmp ((char *) root->name, "gstfileindex") != 0) { - GST_ERROR_OBJECT (index, "root node isn't a gstfileindex"); - return; - } - - val = xmlGetProp (root, (guchar *) "version"); - if (!val || atoi ((char *) val) != 1) { - GST_ERROR_OBJECT (index, "version != 1"); - return; - } - free (val); - - for (part = root->children; part; part = part->next) { - if (strcmp ((char *) part->name, "writers") == 0) { - xmlNodePtr writer; - - for (writer = part->children; writer; writer = writer->next) { - xmlChar *datafile = xmlGetProp (writer, (guchar *) "datafile"); - gchar *path = g_strdup_printf ("%s/%s", index->location, datafile); - int fd; - GstFileIndexId *id_index; - xmlNodePtr wpart; - xmlChar *entries_str; - gpointer array_data; - - free (datafile); - - fd = open (path, O_RDONLY); - g_free (path); - if (fd < 0) { - GST_ERROR_OBJECT (index, - "Can't open '%s': %s", path, strerror (errno)); - continue; - } - - id_index = g_new0 (GstFileIndexId, 1); - id_index->id_desc = (char *) xmlGetProp (writer, (guchar *) "id"); - - for (wpart = writer->children; wpart; wpart = wpart->next) { - if (strcmp ((char *) wpart->name, "formats") == 0) { - xmlChar *count_str = xmlGetProp (wpart, (guchar *) "count"); - gint fx = 0; - xmlNodePtr format; - - id_index->nformats = atoi ((char *) count_str); - free (count_str); - - id_index->format = g_new (GstFormat, id_index->nformats); - - for (format = wpart->children; format; format = format->next) { - xmlChar *nick = xmlGetProp (format, (guchar *) "nick"); - GstFormat fmt = gst_format_get_by_nick ((char *) nick); - - if (fmt == GST_FORMAT_UNDEFINED) - GST_ERROR_OBJECT (index, "format '%s' undefined", nick); - g_assert (fx < id_index->nformats); - id_index->format[fx++] = fmt; - free (nick); - } - } else - GST_INFO_OBJECT (index, "unknown wpart '%s'", wpart->name); - } - - g_assert (id_index->nformats > 0); - _fc_alloc_array (id_index); - g_assert (id_index->array->data == NULL); /* little bit risky */ - - entries_str = xmlGetProp (writer, (guchar *) "entries"); - id_index->array->len = atoi ((char *) entries_str); - free (entries_str); - - array_data = - mmap (NULL, ARRAY_TOTAL_SIZE (id_index), PROT_READ, MAP_SHARED, fd, - 0); - close (fd); - if (array_data == MAP_FAILED) { - GST_ERROR_OBJECT (index, - "mmap %s failed: %s", path, strerror (errno)); - continue; - } - - id_index->array->data = array_data; - - index->unresolved = g_slist_prepend (index->unresolved, id_index); - } - } else - GST_INFO_OBJECT (index, "unknown part '%s'", part->name); - } - - xmlFreeDoc (doc); - - GST_FLAG_UNSET (index, GST_INDEX_WRITABLE); - index->is_loaded = TRUE; - GST_LOG_OBJECT (index, "index %s loaded OK", index->location); -} - -static void -gst_file_index_set_property (GObject * object, - guint prop_id, const GValue * value, GParamSpec * pspec) -{ - GstFileIndex *index = GST_FILE_INDEX (object); - - switch (prop_id) { - case ARG_LOCATION: - if (index->location) - g_free (index->location); - index->location = g_value_dup_string (value); - - if (index->location && !g_hash_table_size (index->id_index)) - gst_file_index_load (index); - break; - } -} - -static void -gst_file_index_get_property (GObject * object, - guint prop_id, GValue * value, GParamSpec * pspec) -{ - GstFileIndex *index = GST_FILE_INDEX (object); - - switch (prop_id) { - case ARG_LOCATION: - g_value_set_string (value, index->location); - break; - } -} - -static void -_file_index_id_save_xml (gpointer _key, GstFileIndexId * ii, xmlNodePtr writers) -{ - const gint bufsize = 16; - gchar buf[bufsize]; - xmlNodePtr writer; - xmlNodePtr formats; - gint xx; - - if (!ii->array) { - GST_INFO ("Index for %s is empty", ii->id_desc); - return; - } - - writer = xmlNewChild (writers, NULL, (guchar *) "writer", NULL); - xmlSetProp (writer, (guchar *) "id", (guchar *) ii->id_desc); - g_snprintf (buf, bufsize, "%d", ii->array->len); - xmlSetProp (writer, (guchar *) "entries", (guchar *) buf); - g_snprintf (buf, bufsize, "%d", ii->id); /* any unique number is OK */ - xmlSetProp (writer, (guchar *) "datafile", (guchar *) buf); - - formats = xmlNewChild (writer, NULL, (guchar *) "formats", NULL); - g_snprintf (buf, bufsize, "%d", ii->nformats); - xmlSetProp (formats, (guchar *) "count", (guchar *) buf); - - for (xx = 0; xx < ii->nformats; xx++) { - xmlNodePtr format = xmlNewChild (formats, NULL, (guchar *) "format", NULL); - const GstFormatDefinition *def = gst_format_get_details (ii->format[xx]); - - xmlSetProp (format, (guchar *) "nick", (guchar *) def->nick); - } -} - -/* - We must save the binary data in separate files because - mmap wants getpagesize() alignment. If we append all - the data to one file then we don't know the appropriate - padding since the page size isn't fixed. -*/ -static void -_file_index_id_save_entries (gpointer * _key, - GstFileIndexId * ii, gchar * prefix) -{ - GError *err; - gchar *path; - GIOChannel *chan; - - if (!ii->array) - return; - - err = NULL; - path = g_strdup_printf ("%s/%d", prefix, ii->id); - chan = g_io_channel_new_file (path, "w", &err); - g_free (path); - if (err) - goto fail; - - g_io_channel_set_encoding (chan, NULL, &err); - if (err) - goto fail; - - g_io_channel_write_chars (chan, - ii->array->data, ARRAY_TOTAL_SIZE (ii), NULL, &err); - if (err) - goto fail; - - g_io_channel_shutdown (chan, TRUE, &err); - if (err) - goto fail; - - g_io_channel_unref (chan); - return; - -fail: - GST_ERROR ("%s", err->message); -} - -/* - We have to save the whole set of indexes into a single file - so it doesn't make sense to commit only a single writer. - - i suggest: - - gst_index_commit (index, -1); -*/ -static void -gst_file_index_commit (GstIndex * _index, gint _writer_id) -{ - GstFileIndex *index = GST_FILE_INDEX (_index); - xmlDocPtr doc; - xmlNodePtr writers; - GError *err = NULL; - gchar *path; - GIOChannel *tocfile; - - g_return_if_fail (index->location); - g_return_if_fail (!index->is_loaded); - - GST_FLAG_UNSET (index, GST_INDEX_WRITABLE); - - doc = xmlNewDoc ((guchar *) "1.0"); - doc->xmlRootNode = xmlNewDocNode (doc, NULL, (guchar *) "gstfileindex", NULL); - xmlSetProp (doc->xmlRootNode, (guchar *) "version", (guchar *) "1"); - - writers = xmlNewChild (doc->xmlRootNode, NULL, (guchar *) "writers", NULL); - g_hash_table_foreach (index->id_index, - (GHFunc) _file_index_id_save_xml, writers); - - if (mkdir (index->location, 0777) && errno != EEXIST) { - GST_ERROR_OBJECT (index, "mkdir %s: %s", index->location, strerror (errno)); - return; - } - - path = g_strdup_printf ("%s/gstindex.xml", index->location); - tocfile = g_io_channel_new_file (path, "w", &err); - g_free (path); - if (err) { - GST_ERROR_OBJECT (index, "%s", err->message); - return; - } - - g_io_channel_set_encoding (tocfile, NULL, &err); - if (err) { - GST_ERROR_OBJECT (index, "%s", err->message); - return; - } - - { - xmlChar *xmlmem; - int xmlsize; - - xmlDocDumpMemory (doc, &xmlmem, &xmlsize); - g_io_channel_write_chars (tocfile, (char *) xmlmem, xmlsize, NULL, &err); - if (err) { - GST_ERROR_OBJECT (index, "%s", err->message); - return; - } - xmlFreeDoc (doc); - free (xmlmem); - } - - g_io_channel_shutdown (tocfile, TRUE, &err); - if (err) { - GST_ERROR_OBJECT (index, "%s", err->message); - return; - } - - g_io_channel_unref (tocfile); - - g_hash_table_foreach (index->id_index, - (GHFunc) _file_index_id_save_entries, index->location); -} - -static void -gst_file_index_add_id (GstIndex * index, GstIndexEntry * entry) -{ - GstFileIndex *fileindex = GST_FILE_INDEX (index); - GstFileIndexId *id_index; - - id_index = g_hash_table_lookup (fileindex->id_index, &entry->id); - - if (!id_index) { - id_index = g_new0 (GstFileIndexId, 1); - - id_index->id = entry->id; - id_index->id_desc = g_strdup (entry->data.id.description); - - /* It would be useful to know the GType of the writer so - we can try to cope with changes in the id_desc path. */ - - g_hash_table_insert (fileindex->id_index, &id_index->id, id_index); - } -} - -/* This algorithm differs from libc bsearch in the handling - of non-exact matches. */ - -static gboolean -_fc_bsearch (GArray * ary, - gint stride, - gint * ret, - GCompareDataFunc compare, gconstpointer sample, gpointer user_data) -{ - gint first, last; - gint mid; - gint midsize; - gint cmp; - gint tx; - - g_return_val_if_fail (compare, FALSE); - - if (!ary->len) { - if (ret) - *ret = 0; - return FALSE; - } - - first = 0; - last = ary->len - 1; - - midsize = last - first; - - while (midsize > 1) { - mid = first + midsize / 2; - - cmp = (*compare) (sample, ary->data + mid * stride, user_data); - - if (cmp == 0) { - /* if there are multiple matches then scan for the first match */ - while (mid > 0 && - (*compare) (sample, ary->data + (mid - 1) * stride, user_data) == 0) - --mid; - - if (ret) - *ret = mid; - return TRUE; - } - - if (cmp < 0) - last = mid - 1; - else - first = mid + 1; - - midsize = last - first; - } - - for (tx = first; tx <= last; tx++) { - cmp = (*compare) (sample, ary->data + tx * stride, user_data); - - if (cmp < 0) { - if (ret) - *ret = tx; - return FALSE; - } - if (cmp == 0) { - if (ret) - *ret = tx; - return TRUE; - } - } - - if (ret) - *ret = last + 1; - return FALSE; -} - -static gint -file_index_compare (gconstpointer sample, gconstpointer row, gpointer user_data) -{ - //GstFileIndexId *id_index = user_data; - const GstIndexAssociation *ca = sample; - gint64 val1 = ca->value; - gint64 val2_be = ARRAY_ROW_VALUE (row, ca->format); - gint64 val2 = GINT64_FROM_BE (val2_be); - gint64 diff = val2 - val1; - - return (diff == 0 ? 0 : (diff < 0 ? 1 : -1)); -} - -static void -gst_file_index_add_association (GstIndex * index, GstIndexEntry * entry) -{ - GstFileIndex *fileindex = GST_FILE_INDEX (index); - GstFileIndexId *id_index; - gint mx; - GstIndexAssociation sample; - gboolean exact; - - id_index = g_hash_table_lookup (fileindex->id_index, &entry->id); - if (!id_index) - return; - - if (!id_index->nformats) { - gint fx; - - id_index->nformats = GST_INDEX_NASSOCS (entry); - GST_LOG_OBJECT (fileindex, "creating %d formats for %d", - id_index->nformats, entry->id); - id_index->format = g_new (GstFormat, id_index->nformats); - for (fx = 0; fx < id_index->nformats; fx++) - id_index->format[fx] = GST_INDEX_ASSOC_FORMAT (entry, fx); - _fc_alloc_array (id_index); - } else { - /* only sanity checking */ - if (id_index->nformats != GST_INDEX_NASSOCS (entry)) - GST_WARNING_OBJECT (fileindex, "arity change %d -> %d", - id_index->nformats, GST_INDEX_NASSOCS (entry)); - else { - gint fx; - - for (fx = 0; fx < id_index->nformats; fx++) - if (id_index->format[fx] != GST_INDEX_ASSOC_FORMAT (entry, fx)) - GST_WARNING_OBJECT (fileindex, "format[%d] changed %d -> %d", - fx, id_index->format[fx], GST_INDEX_ASSOC_FORMAT (entry, fx)); - } - } - - /* this is a hack, we should use a private structure instead */ - sample.format = 0; - sample.value = GST_INDEX_ASSOC_VALUE (entry, 0); - - exact = - _fc_bsearch (id_index->array, ARRAY_ROW_SIZE (id_index), - &mx, file_index_compare, &sample, id_index); - - if (exact) { - /* maybe overwrite instead? */ - GST_DEBUG_OBJECT (index, - "Ignoring duplicate index association at %lld", - GST_INDEX_ASSOC_VALUE (entry, 0)); - return; - } - - { - gchar row_data[ARRAY_ROW_SIZE (id_index)]; - gint fx; - - gint32 flags_host = GST_INDEX_ASSOC_FLAGS (entry); - - ARRAY_ROW_FLAGS (row_data) = GINT32_TO_BE (flags_host); - - for (fx = 0; fx < id_index->nformats; fx++) { - gint64 val_host = GST_INDEX_ASSOC_VALUE (entry, fx); - - ARRAY_ROW_VALUE (row_data, fx) = GINT64_TO_BE (val_host); - } - - g_array_insert_vals (id_index->array, mx, row_data, 1); - } -} - -/* -static void -show_entry (GstIndexEntry *entry) -{ - switch (entry->type) { - case GST_INDEX_ENTRY_ID: - g_print ("id %d describes writer %s\n", entry->id, - GST_INDEX_ID_DESCRIPTION (entry)); - break; - case GST_INDEX_ENTRY_FORMAT: - g_print ("%d: registered format %d for %s\n", entry->id, - GST_INDEX_FORMAT_FORMAT (entry), - GST_INDEX_FORMAT_KEY (entry)); - break; - case GST_INDEX_ENTRY_ASSOCIATION: - { - gint i; - - g_print ("%d: %08x ", entry->id, GST_INDEX_ASSOC_FLAGS (entry)); - for (i = 0; i < GST_INDEX_NASSOCS (entry); i++) { - g_print ("%d %lld ", GST_INDEX_ASSOC_FORMAT (entry, i), - GST_INDEX_ASSOC_VALUE (entry, i)); - } - g_print ("\n"); - break; - } - default: - break; - } -} -*/ - -static void -gst_file_index_add_entry (GstIndex * index, GstIndexEntry * entry) -{ - GST_LOG_OBJECT (index, "adding this entry"); - - switch (entry->type) { - case GST_INDEX_ENTRY_ID: - gst_file_index_add_id (index, entry); - break; - case GST_INDEX_ENTRY_ASSOCIATION: - gst_file_index_add_association (index, entry); - break; - case GST_INDEX_ENTRY_OBJECT: - GST_ERROR_OBJECT (index, "gst_file_index_add_object not implemented"); - break; - case GST_INDEX_ENTRY_FORMAT: - /* - We infer the formats from the entry itself so this type of - GST_INDEX_ENTRY_* can probably go away. - */ - GST_DEBUG_OBJECT (index, "gst_file_index_add_format not implemented"); - break; - default: - break; - } -} - -static GstIndexEntry * -gst_file_index_get_assoc_entry (GstIndex * index, - gint id, - GstIndexLookupMethod method, - GstAssocFlags flags, - GstFormat format, - gint64 value, GCompareDataFunc _ignore_func, gpointer _ignore_user_data) -{ - GstFileIndex *fileindex = GST_FILE_INDEX (index); - GstFileIndexId *id_index; - gint formatx = -1; - gint fx; - GstIndexAssociation sample; - gint mx; - gboolean exact; - gpointer row_data; - GstIndexEntry *entry; - gint xx; - - g_return_val_if_fail (id > 0, NULL); - - id_index = g_hash_table_lookup (fileindex->id_index, &id); - if (!id_index) { - GST_WARNING_OBJECT (fileindex, "writer %d unavailable", id); - return NULL; - } - - for (fx = 0; fx < id_index->nformats; fx++) - if (id_index->format[fx] == format) { - formatx = fx; - break; - } - - if (formatx == -1) { - GST_WARNING_OBJECT (fileindex, "format %d not available", format); - return NULL; - } - - /* this is a hack, we should use a private structure instead */ - sample.format = formatx; - sample.value = value; - - exact = _fc_bsearch (id_index->array, ARRAY_ROW_SIZE (id_index), - &mx, file_index_compare, &sample, id_index); - - if (!exact) { - if (method == GST_INDEX_LOOKUP_EXACT) - return NULL; - else if (method == GST_INDEX_LOOKUP_BEFORE) { - if (mx == 0) - return NULL; - mx -= 1; - } else if (method == GST_INDEX_LOOKUP_AFTER) { - if (mx == id_index->array->len) - return NULL; - } - } - - row_data = id_index->array->data + mx * ARRAY_ROW_SIZE (id_index); - - /* if exact then ignore flags (?) */ - if (method != GST_INDEX_LOOKUP_EXACT) - while ((GINT32_FROM_BE (ARRAY_ROW_FLAGS (row_data)) & flags) != flags) { - if (method == GST_INDEX_LOOKUP_BEFORE) - mx -= 1; - else if (method == GST_INDEX_LOOKUP_AFTER) - mx += 1; - if (mx < 0 || mx >= id_index->array->len) - return NULL; - row_data = id_index->array->data + mx * ARRAY_ROW_SIZE (id_index); - } - - /* entry memory management needs improvement FIXME */ - if (!fileindex->ret_entry) - fileindex->ret_entry = g_new0 (GstIndexEntry, 1); - entry = fileindex->ret_entry; - if (entry->data.assoc.assocs) { - g_free (entry->data.assoc.assocs); - entry->data.assoc.assocs = NULL; - } - - entry->type = GST_INDEX_ENTRY_ASSOCIATION; - - GST_INDEX_NASSOCS (entry) = id_index->nformats; - entry->data.assoc.assocs = g_new (GstIndexAssociation, id_index->nformats); - - { - gint32 flags_be = ARRAY_ROW_FLAGS (row_data); - - GST_INDEX_ASSOC_FLAGS (entry) = GINT32_FROM_BE (flags_be); - - for (xx = 0; xx < id_index->nformats; xx++) { - gint64 val_be = ARRAY_ROW_VALUE (row_data, xx); - - GST_INDEX_ASSOC_FORMAT (entry, xx) = id_index->format[xx]; - GST_INDEX_ASSOC_VALUE (entry, xx) = GINT64_FROM_BE (val_be); - } - } - - return entry; -} - -gboolean -gst_file_index_plugin_init (GstPlugin * plugin) -{ - GstIndexFactory *factory; - - factory = gst_index_factory_new ("fileindex", - "A index that stores entries in file", gst_file_index_get_type ()); - - if (factory != NULL) { - gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory)); - } else { - return FALSE; - } - GST_DEBUG_CATEGORY_INIT (DC, "GST_FILEINDEX", 0, NULL); - - return TRUE; -} diff --git a/plugins/indexers/gstindexers.c b/plugins/indexers/gstindexers.c deleted file mode 100644 index 188a8aa85f..0000000000 --- a/plugins/indexers/gstindexers.c +++ /dev/null @@ -1,44 +0,0 @@ -/* GStreamer - * Copyright (C) <1999> Erik Walthinsen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include -#include -#include - -extern gboolean gst_mem_index_plugin_init (GstPlugin * plugin); -extern gboolean gst_file_index_plugin_init (GstPlugin * plugin); - -static gboolean -plugin_init (GstPlugin * plugin) -{ - gboolean res = TRUE; - - res &= gst_mem_index_plugin_init (plugin); -#ifndef GST_DISABLE_LOADSAVE_REGISTRY - res &= gst_file_index_plugin_init (plugin); -#endif - - return res; -} - -GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "gstindexers", - "GStreamer core indexers", - plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN) diff --git a/plugins/indexers/gstmemindex.c b/plugins/indexers/gstmemindex.c deleted file mode 100644 index c3ef4c2403..0000000000 --- a/plugins/indexers/gstmemindex.c +++ /dev/null @@ -1,420 +0,0 @@ -/* GStreamer - * Copyright (C) <1999> Erik Walthinsen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include - -#define GST_TYPE_MEM_INDEX \ - (gst_index_get_type ()) -#define GST_MEM_INDEX(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MEM_INDEX, GstMemIndex)) -#define GST_MEM_INDEX_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MEM_INDEX, GstMemIndexClass)) -#define GST_IS_MEM_INDEX(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MEM_INDEX)) -#define GST_IS_MEM_INDEX_CLASS(obj) \ - (GST_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MEM_INDEX)) - -/* - * Object model: - * - * All entries are simply added to a GList first. Then we build - * an index to each entry for each id/format - * - * - * memindex - * -----------------------------... - * ! ! - * id1 id2 - * ------------ - * ! ! - * format1 format2 - * ! ! - * GTree GTree - * - * - * The memindex creates a MemIndexId object for each writer id, a - * Hashtable is kept to map the id to the MemIndexId - * - * The MemIndexId keeps a MemIndexFormatIndex for each format the - * specific writer wants indexed. - * - * The MemIndexFormatIndex keeps all the values of the particular - * format in a GTree, The values of the GTree point back to the entry. - * - * Finding a value for an id/format requires locating the correct GTree, - * then do a lookup in the Tree to get the required value. - */ - -typedef struct -{ - GstFormat format; - gint offset; - GTree *tree; -} -GstMemIndexFormatIndex; - -typedef struct -{ - gint id; - GHashTable *format_index; -} -GstMemIndexId; - -typedef struct _GstMemIndex GstMemIndex; -typedef struct _GstMemIndexClass GstMemIndexClass; - -struct _GstMemIndex -{ - GstIndex parent; - - GList *associations; - - GHashTable *id_index; -}; - -struct _GstMemIndexClass -{ - GstIndexClass parent_class; -}; - -/* Index signals and args */ -enum -{ - LAST_SIGNAL -}; - -enum -{ - ARG_0, - /* FILL ME */ -}; - -static void gst_mem_index_class_init (GstMemIndexClass * klass); -static void gst_mem_index_init (GstMemIndex * index); -static void gst_mem_index_dispose (GObject * object); - -static void gst_mem_index_add_entry (GstIndex * index, GstIndexEntry * entry); -static GstIndexEntry *gst_mem_index_get_assoc_entry (GstIndex * index, gint id, - GstIndexLookupMethod method, GstAssocFlags flags, - GstFormat format, gint64 value, GCompareDataFunc func, gpointer user_data); - -#define CLASS(mem_index) GST_MEM_INDEX_CLASS (G_OBJECT_GET_CLASS (mem_index)) - -static GstIndex *parent_class = NULL; - -/*static guint gst_mem_index_signals[LAST_SIGNAL] = { 0 }; */ - -GType -gst_mem_index_get_type (void) -{ - static GType mem_index_type = 0; - - if (!mem_index_type) { - static const GTypeInfo mem_index_info = { - sizeof (GstMemIndexClass), - NULL, - NULL, - (GClassInitFunc) gst_mem_index_class_init, - NULL, - NULL, - sizeof (GstMemIndex), - 1, - (GInstanceInitFunc) gst_mem_index_init, - NULL - }; - - mem_index_type = - g_type_register_static (GST_TYPE_INDEX, "GstMemIndex", &mem_index_info, - 0); - } - return mem_index_type; -} - -static void -gst_mem_index_class_init (GstMemIndexClass * klass) -{ - GObjectClass *gobject_class; - GstIndexClass *gstindex_class; - - gobject_class = (GObjectClass *) klass; - gstindex_class = (GstIndexClass *) klass; - - parent_class = g_type_class_ref (GST_TYPE_INDEX); - - gobject_class->dispose = gst_mem_index_dispose; - - gstindex_class->add_entry = gst_mem_index_add_entry; - gstindex_class->get_assoc_entry = gst_mem_index_get_assoc_entry; -} - -static void -gst_mem_index_init (GstMemIndex * index) -{ - GST_DEBUG ("created new mem index"); - - index->associations = NULL; - index->id_index = g_hash_table_new (g_int_hash, g_int_equal); -} - -static void -gst_mem_index_dispose (GObject * object) -{ - //GstMemIndex *memindex = GST_MEM_INDEX (object); - - G_OBJECT_CLASS (parent_class)->dispose (object); -} - -static void -gst_mem_index_add_id (GstIndex * index, GstIndexEntry * entry) -{ - GstMemIndex *memindex = GST_MEM_INDEX (index); - GstMemIndexId *id_index; - - id_index = g_hash_table_lookup (memindex->id_index, &entry->id); - - if (!id_index) { - id_index = g_new0 (GstMemIndexId, 1); - - id_index->id = entry->id; - id_index->format_index = g_hash_table_new (g_int_hash, g_int_equal); - g_hash_table_insert (memindex->id_index, &id_index->id, id_index); - } -} - -static gint -mem_index_compare (gconstpointer a, gconstpointer b, gpointer user_data) -{ - GstMemIndexFormatIndex *index = user_data; - gint64 val1, val2; - gint64 diff; - - val1 = GST_INDEX_ASSOC_VALUE (((GstIndexEntry *) a), index->offset); - val2 = GST_INDEX_ASSOC_VALUE (((GstIndexEntry *) b), index->offset); - - diff = (val2 - val1); - - return (diff == 0 ? 0 : (diff > 0 ? 1 : -1)); -} - -static void -gst_mem_index_index_format (GstMemIndexId * id_index, GstIndexEntry * entry, - gint assoc) -{ - GstMemIndexFormatIndex *index; - GstFormat *format; - - format = &GST_INDEX_ASSOC_FORMAT (entry, assoc); - - index = g_hash_table_lookup (id_index->format_index, format); - - if (!index) { - index = g_new0 (GstMemIndexFormatIndex, 1); - - index->format = *format; - index->offset = assoc; - index->tree = g_tree_new_with_data (mem_index_compare, index); - - g_hash_table_insert (id_index->format_index, &index->format, index); - } - - g_tree_insert (index->tree, entry, entry); -} - -static void -gst_mem_index_add_association (GstIndex * index, GstIndexEntry * entry) -{ - GstMemIndex *memindex = GST_MEM_INDEX (index); - GstMemIndexId *id_index; - - memindex->associations = g_list_prepend (memindex->associations, entry); - - id_index = g_hash_table_lookup (memindex->id_index, &entry->id); - if (id_index) { - gint i; - - for (i = 0; i < GST_INDEX_NASSOCS (entry); i++) { - gst_mem_index_index_format (id_index, entry, i); - } - } -} - -static void -gst_mem_index_add_object (GstIndex * index, GstIndexEntry * entry) -{ -} - -static void -gst_mem_index_add_format (GstIndex * index, GstIndexEntry * entry) -{ -} - -static void -gst_mem_index_add_entry (GstIndex * index, GstIndexEntry * entry) -{ - GST_LOG_OBJECT (index, "added this entry"); - - switch (entry->type) { - case GST_INDEX_ENTRY_ID: - gst_mem_index_add_id (index, entry); - break; - case GST_INDEX_ENTRY_ASSOCIATION: - gst_mem_index_add_association (index, entry); - break; - case GST_INDEX_ENTRY_OBJECT: - gst_mem_index_add_object (index, entry); - break; - case GST_INDEX_ENTRY_FORMAT: - gst_mem_index_add_format (index, entry); - break; - default: - break; - } -} - -typedef struct -{ - gint64 value; - GstMemIndexFormatIndex *index; - gboolean exact; - GstIndexEntry *lower; - gint64 low_diff; - GstIndexEntry *higher; - gint64 high_diff; -} -GstMemIndexSearchData; - -static gint -mem_index_search (gconstpointer a, gconstpointer b) -{ - GstMemIndexSearchData *data = (GstMemIndexSearchData *) b; - GstMemIndexFormatIndex *index = data->index; - gint64 val1, val2; - gint64 diff; - - val1 = GST_INDEX_ASSOC_VALUE (((GstIndexEntry *) a), index->offset); - val2 = data->value; - - diff = (val1 - val2); - if (diff == 0) - return 0; - - /* exact matching, don't update low/high */ - if (data->exact) - return (diff > 0 ? 1 : -1); - - if (diff < 0) { - if (diff > data->low_diff) { - data->low_diff = diff; - data->lower = (GstIndexEntry *) a; - } - diff = -1; - } else { - if (diff < data->high_diff) { - data->high_diff = diff; - data->higher = (GstIndexEntry *) a; - } - diff = 1; - } - - return diff; -} - -static GstIndexEntry * -gst_mem_index_get_assoc_entry (GstIndex * index, gint id, - GstIndexLookupMethod method, - GstAssocFlags flags, - GstFormat format, gint64 value, GCompareDataFunc func, gpointer user_data) -{ - GstMemIndex *memindex = GST_MEM_INDEX (index); - GstMemIndexId *id_index; - GstMemIndexFormatIndex *format_index; - GstIndexEntry *entry; - GstMemIndexSearchData data; - - id_index = g_hash_table_lookup (memindex->id_index, &id); - if (!id_index) - return NULL; - - format_index = g_hash_table_lookup (id_index->format_index, &format); - if (!format_index) - return NULL; - - data.value = value; - data.index = format_index; - data.exact = (method == GST_INDEX_LOOKUP_EXACT); - - /* setup data for low/high checks if we are not looking - * for an exact match */ - if (!data.exact) { - data.low_diff = G_MININT64; - data.lower = NULL; - data.high_diff = G_MAXINT64; - data.higher = NULL; - } - - entry = g_tree_search (format_index->tree, mem_index_search, &data); - - /* get the low/high values if we're not exact */ - if (entry == NULL && !data.exact) { - if (method == GST_INDEX_LOOKUP_BEFORE) - entry = data.lower; - else if (method == GST_INDEX_LOOKUP_AFTER) { - entry = data.higher; - } - } - - if (entry) { - if ((GST_INDEX_ASSOC_FLAGS (entry) & flags) != flags) { - GList *l_entry = g_list_find (memindex->associations, entry); - - entry = NULL; - - while (l_entry) { - entry = (GstIndexEntry *) l_entry->data; - - if (entry->id == id && (GST_INDEX_ASSOC_FLAGS (entry) & flags) == flags) - break; - - if (method == GST_INDEX_LOOKUP_BEFORE) - l_entry = g_list_next (l_entry); - else if (method == GST_INDEX_LOOKUP_AFTER) { - l_entry = g_list_previous (l_entry); - } - } - } - } - - return entry; -} - -gboolean -gst_mem_index_plugin_init (GstPlugin * plugin) -{ - GstIndexFactory *factory; - - factory = gst_index_factory_new ("memindex", - "A index that stores entries in memory", gst_mem_index_get_type ()); - - if (factory != NULL) { - gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory)); - } else { - g_warning ("could not register memindex"); - } - return TRUE; -} diff --git a/tests/old/examples/Makefile.am b/tests/old/examples/Makefile.am deleted file mode 100644 index ed48293d69..0000000000 --- a/tests/old/examples/Makefile.am +++ /dev/null @@ -1,25 +0,0 @@ -if GST_DISABLE_LOADSAVE -GST_LOADSAVE_DIRS = -else -GST_LOADSAVE_DIRS = xml typefind -endif - -dirs = \ - helloworld \ - queue \ - queue2 \ - queue3 \ - queue4 \ - launch \ - thread \ - plugins \ - mixer \ - cutter \ - pingpong \ - manual \ - retag - -SUBDIRS = $(dirs) \ - $(GST_LOADSAVE_DIRS) - -DIST_SUBDIRS = $(dirs) xml typefind diff --git a/tests/old/examples/appreader/.gitignore b/tests/old/examples/appreader/.gitignore deleted file mode 100644 index 2167b1baf8..0000000000 --- a/tests/old/examples/appreader/.gitignore +++ /dev/null @@ -1 +0,0 @@ -appreader diff --git a/tests/old/examples/appreader/Makefile.am b/tests/old/examples/appreader/Makefile.am deleted file mode 100644 index 68b2265bef..0000000000 --- a/tests/old/examples/appreader/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -noinst_PROGRAMS = appreader - -appreader_LDADD = $(GST_OBJ_LIBS) -appreader_CFLAGS = $(GST_OBJ_CFLAGS) - diff --git a/tests/old/examples/appreader/appreader.c b/tests/old/examples/appreader/appreader.c deleted file mode 100644 index 5e8768a372..0000000000 --- a/tests/old/examples/appreader/appreader.c +++ /dev/null @@ -1,76 +0,0 @@ -/* GStreamer - * Copyright (C) <1999> Erik Walthinsen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include - -static void -fill_queue (GstElement * queue, gint level, GstBin * pipeline) -{ - /* this needs to iterate till something is pushed - * in the queue */ - gst_bin_iterate (pipeline); -} - -gint -main (gint argc, gchar * argv[]) -{ - GstElement *queue, *src, *pipeline; - GstBuffer *buffer; - gboolean done = FALSE; - GstPad *pad; - - gst_init (&argc, &argv); - - queue = gst_element_factory_make ("queue", "queue"); - g_object_set (G_OBJECT (queue), "signal_marks", TRUE, NULL); - - src = gst_element_factory_make ("filesrc", "src"); - g_object_set (G_OBJECT (src), "location", "appreader.c", NULL); - - pipeline = gst_pipeline_new ("pipeline"); - - gst_bin_add_many (GST_BIN (pipeline), src, queue, NULL); - - gst_element_link_many (src, queue, NULL); - - pad = gst_element_get_pad (queue, "src"); - g_signal_connect (G_OBJECT (queue), "low_watermark", G_CALLBACK (fill_queue), - pipeline); - - gst_element_set_state (pipeline, GST_STATE_PLAYING); - - do { - /* get buffer into the app */ - buffer = GST_RPAD_GETFUNC (pad) (pad); - - /* just exit on any event */ - if (GST_IS_EVENT (buffer)) { - done = TRUE; - } else { - gst_util_dump_mem (GST_BUFFER_DATA (buffer), GST_BUFFER_SIZE (buffer)); - } - gst_data_unref (GST_DATA (buffer)); - - } while (!done); - - gst_element_set_state (pipeline, GST_STATE_NULL); - gst_object_unref (GST_OBJECT (pipeline)); - - return 0; -} diff --git a/tests/old/examples/cutter/.gitignore b/tests/old/examples/cutter/.gitignore deleted file mode 100644 index d1442f38e5..0000000000 --- a/tests/old/examples/cutter/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -cutter -*.bb -*.bbg -*.da diff --git a/tests/old/examples/cutter/Makefile.am b/tests/old/examples/cutter/Makefile.am deleted file mode 100644 index 5285612a45..0000000000 --- a/tests/old/examples/cutter/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -noinst_PROGRAMS = cutter -noinst_HEADERS = cutter.h - -cutter_LDADD = $(GST_OBJ_LIBS) -cutter_CFLAGS = $(GST_OBJ_CFLAGS) diff --git a/tests/old/examples/cutter/cutter.c b/tests/old/examples/cutter/cutter.c deleted file mode 100644 index dc26a60bef..0000000000 --- a/tests/old/examples/cutter/cutter.c +++ /dev/null @@ -1,203 +0,0 @@ -/* - * cutter.c - cut audio into pieces based on silence - thomas@apestaart.org - * - * construct a simple pipeline osssrc ! cutter ! filesink - * pause when necessary, change output - * - * Latest change : 03/06/2001 - * - * Version : 0.3 - */ - -#include -#include -#include -#include - -#define DEBUG - -gboolean playing = TRUE; -gboolean cut_start_signalled = FALSE; -gboolean cut_stop_signalled = FALSE; - -int id = 0; /* increment this for each new cut */ -GstElement *main_bin; -GstElement *audiosrc; -GstElement *queue; -GstElement *thread; -GstElement *cutter; -GstElement *filesink; -GstElement *encoder; -char buffer[255]; - -/* signal callbacks */ - -void -cut_start (GstElement * element) -{ - g_print ("\nDEBUG: main: cut start\n"); - /* we should pause the pipeline, unlink cutter and filesink - * create a new filesink to a real file, relink, and set to play - */ - g_print ("DEBUG: cut_start: main_bin pausing\n"); - gst_element_set_state (main_bin, GST_STATE_PAUSED); - g_print ("DEBUG: cut_start: main_bin paused\n"); - - { - time_t seconds; - struct tm *ct; - - time (&seconds); - ct = localtime (&seconds); -/* sprintf (buffer, "/news/incoming/audio/cutter.%06d.wav", id); */ - sprintf (buffer, - "/news/incoming/audio/cutter.%04d%02d%02d.%02d%02d%02d.wav", - ct->tm_year + 1900, ct->tm_mon, ct->tm_mday, ct->tm_hour, ct->tm_min, - ct->tm_sec); - } - g_print ("DEBUG: cut_start: setting new location to %s\n", buffer); - g_object_set (G_OBJECT (filesink), "location", buffer, NULL); - g_object_set (G_OBJECT (filesink), "type", 4, NULL); - - gst_element_set_state (main_bin, GST_STATE_PLAYING); - ++id; - g_print ("start_cut_signal done\n"); - return; -} - -void -cut_start_signal (GstElement * element) -{ - g_print ("\nDEBUG: main: cut start signal\n"); - cut_start_signalled = TRUE; -} - -void -cut_stop (GstElement * element) -{ - g_print ("\nDEBUG: main: cut stop\n"); - /* we should pause the pipeline, unlink filesink, create a fake filesink, - * link to pipeline, and set to play - */ - g_print ("DEBUG: cut_stop: main_bin paused\n"); - gst_element_set_state (main_bin, GST_STATE_PAUSED); - - g_print ("DEBUG: cut_stop: setting new location\n"); - g_object_set (G_OBJECT (filesink), "location", "/dev/null", NULL); - - gst_element_set_state (main_bin, GST_STATE_PLAYING); - g_print ("stop_cut_signal done\n"); - return; -} - -void -cut_stop_signal (GstElement * element) -{ - g_print ("\nDEBUG: main: cut stop signal\n"); - cut_stop_signalled = TRUE; -} - -int -main (int argc, char *argv[]) -{ - /*int i, j; */ - /*gboolean done; */ - - /*char buffer[20]; */ - - /*output_channel_t *channel_out; */ - - GstElement *audiosrc; - - gst_init (&argc, &argv); -/* - if (argc == 1) - { - g_print("usage: %s <...>\n", argv[0]); - exit(-1); - }*/ - - /* set up input channel and main bin */ - - g_print ("creating main bin\n"); - /* create cutter */ - cutter = gst_element_factory_make ("cutter", "cutter"); - - g_object_set (G_OBJECT (cutter), - "threshold_dB", -40.0, "runlength", 0.5, "prelength", 1.0, NULL); - - /* create an audio src */ - if (!(audiosrc = gst_element_factory_make ("osssrc", "audio_src"))) - g_error ("Could not create 'osssrc' element !\n"); - - /* set params */ - - g_object_set (G_OBJECT (audiosrc), "frequency", 44100, - "channels", 1, "format", 16, NULL); - - if (!(encoder = gst_element_factory_make ("passthrough", "encoder"))) - g_error ("Could not create 'passthrough' element !\n"); - - if (!(filesink = gst_element_factory_make ("afsink", "disk_sink"))) - g_error ("Could not create 'afsink' element !\n"); - - g_object_set (G_OBJECT (filesink), "location", "/dev/null", NULL); - - thread = gst_thread_new ("thread"); - g_assert (thread != NULL); - - /* create main bin */ - main_bin = gst_pipeline_new ("bin"); - g_assert (main_bin != NULL); - - queue = gst_element_factory_make ("queue", "queue"); - g_assert (queue); - - /* add elements to bin */ - gst_bin_add (GST_BIN (main_bin), audiosrc); - gst_bin_add (GST_BIN (thread), queue); - - gst_bin_add_many (GST_BIN (thread), cutter, encoder, filesink, NULL); - - gst_element_link_many (audiosrc, queue, cutter, encoder, filesink, NULL); - gst_bin_add (GST_BIN (main_bin), thread); - - /* set signal handlers */ - g_print ("setting signal handlers\n"); - g_signal_connect (G_OBJECT (cutter), "cut_start", - (GCallback) cut_start_signal, NULL); - g_signal_connect (G_OBJECT (cutter), "cut_stop", - (GCallback) cut_stop_signal, NULL); - - /* start playing */ - g_print ("setting to play\n"); - gst_element_set_state (main_bin, GST_STATE_PLAYING); -/* - g_print ("setting thread to play\n"); - gst_element_set_state (GST_ELEMENT (thread), GST_STATE_PLAYING); -*/ - while (playing) { -/* g_print ("> "); */ - gst_bin_iterate (GST_BIN (main_bin)); -/* g_print (" <"); */ - if (cut_start_signalled) { - g_print ("\nDEBUG: main: cut_start_signalled true !\n"); - cut_start (cutter); - cut_start_signalled = FALSE; - } - if (cut_stop_signalled) { - g_print ("\nDEBUG: main: cut_stop_signalled true !\n"); - cut_stop (cutter); - cut_stop_signalled = FALSE; - } - } - g_print ("we're done iterating.\n"); - /* stop the bin */ - - gst_element_set_state (main_bin, GST_STATE_NULL); - - gst_object_unref (GST_OBJECT (filesink)); - gst_object_unref (GST_OBJECT (main_bin)); - - exit (0); -} diff --git a/tests/old/examples/cutter/cutter.h b/tests/old/examples/cutter/cutter.h deleted file mode 100644 index 15182d0438..0000000000 --- a/tests/old/examples/cutter/cutter.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * cutter.h header file - * thomas@apestaart.org - */ - -typedef struct -{ - GstElement *pipe; - GstElement *filesink; - GstElement *audiosink; - - char *location; - int channel_id; -} output_channel_t; diff --git a/tests/old/examples/events/Makefile.am b/tests/old/examples/events/Makefile.am deleted file mode 100644 index ef74b46b5d..0000000000 --- a/tests/old/examples/events/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -noinst_PROGRAMS = seek - -LDADD = $(GST_OBJ_LIBS) -AM_CFLAGS = $(GST_OBJ_CFLAGS) diff --git a/tests/old/examples/events/seek.c b/tests/old/examples/events/seek.c deleted file mode 100644 index 4e45f53731..0000000000 --- a/tests/old/examples/events/seek.c +++ /dev/null @@ -1,68 +0,0 @@ -#include - -int -main (int argc, char *argv[]) -{ - GstBin *bin; - GstElement *src, *sink; - GstPad *srcpad, *sinkpad; - -/* _gst_plugin_spew = TRUE; */ - gst_init (&argc, &argv); - - bin = GST_BIN (gst_pipeline_new ("pipeline")); - g_return_val_if_fail (bin != NULL, -1); - - g_print ("--- creating src and sink elements\n"); - src = gst_element_factory_make ("fakesrc", "src"); - g_return_val_if_fail (src != NULL, -1); - sink = gst_element_factory_make ("fakesink", "sink"); - g_return_val_if_fail (sink != NULL, -1); - - g_print ("--- about to add the elements to the bin\n"); - gst_bin_add (bin, GST_ELEMENT (src)); - gst_bin_add (bin, GST_ELEMENT (sink)); - - g_print ("--- getting pads\n"); - srcpad = gst_element_get_pad (src, "src"); - g_return_val_if_fail (srcpad != NULL, -1); - sinkpad = gst_element_get_pad (sink, "sink"); - g_return_val_if_fail (srcpad != NULL, -1); - - g_print ("--- linking\n"); - gst_pad_link (srcpad, sinkpad); - - g_print ("--- setting up\n"); - gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PLAYING); - - g_print ("--- iterating\n"); - gst_bin_iterate (bin); - gst_bin_iterate (bin); - - g_print ("--- seek to 100\n"); - gst_pad_send_event (srcpad, gst_event_new_seek (GST_SEEK_ANY, 100, FALSE)); - - g_print ("--- seek done, iterating\n"); - gst_bin_iterate (bin); - gst_bin_iterate (bin); - - g_print ("--- seek to 200 with flush\n"); - gst_pad_send_event (srcpad, gst_event_new_seek (GST_SEEK_ANY, 200, TRUE)); - - g_print ("--- seek done, iterating\n"); - gst_bin_iterate (bin); - gst_bin_iterate (bin); - gst_bin_iterate (bin); - - g_print ("--- flush\n"); - gst_pad_send_event (srcpad, gst_event_new_flush ()); - - g_print ("--- flush done, iterating\n"); - gst_bin_iterate (bin); - gst_bin_iterate (bin); - - g_print ("--- cleaning up\n"); - gst_element_set_state (GST_ELEMENT (bin), GST_STATE_NULL); - - return 0; -} diff --git a/tests/old/examples/helloworld/.gitignore b/tests/old/examples/helloworld/.gitignore deleted file mode 100644 index 5fffd1801f..0000000000 --- a/tests/old/examples/helloworld/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -helloworld -*.bb -*.bbg -*.da diff --git a/tests/old/examples/helloworld/Makefile.am b/tests/old/examples/helloworld/Makefile.am deleted file mode 100644 index a7d1bd9c25..0000000000 --- a/tests/old/examples/helloworld/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -noinst_PROGRAMS = helloworld - -helloworld_LDADD = $(GST_OBJ_LIBS) -helloworld_CFLAGS = $(GST_OBJ_CFLAGS) diff --git a/tests/old/examples/helloworld/helloworld.c b/tests/old/examples/helloworld/helloworld.c deleted file mode 100644 index c60c547f82..0000000000 --- a/tests/old/examples/helloworld/helloworld.c +++ /dev/null @@ -1,82 +0,0 @@ -#include -#include - -static void -error_cb (GstElement * bin, GstElement * error_element, GError * error, - const gchar * debug_msg, gpointer user_data) -{ - gboolean *p_got_error = (gboolean *) user_data; - - g_printerr ("An error occured: %s\n", error->message); - - *p_got_error = TRUE; -} - -int -main (int argc, char *argv[]) -{ - GstElement *bin, *filesrc, *decoder, *audioconvert, *audioscale, *osssink; - gboolean got_error; - - gst_init (&argc, &argv); - - if (argc != 2) { - g_print ("usage: %s \n", argv[0]); - exit (-1); - } - - /* create a new bin to hold the elements */ - bin = gst_pipeline_new ("pipeline"); - g_assert (bin); - - /* create a disk reader */ - filesrc = gst_element_factory_make ("filesrc", "disk_source"); - g_assert (filesrc); - g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL); - - /* now it's time to get the decoder */ - decoder = gst_element_factory_make ("mad", "decode"); - if (!decoder) { - g_print ("could not find plugin \"mad\""); - return -1; - } - - /* create standard converters to make sure the decoded - * samples are converted into a format our audio sink - * understands (if necessary) */ - audioconvert = gst_element_factory_make ("audioconvert", "audioconvert"); - audioscale = gst_element_factory_make ("audioscale", "audioscale"); - g_assert (audioconvert && audioscale); - - /* and an audio sink */ - osssink = gst_element_factory_make ("osssink", "play_audio"); - g_assert (osssink); - - /* add objects to the main pipeline */ - gst_bin_add_many (GST_BIN (bin), filesrc, decoder, audioconvert, audioscale, - osssink, NULL); - - /* link the elements */ - if (!gst_element_link_many (filesrc, decoder, audioconvert, audioscale, - osssink, NULL)) - g_error ("gst_element_link_many() failed!"); - - /* check for errors */ - got_error = FALSE; - g_signal_connect (bin, "error", G_CALLBACK (error_cb), &got_error); - - /* start playing */ - gst_element_set_state (bin, GST_STATE_PLAYING); - - while (!got_error && gst_bin_iterate (GST_BIN (bin))) { - ; - } - - /* stop the bin */ - gst_element_set_state (bin, GST_STATE_NULL); - - /* free */ - g_object_unref (bin); - - exit (0); -} diff --git a/tests/old/examples/helloworld2/.gitignore b/tests/old/examples/helloworld2/.gitignore deleted file mode 100644 index 907ddb903c..0000000000 --- a/tests/old/examples/helloworld2/.gitignore +++ /dev/null @@ -1 +0,0 @@ -helloworld2 diff --git a/tests/old/examples/helloworld2/Makefile.am b/tests/old/examples/helloworld2/Makefile.am deleted file mode 100644 index 8e00b0ac04..0000000000 --- a/tests/old/examples/helloworld2/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -noinst_PROGRAMS = helloworld2 - -helloworld2_LDADD = $(GST_OBJ_LIBS) -helloworld2_CFLAGS = $(GST_OBJ_CFLAGS) - diff --git a/tests/old/examples/helloworld2/helloworld2.c b/tests/old/examples/helloworld2/helloworld2.c deleted file mode 100644 index 28a32789d0..0000000000 --- a/tests/old/examples/helloworld2/helloworld2.c +++ /dev/null @@ -1,133 +0,0 @@ -#include - -static void -gst_play_have_type (GstElement * typefind, GstCaps * caps, - GstElement * pipeline) -{ - GstElement *osssink; - GstElement *new_element; - GstAutoplug *autoplug; - GstElement *autobin; - GstElement *filesrc; - GstElement *cache; - - GST_DEBUG ("GstPipeline: play have type"); - - gst_element_set_state (pipeline, GST_STATE_PAUSED); - - filesrc = gst_bin_get_by_name (GST_BIN (pipeline), "disk_source"); - autobin = gst_bin_get_by_name (GST_BIN (pipeline), "autobin"); - cache = gst_bin_get_by_name (GST_BIN (autobin), "cache"); - - /* unlink_pads the typefind from the pipeline and remove it */ - gst_element_unlink_pads (cache, "src", typefind, "sink"); - gst_bin_remove (GST_BIN (autobin), typefind); - - /* and an audio sink */ - osssink = gst_element_factory_make ("osssink", "play_audio"); - g_assert (osssink != NULL); - - autoplug = gst_autoplug_factory_make ("staticrender"); - g_assert (autoplug != NULL); - - new_element = gst_autoplug_to_renderers (autoplug, caps, osssink, NULL); - - if (!new_element) { - g_print ("could not autoplug, no suitable codecs found...\n"); - exit (-1); - } - - gst_element_set_name (new_element, "new_element"); - - gst_bin_add (GST_BIN (autobin), new_element); - - g_object_set (G_OBJECT (cache), "reset", TRUE, NULL); - - gst_element_link_pads (cache, "src", new_element, "sink"); - - gst_element_set_state (pipeline, GST_STATE_PLAYING); -} - -static void -gst_play_cache_empty (GstElement * element, GstElement * pipeline) -{ - GstElement *autobin; - GstElement *filesrc; - GstElement *cache; - GstElement *new_element; - - fprintf (stderr, "have cache empty\n"); - - gst_element_set_state (pipeline, GST_STATE_PAUSED); - - filesrc = gst_bin_get_by_name (GST_BIN (pipeline), "disk_source"); - autobin = gst_bin_get_by_name (GST_BIN (pipeline), "autobin"); - cache = gst_bin_get_by_name (GST_BIN (autobin), "cache"); - new_element = gst_bin_get_by_name (GST_BIN (autobin), "new_element"); - - gst_element_unlink_pads (filesrc, "src", cache, "sink"); - gst_element_unlink_pads (cache, "src", new_element, "sink"); - gst_bin_remove (GST_BIN (autobin), cache); - gst_element_link_pads (filesrc, "src", new_element, "sink"); - - gst_element_set_state (pipeline, GST_STATE_PLAYING); - - fprintf (stderr, "done with cache_empty\n"); -} - -int -main (int argc, char *argv[]) -{ - GstElement *filesrc; - GstElement *pipeline; - GstElement *autobin; - GstElement *typefind; - GstElement *cache; - - gst_init (&argc, &argv); - - if (argc != 2) { - g_print ("usage: %s \n", argv[0]); - exit (-1); - } - - /* create a new pipeline to hold the elements */ - pipeline = gst_pipeline_new ("pipeline"); - g_assert (pipeline != NULL); - - /* create a disk reader */ - filesrc = gst_element_factory_make ("filesrc", "disk_source"); - g_assert (filesrc != NULL); - g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL); - gst_bin_add (GST_BIN (pipeline), filesrc); - - autobin = gst_bin_new ("autobin"); - cache = gst_element_factory_make ("autoplugcache", "cache"); - g_signal_connect (G_OBJECT (cache), "cache_empty", - G_CALLBACK (gst_play_cache_empty), pipeline); - - typefind = gst_element_factory_make ("typefind", "typefind"); - g_signal_connect (G_OBJECT (typefind), "have_type", - G_CALLBACK (gst_play_have_type), pipeline); - gst_bin_add (GST_BIN (autobin), cache); - gst_bin_add (GST_BIN (autobin), typefind); - - gst_element_link_pads (cache, "src", typefind, "sink"); - gst_element_add_ghost_pad (autobin, gst_element_get_pad (cache, "sink"), - "sink"); - - gst_bin_add (GST_BIN (pipeline), autobin); - gst_element_link_pads (filesrc, "src", autobin, "sink"); - - /* start playing */ - gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING); - - while (gst_bin_iterate (GST_BIN (pipeline))); - - /* stop the pipeline */ - gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL); - - gst_object_unref (GST_OBJECT (pipeline)); - - exit (0); -} diff --git a/tests/old/examples/launch/.gitignore b/tests/old/examples/launch/.gitignore deleted file mode 100644 index 6654cce4b3..0000000000 --- a/tests/old/examples/launch/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -mp3play -mp3parselaunch -*.bb -*.bbg -*.da diff --git a/tests/old/examples/launch/Makefile.am b/tests/old/examples/launch/Makefile.am deleted file mode 100644 index c1b9f298b4..0000000000 --- a/tests/old/examples/launch/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -noinst_PROGRAMS = mp3parselaunch - -mp3parselaunch_LDADD = $(GST_OBJ_LIBS) -mp3parselaunch_CFLAGS = $(GST_OBJ_CFLAGS) - -noinst_SCRIPTS = mp3play -EXTRA_DIST = mp3play diff --git a/tests/old/examples/launch/mp3parselaunch.c b/tests/old/examples/launch/mp3parselaunch.c deleted file mode 100644 index 5fe06de550..0000000000 --- a/tests/old/examples/launch/mp3parselaunch.c +++ /dev/null @@ -1,35 +0,0 @@ -#include -#include - -int -main (int argc, char *argv[]) -{ - GstElement *pipeline; - GstElement *filesrc; - GError *error = NULL; - - gst_init (&argc, &argv); - - if (argc != 2) { - g_print ("usage: %s \n", argv[0]); - return -1; - } - - pipeline = (GstElement *) - gst_parse_launch ("filesrc name=my_filesrc ! mad ! osssink", &error); - if (!pipeline) { - fprintf (stderr, "Parse error: %s", error->message); - exit (1); - } - - filesrc = gst_bin_get_by_name (GST_BIN (pipeline), "my_filesrc"); - g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL); - - gst_element_set_state (pipeline, GST_STATE_PLAYING); - - while (gst_bin_iterate (GST_BIN (pipeline))); - - gst_element_set_state (pipeline, GST_STATE_NULL); - - return 0; -} diff --git a/tests/old/examples/launch/mp3play b/tests/old/examples/launch/mp3play deleted file mode 100755 index 5577c3b851..0000000000 --- a/tests/old/examples/launch/mp3play +++ /dev/null @@ -1,4 +0,0 @@ -#! /bin/sh -for loc in "$@"; do -../../tools/gst-launch filesrc location="$loc" ! mp3parse ! mad ! osssink -done diff --git a/tests/old/examples/manual/.gitignore b/tests/old/examples/manual/.gitignore deleted file mode 100644 index 5ad13efc27..0000000000 --- a/tests/old/examples/manual/.gitignore +++ /dev/null @@ -1,39 +0,0 @@ -Makefile -Makefile.in -*.c -*.o -*.lo -*.la -.deps -.libs - -dynamic -elementget -elementmake -gnome -helloworld -helloworld2 -init -popt -queue -threads -bin -decodebin -elementcreate -elementfactory -elementlink -ghostpad -pad -playbin -query -fakesrc -typefind - -xml-mp3 -xml -xmlTest.gst -README - -*.bb -*.bbg -*.da diff --git a/tests/old/examples/manual/Makefile.am b/tests/old/examples/manual/Makefile.am deleted file mode 100644 index dd6889035b..0000000000 --- a/tests/old/examples/manual/Makefile.am +++ /dev/null @@ -1,101 +0,0 @@ -if HAVE_LIBGNOMEUI -GNOME=gnome -else -GNOME= -endif - -if GST_DISABLE_LOADSAVE -GST_LOADSAVE_SRC = -else -GST_LOADSAVE_SRC = xml-mp3 -endif - -INCLUDES = $(GST_OBJ_CFLAGS) - -#dynamic_LDADD = $(GST_OBJ_LIBS) $(LIBGNOMEUI_LIBS) -#dynamic_CFLAGS = $(GST_OBJ_CFLAGS) $(LIBGNOMEUI_CFLAGS) -gnome_LDADD = $(GST_OBJ_LIBS) $(LIBGNOMEUI_LIBS) -gnome_CFLAGS = $(GST_OBJ_CFLAGS) $(LIBGNOMEUI_CFLAGS) - -EXTRA_DIST = extract.pl - -EXAMPLES = \ - dynamic \ - $(GNOME) \ - elementcreate \ - elementmake \ - elementfactory \ - elementget \ - elementlink \ - bin \ - pad \ - ghostpad \ - helloworld \ - init \ - popt \ - query \ - threads \ - typefind \ - fakesrc \ - playbin \ - decodebin \ - $(GST_LOADSAVE_SRC) - -elementmake.c elementcreate.c elementget.c elementlink.c elementfactory.c: $(top_srcdir)/docs/manual/basics-elements.xml - $(PERL_PATH) $(srcdir)/extract.pl $@ \ - $(top_srcdir)/docs/manual/basics-elements.xml - -bin.c : $(top_srcdir)/docs/manual/basics-bins.xml - $(PERL_PATH) $(srcdir)/extract.pl $@ \ - $(top_srcdir)/docs/manual/basics-bins.xml - -pad.c ghostpad.c: $(top_srcdir)/docs/manual/basics-pads.xml - $(PERL_PATH) $(srcdir)/extract.pl $@ \ - $(top_srcdir)/docs/manual/basics-pads.xml - -gnome.c: $(top_srcdir)/docs/manual/appendix-integration.xml - $(PERL_PATH) $(srcdir)/extract.pl $@ \ - $(top_srcdir)/docs/manual/appendix-integration.xml - -helloworld.c: $(top_srcdir)/docs/manual/basics-helloworld.xml - $(PERL_PATH) $(srcdir)/extract.pl $@ \ - $(top_srcdir)/docs/manual/basics-helloworld.xml - -init.c popt.c: $(top_srcdir)/docs/manual/basics-init.xml - $(PERL_PATH) $(srcdir)/extract.pl $@ \ - $(top_srcdir)/docs/manual/basics-init.xml - -query.c: $(top_srcdir)/docs/manual/advanced-position.xml - $(PERL_PATH) $(srcdir)/extract.pl $@ \ - $(top_srcdir)/docs/manual/advanced-position.xml - -threads.c: $(top_srcdir)/docs/manual/advanced-threads.xml - $(PERL_PATH) $(srcdir)/extract.pl $@ \ - $(top_srcdir)/docs/manual/advanced-threads.xml - -typefind.c dynamic.c: $(top_srcdir)/docs/manual/advanced-autoplugging.xml - $(PERL_PATH) $(srcdir)/extract.pl $@ \ - $(top_srcdir)/docs/manual/advanced-autoplugging.xml - -fakesrc.c: $(top_srcdir)/docs/manual/advanced-dataaccess.xml - $(PERL_PATH) $(srcdir)/extract.pl $@ \ - $(top_srcdir)/docs/manual/advanced-dataaccess.xml - -playbin.c decodebin.c: $(top_srcdir)/docs/manual/highlevel-components.xml - $(PERL_PATH) $(srcdir)/extract.pl $@ \ - $(top_srcdir)/docs/manual/highlevel-components.xml - -xml-mp3.c: $(top_srcdir)/docs/manual/highlevel-xml.xml - $(PERL_PATH) $(srcdir)/extract.pl $@ \ - $(top_srcdir)/docs/manual/highlevel-xml.xml - -# we use some of the examples as testsuite apps, to verify that -# they actually run -include $(top_srcdir)/testsuite/Rules - -tests_pass = elementmake elementget init popt -tests_fail = -tests_ignore = - -noinst_PROGRAMS = $(EXAMPLES) -LDADD = $(GST_OBJ_LIBS) diff --git a/tests/old/examples/manual/extract.pl b/tests/old/examples/manual/extract.pl deleted file mode 100755 index 5c257c70a0..0000000000 --- a/tests/old/examples/manual/extract.pl +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/perl - -# extract code fragments from xml program listings -# first argument: source code file to find -# second argument: xml files to extract code from - -# main - -# decodes xml by translating & < > back to what they should be -# and also ignore -# and -sub -xml_decode ($) -{ - my $input = shift; - - $input =~ s/\&/&/g; - $input =~ s/<//g; - - if ($input =~ //) { $input = ""; } - if ($input =~ //) { $input = ""; } - - #print "Returning line $input"; - return $input; -} - -# main -my $output = shift @ARGV; - -$found = 0; -%blocks = (); - -foreach $file (@ARGV) -{ - open FILE, $file or die "Cannot open file $file"; - - while ($line = ) - { - if ($line =~ //) - { - $found = 1; - $block_id = $1; - $block = "\n/*** block $block_id from $file ***/\n"; - - print "Extracting $output block $block_id from $file\n"; - - while ($line = ) - { - if ($line =~ //) - { - last; - } - $block .= xml_decode ($line); - } - $blocks{$block_id} = $block; - } - } -} - - -if (!$found) -{ - print "Could not find $output example !\n"; - exit(1); -} - -# now output all the blocks in the right order -open OUTPUT, ">$output"; -@block_ids = keys %blocks; -foreach $block_id (sort @block_ids) -{ - print "Writing $output block $block_id\n"; - print OUTPUT $blocks{$block_id}; -} -close OUTPUT; diff --git a/tests/old/examples/mixer/.gitignore b/tests/old/examples/mixer/.gitignore deleted file mode 100644 index 0ba0585042..0000000000 --- a/tests/old/examples/mixer/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -helloworld -mixer -*.bb -*.bbg -*.da diff --git a/tests/old/examples/mixer/Makefile.am b/tests/old/examples/mixer/Makefile.am deleted file mode 100644 index a1f226a00e..0000000000 --- a/tests/old/examples/mixer/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -noinst_PROGRAMS = mixer -noinst_HEADERS = mixer.h - -mixer_LDADD = $(GST_OBJ_LIBS) -mixer_CFLAGS = $(GST_OBJ_CFLAGS) diff --git a/tests/old/examples/mixer/mixer.c b/tests/old/examples/mixer/mixer.c deleted file mode 100644 index 6a3acc119f..0000000000 --- a/tests/old/examples/mixer/mixer.c +++ /dev/null @@ -1,398 +0,0 @@ -/* - * mixer.c - stereo audio mixer - thomas@apestaart.org - * example based on helloworld - * demonstrates the adder plugin and the volume envelope plugin - * work in progress but do try it out - * - * Latest change : 28/08/2001 - * trying to adapt to incsched - * delayed start for channels > 1 - * now works by quickhacking the - * adder plugin to set - * GST_ELEMENT_COTHREAD_STOPPING - * Version : 0.5.1 - */ - -#include -#include -#include "mixer.h" -#include - -/*#define WITH_BUG */ -/*#define WITH_BUG2 */ -/*#define DEBUG */ -/*#define AUTOPLUG * define if you want autoplugging of input channels * */ -/* function prototypes */ - -input_channel_t *create_input_channel (int id, char *location); -void destroy_input_channel (input_channel_t * pipe); -void env_register_cp (GstElement * volenv, double cp_time, double cp_level); - - -gboolean playing; - - -/* eos will be called when the src element has an end of stream */ -void -eos (GstElement * element) -{ - g_print ("have eos, quitting ?\n"); - -/* playing = FALSE; */ -} - -G_GNUC_UNUSED static GstCaps * -gst_play_type_find (GstBin * bin, GstElement * element) -{ - GstElement *typefind; - GstElement *pipeline; - GstCaps *caps = NULL; - - GST_DEBUG ("GstPipeline: typefind for element \"%s\"", - GST_ELEMENT_NAME (element)); - - pipeline = gst_pipeline_new ("autoplug_pipeline"); - - typefind = gst_element_factory_make ("typefind", "typefind"); - g_return_val_if_fail (typefind != NULL, FALSE); - - gst_pad_link (gst_element_get_pad (element, "src"), - gst_element_get_pad (typefind, "sink")); - gst_bin_add (bin, typefind); - gst_bin_add (GST_BIN (pipeline), GST_ELEMENT (bin)); - - gst_element_set_state (pipeline, GST_STATE_PLAYING); - - /* push a buffer... the have_type signal handler will set the found flag */ - gst_bin_iterate (GST_BIN (pipeline)); - - gst_element_set_state (pipeline, GST_STATE_NULL); - - caps = gst_pad_get_caps (gst_element_get_pad (element, "src")); - - gst_pad_unlink (gst_element_get_pad (element, "src"), - gst_element_get_pad (typefind, "sink")); - gst_bin_remove (bin, typefind); - gst_bin_remove (GST_BIN (pipeline), GST_ELEMENT (bin)); - gst_object_unref (GST_OBJECT (typefind)); - gst_object_unref (GST_OBJECT (pipeline)); - - return caps; -} - -int -main (int argc, char *argv[]) -{ - int i, j; - int num_channels; - - char buffer[20]; - - GList *input_channels; /* structure holding all the input channels */ - - input_channel_t *channel_in; - - GstElement *main_bin; - GstElement *adder; - GstElement *audiosink; - - GstPad *pad; /* to request pads for the adder */ - - gst_init (&argc, &argv); - - if (argc == 1) { - g_print ("usage: %s <...>\n", argv[0]); - exit (-1); - } - num_channels = argc - 1; - - /* set up output channel and main bin */ - - /* create adder */ - adder = gst_element_factory_make ("adder", "adderel"); - - /* create an audio sink */ - audiosink = gst_element_factory_make ("esdsink", "play_audio"); - - /* create main bin */ - main_bin = gst_pipeline_new ("bin"); - - /* link adder and output to bin */ - GST_INFO ("main: adding adder to bin"); - gst_bin_add (GST_BIN (main_bin), adder); - GST_INFO ("main: adding audiosink to bin"); - gst_bin_add (GST_BIN (main_bin), audiosink); - - /* link adder and audiosink */ - - gst_pad_link (gst_element_get_pad (adder, "src"), - gst_element_get_pad (audiosink, "sink")); - - /* start looping */ - input_channels = NULL; - - for (i = 1; i < argc; ++i) { - printf ("Opening channel %d from file %s...\n", i, argv[i]); - channel_in = create_input_channel (i, argv[i]); - input_channels = g_list_append (input_channels, channel_in); - - if (i > 1) - gst_element_set_state (main_bin, GST_STATE_PAUSED); - gst_bin_add (GST_BIN (main_bin), channel_in->pipe); - - /* request pads and link to adder */ - GST_INFO ("requesting pad\n"); - pad = gst_element_get_request_pad (adder, "sink%d"); - printf ("\tGot new adder sink pad %s\n", gst_pad_get_name (pad)); - sprintf (buffer, "channel%d", i); - gst_pad_link (gst_element_get_pad (channel_in->pipe, buffer), pad); - - /* register a volume envelope */ - printf ("\tregistering volume envelope...\n"); - - /* - * this is the volenv : - * each song gets a slot of 5 seconds, with a 5 second fadeout - * at the end of that, all audio streams play simultaneously - * at a level ensuring no distortion - * example for three songs : - * song1 : starts at full level, plays 5 seconds, faded out at 10 seconds, - * sleep until 25, fade to end level at 30 - * song2 : starts silent, fades in at 5 seconds, full blast at 10 seconds, - * full level until 15, faded out at 20, sleep until 25, fade to end at 30 - * song3 : starts muted, fades in from 15, full at 20, until 25, fade to end level - */ - - if (i == 1) { - /* first song gets special treatment for end style */ - env_register_cp (channel_in->volenv, 0.0, 1.0); - } else { - env_register_cp (channel_in->volenv, 0.0, 0.0000001); /* start muted */ - env_register_cp (channel_in->volenv, i * 10.0 - 15.0, 0.0000001); /* start fade in */ - env_register_cp (channel_in->volenv, i * 10.0 - 10.0, 1.0); - } - env_register_cp (channel_in->volenv, i * 10.0 - 5.0, 1.0); /* end of full level */ - - if (i != num_channels) { - env_register_cp (channel_in->volenv, i * 10.0, 0.0000001); /* fade to black */ - env_register_cp (channel_in->volenv, num_channels * 10.0 - 5.0, 0.0000001); /* start fade in */ - } - env_register_cp (channel_in->volenv, num_channels * 10.0, 1.0 / num_channels); /* to end level */ - -#ifndef GST_DISABLE_LOADSAVE - gst_xml_write_file (GST_ELEMENT (main_bin), fopen ("mixer.xml", "w")); -#endif - - /* start playing */ - gst_element_set_state (main_bin, GST_STATE_PLAYING); - - /* write out the schedule */ - gst_scheduler_show (GST_ELEMENT_SCHED (main_bin)); - playing = TRUE; - - j = 0; - /*printf ("main: start iterating from 0"); */ - while (playing && j < 100) { -/* printf ("main: iterating %d\n", j); */ - gst_bin_iterate (GST_BIN (main_bin)); - /*fprintf(stderr,"after iterate()\n"); */ - ++j; - } - } - printf ("main: all the channels are open\n"); - while (playing) { - gst_bin_iterate (GST_BIN (main_bin)); - /*fprintf(stderr,"after iterate()\n"); */ - } - /* stop the bin */ - gst_element_set_state (main_bin, GST_STATE_NULL); - - while (input_channels) { - destroy_input_channel (input_channels->data); - input_channels = g_list_next (input_channels); - } - g_list_free (input_channels); - - gst_object_unref (GST_OBJECT (audiosink)); - - gst_object_unref (GST_OBJECT (main_bin)); - - exit (0); -} - -input_channel_t * -create_input_channel (int id, char *location) -{ - /* create an input channel, reading from location - * return a pointer to the channel - * return NULL if failed - */ - - input_channel_t *channel; - - char buffer[20]; /* hold the names */ - -/* GstAutoplug *autoplug; - GstCaps *srccaps; */ - GstElement *new_element; - GstElement *decoder; - - GST_DEBUG ("c_i_p : creating channel with id %d for file %s", id, location); - - /* allocate channel */ - - channel = (input_channel_t *) malloc (sizeof (input_channel_t)); - if (channel == NULL) { - printf ("create_input_channel : could not allocate memory for channel !\n"); - return NULL; - } - - /* create channel */ - - GST_DEBUG ("c_i_p : creating pipeline"); - - sprintf (buffer, "pipeline%d", id); - channel->pipe = gst_bin_new (buffer); - g_assert (channel->pipe != NULL); - - /* create elements */ - - GST_DEBUG ("c_i_p : creating filesrc"); - - sprintf (buffer, "filesrc%d", id); - channel->filesrc = gst_element_factory_make ("filesrc", buffer); - g_assert (channel->filesrc != NULL); - - GST_DEBUG ("c_i_p : setting location"); - g_object_set (G_OBJECT (channel->filesrc), "location", location, NULL); - - /* add filesrc to the bin before autoplug */ - gst_bin_add (GST_BIN (channel->pipe), channel->filesrc); - - /* link signal to eos of filesrc */ - g_signal_connect (G_OBJECT (channel->filesrc), "eos", G_CALLBACK (eos), NULL); - - -#ifdef DEBUG - printf ("DEBUG : c_i_p : creating volume envelope\n"); -#endif - - sprintf (buffer, "volenv%d", id); - channel->volenv = gst_element_factory_make ("volenv", buffer); - g_assert (channel->volenv != NULL); - - /* autoplug the pipe */ - -#ifdef DEBUG - printf ("DEBUG : c_i_p : getting srccaps\n"); -#endif - -#ifdef WITH_BUG - srccaps = gst_play_type_find (GST_BIN (channel->pipe), channel->filesrc); -#endif -#ifdef WITH_BUG2 - { - GstElement *pipeline; - - pipeline = gst_pipeline_new ("autoplug_pipeline"); - - gst_bin_add (GST_BIN (pipeline), channel->pipe); - gst_element_set_state (pipeline, GST_STATE_PLAYING); - gst_element_set_state (pipeline, GST_STATE_NULL); - gst_bin_remove (GST_BIN (pipeline), channel->pipe); - - } -#endif - -#ifdef AUTOPLUG - if (!srccaps) { - g_print ("could not autoplug, unknown media type...\n"); - exit (-1); - } -#ifdef DEBUG - printf ("DEBUG : c_i_p : creating autoplug\n"); -#endif - - autoplug = gst_autoplug_factory_make ("static"); - g_assert (autoplug != NULL); - -#ifdef DEBUG - printf ("DEBUG : c_i_p : autoplugging\n"); -#endif - - new_element = gst_autoplug_to_caps (autoplug, srccaps, - gst_caps_new ("audio/raw", NULL), NULL); - - if (!new_element) { - g_print ("could not autoplug, no suitable codecs found...\n"); - exit (-1); - } -#else - - new_element = gst_bin_new ("autoplug_bin"); - - /* static plug, use mad plugin and assume mp3 input */ - printf ("using static plugging for input channel\n"); - decoder = gst_element_factory_make ("mad", "mpg123"); - if (!decoder) { - fprintf (stderr, "Could not get a decoder element !\n"); - exit (1); - } - gst_bin_add (GST_BIN (new_element), decoder); - - gst_element_add_ghost_pad (new_element, - gst_element_get_pad (decoder, "sink"), "sink"); - gst_element_add_ghost_pad (new_element, - gst_element_get_pad (decoder, "src"), "src_00"); - -#endif -#ifndef GST_DISABLE_LOADSAVE - gst_xml_write_file (GST_ELEMENT (new_element), fopen ("mixer.gst", "w")); -#endif - - gst_bin_add (GST_BIN (channel->pipe), channel->volenv); - gst_bin_add (GST_BIN (channel->pipe), new_element); - - gst_element_link_pads (channel->filesrc, "src", new_element, "sink"); - gst_element_link_pads (new_element, "src_00", channel->volenv, "sink"); - - /* add a ghost pad */ - sprintf (buffer, "channel%d", id); - gst_element_add_ghost_pad (channel->pipe, - gst_element_get_pad (channel->volenv, "src"), buffer); - - -#ifdef DEBUG - printf ("DEBUG : c_i_p : end function\n"); -#endif - - return channel; -} - -void -destroy_input_channel (input_channel_t * channel) -{ - /* - * destroy an input channel - */ - -#ifdef DEBUG - printf ("DEBUG : d_i_p : start\n"); -#endif - - /* destroy elements */ - - gst_object_unref (GST_OBJECT (channel->pipe)); - - free (channel); -} - -void -env_register_cp (GstElement * volenv, double cp_time, double cp_level) -{ - char buffer[30]; - - sprintf (buffer, "%f:%f", cp_time, cp_level); - g_object_set (G_OBJECT (volenv), "controlpoint", buffer, NULL); - -} diff --git a/tests/old/examples/mixer/mixer.h b/tests/old/examples/mixer/mixer.h deleted file mode 100644 index 4cae18e305..0000000000 --- a/tests/old/examples/mixer/mixer.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * mixer.h header file - * thomas@apestaart.org - */ - -typedef struct -{ - GstElement *pipe, *filesrc, *volenv; - - char *location; - int channel_id; -} input_channel_t; diff --git a/tests/old/examples/pingpong/.gitignore b/tests/old/examples/pingpong/.gitignore deleted file mode 100644 index 53dd624638..0000000000 --- a/tests/old/examples/pingpong/.gitignore +++ /dev/null @@ -1,12 +0,0 @@ -Makefile -Makefile.in -*.o -*.lo -*.la -.deps -.libs - -pingpong -*.bb -*.bbg -*.da diff --git a/tests/old/examples/pingpong/Makefile.am b/tests/old/examples/pingpong/Makefile.am deleted file mode 100644 index feaa456b6e..0000000000 --- a/tests/old/examples/pingpong/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -noinst_PROGRAMS = pingpong - -pingpong_LDADD = $(GST_OBJ_LIBS) -pingpong_CFLAGS = $(GST_OBJ_CFLAGS) - diff --git a/tests/old/examples/pingpong/pingpong.c b/tests/old/examples/pingpong/pingpong.c deleted file mode 100644 index 59f7be64f2..0000000000 --- a/tests/old/examples/pingpong/pingpong.c +++ /dev/null @@ -1,99 +0,0 @@ -/* GStreamer - * Copyright (C) <1999> Erik Walthinsen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include - -static GstElement * -make_bin (gint count) -{ - GstElement *bin; - GstElement *src; - char *name; - - name = g_strdup_printf ("bin%d", count); - bin = gst_bin_new (name); - g_free (name); - - name = g_strdup_printf ("fakesrc%d", count); - src = gst_element_factory_make ("fakesrc", name); - g_free (name); - - gst_bin_add (GST_BIN (bin), src); - - gst_element_add_ghost_pad (bin, gst_element_get_pad (src, "src"), "src"); - - return bin; -} - -gint -main (gint argc, gchar * argv[]) -{ - GstElement *pipeline; - GstElement *aggregator, *sink; - GstElement *bin1, *bin2; - GstPad *pad1, *pad2; - gint i; - - gst_init (&argc, &argv); - - pipeline = gst_pipeline_new ("main"); - g_signal_connect (pipeline, "deep_notify", - G_CALLBACK (gst_element_default_deep_notify), NULL); - - aggregator = gst_element_factory_make ("aggregator", "mixer"); - sink = gst_element_factory_make ("fakesink", "sink"); - - gst_bin_add (GST_BIN (pipeline), aggregator); - gst_bin_add (GST_BIN (pipeline), sink); - - gst_element_link_pads (aggregator, "src", sink, "sink"); - - bin1 = make_bin (1); - pad1 = gst_element_get_request_pad (aggregator, "sink%d"); - gst_pad_link (gst_element_get_pad (bin1, "src"), pad1); - gst_bin_add (GST_BIN (pipeline), bin1); - - bin2 = make_bin (2); - pad2 = gst_element_get_request_pad (aggregator, "sink%d"); - gst_pad_link (gst_element_get_pad (bin2, "src"), pad2); - gst_bin_add (GST_BIN (pipeline), bin2); - - gst_element_set_state (pipeline, GST_STATE_PLAYING); - i = 2; - while (i--) - gst_bin_iterate (GST_BIN (pipeline)); - - g_print ("pause bin1\n"); - gst_element_set_state (bin1, GST_STATE_PAUSED); - - i = 4; - while (i--) - gst_bin_iterate (GST_BIN (pipeline)); - - g_print ("playing bin1\n"); - gst_element_set_state (bin1, GST_STATE_PLAYING); - - i = 4; - while (i--) - gst_bin_iterate (GST_BIN (pipeline)); - - gst_element_set_state (pipeline, GST_STATE_NULL); - - return 0; -} diff --git a/tests/old/examples/plugins/.gitignore b/tests/old/examples/plugins/.gitignore deleted file mode 100644 index 1eec6ddd7c..0000000000 --- a/tests/old/examples/plugins/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -Makefile -Makefile.in -*.o -*.lo -*.la -.deps -.libs -*.bb -*.bbg -*.da diff --git a/tests/old/examples/plugins/Makefile.am b/tests/old/examples/plugins/Makefile.am deleted file mode 100644 index 16d260df08..0000000000 --- a/tests/old/examples/plugins/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ - -plugin_LTLIBRARIES = libgstexample.la - -libgstexample_la_SOURCES = example.c -libgstexample_la_CFLAGS = $(GST_OBJ_CFLAGS) -libgstexample_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) - -noinst_HEADERS = example.h - -## ... but we don't want them installed so we override the install target -install: - @true diff --git a/tests/old/examples/plugins/example.c b/tests/old/examples/plugins/example.c deleted file mode 100644 index 1f83b4e08b..0000000000 --- a/tests/old/examples/plugins/example.c +++ /dev/null @@ -1,426 +0,0 @@ -/* GStreamer - * Copyright (C) <1999> Erik Walthinsen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* First, include the header file for the plugin, to bring in the - * object definition and other useful things. - */ -#include -#include "example.h" - -/* The ElementDetails structure gives a human-readable description of the - * plugin, as well as author and version data. Use the GST_ELEMENT_DETAILS - * macro when defining it. - */ -static GstElementDetails example_details = -GST_ELEMENT_DETAILS ("An example plugin", - "Example/FirstExample", - "Shows the basic structure of a plugin", - "your name "); - -/* These are the signals that this element can fire. They are zero- - * based because the numbers themselves are private to the object. - * LAST_SIGNAL is used for initialization of the signal array. - */ -enum -{ - ASDF, - /* FILL ME */ - LAST_SIGNAL -}; - -/* Arguments are identified the same way, but cannot be zero, so you - * must leave the ARG_0 entry in as a placeholder. - */ -enum -{ - ARG_0, - ARG_ACTIVE - /* FILL ME */ -}; - -/* The PadFactory structures describe what pads the element has or - * can have. They can be quite complex, but for this example plugin - * they are rather simple. - */ -GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", /* The name of the pad */ - GST_PAD_SINK, /* Direction of the pad */ - GST_PAD_ALWAYS, /* The pad exists for every instance */ - GST_STATIC_CAPS ("unknown/unknown, " /* The MIME media type */ - "foo:int=1, " /* an integer property */ - "bar:boolean=true, " /* a boolean property */ - "baz:int={ 1, 3 }" /* a list of values */ - ) - ); - -/* This factory is much simpler, and defines the source pad. */ -GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS ("unknown/unknown") - ); - - -/* A number of function prototypes are given so we can refer to them later. */ -static void gst_example_class_init (GstExampleClass * klass); -static void gst_example_init (GstExample * example); - -static void gst_example_chain (GstPad * pad, GstData * _data); - -static void gst_example_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec); -static void gst_example_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec); -static GstElementStateReturn gst_example_change_state (GstElement * element); - -/* The parent class pointer needs to be kept around for some object - * operations. - */ -static GstElementClass *parent_class = NULL; - -/* This array holds the ids of the signals registered for this object. - * The array indexes are based on the enum up above. - */ -static guint gst_example_signals[LAST_SIGNAL] = { 0 }; - -/* This function is used to register and subsequently return the type - * identifier for this object class. On first invocation, it will - * register the type, providing the name of the class, struct sizes, - * and pointers to the various functions that define the class. - */ -GType -gst_example_get_type (void) -{ - static GType example_type = 0; - - if (!example_type) { - static const GTypeInfo example_info = { - sizeof (GstExampleClass), - NULL, - NULL, - (GClassInitFunc) gst_example_class_init, - NULL, - NULL, - sizeof (GstExample), - 0, - (GInstanceInitFunc) gst_example_init, - }; - - example_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstExample", &example_info, - 0); - } - return example_type; -} - -/* In order to create an instance of an object, the class must be - * initialized by this function. GObject will take care of running - * it, based on the pointer to the function provided above. - */ -static void -gst_example_class_init (GstExampleClass * klass) -{ - /* Class pointers are needed to supply pointers to the private - * implementations of parent class methods. - */ - GObjectClass *gobject_class; - GstElementClass *gstelement_class; - - /* Since the example class contains the parent classes, you can simply - * cast the pointer to get access to the parent classes. - */ - gobject_class = (GObjectClass *) klass; - gstelement_class = (GstElementClass *) klass; - - /* The parent class is needed for class method overrides. */ - parent_class = g_type_class_ref (GST_TYPE_ELEMENT); - - /* Here we add an argument to the object. This argument is an integer, - * and can be both read and written. - */ - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ACTIVE, g_param_spec_int ("active", "active", "active", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */ - - /* Here we add a signal to the object. This is a very useless signal - * called asdf. The signal will also pass a pointer to the listeners - * which happens to be the example element itself */ - gst_example_signals[ASDF] = - g_signal_new ("asdf", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GstExampleClass, asdf), NULL, NULL, - g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, GST_TYPE_EXAMPLE); - - - /* The last thing is to provide the functions that implement get and set - * of arguments. - */ - gobject_class->set_property = gst_example_set_property; - gobject_class->get_property = gst_example_get_property; - - /* we also override the default state change handler with our own - * implementation */ - gstelement_class->change_state = gst_example_change_state; - /* We can now provide the details for this element, that we defined earlier. */ - gst_element_class_set_details (gstelement_class, &example_details); - /* The pad templates can be easily generated from the factories above, - * and then added to the list of padtemplates for the class. - */ - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&sink_template)); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&src_template)); -} - -/* This function is responsible for initializing a specific instance of - * the plugin. - */ -static void -gst_example_init (GstExample * example) -{ - /* First we create the sink pad, which is the input to the element. - * We will use the template constructed by the factory. - */ - example->sinkpad = - gst_pad_new_from_template (gst_static_pad_template_get (&sink_template), - "sink"); - /* Setting the chain function allows us to supply the function that will - * actually be performing the work. Without this, the element would do - * nothing, with undefined results (assertion failures and such). - */ - gst_pad_set_chain_function (example->sinkpad, gst_example_chain); - /* We then must add this pad to the element's list of pads. The base - * element class manages the list of pads, and provides accessors to it. - */ - gst_element_add_pad (GST_ELEMENT (example), example->sinkpad); - - /* The src pad, the output of the element, is created and registered - * in the same way, with the exception of the chain function. Source - * pads don't have chain functions, because they can't accept buffers, - * they only produce them. - */ - example->srcpad = - gst_pad_new_from_template (gst_static_pad_template_get (&src_template), - "src"); - gst_element_add_pad (GST_ELEMENT (example), example->srcpad); - - /* Initialization of element's private variables. */ - example->active = FALSE; -} - -/* The chain function is the heart of the element. It's where all the - * work is done. It is passed a pointer to the pad in question, as well - * as the buffer provided by the peer element. - */ -static void -gst_example_chain (GstPad * pad, GstData * _data) -{ - GstBuffer *buf = GST_BUFFER (_data); - GstExample *example; - GstBuffer *outbuf; - - /* Some of these checks are of dubious value, since if there were not - * already true, the chain function would never be called. - */ - g_return_if_fail (pad != NULL); - g_return_if_fail (GST_IS_PAD (pad)); - g_return_if_fail (buf != NULL); - - /* We need to get a pointer to the element this pad belongs to. */ - example = GST_EXAMPLE (gst_pad_get_parent (pad)); - - /* A few more sanity checks to make sure that the element that owns - * this pad is the right kind of element, in case something got confused. - */ - g_return_if_fail (example != NULL); - g_return_if_fail (GST_IS_EXAMPLE (example)); - - /* If we are supposed to be doing something, here's where it happens. */ - if (example->active) { - /* In this example we're going to copy the buffer to another one, - * so we need to allocate a new buffer first. */ - outbuf = gst_buffer_new (); - - /* We need to copy the size and offset of the buffer at a minimum. */ - GST_BUFFER_SIZE (outbuf) = GST_BUFFER_SIZE (buf); - GST_BUFFER_OFFSET (outbuf) = GST_BUFFER_OFFSET (buf); - - /* Then allocate the memory for the new buffer */ - GST_BUFFER_DATA (outbuf) = (guchar *) g_malloc (GST_BUFFER_SIZE (outbuf)); - - /* Then copy the data in the incoming buffer into the new buffer. */ - memcpy (GST_BUFFER_DATA (outbuf), GST_BUFFER_DATA (buf), - GST_BUFFER_SIZE (outbuf)); - - /* we don't need the incomming buffer anymore so we unref it. When we are - * the last plugin with a handle to the buffer, its memory will be freed */ - gst_buffer_unref (buf); - - /* When we're done with the buffer, we push it on to the next element - * in the pipeline, through the element's source pad, which is stored - * in the element's structure. - */ - gst_pad_push (example->srcpad, GST_DATA (outbuf)); - - /* For fun we'll emit our useless signal here */ - g_signal_emit (G_OBJECT (example), gst_example_signals[ASDF], 0, example); - - /* If we're not doing something, just send the original incoming buffer. */ - } else { - gst_pad_push (example->srcpad, GST_DATA (buf)); - } -} - -/* Properties are part of the GLib+ object system, and these functions - * enable the element to respond to various properties. - */ -static void -gst_example_set_property (GObject * object, guint prop_id, const GValue * value, - GParamSpec * pspec) -{ - GstExample *example; - - g_return_if_fail (GST_IS_EXAMPLE (object)); - - /* Get a pointer of the right type. */ - example = GST_EXAMPLE (object); - - /* Check the argument id to see which argument we're setting. */ - switch (prop_id) { - case ARG_ACTIVE: - /* Here we simply copy the value of the argument to our private - * storage. More complex operations can be done, but beware that - * they may occur at any time, possibly even while your chain function - * is running, if you are using threads. - */ - example->active = g_value_get_int (value); - g_print ("example: set active to %d\n", example->active); - break; - default: - break; - } -} - -/* The set function is simply the inverse of the get fuction. */ -static void -gst_example_get_property (GObject * object, guint prop_id, GValue * value, - GParamSpec * pspec) -{ - GstExample *example; - - g_return_if_fail (GST_IS_EXAMPLE (object)); - - example = GST_EXAMPLE (object); - - switch (prop_id) { - case ARG_ACTIVE: - g_value_set_int (value, example->active); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -/* This is the state change function that will be called when - * the element goes through the different state changes. - * The plugin can prepare itself and its internal data structures - * in the various state transitions. - */ -static GstElementStateReturn -gst_example_change_state (GstElement * element) -{ - GstExample *example; - - /* cast to our plugin */ - example = GST_EXAMPLE (element); - - /* we perform our actions based on the state transition - * of the element */ - switch (GST_STATE_TRANSITION (element)) { - /* The NULL to READY transition is used to - * create threads (if any), and/or open devices */ - case GST_STATE_NULL_TO_READY: - break; - case GST_STATE_READY_TO_PAUSED: - break; - /* In the PAUSED to PLAYING state, the element should - * prepare itself for operation or continue after a PAUSE */ - case GST_STATE_PAUSED_TO_PLAYING: - break; - /* In the PLAYING to PAUSED state, the element should - * PAUSE itself and make sure it can resume operation */ - case GST_STATE_PLAYING_TO_PAUSED: - break; - /* In the PAUSED to READY state, the element should reset - * its internal state and close any devices. */ - case GST_STATE_PAUSED_TO_READY: - break; - /* The element should free all resources, terminate threads - * and put itself into its initial state again */ - case GST_STATE_READY_TO_NULL: - break; - } - - /* Then we call the parent state change handler */ - return parent_class->change_state (element); -} - - -/* This is the entry into the plugin itself. When the plugin loads, - * this function is called to register everything that the plugin provides. - */ -static gboolean -plugin_init (GstPlugin * plugin) -{ - /* We need to register each element we provide with the plugin. This consists - * of the name of the element, a rank that gives the importance of the element - * when compared to similar plugins and the GType identifier. - */ - if (!gst_element_register (plugin, "example", GST_RANK_MARGINAL, - GST_TYPE_EXAMPLE)) - return FALSE; - - /* Now we can return successfully. */ - return TRUE; - - /* At this point, the GStreamer core registers the plugin, its - * elementfactories, padtemplates, etc., for use in your application. - */ -} - -/* This structure describes the plugin to the system for dynamically loading - * plugins, so that the version number and name can be checked in a uniform - * way. - * - * The symbol pointing to this structure is the only symbol looked up when - * loading the plugin. - */ -GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, /* The major version of the core that this was built with */ - GST_VERSION_MINOR, /* The minor version of the core that this was built with */ - "example", /* The name of the plugin. This must be unique: plugins with - * the same name will be assumed to be identical, and only - * one will be loaded. */ - "an example plugin", /* a short description of the plugin in English */ - plugin_init, /* Pointer to the initialisation function for the plugin. */ - "0.1", /* The version number of the plugin */ - "LGPL", /* effective license the plugin can be shipped with. Must be - * valid for all libraries it links to, too. */ - "my nifty plugin package", - /* package this plugin belongs to. */ - "http://www.mydomain.com" - /* originating URL for this plugin. This is the place to look - * for updates, information and so on. */ - ); diff --git a/tests/old/examples/plugins/example.h b/tests/old/examples/plugins/example.h deleted file mode 100644 index 33003bcc75..0000000000 --- a/tests/old/examples/plugins/example.h +++ /dev/null @@ -1,87 +0,0 @@ -/* GStreamer - * Copyright (C) <1999> Erik Walthinsen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - -#ifndef __GST_EXAMPLE_H__ -#define __GST_EXAMPLE_H__ - -#include - -G_BEGIN_DECLS - -/* This is the definition of the element's object structure. */ -typedef struct _GstExample GstExample; - -/* The structure itself is derived from GstElement, as can be seen by the - * fact that there's a complete instance of the GstElement structure at - * the beginning of the object. This allows the element to be cast to - * an Element or even an Object. - */ -struct _GstExample { - GstElement element; - - /* We need to keep track of our pads, so we do so here. */ - GstPad *sinkpad,*srcpad; - - /* We'll use this to decide whether to do anything to the data we get. */ - gboolean active; -}; - -/* The other half of the object is its class. The class also derives from - * the same parent, though it must be the class structure this time. - * Function pointers for polymophic methods and signals are placed in this - * structure. */ -typedef struct _GstExampleClass GstExampleClass; - -struct _GstExampleClass { - GstElementClass parent_class; - - /* signals */ - void (*asdf) (GstElement *element, GstExample *example); -}; - -/* Five standard preprocessing macros are used in the GLib object system. - * The first uses the object's _get_type function to return the GType - * of the object. - */ -#define GST_TYPE_EXAMPLE \ - (gst_example_get_type()) -/* The second is a checking cast to the correct type. If the object passed - * is not the right type, a warning will be generated on stderr. - */ -#define GST_EXAMPLE(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_EXAMPLE,GstExample)) -/* The third is a checking cast of the class instead of the object. */ -#define GST_EXAMPLE_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_EXAMPLE,GstExampleClass)) -/* The last two simply check to see if the passed pointer is an object or - * class of the correct type. */ -#define GST_IS_EXAMPLE(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_EXAMPLE)) -#define GST_IS_EXAMPLE_CLASS(obj) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_EXAMPLE)) - -/* This is the only prototype needed, because it is used in the above - * GST_TYPE_EXAMPLE macro. - */ -GType gst_example_get_type(void); - -G_END_DECLS - -#endif /* __GST_EXAMPLE_H__ */ diff --git a/tests/old/examples/queue/.gitignore b/tests/old/examples/queue/.gitignore deleted file mode 100644 index 80ea866872..0000000000 --- a/tests/old/examples/queue/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -queue -*.bb -*.bbg -*.da diff --git a/tests/old/examples/queue/Makefile.am b/tests/old/examples/queue/Makefile.am deleted file mode 100644 index 9d668392a3..0000000000 --- a/tests/old/examples/queue/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -noinst_PROGRAMS = queue - -queue_LDADD = $(GST_OBJ_LIBS) -queue_CFLAGS = $(GST_OBJ_CFLAGS) - diff --git a/tests/old/examples/queue/queue.c b/tests/old/examples/queue/queue.c deleted file mode 100644 index 67b8a2321f..0000000000 --- a/tests/old/examples/queue/queue.c +++ /dev/null @@ -1,56 +0,0 @@ -#include -#include - -int -main (int argc, char *argv[]) -{ - GstElement *filesrc, *osssink, *parse, *decode, *queue; - GstElement *pipeline; - GstElement *thread; - - gst_init (&argc, &argv); - - if (argc != 2) { - g_print ("usage: %s \n", argv[0]); - exit (-1); - } - - /* create a new thread to hold the elements */ - thread = gst_thread_new ("thread"); - g_assert (thread != NULL); - - /* create a new pipeline to hold the elements */ - pipeline = gst_pipeline_new ("pipeline"); - g_assert (pipeline != NULL); - - /* create a disk reader */ - filesrc = gst_element_factory_make ("filesrc", "disk_source"); - g_assert (filesrc != NULL); - g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL); - - parse = gst_element_factory_make ("mp3parse", "parse"); - decode = gst_element_factory_make ("mad", "decode"); - - queue = gst_element_factory_make ("queue", "queue"); - - /* and an audio sink */ - osssink = gst_element_factory_make ("osssink", "play_audio"); - g_assert (osssink != NULL); - - /* add objects to the main pipeline */ - gst_bin_add_many (GST_BIN (pipeline), filesrc, parse, decode, queue, NULL); - - gst_bin_add (GST_BIN (thread), osssink); - gst_bin_add (GST_BIN (pipeline), thread); - - gst_element_link_many (filesrc, parse, decode, queue, osssink, NULL); - - /* start playing */ - gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING); - - while (gst_bin_iterate (GST_BIN (pipeline))); - - gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL); - - exit (0); -} diff --git a/tests/old/examples/queue2/.gitignore b/tests/old/examples/queue2/.gitignore deleted file mode 100644 index fcbde93534..0000000000 --- a/tests/old/examples/queue2/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -queue2 -*.bb -*.bbg -*.da diff --git a/tests/old/examples/queue2/Makefile.am b/tests/old/examples/queue2/Makefile.am deleted file mode 100644 index 5b2aa36b49..0000000000 --- a/tests/old/examples/queue2/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -noinst_PROGRAMS = queue2 - -queue2_LDADD = $(GST_OBJ_LIBS) -queue2_CFLAGS = $(GST_OBJ_CFLAGS) - diff --git a/tests/old/examples/queue2/queue2.c b/tests/old/examples/queue2/queue2.c deleted file mode 100644 index 7d5862600b..0000000000 --- a/tests/old/examples/queue2/queue2.c +++ /dev/null @@ -1,81 +0,0 @@ -#include -#include - -gboolean playing; - -/* eos will be called when the src element has an end of stream */ -void -eos (GstElement * element, gpointer data) -{ - g_print ("have eos, quitting\n"); - - playing = FALSE; -} - -int -main (int argc, char *argv[]) -{ - GstElement *filesrc, *osssink, *queue; - GstElement *pipeline; - GstElement *thread; - - gst_init (&argc, &argv); - - if (argc != 2) { - g_print ("usage: %s \n", argv[0]); - exit (-1); - } - - /* create a new thread to hold the elements */ - thread = gst_thread_new ("thread"); - g_assert (thread != NULL); - - /* create a new bin to hold the elements */ - pipeline = gst_pipeline_new ("pipeline"); - g_assert (pipeline != NULL); - - /* create a disk reader */ - filesrc = gst_element_factory_make ("filesrc", "disk_source"); - g_assert (filesrc != NULL); - g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL); - g_signal_connect (G_OBJECT (filesrc), "eos", G_CALLBACK (eos), thread); - - queue = gst_element_factory_make ("queue", "queue"); - - /* and an audio sink */ - osssink = gst_element_factory_make ("osssink", "play_audio"); - g_assert (osssink != NULL); - - /* add objects to the main pipeline */ - /* - gst_pipeline_add_src(GST_PIPELINE(pipeline), filesrc); - gst_pipeline_add_sink(GST_PIPELINE(pipeline), queue); - - gst_bin_add(GST_BIN(thread), osssink); - - gst_pad_link(gst_element_get_pad(queue,"src"), - gst_element_get_pad(osssink,"sink")); - - if (!gst_pipeline_autoplug(GST_PIPELINE(pipeline))) { - g_print("cannot autoplug pipeline\n"); - exit(-1); - } - */ - - gst_bin_add (GST_BIN (pipeline), thread); - - /* make it ready */ - gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_READY); - /* start playing */ - gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING); - - playing = TRUE; - - while (playing) { - gst_bin_iterate (GST_BIN (pipeline)); - } - - gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL); - - exit (0); -} diff --git a/tests/old/examples/queue3/.gitignore b/tests/old/examples/queue3/.gitignore deleted file mode 100644 index 7e70b37ffc..0000000000 --- a/tests/old/examples/queue3/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -queue3 -*.bb -*.bbg -*.da diff --git a/tests/old/examples/queue3/Makefile.am b/tests/old/examples/queue3/Makefile.am deleted file mode 100644 index f229f3f152..0000000000 --- a/tests/old/examples/queue3/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -noinst_PROGRAMS = queue3 - -queue3_LDADD = $(GST_OBJ_LIBS) -queue3_CFLAGS = $(GST_OBJ_CFLAGS) - diff --git a/tests/old/examples/queue3/queue3.c b/tests/old/examples/queue3/queue3.c deleted file mode 100644 index 3a17854d7d..0000000000 --- a/tests/old/examples/queue3/queue3.c +++ /dev/null @@ -1,76 +0,0 @@ -#include -#include - -gboolean playing; - -/* eos will be called when the src element has an end of stream */ -void -eos (GstElement * element, gpointer data) -{ - g_print ("have eos, quitting\n"); - - playing = FALSE; -} - -int -main (int argc, char *argv[]) -{ - GstElement *filesrc, *osssink, *queue, *parse, *decode; - GstElement *bin; - GstElement *thread; - - gst_init (&argc, &argv); - - if (argc != 2) { - g_print ("usage: %s \n", argv[0]); - exit (-1); - } - - /* create a new thread to hold the elements */ - thread = gst_thread_new ("thread"); - g_assert (thread != NULL); - - /* create a new bin to hold the elements */ - bin = gst_bin_new ("bin"); - g_assert (bin != NULL); - - /* create a disk reader */ - filesrc = gst_element_factory_make ("filesrc", "disk_source"); - g_assert (filesrc != NULL); - g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL); - g_signal_connect (G_OBJECT (filesrc), "eos", G_CALLBACK (eos), thread); - - queue = gst_element_factory_make ("queue", "queue"); - - /* and an audio sink */ - osssink = gst_element_factory_make ("osssink", "play_audio"); - g_assert (osssink != NULL); - - parse = gst_element_factory_make ("mp3parse", "parse"); - decode = gst_element_factory_make ("mpg123", "decode"); - - /* add objects to the main bin */ - gst_bin_add (GST_BIN (bin), filesrc); - gst_bin_add (GST_BIN (bin), queue); - - gst_bin_add (GST_BIN (thread), parse); - gst_bin_add (GST_BIN (thread), decode); - gst_bin_add (GST_BIN (thread), osssink); - - gst_element_link_many (filesrc, queue, parse, decode, osssink, NULL); - - /* make it ready */ - gst_element_set_state (GST_ELEMENT (bin), GST_STATE_READY); - /* start playing */ - gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PLAYING); - - playing = TRUE; - - while (playing) { - gst_bin_iterate (GST_BIN (bin)); - } - - gst_element_set_state (GST_ELEMENT (bin), GST_STATE_NULL); - - exit (0); -} diff --git a/tests/old/examples/queue4/.gitignore b/tests/old/examples/queue4/.gitignore deleted file mode 100644 index 7e190c534c..0000000000 --- a/tests/old/examples/queue4/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -queue4 -*.bb -*.bbg -*.da diff --git a/tests/old/examples/queue4/Makefile.am b/tests/old/examples/queue4/Makefile.am deleted file mode 100644 index 9b3911de8e..0000000000 --- a/tests/old/examples/queue4/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -noinst_PROGRAMS = queue4 - -queue4_LDADD = $(GST_OBJ_LIBS) -queue4_CFLAGS = $(GST_OBJ_CFLAGS) - diff --git a/tests/old/examples/queue4/queue4.c b/tests/old/examples/queue4/queue4.c deleted file mode 100644 index 8ea60d89e7..0000000000 --- a/tests/old/examples/queue4/queue4.c +++ /dev/null @@ -1,84 +0,0 @@ -#include -#include - -gboolean playing; - -/* eos will be called when the src element has an end of stream */ -void -eos (GstElement * element, gpointer data) -{ - g_print ("have eos, quitting\n"); - - playing = FALSE; -} - -int -main (int argc, char *argv[]) -{ - GstElement *filesrc, *osssink, *queue, *queue2, *parse, *decode; - GstElement *bin; - GstElement *thread, *thread2; - - gst_init (&argc, &argv); - - if (argc != 2) { - g_print ("usage: %s \n", argv[0]); - exit (-1); - } - - /* create a new thread to hold the elements */ - thread = gst_thread_new ("thread"); - g_assert (thread != NULL); - thread2 = gst_thread_new ("thread2"); - g_assert (thread2 != NULL); - - /* create a new bin to hold the elements */ - bin = gst_bin_new ("bin"); - g_assert (bin != NULL); - - /* create a disk reader */ - filesrc = gst_element_factory_make ("filesrc", "disk_source"); - g_assert (filesrc != NULL); - g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL); - g_signal_connect (G_OBJECT (filesrc), "eos", G_CALLBACK (eos), thread); - - queue = gst_element_factory_make ("queue", "queue"); - queue2 = gst_element_factory_make ("queue", "queue2"); - - /* and an audio sink */ - osssink = gst_element_factory_make ("osssink", "play_audio"); - g_assert (osssink != NULL); - - parse = gst_element_factory_make ("mp3parse", "parse"); - decode = gst_element_factory_make ("mpg123", "decode"); - - /* add objects to the main bin */ - gst_bin_add (GST_BIN (bin), filesrc); - gst_bin_add (GST_BIN (bin), queue); - - gst_bin_add (GST_BIN (thread), parse); - gst_bin_add (GST_BIN (thread), decode); - gst_bin_add (GST_BIN (thread), queue2); - - gst_bin_add (GST_BIN (thread2), osssink); - - gst_element_link_many (filesrc, queue, parse, decode, queue2, osssink, NULL); - - gst_bin_add (GST_BIN (bin), thread); - gst_bin_add (GST_BIN (bin), thread2); - - /* make it ready */ - gst_element_set_state (GST_ELEMENT (bin), GST_STATE_READY); - /* start playing */ - gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PLAYING); - - playing = TRUE; - - while (playing) { - gst_bin_iterate (GST_BIN (bin)); - } - - gst_element_set_state (GST_ELEMENT (bin), GST_STATE_NULL); - - exit (0); -} diff --git a/tests/old/examples/retag/.gitignore b/tests/old/examples/retag/.gitignore deleted file mode 100644 index 1948113728..0000000000 --- a/tests/old/examples/retag/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -retag -transcode -*.bb -*.bbg -*.da diff --git a/tests/old/examples/retag/Makefile.am b/tests/old/examples/retag/Makefile.am deleted file mode 100644 index 9e9e8cd71c..0000000000 --- a/tests/old/examples/retag/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -noinst_PROGRAMS = retag transcode - -retag_LDADD = $(GST_OBJ_LIBS) -retag_CFLAGS = $(GST_OBJ_CFLAGS) - -transcode_LDADD = $(GST_OBJ_LIBS) -transcode_CFLAGS = $(GST_OBJ_CFLAGS) diff --git a/tests/old/examples/retag/retag.c b/tests/old/examples/retag/retag.c deleted file mode 100644 index 871cc21c77..0000000000 --- a/tests/old/examples/retag/retag.c +++ /dev/null @@ -1,111 +0,0 @@ -/* - * This example shows how to use interfaces and the tag subsystem. - * It takes an mp3 file as input, and makes an ogg file out of it. While doing - * this, it parses the filename and sets artist and title in the ogg file. - * It assumes the filename to be " - .mp3" - * - * Run the program as "retag <mp3 file>" - * - * To run this program, you need to have the gst-plugins package (specifically - * the vorbis and mad plugins) installed. - */ - -/* main header */ -#include <gst/gst.h> -/* and a header we need for the string manipulation */ -#include <string.h> - -int -main (int argc, char *argv[]) -{ - GstElement *bin, *filesrc, *tag_changer, *filesink; - GstCaps *filtercaps; - gchar *artist, *title, *ext, *filename; - - /* initialize GStreamer */ - gst_init (&argc, &argv); - - /* check that the argument is there */ - if (argc != 2) { - g_print ("usage: %s <mp3 file>\n", argv[0]); - return 1; - } - - /* parse the mp3 name */ - artist = strrchr (argv[1], '/'); - if (artist == NULL) - artist = argv[1]; - artist = g_strdup (artist); - ext = strrchr (artist, '.'); - if (ext) - *ext = '\0'; - title = strstr (artist, " - "); - if (title == NULL) { - g_print ("The format of the mp3 file is invalid.\n"); - return 1; - } - *title = '\0'; - title += 3; - - - /* create a new bin to hold the elements */ - bin = gst_pipeline_new ("pipeline"); - g_assert (bin); - - /* create a file reader */ - filesrc = gst_element_factory_make ("filesrc", "disk_source"); - g_assert (filesrc); - - /* now it's time to get the tag_changer */ - tag_changer = gst_element_factory_make ("id3tag", "tag_changer"); - if (!tag_changer) { - g_print ("could not find plugin \"mad\""); - return 1; - } - - /* and a file writer */ - filesink = gst_element_factory_make ("filesink", "filesink"); - g_assert (filesink); - - /* set the filenames */ - filename = g_strdup_printf ("%s.temp", argv[1]); /* easy solution */ - g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL); - g_object_set (G_OBJECT (filesink), "location", filename, NULL); - - /* make sure the tag setter uses our stuff - (though that should already be default) */ - gst_tag_setter_set_merge_mode (GST_TAG_SETTER (tag_changer), - GST_TAG_MERGE_REPLACE); - - /* set the tagging information */ - gst_tag_setter_add (GST_TAG_SETTER (tag_changer), GST_TAG_MERGE_REPLACE, - GST_TAG_ARTIST, artist, GST_TAG_TITLE, title, NULL); - - /* add objects to the main pipeline */ - gst_bin_add_many (GST_BIN (bin), filesrc, tag_changer, filesink, NULL); - - /* link the elements */ - if (!gst_element_link (filesrc, tag_changer)) - g_assert_not_reached (); - - /* id3tag determines its mode of operation from its source caps */ - filtercaps = gst_caps_new_simple ("application/x-id3", NULL); - if (!gst_element_link_filtered (tag_changer, filesink, filtercaps)) - g_assert_not_reached (); - gst_caps_free (filtercaps); - - /* start playing */ - gst_element_set_state (bin, GST_STATE_PLAYING); - - while (gst_bin_iterate (GST_BIN (bin))); - - /* stop the bin */ - gst_element_set_state (bin, GST_STATE_NULL); - - /* rename the file to the correct name and remove the old one */ - remove (argv[1]); - rename (filename, argv[1]); - g_free (filename); - - return 0; -} diff --git a/tests/old/examples/retag/transcode.c b/tests/old/examples/retag/transcode.c deleted file mode 100644 index 0913d91674..0000000000 --- a/tests/old/examples/retag/transcode.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * This example shows how to use interfaces and the tag subsystem. - * It takes an mp3 file as input, and makes an ogg file out of it. While doing - * this, it parses the filename and sets artist and title in the ogg file. - * It assumes the filename to be "<artist> - <title>.mp3" - * - * Run the program as "transcode <mp3 file>" - * - * To run this program, you need to have the gst-plugins package (specifically - * the vorbis and mad plugins) installed. - */ - -/* main header */ -#include <gst/gst.h> -/* and a header we need for the string manipulation */ -#include <string.h> - -int -main (int argc, char *argv[]) -{ - GstElement *bin, *filesrc, *decoder, *encoder, *filesink; - gchar *artist, *title, *ext, *filename; - - /* initialize GStreamer */ - gst_init (&argc, &argv); - - /* check that the argument is there */ - if (argc != 2) { - g_print ("usage: %s <mp3 file>\n", argv[0]); - return 1; - } - - /* parse the mp3 name */ - artist = strrchr (argv[1], '/'); - if (artist == NULL) - artist = argv[1]; - artist = g_strdup (artist); - ext = strrchr (artist, '.'); - if (ext) - *ext = '\0'; - title = strstr (artist, " - "); - if (title == NULL) { - g_print ("The format of the mp3 file is invalid.\n"); - g_print ("It needs to be in the form of artist - title.mp3.\n"); - return 1; - } - *title = '\0'; - title += 3; - - - /* create a new bin to hold the elements */ - bin = gst_pipeline_new ("pipeline"); - g_assert (bin); - - /* create a file reader */ - filesrc = gst_element_factory_make ("filesrc", "disk_source"); - g_assert (filesrc); - - /* now it's time to get the decoder */ - decoder = gst_element_factory_make ("mad", "decode"); - if (!decoder) { - g_print ("could not find plugin \"mad\""); - return 1; - } - - /* create the encoder */ - encoder = gst_element_factory_make ("vorbisenc", "encoder"); - if (!encoder) { - g_print ("cound not find plugin \"vorbisenc\""); - return 1; - } - - /* and a file writer */ - filesink = gst_element_factory_make ("filesink", "filesink"); - g_assert (filesink); - - /* set the filenames */ - filename = g_strdup_printf ("%s.ogg", argv[1]); /* easy solution */ - g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL); - g_object_set (G_OBJECT (filesink), "location", filename, NULL); - g_free (filename); - - /* make sure the tag setter uses our stuff - (though that should already be default) */ - gst_tag_setter_set_merge_mode (GST_TAG_SETTER (encoder), GST_TAG_MERGE_KEEP); - /* set the tagging information */ - gst_tag_setter_add (GST_TAG_SETTER (encoder), GST_TAG_MERGE_REPLACE, - GST_TAG_ARTIST, artist, GST_TAG_TITLE, title, NULL); - - /* add objects to the main pipeline */ - gst_bin_add_many (GST_BIN (bin), filesrc, decoder, encoder, filesink, NULL); - - /* link the elements */ - gst_element_link_many (filesrc, decoder, encoder, filesink, NULL); - - /* start playing */ - gst_element_set_state (bin, GST_STATE_PLAYING); - - while (gst_bin_iterate (GST_BIN (bin))); - - /* stop the bin */ - gst_element_set_state (bin, GST_STATE_NULL); - - return 0; -} diff --git a/tests/old/examples/thread/.gitignore b/tests/old/examples/thread/.gitignore deleted file mode 100644 index 74051926de..0000000000 --- a/tests/old/examples/thread/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -thread -*.bb -*.bbg -*.da diff --git a/tests/old/examples/thread/Makefile.am b/tests/old/examples/thread/Makefile.am deleted file mode 100644 index 86a7c19abf..0000000000 --- a/tests/old/examples/thread/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -noinst_PROGRAMS = thread - -thread_LDADD = $(GST_OBJ_LIBS) -thread_CFLAGS = $(GST_OBJ_CFLAGS) - diff --git a/tests/old/examples/thread/thread.c b/tests/old/examples/thread/thread.c deleted file mode 100644 index 5478da84d7..0000000000 --- a/tests/old/examples/thread/thread.c +++ /dev/null @@ -1,76 +0,0 @@ -#include <stdlib.h> -#include <gst/gst.h> - -/* eos will be called when the src element has an end of stream */ -void -eos (GstElement * element, gpointer data) -{ - GstThread *thread = GST_THREAD (data); - - g_print ("have eos, quitting\n"); - - /* stop the bin */ - gst_element_set_state (GST_ELEMENT (thread), GST_STATE_NULL); - - gst_main_quit (); -} - -int -main (int argc, char *argv[]) -{ - GstElement *filesrc, *osssink; - GstElement *pipeline; - GstElement *thread; - - gst_init (&argc, &argv); - - if (argc != 2) { - g_print ("usage: %s <filename>\n", argv[0]); - exit (-1); - } - - /* create a new thread to hold the elements */ - thread = gst_thread_new ("thread"); - g_assert (thread != NULL); - - /* create a new bin to hold the elements */ - pipeline = gst_pipeline_new ("pipeline"); - g_assert (pipeline != NULL); - - /* create a disk reader */ - filesrc = gst_element_factory_make ("filesrc", "disk_source"); - g_assert (filesrc != NULL); - g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL); - g_signal_connect (G_OBJECT (filesrc), "eos", G_CALLBACK (eos), thread); - - /* and an audio sink */ - osssink = gst_element_factory_make ("osssink", "play_audio"); - g_assert (osssink != NULL); - - /* add objects to the main pipeline */ - /* - gst_pipeline_add_src(GST_PIPELINE(pipeline), filesrc); - gst_pipeline_add_sink(GST_PIPELINE(pipeline), osssink); - - if (!gst_pipeline_autoplug(GST_PIPELINE(pipeline))) { - g_print("unable to handle stream\n"); - exit(-1); - } - */ - - /*gst_bin_remove(GST_BIN(pipeline), filesrc); */ - - /*gst_bin_add(GST_BIN(thread), filesrc); */ - gst_bin_add (GST_BIN (thread), GST_ELEMENT (pipeline)); - - /* make it ready */ - gst_element_set_state (GST_ELEMENT (thread), GST_STATE_READY); - /* start playing */ - gst_element_set_state (GST_ELEMENT (thread), GST_STATE_PLAYING); - - gst_main (); - - gst_object_unref (GST_OBJECT (thread)); - - exit (0); -} diff --git a/tests/old/examples/typefind/.gitignore b/tests/old/examples/typefind/.gitignore deleted file mode 100644 index 6c4ae04786..0000000000 --- a/tests/old/examples/typefind/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -typefind -*.bb -*.bbg -*.da diff --git a/tests/old/examples/typefind/Makefile.am b/tests/old/examples/typefind/Makefile.am deleted file mode 100644 index cc998021af..0000000000 --- a/tests/old/examples/typefind/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -noinst_PROGRAMS = typefind - -typefind_LDADD = $(GST_OBJ_LIBS) -typefind_CFLAGS = $(GST_OBJ_CFLAGS) - diff --git a/tests/old/examples/typefind/typefind.c b/tests/old/examples/typefind/typefind.c deleted file mode 100644 index e77d38c983..0000000000 --- a/tests/old/examples/typefind/typefind.c +++ /dev/null @@ -1,60 +0,0 @@ -#include <gst/gst.h> - -void -type_found (GstElement * typefind, const GstCaps * caps) -{ - xmlDocPtr doc; - xmlNodePtr parent; - - doc = xmlNewDoc ((guchar *) "1.0"); - doc->xmlRootNode = xmlNewDocNode (doc, NULL, (guchar *) "Capabilities", NULL); - - parent = xmlNewChild (doc->xmlRootNode, NULL, (guchar *) "Caps1", NULL); - /* FIXME */ - //gst_caps_save_thyself (caps, parent); - - xmlDocDump (stdout, doc); -} - -int -main (int argc, char *argv[]) -{ - GstElement *bin, *filesrc, *typefind; - - gst_init (&argc, &argv); - - if (argc != 2) { - g_print ("usage: %s <filename>\n", argv[0]); - exit (-1); - } - - /* create a new bin to hold the elements */ - bin = gst_pipeline_new ("bin"); - g_assert (bin != NULL); - - /* create a file reader */ - filesrc = gst_element_factory_make ("filesrc", "file_source"); - g_assert (filesrc != NULL); - g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL); - - typefind = gst_element_factory_make ("typefind", "typefind"); - g_assert (typefind != NULL); - - /* add objects to the main pipeline */ - gst_bin_add (GST_BIN (bin), filesrc); - gst_bin_add (GST_BIN (bin), typefind); - - g_signal_connect (G_OBJECT (typefind), "have_type", - G_CALLBACK (type_found), NULL); - - gst_element_link (filesrc, typefind); - - /* start playing */ - gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PLAYING); - - gst_bin_iterate (GST_BIN (bin)); - - gst_element_set_state (GST_ELEMENT (bin), GST_STATE_NULL); - - exit (0); -} diff --git a/tests/old/examples/xml/.gitignore b/tests/old/examples/xml/.gitignore deleted file mode 100644 index 7b9745aa5f..0000000000 --- a/tests/old/examples/xml/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -createxml -runxml -xmlTest.gst -*.bb -*.bbg -*.da diff --git a/tests/old/examples/xml/Makefile.am b/tests/old/examples/xml/Makefile.am deleted file mode 100644 index 11d3cf1270..0000000000 --- a/tests/old/examples/xml/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -noinst_PROGRAMS = createxml runxml - -createxml_LDADD = $(GST_OBJ_LIBS) -createxml_CFLAGS = $(GST_OBJ_CFLAGS) -runxml_LDADD = $(GST_OBJ_LIBS) -runxml_CFLAGS = $(GST_OBJ_CFLAGS) - diff --git a/tests/old/examples/xml/createxml.c b/tests/old/examples/xml/createxml.c deleted file mode 100644 index e7c0ae79a7..0000000000 --- a/tests/old/examples/xml/createxml.c +++ /dev/null @@ -1,93 +0,0 @@ -#include <stdlib.h> -#include <gst/gst.h> - -gboolean playing; - -static void -object_saved (GstObject * object, xmlNodePtr parent, gpointer data) -{ - xmlNodePtr child; - xmlNsPtr ns; - - /* first see if the namespace is already known */ - ns = xmlSearchNsByHref (parent->doc, parent, - (guchar *) "http://gstreamer.net/gst-test/1.0/"); - if (ns == NULL) { - xmlNodePtr root = xmlDocGetRootElement (parent->doc); - - /* add namespace to root node */ - ns = xmlNewNs (root, (guchar *) "http://gstreamer.net/gst-test/1.0/", - (guchar *) "test"); - } - child = xmlNewChild (parent, ns, (guchar *) "comment", NULL); - - xmlNewChild (child, NULL, (guchar *) "text", (guchar *) data); -} - -int -main (int argc, char *argv[]) -{ - GstElement *filesrc, *osssink, *queue, *queue2, *decode; - GstElement *pipeline; - GstElement *thread, *thread2; - - gst_init (&argc, &argv); - - if (argc != 2) { - g_print ("usage: %s <filename>\n", argv[0]); - exit (-1); - } - - /* create new threads to hold the elements */ - thread = gst_element_factory_make ("thread", "thread"); - g_assert (thread != NULL); - thread2 = gst_element_factory_make ("thread", "thread2"); - g_assert (thread2 != NULL); - - /* these signals will allow us to save custom tags with the gst xml output */ - g_signal_connect (G_OBJECT (thread), "object_saved", - G_CALLBACK (object_saved), g_strdup ("decoder thread")); - g_signal_connect (G_OBJECT (thread2), "object_saved", - G_CALLBACK (object_saved), g_strdup ("render thread")); - - /* create a new bin to hold the elements */ - pipeline = gst_pipeline_new ("pipeline"); - g_assert (pipeline != NULL); - - /* create a disk reader */ - filesrc = gst_element_factory_make ("filesrc", "disk_source"); - g_assert (filesrc != NULL); - g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL); - - queue = gst_element_factory_make ("queue", "queue"); - queue2 = gst_element_factory_make ("queue", "queue2"); - - /* and an audio sink */ - osssink = gst_element_factory_make ("osssink", "play_audio"); - g_assert (osssink != NULL); - - decode = gst_element_factory_make ("mad", "decode"); - g_assert (decode != NULL); - - /* add objects to the main pipeline */ - gst_bin_add (GST_BIN (pipeline), filesrc); - gst_bin_add (GST_BIN (pipeline), queue); - - gst_bin_add (GST_BIN (thread), decode); - gst_bin_add (GST_BIN (thread), queue2); - - gst_bin_add (GST_BIN (thread2), osssink); - - gst_element_link_many (filesrc, queue, decode, queue2, osssink, NULL); - - gst_bin_add (GST_BIN (pipeline), thread); - gst_bin_add (GST_BIN (pipeline), thread2); - - /* write the bin to stdout */ - gst_xml_write_file (GST_ELEMENT (pipeline), stdout); - - /* write the bin to a file */ - gst_xml_write_file (GST_ELEMENT (pipeline), fopen ("xmlTest.gst", "w")); - - exit (0); -} diff --git a/tests/old/examples/xml/runxml.c b/tests/old/examples/xml/runxml.c deleted file mode 100644 index 2e29963cc3..0000000000 --- a/tests/old/examples/xml/runxml.c +++ /dev/null @@ -1,61 +0,0 @@ -#include <string.h> -#include <stdlib.h> -#include <gst/gst.h> - -gboolean playing; - -G_GNUC_UNUSED static void -xml_loaded (GstXML * xml, GstObject * object, xmlNodePtr self, gpointer data) -{ - xmlNodePtr children = self->xmlChildrenNode; - - while (children) { - if (!strcmp ((char *) children->name, "comment")) { - xmlNodePtr nodes = children->xmlChildrenNode; - - while (nodes) { - if (!strcmp ((char *) nodes->name, "text")) { - gchar *name = g_strdup ((char *) xmlNodeGetContent (nodes)); - - g_print ("object %s loaded with comment '%s'\n", - gst_object_get_name (object), name); - } - nodes = nodes->next; - } - } - children = children->next; - } -} - -int -main (int argc, char *argv[]) -{ - GstXML *xml; - GstElement *pipeline; - gboolean ret; - - gst_init (&argc, &argv); - - xml = gst_xml_new (); - -/* g_signal_connect (G_OBJECT (xml), "object_loaded", */ -/* G_CALLBACK (xml_loaded), xml); */ - - if (argc == 2) - ret = gst_xml_parse_file (xml, (guchar *) argv[1], NULL); - else - ret = gst_xml_parse_file (xml, (guchar *) "xmlTest.gst", NULL); - - g_assert (ret == TRUE); - - pipeline = gst_xml_get_element (xml, (guchar *) "pipeline"); - g_assert (pipeline != NULL); - - gst_element_set_state (pipeline, GST_STATE_PLAYING); - - while (gst_bin_iterate (GST_BIN (pipeline))); - - gst_element_set_state (pipeline, GST_STATE_NULL); - - exit (0); -} diff --git a/tests/old/testsuite/.gitignore b/tests/old/testsuite/.gitignore deleted file mode 100644 index 4fa802d8bf..0000000000 --- a/tests/old/testsuite/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -Makefile -Makefile.in -*.o -*.lo -*.la -.deps -.libs -test-registry.xml -elementstest-registry.xml -threadstest-registry.xml -*.bb -*.bbg -*.da -test_gst_init diff --git a/tests/old/testsuite/Makefile.am b/tests/old/testsuite/Makefile.am deleted file mode 100644 index df8249a062..0000000000 --- a/tests/old/testsuite/Makefile.am +++ /dev/null @@ -1,38 +0,0 @@ -include Rules - - -if GST_DISABLE_PARSE -GST_PARSE_DIRS = -else -GST_PARSE_DIRS = parse -endif - -if GST_DISABLE_GST_DEBUG -GST_DEBUG_DIRS = -else -GST_DEBUG_DIRS = debug -endif - -SUBDIRS = \ - bins bytestream caps childproxy cleanup clock \ - $(GST_DEBUG_DIRS) \ - dlopen dynparams \ - elements ghostpads indexers negotiation pad \ - $(GST_PARSE_DIRS) \ - plugin refcounting schedulers states tags threads - -DIST_SUBDIRS = \ - bins bytestream caps childproxy cleanup clock \ - debug \ - dlopen dynparams \ - elements ghostpads indexers negotiation pad \ - parse \ - plugin refcounting schedulers states tags threads - -tests_pass = test_gst_init -tests_fail = -tests_ignore = - -# we makes them, we gots to clean them -CLEANFILES += test-registry.xml - diff --git a/tests/old/testsuite/Rules b/tests/old/testsuite/Rules deleted file mode 100644 index 6eda0d4191..0000000000 --- a/tests/old/testsuite/Rules +++ /dev/null @@ -1,33 +0,0 @@ - -TESTS_ENVIRONMENT=\ - G_DEBUG=fatal_warnings \ - GST_PLUGIN_PATH=$(top_builddir)/gst:$(top_builddir)/testsuite \ - GST_REGISTRY=$(top_builddir)/testsuite/test-registry.xml - - -plugindir = $(libdir)/gstreamer-@GST_MAJORMINOR@ - -check_PROGRAMS = $(tests_pass) $(tests_fail) $(tests_ignore) - -# make all tests depend on the versioned gst-register -$(tests_pass) $(tests_fail): $(top_builddir)/tools/gst-register-@GST_MAJORMINOR@ - -# rebuild gst-register-@GST_MAJORMINOR@ if needed -# the EXEEXT is because am 1.6 complained about overrides -$(top_builddir)/tools/gst-register-@GST_MAJORMINOR@$(EXEEXT): - cd $(top_builddir)/tools && make - -TESTS = $(top_builddir)/tools/gst-register-@GST_MAJORMINOR@ \ - $(tests_pass) $(tests_fail) -XFAIL_TESTS = $(tests_fail) - -AM_CFLAGS = $(GST_OBJ_CFLAGS) -LIBS = $(GST_OBJ_LIBS) - -# override to _not_ install the test plugins -install-pluginLTLIBRARIES: - -# This rule is here so make distcheck works on machines where core -# dumps have PIDs appended -CLEANFILES = core.* - diff --git a/tests/old/testsuite/bins/.gitignore b/tests/old/testsuite/bins/.gitignore deleted file mode 100644 index b529896ae8..0000000000 --- a/tests/old/testsuite/bins/.gitignore +++ /dev/null @@ -1 +0,0 @@ -interface diff --git a/tests/old/testsuite/bins/Makefile.am b/tests/old/testsuite/bins/Makefile.am deleted file mode 100644 index 265f5ca1fa..0000000000 --- a/tests/old/testsuite/bins/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -include ../Rules - -tests_pass = interface -tests_fail = -tests_ignore = diff --git a/tests/old/testsuite/bins/interface.c b/tests/old/testsuite/bins/interface.c deleted file mode 100644 index 028b8f0b81..0000000000 --- a/tests/old/testsuite/bins/interface.c +++ /dev/null @@ -1,78 +0,0 @@ -/* GStreamer - * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include <gst/gst.h> - -/* tests if gst_bin_get_(all_)by_interface works */ - -gint -main (gint argc, gchar * argv[]) -{ - GstBin *bin, *bin2; - GList *list; - GstElement *filesrc; - - gst_init (&argc, &argv); - - bin = GST_BIN (gst_bin_new (NULL)); - g_assert (bin); - - filesrc = gst_element_factory_make ("filesrc", NULL); - g_assert (filesrc); - g_assert (GST_IS_URI_HANDLER (filesrc)); - gst_bin_add (bin, filesrc); - - g_assert (gst_bin_get_by_interface (bin, GST_TYPE_URI_HANDLER) == filesrc); - list = gst_bin_get_all_by_interface (bin, GST_TYPE_URI_HANDLER); - g_assert (g_list_length (list) == 1); - g_assert (list->data == (gpointer) filesrc); - g_list_free (list); - - gst_bin_add_many (bin, - gst_element_factory_make ("identity", NULL), - gst_element_factory_make ("identity", NULL), - gst_element_factory_make ("identity", NULL), NULL); - g_assert (gst_bin_get_by_interface (bin, GST_TYPE_URI_HANDLER) == filesrc); - list = gst_bin_get_all_by_interface (bin, GST_TYPE_URI_HANDLER); - g_assert (g_list_length (list) == 1); - g_assert (list->data == (gpointer) filesrc); - g_list_free (list); - - bin2 = bin; - bin = GST_BIN (gst_bin_new (NULL)); - g_assert (bin); - gst_bin_add_many (bin, - gst_element_factory_make ("identity", NULL), - gst_element_factory_make ("identity", NULL), - GST_ELEMENT (bin2), gst_element_factory_make ("identity", NULL), NULL); - g_assert (gst_bin_get_by_interface (bin, GST_TYPE_URI_HANDLER) == filesrc); - list = gst_bin_get_all_by_interface (bin, GST_TYPE_URI_HANDLER); - g_assert (g_list_length (list) == 1); - g_assert (list->data == (gpointer) filesrc); - g_list_free (list); - - gst_bin_add (bin, gst_element_factory_make ("filesrc", NULL)); - gst_bin_add (bin2, gst_element_factory_make ("filesrc", NULL)); - list = gst_bin_get_all_by_interface (bin, GST_TYPE_URI_HANDLER); - g_assert (g_list_length (list) == 3); - g_list_free (list); - - g_object_unref (bin); - return 0; -} diff --git a/tests/old/testsuite/bytestream/.gitignore b/tests/old/testsuite/bytestream/.gitignore deleted file mode 100644 index 6b90160e0b..0000000000 --- a/tests/old/testsuite/bytestream/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -Makefile -Makefile.in -*.o -*.lo -*.la -.deps -.libs -test1 -filepadsink diff --git a/tests/old/testsuite/bytestream/Makefile.am b/tests/old/testsuite/bytestream/Makefile.am deleted file mode 100644 index 790dca8d84..0000000000 --- a/tests/old/testsuite/bytestream/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -include ../Rules - -tests_pass = filepadsink -tests_fail = test1 -tests_ignore = - -test1_SOURCES = test1.c gstbstest.c -test1_LDFLAGS = $(top_builddir)/libs/gst/bytestream/libgstbytestream.la - -filepadsink_CFLAGS = $(AM_CFLAGS) -DTHE_FILE=\""$(top_srcdir)/configure.ac"\" -filepadsink_LDFLAGS = $(top_builddir)/libs/gst/bytestream/libgstbytestream.la diff --git a/tests/old/testsuite/bytestream/filepadsink.c b/tests/old/testsuite/bytestream/filepadsink.c deleted file mode 100644 index e5ac8b9ea1..0000000000 --- a/tests/old/testsuite/bytestream/filepadsink.c +++ /dev/null @@ -1,281 +0,0 @@ -/* GStreamer - * Copyright (C) 2004 Benjamin Otte <otte@gnome.org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif -#include <gst/gst.h> -#include <gst/bytestream/filepad.h> -#include <stdio.h> -#include <string.h> - -#define GST_TYPE_FP_SINK \ - (gst_fp_sink_get_type()) -#define GST_FP_SINK(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FP_SINK,GstFpSink)) -#define GST_FP_SINK_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FP_SINK,GstFpSinkClass)) -#define GST_IS_FP_SINK(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FP_SINK)) -#define GST_IS_FP_SINK_CLASS(obj) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FP_SINK)) - - -typedef struct _GstFpSink GstFpSink; -typedef struct _GstFpSinkClass GstFpSinkClass; - -struct _GstFpSink -{ - GstElement element; - /* pads */ - GstFilePad *sinkpad; - - /* fd */ - FILE *stream; - guint state; -}; - -struct _GstFpSinkClass -{ - GstElementClass parent_class; -}; - -GST_BOILERPLATE (GstFpSink, gst_fp_sink, GstElement, GST_TYPE_ELEMENT); - -static void do_tests (GstFilePad * pad); - - -static void -gst_fp_sink_base_init (gpointer g_class) -{ -} - -static void -gst_fp_sink_class_init (GstFpSinkClass * klass) -{ -} - -static GstStaticPadTemplate template = GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS ("ANY") - ); - -static void -gst_fp_sink_init (GstFpSink * fp) -{ - GST_FLAG_SET (fp, GST_ELEMENT_EVENT_AWARE); - - fp->sinkpad = - GST_FILE_PAD (gst_file_pad_new (gst_static_pad_template_get (&template), - "sink")); - gst_file_pad_set_iterate_function (fp->sinkpad, do_tests); - gst_element_add_pad (GST_ELEMENT (fp), GST_PAD (fp->sinkpad)); -} - -#define THE_CHECK(result) G_STMT_START{ \ - gint64 pos = gst_file_pad_tell(fp->sinkpad); \ - if (pos >= 0) \ - g_assert (pos == ftell (fp->stream)); \ - g_print ("%s (%"G_GINT64_FORMAT")\n", result ? "OK" : "no", pos); \ - return result; \ -}G_STMT_END -#define FAIL THE_CHECK(FALSE) -#define SUCCESS THE_CHECK(TRUE) - -static gboolean -fp_read (GstFpSink * fp, guint size) -{ - guint8 buf[size], buf2[size]; - gint64 amount; - - g_print ("reading %u bytes...", size); - amount = gst_file_pad_read (fp->sinkpad, buf, size); - if (amount == -EAGAIN) - FAIL; - g_assert (amount == size); - amount = fread (buf2, 1, amount, fp->stream); - g_assert (amount == size); - if (memcmp (buf, buf2, amount) != 0) - g_assert_not_reached (); - fp->state++; - SUCCESS; -} - -static gboolean -fp_try_read (GstFpSink * fp, guint size) -{ - guint8 buf[size], buf2[size]; - gint64 amount; - size_t amount2; - - g_print ("reading %u bytes...", size); - amount = gst_file_pad_try_read (fp->sinkpad, buf, size); - if (amount == -EAGAIN) - FAIL; - g_assert (amount > 0); - amount2 = fread (buf2, 1, amount, fp->stream); - g_assert (amount == amount2); - if (memcmp (buf, buf2, amount) != 0) - g_assert_not_reached (); - fp->state++; - SUCCESS; -} - -static gboolean -fp_seek (GstFpSink * fp, gint64 pos, GstSeekType whence) -{ - int seek_type = whence == GST_SEEK_METHOD_SET ? SEEK_SET : - whence == GST_SEEK_METHOD_CUR ? SEEK_CUR : SEEK_END; - - g_print ("seeking to %s %" G_GINT64_FORMAT " bytes...", - whence == GST_SEEK_METHOD_SET ? "" : whence == - GST_SEEK_METHOD_CUR ? "+-" : "-", pos); - if (gst_file_pad_seek (fp->sinkpad, pos, whence) != 0) - g_assert_not_reached (); - if (fseek (fp->stream, pos, seek_type) != 0) - g_assert_not_reached (); - fp->state++; - SUCCESS; -} - -static gboolean -fp_eof (GstFpSink * fp) -{ - guint8 buf; - - g_print ("checking for EOF..."); - if (!gst_file_pad_eof (fp->sinkpad)) - FAIL; - if (fread (&buf, 1, 1, fp->stream) != 0) - g_assert_not_reached (); - fp->state++; - SUCCESS; -} - -#define MIN_SIZE 10050 -#define MAX_SIZE 1000000 -static void -do_tests (GstFilePad * pad) -{ - GstFpSink *fp = GST_FP_SINK (gst_pad_get_parent (GST_PAD (pad))); - - while (TRUE) { - switch (fp->state) { - case 0: - if (!fp_try_read (fp, 50)) - return; - break; - case 1: - if (!fp_try_read (fp, MAX_SIZE)) /* more than file size */ - return; - break; - case 2: - if (!fp_seek (fp, 0, GST_SEEK_METHOD_SET)) - return; - break; - case 3: - if (!fp_read (fp, 50)) - return; - break; - case 4: - if (!fp_read (fp, MIN_SIZE - 50)) /* bigger than 1 buffer */ - return; - break; - case 5: - if (!fp_seek (fp, -200, GST_SEEK_METHOD_CUR)) - return; - break; - case 6: - if (!fp_read (fp, 50)) - return; - break; - case 7: - if (!fp_seek (fp, 50, GST_SEEK_METHOD_CUR)) - return; - break; - case 8: - if (!fp_read (fp, 50)) - return; - break; - case 9: - if (!fp_seek (fp, MIN_SIZE - 50, GST_SEEK_METHOD_SET)) - return; - break; - case 10: - if (!fp_read (fp, 50)) - return; - break; - case 11: - if (!fp_seek (fp, 0, GST_SEEK_METHOD_END)) - return; - break; - case 12: - if (!fp_eof (fp)) - return; - gst_element_set_eos (GST_ELEMENT (fp)); - return; - default: - g_assert_not_reached (); - } - } -} - -#ifndef THE_FILE -# define THE_FILE "../../configure.ac" -#endif -gint -main (gint argc, gchar ** argv) -{ - GstElement *pipeline, *src, *sink; - long size; - - gst_init (&argc, &argv); - gst_library_load ("gstbytestream"); - - pipeline = gst_element_factory_make ("pipeline", NULL); - g_assert (pipeline); - src = gst_element_factory_make ("filesrc", NULL); - g_assert (src); - sink = g_object_new (GST_TYPE_FP_SINK, NULL); - gst_object_set_name (GST_OBJECT (sink), "sink"); - gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL); - if (!gst_element_link (src, sink)) - g_assert_not_reached (); - g_object_set (src, "location", THE_FILE, NULL); - GST_FP_SINK (sink)->stream = fopen (THE_FILE, "rb"); - g_assert (GST_FP_SINK (sink)->stream); - /* check correct file sizes */ - if (fseek (GST_FP_SINK (sink)->stream, 0, SEEK_END) != 0) - g_assert_not_reached (); - size = ftell (GST_FP_SINK (sink)->stream); - if (fseek (GST_FP_SINK (sink)->stream, 0, SEEK_SET) != 0) - g_assert_not_reached (); - g_assert (size >= MIN_SIZE); - g_assert (size <= MAX_SIZE); - - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) - g_assert_not_reached (); - while (gst_bin_iterate (GST_BIN (pipeline))); - - g_assert (GST_FP_SINK (sink)->state == 13); - g_object_unref (pipeline); - pipeline = NULL; - return 0; -} diff --git a/tests/old/testsuite/bytestream/gstbstest.c b/tests/old/testsuite/bytestream/gstbstest.c deleted file mode 100644 index 3eb6ae4437..0000000000 --- a/tests/old/testsuite/bytestream/gstbstest.c +++ /dev/null @@ -1,419 +0,0 @@ -/* GStreamer - * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu> - * 2000 Wim Taymans <wtay@chello.be> - * - * gstbstest.c: - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include <stdlib.h> -#include <string.h> - -#include <gst/gst.h> -#include <gst/bytestream/bytestream.h> - -#define GST_TYPE_BSTEST (gst_bstest_get_type()) -#define GST_BSTEST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BSTEST,GstBsTest)) -#define GST_BSTEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BSTEST,GstBsTestClass)) -#define GST_IS_BSTEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BSTEST)) -#define GST_IS_BSTEST_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BSTEST)) - -typedef struct _GstBsTest GstBsTest; -typedef struct _GstBsTestClass GstBsTestClass; - -struct _GstBsTest -{ - GstElement element; - - GstPad *sinkpad; - GstPad *srcpad; - - GstByteStream *bs; - - gchar *accesspattern; - guint num_patterns; - gchar **patterns; - guint sizemin; - guint sizemax; - gint count; - gboolean silent; -}; - -struct _GstBsTestClass -{ - GstElementClass parent_class; -}; - -GType gst_bstest_get_type (void); - - -GstElementDetails gst_bstest_details = GST_ELEMENT_DETAILS ("ByteStreamTest", - "Filter", - "Test for the GstByteStream code", - "Erik Walthinsen <omega@temple-baptist.com>, " - "Wim Taymans <wim.taymans@chello.be>"); - - -/* BsTest signals and args */ -enum -{ - /* FILL ME */ - LAST_SIGNAL -}; - -enum -{ - ARG_0, - ARG_SIZEMIN, - ARG_SIZEMAX, - ARG_COUNT, - ARG_SILENT, - ARG_ACCESSPATTERN, -}; - - -static void gst_bstest_base_init (gpointer g_class); -static void gst_bstest_class_init (GstBsTestClass * klass); -static void gst_bstest_init (GstBsTest * bstest); - -static void gst_bstest_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec); -static void gst_bstest_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec); - -static GstElementStateReturn gst_bstest_change_state (GstElement * element); -static void gst_bstest_loop (GstElement * element); - -static GstElementClass *parent_class = NULL; - -/* static guint gst_bstest_signals[LAST_SIGNAL] = { 0 }; */ - -GType -gst_bstest_get_type (void) -{ - static GType bstest_type = 0; - - if (!bstest_type) { - static const GTypeInfo bstest_info = { - sizeof (GstBsTestClass), - gst_bstest_base_init, - NULL, - (GClassInitFunc) gst_bstest_class_init, - NULL, - NULL, - sizeof (GstBsTest), - 0, - (GInstanceInitFunc) gst_bstest_init, - }; - - bstest_type = - g_type_register_static (GST_TYPE_ELEMENT, "BSTest", &bstest_info, 0); - } - return bstest_type; -} -static void -gst_bstest_base_init (gpointer g_class) -{ - GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_set_details (gstelement_class, &gst_bstest_details); -} - -static void -gst_bstest_class_init (GstBsTestClass * klass) -{ - GObjectClass *gobject_class; - GstElementClass *gstelement_class; - - gobject_class = (GObjectClass *) klass; - gstelement_class = (GstElementClass *) klass; - - parent_class = g_type_class_ref (GST_TYPE_ELEMENT); - - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SIZEMIN, - g_param_spec_int ("sizemin", "sizemin", "sizemin", 0, G_MAXINT, - 0, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SIZEMAX, - g_param_spec_int ("sizemax", "sizemax", "sizemax", 0, G_MAXINT, - 384, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ACCESSPATTERN, - g_param_spec_string ("accesspattern", "accesspattern", "accesspattern", - "r", G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_COUNT, - g_param_spec_uint ("count", "count", "count", - 0, G_MAXUINT, 0, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SILENT, - g_param_spec_boolean ("silent", "silent", "silent", - FALSE, G_PARAM_READWRITE)); - - gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_bstest_set_property); - gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_bstest_get_property); - - gstelement_class->change_state = gst_bstest_change_state; - -} - -static GstCaps * -gst_bstest_getcaps (GstPad * pad) -{ - GstBsTest *bstest = GST_BSTEST (gst_pad_get_parent (pad)); - GstPad *otherpad; - - otherpad = (pad == bstest->srcpad) ? bstest->sinkpad : bstest->srcpad; - - return gst_pad_get_allowed_caps (otherpad); -} - -GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - -GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - -static void -gst_bstest_init (GstBsTest * bstest) -{ - bstest->sinkpad = - gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate), - "sink"); - gst_element_add_pad (GST_ELEMENT (bstest), bstest->sinkpad); - gst_pad_set_getcaps_function (bstest->sinkpad, gst_bstest_getcaps); - - bstest->srcpad = - gst_pad_new_from_template (gst_static_pad_template_get (&srctemplate), - "src"); - gst_element_add_pad (GST_ELEMENT (bstest), bstest->srcpad); - gst_pad_set_getcaps_function (bstest->srcpad, gst_bstest_getcaps); - - gst_element_set_loop_function (GST_ELEMENT (bstest), gst_bstest_loop); - - bstest->sizemin = 0; - bstest->sizemax = 384; - bstest->accesspattern = g_strdup ("r"); - bstest->patterns = g_strsplit (bstest->accesspattern, ":", 0); - bstest->count = 5; - bstest->silent = FALSE; - bstest->bs = NULL; -} - -static guint -gst_bstest_get_size (GstBsTest * bstest, gchar * sizestring, guint prevsize) -{ - guint size; - - if (sizestring[0] == 0) { - size = bstest->sizemax; - } else if (sizestring[0] == 'r') { - size = - bstest->sizemin + - (guint8) (((gfloat) bstest->sizemax) * rand () / (RAND_MAX + - (gfloat) bstest->sizemin)); - } else if (sizestring[0] == '<') { - size = prevsize; - } else { - size = atoi (sizestring); - } - - if (size == 0) - size++; - - return size; -} - -static void -gst_bstest_loop (GstElement * element) -{ - GstBsTest *bstest; - GstBuffer *buf = NULL; - - g_return_if_fail (element != NULL); - g_return_if_fail (GST_IS_BSTEST (element)); - - bstest = GST_BSTEST (element); - - do { - guint size = 0; - guint i = 0; - guint8 *ptr; - - while (i < bstest->num_patterns) { - buf = NULL; - - if (bstest->patterns[i][0] == 'r') { - size = gst_bstest_get_size (bstest, &bstest->patterns[i][1], size); - if (!bstest->silent) - g_print ("bstest: ***** read %d bytes\n", size); - gst_bytestream_read (bstest->bs, &buf, size); - } else if (bstest->patterns[i][0] == 'f') { - size = gst_bstest_get_size (bstest, &bstest->patterns[i][1], size); - if (!bstest->silent) - g_print ("bstest: ***** flush %d bytes\n", size); - gst_bytestream_flush (bstest->bs, size); - } else if (!strncmp (bstest->patterns[i], "pb", 2)) { - size = gst_bstest_get_size (bstest, &bstest->patterns[i][2], size); - if (!bstest->silent) - g_print ("bstest: ***** peek bytes %d bytes\n", size); - gst_bytestream_peek_bytes (bstest->bs, &ptr, size); - } else if (bstest->patterns[i][0] == 'p') { - size = gst_bstest_get_size (bstest, &bstest->patterns[i][1], size); - if (!bstest->silent) - g_print ("bstest: ***** peek %d bytes\n", size); - gst_bytestream_peek (bstest->bs, &buf, size); - gst_buffer_unref (buf); - buf = NULL; - } - - if (buf) - gst_pad_push (bstest->srcpad, GST_DATA (buf)); - - i++; - } -/* } while (!GST_ELEMENT_IS_COTHREAD_STOPPING (element)); */ - - } while (0); -} - -static void -gst_bstest_set_property (GObject * object, guint prop_id, const GValue * value, - GParamSpec * pspec) -{ - GstBsTest *bstest; - - /* it's not null if we got it, but it might not be ours */ - g_return_if_fail (GST_IS_BSTEST (object)); - - bstest = GST_BSTEST (object); - - switch (prop_id) { - case ARG_SIZEMIN: - bstest->sizemin = g_value_get_int (value); - break; - case ARG_SIZEMAX: - bstest->sizemax = g_value_get_int (value); - break; - case ARG_ACCESSPATTERN: - if (bstest->accesspattern) { - g_free (bstest->accesspattern); - g_strfreev (bstest->patterns); - } - if (g_value_get_string (value) == NULL) { - gst_element_set_state (GST_ELEMENT (object), GST_STATE_NULL); - bstest->accesspattern = NULL; - bstest->num_patterns = 0; - } else { - guint i = 0; - - bstest->accesspattern = g_strdup (g_value_get_string (value)); - bstest->patterns = g_strsplit (bstest->accesspattern, ":", 0); - while (bstest->patterns[i++]); - bstest->num_patterns = i - 1; - } - break; - case ARG_COUNT: - bstest->count = g_value_get_uint (value); - break; - case ARG_SILENT: - bstest->silent = g_value_get_boolean (value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_bstest_get_property (GObject * object, guint prop_id, GValue * value, - GParamSpec * pspec) -{ - GstBsTest *bstest; - - /* it's not null if we got it, but it might not be ours */ - g_return_if_fail (GST_IS_BSTEST (object)); - - bstest = GST_BSTEST (object); - - switch (prop_id) { - case ARG_SIZEMIN: - g_value_set_int (value, bstest->sizemin); - break; - case ARG_SIZEMAX: - g_value_set_int (value, bstest->sizemax); - break; - case ARG_ACCESSPATTERN: - g_value_set_string (value, bstest->accesspattern); - break; - case ARG_COUNT: - g_value_set_uint (value, bstest->count); - break; - case ARG_SILENT: - g_value_set_boolean (value, bstest->silent); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static GstElementStateReturn -gst_bstest_change_state (GstElement * element) -{ - GstBsTest *bstest; - - g_return_val_if_fail (GST_IS_BSTEST (element), GST_STATE_FAILURE); - - bstest = GST_BSTEST (element); - - if (GST_STATE_PENDING (element) == GST_STATE_NULL) { - if (bstest->bs) { - gst_bytestream_destroy (bstest->bs); - bstest->bs = NULL; - } - } else { - if (!bstest->bs) { - bstest->bs = gst_bytestream_new (bstest->sinkpad); - } - } - - if (GST_ELEMENT_CLASS (parent_class)->change_state) - return GST_ELEMENT_CLASS (parent_class)->change_state (element); - - return GST_STATE_SUCCESS; -} - -static gboolean -plugin_init (GstPlugin * plugin) -{ - /* We need to create an ElementFactory for each element we provide. - * This consists of the name of the element, the GType identifier, - * and a pointer to the details structure at the top of the file. - */ - return gst_element_register (plugin, "bstest", GST_RANK_PRIMARY, - GST_TYPE_BSTEST); -} - -GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "bstest", - "test for the bytestream element", - plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN) diff --git a/tests/old/testsuite/bytestream/test1.c b/tests/old/testsuite/bytestream/test1.c deleted file mode 100644 index fde56402c6..0000000000 --- a/tests/old/testsuite/bytestream/test1.c +++ /dev/null @@ -1,230 +0,0 @@ -#include <string.h> -#include <stdlib.h> - -#include <gst/gst.h> - -#define VM_THRES 1000 -#define MAX_CONFIG_LINE 255 -#define MAX_CONFIG_PATTERN 64 - -typedef struct -{ - gint src_data; - gint src_sizetype; - - gchar *bs_accesspattern; - - gboolean integrity_check; -} -TestParam; - -static GSList *params = NULL; - -static guint8 count; -static guint iterations; -static gboolean integrity_check = TRUE; -static gboolean verbose = FALSE; -static gboolean dump = FALSE; - -static void -handoff (GstElement * element, GstBuffer * buf, GstPad * pad, gpointer data) -{ - if (GST_IS_BUFFER (buf)) { - if (integrity_check) { - gint i; - guint8 *ptr = GST_BUFFER_DATA (buf); - - for (i = 0; i < GST_BUFFER_SIZE (buf); i++) { - if (*ptr++ != count++) { - g_print ("data error!\n"); - return; - } - } - } - } else { - g_print ("not a buffer ! %p\n", buf); - } -} -static gchar * -create_desc (TestParam * param) -{ - gchar *desc; - - desc = - g_strdup_printf ("%s %s, pattern %s", - (param->src_sizetype == 2 ? "fixed" : "random"), - (param->src_data == 1 ? "src" : "subbuffer"), param->bs_accesspattern); - return desc; -} - -static gboolean -read_param_file (gchar * filename) -{ - FILE *fp; - gchar line[MAX_CONFIG_LINE + 1]; - guint linenr = 0; - gchar pattern[MAX_CONFIG_PATTERN]; - gint data, sizetype, integrity_check; - gchar *scan_str; - gboolean res = TRUE; - - fp = fopen (filename, "rb"); - if (fp == NULL) - return FALSE; - - scan_str = g_strdup_printf ("%%d %%d %%%ds %%d", MAX_CONFIG_PATTERN - 1); - - while (fgets (line, MAX_CONFIG_LINE, fp)) { - linenr++; - - if (line[0] == '\n' || line[0] == '#') - continue; - - if (sscanf (line, scan_str, &data, &sizetype, pattern, - &integrity_check) != 4) { - g_print ("error on line: %d\n", linenr); - res = FALSE; - break; - } else { - TestParam *param = g_malloc (sizeof (TestParam)); - - param->src_data = data; - param->src_sizetype = sizetype; - param->bs_accesspattern = g_strdup (pattern); - param->integrity_check = (integrity_check == 0 ? FALSE : TRUE); - - params = g_slist_append (params, param); - } - } - g_free (scan_str); - - return res; -} - -static void -run_test (GstBin * pipeline, gint iters) -{ - gint vm = 0; - gint maxiters = iters; - gint prev_percent = -1; - - count = 0; - gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING); - - while (iters) { - gint newvm = gst_alloc_trace_live_all (); - gint percent; - - percent = (gint) ((maxiters - iters + 1) * 100.0 / maxiters); - - if (percent != prev_percent || newvm - vm > VM_THRES) { - g_print ("\r%d (delta %d) %.3d%% ", newvm, newvm - vm, - percent); - prev_percent = percent; - vm = newvm; - } - gst_bin_iterate (pipeline); - - if (iters > 0) - iters--; - } - gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL); -} - -static void -usage (char *argv[]) -{ - g_print ("usage: %s [--verbose] [--dump] <paramfile> <iterations>\n", - argv[0]); -} - -int -main (int argc, char *argv[]) -{ - GstElement *src; - GstElement *sink; - GstElement *bs; - GstElement *pipeline; - gint testnum = 0; - GSList *walk; - gint arg_walk; - - gst_alloc_trace_set_flags_all (GST_ALLOC_TRACE_LIVE); - gst_init (&argc, &argv); - - arg_walk = 1; - while ((arg_walk < argc) && (argv[arg_walk][0] == '-')) { - if (!strncmp (argv[arg_walk], "--verbose", 9)) - verbose = TRUE; - else if (!strncmp (argv[arg_walk], "--dump", 6)) - dump = TRUE; - else { - g_print ("unknown option %s (ignored)\n", argv[arg_walk]); - } - - arg_walk++; - } - if (argc - arg_walk < 2) { - usage (argv); - return -1; - } - if (!read_param_file (argv[arg_walk])) { - g_print ("error reading file %s\n", argv[arg_walk]); - usage (argv); - return -1; - } - arg_walk++; - iterations = atoi (argv[arg_walk]); - - pipeline = gst_element_factory_make ("pipeline", "pipeline"); - g_assert (pipeline); - - src = gst_element_factory_make ("fakesrc", "src"); - g_assert (src); - - sink = gst_element_factory_make ("fakesink", "sink"); - g_assert (sink); - g_object_set (sink, "signal-handoff", TRUE, NULL); - g_signal_connect (G_OBJECT (sink), "handoff", G_CALLBACK (handoff), NULL); - - bs = gst_element_factory_make ("bstest", "bs"); - g_assert (bs); - - gst_element_link_many (src, bs, sink, NULL); - - gst_bin_add_many (GST_BIN (pipeline), src, bs, sink, NULL); - - walk = params; - - while (walk) { - gchar *desc; - TestParam *param = (TestParam *) (walk->data); - - integrity_check = param->integrity_check; - - g_print ("\n\nrunning test %d (%d iterations):\n", testnum + 1, iterations); - desc = create_desc (param); - g_print ("%s\n", desc); - g_free (desc); - - g_object_set (G_OBJECT (src), "data", param->src_data, - "sizetype", param->src_sizetype, - "filltype", (integrity_check ? 5 : 0), "silent", !verbose, NULL); - - g_object_set (G_OBJECT (bs), "accesspattern", param->bs_accesspattern, - "silent", !verbose, NULL); - - g_object_set (G_OBJECT (sink), "dump", dump, "silent", !verbose, NULL); - - run_test (GST_BIN (pipeline), iterations); - - testnum++; - - walk = g_slist_next (walk); - } - - g_print ("\n\ndone\n"); - - return 0; - -} diff --git a/tests/old/testsuite/bytestream/testfile1 b/tests/old/testsuite/bytestream/testfile1 deleted file mode 100644 index 68a32dd582..0000000000 --- a/tests/old/testsuite/bytestream/testfile1 +++ /dev/null @@ -1,93 +0,0 @@ -# lots of parameters here. values for the columns are like: -# -# - data property in fakesrc: 1 = allocate, 2 = subbuffer -# - sizetype property in fakesrc: 2 = fixed, 3 = random -# -# - accesspattern for bstest -# <action><size>[:<action><size>...] -# -# <action> can be: -# r = read -# p = peek -# pb = peek bytes -# f = flush -# <size> can be: -# <empty> = fixed size -# r = random size -# < = previous size -# <int> = this size -# -# - integrity check: 0 = no, 1 = yes -# -1 2 r 1 -1 2 rr 1 -1 3 r 1 -1 3 rr 1 -2 2 r 1 -2 2 rr 1 -2 3 r 1 -2 3 rr 1 -1 2 p:r< 1 -1 2 pr:r< 1 -1 3 p:r< 1 -1 3 pr:r< 1 -2 2 p:r< 1 -2 2 pr:r< 1 -2 3 p:r< 1 -2 3 pr:r< 1 -1 2 p:rr 1 -1 2 pr:rr 1 -1 3 p:rr 1 -1 3 pr:rr 1 -2 2 p:rr 1 -2 2 pr:rr 1 -2 3 p:rr 1 -2 3 pr:rr 1 -1 2 pb:r 1 -1 2 pbr:r 1 -1 3 pb:r 1 -1 3 pbr:r 1 -2 2 pb:r 1 -2 2 pbr:r 1 -2 3 pb:r 1 -2 3 pbr:r 1 -1 2 pb:rr 1 -1 2 pbr:rr 1 -1 3 pb:rr 1 -1 3 pbr:rr 1 -2 2 pb:rr 1 -2 2 pbr:rr 1 -2 3 pb:rr 1 -2 3 pbr:rr 1 -1 2 p:fr:rr 0 -1 2 pr:fr:rr 0 -1 3 p:fr:rr 0 -1 3 pr:fr:rr 0 -2 2 p:fr:rr 0 -2 2 pr:fr:rr 0 -2 3 p:fr:rr 0 -2 3 pr:fr:rr 0 -1 2 fr:rr 0 -1 2 fr:rr 0 -1 3 fr:rr 0 -1 3 fr:rr 0 -2 2 fr:rr 0 -2 2 fr:rr 0 -2 3 fr:rr 0 -2 3 fr:rr 0 -1 2 fr:fr:rr 0 -1 2 fr:fr:rr 0 -1 3 fr:fr:rr 0 -1 3 fr:fr:rr 0 -2 2 fr:fr:rr 0 -2 2 fr:fr:rr 0 -2 3 fr:fr:rr 0 -2 3 fr:fr:rr 0 -1 2 pbr:pbr:rr 1 -1 2 pbr:pbr:rr 1 -1 3 pbr:pbr:rr 1 -1 3 pbr:pbr:rr 1 -2 2 pbr:pbr:rr 1 -2 2 pbr:pbr:rr 1 -2 3 pbr:pbr:rr 1 -2 3 pbr:pbr:rr 1 diff --git a/tests/old/testsuite/caps/.gitignore b/tests/old/testsuite/caps/.gitignore deleted file mode 100644 index 5419534b31..0000000000 --- a/tests/old/testsuite/caps/.gitignore +++ /dev/null @@ -1,36 +0,0 @@ -Makefile -Makefile.in -*.o -*.lo -*.la -*.bb -*.bbg -*.da -.deps -.libs - -app_fixate -audioscale -caps -compatibility -deserialize -enumcaps -eratosthenes -filtercaps -fixed -fraction-convert -fraction-multiply-and-zero -intersect2 -intersection -normalisation -random -renegotiate -union -simplify -sets -string-conversions -structure -subtract -value_compare -value_intersect -value_serialize diff --git a/tests/old/testsuite/caps/Makefile.am b/tests/old/testsuite/caps/Makefile.am deleted file mode 100644 index e3918b18d5..0000000000 --- a/tests/old/testsuite/caps/Makefile.am +++ /dev/null @@ -1,37 +0,0 @@ -include ../Rules - -tests_pass = \ - app_fixate \ - enumcaps \ - intersection \ - compatibility \ - deserialize \ - normalisation \ - union \ - string-conversions \ - fixed \ - fraction-convert \ - fraction-multiply-and-zero \ - fromstring \ - intersect2 \ - caps \ - value_compare \ - value_intersect \ - value_serialize \ - audioscale \ - filtercaps \ - eratosthenes \ - renegotiate \ - subtract \ - sets \ - simplify \ - random \ - structure - -EXTRA_DIST = caps_strings - -noinst_HEADERS = \ - caps.h - -tests_fail = -tests_ignore = diff --git a/tests/old/testsuite/caps/app_fixate.c b/tests/old/testsuite/caps/app_fixate.c deleted file mode 100644 index 52658e7ee2..0000000000 --- a/tests/old/testsuite/caps/app_fixate.c +++ /dev/null @@ -1,51 +0,0 @@ - -#include <gst/gst.h> - - -static GstCaps * -handler (GObject * object, GstCaps * caps, gpointer user_data) -{ - g_print ("in handler %p, %p, %p\n", object, caps, user_data); - - g_assert (GST_IS_PAD (object)); - - g_print ("caps: %s\n", gst_caps_to_string (caps)); - - if (gst_caps_is_any (caps)) { - return gst_caps_new_simple ("application/x-foo", - "field", GST_TYPE_INT_RANGE, 1, 10, NULL); - } - - return NULL; -} - - -int -main (int argc, char *argv[]) -{ - GstElement *a; - GstElement *b; - GstElement *pipeline; - GstPad *pad; - - gst_init (&argc, &argv); - - pipeline = gst_pipeline_new (NULL); - - a = gst_element_factory_make ("fakesrc", NULL); - g_assert (a); - b = gst_element_factory_make ("fakesink", NULL); - g_assert (b); - - gst_bin_add_many (GST_BIN (pipeline), a, b, NULL); - gst_element_link (a, b); - - pad = gst_element_get_pad (a, "src"); - g_signal_connect (G_OBJECT (pad), "fixate", G_CALLBACK (handler), - (void *) 0xdeadbeef); - - gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING); - - - return 0; -} diff --git a/tests/old/testsuite/caps/audioscale.c b/tests/old/testsuite/caps/audioscale.c deleted file mode 100644 index 9b73dbd853..0000000000 --- a/tests/old/testsuite/caps/audioscale.c +++ /dev/null @@ -1,174 +0,0 @@ -/* GStreamer - * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -/* Element-Checklist-Version: 5 */ - - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include <string.h> -#include <math.h> - -#include <gst/gst.h> - - -static void -gst_audioscale_expand_value (GValue * dest, const GValue * src) -{ - int rate_min, rate_max; - - if (G_VALUE_TYPE (src) == G_TYPE_INT || - G_VALUE_TYPE (src) == GST_TYPE_INT_RANGE) { - if (G_VALUE_TYPE (src) == G_TYPE_INT) { - rate_min = g_value_get_int (src); - rate_max = rate_min; - } else { - rate_min = gst_value_get_int_range_min (src); - rate_max = gst_value_get_int_range_max (src); - } - - rate_min /= 2; - if (rate_min < 1) - rate_min = 1; - if (rate_max < G_MAXINT / 2) { - rate_max *= 2; - } else { - rate_max = G_MAXINT; - } - - g_value_init (dest, GST_TYPE_INT_RANGE); - gst_value_set_int_range (dest, rate_min, rate_max); - return; - } - - if (G_VALUE_TYPE (src) == GST_TYPE_LIST) { - int i; - - g_value_init (dest, GST_TYPE_LIST); - for (i = 0; i < gst_value_list_get_size (src); i++) { - const GValue *s = gst_value_list_get_value (src, i); - GValue d = { 0 }; - int j; - - gst_audioscale_expand_value (&d, s); - - for (j = 0; j < gst_value_list_get_size (dest); j++) { - const GValue *s2 = gst_value_list_get_value (dest, j); - GValue d2 = { 0 }; - - gst_value_union (&d2, &d, s2); - if (G_VALUE_TYPE (&d2) == GST_TYPE_INT_RANGE) { - g_value_unset ((GValue *) s2); - gst_value_init_and_copy ((GValue *) s2, &d2); - break; - } - g_value_unset (&d2); - } - if (j == gst_value_list_get_size (dest)) { - gst_value_list_append_value (dest, &d); - } - g_value_unset (&d); - } - - if (gst_value_list_get_size (dest) == 1) { - const GValue *s = gst_value_list_get_value (dest, 0); - GValue d = { 0 }; - - gst_value_init_and_copy (&d, s); - g_value_unset (dest); - gst_value_init_and_copy (dest, &d); - g_value_unset (&d); - } - - return; - } - - GST_ERROR ("unexpected value type"); -} - -static GstCaps * -gst_audioscale_getcaps (const GstCaps * othercaps) -{ - GstCaps *caps; - int i; - - caps = gst_caps_copy (othercaps); - - /* we do this hack, because the audioscale lib doesn't handle - * rate conversions larger than a factor of 2 */ - for (i = 0; i < gst_caps_get_size (caps); i++) { - GstStructure *structure = gst_caps_get_structure (caps, i); - const GValue *value; - GValue dest = { 0 }; - - value = gst_structure_get_value (structure, "rate"); - if (value == NULL) { - GST_ERROR ("caps structure doesn't have required rate field"); - return NULL; - } - - gst_audioscale_expand_value (&dest, value); - - gst_structure_set_value (structure, "rate", &dest); - } - - return caps; -} - - -void -test_caps (const char *s) -{ - GstCaps *caps; - GstCaps *caps2; - char *s2; - - caps = gst_caps_from_string (s); - caps2 = gst_audioscale_getcaps (caps); - s2 = gst_caps_to_string (caps2); - - g_print ("original: %s\nfiltered: %s\n\n", s, s2); - - g_free (s2); - gst_caps_free (caps); - gst_caps_free (caps2); -} - - -int -main (int argc, char *argv[]) -{ - - gst_init (&argc, &argv); - - test_caps ("audio/x-raw-int, rate=(int)1"); - test_caps ("audio/x-raw-int, rate=(int)10"); - test_caps ("audio/x-raw-int, rate=(int)100"); - test_caps ("audio/x-raw-int, rate=(int)10000"); - test_caps ("audio/x-raw-int, rate=(int)2000000000"); - - test_caps ("audio/x-raw-int, rate=(int)[1,100]"); - test_caps ("audio/x-raw-int, rate=(int)[1000,40000]"); - - test_caps ("audio/x-raw-int, rate=(int){1,100}"); - test_caps ("audio/x-raw-int, rate=(int){100,200,300}"); - test_caps ("audio/x-raw-int, rate=(int){[100,200],1000}"); - - return 0; -} diff --git a/tests/old/testsuite/caps/caps.c b/tests/old/testsuite/caps/caps.c deleted file mode 100644 index c8169760dd..0000000000 --- a/tests/old/testsuite/caps/caps.c +++ /dev/null @@ -1,159 +0,0 @@ - -#include <gst/gst.h> - - -void -test1 (void) -{ - GstCaps *caps; - GstCaps *caps2; - - g_print ("type is %d\n", (int) gst_caps_get_type ()); - - caps = gst_caps_new_empty (); - g_assert (caps != NULL); - gst_caps_free (caps); - - caps = gst_caps_new_any (); - g_assert (caps != NULL); - gst_caps_free (caps); - - caps = gst_caps_new_simple ("audio/raw", "_int", G_TYPE_INT, 100, NULL); - g_assert (caps != NULL); - g_assert (gst_caps_is_empty (caps) == FALSE); - g_assert (gst_caps_is_any (caps) == FALSE); - g_assert (GST_CAPS_IS_SIMPLE (caps) == TRUE); - g_assert (gst_caps_is_fixed (caps) == TRUE); - g_print ("%s\n", gst_caps_to_string (caps)); - gst_caps_free (caps); - - caps = gst_caps_new_simple ("audio/raw", - "_double", G_TYPE_DOUBLE, 100.0, NULL); - g_assert (caps != NULL); - g_assert (gst_caps_is_empty (caps) == FALSE); - g_assert (gst_caps_is_any (caps) == FALSE); - g_assert (GST_CAPS_IS_SIMPLE (caps) == TRUE); - g_assert (gst_caps_is_fixed (caps) == TRUE); - g_print ("%s\n", gst_caps_to_string (caps)); - gst_caps_free (caps); - - caps = gst_caps_new_simple ("audio/raw", - "_fourcc", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('a', 'b', 'c', 'd'), NULL); - g_assert (caps != NULL); - g_assert (gst_caps_is_empty (caps) == FALSE); - g_assert (gst_caps_is_any (caps) == FALSE); - g_assert (GST_CAPS_IS_SIMPLE (caps) == TRUE); - g_assert (gst_caps_is_fixed (caps) == TRUE); - g_print ("%s\n", gst_caps_to_string (caps)); - gst_caps_free (caps); - - caps = gst_caps_new_simple ("audio/raw", - "_boolean", G_TYPE_BOOLEAN, TRUE, NULL); - g_assert (caps != NULL); - g_assert (gst_caps_is_empty (caps) == FALSE); - g_assert (gst_caps_is_any (caps) == FALSE); - g_assert (GST_CAPS_IS_SIMPLE (caps) == TRUE); - g_assert (gst_caps_is_fixed (caps) == TRUE); - g_print ("%s\n", gst_caps_to_string (caps)); - gst_caps_free (caps); - - caps = - gst_caps_new_full (gst_structure_new ("audio/raw", "_int", G_TYPE_INT, - 100, NULL), gst_structure_new ("audio/raw2", "_int", G_TYPE_INT, 100, - NULL), NULL); - g_assert (caps != NULL); - g_assert (gst_caps_is_empty (caps) == FALSE); - g_assert (gst_caps_is_any (caps) == FALSE); - g_assert (GST_CAPS_IS_SIMPLE (caps) == FALSE); - g_assert (gst_caps_is_fixed (caps) == FALSE); - g_print ("%s\n", gst_caps_to_string (caps)); - gst_caps_free (caps); - - caps = gst_caps_new_simple ("audio/raw", "_int", G_TYPE_INT, 100, NULL); - g_assert (caps != NULL); - caps2 = gst_caps_copy (caps); - g_assert (caps2 != NULL); - g_assert (gst_caps_is_empty (caps2) == FALSE); - g_assert (gst_caps_is_any (caps2) == FALSE); - g_assert (GST_CAPS_IS_SIMPLE (caps2) == TRUE); - g_assert (gst_caps_is_fixed (caps2) == TRUE); - g_print ("%s\n", gst_caps_to_string (caps)); - g_print ("%s\n", gst_caps_to_string (caps2)); - gst_caps_free (caps); - gst_caps_free (caps2); - - caps = gst_caps_new_simple ("audio/raw", "_int", G_TYPE_INT, 100, NULL); - gst_caps_append (caps, - gst_caps_new_simple ("audio/raw", "_int", G_TYPE_INT, 200, NULL)); - g_assert (caps != NULL); - g_assert (gst_caps_is_empty (caps) == FALSE); - g_assert (gst_caps_is_any (caps) == FALSE); - g_assert (GST_CAPS_IS_SIMPLE (caps) == FALSE); - g_assert (gst_caps_is_fixed (caps) == FALSE); - g_print ("%s\n", gst_caps_to_string (caps)); - gst_caps_free (caps); - - caps = gst_caps_new_simple ("audio/raw", "_int", G_TYPE_INT, 100, NULL); - g_assert (caps != NULL); - gst_caps_append_structure (caps, - gst_structure_new ("audio/raw", "_int", G_TYPE_INT, 200, NULL)); - g_assert (gst_caps_is_empty (caps) == FALSE); - g_assert (gst_caps_is_any (caps) == FALSE); - g_assert (GST_CAPS_IS_SIMPLE (caps) == FALSE); - g_assert (gst_caps_is_fixed (caps) == FALSE); - g_print ("%s\n", gst_caps_to_string (caps)); - gst_caps_free (caps); -} - -void -test2 (void) -{ - GstCaps *caps1; - GstCaps *caps2; - GstCaps *caps; - - caps1 = - gst_caps_new_full (gst_structure_new ("audio/raw", "_int", G_TYPE_INT, - 100, NULL), gst_structure_new ("audio/raw", "_int", G_TYPE_INT, 200, - NULL), NULL); - caps2 = - gst_caps_new_full (gst_structure_new ("audio/raw", "_int", G_TYPE_INT, - 100, NULL), gst_structure_new ("audio/raw", "_int", G_TYPE_INT, 300, - NULL), NULL); - caps = gst_caps_intersect (caps1, caps2); - g_print ("%s\n", gst_caps_to_string (caps)); - gst_caps_free (caps); - gst_caps_free (caps1); - gst_caps_free (caps2); - -} - -void -test3 (void) -{ - GstCaps *caps1; - GstCaps *caps2; - - caps1 = gst_caps_new_any (); - caps2 = gst_caps_new_simple ("audio/raw", NULL); - - gst_caps_append (caps1, caps2); - g_print ("%s\n", gst_caps_to_string (caps1)); - - g_assert (gst_caps_is_any (caps1)); - g_assert (gst_caps_get_size (caps1) == 0); - - gst_caps_free (caps1); -} - -int -main (int argc, char *argv[]) -{ - gst_init (&argc, &argv); - - test1 (); - test2 (); - test3 (); - - return 0; -} diff --git a/tests/old/testsuite/caps/caps.h b/tests/old/testsuite/caps/caps.h deleted file mode 100644 index 9c36868f1c..0000000000 --- a/tests/old/testsuite/caps/caps.h +++ /dev/null @@ -1,22 +0,0 @@ -#include <glib.h> - -/* defines an array of strings named caps_list, that contains a list of caps for - general tests. So if you don't know what caps to use to write a test, just - include this file */ - -static const gchar *caps_list[] = { -/* - "audio/x-adpcm, layout=(string)quicktime; audio/x-adpcm, layout=(string)quicktime; audio/x-adpcm, layout=(string)wav; audio/x-adpcm, layout=(string)wav; audio/x-adpcm, layout=(string)dk3; audio/x-adpcm, layout=(string)dk3; audio/x-adpcm, layout=(string)dk4; audio/x-adpcm, layout=(string)dk4; audio/x-adpcm, layout=(string)westwood; audio/x-adpcm, layout=(string)westwood; audio/x-adpcm, layout=(string)smjpeg; audio/x-adpcm, layout=(string)smjpeg; audio/x-adpcm, layout=(string)microsoft; audio/x-adpcm, layout=(string)microsoft; audio/x-adpcm, layout=(string)4xm; audio/x-adpcm, layout=(string)4xm; audio/x-adpcm, layout=(string)xa; audio/x-adpcm, layout=(string)xa; audio/x-adpcm, layout=(string)adx; audio/x-adpcm, layout=(string)adx; audio/x-adpcm, layout=(string)ea; audio/x-adpcm, layout=(string)ea; audio/x-adpcm, layout=(string)g726; audio/x-adpcm, layout=(string)g726", - "video/x-raw-yuv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], format=(fourcc)I420; video/x-raw-yuv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], format=(fourcc)YUY2; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)24, depth=(int)24, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, endianness=(int)4321; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)24, depth=(int)24, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, endianness=(int)4321; video/x-raw-yuv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], format=(fourcc)Y42B; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)32, depth=(int)24, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, endianness=(int)4321; video/x-raw-yuv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], format=(fourcc)YUV9; video/x-raw-yuv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], format=(fourcc)Y41B; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)16, depth=(int)16, red_mask=(int)63488, green_mask=(int)2016, blue_mask=(int)31, endianness=(int)1234; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)16, depth=(int)15, red_mask=(int)31744, green_mask=(int)992, blue_mask=(int)31, endianness=(int)1234", - "video/x-raw-yuv, format=(fourcc){ YUY2, I420 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-jpeg, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-divx, divxversion=(int)[ 3, 5 ], width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-xvid, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-3ivx, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-msmpeg, msmpegversion=(int)[ 41, 43 ], width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/mpeg, mpegversion=(int)1, systemstream=(boolean)false, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-h263, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-dv, systemstream=(boolean)false, width=(int)720, height=(int){ 576, 480 }; video/x-huffyuv, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]", - "video/x-raw-yuv, format=(fourcc){ YUY2, I420 }, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; image/jpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-divx, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], divxversion=(int)[ 3, 5 ]; video/x-xvid, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-3ivx, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-msmpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], msmpegversion=(int)[ 41, 43 ]; video/mpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], mpegversion=(int)1, systemstream=(boolean)false; video/x-h263, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-dv, width=(int)720, height=(int){ 576, 480 }, systemstream=(boolean)false; video/x-huffyuv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]", - "video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]", - "video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]", - "video/x-raw-yuv, format=(fourcc){ I420 }, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]", -*/ - "video/x-raw-rgb, bpp = (int) 32, depth = (int) 24, endianness = (int) BIG_ENDIAN, red_mask = (int) 0x000000FF, framerate = (double) [ 0, max ]", - "video/x-raw-rgb, bpp = (int) 32, depth = (int) 24, endianness = (int) BIG_ENDIAN, red_mask = (int) 0xFF000000, framerate = (double) [ 0, max ]", - "ANY", - "EMPTY" -}; - diff --git a/tests/old/testsuite/caps/caps_strings b/tests/old/testsuite/caps/caps_strings deleted file mode 100644 index 72f90522c4..0000000000 --- a/tests/old/testsuite/caps/caps_strings +++ /dev/null @@ -1,263 +0,0 @@ -ANY -EMPTY -image/bmp -image/gif -image/png -audio/x-au -image/jpeg -text/plain -audio/x-ac3 -audio/x-m4a -audio/x-mod -audio/x-sid -audio/x-wav -image/x-jng -image/x-xcf -video/x-4xm -video/x-fli -video/x-mng -audio/x-aiff -audio/x-flac -video/x-cdxa -audio/x-speex -text/uri-list -audio/x-vorbis -video/x-ms-asf -video/x-theora -application/ogg -application/zip -audio/x-shorten -image/x-xpixmap -video/quicktime -video/x-msvideo -video/x-matroska -application/x-ape -application/x-id3 -application/x-rtp -application/x-bzip -application/x-gzip -image/x-sun-raster -video/x-pn-realvideo -application/x-compress -video/x-dvd-subpicture -audio/x-gst_ff-vmdaudio -application/x-gst_ff-RoQ -application/x-gst_ff-ffm -application/x-gst_ff-flv -application/x-gst_ff-gif -application/x-gst_ff-mp3 -application/x-gst_ff-nut -application/x-gst_ff-sdp -application/x-gst_ff-vmd -application/x-gst_ff-flic -application/x-gst_ff-rtsp -application/x-gst_ff-idcin -application/x-gst_ff-redir -application/x-gst_ff-wsaud -application/x-gst_ff-wsvqa -application/x-gst_ff-psxstr -application/vnd.rn-realmedia -application/x-gst_ff-ipmovie -video/quicktime; audio/x-m4a -application/x-gst_ff-film_cpk -application/x-gst_ff-wc3movie -application/x-shockwave-flash -audio/mpeg, mpegversion=(int)1 -text/x-pango-markup; text/plain -audio/x-adpcm, layout=(string)ea -audio/x-adpcm, layout=(string)xa -audio/x-dpcm, layout=(string)roq -audio/x-dpcm, layout=(string)xan -audio/x-mace, maceversion=(int)3 -audio/x-mace, maceversion=(int)6 -application/x-gst_ff-yuv4mpegpipe -audio/x-adpcm, layout=(string)4xm -audio/x-adpcm, layout=(string)adx -audio/x-adpcm, layout=(string)dk3 -audio/x-adpcm, layout=(string)dk4 -audio/x-adpcm, layout=(string)dvi -audio/x-adpcm, layout=(string)g726 -audio/x-adpcm, layout=(string)smjpeg -audio/x-flac; application/x-gst-tags -audio/x-aiff; audio/x-wav; audio/x-au -audio/x-adpcm, layout=(string)westwood -audio/x-dpcm, layout=(string)interplay -audio/x-gsm, rate=(int)[ 1000, 48000 ] -audio/x-pn-realaudio, raversion=(int)1 -audio/x-pn-realaudio, raversion=(int)2 -audio/x-vorbis; application/x-gst-tags -video/mpeg, systemstream=(boolean)true -video/x-dv, systemstream=(boolean)true -audio/x-adpcm, layout=(string)microsoft -audio/x-adpcm, layout=(string)quicktime -video/mpeg, systemstream=(boolean)false -video/mpegts, systemstream=(boolean)true -application/x-yuv4mpeg, y4mversion=(int)1 -image/tiff, endianness=(int){ 4321, 1234 } -audio/mpeg, mpegversion=(int)1, layer=(int)2 -audio/mpeg, mpegversion=(int)1; audio/x-flac -audio/mpeg, mpegversion=(int)1, layer=(int)[ 1, 2 ] -audio/mpeg, mpegversion=(int)1, layer=(int)[ 1, 3 ] -application/x-pn-realmedia, systemstream=(boolean)true -audio/x-gsm, rate=(int)[ 1000, 48000 ], channels=(int)1 -audio/x-speex, rate=(int)[ 1000, 48000 ], channels=(int)1 -video/mpeg, mpegversion=(int)1, systemstream=(boolean)false -audio/x-ac3, channels=(int)[ 1, 6 ], rate=(int)[ 32000, 48000 ] -audio/x-alaw, rate=(int)[ 8000, 192000 ], channels=(int)[ 1, 2 ] -audio/x-mulaw, rate=(int)[ 8000, 192000 ], channels=(int)[ 1, 2 ] -video/mpeg, mpegversion=(int)[ 1, 2 ], systemstream=(boolean)true -video/mpeg, mpegversion=(int){ 1, 2 }, systemstream=(boolean)true -video/mpeg, systemstream=(boolean)true, mpegversion=(int)[ 1, 2 ] -audio/mpeg, systemstream=(boolean)false, mpegversion=(int){ 2, 4 } -video/mpeg, mpegversion=(int)[ 1, 2 ], systemstream=(boolean)false -video/mpeg, mpegversion=(int){ 1, 2 }, systemstream=(boolean)false -audio/x-raw-int, signed=(boolean)true, endianness=(int)1234, width=(int)16, depth=(int)16 -video/x-raw-yuv, format=(fourcc){ I420 }, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ] -video/x-raw-yuv, format=(fourcc)I420, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ] -audio/mpeg, mpegversion=(int)1, layer=(int)[ 1, 2 ], channels=(int)[ 1, 2 ], rate=(int)[ 8000, 96000 ] -audio/mpeg, mpegversion=(int)1, layer=(int)[ 1, 3 ], rate=(int)[ 8000, 48000 ], channels=(int)[ 1, 2 ] -video/x-raw-rgb, framerate=(double)[ 1, 100 ], width=(int)[ 0, 2147483647 ], height=(int)[ 0, 2147483647 ] -video/x-dv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -image/jpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 1, 1.7976931348623157e+308 ] -video/x-4xm, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-png, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-vp3, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-h263, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-h264, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-jpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-theora, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-cinepak, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-huffyuv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-gst_ff-flv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-gst_ff-smc, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-apple-video, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-gst_ff-8bps, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-gst_ff-asv1, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-gst_ff-asv2, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-gst_ff-cljr, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-gst_ff-cyuv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-gst_ff-flic, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-gst_ff-mdec, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-gst_ff-mszh, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-gst_ff-vcr1, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-gst_ff-zlib, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-gst_ff-qtrle, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -audio/x-raw-float, rate=(int)[ 1, 2147483647 ], channels=(int)1, endianness=(int)1234, buffer-frames=(int)[ 1, 2147483647 ] -audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)16000, channels=(int)1 -audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)44100, channels=(int)2 -video/x-gst_ff-xan_wc3, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-jpeg, width=(int)[ 0, 2147483647 ], height=(int)[ 0, 2147483647 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-jpeg, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-xvid, width=(int)[ 0, 2147483647 ], height=(int)[ 0, 2147483647 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-gst_ff-roqvideo, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-gst_ff-vmdvideo, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-gst_ff-vqavideo, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-gst_ff-idcinvideo, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-gst_ff-truemotion1, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -audio/x-raw-float, rate=(int)[ 11025, 48000 ], channels=(int)[ 1, 2 ], endianness=(int)1234, width=(int)32, buffer-frames=(int)0 -video/x-gst_ff-interplayvideo, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-ffv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], ffvversion=(int)1 -video/x-svq, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], svqversion=(int)1 -video/x-wmv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], wmvversion=(int)1 -video/x-wmv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], wmvversion=(int)2 -audio/x-raw-int, depth=(int)16, width=(int)16, signed=(boolean)true, channels=(int)2, endianness=(int)1234, rate=(int)[ 4000, 48000 ] -audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)[ 1000, 48000 ], channels=(int)1 -audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)[ 8000, 96000 ], channels=(int)1 -audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)[ 1, 2147483647 ], channels=(int)1 -audio/x-raw-int, rate=(int)[ 1, 2147483647 ], channels=(int)2, endianness=(int)1234, width=(int)16, depth=(int)16, signed=(boolean)true -video/x-indeo, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], indeoversion=(int)3 -video/x-raw-yuv, format=(fourcc)I420, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-msmpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], msmpegversion=(int)41 -video/x-msmpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], msmpegversion=(int)42 -video/x-msmpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], msmpegversion=(int)43 -audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)[ 1000, 48000 ], channels=(int)[ 1, 2 ] -audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)[ 4000, 48000 ], channels=(int)[ 1, 6 ] -audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)[ 8000, 96000 ], channels=(int)[ 1, 2 ] -audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)[ 11025, 48000 ], channels=(int)[ 1, 2 ] -audio/x-raw-int, width=(int)16, depth=(int)16, endianness=(int)1234, signed=(boolean)true, rate=(int)[ 8000, 192000 ], channels=(int)[ 1, 2 ] -audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)44100, channels=(int)2, chunksize=(int)2352 -video/x-msvideocodec, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], msvideoversion=(int)1 -video/x-raw-yuv, format=(fourcc)I420, height=(int)[ 1, 2147483647 ], width=(int)[ 1, 2147483647 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-raw-yuv, format=(fourcc){ I420, YV12 }, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int){ 32000, 44100, 48000 }, channels=(int)[ 1, 2 ] -audio/x-raw-float, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ], endianness=(int)1234, width=(int)32, buffer-frames=(int)[ 0, 2147483647 ] -video/mpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], mpegversion=(int)1, systemstream=(boolean)false -video/mpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], mpegversion=(int)2, systemstream=(boolean)false -video/mpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], systemstream=(boolean)false, mpegversion=(int)4 -video/x-rle, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], layout=(string)microsoft, depth=(int)[ 1, 64 ] -audio/x-raw-int, rate=(int)44100, channels=(int)2, endianness=(int)1234, width=(int)16, depth=(int)16, signed=(boolean)true, buffer-frames=(int)[ 1, 2147483647 ] -video/x-raw-yuv, format=(fourcc){ YV12, I420, IYUV }, height=(int)[ 1, 2147483647 ], width=(int)[ 1, 2147483647 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -audio/x-raw-int, endianness=(int)1234, signed=(boolean){ true, false }, width=(int){ 8, 16 }, depth=(int){ 8, 16 }, rate=(int)[ 8000, 48000 ], channels=(int)[ 1, 2 ] -audio/x-raw-int, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ], endianness=(int)1234, width=(int){ 8, 16 }, depth=(int){ 8, 16 }, signed=(boolean)true -video/x-raw-yuv, format=(fourcc){ YUY2, I420, YV12, YUYV, UYVY }, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -audio/x-raw-int, endianness=(int)1234, signed=(boolean){ true, false }, width=(int){ 8, 16 }, depth=(int){ 8, 16 }, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2 ] -video/x-pn-realvideo, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], systemstream=(boolean)false, rmversion=(int)1 -video/x-pn-realvideo, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], systemstream=(boolean)false, rmversion=(int)2 -video/x-raw-yuv, format=(fourcc){ I420, YV12, YUY2, YVYU, UYVY }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -audio/x-wma, wmaversion=(int)1, flags1=(int)[ -2147483648, 2147483647 ], flags2=(int)[ -2147483648, 2147483647 ], block_align=(int)[ 0, 2147483647 ], bitrate=(int)[ 0, 2147483647 ] -audio/x-wma, wmaversion=(int)2, flags1=(int)[ -2147483648, 2147483647 ], flags2=(int)[ -2147483648, 2147483647 ], block_align=(int)[ 0, 2147483647 ], bitrate=(int)[ 0, 2147483647 ] -video/x-raw-yuv, format=(fourcc)I420, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double){ 23.976023976, 24, 25, 29.97002997, 30, 50, 59.94005994, 60 } -audio/x-raw-int, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ], endianness=(int){ 1234, 4321 }, width=(int){ 8, 16, 32 }, depth=(int)[ 1, 32 ], signed=(boolean){ true, false } -audio/x-raw-int, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2 ], endianness=(int)1234, width=(int){ 8, 16 }, depth=(int){ 8, 16 }, signed=(boolean){ true, false }, buffer-frames=(int)[ 1, 2147483647 ] -audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)[ 8000, 48000 ], channels=(int)[ 1, 2 ]; audio/x-mulaw, rate=(int)[ 8000, 48000 ], channels=(int)[ 1, 2 ] -audio/mpeg, mpegversion=(int)1; audio/x-raw-int, endianness=(int)4321, signed=(boolean)true, width=(int){ 16, 20, 24 }, depth=(int){ 16, 20, 24 }, rate=(int){ 48000, 96000 }, channels=(int)[ 1, 8 ]; audio/x-ac3 -audio/x-raw-int, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ], endianness=(int)1234, width=(int){ 8, 16 }, depth=(int){ 8, 16 }, signed=(boolean){ true, false }, buffer-frames=(int)[ 1, 2147483647 ] -video/x-raw-rgb, framerate=(double)[ 1, 100 ], width=(int)[ 0, 2147483647 ], height=(int)[ 0, 2147483647 ]; video/x-raw-yuv, framerate=(double)[ 1, 100 ], width=(int)[ 0, 2147483647 ], height=(int)[ 0, 2147483647 ] -video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 1, 60 ] -video/mpeg, mpegversion=(int)1, systemstream=(boolean)false, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], pixel_width=(int)[ 1, 255 ], pixel_height=(int)[ 1, 255 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/mpeg, mpegversion=(int){ 1, 4 }, systemstream=(boolean)false, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double){ 23.976023976, 24, 25, 29.97002997, 30, 50, 59.94005994, 60 } -video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)256, height=(int)128, framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-raw-rgb, bpp=(int)16, depth=(int)16, endianness=(int)1234, red_mask=(int)63488, green_mask=(int)2016, blue_mask=(int)31, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-raw-rgb, bpp=(int)24, depth=(int)24, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-raw-rgb, bpp=(int)24, depth=(int)24, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -audio/x-raw-float, depth=(int)32, endianness=(int)1234, rate=(int)[ 11025, 48000 ], channels=(int)2; audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)[ 11025, 48000 ], channels=(int)[ 1, 2 ] -video/x-svq, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], svqversion=(int)3, halfpel_flag=(int)[ 0, 1 ], thirdpel_flag=(int)[ 0, 1 ], low_delay=(int)[ 0, 1 ], unknown_svq3_flag=(int)[ 0, 1 ] -video/x-raw-rgb, depth=(int)24, bpp=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, height=(int)[ 1, 2147483647 ], width=(int)[ 1, 2147483647 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -audio/x-raw-int, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ], endianness=(int){ 1234, 4321 }, width=(int){ 8, 16, 32 }, depth=(int)[ 1, 32 ], signed=(boolean){ true, false }; audio/x-alaw, rate=(int)[ 8000, 48000 ], channels=(int)[ 1, 2 ] -audio/x-raw-int, endianess=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)[ 1000, 96000 ], channels=(int)[ 1, 2 ]; audio/x-raw-int, signed=(boolean)false, width=(int)8, depth=(int)8, rate=(int)[ 1000, 96000 ], channels=(int)[ 1, 2 ] -audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)[ 8000, 96000 ], channels=(int)[ 1, 2 ]; audio/x-raw-int, signed=(boolean)false, width=(int)8, depth=(int)8, rate=(int)[ 8000, 96000 ], channels=(int)[ 1, 2 ] -video/x-raw-yuv, format=(fourcc){ YV12, I420, Y42B }, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], pixel_width=(int)[ 1, 255 ], pixel_height=(int)[ 1, 255 ], framerate=(double){ 23.976023976, 24, 25, 29.97002997, 30, 50, 59.94005994, 60 } -audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)[ 4000, 96000 ], channels=(int)1; audio/x-raw-float, rate=(int)[ 1, 2147483647 ], channels=(int)1, endianness=(int)1234, width=(int)32, buffer-frames=(int)[ 0, 2147483647 ] -video/x-divx, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], divxversion=(int)3; video/x-msmpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], msmpegversion=(int)43 -audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int){ 16, 24, 32 }, depth=(int){ 16, 24, 32 }, rate=(int)[ 8000, 96000 ], channels=(int)[ 1, 6 ]; audio/x-raw-float, endianness=(int)1234, depth=(int){ 32, 64 }, rate=(int)[ 8000, 96000 ], channels=(int)[ 1, 6 ] -audio/x-raw-int, rate=(int)[ 1, 2147483647 ], channels=(int)1, endianness=(int)1234, width=(int)16, depth=(int)16, signed=(boolean){ true, false }; audio/x-raw-float, rate=(int)[ 1, 2147483647 ], channels=(int)1, endianness=(int)1234, width=(int)32, buffer-frames=(int)[ 0, 2147483647 ] -audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int){ 8000, 11025, 22050, 44100 }, channels=(int)[ 1, 2 ]; audio/x-raw-int, signed=(boolean)false, width=(int)8, depth=(int)8, rate=(int){ 8000, 11025, 22050, 44100 }, channels=(int)[ 1, 2 ] -audio/x-raw-float, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ], endianness=(int)1234, width=(int)32, buffer-frames=(int)[ 1, 2147483647 ]; audio/x-raw-int, channels=(int)[ 1, 2147483647 ], rate=(int)[ 1, 2147483647 ], endianness=(int)1234, width=(int)16, depth=(int)16, signed=(boolean)true -audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]; audio/x-raw-float, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ], endianness=(int)1234, width=(int)32, buffer-frames=(int)[ 0, 2147483647 ] -audio/x-raw-int, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ], endianness=(int){ 1234, 4321 }, width=(int){ 8, 16, 32 }, depth=(int)[ 1, 32 ], signed=(boolean){ true, false }; audio/x-raw-float, rate=(int)[ 1, 2147483647 ], channels=(int)1, endianness=(int)1234, buffer-frames=(int)[ 1, 2147483647 ] -audio/x-raw-int, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ], endianness=(int)1234, width=(int)16, depth=(int)16, signed=(boolean){ true, false }; audio/x-raw-float, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ], endianness=(int)1234, width=(int)32, buffer-frames=(int)[ 0, 2147483647 ] -audio/x-raw-int, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2 ], endianness=(int){ 1234, 4321 }, width=(int){ 8, 16, 32 }, depth=(int)[ 1, 32 ], signed=(boolean){ true, false }; audio/x-raw-float, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2 ], endianness=(int)1234, width=(int)32, buffer-frames=(int)[ 0, 2147483647 ] -image/png; image/jpeg; image/gif; image/x-icon; application/x-navi-animation; image/x-cmu-raster; image/x-sun-raster; image/x-pixmap; image/tiff; image/x-portable-anymap; image/x-portable-bitmap; image/x-portable-graymap; image/x-portable-pixmap; image/bmp; image/x-bmp; image/x-MS-bmp; image/vnd.wap.wbmp; image/x-bitmap; image/x-tga -audio/x-raw-int, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ], endianness=(int){ 1234, 4321 }, width=(int){ 8, 16, 32 }, depth=(int)[ 1, 32 ], signed=(boolean){ true, false }; audio/x-raw-float, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ], endianness=(int){ 1234, 4321 }, width=(int){ 32, 64 }, buffer-frames=(int)[ 1, 2147483647 ] -audio/x-raw-int, endianness=(int)1234, signed=(boolean){ true, false }, width=(int){ 8, 16 }, depth=(int){ 8, 16 }, rate=(int)[ 1000, 96000 ], channels=(int)[ 1, 2 ]; audio/mpeg, mpegversion=(int)1, layer=(int)[ 1, 3 ], rate=(int)[ 1000, 96000 ], channels=(int)[ 1, 2 ]; audio/x-vorbis, rate=(int)[ 1000, 96000 ], channels=(int)[ 1, 2 ]; audio/x-ac3, rate=(int)[ 1000, 96000 ], channels=(int)[ 1, 2 ] -audio/x-raw-int, endianness=(int)1234, signed=(boolean){ true, false }, width=(int){ 8, 16 }, depth=(int){ 8, 16 }, rate=(int)[ 1000, 96000 ], channels=(int)[ 1, 2 ]; audio/mpeg, mpegversion=(int)1, layer=(int){ 1, 3 }, rate=(int)[ 1000, 96000 ], channels=(int)[ 1, 2 ]; audio/x-vorbis, rate=(int)[ 1000, 96000 ], channels=(int)[ 1, 2 ]; audio/x-ac3, rate=(int)[ 1000, 96000 ], channels=(int)[ 1, 2 ] -audio/mpeg, mpegversion=(int)1, layer=(int)[ 1, 3 ], channels=(int)[ 1, 8 ], rate=(int)[ 8000, 96000 ]; audio/mpeg, mpegversion=(int){ 2, 4 }, channels=(int)[ 1, 8 ], rate=(int)[ 8000, 96000 ]; audio/x-ac3, channels=(int)[ 1, 8 ], rate=(int)[ 8000, 96000 ]; audio/x-raw-int, width=(int){ 8, 16, 24 }, depth=(int){ 8, 16, 24 }, endianness=(int){ 4321, 1234 }, signed=(boolean){ true, false }, channels=(int)[ 1, 8 ], rate=(int)[ 8000, 96000 ] -video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/mpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], mpegversion=(int)4, systemstream=(boolean)false; video/x-3ivx, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-divx, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], divxversion=(int)[ 4, 5 ]; video/x-xvid, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-raw-yuv, format=(fourcc)YUY2, width=(int)720, height=(int){ 480, 576 }, framerate=(double){ 25, 29.97002997 }; video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, width=(int)720, height=(int){ 480, 576 }, framerate=(double){ 25, 29.97002997 }; video/x-raw-rgb, bpp=(int)24, depth=(int)24, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, width=(int)720, height=(int){ 480, 576 }, framerate=(double){ 25, 29.97002997 } -audio/mpeg, mpegversion=(int)1, layer=(int){ 3, 2 }, rate=(int)[ 8000, 96000 ], channels=(int)[ 1, 2 ]; audio/x-ac3, rate=(int)[ 8000, 96000 ], channels=(int)[ 1, 2 ]; audio/x-adpcm, layout=(string)microsoft, rate=(int)[ 8000, 96000 ], channels=(int)[ 1, 2 ]; audio/x-alaw, rate=(int)[ 8000, 96000 ], channels=(int)[ 1, 2 ]; audio/x-mulaw, rate=(int)[ 8000, 96000 ], channels=(int)[ 1, 2 ]; audio/x-raw-int, endianness=(int)1234, signed=(boolean){ true, false }, width=(int){ 8, 16 }, depth=(int){ 8, 16 }, rate=(int)[ 8000, 96000 ], channels=(int)[ 1, 2 ]; audio/x-vorbis, rate=(int)[ 8000, 96000 ], channels=(int)[ 1, 2 ] -audio/x-raw-int, endianness=(int)1234, signed=(boolean){ true, false }, width=(int){ 8, 16 }, depth=(int){ 8, 16 }, rate=(int)[ 8000, 48000 ], channels=(int)[ 1, 2 ]; audio/mpeg, mpegversion=(int)1, layer=(int)[ 1, 3 ], rate=(int)[ 8000, 48000 ], channels=(int)[ 1, 2 ]; audio/x-alaw, rate=(int)[ 8000, 48000 ], channels=(int)[ 1, 2 ]; audio/x-mulaw, rate=(int)[ 8000, 48000 ], channels=(int)[ 1, 2 ]; audio/x-adpcm, layout=(string)microsoft, block_align=(int)[ 1, 8192 ], rate=(int)[ 8000, 48000 ], channels=(int)[ 1, 2 ]; audio/x-adpcm, layout=(string)dvi, block_align=(int)[ 1, 8192 ], rate=(int)[ 8000, 48000 ], channels=(int)[ 1, 2 ] -video/x-raw-rgb, depth=(int)24, bpp=(int)24, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, height=(int)[ 1, 2147483647 ], width=(int)[ 1, 2147483647 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, depth=(int)24, bpp=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, height=(int)[ 1, 2147483647 ], width=(int)[ 1, 2147483647 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-yuv, format=(fourcc)I420, height=(int)[ 1, 2147483647 ], width=(int)[ 1, 2147483647 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, bpp=(int)24, depth=(int)24, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, bpp=(int)16, depth=(int)16, endianness=(int)1234, red_mask=(int)63488, green_mask=(int)2016, blue_mask=(int)31, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -audio/mpeg, mpegversion=(int)1, layer=(int){ 3, 2 }, rate=(int)[ 8000, 96000 ], channels=(int)[ 1, 2 ]; audio/x-ac3, rate=(int)[ 8000, 96000 ], channels=(int)[ 1, 2 ]; audio/x-raw-int, endianness=(int)1234, signed=(boolean){ true, false }, width=(int){ 8, 16 }, depth=(int){ 8, 16 }, rate=(int)[ 8000, 96000 ], channels=(int)[ 1, 2 ]; audio/x-vorbis, rate=(int)[ 8000, 96000 ], channels=(int)[ 1, 2 ]; audio/x-wma, wmaversion=(int){ 1, 2 }, flags1=(int)[ -2147483648, 2147483647 ], flags2=(int)[ -2147483648, 2147483647 ], block_align=(int)[ 0, 2147483647 ], bitrate=(int)[ 0, 2147483647 ], rate=(int)[ 8000, 96000 ], channels=(int)[ 1, 2 ]; audio/x-wma, wmaversion=(int)9, rate=(int)[ 8000, 96000 ], channels=(int)[ 1, 2 ] -audio/mpeg, mpegversion=(int)1, layer=(int){ 3, 2 }; audio/x-ac3; audio/x-adpcm, layout=(string){ g726, ea, adx, xa, 4xm, microsoft, smjpeg, westwood, dk4, dk3, dvi, quicktime }; audio/x-alaw; audio/x-dpcm, layout=(string){ roq, interplay, xan }; audio/x-gst_ff-vmdaudio; audio/x-mace, maceversion=(int){ 3, 6 }; audio/x-mulaw; audio/x-pn-realaudio, raversion=(int){ 1, 2 }; audio/x-raw-int, width=(int)16, depth=(int)16, endianness=(int){ 4321, 1234 }, signed=(boolean){ false, true }; audio/x-raw-int, width=(int)8, depth=(int)8, endianness=(int)1234, signed=(boolean){ false, true }; audio/x-wma, wmaversion=(int){ 1, 2 }, flags1=(int)[ -2147483648, 2147483647 ], flags2=(int)[ -2147483648, 2147483647 ], block_align=(int)[ 0, 2147483647 ], bitrate=(int)[ 0, 2147483647 ] -video/mpeg, mpegversion=(int){ 1, 2, 4 }, systemstream=(boolean)false, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-divx, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-xvid, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-msmpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-jpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-yuv, format=(fourcc){ YUY2, I420 }, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-raw-yuv, format=(fourcc){ YUY2, I420 }, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; image/jpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-divx, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], divxversion=(int)[ 3, 5 ]; video/x-xvid, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-3ivx, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-msmpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], msmpegversion=(int)[ 41, 43 ]; video/mpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], mpegversion=(int)1, systemstream=(boolean)false; video/x-h263, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-dv, width=(int)720, height=(int){ 576, 480 }, systemstream=(boolean)false; video/x-huffyuv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ] -audio/mpeg, mpegversion=(int)1, layer=(int){ 1, 2, 3 }, channels=(int)[ 1, 6 ], rate=(int)[ 4000, 96000 ]; audio/mpeg, mpegversion=(int){ 2, 4 }, channels=(int)[ 1, 6 ], rate=(int)[ 4000, 96000 ]; audio/x-ac3, channels=(int)[ 1, 6 ], rate=(int)[ 4000, 96000 ]; audio/x-adpcm, layout=(string)microsoft, rate=(int)[ 4000, 96000 ], channels=(int)[ 1, 6 ]; audio/x-alaw, rate=(int)[ 4000, 96000 ], channels=(int)[ 1, 6 ]; audio/x-mulaw, rate=(int)[ 4000, 96000 ], channels=(int)[ 1, 6 ]; audio/x-raw-float, endianness=(int)1234, buffer-frames=(int)[ 1, 2147483647 ], width=(int)[ 32, 64 ], channels=(int)[ 1, 6 ], rate=(int)[ 4000, 96000 ]; audio/x-raw-int, signed=(boolean){ true, false }, depth=(int){ 8, 16 }, width=(int){ 8, 16 }, endianness=(int){ 4321, 1234 }, channels=(int)[ 1, 6 ], rate=(int)[ 4000, 96000 ]; audio/x-vorbis, rate=(int)[ 4000, 96000 ], channels=(int)[ 1, 6 ] -video/x-raw-yuv, format=(fourcc){ YUY2, I420 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-jpeg, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-divx, divxversion=(int)[ 3, 5 ], width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-xvid, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-3ivx, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-msmpeg, msmpegversion=(int)[ 41, 43 ], width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/mpeg, mpegversion=(int)1, systemstream=(boolean)false, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-h263, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-dv, systemstream=(boolean)false, width=(int)720, height=(int){ 576, 480 }; video/x-huffyuv, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ] -video/x-divx, divxversion=(int){ 3, 5 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(double)[ 25, 1.7976931348623157e+308 ]; video/x-dv, systemstream=(boolean)false, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(double)[ 25, 1.7976931348623157e+308 ]; video/x-jpeg, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(double)[ 25, 1.7976931348623157e+308 ]; video/x-msmpeg, msmpegversion=(int){ 41, 42, 43 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(double)[ 25, 1.7976931348623157e+308 ]; video/x-raw-yuv, format=(fourcc){ I420, YUY2 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(double)[ 25, 1.7976931348623157e+308 ]; video/x-wmv, wmvversion=(int){ 1, 2 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(double)[ 25, 1.7976931348623157e+308 ] -video/x-raw-rgb, bpp=(int)24, depth=(int)24, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, bpp=(int)16, depth=(int)16, endianness=(int)1234, red_mask=(int)63488, green_mask=(int)2016, blue_mask=(int)31, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, bpp=(int)16, depth=(int)15, endianness=(int)1234, red_mask=(int)31744, green_mask=(int)992, blue_mask=(int)31, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-raw-rgb, depth=(int)24, bpp=(int)32, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, height=(int)[ 1, 2147483647 ], width=(int)[ 1, 2147483647 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, depth=(int)24, bpp=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, height=(int)[ 1, 2147483647 ], width=(int)[ 1, 2147483647 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, depth=(int)24, bpp=(int)32, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, height=(int)[ 1, 2147483647 ], width=(int)[ 1, 2147483647 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, depth=(int)24, bpp=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, height=(int)[ 1, 2147483647 ], width=(int)[ 1, 2147483647 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -audio/x-alaw, rate=(int)[ 8000, 192000 ], channels=(int)1; audio/x-mulaw, rate=(int)[ 8000, 192000 ], channels=(int)1; audio/x-raw-float, width=(int){ 32, 64 }, endianness=(int)1234, rate=(int)[ 8000, 192000 ], channels=(int)1; audio/x-raw-int, width=(int)16, depth=(int)16, signed=(boolean){ false, true }, endianness=(int){ 1234, 4321 }, rate=(int)[ 8000, 192000 ], channels=(int)1; audio/x-raw-int, width=(int)32, depth=(int)24, signed=(boolean){ false, true }, endianness=(int){ 1234, 4321 }, rate=(int)[ 8000, 192000 ], channels=(int)1; audio/x-raw-int, width=(int)32, depth=(int)32, signed=(boolean){ false, true }, endianness=(int){ 1234, 4321 }, rate=(int)[ 8000, 192000 ], channels=(int)1; audio/x-raw-int, width=(int)24, depth=(int)24, signed=(boolean){ false, true }, endianness=(int){ 1234, 4321 }, rate=(int)[ 8000, 192000 ], channels=(int)1; audio/x-raw-int, width=(int)24, depth=(int)20, signed=(boolean){ false, true }, endianness=(int){ 1234, 4321 }, rate=(int)[ 8000, 192000 ], channels=(int)1; audio/x-raw-int, width=(int)24, depth=(int)18, signed=(boolean){ false, true }, endianness=(int){ 1234, 4321 }, rate=(int)[ 8000, 192000 ], channels=(int)1; audio/x-raw-int, width=(int)8, depth=(int)8, signed=(boolean){ true, false }, rate=(int)[ 8000, 192000 ], channels=(int)1 -video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)24, depth=(int)24, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, endianness=(int)4321; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)24, depth=(int)24, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, endianness=(int)4321; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)32, depth=(int)24, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, endianness=(int)4321; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)16, depth=(int)16, red_mask=(int)63488, green_mask=(int)2016, blue_mask=(int)31, endianness=(int)1234; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)16, depth=(int)15, red_mask=(int)31744, green_mask=(int)992, blue_mask=(int)31, endianness=(int)1234; video/x-raw-yuv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], format=(fourcc){ I420, YUY2, Y42B, YUV9, Y41B } -audio/x-alaw, rate=(int)[ 8000, 192000 ], channels=(int)[ 1, 32 ]; audio/x-mulaw, rate=(int)[ 8000, 192000 ], channels=(int)[ 1, 32 ]; audio/x-raw-float, width=(int){ 32, 64 }, endianness=(int)1234, rate=(int)[ 8000, 192000 ], channels=(int)[ 1, 32 ]; audio/x-raw-int, width=(int)16, depth=(int)16, signed=(boolean){ false, true }, endianness=(int){ 1234, 4321 }, rate=(int)[ 8000, 192000 ], channels=(int)[ 1, 32 ]; audio/x-raw-int, width=(int)32, depth=(int)24, signed=(boolean){ false, true }, endianness=(int){ 1234, 4321 }, rate=(int)[ 8000, 192000 ], channels=(int)[ 1, 32 ]; audio/x-raw-int, width=(int)32, depth=(int)32, signed=(boolean){ false, true }, endianness=(int){ 1234, 4321 }, rate=(int)[ 8000, 192000 ], channels=(int)[ 1, 32 ]; audio/x-raw-int, width=(int)24, depth=(int)24, signed=(boolean){ false, true }, endianness=(int){ 1234, 4321 }, rate=(int)[ 8000, 192000 ], channels=(int)[ 1, 32 ]; audio/x-raw-int, width=(int)24, depth=(int)20, signed=(boolean){ false, true }, endianness=(int){ 1234, 4321 }, rate=(int)[ 8000, 192000 ], channels=(int)[ 1, 32 ]; audio/x-raw-int, width=(int)24, depth=(int)18, signed=(boolean){ false, true }, endianness=(int){ 1234, 4321 }, rate=(int)[ 8000, 192000 ], channels=(int)[ 1, 32 ]; audio/x-raw-int, width=(int)8, depth=(int)8, signed=(boolean){ true, false }, rate=(int)[ 8000, 192000 ], channels=(int)[ 1, 32 ] -video/x-raw-rgb, bpp=(int){ 32, 24 }, endianness=(int)4321, depth=(int)24, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, bpp=(int){ 32, 24 }, endianness=(int)4321, depth=(int)24, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, bpp=(int)32, endianness=(int)4321, depth=(int)24, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, bpp=(int)32, endianness=(int)4321, depth=(int)24, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, bpp=(int)16, endianness=(int)1234, depth=(int)16, red_mask=(int)63488, green_mask=(int)2016, blue_mask=(int)31, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, bpp=(int)16, endianness=(int)1234, depth=(int)15, red_mask=(int)31744, green_mask=(int)992, blue_mask=(int)31, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-yuv, format=(fourcc){ YUY2, UYVY, Y422, UYNV, YVYU, IYU2, YVU9, YUV9, YV12, I420, Y800 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-raw-rgb, depth=(int)24, bpp=(int){ 32, 24 }, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, width=(int)[ 100, 2147483647 ], height=(int)[ 100, 2147483647 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, depth=(int)24, bpp=(int){ 32, 24 }, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, width=(int)[ 100, 2147483647 ], height=(int)[ 100, 2147483647 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, depth=(int)24, bpp=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, width=(int)[ 100, 2147483647 ], height=(int)[ 100, 2147483647 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, depth=(int)24, bpp=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)[ 100, 2147483647 ], height=(int)[ 100, 2147483647 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, depth=(int)16, bpp=(int)16, endianness=(int)1234, red_mask=(int)63488, green_mask=(int)2016, blue_mask=(int)31, width=(int)[ 100, 2147483647 ], height=(int)[ 100, 2147483647 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, depth=(int)15, bpp=(int)16, endianness=(int)1234, red_mask=(int)31744, green_mask=(int)992, blue_mask=(int)31, width=(int)[ 100, 2147483647 ], height=(int)[ 100, 2147483647 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-yuv, format=(fourcc){ YUY2, UYVY, Y422, UYNV, YVYU, YV12, I420, Y800 }, width=(int)[ 100, 2147483647 ], height=(int)[ 100, 2147483647 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-dv, systemstream=(boolean)true, width=(int)[ 1, 4096 ], height=(int)[ 1, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-jpeg, width=(int)[ 1, 4096 ], height=(int)[ 1, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, bpp=(int)8, depth=(int)8, red_mask=(int)224, green_mask=(int)28, blue_mask=(int)3, endianness=(int)1234, width=(int)[ 1, 4096 ], height=(int)[ 1, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, bpp=(int)16, depth=(int)15, red_mask=(int)31744, green_mask=(int)992, blue_mask=(int)31, endianness=(int){ 1234, 4321 }, width=(int)[ 1, 4096 ], height=(int)[ 1, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, bpp=(int)24, depth=(int)24, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, endianness=(int)4321, width=(int)[ 1, 4096 ], height=(int)[ 1, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, bpp=(int)24, depth=(int)24, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, endianness=(int)4321, width=(int)[ 1, 4096 ], height=(int)[ 1, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)32, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, endianness=(int)4321, width=(int)[ 1, 4096 ], height=(int)[ 1, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)32, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, endianness=(int)4321, width=(int)[ 1, 4096 ], height=(int)[ 1, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-yuv, format=(fourcc){ YVU9, YV12, YUY2, UYVY, Y42B, Y41B, Y41P, YUV9, I420 }, width=(int)[ 1, 4096 ], height=(int)[ 1, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-raw-yuv, format=(fourcc){ I420, YUY2, YV12, YVYU, UYVY }, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, width=(int)[ 0, 2147483647 ], height=(int)[ 0, 2147483647 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], depth=(int)24, bpp=(int)32, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255; video/x-raw-rgb, width=(int)[ 0, 2147483647 ], height=(int)[ 0, 2147483647 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], depth=(int)24, bpp=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280; video/x-raw-rgb, width=(int)[ 0, 2147483647 ], height=(int)[ 0, 2147483647 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], depth=(int)24, bpp=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216; video/x-raw-rgb, width=(int)[ 0, 2147483647 ], height=(int)[ 0, 2147483647 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], depth=(int)24, bpp=(int)32, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680; video/x-raw-rgb, width=(int)[ 0, 2147483647 ], height=(int)[ 0, 2147483647 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], depth=(int)24, bpp=(int)24, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680; video/x-raw-rgb, bpp=(int)16, depth=(int)15, endianness=(int)1234, red_mask=(int)31744, green_mask=(int)992, blue_mask=(int)31, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, bpp=(int)16, depth=(int)16, endianness=(int)1234, red_mask=(int)63488, green_mask=(int)2016, blue_mask=(int)31, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, bpp=(int)24, depth=(int)24, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, bpp=(int)24, depth=(int)24, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, bpp=(int)16, depth=(int)16, endianness=(int)1234, red_mask=(int)63488, green_mask=(int)2016, blue_mask=(int)31, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, bpp=(int)16, depth=(int)15, endianness=(int)1234, red_mask=(int)31744, green_mask=(int)992, blue_mask=(int)31, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -image/jpeg, framerate=(double)[ 0, 1.7976931348623157e+308 ], width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/mpeg, systemstream=(boolean)false, mpegversion=(int)1, framerate=(double)[ 0, 1.7976931348623157e+308 ], width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-3ivx, framerate=(double)[ 0, 1.7976931348623157e+308 ], width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-cinepak, framerate=(double)[ 0, 1.7976931348623157e+308 ], width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-divx, divxversion=(int){ 3, 4 }, framerate=(double)[ 0, 1.7976931348623157e+308 ], width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-dv, systemstream=(boolean)false, framerate=(double)[ 0, 1.7976931348623157e+308 ], width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-h263, framerate=(double)[ 0, 1.7976931348623157e+308 ], width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-huffyuv, framerate=(double)[ 0, 1.7976931348623157e+308 ], width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-msmpeg, msmpegversion=(int){ 41, 42, 43 }, framerate=(double)[ 0, 1.7976931348623157e+308 ], width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-msvideocodec, msvideoversion=(int)1, framerate=(double)[ 0, 1.7976931348623157e+308 ], width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-raw-yuv, format=(fourcc){ I420, YUY2 }, framerate=(double)[ 0, 1.7976931348623157e+308 ], width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-rle, layout=(string)microsoft, depth=(int)[ 1, 64 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-wmv, wmvversion=(int){ 1, 2 }, framerate=(double)[ 0, 1.7976931348623157e+308 ], width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-xvid, framerate=(double)[ 0, 1.7976931348623157e+308 ], width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ] -video/x-raw-rgb, bpp=(int)24, depth=(int)24, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, bpp=(int)24, depth=(int)24, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, bpp=(int)16, depth=(int)16, endianness=(int)1234, red_mask=(int)63488, green_mask=(int)2016, blue_mask=(int)31, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, bpp=(int)16, depth=(int)15, endianness=(int)1234, red_mask=(int)31744, green_mask=(int)992, blue_mask=(int)31, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-yuv, format=(fourcc){ I420, YV12, YUY2, YVYU, UYVY, YUV9, YVU9, Y800, Y41P, Y41B, Y42B, IUY2 }, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ] -image/jpeg, framerate=(double)[ 0, 1.7976931348623157e+308 ], width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], pixel_width=(int)[ 0, 255 ], pixel_height=(int)[ 0, 255 ]; video/mpeg, mpegversion=(int){ 4, 2, 1 }, systemstream=(boolean)false, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], pixel_width=(int)[ 0, 255 ], pixel_height=(int)[ 0, 255 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-3ivx, framerate=(double)[ 0, 1.7976931348623157e+308 ], width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], pixel_width=(int)[ 0, 255 ], pixel_height=(int)[ 0, 255 ]; video/x-cinepak, framerate=(double)[ 0, 1.7976931348623157e+308 ], width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], pixel_width=(int)[ 0, 255 ], pixel_height=(int)[ 0, 255 ]; video/x-divx, divxversion=(int){ 5, 4, 3 }, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], pixel_width=(int)[ 0, 255 ], pixel_height=(int)[ 0, 255 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-dv, systemstream=(boolean)false, framerate=(double)[ 0, 1.7976931348623157e+308 ], width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], pixel_width=(int)[ 0, 255 ], pixel_height=(int)[ 0, 255 ]; video/x-h263, framerate=(double)[ 0, 1.7976931348623157e+308 ], width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], pixel_width=(int)[ 0, 255 ], pixel_height=(int)[ 0, 255 ]; video/x-huffyuv, framerate=(double)[ 0, 1.7976931348623157e+308 ], width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], pixel_width=(int)[ 0, 255 ], pixel_height=(int)[ 0, 255 ]; video/x-jpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], pixel_width=(int)[ 0, 255 ], pixel_height=(int)[ 0, 255 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-msmpeg, msmpegversion=(int){ 41, 42, 43 }, framerate=(double)[ 0, 1.7976931348623157e+308 ], width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], pixel_width=(int)[ 0, 255 ], pixel_height=(int)[ 0, 255 ]; video/x-msvideocodec, msvideoversion=(int)1, framerate=(double)[ 0, 1.7976931348623157e+308 ], width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], pixel_width=(int)[ 0, 255 ], pixel_height=(int)[ 0, 255 ]; video/x-raw-yuv, format=(fourcc){ YV12, YUY2, I420 }, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], pixel_width=(int)[ 0, 255 ], pixel_height=(int)[ 0, 255 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-rle, layout=(string)microsoft, depth=(int)[ 1, 64 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], pixel_width=(int)[ 0, 255 ], pixel_height=(int)[ 0, 255 ]; video/x-wmv, wmvversion=(int){ 1, 2 }, framerate=(double)[ 0, 1.7976931348623157e+308 ], width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], pixel_width=(int)[ 0, 255 ], pixel_height=(int)[ 0, 255 ]; video/x-xvid, framerate=(double)[ 0, 1.7976931348623157e+308 ], width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], pixel_width=(int)[ 0, 255 ], pixel_height=(int)[ 0, 255 ] -video/x-dv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/mpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], mpegversion=(int){ 1, 2, 4 }, systemstream=(boolean)false; video/x-4xm, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-apple-video, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-cinepak, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-ffv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], ffvversion=(int)1; video/x-gst_ff-8bps, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-gst_ff-asv1, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-gst_ff-asv2, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-gst_ff-cljr, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-gst_ff-cyuv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-gst_ff-flic, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-gst_ff-flv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-gst_ff-idcinvideo, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-gst_ff-interplayvideo, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-gst_ff-mdec, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-gst_ff-mszh, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-gst_ff-qtrle, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-gst_ff-roqvideo, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-gst_ff-smc, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-gst_ff-truemotion1, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-gst_ff-vcr1, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-gst_ff-vmdvideo, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-gst_ff-vqavideo, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-gst_ff-xan_wc3, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-gst_ff-zlib, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-h263, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-h264, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-huffyuv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-indeo, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], indeoversion=(int)3; video/x-jpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-msmpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], msmpegversion=(int){ 41, 42, 43 }; video/x-msvideocodec, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], msvideoversion=(int)1; video/x-pn-realvideo, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], systemstream=(boolean)false, rmversion=(int){ 2, 1 }; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)24, depth=(int)24, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, endianness=(int)4321; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)24, depth=(int)24, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, endianness=(int)4321; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)32, depth=(int)24, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, endianness=(int)4321; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)16, depth=(int)16, red_mask=(int)63488, green_mask=(int)2016, blue_mask=(int)31, endianness=(int)1234; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)16, depth=(int)15, red_mask=(int)31744, green_mask=(int)992, blue_mask=(int)31, endianness=(int)1234; video/x-raw-yuv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], format=(fourcc){ I420, YUY2, Y42B, YUV9, Y41B }; video/x-rle, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], layout=(string)microsoft, depth=(int)[ 1, 64 ]; video/x-svq, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], svqversion=(int)3, halfpel_flag=(int)[ 0, 1 ], thirdpel_flag=(int)[ 0, 1 ], low_delay=(int)[ 0, 1 ], unknown_svq3_flag=(int)[ 0, 1 ]; video/x-svq, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], svqversion=(int)1; video/x-theora, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-vp3, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-wmv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], wmvversion=(int){ 1, 2 } diff --git a/tests/old/testsuite/caps/compatibility.c b/tests/old/testsuite/caps/compatibility.c deleted file mode 100644 index 9b24e7f7f9..0000000000 --- a/tests/old/testsuite/caps/compatibility.c +++ /dev/null @@ -1,93 +0,0 @@ -#include <gst/gst.h> - -/* these caps all have a non empty intersection */ -GstStaticCaps sinkcaps = GST_STATIC_CAPS ("video/mpeg, " "mpegtype=(int)[1,2]"); - -GstStaticCaps mp1parsecaps = GST_STATIC_CAPS ("video/mpeg, " "mpegtype=(int)1"); - -GstStaticCaps rawcaps = GST_STATIC_CAPS ("video/raw, " - "fourcc=(fourcc){YV12,YUY2}, " - "width=(int)[16,4096], " "height=(int)[16,4096]"); - -GstStaticCaps rawcaps2 = GST_STATIC_CAPS ("video/raw, " - "fourcc=(fourcc)YUY2, " "height=(int)[16,256]"); - -GstStaticCaps rawcaps3 = GST_STATIC_CAPS ("video/raw, " - "fourcc=(fourcc){YV12,YUY2}, " "height=(int)[16,4096]"); - -#if 0 -/* these caps aren't used yet */ -GstStaticCaps rawcaps4 = GST_STATIC_CAPS ("video/raw, " - "fourcc=(fourcc){\"YV12\", \"YUYV\"}, " "height=(int)[16,4096]"); - -GstStaticCaps rawcaps4 = GST_STATIC_CAPS ("video/raw, " - "fourcc=(fourcc){\"YUYV\", \"YUY2\"}, " "height=(int)[16,4096]"); -#endif - -GstStaticCaps rawcaps6 = GST_STATIC_CAPS ("video/raw, " - "format=(fourcc)\"I420\"; " "video/raw, " "format=(fourcc)\"YUYV\""); - -GstStaticCaps rawcaps7 = GST_STATIC_CAPS ("video/raw, " - "format=(fourcc)\"I420\"; " "video/raw, " "format=(fourcc)\"YV12\""); - - -int -main (int argc, char *argv[]) -{ - gboolean testret; - gint ret = 0; - - gst_init (&argc, &argv); - - testret = gst_caps_is_always_compatible (gst_static_caps_get (&mp1parsecaps), - gst_static_caps_get (&rawcaps)); - g_print ("4 <-> 2 == %d (invalid, wrong major type)\n", testret); - ret = ret + (testret == FALSE) ? 0 : 1; - - testret = gst_caps_is_always_compatible (gst_static_caps_get (&mp1parsecaps), - gst_static_caps_get (&sinkcaps)); - g_print ("4 <-> 1 == %d (valid, subset)\n", testret); - ret = ret + (testret == TRUE) ? 0 : 1; - - testret = gst_caps_is_always_compatible (gst_static_caps_get (&sinkcaps), - gst_static_caps_get (&mp1parsecaps)); - g_print ("1 <-> 4 == %d (invalid, superset)\n", testret); - ret = ret + (testret == FALSE) ? 0 : 1; - - testret = gst_caps_is_always_compatible (gst_static_caps_get (&rawcaps), - gst_static_caps_get (&rawcaps2)); - g_print ("2 <-> 3 == %d (invalid, ranges)\n", testret); - ret = ret + (testret == FALSE) ? 0 : 1; - - testret = gst_caps_is_always_compatible (gst_static_caps_get (&rawcaps), - gst_static_caps_get (&rawcaps3)); - g_print ("2 <-> 5 == %d (valid)\n", testret); - ret = ret + (testret == TRUE) ? 0 : 1; - - testret = gst_caps_is_always_compatible (gst_static_caps_get (&rawcaps3), - gst_static_caps_get (&rawcaps)); - g_print ("5 <-> 2 == %d (invalid)\n", testret); - ret = ret + (testret == FALSE) ? 0 : 1; - - testret = gst_caps_is_always_compatible (gst_static_caps_get (&rawcaps2), - gst_static_caps_get (&rawcaps3)); - g_print ("3 <-> 5 == %d (valid)\n", testret); - ret = ret + (testret == TRUE) ? 0 : 1; - - testret = gst_caps_is_always_compatible (gst_static_caps_get (&rawcaps2), - gst_static_caps_get (&rawcaps)); - g_print ("3 <-> 2 == %d (invalid, property missing in source)\n", testret); - ret = ret + (testret == FALSE) ? 0 : 1; - - testret = gst_caps_is_always_compatible (gst_static_caps_get (&rawcaps), - gst_static_caps_get (&rawcaps)); - g_print ("2 <-> 2 == %d (valid, same caps)\n", testret); - ret = ret + (testret == TRUE) ? 0 : 1; - - testret = gst_caps_is_always_compatible (gst_static_caps_get (&rawcaps6), - gst_static_caps_get (&rawcaps7)); - g_print ("6 <-> 7 == %d (invalid, second caps doesn't fit)\n", testret); - ret = ret + (testret == FALSE) ? 0 : 1; - - return ret; -} diff --git a/tests/old/testsuite/caps/deserialize.c b/tests/old/testsuite/caps/deserialize.c deleted file mode 100644 index a6964c62c9..0000000000 --- a/tests/old/testsuite/caps/deserialize.c +++ /dev/null @@ -1,85 +0,0 @@ - -#include <gst/gst.h> -#include <string.h> - -/* The caps_strings file is created using: - * - * grep '^.caps' /home/ds/.gstreamer-0.8/registry.xml | \ - * sed 's/^.caps.\(.*\)..caps.$/\1/' | awk '{print length($ln) " " $ln; }' | \ - * sort -n | uniq | sed 's/^[^ ]* //' >caps_strings - * - */ - - -int -main (int argc, char *argv[]) -{ - char *filename; - char *data; - char **list; - int i; - gsize length; - GstCaps *caps; - - gst_init (&argc, &argv); - - if (argc > 1) { - filename = g_strdup (argv[1]); - } else { - const char *srcdir = g_getenv ("srcdir"); - - if (srcdir) { - filename = g_build_filename (srcdir, "caps_strings", NULL); - } else { - filename = g_strdup ("caps_strings"); - } - } - - if (!g_file_get_contents (filename, &data, &length, NULL)) { - g_print ("could not open file %s\n", filename); - abort (); - } - - list = g_strsplit (data, "\n", 0); - - for (i = 0; list[i] != NULL; i++) { - if (list[i][0] == 0) { - g_free (list[i]); - continue; - } - - caps = gst_caps_from_string (list[i]); - if (caps == NULL) { - char **list2; - int j; - - g_print ("Could not parse: %s\n", list[i]); - g_print ("Trying each structure...\n"); - - list2 = g_strsplit (list[i], ";", 0); - - for (j = 0; list2[j] != NULL; j++) { - caps = gst_caps_from_string (list2[j]); - - if (caps == NULL) { - g_print ("Could not parse %s\n", list2[j]); - abort (); - } - - gst_caps_free (caps); - } - - g_print ("parsed each structure individually\n"); - abort (); - } - - gst_caps_free (caps); - g_free (list[i]); - } - - g_free (list); - g_free (data); - g_free (filename); - - return 0; -} diff --git a/tests/old/testsuite/caps/enumcaps.c b/tests/old/testsuite/caps/enumcaps.c deleted file mode 100644 index 7585333733..0000000000 --- a/tests/old/testsuite/caps/enumcaps.c +++ /dev/null @@ -1,95 +0,0 @@ -/* GStreamer test - * (c) 2004 Ronald Bultje <rbultje@ronald.bitfreak.net> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gst/gst.h> - -typedef enum -{ - TEST_YES, - TEST_NO -} -TestBool; - -#define TEST_BOOL_TYPE (test_bool_get_type ()) -GType -test_bool_get_type (void) -{ - static GType etype = 0; - - if (etype == 0) { - static const GEnumValue values[] = { - {TEST_YES, "TEST_YES", "yes"}, - {TEST_NO, "TEST_NO", "no"}, - {0, NULL, NULL} - }; - - etype = g_enum_register_static ("TestBool", values); - } - return etype; -} - -gint -main (gint argc, gchar * argv[]) -{ - gchar *str; - GstCaps *caps, *res_caps; - GstStructure *strc; - GValue value = { 0 }; - TestBool yes, no; - - /* register multichannel type */ - gst_init (&argc, &argv); - test_bool_get_type (); - - /* test some caps */ - caps = gst_caps_new_simple ("application/x-gst-test", NULL); - str = gst_caps_to_string (caps); - g_assert (str); - g_free (str); - - /* set enums in list */ - strc = gst_caps_get_structure (caps, 0); - g_value_init (&value, TEST_BOOL_TYPE); - g_value_set_enum (&value, TEST_YES); - gst_structure_set_value (strc, "yes", &value); - g_value_set_enum (&value, TEST_NO); - gst_structure_set_value (strc, "no", &value); - g_value_unset (&value); - - /* test to-/from-string conversions for enums */ - str = gst_caps_to_string (caps); - g_assert (str); - res_caps = gst_caps_from_string (str); - g_free (str); - - /* see if all worked */ - strc = gst_caps_get_structure (res_caps, 0); - yes = g_value_get_enum (gst_structure_get_value (strc, "yes")); - no = g_value_get_enum (gst_structure_get_value (strc, "no")); - g_assert (yes == TEST_YES && no == TEST_NO); - gst_caps_free (caps); - gst_caps_free (res_caps); - - /* yes */ - return 0; -} diff --git a/tests/old/testsuite/caps/eratosthenes.c b/tests/old/testsuite/caps/eratosthenes.c deleted file mode 100644 index 85049564e9..0000000000 --- a/tests/old/testsuite/caps/eratosthenes.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (C) 2004 Benjamin Otte <in7y118@public.uni-hamburg.de> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <gst/gst.h> -#include <stdlib.h> - -#define MAX_SIEVE 20 - -static void -eratosthenes (GValue * sieve, gboolean up, int size) -{ - guint i, j; - GValue temp = { 0, }; - GValue list = { 0, }; - - g_value_init (sieve, GST_TYPE_INT_RANGE); - gst_value_set_int_range (sieve, 2, size * size); - for (i = up ? 2 : size; up ? (i <= size) : (i >= 2); i += up ? 1 : -1) { - g_value_init (&list, GST_TYPE_LIST); - for (j = 2 * i; j <= size * size; j += i) { - GValue v = { 0, }; - - g_value_init (&v, G_TYPE_INT); - g_value_set_int (&v, j); - gst_value_list_append_value (&list, &v); - g_value_unset (&v); - } - gst_value_subtract (&temp, sieve, &list); - g_value_unset (sieve); - gst_value_init_and_copy (sieve, &temp); - g_value_unset (&temp); - g_value_unset (&list); - /* g_print ("%2u: %s\n", i, gst_value_serialize (sieve)); */ - } - - g_print ("%s\n", gst_value_serialize (sieve)); -} - -gint -main (gint argc, gchar ** argv) -{ - GValue up = { 0, }; - GValue down = { 0, }; - guint size = MAX_SIEVE; - - gst_init (&argc, &argv); - - if (argc > 1) - size = atol (argv[1]); - - eratosthenes (&up, TRUE, size); - eratosthenes (&down, FALSE, size); - - g_assert (gst_value_compare (&up, &down) == GST_VALUE_EQUAL); - return 0; -} diff --git a/tests/old/testsuite/caps/filtercaps.c b/tests/old/testsuite/caps/filtercaps.c deleted file mode 100644 index 51466e567e..0000000000 --- a/tests/old/testsuite/caps/filtercaps.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2004 Benjamin Otte <in7y118@public.uni-hamburg.de> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <gst/gst.h> - -gint -main (gint argc, gchar ** argv) -{ - GstCaps *caps; - GstElement *sink, *identity; - GstElement *pipeline; - - gst_init (&argc, &argv); - - pipeline = gst_pipeline_new ("pipeline"); - g_assert (pipeline); - identity = gst_element_factory_make ("identity", NULL); - g_assert (identity); - sink = gst_element_factory_make ("fakesink", NULL); - g_assert (sink); - gst_bin_add_many (GST_BIN (pipeline), identity, sink, NULL); - gst_element_link_filtered (identity, sink, - gst_caps_new_simple ("audio/x-raw-int", NULL)); - caps = gst_pad_get_caps (gst_element_get_pad (identity, "sink")); - g_print ("caps: %s\n", gst_caps_to_string (caps)); - g_assert (!gst_caps_is_any (caps)); - caps = gst_pad_get_allowed_caps (gst_element_get_pad (identity, "sink")); - g_print ("allowed caps: %s\n", gst_caps_to_string (caps)); - g_assert (gst_caps_is_any (caps)); - - return 0; -} diff --git a/tests/old/testsuite/caps/fixed.c b/tests/old/testsuite/caps/fixed.c deleted file mode 100644 index e0913d2ee9..0000000000 --- a/tests/old/testsuite/caps/fixed.c +++ /dev/null @@ -1,82 +0,0 @@ -/* GStreamer - * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include <gst/gst.h> - -gint -main (gint argc, gchar * argv[]) -{ -#if 0 - GstCaps *caps; - - gst_init (&argc, &argv); - - caps = GST_CAPS_NEW ("testcaps", "unknown/unknown", NULL); - - /* newly crrated caps without props is fixed */ - g_assert (GST_CAPS_IS_FIXED (caps)); - - entry = gst_props_entry_new ("foo", GST_PROPS_INT (5)); - /* this entry is fixed */ - g_assert (gst_props_entry_is_fixed (entry)); - - props = gst_props_empty_new (); - /* props are fixed when created */ - g_assert (GST_PROPS_IS_FIXED (props)); - - gst_props_add_entry (props, entry); - /* props should still be fixed */ - g_assert (GST_PROPS_IS_FIXED (props)); - - gst_caps_set_props (caps, props); - /* caps should still be fixed */ - g_assert (GST_CAPS_IS_FIXED (caps)); - - entry = gst_props_entry_new ("bar", GST_PROPS_INT_RANGE (1, 5)); - /* this entry is variable */ - g_assert (!gst_props_entry_is_fixed (entry)); - - gst_props_add_entry (props, entry); - /* props should be variable now */ - g_assert (!GST_PROPS_IS_FIXED (props)); - /* caps too */ - g_assert (!GST_CAPS_IS_FIXED (caps)); - - gst_props_remove_entry_by_name (props, "bar"); - /* props should be fixed again now */ - g_assert (GST_PROPS_IS_FIXED (props)); - /* caps too */ - g_assert (GST_CAPS_IS_FIXED (caps)); - - gst_props_set (props, "foo", GST_PROPS_INT_RANGE (1, 5)); - /* props should be variable again now */ - g_assert (!GST_PROPS_IS_FIXED (props)); - /* caps too */ - g_assert (!GST_CAPS_IS_FIXED (caps)); - - gst_props_set (props, "foo", GST_PROPS_INT (5)); - /* props should be fixed again now */ - g_assert (GST_PROPS_IS_FIXED (props)); - /* caps too */ - g_assert (GST_CAPS_IS_FIXED (caps)); - -#endif - - return 0; -} diff --git a/tests/old/testsuite/caps/fraction-convert.c b/tests/old/testsuite/caps/fraction-convert.c deleted file mode 100644 index 6c30195710..0000000000 --- a/tests/old/testsuite/caps/fraction-convert.c +++ /dev/null @@ -1,139 +0,0 @@ -/* GStreamer - * - * fraction-convert.c: test for GstFraction transform - * - * Copyright (C) <2004> Thomas Vander Stichele <thomas at apestaart dot org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include <math.h> -#include <gst/gst.h> -#include <glib.h> - -static void -check_from_double_convert (gdouble value, gint num, gint denom, gdouble prec) -{ - GValue value1 = { 0 }; - GValue value2 = { 0 }; - gdouble check; - gint res_num, res_denom; - - g_value_init (&value1, G_TYPE_DOUBLE); - g_value_init (&value2, GST_TYPE_FRACTION); - - g_value_set_double (&value1, value); - g_value_transform (&value1, &value2); - g_print ("%s = %s ? (expected: %d/%d )\n", - gst_value_serialize (&value1), gst_value_serialize (&value2), num, denom); - - res_num = gst_value_get_fraction_numerator (&value2); - res_denom = gst_value_get_fraction_denominator (&value2); - if (res_num == num && res_denom == denom) { - g_print ("best conversion.\n"); - } else { - if (fabs (value - res_num / (gdouble) res_denom) <= prec) { - g_print ("acceptable suboptimal conversion.\n"); - } else { - g_print ("unacceptable suboptimal conversion.\n"); - g_assert_not_reached (); - } - } - g_value_transform (&value2, &value1); - g_print ("%s = %s\n", - gst_value_serialize (&value2), gst_value_serialize (&value1)); - check = g_value_get_double (&value1); - g_assert (fabs (value - check) <= prec); -} - -static void -check_from_fraction_convert (gint num, gint denom, gdouble prec) -{ - GValue value1 = { 0 }; - GValue value2 = { 0 }; - gdouble value; - gint res_num, res_denom; - - g_value_init (&value1, GST_TYPE_FRACTION); - g_value_init (&value2, G_TYPE_DOUBLE); - - gst_value_set_fraction (&value1, num, denom); - g_value_transform (&value1, &value2); - - value = g_value_get_double (&value2); - g_assert (fabs (value - ((gdouble) num) / denom) < prec); - - g_print ("%s = %s, %2.50lf as double\n", - gst_value_serialize (&value1), gst_value_serialize (&value2), value); - - g_value_transform (&value2, &value1); - g_print ("%s = %s ? (expected: %d/%d )\n", - gst_value_serialize (&value2), gst_value_serialize (&value1), num, denom); - value = g_value_get_double (&value2); - - res_num = gst_value_get_fraction_numerator (&value1); - res_denom = gst_value_get_fraction_denominator (&value1); - if (res_num == num && res_denom == denom) { - g_print ("best conversion.\n"); - } else { - if (fabs (value - res_num / (gdouble) res_denom) <= prec) { - g_print ("acceptable suboptimal conversion.\n"); - } else { - g_print ("unacceptable suboptimal conversion.\n"); - g_assert_not_reached (); - } - } - - g_value_unset (&value2); - g_value_unset (&value1); -} - -static void -transform_test (void) -{ - check_from_fraction_convert (30000, 1001, 1.0e-9); - check_from_fraction_convert (1, G_MAXINT, 1.0e-9); - check_from_fraction_convert (G_MAXINT, 1, 1.0e-9); - - check_from_double_convert (0.0, 0, 1, 1.0e-9); - check_from_double_convert (1.0, 1, 1, 1.0e-9); - check_from_double_convert (-1.0, -1, 1, 1.0e-9); - check_from_double_convert (M_PI, 1881244168, 598818617, 1.0e-9); - check_from_double_convert (-M_PI, -1881244168, 598818617, 1.0e-9); - - check_from_double_convert (G_MAXDOUBLE, G_MAXINT, 1, G_MAXDOUBLE); - check_from_double_convert (G_MINDOUBLE, 0, 1, G_MAXDOUBLE); - check_from_double_convert (-G_MAXDOUBLE, -G_MAXINT, 1, G_MAXDOUBLE); - check_from_double_convert (-G_MINDOUBLE, 0, 1, G_MAXDOUBLE); - - check_from_double_convert (((gdouble) G_MAXINT) + 1, G_MAXINT, 1, - G_MAXDOUBLE); - check_from_double_convert (((gdouble) G_MININT) - 1, G_MININT + 1, 1, - G_MAXDOUBLE); - - check_from_double_convert (G_MAXINT - 1, G_MAXINT - 1, 1, 0); - check_from_double_convert (G_MININT + 1, G_MININT + 1, 1, 0); -} - -int -main (int argc, char *argv[]) -{ - gst_init (&argc, &argv); - - transform_test (); - - return 0; -} diff --git a/tests/old/testsuite/caps/fraction-multiply-and-zero.c b/tests/old/testsuite/caps/fraction-multiply-and-zero.c deleted file mode 100644 index 50c0a53e75..0000000000 --- a/tests/old/testsuite/caps/fraction-multiply-and-zero.c +++ /dev/null @@ -1,131 +0,0 @@ -/* GStreamer - * - * fraction.c: test for all GstFraction operations - * - * Copyright (C) <2004> Thomas Vander Stichele <thomas at apestaart dot org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include <gst/gst.h> -#include <glib.h> - -static void -check_multiplication (int num1, int den1, int num2, int den2, int num_result, - int den_result) -{ - GValue value1 = { 0 }; - GValue value2 = { 0 }; - GValue value3 = { 0 }; - - g_value_init (&value1, GST_TYPE_FRACTION); - g_value_init (&value2, GST_TYPE_FRACTION); - g_value_init (&value3, GST_TYPE_FRACTION); - - gst_value_set_fraction (&value1, num1, den1); - gst_value_set_fraction (&value2, num2, den2); - g_print ("%d/%d * %d/%d = ", num1, den1, num2, den2); - gst_value_fraction_multiply (&value3, &value1, &value2); - g_print ("%d/%d (should be %d/%d)\n", - gst_value_get_fraction_numerator (&value3), - gst_value_get_fraction_denominator (&value3), num_result, den_result); - g_assert (gst_value_get_fraction_numerator (&value3) == num_result); - g_assert (gst_value_get_fraction_denominator (&value3) == den_result); - - g_value_unset (&value1); - g_value_unset (&value2); - g_value_unset (&value3); -} - -static void -check_equal (int num1, int den1, int num2, int den2) -{ - GValue value1 = { 0 }; - GValue value2 = { 0 }; - - g_value_init (&value1, GST_TYPE_FRACTION); - g_value_init (&value2, GST_TYPE_FRACTION); - - gst_value_set_fraction (&value1, num1, den1); - gst_value_set_fraction (&value2, num2, den2); - g_print ("%d/%d == %d/%d ? ", num1, den1, num2, den2); - g_assert (gst_value_compare (&value1, &value2) == GST_VALUE_EQUAL); - g_print ("yes\n"); - - g_value_unset (&value1); - g_value_unset (&value2); -} - -static void -zero_test (void) -{ - GValue value1 = { 0 }; - - g_value_init (&value1, GST_TYPE_FRACTION); - - /* fractions are initialized at 0 */ - g_assert (gst_value_get_fraction_numerator (&value1) == 0); - g_assert (gst_value_get_fraction_denominator (&value1) == 1); - - /* every zero value is set to 0/1 */ - gst_value_set_fraction (&value1, 0, 235); - g_assert (gst_value_get_fraction_numerator (&value1) == 0); - g_assert (gst_value_get_fraction_denominator (&value1) == 1); - gst_value_set_fraction (&value1, 0, -G_MAXINT); - g_assert (gst_value_get_fraction_numerator (&value1) == 0); - g_assert (gst_value_get_fraction_denominator (&value1) == 1); - - g_value_unset (&value1); -} - -int -main (int argc, char *argv[]) -{ - GValue value1 = { 0 }; - GValue value2 = { 0 }; - GValue value3 = { 0 }; - - gst_init (&argc, &argv); - - g_value_init (&value1, GST_TYPE_FRACTION); - g_value_init (&value2, GST_TYPE_FRACTION); - g_value_init (&value3, GST_TYPE_FRACTION); - - /*** zeroes ***/ - - /* basic zero tests */ - zero_test (); - - /* check all zeroes are zeroes */ - check_equal (0, 1, 0, 12345); - check_equal (0, 1, 0, -1); - - /* check multiplying with zeroes results in zeroes */ - check_multiplication (0, 1, 17, 18, 0, 1); - check_multiplication (0, -13, -G_MAXINT, 2736, 0, 1); - - /*** large numbers ***/ - - /* check multiplying large numbers works */ - check_multiplication (G_MAXINT, 1, G_MAXINT - 1, G_MAXINT, G_MAXINT - 1, 1); - check_multiplication (-G_MAXINT, 1, -G_MAXINT + 1, -G_MAXINT, -G_MAXINT + 1, - 1); - check_multiplication (G_MAXINT / 28, 459, -28, -G_MAXINT / 459, - G_MAXINT / 28 * 28, G_MAXINT / 459 * 459); - check_multiplication (3117 * 13, -17, 3117 * 17, 13, -3117 * 3117, 1); - - return 0; -} diff --git a/tests/old/testsuite/caps/fromstring.c b/tests/old/testsuite/caps/fromstring.c deleted file mode 100644 index e6b93e5968..0000000000 --- a/tests/old/testsuite/caps/fromstring.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) <2005> Thomas Vander Stichele <thomas at apestaart dot org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <gst/gst.h> -#include <string.h> -#include "caps.h" - - -gint -main (gint argc, gchar ** argv) -{ - guint i; - guint ret = 0; - GstCaps *caps; - - gst_init (&argc, &argv); - - for (i = 0; i < G_N_ELEMENTS (caps_list); i++) { - g_print ("getting caps from string %s\n", caps_list[i]); - caps = gst_caps_from_string (caps_list[i]); - if (!caps) { - ++ret; - g_print ("Could not get caps from string %s\n", caps_list[i]); - } else { - g_free (caps); - } - } - - return ret; -} diff --git a/tests/old/testsuite/caps/intersect2.c b/tests/old/testsuite/caps/intersect2.c deleted file mode 100644 index e43bc63970..0000000000 --- a/tests/old/testsuite/caps/intersect2.c +++ /dev/null @@ -1,121 +0,0 @@ -#include <gst/gst.h> - -GstStaticCaps rawcaps1 = GST_STATIC_CAPS ("video/x-raw-yuv, " - "fourcc:fourcc=\"YUYV\", " - "height:int=640, " - "width:int=480, " - "framerate:float=30.0; " - "video/x-raw-yuv, " - "fourcc:fourcc=\"I420\", " - "height:int=640, " "width:int=480, " "framerate:float=30.0"); - -GstStaticCaps rawcaps2 = GST_STATIC_CAPS ("video/x-raw-yuv"); - -GstStaticCaps rawcaps3 = -GST_STATIC_CAPS ("video/x-raw-yuv, height=(int) [ 0, MAX ]"); - -GstStaticCaps rawcaps4 = - GST_STATIC_CAPS - ("video/x-raw-yuv, format=(fourcc)YUY2; video/x-raw-yuv, format=(fourcc)UYVY"); - -GstStaticCaps rawcaps5 = - GST_STATIC_CAPS - ("video/x-raw-yuv, format=(fourcc)YUY2, framerate=(double)[0,1.79769e+308], width=(int)[0,2147483647], height=(int)[0,2147483647]; video/x-raw-yuv, format=(fourcc)UYVY, framerate=(double)[0,1.79769e+308], width=(int)[0,2147483647], height=(int)[0,2147483647]"); - -GstStaticCaps rawcaps6 = - GST_STATIC_CAPS - ("video/x-raw-yuv, format=(fourcc)YUY2, width=(int)320, height=(int)240"); - -GstStaticCaps rawcaps7 = - GST_STATIC_CAPS - ("video/x-raw-yuv, format=(fourcc)YUY2, width=(int)[0,2147483647], height=(int)[0,2147483647], framerate=(double)[0,1.79769e+308]"); - -GstStaticCaps rawcaps8 = - GST_STATIC_CAPS - ("video/x-raw-yuv, format=(fourcc)YUY2, width=(int)320, height=(int)240"); - -GstStaticCaps rawcaps9 = - GST_STATIC_CAPS - ("audio/x-raw-float, " - "channel-positions=(int)< " - "{ 1, 2, 3, 4, 5, 6 }, " - "{ 1, 2 }, " - "{ 1, 2, 3, 4, 5, 6 }, " "{ 1, 2, 3, 4, 5, 6 }, " "{ 4, 5, 6 }, " "6 >"); - -GstStaticCaps rawcaps10 = - GST_STATIC_CAPS - ("audio/x-raw-float, " - "channel-positions=(int)< 1, { 2, 3, 4, 5, 6 }, 3, 4, {4, 5, 6 }, " - "{ 4, 5, 6 } >"); - - -int -main (int argc, char *argv[]) -{ - GstCaps *caps1; - GstCaps *caps2; - GstCaps *caps3; - GstCaps *caps4; - GstCaps *caps; - - gst_init (&argc, &argv); - - caps1 = gst_caps_copy (gst_static_caps_get (&rawcaps1)); - caps2 = - gst_caps_new_full (gst_structure_copy (gst_caps_get_structure - (gst_static_caps_get (&rawcaps1), 0)), NULL); - -#if 0 - gst_caps_set (caps1, "height", GST_PROPS_INT (640)); - gst_caps_set (caps1, "width", GST_PROPS_INT (480)); - gst_caps_set (caps1, "framerate", GST_PROPS_FLOAT (30.0)); -#endif - - caps = gst_caps_intersect (caps1, caps2); - g_print ("caps %s\n", gst_caps_to_string (caps)); - if (gst_caps_is_empty (caps)) - return 1; - gst_caps_free (caps1); - gst_caps_free (caps2); - - caps1 = gst_caps_copy (gst_static_caps_get (&rawcaps2)); - caps2 = gst_caps_copy (gst_static_caps_get (&rawcaps3)); - caps = gst_caps_intersect (caps1, caps2); - g_print ("caps %s\n", gst_caps_to_string (caps)); - if (gst_caps_is_empty (caps)) - return 1; - gst_caps_free (caps1); - gst_caps_free (caps2); - - caps1 = gst_caps_copy (gst_static_caps_get (&rawcaps4)); - caps2 = gst_caps_copy (gst_static_caps_get (&rawcaps5)); - caps3 = gst_caps_copy (gst_static_caps_get (&rawcaps6)); - caps4 = gst_caps_intersect (caps1, caps2); - caps = gst_caps_intersect (caps3, caps4); - g_print ("caps4 %s\n", gst_caps_to_string (caps4)); - g_print ("caps %s\n", gst_caps_to_string (caps)); - gst_caps_free (caps1); - gst_caps_free (caps2); - gst_caps_free (caps3); - gst_caps_free (caps4); - - caps1 = gst_caps_copy (gst_static_caps_get (&rawcaps7)); - caps2 = gst_caps_copy (gst_static_caps_get (&rawcaps8)); - caps = gst_caps_intersect (caps1, caps2); - g_print ("caps %s\n", gst_caps_to_string (caps)); - if (gst_caps_is_empty (caps)) - return 1; - gst_caps_free (caps1); - gst_caps_free (caps2); - - caps1 = gst_caps_copy (gst_static_caps_get (&rawcaps9)); - caps2 = gst_caps_copy (gst_static_caps_get (&rawcaps10)); - caps = gst_caps_intersect (caps1, caps2); - g_print ("caps %s\n", gst_caps_to_string (caps)); - if (gst_caps_is_empty (caps)) - return 1; - gst_caps_free (caps1); - gst_caps_free (caps2); - - return 0; -} diff --git a/tests/old/testsuite/caps/intersection.c b/tests/old/testsuite/caps/intersection.c deleted file mode 100644 index bda8950ce7..0000000000 --- a/tests/old/testsuite/caps/intersection.c +++ /dev/null @@ -1,111 +0,0 @@ -#include <gst/gst.h> - -/* these caps all have a non empty intersection */ -GstStaticCaps sinkcaps = GST_STATIC_CAPS ("video/mpeg, " - "mpegtype=(int)1, " - "foo1=(int)[20,40], " "foo2=(int)[20,40], " "foo3=(int)[10,20]"); - -GstStaticCaps mp1parsecaps = GST_STATIC_CAPS ("video/mpeg, " - "mpegtype=(int)1, " - "foo1=(int)30, " "foo2=(int)[20,30], " "foo3=(int)[20,30]"); - - - -GstStaticCaps rawcaps = GST_STATIC_CAPS ("video/raw, " - "width=(int)[16,4096], " "height=(int)[16,4096]"); - -GstStaticCaps rawcaps2 = GST_STATIC_CAPS ("video/raw, " - "height=(int)[16,256], " "depth=(int)16"); - -GstStaticCaps rawcaps3 = GST_STATIC_CAPS ("video/raw, " - "fourcc=(fourcc){\"YUY2\", \"YV12\" }, " "height=(int)[16,4096]"); - -GstStaticCaps rawcaps4 = GST_STATIC_CAPS ("video/raw, " - "fourcc=(fourcc){\"YUY2\",\"YV12\",\"YUYV\" }, " "height=(int)[16,4096]"); - -GstStaticCaps rawcaps5 = GST_STATIC_CAPS ("video/raw, " - "fourcc=(fourcc){\"YUYV\",\"YUY2\"}, " "height=(int)[16,4096]"); - -GstStaticCaps rawcaps6 = GST_STATIC_CAPS ("video/raw, " - "fourcc=(fourcc)\"YUYV\", " - "height=(int)640, " - "width=(int)480, " - "framerate=(double)30.0; " - "video/raw, " - "fourcc=(fourcc)\"I420\", " - "height=(int)640, " "width=(int)480, " "framerate=(double)30.0"); - -GstStaticCaps rawcaps7 = - GST_STATIC_CAPS - ("video/x-raw-yuv, format=(fourcc)YUY2, width=(int)[1,2147483647], height=(int)[1,2147483647], framerate=(double)[0,1.79769e+308]"); - -GstStaticCaps rawcaps8 = - GST_STATIC_CAPS - ("video/x-raw-yuv, format=(fourcc){ I420, YV12, YUY2 }, width=(int)[16,4096], height=(int)[16,4096], framerate=(double)[0,1.79769e+308]"); - -int -main (int argc, char *argv[]) -{ - xmlDocPtr doc; - xmlNodePtr parent; - GstCaps *caps; - - gst_init (&argc, &argv); - - doc = xmlNewDoc ((const xmlChar *) "1.0"); - doc->xmlRootNode = - xmlNewDocNode (doc, NULL, (const xmlChar *) "Capabilities", NULL); - - /* - g_mem_chunk_info (); - for (i = 0; i<100000; i++) { - caps = gst_caps_intersect (gst_static_caps_get (rawcaps3), GST_CAPS_GET (rawcaps4)); - gst_caps_unref (caps); - } - g_mem_chunk_info (); - */ - - caps = gst_caps_intersect (gst_static_caps_get (&sinkcaps), - gst_static_caps_get (&mp1parsecaps)); - parent = - xmlNewChild (doc->xmlRootNode, NULL, (const xmlChar *) "Capabilities1", - NULL); - gst_caps_save_thyself (caps, parent); - - caps = gst_caps_intersect (gst_static_caps_get (&rawcaps), - gst_static_caps_get (&rawcaps2)); - parent = - xmlNewChild (doc->xmlRootNode, NULL, (const xmlChar *) "Capabilities2", - NULL); - gst_caps_save_thyself (caps, parent); - - caps = gst_caps_intersect (gst_static_caps_get (&rawcaps3), - gst_static_caps_get (&rawcaps4)); - parent = - xmlNewChild (doc->xmlRootNode, NULL, (const xmlChar *) "Capabilities3", - NULL); - gst_caps_save_thyself (caps, parent); - - caps = gst_caps_intersect (gst_static_caps_get (&rawcaps3), - gst_static_caps_get (&rawcaps5)); - parent = - xmlNewChild (doc->xmlRootNode, NULL, (const xmlChar *) "Capabilities4", - NULL); - gst_caps_save_thyself (caps, parent); - - caps = gst_caps_intersect (gst_static_caps_get (&rawcaps6), - gst_caps_new_full (gst_structure_copy (gst_caps_get_structure - (gst_static_caps_get (&rawcaps6), 0)), NULL)); - parent = - xmlNewChild (doc->xmlRootNode, NULL, (const xmlChar *) "Capabilities5", - NULL); - gst_caps_save_thyself (caps, parent); - - caps = gst_caps_intersect (gst_static_caps_get (&rawcaps7), - gst_static_caps_get (&rawcaps8)); - g_print ("intersection: %s\n", gst_caps_to_string (caps)); - - xmlDocDump (stdout, doc); - - return 0; -} diff --git a/tests/old/testsuite/caps/normalisation.c b/tests/old/testsuite/caps/normalisation.c deleted file mode 100644 index 4d1eae3955..0000000000 --- a/tests/old/testsuite/caps/normalisation.c +++ /dev/null @@ -1,85 +0,0 @@ -#include <gst/gst.h> - -/* these caps all have a non empty intersection */ -GstStaticCaps sinkcaps = GST_STATIC_CAPS ("video/mpeg, " - "fourcc=(fourcc){\"YV12\",\"YUY2\"}, " - "foo1=(int)[20,40], " "foo2=(int)[20,40], " "foo3=(int)[10,20]"); - -GstStaticCaps mp1parsecaps = GST_STATIC_CAPS ("video/mpeg, " - "fourcc=(fourcc){\"YV12\",\"YUY2\"}, " "foo4=(fourcc){\"YV12\",\"YUY2\"}"); - -GstStaticCaps rawcaps = GST_STATIC_CAPS ("video/raw, " - "width=(int)[16,4096], " - "height=(int)[16,4096], " "fourcc=(fourcc){\"YV12\",\"YUY2\"}"); - -GstStaticCaps rawcaps2 = GST_STATIC_CAPS ("video/raw, " - "width=(int)[16,256], " - "height=(int)16; " "video/raw, " "width=(int)[16,256], " "height=(int)16"); - -GstStaticCaps rawcaps3 = GST_STATIC_CAPS ("video/raw, " - "width=(int)[16,256], " - "height=(int)16; " - "video/raw, " - "width=(int)[16,256], " - "height=(int)16; " - "video/raw, " - "fourcc=(fourcc){\"YV12\",\"YUY2\"}, " "height=(int)[16,4096]"); - -GstStaticCaps rawcaps4 = GST_STATIC_CAPS ("x, " - "y=(int){1,2}, " "z=(int){3,4}; " "a, " "b=(int){5,6}, " "c=(int){7,8}"); - -/* defined, not used -GST_CAPS_FACTORY (rawcaps4, - GST_CAPS_NEW ( - "raw2_sink_caps", - "video/raw", - "fourcc", GST_PROPS_LIST ( - GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2")), - GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")), - GST_PROPS_FOURCC (GST_STR_FOURCC ("YUYV")) - ), - "height", GST_PROPS_INT_RANGE (16, 4096) - ) -); - -GST_CAPS_FACTORY (rawcaps5, - GST_CAPS_NEW ( - "raw2_sink_caps", - "video/raw", - "fourcc", GST_PROPS_LIST ( - GST_PROPS_FOURCC (GST_STR_FOURCC ("YUYV")), - GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2")) - ), - "height", GST_PROPS_INT_RANGE (16, 4096) - ) -); -*/ - -int -main (int argc, char *argv[]) -{ - GstCaps *caps; - - gst_init (&argc, &argv); - - caps = gst_caps_normalize (gst_static_caps_get (&sinkcaps)); - g_print ("\n%s\n", gst_caps_to_string (caps)); - - caps = gst_caps_normalize (gst_static_caps_get (&mp1parsecaps)); - g_print ("\n%s\n", gst_caps_to_string (caps)); - - caps = gst_caps_normalize (gst_static_caps_get (&rawcaps)); - g_print ("\n%s\n", gst_caps_to_string (caps)); - - caps = gst_caps_normalize (gst_static_caps_get (&rawcaps2)); - g_print ("\n%s\n", gst_caps_to_string (caps)); - - caps = gst_caps_normalize (gst_static_caps_get (&rawcaps3)); - g_print ("\n%s\n", gst_caps_to_string (caps)); - - caps = gst_caps_normalize (gst_static_caps_get (&rawcaps4)); - g_assert (gst_caps_get_size (caps) == 8); - g_print ("\n%s\n", gst_caps_to_string (caps)); - - return 0; -} diff --git a/tests/old/testsuite/caps/random.c b/tests/old/testsuite/caps/random.c deleted file mode 100644 index 6b10abc902..0000000000 --- a/tests/old/testsuite/caps/random.c +++ /dev/null @@ -1,69 +0,0 @@ -/* GStreamer - * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include <gst/gst.h> - -void -assert_on_error (GstDebugCategory * category, GstDebugLevel level, - const gchar * file, const gchar * function, gint line, GObject * object, - GstDebugMessage * message, gpointer data) -{ - g_assert (level != GST_LEVEL_ERROR); -} - -gint -main (gint argc, gchar * argv[]) -{ - /* this file contains random tests for stuff that went wrong in some version - * and should be tested so we're sure it works right now - * Please add what exactly the code tests for in your test */ - - gst_init (&argc, &argv); - - /* TEST 1: - * gstcaps.c 1.120 used a code path that caused a GST_ERROR for the tested - * caps when simplifying even though that is absolutely valid */ - { - GstCaps *caps = - gst_caps_from_string - ("some/type, a=(int)2, b=(int)3, c=bla; some/type, a=(int)2, c=bla"); - gst_debug_add_log_function (assert_on_error, NULL); - gst_caps_do_simplify (caps); - gst_debug_remove_log_function (assert_on_error); - gst_caps_free (caps); - } - - /* TEST 2: - * gstvalue.c 1.34 had a broken comparison function for int ranges that - * returned GST_VALUE_EQUAL even though the range end was different */ - { - GValue v1 = { 0, }; - GValue v2 = { 0, }; - - g_value_init (&v1, GST_TYPE_INT_RANGE); - g_value_init (&v2, GST_TYPE_INT_RANGE); - gst_value_set_int_range (&v1, 1, 2); - gst_value_set_int_range (&v2, 1, 3); - g_assert (gst_value_compare (&v1, &v2) != GST_VALUE_EQUAL); - g_value_unset (&v1); - g_value_unset (&v2); - } - - return 0; -} diff --git a/tests/old/testsuite/caps/renegotiate.c b/tests/old/testsuite/caps/renegotiate.c deleted file mode 100644 index 377ffe038c..0000000000 --- a/tests/old/testsuite/caps/renegotiate.c +++ /dev/null @@ -1,118 +0,0 @@ - -#include <gst/gst.h> -#include <string.h> - -static GstPad *sinesrcpad; - -static GstStaticCaps caps1 = GST_STATIC_CAPS ("audio/x-raw-int, " - "endianness=(int)1234, " - "signed=(boolean)true, " - "width=(int)16, " "depth=(int)16, " "rate=(int)48000, " "channels=(int)1"); -static GstStaticCaps caps2 = GST_STATIC_CAPS ("audio/x-raw-int, " - "endianness=(int)1234, " - "signed=(boolean)true, " - "width=(int)16, " "depth=(int)16, " "rate=(int)44100, " "channels=(int)1"); - -int stage = 0; - -static GstCaps * -my_fixate (GstPad * pad, GstCaps * caps, gpointer user_data) -{ - const char *element_name; - const char *pad_name; - - element_name = gst_element_get_name (gst_pad_get_parent (pad)); - pad_name = gst_pad_get_name (pad); - - g_print ("%s:%s: %s\n", element_name, pad_name, gst_caps_to_string (caps)); - - if (strcmp (element_name, "sinesrc0") == 0 && strcmp (pad_name, "src") == 0) { - GstCaps *icaps; - const GstCaps *mycaps; - int rate; - - sinesrcpad = pad; - - if (stage == 0) { - mycaps = gst_static_caps_get (&caps1); - rate = 48000; - } else { - mycaps = gst_static_caps_get (&caps2); - rate = 44100; - } - icaps = gst_caps_intersect (caps, mycaps); - if (!gst_caps_is_empty (icaps)) { - gst_caps_free (icaps); - g_print ("returning %d\n", rate); - return gst_caps_copy (mycaps); - } - gst_caps_free (icaps); - } - - return NULL; -} - -int -main (int argc, char *argv[]) -{ - GstElement *pipeline; - const GList *list; - const GList *l2; - int i; - int ret; - GError *error = NULL; - - gst_init (&argc, &argv); - - /* change sinesrk to sinesrc once gst_parse_launch is fixed */ - pipeline = gst_parse_launch ("sinesrc ! audioconvert ! " - "audio/x-raw-int, channels=2, rate=48000;" - "audio/x-raw-int, channels=1, rate=44100 !" "fakesink", &error); - - if (error != NULL) { - g_print - ("oops, couldn't build pipeline. You probably don't have audioconvert or sinesrc\n" - "the error was: %s\n", error->message); - g_error_free (error); - exit (0); - } - - list = gst_bin_get_list (GST_BIN (pipeline)); - while (list) { - GstElement *element = GST_ELEMENT (list->data); - - l2 = gst_element_get_pad_list (element); - while (l2) { - GstPad *pad = GST_PAD (l2->data); - - if (gst_pad_get_direction (pad) == GST_PAD_SRC) { - g_signal_connect (G_OBJECT (pad), "fixate", G_CALLBACK (my_fixate), - NULL); - } - l2 = g_list_next (l2); - } - list = g_list_next (list); - } - - g_signal_connect (pipeline, "deep_notify", - G_CALLBACK (gst_element_default_deep_notify), NULL); - - gst_element_set_state (pipeline, GST_STATE_PLAYING); - i = 0; - while (1) { - gst_bin_iterate (GST_BIN (pipeline)); - i++; - if (i == 10) { - stage = 1; - g_print ("10 iterations\n"); - ret = gst_pad_renegotiate (sinesrcpad); - g_print ("negotiation returned %d\n", ret); - } - if (i == 20) { - g_print ("20 iterations\n"); - exit (0); - } - } - - return 0; -} diff --git a/tests/old/testsuite/caps/sets.c b/tests/old/testsuite/caps/sets.c deleted file mode 100644 index a2c93760c7..0000000000 --- a/tests/old/testsuite/caps/sets.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2004 Benjamin Otte <in7y118@public.uni-hamburg.de> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <gst/gst.h> -#include <string.h> -#include "caps.h" - -static void -check_caps (const gchar * eins, const gchar * zwei) -{ - GstCaps *one, *two, *test, *test2, *test3, *test4; - - one = gst_caps_from_string (eins); - two = gst_caps_from_string (zwei); - g_print (" A = %u\n", (unsigned int) strlen (eins)); - g_print (" B = %u\n", (unsigned int) strlen (zwei)); - - test = gst_caps_intersect (one, two); - if (gst_caps_is_equal (one, two)) { - g_print (" EQUAL\n\n"); - g_assert (gst_caps_is_equal (one, test)); - g_assert (gst_caps_is_equal (two, test)); - } else if (!gst_caps_is_any (one) || gst_caps_is_empty (two)) { - test2 = gst_caps_subtract (one, test); - g_print (" A - B = %u\n", - (unsigned int) strlen (gst_caps_to_string (test2))); - /* test2 = one - (one A two) = one - two */ - test3 = gst_caps_intersect (test2, two); - g_print (" empty = %s\n", gst_caps_to_string (test3)); - g_assert (gst_caps_is_empty (test3)); - gst_caps_free (test3); - test3 = gst_caps_union (test2, two); - g_print (" A + B = %u\n", - (unsigned int) strlen (gst_caps_to_string (test3))); - /* test3 = one - two + two = one + two */ - g_print (" A + B = %s\n", gst_caps_to_string (gst_caps_subtract (one, - test3))); - g_assert (gst_caps_is_subset (one, test3)); - test4 = gst_caps_union (one, two); - g_assert (gst_caps_is_equal (test3, test4)); - g_print (" NOT EQUAL\n\n"); - gst_caps_free (test2); - gst_caps_free (test3); - gst_caps_free (test4); - } else { - g_print (" ANY CAPS\n\n"); - } - gst_caps_free (test); - gst_caps_free (two); - gst_caps_free (one); -} - -gint -main (gint argc, gchar ** argv) -{ - guint i, j; - - gst_init (&argc, &argv); - - for (i = 0; i < G_N_ELEMENTS (caps_list); i++) { - for (j = 0; j < G_N_ELEMENTS (caps_list); j++) { - g_print ("%u - %u\n", i, j); - check_caps (caps_list[i], caps_list[j]); - } - } - - return 0; -} diff --git a/tests/old/testsuite/caps/simplify.c b/tests/old/testsuite/caps/simplify.c deleted file mode 100644 index 983d4c7ce2..0000000000 --- a/tests/old/testsuite/caps/simplify.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (C) 2004 Benjamin Otte <in7y118@public.uni-hamburg.de> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <gst/gst.h> -#include <string.h> -#include "caps.h" - -/* statistics junkie!!! */ -static guint size_before = 0, size_after = 0; -static guint length_before = 0, length_after = 0; -static guint impossible = 0, success = 0, failure = 0; - -static void -check_caps (GstCaps * caps) -{ - gchar *before, *after; - GstCaps *old; - - before = gst_caps_to_string (caps); - old = gst_caps_copy (caps); - gst_caps_do_simplify (caps); - after = gst_caps_to_string (caps); - g_assert (gst_caps_get_size (caps) <= gst_caps_get_size (old)); - if (gst_caps_get_size (caps) == gst_caps_get_size (old)) - g_assert (strlen (after) <= strlen (before)); - g_assert (gst_caps_is_equal (caps, old)); - g_print ("%s %2u/%-4u => %2u/%-4u\n", - gst_caps_get_size (caps) < gst_caps_get_size (old) || - strlen (after) < strlen (before) ? "REDUCED" : - (gst_caps_get_size (old) < 2 ? " --- " : " "), - gst_caps_get_size (old), (unsigned int) strlen (before), - gst_caps_get_size (caps), (unsigned int) strlen (after)); - - size_before += gst_caps_get_size (old); - size_after += gst_caps_get_size (caps); - length_before += strlen (before); - length_after += strlen (after); - if (gst_caps_get_size (old) < 2) { - impossible++; - } else if (gst_caps_get_size (caps) < gst_caps_get_size (old) || - strlen (after) < strlen (before)) { - success++; - } else { - failure++; - } - - g_free (before); - g_free (after); - gst_caps_free (old); -} - -gint -main (gint argc, gchar ** argv) -{ - guint i, j; - - gst_init (&argc, &argv); - - for (i = 0; i < G_N_ELEMENTS (caps_list); i++) { - GstCaps *caps = gst_caps_from_string (caps_list[i]); - - g_print (" %2u ", i); - check_caps (caps); - if (!gst_caps_is_any (caps)) { - for (j = 0; j < G_N_ELEMENTS (caps_list); j++) { - GstCaps *temp, *temp2; - GstCaps *caps2 = gst_caps_from_string (caps_list[j]); - - /* subtraction */ - temp = gst_caps_subtract (caps, caps2); - - g_print ("%2u - %2u ", i, j); - check_caps (temp); - gst_caps_free (temp); - /* union */ - temp = gst_caps_union (caps, caps2); - g_print ("%2u + %2u ", i, j); - check_caps (temp); - if (i == j) - g_assert (gst_caps_get_size (caps) == gst_caps_get_size (temp)); - g_assert (gst_caps_is_subset (caps, temp)); - g_assert (gst_caps_is_subset (caps2, temp)); - /* appending (union without simplifying) */ - temp2 = gst_caps_copy (caps); - gst_caps_append (temp2, caps2); - g_assert (gst_caps_is_equal (temp, temp2)); - gst_caps_free (temp2); - gst_caps_free (temp); - } - } - gst_caps_free (caps); - } - g_print ("\n\nSTATISTICS:\n"); - g_print ("\nOf all caps tried\n"); - g_print ("%3u (%02.4g%%) caps were already at minimum size.\n", impossible, - 100.0 * ((double) impossible) / (impossible + success + failure)); - g_print ("%3u (%02.4g%%) caps were successfully reduced.\n", success, - 100.0 * ((double) success) / (impossible + success + failure)); - g_print ("%3u (%02.4g%%) caps could not be reduced.\n", failure, - 100.0 * ((double) failure) / (impossible + success + failure)); - g_print ("\nOf all caps that could possibly be reduced\n"); - g_print ("%02.4g%% were reduced\n", - 100.0 * ((double) success) / (success + failure)); - g_print ("%02.4g%% average reduction in caps structure amount\n", - 100.0 * (1.0 - ((double) size_after) / size_before)); - g_print ("%02.4g%% average reduction in caps serialization length\n", - 100.0 * (1.0 - ((double) length_after) / length_before)); - - return 0; -} diff --git a/tests/old/testsuite/caps/string-conversions.c b/tests/old/testsuite/caps/string-conversions.c deleted file mode 100644 index e28c3bdd1a..0000000000 --- a/tests/old/testsuite/caps/string-conversions.c +++ /dev/null @@ -1,205 +0,0 @@ -#include <gst/gst.h> -#include <string.h> - -GstStaticCaps caps1 = GST_STATIC_CAPS ("video/mpeg, " "mpegtype=(int){1,2}"); - -GstStaticCaps caps2 = GST_STATIC_CAPS ("video/mpeg, " "mpegtype=(int){1}"); - -GstStaticCaps caps3 = GST_STATIC_CAPS ("video/raw, " - "fourcc=(fourcc){\"YV12\",\"YUY2\"}, " - "width=(int)[16,4096], " "height=(int)[16,4096]"); - -GstStaticCaps caps4 = GST_STATIC_CAPS ("video/raw, " - "fourcc=(fourcc)\"YV12\", " "height=(int)[16,256]"); - -GstStaticCaps caps5 = GST_STATIC_CAPS ("video/raw, " - "fourcc=(fourcc){\"YV12\",\"YUY2\"}, " "height=(int)[16,4096]"); - -GstStaticCaps caps6 = GST_STATIC_CAPS ("video/raw, " - "fourcc=(fourcc){\"YV12\",\"YUYV\"}, " "height=(int)[16,4096]"); - -GstStaticCaps caps7 = GST_STATIC_CAPS ("video/raw, " - "fourcc=(fourcc){\"YVYV\",\"YUY2\"}, " "height=(int)[16,4096]," - "pixel-aspect-ratio=(fraction)16/15"); - -GstStaticCaps caps8 = GST_STATIC_CAPS ("video/raw, " - "format=(fourcc)\"I420\"; " "video/raw, " "format=(fourcc)\"YUYV\""); - -GstStaticCaps caps9 = GST_STATIC_CAPS ("video/raw, " - "format=(fourcc)\"I420\"; " "video/raw, " "format=(fourcc)\"YV12\""); - -static gint test = 0; -static gint failures = 0; - -#define TEST_START g_print ("%3d, START\n", ++test) -#define TEST_FAIL g_print ("%3d, FAIL : failure %d\n", test, ++failures) -#define TEST_SUCCESS g_print ("%3d, SUCCESS\n", test) -#define TEST_END(result) G_STMT_START{ \ - if (result) { \ - TEST_SUCCESS; \ - } else { \ - TEST_FAIL; \ - } \ -}G_STMT_END -static void -test_caps_func (const GstCaps * caps) -{ - gchar *str1, *str2; - gboolean ret = FALSE; - - str1 = gst_caps_to_string (caps); - caps = gst_caps_from_string (str1); - if (!caps) { - g_print ("%3d, INFO : no caps from %s\n", test, str1); - TEST_END (ret); - return; - } - str2 = gst_caps_to_string (caps); - g_print ("%3d, INFO : %s <==> %s\n", test, str1, str2); - ret = strcmp (str1, str2) == 0; - g_free (str1); - g_free (str2); - TEST_END (ret); -} -static void -test_caps (const GstCaps * caps) -{ - TEST_START; - test_caps_func (caps); -} -static void -test_string (gchar * str) -{ - GstCaps *caps; - - TEST_START; - g_print ("%3d, INFO : checking %s\n", test, str); - caps = gst_caps_from_string (str); - if (!caps) { - g_print ("%3d, INFO : no caps from %s\n", test, str); - TEST_FAIL; - return; - } - test_caps_func (caps); -} -static void -test_string_fail (gchar * str) -{ - GstCaps *caps; - - TEST_START; - g_print ("%3d, INFO : checking %s for failure\n", test, str); - caps = gst_caps_from_string (str); - g_print ("got %p\n", caps); - TEST_END (caps == NULL); -} - -int -main (int argc, char *argv[]) -{ - gst_init (&argc, &argv); - goto bla; -bla: - /* stupidity tests */ - test_caps (gst_caps_new_simple ("audio/raw", NULL)); - - /* all sorts of caps */ - test_caps (gst_static_caps_get (&caps1)); - test_caps (gst_static_caps_get (&caps2)); - test_caps (gst_static_caps_get (&caps3)); - test_caps (gst_static_caps_get (&caps4)); - test_caps (gst_static_caps_get (&caps5)); - test_caps (gst_static_caps_get (&caps6)); - test_caps (gst_static_caps_get (&caps7)); - test_caps (gst_static_caps_get (&caps8)); - test_caps (gst_static_caps_get (&caps9)); - - /* mime types */ - test_string ("audio/raw"); - test_string ("\"audio/raw\""); - - /* fixed props entries */ - test_string ("audio/raw ,test=(int)1"); - test_string ("audio/raw ,test=(double) 1"); - test_string ("audio/raw, test=(fourcc )1"); - test_string ("audio/raw ,test=(i)1"); - test_string ("audio/raw ,test=(d) 1"); - test_string ("audio/raw, test=(4 )1"); - test_string ("audio/raw,test=( fourcc ) 0x0000001"); - test_string ("audio/raw,test =(fourcc) \"RGB \""); - test_string ("audio/raw , test=( string)1"); - test_string ("audio/raw,test= 1"); - test_string ("audio/raw,test = 1.0"); - test_string ("audio/raw ,test= \"1.0\""); - test_string ("audio/raw,test=( str) \"1\""); - test_string ("audio/raw ,test=(b)False"); - test_string ("audio/raw ,test =(bool) trUE"); - test_string ("audio/raw ,test=(b ) yes"); - test_string ("audio/raw ,test =( boolean)no"); - test_string ("audio/raw ,test = < 1, 2, 3 >"); - test_string ("video/raw ,test =( fraction)9/8"); - - /* buffers */ - test_string ("audio/raw ,test=(buffer)0123456789abcdef"); - test_string ("audio/raw ,test= < (buffer)0123, (buffer)4567 >"); - - /* unfixed props entries */ - test_string ("audio/raw, test= [ 1, 2 ]"); - test_string_fail ("audio/raw, test= [ 1.0 , 2]"); - test_string_fail ("audio/raw, test = [1, 2.5 ]"); - test_string ("audio/raw, test= [1.3, 2.1 ]"); - test_string ("audio/raw, test =(int ) [1,2]"); - test_string ("audio/raw, test =(double ) [1,2]"); - test_string ("audio/raw, test= [(int) 1, 2 ]"); - test_string ("audio/raw, test=(d) [ (double)1.0 , 2]"); - test_string ("audio/raw, test=(double) [1.3, (double)2.1 ]"); - test_string ("audio/raw, test =(i) [(int)1,2]"); - test_string ("audio/raw, test={(int)1,2}"); - test_string - ("audio/raw, test= {(int)1 ,2,3 ,(int) 4 , 5 ,6 , (int )7 ,8 , (int ) 9, 10}"); - test_string ("audio/raw, test= {1.0}"); - test_string ("audio/raw, test= {\"hi\", \"i dig ya\", dude}"); - test_string ("audio/raw, test= {(int)1,2}"); - test_string ("audio/raw, test= {(int)1,2}"); - - /* prop concatenations */ - test_string ("audio/raw, test=(double) [1.3, (double)2.1 ], test2= [ 1, 2 ]"); - test_string ("audio/raw , test=(fourcc) \"RGB \",test2=(int)1"); - test_string - ("audio/raw, test= [(int ) 1, 2 ] ,test2 =(fourcc) \"RGB \""); - test_string ("audio/raw, test= [1.3, 2.1 ] , test2= {1.0}"); - test_string - ("audio/raw, test= {(int)1 ,2,3 ,(int) 4 , 5 ,6 , (int )7 ,8 , (int ) 9, 10}, test2 = [1.0, 2.5 ] , test3= (string)1 ,test4=(i)1"); - - /* caps concatenations */ - test_string - ("audio/raw, test= [(int ) 1, 2 ] ,test2 =(fourcc) \"RGB \";\"audio/raw\""); - test_string - ("audio/raw, test =(double ) [1,2] ; audio/raw, test=(fourcc )1 ;audio/raw, test= {\"hi\", \"i dig ya\", dude}"); - test_string - ("audio/raw, test=(double) [1.3, (double)2.1 ];audio/raw, test =(i) [(int)1,2]"); - - - /* mimes */ - test_string_fail ("audio/raw\\"); - test_string_fail ("'audio/raw"); - test_string_fail ("'audio/raw\""); - /* wrong type */ - test_string_fail ("audio/raw, test=(int) [1.0,2]"); - test_string_fail ("audio/raw, test=(int) [1 ,0.2]"); - test_string_fail ("audio/raw, test=(int) [1.0, 2.000]"); - test_string_fail ("audio/raw, test=(int) <1.0, 2.000>"); - /* unmatched */ - test_string_fail ("audio/raw, test=(int = ["); - test_string_fail ("audio/raw, test= {"); - test_string_fail ("audio/raw, test= <"); - test_string_fail ("audio/raw, test = \"dood'"); - test_string_fail ("audio/raw, test= '"); - - if (failures) { - g_print ("\n FAILURES : %d\n", failures); - } else { - g_print ("\n DONE\n"); - } - return failures; -} diff --git a/tests/old/testsuite/caps/structure.c b/tests/old/testsuite/caps/structure.c deleted file mode 100644 index 84c607e454..0000000000 --- a/tests/old/testsuite/caps/structure.c +++ /dev/null @@ -1,25 +0,0 @@ - -#include <gst/gst.h> - - -void -test1 (void) -{ - GstStructure *structure; - - g_print ("type is %d\n", (int) gst_structure_get_type ()); - - structure = gst_structure_empty_new ("moo"); - g_assert (structure != NULL); - g_assert (GST_IS_STRUCTURE (structure)); -} - -int -main (int argc, char *argv[]) -{ - gst_init (&argc, &argv); - - test1 (); - - return 0; -} diff --git a/tests/old/testsuite/caps/subtract.c b/tests/old/testsuite/caps/subtract.c deleted file mode 100644 index fe80d444a8..0000000000 --- a/tests/old/testsuite/caps/subtract.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2004 Benjamin Otte <in7y118@public.uni-hamburg.de> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <gst/gst.h> - -static void -check_caps (const gchar * set, const gchar * subset) -{ - GstCaps *one, *two, *test, *test2; - - g_print (" A = %s\n", set); - one = gst_caps_from_string (set); - g_print (" B = %s\n", subset); - two = gst_caps_from_string (subset); - /* basics */ - test = gst_caps_subtract (one, one); - g_assert (gst_caps_is_empty (test)); - gst_caps_free (test); - test = gst_caps_subtract (two, two); - g_assert (gst_caps_is_empty (test)); - gst_caps_free (test); - test = gst_caps_subtract (two, one); - g_assert (gst_caps_is_empty (test)); - gst_caps_free (test); - /* now the nice part */ - test = gst_caps_subtract (one, two); - g_assert (!gst_caps_is_empty (test)); - g_print (" A - B = %s\n", gst_caps_to_string (test)); - test2 = gst_caps_union (test, two); - g_print ("A - B + B = %s\n", gst_caps_to_string (test2)); - gst_caps_free (test); - test = gst_caps_subtract (test2, one); - g_assert (gst_caps_is_empty (test)); - gst_caps_free (test); -} - -gint -main (gint argc, gchar ** argv) -{ - gst_init (&argc, &argv); - - check_caps ("some/mime, _int = [ 1, 2 ], list = { \"A\", \"B\", \"C\" }", - "some/mime, _int = 1, list = \"A\""); - check_caps ("some/mime, _double = (double) 1.0; other/mime, _int = { 1, 2 }", - "some/mime, _double = (double) 1.0"); - - return 0; -} diff --git a/tests/old/testsuite/caps/union.c b/tests/old/testsuite/caps/union.c deleted file mode 100644 index 798f6faa2a..0000000000 --- a/tests/old/testsuite/caps/union.c +++ /dev/null @@ -1,34 +0,0 @@ -#include <gst/gst.h> - -/* these caps all have a non empty intersection */ -GstStaticCaps sinkcaps = GST_STATIC_CAPS ("video/mpeg, " - "mpegtype:int=1, " - "foo1:int=[20,40], " "foo2:int=[20,40], " "foo3:int=[10,20]"); - -GstStaticCaps mp1parsecaps = GST_STATIC_CAPS ("video/mpeg, " - "mpegtype:int=1, " "foo1:int=30, " "foo2:int=[20,30], " "foo3:int=[20,30]"); - -int -main (int argc, char *argv[]) -{ - xmlDocPtr doc; - xmlNodePtr parent; - GstCaps *caps; - - gst_init (&argc, &argv); - - doc = xmlNewDoc ((const xmlChar *) "1.0"); - doc->xmlRootNode = - xmlNewDocNode (doc, NULL, (const xmlChar *) "Capabilities", NULL); - - caps = gst_caps_union (gst_static_caps_get (&sinkcaps), - gst_static_caps_get (&mp1parsecaps)); - parent = - xmlNewChild (doc->xmlRootNode, NULL, (const xmlChar *) "Capabilities1", - NULL); - gst_caps_save_thyself (caps, parent); - - xmlDocDump (stdout, doc); - - return 0; -} diff --git a/tests/old/testsuite/caps/value_compare.c b/tests/old/testsuite/caps/value_compare.c deleted file mode 100644 index e6c54129e1..0000000000 --- a/tests/old/testsuite/caps/value_compare.c +++ /dev/null @@ -1,106 +0,0 @@ - -#include <gst/gst.h> -#include <glib.h> - -void -test1 (void) -{ - GValue value1 = { 0 }; - GValue value2 = { 0 }; - - //GValue value3 = { 0 }; - //gboolean ret; - - g_value_init (&value1, G_TYPE_INT); - g_value_set_int (&value1, 10); - g_value_init (&value2, G_TYPE_INT); - g_value_set_int (&value2, 20); - g_assert (gst_value_compare (&value1, &value2) == GST_VALUE_LESS_THAN); - g_assert (gst_value_compare (&value2, &value1) == GST_VALUE_GREATER_THAN); - g_assert (gst_value_compare (&value1, &value1) == GST_VALUE_EQUAL); - g_value_unset (&value1); - g_value_unset (&value2); - - g_value_init (&value1, G_TYPE_DOUBLE); - g_value_set_double (&value1, 10); - g_value_init (&value2, G_TYPE_DOUBLE); - g_value_set_double (&value2, 20); - g_assert (gst_value_compare (&value1, &value2) == GST_VALUE_LESS_THAN); - g_assert (gst_value_compare (&value2, &value1) == GST_VALUE_GREATER_THAN); - g_assert (gst_value_compare (&value1, &value1) == GST_VALUE_EQUAL); - g_value_unset (&value1); - g_value_unset (&value2); - - g_value_init (&value1, G_TYPE_STRING); - g_value_set_string (&value1, "a"); - g_value_init (&value2, G_TYPE_STRING); - g_value_set_string (&value2, "b"); - g_assert (gst_value_compare (&value1, &value2) == GST_VALUE_LESS_THAN); - g_assert (gst_value_compare (&value2, &value1) == GST_VALUE_GREATER_THAN); - g_assert (gst_value_compare (&value1, &value1) == GST_VALUE_EQUAL); - g_value_unset (&value1); - g_value_unset (&value2); - - g_value_init (&value1, GST_TYPE_FOURCC); - gst_value_set_fourcc (&value1, GST_MAKE_FOURCC ('a', 'b', 'c', 'd')); - g_value_init (&value2, GST_TYPE_FOURCC); - gst_value_set_fourcc (&value2, GST_MAKE_FOURCC ('1', '2', '3', '4')); - g_assert (gst_value_compare (&value1, &value2) == GST_VALUE_UNORDERED); - g_assert (gst_value_compare (&value1, &value1) == GST_VALUE_EQUAL); - g_value_unset (&value1); - g_value_unset (&value2); - - /* comparing 2/3 with 3/4 */ - g_value_init (&value1, GST_TYPE_FRACTION); - gst_value_set_fraction (&value1, 2, 3); - g_value_init (&value2, GST_TYPE_FRACTION); - gst_value_set_fraction (&value2, 3, 4); - g_assert (gst_value_compare (&value1, &value2) == GST_VALUE_LESS_THAN); - g_assert (gst_value_compare (&value2, &value1) == GST_VALUE_GREATER_THAN); - g_assert (gst_value_compare (&value1, &value1) == GST_VALUE_EQUAL); - g_value_unset (&value1); - g_value_unset (&value2); - - /* comparing -4/5 with 2/-3 */ - g_value_init (&value1, GST_TYPE_FRACTION); - gst_value_set_fraction (&value1, -4, 5); - g_value_init (&value2, GST_TYPE_FRACTION); - gst_value_set_fraction (&value2, 2, -3); - g_assert (gst_value_compare (&value1, &value2) == GST_VALUE_LESS_THAN); - g_assert (gst_value_compare (&value2, &value1) == GST_VALUE_GREATER_THAN); - g_assert (gst_value_compare (&value1, &value1) == GST_VALUE_EQUAL); - g_value_unset (&value1); - g_value_unset (&value2); - - /* comparing 10/100 with 200/2000 */ - g_value_init (&value1, GST_TYPE_FRACTION); - gst_value_set_fraction (&value1, 10, 100); - g_value_init (&value2, GST_TYPE_FRACTION); - gst_value_set_fraction (&value2, 200, 2000); - g_assert (gst_value_compare (&value1, &value2) == GST_VALUE_EQUAL); - g_value_unset (&value1); - g_value_unset (&value2); - - /* comparing -4/5 with 2/-3 */ - g_value_init (&value1, GST_TYPE_FRACTION); - gst_value_set_fraction (&value1, -4, 5); - g_value_init (&value2, GST_TYPE_FRACTION); - gst_value_set_fraction (&value2, 2, -3); - g_assert (gst_value_compare (&value1, &value2) == GST_VALUE_LESS_THAN); - g_assert (gst_value_compare (&value2, &value1) == GST_VALUE_GREATER_THAN); - g_assert (gst_value_compare (&value1, &value1) == GST_VALUE_EQUAL); - g_value_unset (&value1); - g_value_unset (&value2); - -} - -int -main (int argc, char *argv[]) -{ - - gst_init (&argc, &argv); - - test1 (); - - return 0; -} diff --git a/tests/old/testsuite/caps/value_intersect.c b/tests/old/testsuite/caps/value_intersect.c deleted file mode 100644 index aebd448e43..0000000000 --- a/tests/old/testsuite/caps/value_intersect.c +++ /dev/null @@ -1,58 +0,0 @@ - -#include <gst/gst.h> - -void -test1 (void) -{ - GValue dest = { 0 }; - GValue src1 = { 0 }; - GValue src2 = { 0 }; - gboolean ret; - - g_value_init (&src1, G_TYPE_INT); - g_value_set_int (&src1, 10); - g_value_init (&src2, G_TYPE_INT); - g_value_set_int (&src1, 20); - ret = gst_value_intersect (&dest, &src1, &src2); - g_assert (ret == 0); - g_print ("ret = %d\n", ret); -} - -void -test2 (void) -{ - GValue dest = { 0 }; - GValue src1 = { 0 }; - GValue src2 = { 0 }; - GValue item = { 0 }; - gboolean ret; - - g_value_init (&src1, GST_TYPE_FOURCC); - gst_value_set_fourcc (&src1, GST_MAKE_FOURCC ('Y', 'U', 'Y', '2')); - g_value_init (&src2, GST_TYPE_LIST); - g_value_init (&item, GST_TYPE_FOURCC); - gst_value_set_fourcc (&item, GST_MAKE_FOURCC ('Y', 'U', 'Y', '2')); - gst_value_list_append_value (&src2, &item); - gst_value_set_fourcc (&item, GST_MAKE_FOURCC ('I', '4', '2', '0')); - gst_value_list_append_value (&src2, &item); - gst_value_set_fourcc (&item, GST_MAKE_FOURCC ('A', 'B', 'C', 'D')); - gst_value_list_append_value (&src2, &item); - ret = gst_value_intersect (&dest, &src1, &src2); - g_print ("ret = %d\n", ret); - - g_print ("type = %s\n", g_type_name (G_VALUE_TYPE (&dest))); - g_print ("value = %s\n", g_strdup_value_contents (&dest)); -} - -int -main (int argc, char *argv[]) -{ - - gst_init (&argc, &argv); - - test1 (); - test2 (); - - return 0; - -} diff --git a/tests/old/testsuite/caps/value_serialize.c b/tests/old/testsuite/caps/value_serialize.c deleted file mode 100644 index c621568c73..0000000000 --- a/tests/old/testsuite/caps/value_serialize.c +++ /dev/null @@ -1,125 +0,0 @@ -#include <gst/gst.h> - -static void -test1 (void) -{ - GValue value = { 0 }; - gboolean ret; - - g_value_init (&value, GST_TYPE_BUFFER); - ret = gst_value_deserialize (&value, "1234567890abcdef"); - g_assert (ret); -} - -static gboolean -test_string_serialization (void) -{ - gchar *try[] = { - "Dude", - "Hi, I'm a string", - "tüüüt!" - }; - gchar *tmp; - GValue v = { 0, }; - guint i; - gboolean ret = TRUE; - - g_value_init (&v, G_TYPE_STRING); - for (i = 0; i < G_N_ELEMENTS (try); i++) { - g_value_set_string (&v, try[i]); - tmp = gst_value_serialize (&v); - if (!tmp) { - g_print ("couldn't serialize: %s\n", try[i]); - ret = FALSE; - continue; - } - if (!gst_value_deserialize (&v, tmp)) { - g_print ("couldn't deserialize: %s\n", tmp); - g_free (tmp); - ret = FALSE; - continue; - } - g_free (tmp); - if (!g_str_equal (g_value_get_string (&v), try[i])) { - g_print ("serialized : %s\n", try[i]); - g_print ("deserialized: %s\n", g_value_get_string (&v)); - ret = FALSE; - continue; - } - } - g_value_unset (&v); - return ret; - -} - -static gboolean -test_string_deserialization (void) -{ - struct - { - gchar *from; - gchar *to; - } tests[] = { - { - "", ""}, { - "\"\"", ""}, - /* FAILURES */ - { - "\"", NULL}, /* missing second quote */ - { - "\"Hello\\ World", NULL}, /* missing second quote */ - { - "\"\\", NULL}, /* quote at end, missing second quote */ - { - "\"\\0", NULL}, /* missing second quote */ - { - "\"\\0\"", NULL}, /* unfinished escaped character */ - { - "\" \"", NULL}, /* spaces must be escaped */ -#if 0 - /* FIXME 0.9: this test should fail, but it doesn't */ - { - "tüüt", NULL} /* string with special chars must be escaped */ -#endif - }; - guint i; - GValue v = { 0, }; - gboolean ret = TRUE; - - g_value_init (&v, G_TYPE_STRING); - for (i = 0; i < G_N_ELEMENTS (tests); i++) { - if (gst_value_deserialize (&v, tests[i].from)) { - if (tests[i].to == NULL) { - g_print ("should fail\n"); - g_print ("but got: %s\n", g_value_get_string (&v)); - ret = FALSE; - } else if (!g_str_equal (g_value_get_string (&v), tests[i].to)) { - g_print ("wanted: %s\n", tests[i].to); - g_print ("got : %s\n", g_value_get_string (&v)); - ret = FALSE; - } - } else { - if (tests[i].to != NULL) { - g_print ("failed\n"); - g_print ("but wanted: %s\n", tests[i].to); - ret = FALSE; - } - } - } - g_value_unset (&v); - return ret; -} - -int -main (int argc, char *argv[]) -{ - gboolean ret = TRUE; - - gst_init (&argc, &argv); - - test1 (); - ret &= test_string_serialization (); - ret &= test_string_deserialization (); - - return ret ? 0 : 1; -} diff --git a/tests/old/testsuite/childproxy/Makefile.am b/tests/old/testsuite/childproxy/Makefile.am deleted file mode 100644 index f2324c8a9f..0000000000 --- a/tests/old/testsuite/childproxy/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -include ../Rules - -tests_pass = childproxy -tests_fail = -tests_ignore = - diff --git a/tests/old/testsuite/childproxy/childproxy.c b/tests/old/testsuite/childproxy/childproxy.c deleted file mode 100644 index 07f5f100fc..0000000000 --- a/tests/old/testsuite/childproxy/childproxy.c +++ /dev/null @@ -1,114 +0,0 @@ -/* GStreamer - * Copyright (C) 2005 Stefan Kost <ensonic@users.sf.net> - * - * childproxy.c: test for GstChildProxy iface - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include <gst/gst.h> - -gboolean added = FALSE; -gboolean removed = FALSE; - -static void -my_child_added (GstChildProxy * parent, GstObject * child, gpointer user_data) -{ - if (child == GST_OBJECT (user_data)) { - added = TRUE; - } -} - -static void -my_child_removed (GstChildProxy * parent, GstObject * child, gpointer user_data) -{ - if (child == GST_OBJECT (user_data)) { - removed = TRUE; - } -} - -int -main (int argc, char *argv[]) -{ - GstBin *bin; - GstElement *child1, *child2; - gboolean state; - - gst_init (&argc, &argv); - - if ((bin = GST_BIN (gst_bin_new ("bin"))) == NULL) { - g_print ("Could not create a bin element!\n"); - return 1; - } - - if ((child1 = gst_element_factory_make ("identity", "filter")) == NULL) { - g_print ("Could not create a identity element!\n"); - return 1; - } - - g_signal_connect (G_OBJECT (bin), "child-added", G_CALLBACK (my_child_added), - child1); - g_signal_connect (G_OBJECT (bin), "child-removed", - G_CALLBACK (my_child_removed), child1); - - gst_bin_add (bin, child1); - - if (!added) { - g_print ("ChildProxy::child-added has not been caught!\n"); - return 1; - } - - if (gst_child_proxy_get_children_count (GST_CHILD_PROXY (bin)) != 1) { - g_print ("ChildProxy should manage exactly one child now!\n"); - return 1; - } - - child2 = - GST_ELEMENT (gst_child_proxy_get_child_by_index (GST_CHILD_PROXY (bin), - 0)); - if (child2 != child1) { - g_print ("ChildProxy's first child is not what we have added!\n"); - return 1; - } - - gst_child_proxy_set (GST_OBJECT (bin), "filter::silent", TRUE, NULL); - - g_object_get (G_OBJECT (child1), "silent", &state, NULL); - if (!state) { - g_print ("ChildProxy's child property access failed !\n"); - return 1; - } - - gst_child_proxy_set (GST_OBJECT (bin), "filter::silent", FALSE, NULL); - - g_object_get (G_OBJECT (child1), "silent", &state, NULL); - if (state) { - g_print ("ChildProxy's child property access failed !\n"); - return 1; - } - - gst_bin_remove (bin, child1); - - if (!removed) { - g_print ("ChildProxy::child-added has not been caught!\n"); - return 1; - } - - g_object_unref (G_OBJECT (bin)); - - /* success */ - return 0; -} diff --git a/tests/old/testsuite/cleanup/.gitignore b/tests/old/testsuite/cleanup/.gitignore deleted file mode 100644 index 21be5cc590..0000000000 --- a/tests/old/testsuite/cleanup/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -test-registry.xml -*.bb -*.bbg -*.da - -cleanup1 -cleanup2 -cleanup3 -cleanup4 -cleanup5 diff --git a/tests/old/testsuite/cleanup/Makefile.am b/tests/old/testsuite/cleanup/Makefile.am deleted file mode 100644 index ba1e603d54..0000000000 --- a/tests/old/testsuite/cleanup/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -include ../Rules - -tests_pass = cleanup1 cleanup2 cleanup4 cleanup5 -tests_fail = - -# cleanup3 fails depending on the machine -tests_ignore = cleanup3 diff --git a/tests/old/testsuite/cleanup/cleanup1.c b/tests/old/testsuite/cleanup/cleanup1.c deleted file mode 100644 index 2df2ea3d34..0000000000 --- a/tests/old/testsuite/cleanup/cleanup1.c +++ /dev/null @@ -1,60 +0,0 @@ -#include <gst/gst.h> - -static GstElement * -create_pipeline (void) -{ - GstElement *fakesrc, *fakesink; - GstElement *pipeline; - - - pipeline = gst_pipeline_new ("main_pipeline"); - - fakesrc = gst_element_factory_make ("fakesrc", "fakesrc"); - fakesink = gst_element_factory_make ("fakesink", "fakesink"); - - gst_bin_add_many (GST_BIN (pipeline), fakesrc, fakesink, NULL); - - gst_element_link (fakesrc, fakesink); - - g_object_set (G_OBJECT (fakesrc), "num_buffers", 5, NULL); - - return pipeline; -} - -gint -main (gint argc, gchar * argv[]) -{ - GstElement *pipeline; - gint i = 1000; - gint step = 100; - - free (malloc (8)); /* -lefence */ - - gst_init (&argc, &argv); - - g_mem_chunk_info (); - while (i--) { - if (i % step == 0) - fprintf (stderr, "%10d\r", i); - pipeline = create_pipeline (); - - gst_element_set_state (pipeline, GST_STATE_PLAYING); - - while (gst_bin_iterate (GST_BIN (pipeline))); - - gst_element_set_state (pipeline, GST_STATE_NULL); - - gst_element_set_state (pipeline, GST_STATE_PLAYING); - - while (gst_bin_iterate (GST_BIN (pipeline))); - - gst_element_set_state (pipeline, GST_STATE_NULL); - - gst_object_unref (GST_OBJECT (pipeline)); - - } - fprintf (stderr, "\n"); - g_mem_chunk_info (); - - return 0; -} diff --git a/tests/old/testsuite/cleanup/cleanup2.c b/tests/old/testsuite/cleanup/cleanup2.c deleted file mode 100644 index bd99abd3ba..0000000000 --- a/tests/old/testsuite/cleanup/cleanup2.c +++ /dev/null @@ -1,64 +0,0 @@ -#include <gst/gst.h> - -static GstElement * -create_pipeline (void) -{ - GstElement *fakesrc, *fakesink; - GstElement *pipeline; - GstElement *bin; - - pipeline = gst_pipeline_new ("main_pipeline"); - - fakesrc = gst_element_factory_make ("fakesrc", "fakesrc"); - bin = gst_bin_new ("bin"); - fakesink = gst_element_factory_make ("fakesink", "fakesink"); - gst_bin_add (GST_BIN (bin), fakesink); - gst_element_add_ghost_pad (bin, gst_element_get_pad (fakesink, "sink"), - "sink"); - - gst_bin_add_many (GST_BIN (pipeline), fakesrc, bin, NULL); - - gst_element_link (fakesrc, bin); - - g_object_set (G_OBJECT (fakesrc), "num_buffers", 5, NULL); - - return pipeline; -} - -gint -main (gint argc, gchar * argv[]) -{ - GstElement *pipeline; - gint i = 1000; - gint step = 100; - - free (malloc (8)); /* -lefence */ - - gst_init (&argc, &argv); - - - g_mem_chunk_info (); - while (i--) { - if (i % step == 0) - fprintf (stderr, "%10d\r", i); - pipeline = create_pipeline (); - - gst_element_set_state (pipeline, GST_STATE_PLAYING); - - while (gst_bin_iterate (GST_BIN (pipeline))); - - gst_element_set_state (pipeline, GST_STATE_NULL); - - gst_element_set_state (pipeline, GST_STATE_PLAYING); - - while (gst_bin_iterate (GST_BIN (pipeline))); - - gst_element_set_state (pipeline, GST_STATE_NULL); - - gst_object_unref (GST_OBJECT (pipeline)); - } - fprintf (stderr, "\n"); - g_mem_chunk_info (); - - return 0; -} diff --git a/tests/old/testsuite/cleanup/cleanup3.c b/tests/old/testsuite/cleanup/cleanup3.c deleted file mode 100644 index 37498ba2b6..0000000000 --- a/tests/old/testsuite/cleanup/cleanup3.c +++ /dev/null @@ -1,68 +0,0 @@ -#include <gst/gst.h> - -static GstElement * -create_pipeline (void) -{ - GstElement *fakesrc, *fakesink; - GstElement *pipeline; - GstElement *thread, *queue; - - pipeline = gst_pipeline_new ("main_pipeline"); - - fakesrc = gst_element_factory_make ("fakesrc", "fakesrc"); - thread = gst_thread_new ("thread"); - fakesink = gst_element_factory_make ("fakesink", "fakesink"); - queue = gst_element_factory_make ("queue", "queue"); - gst_bin_add (GST_BIN (thread), fakesink); - gst_bin_add (GST_BIN (thread), queue); - gst_element_link (queue, fakesink); - gst_element_add_ghost_pad (thread, gst_element_get_pad (queue, "sink"), - "sink"); - - gst_element_link (fakesrc, thread); - - gst_bin_add (GST_BIN (pipeline), fakesrc); - gst_bin_add (GST_BIN (pipeline), thread); - - g_object_set (G_OBJECT (fakesrc), "num_buffers", 5, NULL); - - return pipeline; -} - -gint -main (gint argc, gchar * argv[]) -{ - GstElement *pipeline; - gint i = 10000; - gint step = 100; - - free (malloc (8)); /* -lefence */ - - gst_init (&argc, &argv); - - - g_mem_chunk_info (); - while (i--) { - if (i % step == 0) - fprintf (stderr, "%10d\r", i); - pipeline = create_pipeline (); - - gst_element_set_state (pipeline, GST_STATE_PLAYING); - - while (gst_bin_iterate (GST_BIN (pipeline))); - - gst_element_set_state (pipeline, GST_STATE_NULL); - - gst_element_set_state (pipeline, GST_STATE_PLAYING); - - while (gst_bin_iterate (GST_BIN (pipeline))); - - gst_element_set_state (pipeline, GST_STATE_NULL); - - gst_object_unref (GST_OBJECT (pipeline)); - } - fprintf (stderr, "\n"); - g_mem_chunk_info (); - - return 0; -} diff --git a/tests/old/testsuite/cleanup/cleanup4.c b/tests/old/testsuite/cleanup/cleanup4.c deleted file mode 100644 index a82b3f9a68..0000000000 --- a/tests/old/testsuite/cleanup/cleanup4.c +++ /dev/null @@ -1,52 +0,0 @@ -#include <gst/gst.h> - -gint -main (gint argc, gchar * argv[]) -{ - GstElement *pipeline; - GstElement *fakesrc; - gint i; - - free (malloc (8)); /* -lefence */ - - gst_init (&argc, &argv); - - i = 1000; - - pipeline = gst_pipeline_new ("main_pipeline"); - - fakesrc = gst_element_factory_make ("fakesrc", "fakesrc"); - g_object_set (G_OBJECT (fakesrc), "num_buffers", 5, NULL); - gst_bin_add (GST_BIN (pipeline), fakesrc); - - g_mem_chunk_info (); - while (i--) { - GstElement *bin; - GstElement *fakesink; - - g_print ("+"); - - bin = gst_bin_new ("bin"); - - fakesink = gst_element_factory_make ("fakesink", "fakesink"); - - gst_bin_add (GST_BIN (bin), fakesink); - gst_bin_add (GST_BIN (pipeline), bin); - - gst_element_link (fakesrc, fakesink); - - gst_element_set_state (pipeline, GST_STATE_PLAYING); - - while (gst_bin_iterate (GST_BIN (pipeline))); - - gst_element_set_state (pipeline, GST_STATE_NULL); - - g_print ("-"); - gst_bin_remove (GST_BIN (pipeline), GST_ELEMENT (bin)); - - } - g_print ("\n"); - g_mem_chunk_info (); - - return 0; -} diff --git a/tests/old/testsuite/cleanup/cleanup5.c b/tests/old/testsuite/cleanup/cleanup5.c deleted file mode 100644 index 5ec03b5a90..0000000000 --- a/tests/old/testsuite/cleanup/cleanup5.c +++ /dev/null @@ -1,41 +0,0 @@ -#include <gst/gst.h> - -int -main (int argc, char *argv[]) -{ - GstElement *bin, *element; - gint i = 1000; - gint step = 100; - - - free (malloc (8)); /* -lefence */ - - gst_init (&argc, &argv); - - g_mem_chunk_info (); - - bin = gst_pipeline_new ("pipeline"); - - while (i--) { - GstPad *pad; - - if (i % step == 0) - fprintf (stderr, "\r%10d", i); - - element = gst_element_factory_make ("tee", "tee"); - if (!element) - break; - - pad = gst_element_get_request_pad (element, "src%d"); - - gst_bin_add (GST_BIN (bin), element); - gst_bin_remove (GST_BIN (bin), element); - - } - fprintf (stderr, "+\n"); - - gst_object_unref (GST_OBJECT (bin)); - - g_mem_chunk_info (); - return 0; -} diff --git a/tests/old/testsuite/clock/.gitignore b/tests/old/testsuite/clock/.gitignore deleted file mode 100644 index 523c8846de..0000000000 --- a/tests/old/testsuite/clock/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -clock1 -clock2 -signedness diff --git a/tests/old/testsuite/clock/Makefile.am b/tests/old/testsuite/clock/Makefile.am deleted file mode 100644 index d7ed02ba05..0000000000 --- a/tests/old/testsuite/clock/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -include ../Rules - -tests_pass = signedness clock1 clock2 -tests_fail = -tests_ignore = diff --git a/tests/old/testsuite/clock/clock1.c b/tests/old/testsuite/clock/clock1.c deleted file mode 100644 index 7aa9856457..0000000000 --- a/tests/old/testsuite/clock/clock1.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * testsuite program to test clock behaviour - * - * creates a fakesrc ! identity ! fakesink pipeline - * registers a callback on fakesrc and one on fakesink - * also register a normal GLib timeout which should not be reached - */ - -#include <gst/gst.h> -void -gst_clock_debug (GstClock * clock) -{ - g_print ("Clock info: time %" G_GUINT64_FORMAT "\n", - gst_clock_get_time (clock)); -} - -int -main (int argc, char *argv[]) -{ - GstElement *src, *id, *sink, *pipeline; - GstClock *clock = NULL; - - gst_init (&argc, &argv); - - if ((src = gst_element_factory_make ("fakesrc", "source")) == NULL) { - g_print ("Could not create a fakesrc element !\n"); - return 1; - } - if ((id = gst_element_factory_make ("identity", "filter")) == NULL) { - g_print ("Could not create a identity element !\n"); - return 1; - } - if ((sink = gst_element_factory_make ("fakesink", "sink")) == NULL) { - g_print ("Could not create a fakesink element !\n"); - return 1; - } - - if ((pipeline = gst_pipeline_new ("pipeline")) == NULL) { - g_print ("Could not create a pipeline element !\n"); - return 1; - } - - gst_bin_add_many (GST_BIN (pipeline), src, id, sink, NULL); - gst_element_link_many (src, id, sink, NULL); - - clock = gst_bin_get_clock (GST_BIN (pipeline)); - g_assert (clock != NULL); - gst_clock_debug (clock); - gst_clock_debug (clock); - - gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING); - gst_bin_iterate (GST_BIN (pipeline)); - gst_clock_debug (clock); - gst_clock_debug (clock); - gst_clock_debug (clock); - - /* success */ - return 0; -} diff --git a/tests/old/testsuite/clock/clock2.c b/tests/old/testsuite/clock/clock2.c deleted file mode 100644 index 303b9c20f4..0000000000 --- a/tests/old/testsuite/clock/clock2.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * testsuite program to test clock behaviour - * - * creates a fakesrc ! identity ! fakesink pipeline - * registers a callback on fakesrc and one on fakesink - * also register a normal GLib timeout which should not be reached - */ - -#include <gst/gst.h> -void -gst_clock_debug (GstClock * clock, GstElement * fakesink) -{ - g_print ("Clock info: time %" G_GUINT64_FORMAT " - Element info: time %" - G_GUINT64_FORMAT "\n", gst_clock_get_time (clock), - gst_element_get_time (fakesink)); -} - -int -main (int argc, char *argv[]) -{ - GstClock *clock = NULL; - GstElement *pipeline, *fakesrc, *fakesink; - - gst_init (&argc, &argv); - - clock = gst_system_clock_obtain (); - g_assert (clock != NULL); - - /* we check the time on an element */ - fakesrc = gst_element_factory_make ("fakesrc", NULL); - g_assert (fakesrc); - fakesink = gst_element_factory_make ("fakesink", NULL); - g_assert (fakesink); - pipeline = gst_element_factory_make ("pipeline", NULL); - g_assert (pipeline); - gst_bin_add_many (GST_BIN (pipeline), fakesink, fakesrc, NULL); - gst_element_link (fakesrc, fakesink); - gst_element_set_state (pipeline, GST_STATE_PLAYING); - - gst_clock_debug (clock, fakesink); - g_usleep (G_USEC_PER_SEC); - gst_clock_debug (clock, fakesink); - - gst_element_wait (fakesink, 2 * GST_SECOND); - gst_clock_debug (clock, fakesink); - - gst_element_wait (fakesink, 5 * GST_SECOND); - gst_clock_debug (clock, fakesink); - - g_usleep (G_USEC_PER_SEC); - gst_clock_debug (clock, fakesink); - - /* success */ - return 0; -} diff --git a/tests/old/testsuite/clock/signedness.c b/tests/old/testsuite/clock/signedness.c deleted file mode 100644 index 14c19d0d75..0000000000 --- a/tests/old/testsuite/clock/signedness.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * testsuite program to make sure GST_SECOND doesn't cause signedness - * conversions - */ - -#include <gst/gst.h> - -int -main (int argc, char *argv[]) -{ - GstClockTime time[] = { 0, 1, G_MAXUINT64 / GST_SECOND }; - GstClockTimeDiff diff[] = - { 0, 1, -1, G_MAXINT64 / GST_SECOND, G_MININT64 / GST_SECOND }; - guint i; - - gst_init (&argc, &argv); - - for (i = 0; i < G_N_ELEMENTS (time); i++) { - g_print ("%" G_GUINT64_FORMAT " != %" G_GUINT64_FORMAT - " * GST_SECOND / GST_SECOND ? ... ", time[i], time[i]); - if (time[i] != (time[i] * GST_SECOND / GST_SECOND)) { - g_print ("NO\n"); - g_assert_not_reached (); - return 1; - } - g_print ("yes\n"); - } - for (i = 0; i < G_N_ELEMENTS (diff); i++) { - g_print ("%" G_GINT64_FORMAT " != %" G_GINT64_FORMAT - " * GST_SECOND / GST_SECOND ? ... ", diff[i], diff[i]); - if (diff[i] != (diff[i] * GST_SECOND / GST_SECOND)) { - g_print ("NO\n"); - g_assert_not_reached (); - return 1; - } - g_print ("yes\n"); - } - - return 0; -} diff --git a/tests/old/testsuite/debug/.gitignore b/tests/old/testsuite/debug/.gitignore deleted file mode 100644 index 592d5994d7..0000000000 --- a/tests/old/testsuite/debug/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -category -commandline -global -output -printf_extension diff --git a/tests/old/testsuite/debug/Makefile.am b/tests/old/testsuite/debug/Makefile.am deleted file mode 100644 index b38ca39daf..0000000000 --- a/tests/old/testsuite/debug/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -include ../Rules - -tests_pass = commandline category output printf_extension -tests_fail = -tests_ignore = global diff --git a/tests/old/testsuite/debug/category.c b/tests/old/testsuite/debug/category.c deleted file mode 100644 index 350dfa41da..0000000000 --- a/tests/old/testsuite/debug/category.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de> - * - * category.c: test the categories - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <gst/gst.h> -#include <string.h> - -GST_DEBUG_CATEGORY (cat); -#define GST_CAT_DEFAULT cat -GST_DEBUG_CATEGORY_STATIC (cat_static); - -gint -main (gint argc, gchar * argv[]) -{ - GSList *before, *after; - - unsetenv ("GST_DEBUG"); - gst_init (&argc, &argv); - - before = gst_debug_get_all_categories (); - GST_DEBUG_CATEGORY_INIT (cat, "cat", GST_DEBUG_FG_GREEN, - "default category for this test"); - GST_DEBUG_CATEGORY_INIT (cat_static, "cat_static", - GST_DEBUG_BOLD | GST_DEBUG_FG_BLUE | GST_DEBUG_BG_RED, - "static category for this test"); - after = gst_debug_get_all_categories (); - - g_print ("removing default log function\n"); -#ifdef GST_DISABLE_GST_DEBUG - g_assert (gst_debug_remove_log_function (gst_debug_log_default) == 0); -#else - g_assert (gst_debug_remove_log_function (gst_debug_log_default) == 1); - g_print - ("checking, if the two new categories are put into the category list correctly...\n"); - g_assert (g_slist_length (after) - g_slist_length (before) == 2); - /* check the _get stuff */ - g_print - ("checking, if the gst_debug_category_get_* stuff works with the categories...\n"); - g_assert (strcmp (gst_debug_category_get_name (cat), "cat") == 0); - g_assert (gst_debug_category_get_color (cat) == GST_DEBUG_FG_GREEN); - g_assert (strcmp (gst_debug_category_get_description (cat), - "default category for this test") == 0); - g_assert (gst_debug_category_get_threshold (cat) == - gst_debug_get_default_threshold ()); - g_assert (strcmp (gst_debug_category_get_name (cat_static), - "cat_static") == 0); - g_assert (gst_debug_category_get_color (cat_static) | GST_DEBUG_FG_GREEN); - g_assert (gst_debug_category_get_color (cat_static) | GST_DEBUG_BG_RED); - g_assert (gst_debug_category_get_color (cat_static) | GST_DEBUG_BOLD); - g_assert (strcmp (gst_debug_category_get_description (cat_static), - "static category for this test") == 0); - g_assert (gst_debug_category_get_threshold (cat_static) == - gst_debug_get_default_threshold ()); - /* check if setting levels for names work */ - g_print - ("checking if changing threshold for names affects existing categories...\n"); - gst_debug_set_threshold_for_name ("cat", GST_LEVEL_DEBUG); - g_assert (gst_debug_category_get_threshold (cat) == GST_LEVEL_DEBUG); - g_assert (gst_debug_category_get_threshold (cat_static) == - gst_debug_get_default_threshold ()); - gst_debug_set_threshold_for_name ("cat_static", GST_LEVEL_INFO); - g_assert (gst_debug_category_get_threshold (cat) == GST_LEVEL_DEBUG); - g_assert (gst_debug_category_get_threshold (cat_static) == GST_LEVEL_INFO); -#endif - - g_print ("everything ok.\n"); - return 0; -} diff --git a/tests/old/testsuite/debug/commandline.c b/tests/old/testsuite/debug/commandline.c deleted file mode 100644 index fbfafe7949..0000000000 --- a/tests/old/testsuite/debug/commandline.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de> - * - * commandline.c: Test if the command line arguments work - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include <gst/gst.h> - -GST_DEBUG_CATEGORY (cat); -GST_DEBUG_CATEGORY_STATIC (cat_static); - -#ifndef GST_DISABLE_GST_DEBUG -static const gchar *lines[] = { - "--gst-debug-disable", - "--gst-debug-no-color", - "--gst-debug-level=4", - "--gst-debug=cat:4,cat_*:3", - "--gst-debug-level=4 --gst-debug=cat_*:5" -}; - -static void -debug_not_reached (GstDebugCategory * category, GstDebugLevel level, - const gchar * file, const gchar * function, gint line, GObject * object, - GstDebugMessage * message, gpointer thread) -{ - g_assert_not_reached (); -} -#endif - -gint -main (gint argc, gchar * argv[]) -{ - if (argc == 1) { - /* this is the main run that calls the others */ - - unsetenv ("GST_DEBUG"); - gst_init (&argc, &argv); -#ifndef GST_DISABLE_GST_DEBUG - { - gint i, runs, exit; - gchar *command; - - runs = G_N_ELEMENTS (lines); - for (i = 0; i < runs; i++) { - int ret; - - command = g_strdup_printf ("./commandline %s %d", lines[i], i); - g_print ("running \"%s\"\n", command); - ret = g_spawn_command_line_sync (command, NULL, NULL, &exit, NULL); - g_assert (ret == TRUE); - g_assert (exit == 0); - g_print ("\"%s\" worked as expected.\n", command); - g_free (command); - } - } -#endif - - return 0; - } else { - gst_init (&argc, &argv); - if (argc != 2) { - g_print - ("something funny happened to the command line arguments, aborting.\n"); - return 1; - } -#ifndef GST_DISABLE_GST_DEBUG - g_assert (gst_debug_remove_log_function (gst_debug_log_default) == 1); -#endif - GST_DEBUG_CATEGORY_INIT (cat, "cat", 0, "non-static category"); - GST_DEBUG_CATEGORY_INIT (cat_static, "cat_static", 0, "static category"); - switch (argv[1][0]) { - case '0': - g_assert (gst_debug_is_active () == FALSE); -#ifndef GST_DISABLE_GST_DEBUG - gst_debug_add_log_function (debug_not_reached, NULL); -#endif - GST_ERROR ("This will not be seen"); - return 0; - case '1': - return gst_debug_is_colored ()? 1 : 0; - case '2': - g_assert (gst_debug_get_default_threshold () == 4); - g_assert (gst_debug_category_get_threshold (cat) == 4); - return 0; - case '3': - g_assert (gst_debug_get_default_threshold () == GST_LEVEL_DEFAULT); - g_assert (gst_debug_category_get_threshold (cat) == 4); - g_assert (gst_debug_category_get_threshold (cat_static) == 3); - return 0; - case '4': - g_assert (gst_debug_get_default_threshold () == 4); - g_assert (gst_debug_category_get_threshold (cat) == 4); - g_assert (gst_debug_category_get_threshold (cat_static) == 5); - return 0; - default: - g_print ("usupported command, aborting...\n"); - return -1; - } - } - g_assert_not_reached (); -} diff --git a/tests/old/testsuite/debug/global.c b/tests/old/testsuite/debug/global.c deleted file mode 100644 index f8fc02bed8..0000000000 --- a/tests/old/testsuite/debug/global.c +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de> - * - * global.c: Test global parameter setting/getting - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gst/gst.h> - -#define THREAD_COUNT 5 -#define ITERATIONS 20 - -/* stupid logging functions */ -static void -gst_debug_log_one (GstDebugCategory * category, - GstDebugLevel level, - const gchar * file, - const gchar * function, - gint line, GObject * object, GstDebugMessage * message, gpointer data) - G_GNUC_NO_INSTRUMENT; - static void gst_debug_log_two (GstDebugCategory * category, - GstDebugLevel level, - const gchar * file, - const gchar * function, - gint line, GObject * object, GstDebugMessage * message, gpointer thread) - G_GNUC_NO_INSTRUMENT; - - static void - gst_debug_log_one (GstDebugCategory * category, GstDebugLevel level, - const gchar * file, const gchar * function, gint line, GObject * object, - GstDebugMessage * message, gpointer data) -{ -} -static void -gst_debug_log_two (GstDebugCategory * category, GstDebugLevel level, - const gchar * file, const gchar * function, gint line, GObject * object, - GstDebugMessage * message, gpointer data) -{ -} - -static gpointer -thread_main (gpointer threadnum) -{ - gint num; - gint i; - - num = GPOINTER_TO_INT (threadnum); - for (i = 0; i < ITERATIONS; i++) { - g_print ("iteration %d of thread %d starting\n", i, num); - /* do some stuff with global settings */ - gst_debug_set_default_threshold (GST_LEVEL_DEBUG); - gst_debug_add_log_function (gst_debug_log_one, g_thread_self ()); - gst_debug_add_log_function (gst_debug_log_two, NULL); - - /* reset all the stuff we did */ - gst_debug_set_default_threshold (GST_LEVEL_DEFAULT); - g_assert (gst_debug_remove_log_function_by_data (g_thread_self ()) == 1); - } - - g_print ("Thread %d is done.\n", num); - return threadnum; -} - -gint -main (gint argc, gchar * argv[]) -{ - gint i; - GThread *threads[THREAD_COUNT]; - - g_print ("initializing GStreamer\n"); - gst_init (&argc, &argv); - g_assert (gst_debug_remove_log_function (gst_debug_log_default) == 1); - - /* some checks for defaults */ - g_print ("Doing startup checks\n"); - g_assert (gst_debug_get_default_threshold () == GST_LEVEL_DEFAULT); - - g_print ("creating %d threads\n", THREAD_COUNT); - for (i = 0; i < THREAD_COUNT; i++) { - g_assert ((threads[i] = - g_thread_create (thread_main, GINT_TO_POINTER (i), TRUE, NULL))); - } - g_print ("joining %d threads\n", THREAD_COUNT); - for (i = 0; i < THREAD_COUNT; i++) { - g_assert (GPOINTER_TO_INT (g_thread_join (threads[i])) == i); - } - - /* some checks if everything worked */ - g_print ("Doing shutdown checks\n"); - g_assert (gst_debug_get_default_threshold () == GST_LEVEL_DEFAULT); - g_assert (gst_debug_remove_log_function (gst_debug_log_two) == - THREAD_COUNT * ITERATIONS); - - return 0; -} diff --git a/tests/old/testsuite/debug/output.c b/tests/old/testsuite/debug/output.c deleted file mode 100644 index 8360322418..0000000000 --- a/tests/old/testsuite/debug/output.c +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de> - * - * output.c: Test if the debugging output macros work - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <gst/gst.h> - -GST_DEBUG_CATEGORY_STATIC (cat_default); -#define GST_CAT_DEFAULT cat_default -GST_DEBUG_CATEGORY_STATIC (cat2); - -static gint count = -1; -static GstElement *pipeline; - -#ifndef GST_DISABLE_GST_DEBUG -static void -check_message (GstDebugCategory * category, GstDebugLevel level, - const gchar * file, const gchar * function, gint line, GObject * object, - GstDebugMessage * message, gpointer unused) -{ - gint temp; - - /* these checks require count to be set right. So the order in the main - funtion is actually important. */ - /* <0 means no checks */ - if (count < 0) - return; - - g_print ("expecting \"%s\"...", (gchar *) message); - /* level */ - temp = (count % 5) + 1; - g_assert (level == temp); - /* category */ - temp = (count % 10) / 5; - g_assert (category == (temp ? cat2 : cat_default)); - /* object */ - temp = (count % 20) / 10; - g_assert (object == (GObject *) (temp ? pipeline : NULL)); - g_print ("[OK]\n"); -} -#endif - -gint -main (gint argc, gchar * argv[]) -{ - - gst_init (&argc, &argv); - - GST_DEBUG_CATEGORY_INIT (cat_default, "GST_Check_default", 0, - "default category for this test"); - GST_DEBUG_CATEGORY_INIT (cat2, "GST_Check_2", 0, - "second category for this test"); -#ifndef GST_DISABLE_GST_DEBUG - g_assert (gst_debug_remove_log_function (gst_debug_log_default) == 1); -#endif - gst_debug_add_log_function (check_message, NULL); - - count = 0; - GST_ERROR ("This is an error."); - ++count; - GST_WARNING ("This is a warning."); - ++count; - GST_INFO ("This is an info message."); - ++count; - GST_DEBUG ("This is a debug message."); - ++count; - GST_LOG ("This is a log message."); - ++count; - GST_CAT_ERROR (cat2, "This is an error with category."); - ++count; - GST_CAT_WARNING (cat2, "This is a warning with category."); - ++count; - GST_CAT_INFO (cat2, "This is an info message with category."); - ++count; - GST_CAT_DEBUG (cat2, "This is a debug message with category."); - ++count; - GST_CAT_LOG (cat2, "This is a log message with category."); - count = -1; - pipeline = gst_element_factory_make ("pipeline", "testelement"); - count = 10; - GST_ERROR_OBJECT (pipeline, "This is an error with object."); - ++count; - GST_WARNING_OBJECT (pipeline, "This is a warning with object."); - ++count; - GST_INFO_OBJECT (pipeline, "This is an info message with object."); - ++count; - GST_DEBUG_OBJECT (pipeline, "This is a debug message with object."); - ++count; - GST_LOG_OBJECT (pipeline, "This is a log message with object."); - ++count; - GST_CAT_ERROR_OBJECT (cat2, pipeline, - "This is an error with category and object."); - ++count; - GST_CAT_WARNING_OBJECT (cat2, pipeline, - "This is a warning with category and object."); - ++count; - GST_CAT_INFO_OBJECT (cat2, pipeline, - "This is an info message with category and object."); - ++count; - GST_CAT_DEBUG_OBJECT (cat2, pipeline, - "This is a debug message with category and object."); - ++count; - GST_CAT_LOG_OBJECT (cat2, pipeline, - "This is a log message with category and object."); - count = -1; - -#ifndef GST_DISABLE_GST_DEBUG - g_assert (gst_debug_remove_log_function (check_message) == 1); -#endif - - return 0; -} diff --git a/tests/old/testsuite/debug/printf_extension.c b/tests/old/testsuite/debug/printf_extension.c deleted file mode 100644 index 393f68a7c7..0000000000 --- a/tests/old/testsuite/debug/printf_extension.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2004 David A. Schleef <ds@schleef.org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <gst/gst.h> - -gint -main (gint argc, gchar * argv[]) -{ - GstCaps *caps; - GstElement *element; - G_GNUC_UNUSED gpointer null = NULL; - - /* G_GNUC_UNUSED int zero = 0; */ - - gst_init (&argc, &argv); - - caps = gst_caps_from_string ("audio/x-raw-int, rate=44100"); - - element = gst_element_factory_make ("identity", NULL); - - GST_ERROR ("This should print caps: %" GST_PTR_FORMAT, caps); - GST_ERROR ("This should print an object: %" GST_PTR_FORMAT, element); - GST_ERROR ("This should print null: %" GST_PTR_FORMAT, NULL); - GST_ERROR ("This should print a pointer: %" GST_PTR_FORMAT, &null); - /* 64 bit address to a 32 bit int will cause the GObject interpretation - * to segfault; since GST_PTR_FORMAT only works on stuff with - * sizeof(gpointer) */ - /* GST_ERROR ("This should print a pointer: %" GST_PTR_FORMAT, &zero); */ - - /* GST_ERROR ("This should print a pointer: %" GST_PTR_FORMAT, (void *)1); */ - - return 0; -} diff --git a/tests/old/testsuite/dlopen/.gitignore b/tests/old/testsuite/dlopen/.gitignore deleted file mode 100644 index 3f9346b8de..0000000000 --- a/tests/old/testsuite/dlopen/.gitignore +++ /dev/null @@ -1 +0,0 @@ -dlopen_gst diff --git a/tests/old/testsuite/dlopen/Makefile.am b/tests/old/testsuite/dlopen/Makefile.am deleted file mode 100644 index 646d3a7fcf..0000000000 --- a/tests/old/testsuite/dlopen/Makefile.am +++ /dev/null @@ -1,41 +0,0 @@ -# ../Rules is not included because we specifically don't want the normal -# AM_CFLAGS, etc. - -plugin_LTLIBRARIES = libloadgst.la - -tests_pass = dlopen_gst -tests_fail = -tests_ignore = - -libloadgst_la_SOURCES = loadgst.c -libloadgst_la_CFLAGS = $(GST_OBJ_CFLAGS) -libloadgst_la_LDFLAGS = -module -avoid-version $(GST_OBJ_LIBS) - -dlopen_gst_CFLAGS = $(GLIB_CFLAGS) -dlopen_gst_LDFLAGS = $(GLIB_LIBS) - -TESTS_ENVIRONMENT= \ - G_DEBUG=fatal_warnings \ - GST_PLUGIN_PATH=$(top_builddir)/gst:. \ - GST_REGISTRY=$(top_builddir)/testsuite/test-registry.xml - -check_PROGRAMS = $(tests_pass) $(tests_fail) $(tests_ignore) - -# make all tests depend on the versioned gst-register -$(tests_pass) $(tests_fail): $(top_builddir)/tools/gst-register-@GST_MAJORMINOR@ - -# rebuild gst-register-@GST_MAJORMINOR@ if needed -# the EXEEXT is because am 1.6 complained about overrides -$(top_builddir)/tools/gst-register-@GST_MAJORMINOR@$(EXEEXT): - cd $(top_builddir)/tools && make - -TESTS = $(top_builddir)/tools/gst-register-@GST_MAJORMINOR@ \ - $(tests_pass) $(tests_fail) -XFAIL_TESTS = $(tests_fail) - -# override to _not_ install the test plugins -install-pluginLTLIBRARIES: - -# This rule is here so make distcheck works on machines where core -# dumps have PIDs appended -CLEANFILES = core.* diff --git a/tests/old/testsuite/dlopen/dlopen_gst.c b/tests/old/testsuite/dlopen/dlopen_gst.c deleted file mode 100644 index 2aa4008d4a..0000000000 --- a/tests/old/testsuite/dlopen/dlopen_gst.c +++ /dev/null @@ -1,28 +0,0 @@ - -#include <gmodule.h> - - -int -main (int argc, char *argv[]) -{ - GModule *module; - void (*symbol) (void); - gboolean ret; - - module = g_module_open (".libs/libloadgst.so", -#ifdef HAVE_G_MODULE_BIND_LOCAL - G_MODULE_BIND_LOCAL | -#endif - G_MODULE_BIND_LAZY); - g_assert (module != NULL); - - ret = g_module_symbol (module, "gst_init", (gpointer *) & symbol); - g_print ("'gst_init' is %s\n", ret ? "visible" : "not visible"); - - ret = g_module_symbol (module, "do_test", (gpointer *) & symbol); - g_assert (ret); - - symbol (); - - exit (0); -} diff --git a/tests/old/testsuite/dlopen/loadgst.c b/tests/old/testsuite/dlopen/loadgst.c deleted file mode 100644 index 9bfbd0a12c..0000000000 --- a/tests/old/testsuite/dlopen/loadgst.c +++ /dev/null @@ -1,28 +0,0 @@ - -#include <gst/gst.h> - - -void -do_test (void) -{ - GstElement *pipeline; - int i; - gboolean ret; - - gst_init (NULL, NULL); - - pipeline = gst_parse_launch ("fakesrc ! fakesink", NULL); - g_assert (pipeline != NULL); - - - gst_element_set_state (pipeline, GST_STATE_PLAYING); - - for (i = 0; i < 100; i++) { - ret = gst_bin_iterate (GST_BIN (pipeline)); - g_assert (ret); - g_print ("%s", (i & 1) ? "+" : "-"); - } - g_print ("\n"); - - gst_object_unref (GST_OBJECT (pipeline)); -} diff --git a/tests/old/testsuite/dynparams/.gitignore b/tests/old/testsuite/dynparams/.gitignore deleted file mode 100644 index f853c17ab1..0000000000 --- a/tests/old/testsuite/dynparams/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -*.bb -*.bbg -*.da - -dparamstest diff --git a/tests/old/testsuite/dynparams/Makefile.am b/tests/old/testsuite/dynparams/Makefile.am deleted file mode 100644 index 070a51455c..0000000000 --- a/tests/old/testsuite/dynparams/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -include ../Rules - -tests_pass = dparamstest -tests_fail = -tests_ignore = - -dparamstest_LDADD = $(top_builddir)/libs/gst/control/libgstcontrol-@GST_MAJORMINOR@.la diff --git a/tests/old/testsuite/dynparams/dparamstest.c b/tests/old/testsuite/dynparams/dparamstest.c deleted file mode 100644 index e41c96dac9..0000000000 --- a/tests/old/testsuite/dynparams/dparamstest.c +++ /dev/null @@ -1,319 +0,0 @@ -/* GStreamer - * Copyright (C) 2001 Steve Baker <stevebaker_org@yahoo.co.uk> - * - * dparamstest.c: - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gst/gst.h> -#include <gst/control/control.h> - -#define GST_TYPE_DPTEST (gst_dptest_get_type()) -#define GST_DPTEST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DPTEST,GstDpTest)) -#define GST_DPTEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DPTEST,GstDpTestClass)) -#define GST_IS_DPTEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DPTEST)) -#define GST_IS_DPTEST_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DPTEST)) - -typedef struct _GstDpTest GstDpTest; -typedef struct _GstDpTestClass GstDpTestClass; - -struct _GstDpTest -{ - GstElement element; - - GstPad *sinkpad; - GstPad *srcpad; - GstDParamManager *dpman; - - gfloat float1; - gfloat float2; - gboolean bool1; - gdouble double1; -}; - -struct _GstDpTestClass -{ - GstElementClass parent_class; -}; - -GType gst_dptest_get_type (void); - -enum -{ - ARG_0, -}; - -GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - -GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - - -static void gst_dptest_base_init (gpointer g_class); -static void gst_dptest_class_init (GstDpTestClass * klass); -static void gst_dptest_init (GstDpTest * dptest); - -static void gst_dptest_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec); - -static GstElementStateReturn gst_dptest_change_state (GstElement * element); -static void gst_dptest_chain (GstPad * pad, GstData * buf); - -static GstElementClass *parent_class = NULL; - -GType -gst_dptest_get_type (void) -{ - static GType dptest_type = 0; - - if (!dptest_type) { - static const GTypeInfo dptest_info = { - sizeof (GstDpTestClass), - gst_dptest_base_init, - NULL, - (GClassInitFunc) gst_dptest_class_init, - NULL, - NULL, - sizeof (GstDpTest), - 0, - (GInstanceInitFunc) gst_dptest_init, - }; - - dptest_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstDpTest", &dptest_info, 0); - } - return dptest_type; -} - -static void -gst_dptest_base_init (gpointer g_class) -{ - static GstElementDetails dptest_details = GST_ELEMENT_DETAILS ("DParamTest", - "Filter", - "Test for the GstDParam code", - "Steve Baker <stevebaker_org@yahoo.co.uk>"); - GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_set_details (element_class, &dptest_details); -} - -static void -gst_dptest_class_init (GstDpTestClass * klass) -{ - GObjectClass *gobject_class; - GstElementClass *gstelement_class; - - gobject_class = (GObjectClass *) klass; - gstelement_class = (GstElementClass *) klass; - - parent_class = g_type_class_ref (GST_TYPE_ELEMENT); - - gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_dptest_set_property); - - gstelement_class->change_state = gst_dptest_change_state; - -} - -static void -gst_dptest_init (GstDpTest * dptest) -{ - - dptest->sinkpad = - gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate), - "sink"); - gst_element_add_pad (GST_ELEMENT (dptest), dptest->sinkpad); - gst_pad_set_chain_function (dptest->sinkpad, gst_dptest_chain); - - dptest->srcpad = - gst_pad_new_from_template (gst_static_pad_template_get (&srctemplate), - "src"); - gst_element_add_pad (GST_ELEMENT (dptest), dptest->srcpad); - - dptest->dpman = gst_dpman_new ("dptest_dpman", GST_ELEMENT (dptest)); - - gst_dpman_add_required_dparam_direct (dptest->dpman, - g_param_spec_float ("float1", "float1", "float1", - 0.0, 1.0, 0.5, G_PARAM_READWRITE), "float", &(dptest->float1) - ); - - dptest->float1 = 0.0; -} - -static void -gst_dptest_set_property (GObject * object, guint prop_id, const GValue * value, - GParamSpec * pspec) -{ - GstDpTest *dptest; - - /* it's not null if we got it, but it might not be ours */ - g_return_if_fail (GST_IS_DPTEST (object)); - - dptest = GST_DPTEST (object); - - switch (prop_id) { - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static GstElementStateReturn -gst_dptest_change_state (GstElement * element) -{ - GstDpTest *dptest; - - g_return_val_if_fail (GST_IS_DPTEST (element), GST_STATE_FAILURE); - - dptest = GST_DPTEST (element); - if (GST_ELEMENT_CLASS (parent_class)->change_state) - return GST_ELEMENT_CLASS (parent_class)->change_state (element); - - return GST_STATE_SUCCESS; -} - -static void -gst_dptest_chain (GstPad * pad, GstData * data) -{ - GstDpTest *dptest; - gint frame_count; - - dptest = GST_DPTEST (gst_pad_get_parent (pad)); - g_assert (dptest); - g_print ("dp chain\n"); - - /* we're using a made up buffer size of 64 and a timestamp of zero */ - g_print ("preprocess\n"); - frame_count = 0; - GST_DPMAN_PREPROCESS (dptest->dpman, 64, 0LL); - - while (GST_DPMAN_PROCESS (dptest->dpman, frame_count)) { - ++frame_count; - } - g_print ("dp chain done\n"); -} - -gboolean -gst_dptest_register_elements (GstPlugin * plugin) -{ - return gst_element_register (plugin, "dptest", GST_RANK_NONE, - GST_TYPE_DPTEST); -} - -static GstPluginDesc plugin_desc = { - GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "dptest_elements", - "test elements", - &gst_dptest_register_elements, - NULL, - VERSION, - GST_LICENSE, - GST_PACKAGE, - GST_ORIGIN -}; - -int -main (int argc, char *argv[]) -{ - - GstElement *src; - GstElement *sink; - GstElement *testelement; - GstElement *pipeline; - GstDParamManager *dpman; - GstDParam *dp_float1; - GValue *dp_float1_value; - - gst_init (&argc, &argv); - gst_control_init (&argc, &argv); - - _gst_plugin_register_static (&plugin_desc); - - pipeline = gst_element_factory_make ("pipeline", "pipeline"); - g_assert (pipeline); - - src = gst_element_factory_make ("fakesrc", "src"); - g_assert (src); - - sink = gst_element_factory_make ("fakesink", "sink"); - g_assert (sink); - - testelement = gst_element_factory_make ("dptest", "testelement"); - g_assert (testelement); - - gst_bin_add_many (GST_BIN (pipeline), src, testelement, sink, NULL); - gst_element_link_many (src, testelement, sink, NULL); - - g_object_set (G_OBJECT (src), "num_buffers", 1, NULL); - - g_print ("setting pipeline to play\n"); - gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING); - - /* test that dparam manager is accessable */ - g_print ("getting dparam manager\n"); - dpman = gst_dpman_get_manager (testelement); - gst_dpman_set_mode (dpman, "synchronous"); - - g_assert (dpman); - g_assert (GST_IS_DPMAN (dpman)); - - g_print ("creating dparam for float1\n"); - dp_float1 = gst_dparam_new (G_TYPE_FLOAT);; - g_assert (dp_float1); - g_assert (GST_IS_DPARAM (dp_float1)); - - g_print ("attach dparam to float1\n"); - g_assert (gst_dpman_attach_dparam (dpman, "float1", dp_float1)); - - dp_float1_value = g_new0 (GValue, 1); - g_value_init (dp_float1_value, G_TYPE_FLOAT); - - g_value_set_float (dp_float1_value, 0.1); - g_object_set_property (G_OBJECT (dp_float1), "value_float", dp_float1_value); - - g_print ("iterate once\n"); - gst_bin_iterate (GST_BIN (pipeline)); - - g_print ("check that value changed\n"); - g_assert (GST_DPTEST (testelement)->float1 == 0.1F); - g_assert (!GST_DPARAM_READY_FOR_UPDATE (dp_float1)); - - g_print ("nulling pipeline\n"); - gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL); - - g_print ("playing pipeline\n"); - gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING); - - g_print ("iterate twice\n"); - - g_object_set (G_OBJECT (src), "num_buffers", 2, NULL); - gst_bin_iterate (GST_BIN (pipeline)); - - return 0; -} diff --git a/tests/old/testsuite/elements/.gitignore b/tests/old/testsuite/elements/.gitignore deleted file mode 100644 index 24f01829e8..0000000000 --- a/tests/old/testsuite/elements/.gitignore +++ /dev/null @@ -1,16 +0,0 @@ -Makefile -Makefile.in -*.o -*.lo -*.la -.deps -.libs - -fake -name -property -tee -gst-inspect-check -gst-compprep-check -static -struct_size diff --git a/tests/old/testsuite/elements/Makefile.am b/tests/old/testsuite/elements/Makefile.am deleted file mode 100644 index afce6a58c8..0000000000 --- a/tests/old/testsuite/elements/Makefile.am +++ /dev/null @@ -1,20 +0,0 @@ -include ../Rules - -# disable gst-compprep-check until it doesn't leave stray files for distcheck -tests_pass = name tee property fake gst-inspect-check struct_size -tests_fail = -tests_ignore = - -noinst_HEADERS = property.h struct_i386.h - -gst_inspect_check_SOURCES = -gst-inspect-check$(EXEEXT): $(srcdir)/gst-inspect-check.in - sed s/@[G]ST_MAJORMINOR@/@GST_MAJORMINOR@/ \ - $(srcdir)/gst-inspect-check.in >gst-inspect-check$(EXEEXT) - chmod +x gst-inspect-check$(EXEEXT) - -#gst_compprep_check_SOURCES = -#gst-compprep-check$(EXEEXT): -# cp $(srcdir)/gst-compprep-check.in gst-compprep-check$(EXEEXT) - -EXTRA_DIST = gst-inspect-check.in gst-compprep-check.in diff --git a/tests/old/testsuite/elements/fake.c b/tests/old/testsuite/elements/fake.c deleted file mode 100644 index 43e4c33e3a..0000000000 --- a/tests/old/testsuite/elements/fake.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * test for fakesrc and fakesink element - * thomas@apestaart.org - * originally written for 0.3.2 - */ - -#include <gst/gst.h> -#include "property.h" - -GstElement * -element_create (char *name, char *element) - /* - * create the element - * print an error if it can't be created - * return NULL if it couldn't be created - * return element if it did work - */ -{ - GstElement *el = NULL; - - el = (GstElement *) gst_element_factory_make (element, name); - if (el == NULL) { - fprintf (stderr, "Could not create element %s (%s) !\n", name, element); - return NULL; - } else - return el; -} - -int -main (int argc, char *argv[]) -{ - GstElement *pipeline = NULL; - GstElement *src, *sink; - gint retval = 0; - - /* init */ - gst_init (&argc, &argv); - - /* create */ - g_print ("Creating pipeline\n"); - pipeline = gst_pipeline_new ("pipeline"); - - g_print ("Connecting signals to pipeline\n"); - g_signal_connect (pipeline, "deep_notify", - G_CALLBACK (property_change_callback), NULL); - g_print ("Creating elements\n"); - if (!(src = element_create ("src", "fakesrc"))) - return 1; - g_object_set (G_OBJECT (src), "sizetype", 2, NULL); - if (!(sink = element_create ("sink", "fakesink"))) - return 1; - - /* add */ - g_print ("Adding elements to bin\n"); - gst_bin_add (GST_BIN (pipeline), src); - gst_bin_add (GST_BIN (pipeline), sink); - - /* link */ - g_print ("Linking elements\n"); - gst_element_set_state (pipeline, GST_STATE_PLAYING); - - /* we expect this to give an error */ - if (gst_bin_iterate (GST_BIN (pipeline)) != FALSE) { - g_warning - ("Iterating a bin with unlinked elements should return FALSE !\n"); - retval = 1; - } - - gst_pad_link (gst_element_get_pad (src, "src"), - gst_element_get_pad (sink, "sink")); - - /* set to play */ - g_print ("Doing 1 iteration\n"); - gst_element_set_state (pipeline, GST_STATE_PLAYING); - - /* we expect this to work */ - if (gst_bin_iterate (GST_BIN (pipeline)) != TRUE) { - g_error ("Iterating a bin with linked elements should return TRUE !\n"); - retval = 1; - } - - g_print ("Done !\n"); - return retval; -} diff --git a/tests/old/testsuite/elements/gst-compprep-check.in b/tests/old/testsuite/elements/gst-compprep-check.in deleted file mode 100755 index c5a2cf42f9..0000000000 --- a/tests/old/testsuite/elements/gst-compprep-check.in +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -../../tools/gst-compprep --gst-fatal-warnings diff --git a/tests/old/testsuite/elements/gst-inspect-check.in b/tests/old/testsuite/elements/gst-inspect-check.in deleted file mode 100755 index 55b5cdb1ac..0000000000 --- a/tests/old/testsuite/elements/gst-inspect-check.in +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/perl -w - -# checks all built plugins by running gst-inspect on each element -# and checking for warnings on stderr - -### packages - -use File::Basename; - -print " _______\n"; -print " (__) / \\\n"; -print " (oo) ( M O O )\n"; -print " /-------\\/ --'\\_______/\n"; -print " / | ||\n"; -print "* ||----||\n"; -print " ^^ ^^\n"; - -my $num_warnings = 0; -my $path = `dirname $0`; -chomp $path; -$path = "../../tools"; - -$gst_inspect = "$path/gst-inspect-@GST_MAJORMINOR@"; - -sub check_all_elements -{ - #send stderr to /dev/null - my $command = "$gst_inspect 2>/dev/null"; - my @lines = `$command`; - - if (!@lines) { - print ("gst-inspect returned nothing\n"); - return -1; - } - while ($_ = shift(@lines)){ - my @matches = m/^\w+:\s+(\w+):/; - if(@matches){ - check_element($matches[0]); - } - } - if ($num_warnings > 0){ - print("there are $num_warnings warnings to be fixed\n"); - return -1; - } - return 0; -} - -sub check_element($) -{ - my ($element) = @_; - print "running inspect on $element\n"; - - # capture stderr, send stdout to /dev/null - my $command = "$gst_inspect $element 2>&1 1>/dev/null"; - - my @lines = `$command`; - - while ($_ = shift(@lines)){ - # ignore INFO lines, they are ok - if (! /INFO/){ - print $_; - - # do this to ignore empty lines - if (length > 1){ - $num_warnings++; - } - } - } - system("$gst_inspect $element 2>/dev/null 1>/dev/null"); - if ($? != 0){ - my $exit_value = $? >> 8; - my $signal_num = $? & 127; - my $dumped_core = $? & 128; - if ($exit_value){ - print("error value on exit: $exit_value\n"); - } - if ($signal_num){ - print("signal caused exit: $signal_num\n"); - } - if ($dumped_core){ - print("dumped core: $dumped_core\n"); - } - $num_warnings++ - } -} - -### main - -exit check_all_elements (); - diff --git a/tests/old/testsuite/elements/name.c b/tests/old/testsuite/elements/name.c deleted file mode 100644 index 2780e2c91e..0000000000 --- a/tests/old/testsuite/elements/name.c +++ /dev/null @@ -1,28 +0,0 @@ -/* - * test with names - * create a bunch of elements with NULL as name - * make sure they get created with a decent name - */ - -#include <gst/gst.h> - -int -main (int argc, char *argv[]) -{ - GstElement *element = NULL; - int i = 0; - - /* init */ - gst_init (&argc, &argv); - - for (i = 0; i < 50; ++i) { - /* create element */ - element = gst_element_factory_make ("identity", NULL); - g_assert (GST_IS_ELEMENT (element)); - g_assert (gst_element_get_name (element) != NULL); - g_print ("Created identity element with name %s\n", - gst_element_get_name (element)); - } - g_print ("Done !\n"); - return 0; -} diff --git a/tests/old/testsuite/elements/property.c b/tests/old/testsuite/elements/property.c deleted file mode 100644 index f1ae40fed7..0000000000 --- a/tests/old/testsuite/elements/property.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * test for setting and getting of object properties - * creates a fakesrc - * sets silent (boolean), name (string), and sizemin (int) - * then retrieves the set values and compares - * thomas@apestaart.org - * originally written for 0.4.0 - */ - -#include <string.h> -#include <gst/gst.h> - -GstElement * -element_create (char *name, char *element) - /* - * create the element - * print an error if it can't be created - * return NULL if it couldn't be created - * return element if it did work - */ -{ - GstElement *el = NULL; - - el = (GstElement *) gst_element_factory_make (element, name); - if (el == NULL) { - fprintf (stderr, "Could not create element %s (%s) !\n", name, element); - return NULL; - } else - return el; -} - -int -main (int argc, char *argv[]) -{ - GstElement *src; - gint retval = 0; - gboolean silent_set, silent_get; - gint sizemin_set, sizemin_get; - gchar *name_set, *name_get; - - /* init */ - gst_init (&argc, &argv); - - /* create */ - g_print ("Creating element\n"); - if (!(src = element_create ("src", "fakesrc"))) - return 1; - - /* set */ - silent_set = TRUE; - sizemin_set = 1; - name_set = g_strdup_printf ("test"); - - gst_element_set (src, - "name", name_set, "sizemin", sizemin_set, "silent", silent_set, NULL); - /* get */ - gst_element_get (src, - "name", &name_get, "sizemin", &sizemin_get, "silent", &silent_get, NULL); - - /* compare */ - if (sizemin_set != sizemin_get) { - g_print ("sizemin: set value %d differs from returned value %d\n", - sizemin_set, sizemin_get); - retval = 1; - } else - g_print ("name: set right\n"); - - if (silent_set != silent_get) { - g_print ("silent: set value %s differs from returned value %s\n", - silent_set ? "TRUE" : "FALSE", silent_get ? "TRUE" : "FALSE"); - retval = 1; - } else - g_print ("silent: set right\n"); - - if (strcmp (name_set, name_get) != 0) { - g_print ("name: set value %s differs from returned value %s\n", - name_set, name_get); - retval = 1; - } else - g_print ("name: set right\n"); - - return retval; -} diff --git a/tests/old/testsuite/elements/property.h b/tests/old/testsuite/elements/property.h deleted file mode 100644 index 199b8125b2..0000000000 --- a/tests/old/testsuite/elements/property.h +++ /dev/null @@ -1,23 +0,0 @@ -/* extracted from gst-launch */ -static void -property_change_callback (GObject *object, GstObject *orig, GParamSpec *pspec) -{ - GValue value = { 0, }; /* the important thing is that value.type = 0 */ - gchar *str = 0; - - if (pspec->flags & G_PARAM_READABLE) { - g_value_init(&value, G_PARAM_SPEC_VALUE_TYPE (pspec)); - g_object_get_property (G_OBJECT (orig), pspec->name, &value); - /* fix current bug with g_strdup_value_contents not working with gint64 */ - if (G_IS_PARAM_SPEC_INT64 (pspec)) - str = g_strdup_printf ("%" G_GINT64_FORMAT, g_value_get_int64 (&value)); - else - str = g_strdup_value_contents (&value); - g_print ("%s: %s = %s\n", GST_OBJECT_NAME (orig), pspec->name, str); - g_free (str); - g_value_unset(&value); - } else { - g_warning ("Parameter not readable. What's up with that?"); - } -} - diff --git a/tests/old/testsuite/elements/struct_i386.h b/tests/old/testsuite/elements/struct_i386.h deleted file mode 100644 index ec634cd47f..0000000000 --- a/tests/old/testsuite/elements/struct_i386.h +++ /dev/null @@ -1,150 +0,0 @@ -/* Generated by GStreamer-0.8.4.1 */ -Struct list[] = { - {"GstPoptOption", sizeof (GstPoptOption), 28} - , - {"GstAtomicInt", sizeof (GstAtomicInt), 8} - , - {"GstBuffer", sizeof (GstBuffer), 108} - , - {"GstCaps", sizeof (GstCaps), 28} - , - {"GstStaticCaps", sizeof (GstStaticCaps), 48} - , - {"GstClockEntry", sizeof (GstClockEntry), 36} - , - {"GstClock", sizeof (GstClock), 128} - , - {"GstClockClass", sizeof (GstClockClass), 172} - , - {"GstData", sizeof (GstData), 40} - , - {"GstElementDetails", sizeof (GstElementDetails), 32} - , - {"GstElementFactory", sizeof (GstElementFactory), 112} - , - {"GstElementFactoryClass", sizeof (GstElementFactoryClass), 104} - , - {"GstFormatDefinition", sizeof (GstFormatDefinition), 12} - , - {"GstIndexEntry", sizeof (GstIndexEntry), 20} - , - {"GstIndexGroup", sizeof (GstIndexGroup), 16} - , - {"GstIndex", sizeof (GstIndex), 100} - , - {"GstIndexClass", sizeof (GstIndexClass), 156} - , - {"GstIndexAssociation", sizeof (GstIndexAssociation), 12} - , - {"GstIndexFactory", sizeof (GstIndexFactory), 64} - , - {"GstIndexFactoryClass", sizeof (GstIndexFactoryClass), 104} - , - {"GstDebugCategory", sizeof (GstDebugCategory), 16} - , - {"GstRealPad", sizeof (GstRealPad), 196} - , - {"GstRealPadClass", sizeof (GstRealPadClass), 168} - , - {"GstGhostPad", sizeof (GstGhostPad), 88} - , - {"GstGhostPadClass", sizeof (GstGhostPadClass), 152} - , - {"GstStaticPadTemplate", sizeof (GstStaticPadTemplate), 60} - , - {"GstPipeline", sizeof (GstPipeline), 180} - , - {"GstPipelineClass", sizeof (GstPipelineClass), 328} - , - {"GstPlugin", sizeof (GstPlugin), 92} - , - {"GstPluginDesc", sizeof (GstPluginDesc), 56} - , - {"GstPluginFeature", sizeof (GstPluginFeature), 40} - , - {"GstPluginFeatureClass", sizeof (GstPluginFeatureClass), 88} - , - {"GstProbe", sizeof (GstProbe), 12} - , - {"GstProbeDispatcher", sizeof (GstProbeDispatcher), 8} - , - {"GstQueryTypeDefinition", sizeof (GstQueryTypeDefinition), 12} - , - {"GstQueue", sizeof (GstQueue), 252} - , - {"GstQueueSize", sizeof (GstQueueSize), 16} - , - {"GstQueueClass", sizeof (GstQueueClass), 300} - , - {"GstRegistry", sizeof (GstRegistry), 56} - , - {"GstRegistryClass", sizeof (GstRegistryClass), 116} - , - {"GstSchedulerFactory", sizeof (GstSchedulerFactory), 64} - , - {"GstSchedulerFactoryClass", sizeof (GstSchedulerFactoryClass), 104} - , - {"GstStructure", sizeof (GstStructure), 28} - , - {"GstSystemClock", sizeof (GstSystemClock), 152} - , - {"GstSystemClockClass", sizeof (GstSystemClockClass), 188} - , - {"GstTagSetterIFace", sizeof (GstTagSetterIFace), 8} - , - {"GstThread", sizeof (GstThread), 196} - , - {"GstThreadClass", sizeof (GstThreadClass), 332} - , - {"GstTrace", sizeof (GstTrace), 20} - , - {"GstTraceEntry", sizeof (GstTraceEntry), 128} - , - {"GstAllocTrace", sizeof (GstAllocTrace), 16} - , - {"GstTrashStack", sizeof (GstTrashStack), 12} - , - {"GstTrashStackElement", sizeof (GstTrashStackElement), 4} - , - {"GstTypeFind", sizeof (GstTypeFind), 32} - , - {"GstTypeFindFactory", sizeof (GstTypeFindFactory), 72} - , - {"GstTypeFindFactoryClass", sizeof (GstTypeFindFactoryClass), 104} - , - {"GstObject", sizeof (GstObject), 44} - , - {"GstObjectClass", sizeof (GstObjectClass), 120} - , - {"GstPad", sizeof (GstPad), 68} - , - {"GstPadClass", sizeof (GstPadClass), 136} - , - {"GstPadTemplate", sizeof (GstPadTemplate), 76} - , - {"GstPadTemplateClass", sizeof (GstPadTemplateClass), 140} - , - {"GstElement", sizeof (GstElement), 124} - , - {"GstElementClass", sizeof (GstElementClass), 272} - , - {"GstBin", sizeof (GstBin), 164} - , - {"GstBinClass", sizeof (GstBinClass), 312} - , - {"GstScheduler", sizeof (GstScheduler), 92} - , - {"GstSchedulerClass", sizeof (GstSchedulerClass), 216} - , - {"GstEvent", sizeof (GstEvent), 176} - , - {"GstURIHandlerInterface", sizeof (GstURIHandlerInterface), 44} - , - {"GstValueTable", sizeof (GstValueTable), 32} - , - {"GstXML", sizeof (GstXML), 68} - , - {"GstXMLClass", sizeof (GstXMLClass), 144} - , - {NULL, 0, 0} -}; diff --git a/tests/old/testsuite/elements/struct_size.c b/tests/old/testsuite/elements/struct_size.c deleted file mode 100644 index 1343125c02..0000000000 --- a/tests/old/testsuite/elements/struct_size.c +++ /dev/null @@ -1,69 +0,0 @@ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gst/gst.h> -#include <gst/gstqueue.h> -#include <gst/gsttrashstack.h> -#include <stdlib.h> - -typedef struct -{ - char *name; - int size; - int abi_size; -} -Struct; - -#ifdef HAVE_CPU_I386 -#include "struct_i386.h" -#define HAVE_ABI_SIZES -#else -/* in case someone wants to generate a new arch */ -#include "struct_i386.h" -#endif - -int -main (int argc, char *argv[]) -{ - int i; - - if (argc > 1) { - g_print ("/* Generated by GStreamer-%s */\n", GST_VERSION); - g_print ("Struct list[] = {\n"); - for (i = 0; list[i].name; i++) { - g_print (" { \"%s\", sizeof (%s), %d },\n", - list[i].name, list[i].name, list[i].size); - } - g_print (" { NULL, 0, 0}\n"); - g_print ("};\n"); - } else { - g_print ("Run './struct_size regen' to regenerate structs.h\n"); - -#ifdef HAVE_ABI_SIZES - { - gboolean ok = TRUE; - - for (i = 0; list[i].name; i++) { - if (list[i].size != list[i].abi_size) { - ok = FALSE; - g_print ("sizeof(%s) is %d, expected %d\n", - list[i].name, list[i].size, list[i].abi_size); - } - } - if (ok) { - g_print ("All structures expected size\n"); - } else { - g_print ("failed\n"); - exit (1); - } - } -#else - g_print ("No structure size list was generated for this architecture\n"); - g_print ("ignoring\n"); -#endif - } - - exit (0); -} diff --git a/tests/old/testsuite/elements/tee.c b/tests/old/testsuite/elements/tee.c deleted file mode 100644 index 9f4a528e6b..0000000000 --- a/tests/old/testsuite/elements/tee.c +++ /dev/null @@ -1,172 +0,0 @@ -/* - * test for tee element - * this tests for proxying of caps from tee sink to src's in various situations - * it also tests if you get a good, unique pad when requesting a third one - * which shows a bug in 0.3.2 : - * request pad, get 0 - * request pad, get 1 - * remove pad 0, - * request pad, get 1 (number of pads), already exists, assert fail - * - * thomas@apestaart.org - * originally written for 0.3.2 - */ - -#include <gst/gst.h> -#include <property.h> - -GstElement * -element_create (char *name, char *element) - /* - * create the element - * print an error if it can't be created - * return NULL if it couldn't be created - * return element if it did work - */ -{ - GstElement *el = NULL; - - el = (GstElement *) gst_element_factory_make (element, name); - if (el == NULL) { - fprintf (stderr, "Could not create element %s (%s) !\n", name, element); - return NULL; - } else - return el; -} - -int -main (int argc, char *argv[]) -{ - GstElement *pipeline = NULL; - GstElement *tee, *src, *sink1, *sink2; - GstPad *tee_src1, *tee_src2; - -#if 0 - GstCaps *src_caps = NULL; - GstCaps *sink_caps = NULL; - GstStructure *structure = NULL; - GstPad *pad = NULL; -#endif - - /* init */ - gst_init (&argc, &argv); - - /* create */ - g_print ("Creating pipeline\n"); - pipeline = gst_pipeline_new ("pipeline"); - - g_print ("Connecting signals to pipeline\n"); - g_signal_connect (pipeline, "deep_notify", - G_CALLBACK (property_change_callback), NULL); - - g_print ("Creating elements\n"); - if (!(tee = element_create ("tee", "tee"))) - return 1; - if (!(src = element_create ("src", "fakesrc"))) - return 1; - g_object_set (G_OBJECT (src), "sizetype", 2, NULL); - if (!(sink1 = element_create ("sink1", "fakesink"))) - return 1; - if (!(sink2 = element_create ("sink2", "fakesink"))) - return 1; - - /* add */ - g_print ("Adding elements to bin\n"); - gst_bin_add (GST_BIN (pipeline), src); - gst_bin_add (GST_BIN (pipeline), tee); - - /* link input part */ - g_print ("Linking input elements\n"); - gst_pad_link (gst_element_get_pad (src, "src"), - gst_element_get_pad (tee, "sink")); - - /* request one pad from tee */ - g_print ("Requesting first pad\n"); - tee_src1 = gst_element_get_request_pad (tee, "src%d"); - gst_bin_add (GST_BIN (pipeline), sink1); - gst_pad_link (tee_src1, gst_element_get_pad (sink1, "sink")); - - /* set to play */ - g_print ("Doing 1 iteration\n"); - gst_element_set_state (pipeline, GST_STATE_PLAYING); - gst_bin_iterate (GST_BIN (pipeline)); - - /* pause and request another pad */ - g_print ("Requesting second pad\n"); - gst_element_set_state (pipeline, GST_STATE_PAUSED); - tee_src2 = gst_element_get_request_pad (tee, "src%d"); - gst_bin_add (GST_BIN (pipeline), sink2); - gst_pad_link (tee_src2, gst_element_get_pad (sink2, "sink")); - - /* now we have two fakesinks linked, iterate */ - g_print ("Doing 1 iteration\n"); - gst_element_set_state (pipeline, GST_STATE_PLAYING); - gst_bin_iterate (GST_BIN (pipeline)); - - /* We don't allow apps to call gst_pad_try_set_caps(). */ -#if 0 - /* now we try setting caps on the src pad */ - /* FIXME: should we set to pause here ? */ - src_caps = gst_caps_from_string ("audio/raw, format=(s)\"int\", " - "rate=(i)44100"); - - g_assert (src_caps != NULL); - g_print ("Setting caps on fakesrc's src pad\n"); - pad = gst_element_get_pad (src, "src"); - if ((gst_pad_try_set_caps (pad, src_caps)) <= 0) { - g_print ("Could not set caps !\n"); - } - - /* now iterate and see if it proxies caps ok */ - gst_bin_iterate (GST_BIN (pipeline)); - sink_caps = gst_pad_get_caps (gst_element_get_pad (sink1, "sink")); - if (sink_caps && gst_caps_is_fixed (sink_caps)) { - structure = gst_caps_get_structure (sink_caps, 0); - } else { - structure = NULL; - g_print ("sink_caps is not fixed\n"); - } - if (structure == NULL || !(gst_structure_has_field (structure, "rate"))) { - g_print ("Hm, rate has not been propagated to sink1.\n"); - return 1; - } else { - int rate; - - gst_structure_get_int (structure, "rate", &rate); - g_print ("Rate of pad on sink1 : %d\n", rate); - } - sink_caps = gst_pad_get_caps (gst_element_get_pad (sink2, "sink")); - structure = gst_caps_get_structure (sink_caps, 0); - if (structure != NULL && !(gst_structure_has_field (structure, "rate"))) { - g_print ("Hm, rate has not been propagated to sink2.\n"); - return 1; - } else { - int rate; - - gst_structure_get_int (structure, "rate", &rate); - g_print ("Rate of pad on sink2 : %d\n", rate); - } -#endif - - /* remove the first one, iterate */ - g_print ("Removing first sink\n"); - gst_element_set_state (pipeline, GST_STATE_PAUSED); - gst_pad_unlink (tee_src1, gst_element_get_pad (sink1, "sink")); - gst_bin_remove (GST_BIN (pipeline), sink1); - - /* only second fakesink linked, iterate */ - g_print ("Doing 1 iteration\n"); - gst_element_set_state (pipeline, GST_STATE_PLAYING); - gst_bin_iterate (GST_BIN (pipeline)); - - /* request another pad */ - g_print ("Requesting third pad\n"); - gst_element_set_state (pipeline, GST_STATE_PAUSED); - /* in 0.3.2 the next statement gives an assert error */ - tee_src1 = gst_element_get_request_pad (tee, "src%d"); - - gst_element_set_state (pipeline, GST_STATE_NULL); - - g_print ("Done !\n"); - return 0; -} diff --git a/tests/old/testsuite/ghostpads/.gitignore b/tests/old/testsuite/ghostpads/.gitignore deleted file mode 100644 index a7b1f5e387..0000000000 --- a/tests/old/testsuite/ghostpads/.gitignore +++ /dev/null @@ -1 +0,0 @@ -ghostpads diff --git a/tests/old/testsuite/ghostpads/Makefile.am b/tests/old/testsuite/ghostpads/Makefile.am deleted file mode 100644 index 438055d31a..0000000000 --- a/tests/old/testsuite/ghostpads/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -include ../Rules - -tests_pass = ghostpads -tests_fail = -tests_ignore = diff --git a/tests/old/testsuite/ghostpads/ghostpads.c b/tests/old/testsuite/ghostpads/ghostpads.c deleted file mode 100644 index 7d87782c61..0000000000 --- a/tests/old/testsuite/ghostpads/ghostpads.c +++ /dev/null @@ -1,62 +0,0 @@ -/* GStreamer - * Copyright (C) 2004 Andy Wingo <wingo at pobox.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include <gst/gst.h> - -gint -main (gint argc, gchar * argv[]) -{ - GstElement *pipeline, *bin; - GstElement *fakesrc, *fakesink, *identity; - GstPad *sink, *src, *real = (GstPad *) 0xdeadbeef; - - gst_init (&argc, &argv); - - pipeline = gst_element_factory_make ("pipeline", NULL); - bin = gst_element_factory_make ("bin", NULL); - fakesrc = gst_element_factory_make ("fakesrc", NULL); - fakesink = gst_element_factory_make ("fakesink", NULL); - identity = gst_element_factory_make ("identity", NULL); - - gst_bin_add_many (GST_BIN (pipeline), fakesrc, bin, fakesink, NULL); - gst_bin_add (GST_BIN (bin), identity); - - sink = gst_element_add_ghost_pad (bin, - gst_element_get_pad (identity, "sink"), "sink"); - src = gst_element_add_ghost_pad (bin, - gst_element_get_pad (identity, "src"), "src"); - - gst_element_link_many (fakesrc, bin, fakesink, NULL); - gst_element_set_state (pipeline, GST_STATE_PLAYING); - - if (!gst_bin_iterate (GST_BIN (pipeline))) - g_assert_not_reached (); - - gst_element_set_state (pipeline, GST_STATE_NULL); - - /* test the cleanup */ - gst_object_ref (GST_OBJECT (sink)); - gst_object_unref ((GstObject *) pipeline); - g_object_get (sink, "real-pad", &real, NULL); - g_assert (real == NULL); - g_assert (G_OBJECT (sink)->ref_count == 1); - gst_object_unref (GST_OBJECT (sink)); - - return 0; -} diff --git a/tests/old/testsuite/indexers/.gitignore b/tests/old/testsuite/indexers/.gitignore deleted file mode 100644 index 2b7e86e5ab..0000000000 --- a/tests/old/testsuite/indexers/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -Makefile -Makefile.in -*.o -*.lo -*.la -.deps -.libs -indexdump -cache1 diff --git a/tests/old/testsuite/indexers/Makefile.am b/tests/old/testsuite/indexers/Makefile.am deleted file mode 100644 index 829c2fd4e6..0000000000 --- a/tests/old/testsuite/indexers/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -include ../Rules - -tests_pass = cache1 indexdump -tests_fail = -tests_ignore = diff --git a/tests/old/testsuite/indexers/cache1.c b/tests/old/testsuite/indexers/cache1.c deleted file mode 100644 index 2cfff7b40c..0000000000 --- a/tests/old/testsuite/indexers/cache1.c +++ /dev/null @@ -1,115 +0,0 @@ -/* GStreamer - * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include <gst/gst.h> - -static void -lookup (GstIndex * index, GstIndexLookupMethod method, - GstFormat src_format, gint64 src_value, - GstFormat dest_format, gint64 expecting) -{ - GstIndexEntry *entry; - gint64 result; - - entry = gst_index_get_assoc_entry (index, 0, method, 0, - src_format, src_value); - if (entry) { - gst_index_entry_assoc_map (entry, dest_format, &result); - - if (result == expecting) { - g_print ("OK (%" G_GINT64_FORMAT ")\n", result); - } else { - g_print ("FAIL - expecting %" G_GINT64_FORMAT ", got %" G_GINT64_FORMAT - "\n", expecting, result); - } - } else { - const GstFormatDefinition *def = gst_format_get_details (src_format); - - if (expecting == -1) - g_print ("OK (not found)\n"); - else - g_print ("FAIL - no index entry found for %" G_GINT64_FORMAT - " %s, expecting %" G_GINT64_FORMAT "\n", src_value, def->nick, - expecting); - } -} - -typedef struct _GstIndexTestCase -{ - GstIndexLookupMethod method; - GstFormat src_format; - gint64 src_value; - GstFormat dest_format; - gint64 expecting; -} -GstIndexTestCase; - -const static GstIndexTestCase cases[] = { - {GST_INDEX_LOOKUP_EXACT, GST_FORMAT_BYTES, 3, GST_FORMAT_TIME, 3000}, - {GST_INDEX_LOOKUP_EXACT, GST_FORMAT_TIME, 5000, GST_FORMAT_BYTES, 5}, - {GST_INDEX_LOOKUP_EXACT, GST_FORMAT_TIME, 5010, GST_FORMAT_BYTES, -1}, - {GST_INDEX_LOOKUP_BEFORE, GST_FORMAT_TIME, 5010, GST_FORMAT_BYTES, 5}, - {GST_INDEX_LOOKUP_AFTER, GST_FORMAT_TIME, 5010, GST_FORMAT_BYTES, 6}, - {GST_INDEX_LOOKUP_BEFORE, GST_FORMAT_TIME, 0, GST_FORMAT_BYTES, 0}, - {GST_INDEX_LOOKUP_AFTER, GST_FORMAT_TIME, G_MAXINT64, GST_FORMAT_BYTES, -1}, - {GST_INDEX_LOOKUP_AFTER, GST_FORMAT_TIME, 0, GST_FORMAT_BYTES, 0}, - {GST_INDEX_LOOKUP_BEFORE, GST_FORMAT_TIME, -1, GST_FORMAT_BYTES, -1}, - {GST_INDEX_LOOKUP_BEFORE, GST_FORMAT_TIME, G_MAXINT64, GST_FORMAT_BYTES, - 99999}, - {GST_INDEX_LOOKUP_AFTER, GST_FORMAT_TIME, G_MAXINT64, GST_FORMAT_BYTES, -1}, -}; - -gint -main (gint argc, gchar * argv[]) -{ - GstIndex *index; - GstElement *element; - gint i, id; - - gst_init (&argc, &argv); - - if (argc != 2) { - g_print ("usage: cache1 (memindex | fileindex)\n"); - exit (0); - } - - index = gst_index_factory_make (argv[1]); - g_assert (index != NULL); - - element = gst_element_factory_make ("identity", "element"); - g_assert (element != NULL); - - gst_index_get_writer_id (index, GST_OBJECT (element), &id); - - g_print ("Building index...\n"); - - for (i = 0; i < 100000; i++) { - gst_index_add_association (index, 0, 0, GST_FORMAT_BYTES, (gint64) i, - GST_FORMAT_TIME, (gint64) (i * 1000), 0); - } - - g_print ("Testing index...\n"); - - for (i = 0; i < (sizeof (cases) / sizeof (GstIndexTestCase)); i++) { - lookup (index, cases[i].method, cases[i].src_format, cases[i].src_value, - cases[i].dest_format, cases[i].expecting); - } - - return 0; -} diff --git a/tests/old/testsuite/indexers/indexdump.c b/tests/old/testsuite/indexers/indexdump.c deleted file mode 100644 index a8c48969b5..0000000000 --- a/tests/old/testsuite/indexers/indexdump.c +++ /dev/null @@ -1,81 +0,0 @@ -/* GStreamer - * Copyright (C) 2003 Erik Walthinsen <omega@cse.ogi.edu> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include <gst/gst.h> - -static void -my_resolver (GstIndex * index, GstObject * _ign, gchar ** writer_string, - gpointer user_data) -{ - *writer_string = user_data; -} - -gint -main (gint argc, gchar * argv[]) -{ - GstIndex *index; - GstObject *identity; - gint id; - gint64 cur; - - gst_init (&argc, &argv); - - if (argc != 3) { - g_print ("usage: dumpfileindex /path/to/fileindex writer_id\n"); - exit (0); - } - - index = gst_index_factory_make ("fileindex"); - g_assert (index != NULL); - - g_object_set (index, "location", argv[1], NULL); - gst_index_set_resolver (index, (GstIndexResolver) my_resolver, argv[2]); - - identity = (GstObject *) gst_element_factory_make ("identity", "element"); - g_assert (identity); - gst_index_get_writer_id (index, identity, &id); - - cur = 0; - while (1) { - gint fx; - GstIndexEntry *entry = - gst_index_get_assoc_entry (index, id, GST_INDEX_LOOKUP_AFTER, 0, - GST_FORMAT_TIME, cur); - - if (!entry) - break; - - g_print ("%x", GST_INDEX_ASSOC_FLAGS (entry)); - for (fx = 0; fx < GST_INDEX_NASSOCS (entry); fx++) { - GstFormat fmt = GST_INDEX_ASSOC_FORMAT (entry, fx); - const GstFormatDefinition *def = gst_format_get_details (fmt); - - if (fmt == GST_FORMAT_TIME) { - cur = GST_INDEX_ASSOC_VALUE (entry, fx) + 1; - g_print (" time %.4f", - GST_INDEX_ASSOC_VALUE (entry, fx) / (double) GST_SECOND); - } else - g_print (" %s %" G_GINT64_FORMAT, def->nick, - GST_INDEX_ASSOC_VALUE (entry, fx)); - } - g_print ("\n"); - } - - return 0; -} diff --git a/tests/old/testsuite/negotiation/.gitignore b/tests/old/testsuite/negotiation/.gitignore deleted file mode 100644 index 79725113d2..0000000000 --- a/tests/old/testsuite/negotiation/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -pad_link - diff --git a/tests/old/testsuite/negotiation/Makefile.am b/tests/old/testsuite/negotiation/Makefile.am deleted file mode 100644 index 15347325fd..0000000000 --- a/tests/old/testsuite/negotiation/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -include ../Rules - -tests_pass = pad_link -tests_fail = -tests_ignore = diff --git a/tests/old/testsuite/negotiation/pad_link.c b/tests/old/testsuite/negotiation/pad_link.c deleted file mode 100644 index 553686fbd9..0000000000 --- a/tests/old/testsuite/negotiation/pad_link.c +++ /dev/null @@ -1,35 +0,0 @@ -#include <gst/gst.h> - -/* this test checks that gst_pad_link takes into account all available - * information when trying to link two pads. - * Because identity proxies caps, the caps in the first and second link - * must be compatible for this pipeline to work. - * Since they are not, the second linkig attempt should fail. - */ - -gint -main (int argc, gchar ** argv) -{ - GstElement *src, *identity, *sink; - GstCaps *one, *two; - - gst_init (&argc, &argv); - - /* create incompatible caps */ - src = gst_element_factory_make ("fakesrc", NULL); - g_assert (src); - identity = gst_element_factory_make ("identity", NULL); - g_assert (identity); - sink = gst_element_factory_make ("fakesink", NULL); - g_assert (sink); - - one = gst_caps_from_string ("some/mime"); - two = gst_caps_from_string ("other/mime"); - - g_assert (GST_PAD_LINK_SUCCESSFUL (gst_pad_link_filtered (gst_element_get_pad - (src, "src"), gst_element_get_pad (identity, "sink"), one))); - g_assert (!GST_PAD_LINK_SUCCESSFUL (gst_pad_link_filtered (gst_element_get_pad - (identity, "src"), gst_element_get_pad (sink, "sink"), two))); - - return 0; -} diff --git a/tests/old/testsuite/pad/.gitignore b/tests/old/testsuite/pad/.gitignore deleted file mode 100644 index 0e9ea0228e..0000000000 --- a/tests/old/testsuite/pad/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -chainnopull -getnopush -link diff --git a/tests/old/testsuite/pad/Makefile.am b/tests/old/testsuite/pad/Makefile.am deleted file mode 100644 index cb6e84155d..0000000000 --- a/tests/old/testsuite/pad/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -include ../Rules - -tests_pass = link -tests_fail = chainnopull getnopush -tests_ignore = diff --git a/tests/old/testsuite/pad/chainnopull.c b/tests/old/testsuite/pad/chainnopull.c deleted file mode 100644 index ed83dfc044..0000000000 --- a/tests/old/testsuite/pad/chainnopull.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * this tests that chain-based pads don't pull. - */ - -#include <gst/gst.h> - -typedef struct _GstTestSink -{ - GstElement parent; - GstPad *sinkpad; -} GstTestSink; - -typedef GstElementClass GstTestSinkClass; - -static void -gst_test_sink_class_init (GstTestSinkClass * klass) -{ -} - -static void -gst_test_sink_base_init (gpointer klass) -{ -} - -static void -gst_test_sink_chain (GstPad * pad, GstData * data) -{ - data = gst_pad_pull (pad); -} - -static void -gst_test_sink_init (GstTestSink * sink) -{ - sink->sinkpad = gst_pad_new ("sink", GST_PAD_SINK); - gst_pad_set_chain_function (sink->sinkpad, gst_test_sink_chain); - gst_element_add_pad (GST_ELEMENT (sink), sink->sinkpad); -} - -GST_BOILERPLATE (GstTestSink, gst_test_sink, GstElement, GST_TYPE_ELEMENT); - -int -main (int argc, char *argv[]) -{ - GstElement *pipeline, *fakesrc, *testsink; - gint n; - - gst_init (&argc, &argv); - - pipeline = gst_pipeline_new ("p"); - fakesrc = gst_element_factory_make ("fakesrc", "src"); - testsink = g_object_new (gst_test_sink_get_type (), NULL); - gst_object_set_name (GST_OBJECT (testsink), "sink"); - gst_bin_add_many (GST_BIN (pipeline), fakesrc, testsink, NULL); - gst_element_link (fakesrc, testsink); - gst_element_set_state (pipeline, GST_STATE_PLAYING); - - for (n = 0; n < 100; n++) { - if (!gst_bin_iterate (GST_BIN (pipeline))) - break; - } - - gst_element_set_state (pipeline, GST_STATE_NULL); - gst_object_unref (GST_OBJECT (pipeline)); - - return 0; -} diff --git a/tests/old/testsuite/pad/getnopush.c b/tests/old/testsuite/pad/getnopush.c deleted file mode 100644 index 7041c90983..0000000000 --- a/tests/old/testsuite/pad/getnopush.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * this tests that get-based pads don't push. - */ - -#include <gst/gst.h> - -typedef struct _GstTestSrc -{ - GstElement parent; - GstPad *srcpad; -} GstTestSrc; - -typedef GstElementClass GstTestSrcClass; - -static void -gst_test_src_class_init (GstTestSrcClass * klass) -{ -} -static void -gst_test_src_base_init (gpointer klass) -{ -} - -static GstData * -gst_test_src_get (GstPad * pad) -{ - GstEvent *event; - - event = gst_event_new (GST_EVENT_INTERRUPT); - gst_event_ref (event); - gst_pad_push (pad, GST_DATA (event)); - - return GST_DATA (event); -} - -static void -gst_test_src_init (GstTestSrc * src) -{ - src->srcpad = gst_pad_new ("src", GST_PAD_SRC); - gst_pad_set_get_function (src->srcpad, gst_test_src_get); - gst_element_add_pad (GST_ELEMENT (src), src->srcpad); -} - -GST_BOILERPLATE (GstTestSrc, gst_test_src, GstElement, GST_TYPE_ELEMENT); - -int -main (int argc, char *argv[]) -{ - GstElement *pipeline, *testsrc, *fakesink; - gint n; - - gst_init (&argc, &argv); - - pipeline = gst_pipeline_new ("p"); - testsrc = g_object_new (gst_test_src_get_type (), NULL); - gst_object_set_name (GST_OBJECT (testsrc), "src"); - fakesink = gst_element_factory_make ("fakesink", "sink"); - gst_bin_add_many (GST_BIN (pipeline), testsrc, fakesink, NULL); - gst_element_link (testsrc, fakesink); - gst_element_set_state (pipeline, GST_STATE_PLAYING); - - for (n = 0; n < 100; n++) { - if (!gst_bin_iterate (GST_BIN (pipeline))) - break; - } - - gst_element_set_state (pipeline, GST_STATE_NULL); - gst_object_unref (GST_OBJECT (pipeline)); - - return 0; -} diff --git a/tests/old/testsuite/pad/link.c b/tests/old/testsuite/pad/link.c deleted file mode 100644 index 5d22c381f6..0000000000 --- a/tests/old/testsuite/pad/link.c +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Test that: - * - get-based sources can return data, loop-based sources can push. - * - chain-based filters receive/push, loop-based filters can pull/push. - * - chain-based sinks receive, loop-based sinks pull. - */ - -#include <gst/gst.h> - -/* - * Scary type code. - */ - -typedef struct _GstTestElement -{ - GstElement parent; - GstPad *srcpad, *sinkpad; -} GstTestSrc, GstTestFilter, GstTestSink, GstTestElement; - -typedef GstElementClass GstTestSrcClass, GstTestFilterClass, GstTestSinkClass, - GstTestElementClass; - -#define gst_test_src_class_init gst_test_element_class_init -#define gst_test_filter_class_init gst_test_element_class_init -#define gst_test_sink_class_init gst_test_element_class_init - -#define gst_test_src_base_init gst_test_element_base_init -#define gst_test_filter_base_init gst_test_element_base_init -#define gst_test_sink_base_init gst_test_element_base_init - -static void -gst_test_element_class_init (GstTestElementClass * klass) -{ -} -static void -gst_test_element_base_init (gpointer klass) -{ -} - -/* - * Actual element code. - */ - -gboolean loop = FALSE; - -static GstData * -gst_test_src_get (GstPad * pad) -{ - return GST_DATA (gst_event_new (GST_EVENT_INTERRUPT)); -} - -static void -gst_test_src_loop (GstElement * element) -{ - GstTestSrc *src = (GstTestElement *) element; - - gst_pad_push (src->srcpad, gst_test_src_get (src->srcpad)); -} - -static void -gst_test_src_init (GstTestElement * src) -{ - src->srcpad = gst_pad_new ("src", GST_PAD_SRC); - if (loop) { - gst_element_set_loop_function (GST_ELEMENT (src), gst_test_src_loop); - } else { - gst_pad_set_get_function (src->srcpad, gst_test_src_get); - } - gst_element_add_pad (GST_ELEMENT (src), src->srcpad); - - GST_FLAG_SET (src, GST_ELEMENT_EVENT_AWARE); -} - -static void -gst_test_filter_chain (GstPad * pad, GstData * data) -{ - GstTestFilter *filter = (GstTestElement *) gst_pad_get_parent (pad); - - gst_pad_push (filter->srcpad, data); -} - -static void -gst_test_filter_loop (GstElement * element) -{ - GstTestFilter *filter = (GstTestElement *) element; - - gst_test_filter_chain (filter->sinkpad, gst_pad_pull (filter->sinkpad)); -} - -static void -gst_test_filter_init (GstTestElement * filter) -{ - filter->sinkpad = gst_pad_new ("sink", GST_PAD_SINK); - if (loop) { - gst_element_set_loop_function (GST_ELEMENT (filter), gst_test_filter_loop); - } else { - gst_pad_set_chain_function (filter->sinkpad, gst_test_filter_chain); - } - gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad); - - filter->srcpad = gst_pad_new ("src", GST_PAD_SRC); - gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad); - - GST_FLAG_SET (filter, GST_ELEMENT_EVENT_AWARE); -} - -static void -gst_test_sink_chain (GstPad * pad, GstData * data) -{ - gst_data_unref (data); -} - -static void -gst_test_sink_loop (GstElement * element) -{ - GstTestSink *sink = (GstTestElement *) element; - - gst_test_sink_chain (sink->sinkpad, gst_pad_pull (sink->sinkpad)); -} - -static void -gst_test_sink_init (GstTestElement * sink) -{ - sink->sinkpad = gst_pad_new ("sink", GST_PAD_SINK); - if (loop) { - gst_element_set_loop_function (GST_ELEMENT (sink), gst_test_sink_loop); - } else { - gst_pad_set_chain_function (sink->sinkpad, gst_test_sink_chain); - } - gst_element_add_pad (GST_ELEMENT (sink), sink->sinkpad); - - GST_FLAG_SET (sink, GST_ELEMENT_EVENT_AWARE); -} - -#define parent_class src_parent_class -GST_BOILERPLATE (GstTestSrc, gst_test_src, GstElement, GST_TYPE_ELEMENT); -#undef parent_class -#define parent_class filter_parent_class -GST_BOILERPLATE (GstTestFilter, gst_test_filter, GstElement, GST_TYPE_ELEMENT); -#undef parent_class -#define parent_class sink_parent_class -GST_BOILERPLATE (GstTestSink, gst_test_sink, GstElement, GST_TYPE_ELEMENT); -#undef parent_class - -/* - * Actual test. - */ - -static void -cb_error (GstElement * element) -{ - g_assert_not_reached (); -} - -int -main (int argc, char *argv[]) -{ - GstElement *pipeline, *src, *filter, *sink; - gint n, r; - gboolean res; - - gst_init (&argc, &argv); - - for (r = 0; r < 2; r++) { - pipeline = gst_pipeline_new ("p"); - g_signal_connect (pipeline, "error", G_CALLBACK (cb_error), NULL); - src = g_object_new (gst_test_src_get_type (), NULL); - gst_object_set_name (GST_OBJECT (src), "src"); - filter = g_object_new (gst_test_filter_get_type (), NULL); - gst_object_set_name (GST_OBJECT (filter), "filter"); - sink = g_object_new (gst_test_sink_get_type (), NULL); - gst_object_set_name (GST_OBJECT (sink), "sink"); - gst_bin_add_many (GST_BIN (pipeline), src, filter, sink, NULL); - res = gst_element_link (src, filter); - g_assert (res); - res = gst_element_link (filter, sink); - g_assert (res); - gst_element_set_state (pipeline, GST_STATE_PLAYING); - - for (n = 0; n < 100; n++) { - if (!gst_bin_iterate (GST_BIN (pipeline))) - g_assert_not_reached (); - } - - gst_element_set_state (pipeline, GST_STATE_NULL); - gst_object_unref (GST_OBJECT (pipeline)); - - /* switch element types */ - g_print ("Loop=%s done\n", loop ? "true" : "false"); - loop = !loop; - } - - return 0; -} diff --git a/tests/old/testsuite/parse/.gitignore b/tests/old/testsuite/parse/.gitignore deleted file mode 100644 index 5dbe8a305a..0000000000 --- a/tests/old/testsuite/parse/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -Makefile -Makefile.in -*.o -*.lo -*.la -.deps -.libs -parse1 -parse2 diff --git a/tests/old/testsuite/parse/Makefile.am b/tests/old/testsuite/parse/Makefile.am deleted file mode 100644 index 0b71559a49..0000000000 --- a/tests/old/testsuite/parse/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -include ../Rules - -tests_pass = parse1 parse2 -tests_fail = -tests_ignore = diff --git a/tests/old/testsuite/parse/parse1.c b/tests/old/testsuite/parse/parse1.c deleted file mode 100644 index be4764a944..0000000000 --- a/tests/old/testsuite/parse/parse1.c +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de> - * - * parse1.c: Test various parsing stuff - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <gst/gst.h> - -#include <string.h> -#include <unistd.h> - -/* variables used by the TEST_* macros */ -static gint test = 0; -static guint iterations; -static GstElement *cur = NULL; -static GError *error = NULL; - -/* variables needed for checking */ -static gint i; -static gboolean b; -static gchar *s; - -#define TEST_CHECK_FAIL(condition) G_STMT_START{ \ - if (condition) { \ - g_print ("TEST %2d line %3d OK\n", test, __LINE__); \ - } else { \ - g_print ("TEST %2d line %3d FAILED : %s\n", test, __LINE__, \ - #condition); \ - return -test; \ - } \ -}G_STMT_END - -#define TEST_START(pipeline) G_STMT_START{ \ - g_print ("TEST %2d line %3d START : %s\n", ++test, __LINE__, \ - pipeline); \ - cur = gst_parse_launch (pipeline, &error); \ - if (error == NULL) { \ - g_print ("TEST %2d line %3d CREATED\n", test, __LINE__); \ - } else { \ - g_print ("TEST %2d line %3d FAILED : %s\n", test, __LINE__, \ - error->message); \ - g_error_free (error); \ - return -test; \ - } \ -}G_STMT_END - -#define TEST_OK G_STMT_START{ \ - gst_object_unref (GST_OBJECT (cur)); \ - cur = NULL; \ - g_print ("TEST %2d line %3d COMPLETE\n", test, __LINE__); \ -}G_STMT_END - -#define TEST_RUN G_STMT_START{ \ - alarm(10); \ - g_print ("TEST %2d line %3d RUN\n", test, __LINE__); \ - if (gst_element_set_state (cur, GST_STATE_PLAYING) \ - == GST_STATE_FAILURE) { \ - g_print ("TEST %2d line %3d FAILED : " \ - "pipeline could not be set to PLAYING\n", test, __LINE__); \ - return -test; \ - } \ - iterations = 0; \ - while (gst_bin_iterate (GST_BIN (cur))) iterations++; \ - if (gst_element_set_state (cur, GST_STATE_NULL) \ - == GST_STATE_FAILURE) { \ - g_print ("TEST %2d line %3d FAILED : " \ - "pipeline could not be reset to state NULL\n", test, __LINE__); \ - return -test; \ - } \ - g_print ("TEST %2d line %3d STOPPED : %u iterations\n", \ - test, __LINE__, iterations); \ - alarm(0); \ -}G_STMT_END - -#define PIPELINE1 "fakesrc" -#define PIPELINE2 "fakesrc name=donald num-buffers= 27 silent =TruE sizetype = 3 eos = falSe data= Subbuffer\\ data" -#define PIPELINE3 "fakesrc identity fakesink" -#define PIPELINE4 "fakesrc num-buffers=4 .src ! identity !.sink identity .src ! .sink fakesink" -#define PIPELINE5 "fakesrc num-buffers=4 name=src identity name=id1 identity name = id2 fakesink name =sink src. ! id1. id1.! id2.sink id2.src!sink.sink" -#define PIPELINE6 "pipeline.(name=\"john\" fakesrc num-buffers=4 ( thread. ( ! queue ! identity !{ queue ! fakesink }) ))" -#define PIPELINE7 "fakesrc num-buffers=4 ! tee name=tee .src%d! fakesink tee.src%d ! fakesink fakesink name =\"foo\" tee.src%d ! foo." -/* aggregator is borked -#define PIPELINE8 "fakesrc num-buffers=4 ! tee name=tee1 .src0,src1 ! .sink0, sink1 aggregator ! fakesink" -*/ -#define PIPELINE8 "fakesrc num-buffers=4 ! fakesink" -#define PIPELINE9 "fakesrc num-buffers=4 ! test. fakesink name=test" -#define PIPELINE10 "( fakesrc num-buffers=\"4\" ! ) identity ! fakesink" -#define PIPELINE11 "fakesink name = sink identity name=id ( fakesrc num-buffers=\"4\" ! id. ) id. ! sink." -#define PIPELINE12 "fakesrc num-buffers=4 name=a:b a:b. ! fakesink" - -gint -main (gint argc, gchar * argv[]) -{ - gst_init (&argc, &argv); - - /** - * checks: - * - specifying an element works :) - * - if only 1 element is requested, no bin is returned, but the element - */ - TEST_START (PIPELINE1); - TEST_CHECK_FAIL (G_OBJECT_TYPE (cur) == g_type_from_name ("GstFakeSrc")); - TEST_OK; - - /** - * checks: - * - properties works - * - string, int, boolean and enums can be properly set - * (note: eos should be false) - * - first test of escaping strings - */ - TEST_START (PIPELINE2); - g_object_get (G_OBJECT (cur), "name", &s, "num-buffers", &i, "silent", &b, - NULL); - TEST_CHECK_FAIL (strcmp (s, "donald") == 0); - TEST_CHECK_FAIL (i == 27); - TEST_CHECK_FAIL (b == TRUE); - g_object_get (G_OBJECT (cur), "eos", &b, "sizetype", &i, NULL); - TEST_CHECK_FAIL (i == 3); - TEST_CHECK_FAIL (b == FALSE); - g_object_get (G_OBJECT (cur), "data", &i, NULL); - TEST_CHECK_FAIL (i == 2); - TEST_OK; - - /** - * checks: - * - specifying multiple elements without links works - * - if multiple toplevel elements exist, a pipeline is returned - */ - TEST_START (PIPELINE3); - TEST_CHECK_FAIL (GST_BIN (cur)->numchildren == 3); /* a bit hacky here */ - TEST_CHECK_FAIL (GST_IS_PIPELINE (cur)); - TEST_OK; - - /** - * checks: - * - test default link "!" - * - test if specifying pads on links works - */ - TEST_START (PIPELINE4); - TEST_RUN; - TEST_OK; - - /** - * checks: - * - test if appending the links works, too - * - check if the pipeline constructed works the same as the one before (how?) - */ - TEST_START (PIPELINE5); - TEST_RUN; - TEST_OK; - - /** - * checks: - * - test various types of bins - * - test if linking across bins works - * - test if escaping strings works - */ - TEST_START (PIPELINE6); - TEST_CHECK_FAIL (GST_IS_PIPELINE (cur)); - g_object_get (G_OBJECT (cur), "name", &s, NULL); - TEST_CHECK_FAIL (strcmp (s, "john") == 0); - TEST_RUN; - TEST_OK; - - /** - * checks: - * - test request pads - */ - TEST_START (PIPELINE7); - TEST_RUN; - TEST_OK; - - /** - * checks: - * - multiple pads on 1 link - */ - TEST_START (PIPELINE8); - TEST_RUN; - TEST_OK; - - /** - * checks: - * - failed in grammar.y cvs version 1.17 - */ - TEST_START (PIPELINE9); - TEST_RUN; - TEST_OK; - - /** - * checks: - * - failed in grammar.y cvs version 1.17 - */ - TEST_START (PIPELINE10); - TEST_RUN; - TEST_OK; - - /** - * checks: - * - failed in grammar.y cvs version 1.18 - */ - TEST_START (PIPELINE11); - TEST_RUN; - TEST_OK; - - /** - * checks: - * - fails because a:b. is not a valid element reference in parse.l cvs rev 1.29 - */ - TEST_START (PIPELINE12); - TEST_RUN; - TEST_OK; - - return 0; -} diff --git a/tests/old/testsuite/parse/parse2.c b/tests/old/testsuite/parse/parse2.c deleted file mode 100644 index 3b0a321620..0000000000 --- a/tests/old/testsuite/parse/parse2.c +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de> - * - * parse1.c: Test common pipelines (need various plugins) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <gst/gst.h> - -#include <string.h> - -/* variables used by the TEST_* macros */ -static gint test = 0; -static guint iterations; -static GstElement *cur = NULL; -static GError *error = NULL; -static char *audio_file = NULL; -static char *video_file = NULL; - -/* variables needed for checking */ - -#define TEST_CHECK_FAIL(condition) G_STMT_START{ \ - if (condition) { \ - g_print ("TEST %2d line %3d OK\n", test, __LINE__); \ - } else { \ - g_print ("TEST %2d line %3d FAILED : %s\n", test, __LINE__, #condition); \ - return -test; \ - } \ -}G_STMT_END -#ifdef G_HAVE_ISO_VARARGS -#define TEST_START(...) G_STMT_START{ \ - gchar *pipeline = g_strdup_printf (__VA_ARGS__); \ - g_print ("TEST %2d line %3d START : %s\n", ++test, __LINE__, pipeline); \ - cur = gst_parse_launch (pipeline, &error); \ - if (error == NULL) { \ - g_print ("TEST %2d line %3d CREATED\n", test, __LINE__); \ - } else { \ - g_print ("TEST %2d line %3d FAILED : %s\n", test, __LINE__, error->message); \ - g_error_free (error); \ - return -test; \ - } \ - g_free (pipeline); \ -}G_STMT_END -#elif defined(G_HAVE_GNUC_VARARGS) -#define TEST_START(pipe...) G_STMT_START{ \ - gchar *pipeline = g_strdup_printf ( ## pipe ); \ - g_print ("TEST %2d line %3d START : %s\n", ++test, __LINE__, pipeline); \ - cur = gst_parse_launch (pipeline, &error); \ - if (error == NULL) { \ - g_print ("TEST %2d line %3d CREATED\n", test, __LINE__); \ - } else { \ - g_print ("TEST %2d line %3d FAILED : %s\n", test, __LINE__, error->message); \ - g_error_free (error); \ - return -test; \ - } \ - g_free (pipeline); \ -}G_STMT_END -#else -#error Please fix this macro here -#define TEST_START(pipe...) G_STMT_START{ \ - gchar *pipeline = g_strdup_printf (__VA_ARGS__); \ - g_print ("TEST %2d line %3d START : %s\n", ++test, __LINE__, pipeline); \ - cur = gst_parse_launch (pipeline, &error); \ - if (error == NULL) { \ - g_print ("TEST %2d line %3d CREATED\n", test, __LINE__); \ - } else { \ - g_print ("TEST %2d line %3d FAILED : %s\n", test, __LINE__, error->message); \ - g_error_free (error); \ - return -test; \ - } \ - g_free (pipeline); \ -}G_STMT_END -#endif -#define TEST_OK G_STMT_START{ \ - gst_object_unref (GST_OBJECT (cur)); \ - cur = NULL; \ - g_print ("TEST %2d line %3d COMPLETE\n", test, __LINE__); \ -}G_STMT_END -#define TEST_RUN(iters) G_STMT_START{ \ - gint it = iters; \ - g_print ("TEST %2d line %3d RUN\n", test, __LINE__); \ - if (gst_element_set_state (cur, GST_STATE_PLAYING) == GST_STATE_FAILURE) { \ - g_print ("TEST %2d line %3d FAILED : pipeline could not be set to state PLAYING\n", test, __LINE__); \ - return -test; \ - } \ - iterations = 0; \ - while (gst_bin_iterate (GST_BIN (cur)) && it != 0) { \ - iterations++; \ - it--; \ - } \ - if (gst_element_set_state (cur, GST_STATE_NULL) == GST_STATE_FAILURE) { \ - g_print ("TEST %2d line %3d FAILED : pipeline could not be reset to state NULL\n", test, __LINE__); \ - return -test; \ - } \ - g_print ("TEST %2d line %3d STOPPED : %u iterations\n", test, __LINE__, iterations); \ -}G_STMT_END -#define TEST_FINISH G_STMT_START{ \ - g_print("\n"); \ - g_print("To run this test there are things required that you do not have. (see above)\n"); \ - g_print("Please correct the above mentioned problem if you want to run this test.\n"); \ - g_print("Currently the following tests will be ignored.\n"); \ - g_print("\n"); \ - exit (0); \ -}G_STMT_END -#define TEST_REQUIRE(condition, error) G_STMT_START{ \ - if (condition) { \ - g_print ("REQUIRE line %3d OK\n", __LINE__); \ - } else { \ - g_print ("REQUIRE line %3d EXIT : %s\n", __LINE__, (error)); \ - TEST_FINISH; \ - } \ -}G_STMT_END -#define TEST_REQUIRE_ELEMENT(element_name) G_STMT_START{ \ - GstElement *element = gst_element_factory_make ((element_name), NULL); \ - if (element) { \ - g_print ("REQUIRE line %3d OK\n", __LINE__); \ - gst_object_unref (GST_OBJECT (element)); \ - } else { \ - g_print ("REQUIRE line %3d EXIT : No element of type \"%s\" available. Exiting.\n", __LINE__, (element_name)); \ - TEST_FINISH; \ - } \ -}G_STMT_END - -#define PIPELINE1 "filesrc blocksize =8192 location=%s ! mad ! osssink" -#define PIPELINE2 "filesrc location=%s ! mpegdemux ! mpeg2dec ! xvimagesink" -#define PIPELINE3 "filesrc location=%s ! mpegdemux name = demux ! mpeg2dec ! { queue ! xvimagesink } demux.audio_00 ! mad ! osssink" -#define PIPELINE4 "pipeline. ( { filesrc location=%s ! spider name=spider ! { queue ! volume ! ( tee name=tee ! { queue ! ( goom ) ! colorspace ! ( xvimagesink ) } tee. ! { queue ! ( osssink ) } ) } spider. ! { queue ! colorspace ( xvimagesink ) } } )" -#define PIPELINE5 "pipeline. ( { filesrc location=%s ! spider name=spider ! ( tee name=tee ! { queue ! spider ! ( goom ) ! colorspace ! ( xvimagesink ) } tee. ! { queue ! volume ! ( osssink ) } ) spider. ! { queue! colorspace ( xvimagesink ) } } )" - -/* FIXME: Should this run, too? -#define PIPELINE3 "filesrc location=%s ! mpegdemux name = demux ! mpeg2dec ! { queue ! xvimagesink } demux.audio_%%02d ! mad ! osssink" -*/ - -gint -main (gint argc, gchar * argv[]) -{ - gst_init (&argc, &argv); - - goto here; -here: - - /** - * checks: - * - default playback pipeline - * - unsigned parameters - */ - audio_file = g_build_filename (g_get_home_dir (), "music.mp3", NULL); - TEST_REQUIRE (g_file_test (audio_file, G_FILE_TEST_EXISTS), - "The following tests requires a valid mp3 file music.mp3 in your home directory."); - TEST_REQUIRE_ELEMENT ("mad"); - TEST_REQUIRE_ELEMENT ("osssink"); - TEST_START (PIPELINE1, audio_file); - TEST_RUN (10); - TEST_OK; - - /** - * checks: - * - default video playback pipeline (without audio) - * - SOMETIMES pads - */ - video_file = g_build_filename (g_get_home_dir (), "video.mpeg", NULL); - TEST_REQUIRE (g_file_test (video_file, G_FILE_TEST_EXISTS), - "The following tests requires a valid mpeg file video.mpeg in your home directory."); - TEST_REQUIRE_ELEMENT ("mpegdemux"); - TEST_REQUIRE_ELEMENT ("mpeg2dec"); - TEST_REQUIRE_ELEMENT ("xvimagesink"); - TEST_START (PIPELINE2, video_file); - TEST_RUN (50); - TEST_OK; - - /** - * checks: - * - default video playback pipeline (with audio) - * - more SOMETIMES pads - */ - TEST_START (PIPELINE3, video_file); - TEST_RUN (200); - TEST_OK; - - /** - * checks: - * - default new gst-player pipeline - */ - TEST_START (PIPELINE4, video_file); - TEST_RUN (500); - TEST_OK; - - /** - * checks: - * - default old gst-player pipeline - */ - TEST_START (PIPELINE5, video_file); - TEST_RUN (500); - TEST_OK; - - g_free (audio_file); - g_free (video_file); - return 0; -} diff --git a/tests/old/testsuite/plugin/.gitignore b/tests/old/testsuite/plugin/.gitignore deleted file mode 100644 index bd44ca109e..0000000000 --- a/tests/old/testsuite/plugin/.gitignore +++ /dev/null @@ -1,16 +0,0 @@ -Makefile -Makefile.in -*.o -*.lo -*.la -.deps -.libs -dynamic -linked -loading -registry -static -static2 -*.bb -*.bbg -*.da diff --git a/tests/old/testsuite/plugin/Makefile.am b/tests/old/testsuite/plugin/Makefile.am deleted file mode 100644 index 803c3841c8..0000000000 --- a/tests/old/testsuite/plugin/Makefile.am +++ /dev/null @@ -1,16 +0,0 @@ -include ../Rules - -plugin_LTLIBRARIES = libtestplugin.la libtestplugin2.la - -tests_pass = dynamic linked loading registry static static2 -tests_fail = -tests_ignore = - -libtestplugin_la_SOURCES = testplugin.c -libtestplugin_la_CFLAGS = $(GST_OBJ_CFLAGS) -libtestplugin_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) -libtestplugin2_la_SOURCES = testplugin2.c -libtestplugin2_la_CFLAGS = $(GST_OBJ_CFLAGS) -libtestplugin2_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) - -linked_LIBS = libtestplugin.la libtestplugin2.la diff --git a/tests/old/testsuite/plugin/README b/tests/old/testsuite/plugin/README deleted file mode 100644 index f8898c59d0..0000000000 --- a/tests/old/testsuite/plugin/README +++ /dev/null @@ -1,59 +0,0 @@ -The following plugin modes are supported: - -1) registry based ------------------ - -All known plugins are listed in the registry file. - - gst_plugin_find ("pluginname"); - -Works right after gst_init (), along with the elements in it. -dynamic loading of the plugin is performed when a feature inside -it is requested. - -example: registry.c. (You might want to run gstreamer-register with -the --gst-plugin-path=. to added the test dir to the plugin path so -that the testplugins can be found) - - -2) non registry based, dynmic loading -------------------------------------- - -Plugins are know after a gst_plugin_load ("pluginname"). This -function will scan de plugin paths, so you might want to perform -a gst_plugin_add_path ("path"). - -After the gst_plugin_load(), the features are available without any -further actions. - -example: dynamic.c - - -3) non registry based, shared linking -------------------------------------- - -You can add the plugin .so (or equivalent) file to the LDFLAGS at -compile time. The plugin will be known after the gst_init() without -any further actions. - -example: linked.c - - -4) non registry based, static linking -------------------------------------- - -Plugin compiled with the GST_PLUGIN_STATIC defined can be statically -linked to the executable. The plugin is available after gst_init () -without any further actions. - -example: static.c (plugins are statically linked from another file) - static2.c (plugins are included in the main file) - - -Any combination of the above is possible too, for example, you can use -a registry, have some plugins load dynamically and have another few -linked in as a shared lib. - -You cannot statically link multiple plugins that are compiled without the -GST_PLUGIN_STATIC symbol defined (this will cause multiple defined at link -time for obvious reasons) diff --git a/tests/old/testsuite/plugin/dynamic.c b/tests/old/testsuite/plugin/dynamic.c deleted file mode 100644 index 27b173aa41..0000000000 --- a/tests/old/testsuite/plugin/dynamic.c +++ /dev/null @@ -1,23 +0,0 @@ - -#include <gst/gst.h> - -int -main (int argc, char *argv[]) -{ - GstPlugin *plugin; - GError *error = NULL; - - gst_init (&argc, &argv); - - plugin = gst_plugin_load_file (".libs/libtestplugin.so", &error); - if (error) { - g_print ("ERROR loading plug-in: %s\n", error->message); - g_free (error); - return 1; - } - g_assert (plugin != NULL); - - g_print ("testplugin: %s\n", gst_plugin_get_name (plugin)); - - return 0; -} diff --git a/tests/old/testsuite/plugin/linked.c b/tests/old/testsuite/plugin/linked.c deleted file mode 100644 index 368d3415c5..0000000000 --- a/tests/old/testsuite/plugin/linked.c +++ /dev/null @@ -1,22 +0,0 @@ - -#include <gst/gst.h> - -int -main (int argc, char *argv[]) -{ - GstPlugin *plugin; - - gst_init (&argc, &argv); - - plugin = gst_registry_pool_find_plugin ("testplugin"); - g_assert (plugin != NULL); - - g_print ("testplugin: %p %s\n", plugin, gst_plugin_get_name (plugin)); - - plugin = gst_registry_pool_find_plugin ("testplugin2"); - g_assert (plugin != NULL); - - g_print ("testplugin2: %p %s\n", plugin, gst_plugin_get_name (plugin)); - - return 0; -} diff --git a/tests/old/testsuite/plugin/loading.c b/tests/old/testsuite/plugin/loading.c deleted file mode 100644 index 11d34a298d..0000000000 --- a/tests/old/testsuite/plugin/loading.c +++ /dev/null @@ -1,60 +0,0 @@ - -#include <gst/gst.h> - -int -main (int argc, char *argv[]) -{ - GstPlugin *plugin; - gboolean loaded = FALSE; - gint numplugins; - - gst_init (&argc, &argv); - - numplugins = g_list_length (gst_registry_pool_plugin_list ()); - g_print ("%d plugins loaded\n", numplugins); - g_mem_chunk_info (); - - plugin = gst_registry_pool_find_plugin ("testplugin"); - g_assert (plugin != NULL); - - g_print ("%d features in plugin\n", - g_list_length (gst_plugin_get_feature_list (plugin))); - - - g_print ("testplugin: %p loaded: %s\n", plugin, - (gst_plugin_is_loaded (plugin) ? "true" : "false")); - - loaded = gst_plugin_load (gst_plugin_get_name (plugin)); - g_assert (loaded == TRUE); - - numplugins = g_list_length (gst_registry_pool_plugin_list ()); - g_print ("%d plugins loaded\n", numplugins); - - g_mem_chunk_info (); - - plugin = gst_registry_pool_find_plugin ("testplugin"); - g_assert (plugin != NULL); - g_print ("testplugin: %p loaded: %s\n", plugin, - (gst_plugin_is_loaded (plugin) ? "true" : "false")); - - g_print ("%d features in plugin\n", - g_list_length (gst_plugin_get_feature_list (plugin))); - - loaded = gst_plugin_load (gst_plugin_get_name (plugin)); - g_assert (loaded == TRUE); - - numplugins = g_list_length (gst_registry_pool_plugin_list ()); - g_print ("%d plugins loaded\n", numplugins); - - g_print ("%d features in plugin\n", - g_list_length (gst_plugin_get_feature_list (plugin))); - - g_mem_chunk_info (); - - plugin = gst_registry_pool_find_plugin ("testplugin"); - g_assert (plugin != NULL); - g_print ("testplugin: %p loaded: %s\n", plugin, - (gst_plugin_is_loaded (plugin) ? "true" : "false")); - - return 0; -} diff --git a/tests/old/testsuite/plugin/registry.c b/tests/old/testsuite/plugin/registry.c deleted file mode 100644 index 85a76e2f8c..0000000000 --- a/tests/old/testsuite/plugin/registry.c +++ /dev/null @@ -1,17 +0,0 @@ - -#include <gst/gst.h> - -int -main (int argc, char *argv[]) -{ - GstPlugin *plugin; - - gst_init (&argc, &argv); - - plugin = gst_registry_pool_find_plugin ("testplugin"); - g_assert (plugin != NULL); - - g_print ("testplugin: %s\n", gst_plugin_get_name (plugin)); - - return 0; -} diff --git a/tests/old/testsuite/plugin/static.c b/tests/old/testsuite/plugin/static.c deleted file mode 100644 index 368d3415c5..0000000000 --- a/tests/old/testsuite/plugin/static.c +++ /dev/null @@ -1,22 +0,0 @@ - -#include <gst/gst.h> - -int -main (int argc, char *argv[]) -{ - GstPlugin *plugin; - - gst_init (&argc, &argv); - - plugin = gst_registry_pool_find_plugin ("testplugin"); - g_assert (plugin != NULL); - - g_print ("testplugin: %p %s\n", plugin, gst_plugin_get_name (plugin)); - - plugin = gst_registry_pool_find_plugin ("testplugin2"); - g_assert (plugin != NULL); - - g_print ("testplugin2: %p %s\n", plugin, gst_plugin_get_name (plugin)); - - return 0; -} diff --git a/tests/old/testsuite/plugin/static2.c b/tests/old/testsuite/plugin/static2.c deleted file mode 100644 index 1ab30d0f36..0000000000 --- a/tests/old/testsuite/plugin/static2.c +++ /dev/null @@ -1,49 +0,0 @@ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include <gst/gst.h> - -static gboolean -plugin_init (GstPlugin * plugin) -{ - return TRUE; -} - -GST_PLUGIN_DEFINE_STATIC (GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "testplugin", - "a plugin for testing", - plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN); - -static gboolean -plugin2_init (GstPlugin * plugin) -{ - return TRUE; -} - -GST_PLUGIN_DEFINE_STATIC (GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "testplugin2", - "a second plugin for testing", - plugin2_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN); - -int -main (int argc, char *argv[]) -{ - GstPlugin *plugin; - - gst_init (&argc, &argv); - - plugin = gst_registry_pool_find_plugin ("testplugin"); - g_assert (plugin != NULL); - - g_print ("testplugin: %p %s\n", plugin, gst_plugin_get_name (plugin)); - - plugin = gst_registry_pool_find_plugin ("testplugin2"); - g_assert (plugin != NULL); - - g_print ("testplugin2: %p %s\n", plugin, gst_plugin_get_name (plugin)); - - return 0; -} diff --git a/tests/old/testsuite/plugin/testplugin.c b/tests/old/testsuite/plugin/testplugin.c deleted file mode 100644 index d2ee604b96..0000000000 --- a/tests/old/testsuite/plugin/testplugin.c +++ /dev/null @@ -1,18 +0,0 @@ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include <gst/gst.h> - -static gboolean -plugin_init (GstPlugin * plugin) -{ - return TRUE; -} - -GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "testplugin", - "a plugin for testing", - plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN); diff --git a/tests/old/testsuite/plugin/testplugin2.c b/tests/old/testsuite/plugin/testplugin2.c deleted file mode 100644 index 47d2ad37d3..0000000000 --- a/tests/old/testsuite/plugin/testplugin2.c +++ /dev/null @@ -1,18 +0,0 @@ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include <gst/gst.h> - -static gboolean -plugin_init (GstPlugin * plugin) -{ - return TRUE; -} - -GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "testplugin2", - "another testplugin for testing", - plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN); diff --git a/tests/old/testsuite/plugin/testplugin2_s.c b/tests/old/testsuite/plugin/testplugin2_s.c deleted file mode 100644 index 00c47d8f8d..0000000000 --- a/tests/old/testsuite/plugin/testplugin2_s.c +++ /dev/null @@ -1,18 +0,0 @@ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include <gst/gst.h> - -static gboolean -plugin_init (GstPlugin * plugin) -{ - return TRUE; -} - -GST_PLUGIN_DEFINE_STATIC (GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "testplugin2", - "another testplugin for testing", - plugin_init, VERSION, GST_LICENSE, GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN); diff --git a/tests/old/testsuite/plugin/testplugin_s.c b/tests/old/testsuite/plugin/testplugin_s.c deleted file mode 100644 index b17605d5be..0000000000 --- a/tests/old/testsuite/plugin/testplugin_s.c +++ /dev/null @@ -1,18 +0,0 @@ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include <gst/gst.h> - -static gboolean -plugin_init (GstPlugin * plugin) -{ - return TRUE; -} - -GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "testplugin", - "a plugin for testing", - plugin_init, VERSION, GST_LICENSE, GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN); diff --git a/tests/old/testsuite/refcounting/.gitignore b/tests/old/testsuite/refcounting/.gitignore deleted file mode 100644 index 85d236abb2..0000000000 --- a/tests/old/testsuite/refcounting/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -Makefile -Makefile.in -*.o -*.lo -*.la -.deps -.libs - -bin -element -element_pad -pad -mainloop -sched diff --git a/tests/old/testsuite/refcounting/Makefile.am b/tests/old/testsuite/refcounting/Makefile.am deleted file mode 100644 index 0a0ed82441..0000000000 --- a/tests/old/testsuite/refcounting/Makefile.am +++ /dev/null @@ -1,14 +0,0 @@ -include ../Rules - -tests_pass = bin element mainloop pad element_pad -tests_fail = -tests_ignore = sched - -element_SOURCES = element.c mem.c -pad_SOURCES = pad.c mem.c -element_pad_SOURCES = element_pad.c mem.c -bin_SOURCES = bin.c mem.c - -EXTRA_DIST = thread.c object.c - -noinst_HEADERS = mem.h diff --git a/tests/old/testsuite/refcounting/bin.c b/tests/old/testsuite/refcounting/bin.c deleted file mode 100644 index 4d437b2efe..0000000000 --- a/tests/old/testsuite/refcounting/bin.c +++ /dev/null @@ -1,318 +0,0 @@ -#include <gst/gst.h> - -#define ITERS 100 -#include <stdlib.h> - -static GstElement * -create_bin (void) -{ - GstElement *bin; - GstElement *element; - - bin = gst_bin_new ("testbin"); - g_assert (GST_IS_BIN (bin)); - element = gst_element_factory_make ("fakesrc", NULL); - g_assert (GST_IS_ELEMENT (element)); - gst_element_set_name (element, "test1"); - gst_bin_add (GST_BIN (bin), element); - element = gst_element_factory_make ("fakesrc", NULL); - g_assert (GST_IS_ELEMENT (element)); - gst_element_set_name (element, "test2"); - gst_bin_add (GST_BIN (bin), element); - - return bin; -} - -static GstElement * -create_bin_ghostpads (void) -{ - GstElement *bin; - GstElement *element1, *element2; - - bin = gst_bin_new ("testbin"); - element1 = gst_element_factory_make ("identity", NULL); - gst_bin_add (GST_BIN (bin), element1); - element2 = gst_element_factory_make ("fakesink", NULL); - gst_bin_add (GST_BIN (bin), element2); - gst_element_link_pads (element1, "src", element2, "sink"); - gst_element_add_ghost_pad (bin, gst_element_get_pad (element1, "sink"), - "ghost_sink"); - - return bin; -} - -static void -add_remove_test1 (void) -{ - GstElement *bin; - GstElement *element; - - bin = gst_bin_new ("testbin"); - element = gst_element_factory_make ("fakesrc", NULL); - gst_element_set_name (element, "test1"); - g_assert (GST_OBJECT_FLOATING (element)); - gst_bin_add (GST_BIN (bin), element); - g_assert (!GST_OBJECT_FLOATING (element)); - gst_bin_remove (GST_BIN (bin), element); - - gst_object_unref (GST_OBJECT (bin)); -} - -static void -add_remove_test2 (void) -{ - GstElement *bin; - GstElement *element; - - bin = gst_bin_new ("testbin"); - element = gst_element_factory_make ("fakesrc", NULL); - gst_element_set_name (element, "test1"); - gst_object_ref (GST_OBJECT (element)); - g_assert (GST_OBJECT_FLOATING (element)); - gst_bin_add (GST_BIN (bin), element); - g_assert (!GST_OBJECT_FLOATING (element)); - gst_bin_remove (GST_BIN (bin), element); - g_assert (!GST_OBJECT_FLOATING (element)); - g_assert (!GST_OBJECT_DESTROYED (element)); - - gst_object_unref (GST_OBJECT (element)); -#if 0 - g_assert (GST_OBJECT_DESTROYED (element)); - gst_object_unref (GST_OBJECT (element)); -#endif - - gst_object_unref (GST_OBJECT (bin)); -} - -#if 0 -/* This code is bogus */ -static void -add_remove_test3 (void) -{ - GstElement *bin; - GstElement *element; - - bin = gst_bin_new ("testbin"); - element = gst_element_factory_make ("fakesrc", NULL); - gst_element_set_name (element, "test1"); - g_assert (GST_OBJECT_FLOATING (element)); - gst_bin_add (GST_BIN (bin), element); - g_assert (!GST_OBJECT_FLOATING (element)); - - gst_object_unref (GST_OBJECT (element)); - g_assert (gst_bin_get_by_name (GST_BIN (bin), "test1") == NULL); - - gst_object_unref (GST_OBJECT (bin)); -} -#endif - -#if 0 -/* This code is bogus */ -static void -add_remove_test4 (void) -{ - GstElement *bin, *bin2; - GstElement *element; - - bin = gst_bin_new ("testbin"); - element = gst_element_factory_make ("fakesrc", NULL); - gst_element_set_name (element, "test1"); - g_assert (GST_OBJECT_FLOATING (element)); - gst_bin_add (GST_BIN (bin), element); - g_assert (!GST_OBJECT_FLOATING (element)); - - bin2 = create_bin (); - g_assert (GST_OBJECT_FLOATING (bin2)); - gst_bin_add (GST_BIN (bin), bin2); - g_assert (!GST_OBJECT_FLOATING (bin2)); - - gst_object_unref (GST_OBJECT (bin2)); - g_assert (gst_bin_get_by_name (GST_BIN (bin), "testbin") == NULL); - gst_object_unref (GST_OBJECT (element)); - g_assert (gst_bin_get_by_name (GST_BIN (bin), "test1") == NULL); - - gst_object_unref (GST_OBJECT (bin)); -} -#endif - -int -main (int argc, gchar * argv[]) -{ - GstElement *bin; - int usage1; - gint i, iters; - - gst_alloc_trace_set_flags_all (GST_ALLOC_TRACE_LIVE); - - gst_init (&argc, &argv); - - if (argc == 2) - iters = atoi (argv[1]); - else - iters = ITERS; - - - g_print ("starting test\n"); - - usage1 = gst_alloc_trace_live_all (); - //gst_alloc_trace_print_all (); - - bin = gst_bin_new ("somebin"); - gst_object_unref (GST_OBJECT (bin)); - g_print ("create/unref new bin %d\n", gst_alloc_trace_live_all () - usage1); - - for (i = 0; i < iters; i++) { - bin = gst_bin_new ("somebin"); - gst_object_unref (GST_OBJECT (bin)); - } - g_print ("create/unref %d bins %d\n", iters, - gst_alloc_trace_live_all () - usage1); - - bin = gst_bin_new ("somebin"); - g_assert (GST_OBJECT_FLOATING (bin)); - gst_object_ref (GST_OBJECT (bin)); - gst_object_sink (GST_OBJECT (bin)); - g_assert (!GST_OBJECT_FLOATING (bin)); - gst_object_unref (GST_OBJECT (bin)); - g_print ("create/ref/sink/unref new bin %d\n", - gst_alloc_trace_live_all () - usage1); - - - for (i = 0; i < iters; i++) { - bin = gst_bin_new ("somebin"); - gst_object_ref (GST_OBJECT (bin)); - gst_object_sink (GST_OBJECT (bin)); - gst_object_unref (GST_OBJECT (bin)); - } - g_print ("create/ref/sink/unref %d bins %d\n", iters, - gst_alloc_trace_live_all () - usage1); - - bin = gst_bin_new ("somebin"); - g_assert (!GST_OBJECT_DESTROYED (bin)); - gst_object_unref (GST_OBJECT (bin)); -#if 0 - g_assert (GST_OBJECT_DESTROYED (bin)); - gst_object_unref (GST_OBJECT (bin)); -#endif - g_print ("create/destroy/unref new bin %d\n", - gst_alloc_trace_live_all () - usage1); - - for (i = 0; i < iters; i++) { - bin = gst_bin_new ("somebin"); - gst_object_unref (GST_OBJECT (bin)); -#if 0 - gst_object_unref (GST_OBJECT (bin)); -#endif - } - g_print ("create/destroy/unref %d bin %d\n", iters, - gst_alloc_trace_live_all () - usage1); - - bin = gst_bin_new ("somebin"); - gst_object_ref (GST_OBJECT (bin)); - gst_object_unref (GST_OBJECT (bin)); - gst_object_unref (GST_OBJECT (bin)); - g_print ("create/ref/unref/unref new bin %d\n", - gst_alloc_trace_live_all () - usage1); - - for (i = 0; i < iters; i++) { - bin = gst_bin_new ("somebin"); - gst_object_ref (GST_OBJECT (bin)); - gst_object_unref (GST_OBJECT (bin)); - gst_object_unref (GST_OBJECT (bin)); - } - g_print ("create/ref/unref/unref %d bin %d\n", iters, - gst_alloc_trace_live_all () - usage1); - - bin = gst_bin_new ("somebin"); - gst_object_ref (GST_OBJECT (bin)); - gst_object_unref (GST_OBJECT (bin)); - gst_object_unref (GST_OBJECT (bin)); -#if 0 - gst_object_unref (GST_OBJECT (bin)); -#endif - g_print ("craete/ref/destroy/unref/unref new bin %d\n", - gst_alloc_trace_live_all () - usage1); - - for (i = 0; i < iters; i++) { - bin = gst_bin_new ("somebin"); - gst_object_ref (GST_OBJECT (bin)); - gst_object_unref (GST_OBJECT (bin)); - gst_object_unref (GST_OBJECT (bin)); -#if 0 - gst_object_unref (GST_OBJECT (bin)); -#endif - } - g_print ("craete/ref/destroy/unref/unref %d bins %d\n", iters, - gst_alloc_trace_live_all () - usage1); - - for (i = 0; i < iters; i++) { - bin = gst_bin_new ("somebin"); - gst_object_ref (GST_OBJECT (bin)); - gst_element_set_name (bin, "testing123"); - gst_object_unref (GST_OBJECT (bin)); - gst_element_set_name (bin, "testing123"); - gst_object_unref (GST_OBJECT (bin)); -#if 0 - gst_object_unref (GST_OBJECT (bin)); -#endif - } - g_print ("craete/ref/destroy/unref/unref %d bins with name %d\n", iters, - gst_alloc_trace_live_all () - usage1); - - bin = gst_bin_new ("somebin"); - for (i = 0; i < iters; i++) { - gst_element_set_name (bin, "testing"); - } - gst_object_unref (GST_OBJECT (bin)); - g_print ("set name %d times %d\n", iters, - gst_alloc_trace_live_all () - usage1); - - for (i = 0; i < iters; i++) { - bin = create_bin (); - gst_object_unref (GST_OBJECT (bin)); - } - g_print ("create/unref %d bin with children %d\n", iters, - gst_alloc_trace_live_all () - usage1); - - for (i = 0; i < iters / 2; i++) { - bin = create_bin_ghostpads (); - gst_object_unref (GST_OBJECT (bin)); - } - g_print ("create/unref %d bin with children and ghostpads %d\n", iters / 2, - gst_alloc_trace_live_all () - usage1); - - for (i = 0; i < iters; i++) { - add_remove_test1 (); - } - g_print ("add/remove test1 %d in bin %d\n", iters, - gst_alloc_trace_live_all () - usage1); - - for (i = 0; i < iters; i++) { - add_remove_test2 (); - } - g_print ("add/remove test2 %d in bin %d\n", iters, - gst_alloc_trace_live_all () - usage1); - -#if 0 - for (i = 0; i < iters; i++) { - add_remove_test3 (); - } - g_print ("add/destroy/remove test3 %d in bin %d\n", iters, - gst_alloc_trace_live_all () - usage1); -#endif - -#if 0 - for (i = 0; i < iters; i++) { - add_remove_test4 (); - } - g_print ("add/destroy/remove test4 %d in bin %d\n", iters, - gst_alloc_trace_live_all () - usage1); -#endif - - g_print ("leaked: %d\n", gst_alloc_trace_live_all () - usage1); - - //gst_alloc_trace_print_all (); - - //return (gst_alloc_trace_live_all () - usage1 ? -1 : 0); - return 0; -} diff --git a/tests/old/testsuite/refcounting/element.c b/tests/old/testsuite/refcounting/element.c deleted file mode 100644 index ed0258c32d..0000000000 --- a/tests/old/testsuite/refcounting/element.c +++ /dev/null @@ -1,139 +0,0 @@ -#include <gst/gst.h> - -#define ITERS 100 -#include <stdlib.h> - -int -main (int argc, gchar * argv[]) -{ - GstElement *element; - int usage1; - gint i, iters; - - gst_init (&argc, &argv); - - if (argc == 2) - iters = atoi (argv[1]); - else - iters = ITERS; - - g_print ("starting test\n"); - - usage1 = gst_alloc_trace_live_all (); - //gst_alloc_trace_print_all (); - - element = gst_element_factory_make ("fakesrc", NULL); - gst_object_unref (GST_OBJECT (element)); - g_print ("create/unref new element %d\n", - gst_alloc_trace_live_all () - usage1); - - for (i = 0; i < iters; i++) { - element = gst_element_factory_make ("fakesrc", NULL); - gst_object_unref (GST_OBJECT (element)); - } - g_print ("create/unref %d elements %d\n", iters, - gst_alloc_trace_live_all () - usage1); - - element = gst_element_factory_make ("fakesrc", NULL); - g_assert (GST_OBJECT_FLOATING (element)); - gst_object_ref (GST_OBJECT (element)); - gst_object_sink (GST_OBJECT (element)); - g_assert (!GST_OBJECT_FLOATING (element)); - gst_object_unref (GST_OBJECT (element)); - g_print ("create/ref/sink/unref new element %d\n", - gst_alloc_trace_live_all () - usage1); - - - for (i = 0; i < iters; i++) { - element = gst_element_factory_make ("fakesrc", NULL); - gst_object_ref (GST_OBJECT (element)); - gst_object_sink (GST_OBJECT (element)); - gst_object_unref (GST_OBJECT (element)); - } - g_print ("create/ref/sink/unref %d elements %d\n", iters, - gst_alloc_trace_live_all () - usage1); - -#if 0 - element = gst_element_factory_make ("fakesrc", NULL); - g_assert (!GST_OBJECT_DESTROYED (element)); - gst_object_unref (GST_OBJECT (element)); - g_assert (GST_OBJECT_DESTROYED (element)); - gst_object_unref (GST_OBJECT (element)); - g_print ("create/destroy/unref new element %d\n", - gst_alloc_trace_live_all () - usage1); -#endif - -#if 0 - for (i = 0; i < iters; i++) { - element = gst_element_factory_make ("fakesrc", NULL); - gst_object_unref (GST_OBJECT (element)); - gst_object_unref (GST_OBJECT (element)); - } - g_print ("create/destroy/unref %d element %d\n", iters, - gst_alloc_trace_live_all () - usage1); -#endif - - element = gst_element_factory_make ("fakesrc", NULL); - gst_object_ref (GST_OBJECT (element)); - gst_object_unref (GST_OBJECT (element)); - gst_object_unref (GST_OBJECT (element)); - g_print ("create/ref/unref/unref new element %d\n", - gst_alloc_trace_live_all () - usage1); - - for (i = 0; i < iters; i++) { - element = gst_element_factory_make ("fakesrc", NULL); - gst_object_ref (GST_OBJECT (element)); - gst_object_unref (GST_OBJECT (element)); - gst_object_unref (GST_OBJECT (element)); - } - g_print ("create/ref/unref/unref %d element %d\n", iters, - gst_alloc_trace_live_all () - usage1); - -#if 0 - element = gst_element_factory_make ("fakesrc", NULL); - gst_object_ref (GST_OBJECT (element)); - gst_object_unref (GST_OBJECT (element)); - gst_object_unref (GST_OBJECT (element)); - gst_object_unref (GST_OBJECT (element)); - g_print ("craete/ref/destroy/unref/unref new element %d\n", - gst_alloc_trace_live_all () - usage1); -#endif - -#if 0 - for (i = 0; i < iters; i++) { - element = gst_element_factory_make ("fakesrc", NULL); - gst_object_ref (GST_OBJECT (element)); - gst_object_unref (GST_OBJECT (element)); - gst_object_unref (GST_OBJECT (element)); - gst_object_unref (GST_OBJECT (element)); - } - g_print ("craete/ref/destroy/unref/unref %d elements %d\n", iters, - gst_alloc_trace_live_all () - usage1); -#endif - -#if 0 - for (i = 0; i < iters; i++) { - element = gst_element_factory_make ("fakesrc", NULL); - gst_object_ref (GST_OBJECT (element)); - gst_element_set_name (element, "testing123"); - gst_object_unref (GST_OBJECT (element)); - gst_element_set_name (element, "testing123"); - gst_object_unref (GST_OBJECT (element)); - gst_object_unref (GST_OBJECT (element)); - } - g_print ("craete/ref/destroy/unref/unref %d elements with name %d\n", iters, - gst_alloc_trace_live_all () - usage1); -#endif - - element = gst_element_factory_make ("fakesrc", NULL); - for (i = 0; i < iters; i++) { - gst_element_set_name (element, "testing"); - } - gst_object_unref (GST_OBJECT (element)); - g_print ("set name %d times %d\n", iters, - gst_alloc_trace_live_all () - usage1); - - g_print ("leaked: %d\n", gst_alloc_trace_live_all () - usage1); - - return (gst_alloc_trace_live_all () - usage1 ? -1 : 0); -} diff --git a/tests/old/testsuite/refcounting/element_pad.c b/tests/old/testsuite/refcounting/element_pad.c deleted file mode 100644 index 24b4e82f33..0000000000 --- a/tests/old/testsuite/refcounting/element_pad.c +++ /dev/null @@ -1,115 +0,0 @@ -#include <gst/gst.h> - -#define ITERS 100 -#include <stdlib.h> -#include "mem.h" - -int -main (int argc, gchar * argv[]) -{ - GstElement *element; - GstElement *element2; - GstPad *pad; - long usage1; - gint i, iters; - - gst_init (&argc, &argv); - - if (argc == 2) - iters = atoi (argv[1]); - else - iters = ITERS; - - g_print ("starting element with pad test with %d iterations\n", iters); - usage1 = vmsize (); - - element = gst_element_factory_make ("fakesink", NULL);; - g_assert (GST_IS_ELEMENT (element)); - pad = gst_element_get_pad (element, "sink"); - g_assert (GST_IS_PAD (pad)); - g_assert (GST_OBJECT_FLOATING (element)); - g_assert (!GST_OBJECT_FLOATING (pad)); - g_assert (gst_pad_get_parent (pad) == element); - gst_object_unref (GST_OBJECT (element)); - g_print ("create/addpad/unref 1 new element: %ld\n", vmsize () - usage1); - - for (i = 0; i < iters; i++) { - element = gst_element_factory_make ("fakesink", NULL);; - g_assert (GST_IS_ELEMENT (element)); - gst_object_unref (GST_OBJECT (element)); - } - g_print ("create/unref %d elements: %ld\n", iters, vmsize () - usage1); - - for (i = 0; i < iters / 2; i++) { - element = gst_element_factory_make ("fakesink", NULL); - g_assert (GST_IS_ELEMENT (element)); - element2 = gst_element_factory_make ("fakesrc", NULL); - g_assert (GST_IS_ELEMENT (element2)); - gst_element_link_pads (element2, "src", element, "sink"); - g_assert (GST_PAD_IS_LINKED (gst_element_get_pad (element2, "src"))); - g_assert (GST_PAD_IS_LINKED (gst_element_get_pad (element, "sink"))); - gst_object_unref (GST_OBJECT (element)); - g_assert (!GST_PAD_IS_LINKED (gst_element_get_pad (element2, "src"))); - gst_object_unref (GST_OBJECT (element2)); - } - g_print ("create/link/unref %d element duos: %ld\n", iters / 2, - vmsize () - usage1); - - element = gst_element_factory_make ("fakesink", NULL);; - g_assert (GST_IS_ELEMENT (element)); - pad = gst_element_get_pad (element, "sink"); - g_assert (GST_IS_PAD (pad)); - gst_element_remove_pad (element, pad); - g_assert (gst_element_get_pad (element, "sink") == NULL); - gst_object_unref (GST_OBJECT (element)); - - g_print ("pad removal on one element: %ld\n", vmsize () - usage1); - - for (i = 0; i < iters / 2; i++) { - element = gst_element_factory_make ("fakesink", NULL);; - g_assert (GST_IS_ELEMENT (element)); - pad = gst_element_get_pad (element, "sink"); - g_assert (GST_IS_PAD (pad)); - gst_element_remove_pad (element, pad); - g_assert (gst_element_get_pad (element, "sink") == NULL); - gst_object_unref (GST_OBJECT (element)); - } - g_print ("pad removal loop on %d elements: %ld\n", iters / 2, - vmsize () - usage1); - - for (i = 0; i < iters / 2; i++) { - element = gst_element_factory_make ("fakesink", NULL);; - g_assert (GST_IS_ELEMENT (element)); - pad = gst_element_get_pad (element, "sink"); - g_assert (GST_IS_PAD (pad)); - gst_object_ref (GST_OBJECT (pad)); - gst_element_remove_pad (element, pad); - g_assert (gst_pad_get_parent (pad) == NULL); - gst_object_unref (GST_OBJECT (pad)); - gst_object_unref (GST_OBJECT (element)); - } - g_print ("pad ref/removal/test loop on %d elements: %ld\n", iters / 2, - vmsize () - usage1); - - element = gst_element_factory_make ("fakesink", NULL);; - g_assert (GST_IS_ELEMENT (element)); - pad = gst_element_get_pad (element, "sink"); - g_assert (GST_IS_PAD (pad)); - gst_object_unref (GST_OBJECT (element)); - - g_print ("pad unref on one element: %ld\n", vmsize () - usage1); - - for (i = 0; i < iters / 2; i++) { - element = gst_element_factory_make ("fakesink", NULL); - g_assert (GST_IS_ELEMENT (element)); - pad = gst_element_get_pad (element, "sink"); - g_assert (GST_IS_PAD (pad)); - gst_object_unref (GST_OBJECT (element)); - } - g_print ("pad unref loop on %d elements: %ld\n", iters / 2, - vmsize () - usage1); - - g_print ("leaked: %ld\n", vmsize () - usage1); - - return 0; -} diff --git a/tests/old/testsuite/refcounting/mainloop.c b/tests/old/testsuite/refcounting/mainloop.c deleted file mode 100644 index 0e14a92ef3..0000000000 --- a/tests/old/testsuite/refcounting/mainloop.c +++ /dev/null @@ -1,32 +0,0 @@ -#include <gst/gst.h> - -/* test to make sure that we can do gst_main and gst_main_quit in succession */ -/* FIXME: use mutexes */ - -gboolean mainloop = FALSE; - -static gboolean -quit_main (gpointer data) -{ - if (mainloop) { - mainloop = FALSE; - g_print ("-"); - gst_main_quit (); - } - return TRUE; -} - -int -main (int argc, gchar * argv[]) -{ - int i; - - g_timeout_add (1, quit_main, NULL); - for (i = 0; i < 1000; ++i) { - mainloop = TRUE; - g_print ("+"); - gst_main (); - } - g_print ("\n"); - return 0; -} diff --git a/tests/old/testsuite/refcounting/mem.c b/tests/old/testsuite/refcounting/mem.c deleted file mode 100644 index 5911dc61de..0000000000 --- a/tests/old/testsuite/refcounting/mem.c +++ /dev/null @@ -1,31 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <fcntl.h> -#include <unistd.h> - -int -vmsize () -{ - int pid, fd, size, i, mem; - char filename[17], buf[256], *ptr, *end; - - pid = getpid (); - snprintf (filename, 17, "/proc/%d/stat", pid); - fd = open (filename, O_RDONLY); - if (fd == -1) { - fprintf (stderr, "warning: could not open %s\n", filename); - return -1; - } - size = read (fd, buf, 240); - if (size == -1) - return -1; - ptr = buf; - for (i = 0; i < 22; i++) - ptr = (char *) strchr (ptr, ' ') + 1; - end = (char *) strchr (ptr, ' '); - *end = 0; - sscanf (ptr, "%d", &mem); - close (fd); - return mem; -} diff --git a/tests/old/testsuite/refcounting/mem.h b/tests/old/testsuite/refcounting/mem.h deleted file mode 100644 index 28999db2c3..0000000000 --- a/tests/old/testsuite/refcounting/mem.h +++ /dev/null @@ -1 +0,0 @@ -int vmsize(); diff --git a/tests/old/testsuite/refcounting/object.c b/tests/old/testsuite/refcounting/object.c deleted file mode 100644 index 5646f71ef1..0000000000 --- a/tests/old/testsuite/refcounting/object.c +++ /dev/null @@ -1,160 +0,0 @@ -#include <gst/gst.h> - -#define ITERS 100000 -#include <stdlib.h> -#include "mem.h" - -int -main (int argc, gchar * argv[]) -{ - GstObject *object, *object2; - long usage1; - gint i, iters; - - gst_init (&argc, &argv); - - if (argc == 2) - iters = atoi (argv[1]); - else - iters = ITERS; - - g_print ("starting test with %d iterations\n", iters); - usage1 = vmsize (); - object = gst_object_new (); - gst_object_unref (object); - g_print ("create/unref new object %ld\n", vmsize () - usage1); - - for (i = 0; i < iters; i++) { - object = gst_object_new (); - gst_object_unref (object); - - } - g_print ("create/unref %d object %ld\n", iters, vmsize () - usage1); - - object = gst_object_new (); - g_assert (GST_OBJECT_FLOATING (object)); - gst_object_ref (object); - gst_object_sink (object); - g_assert (!GST_OBJECT_FLOATING (object)); - gst_object_unref (object); - g_print ("create/ref/sink/unref new object %ld\n", vmsize () - usage1); - - for (i = 0; i < iters; i++) { - object = gst_object_new (); - gst_object_ref (object); - gst_object_sink (object); - gst_object_unref (object); - } - g_print ("create/ref/sink/unref %d object %ld\n", iters, vmsize () - usage1); - - object = gst_object_new (); - g_assert (!GST_OBJECT_DESTROYED (object)); - gst_object_unref (object); - g_assert (GST_OBJECT_DESTROYED (object)); - gst_object_unref (object); - g_print ("create/destroy/unref new object %ld\n", vmsize () - usage1); - - for (i = 0; i < iters; i++) { - object = gst_object_new (); - gst_object_unref (object); - gst_object_unref (object); - } - g_print ("destroy/unref %d object %ld\n", iters, vmsize () - usage1); - - object = gst_object_new (); - gst_object_ref (object); - gst_object_unref (object); - gst_object_unref (object); - g_print ("create/ref/unref/unref new object %ld\n", vmsize () - usage1); - - for (i = 0; i < iters; i++) { - object = gst_object_new (); - gst_object_ref (object); - gst_object_unref (object); - gst_object_unref (object); - } - g_print ("create/ref/unref/unref %d object %ld\n", iters, vmsize () - usage1); - - object = gst_object_new (); - gst_object_ref (object); - gst_object_unref (object); - gst_object_unref (object); - gst_object_unref (object); - g_print ("create/ref/destroy/unref/unref new object %ld\n", - vmsize () - usage1); - - for (i = 0; i < iters; i++) { - object = gst_object_new (); - gst_object_ref (object); - gst_object_unref (object); - gst_object_unref (object); - gst_object_unref (object); - } - g_print ("create/ref/destroy/unref/unref %d object %ld\n", iters, - vmsize () - usage1); - - for (i = 0; i < iters; i++) { - object = gst_object_new (); - gst_object_ref (object); - gst_object_set_name (object, "testing123"); - gst_object_unref (object); - gst_object_set_name (object, "testing123"); - gst_object_unref (object); - gst_object_unref (object); - } - g_print ("create/ref/destroy/unref/unref %d object with name %ld\n", iters, - vmsize () - usage1); - - object = gst_object_new (); - for (i = 0; i < iters; i++) { - gst_object_set_name (object, "testing"); - } - gst_object_unref (object); - g_print ("create/set name/unref %d object %ld\n", iters, vmsize () - usage1); - - object = gst_object_new (); - object2 = gst_object_new (); - g_assert (GST_OBJECT_FLOATING (object)); - g_assert (GST_OBJECT_FLOATING (object2)); - - gst_object_set_parent (object, object2); - g_assert (GST_OBJECT_FLOATING (object2)); - g_assert (!GST_OBJECT_FLOATING (object)); - - g_print ("parentage flags set_parent ok %ld\n", vmsize () - usage1); - - gst_object_ref (object); - gst_object_unparent (object); - g_assert (GST_OBJECT_FLOATING (object2)); - g_assert (!GST_OBJECT_FLOATING (object)); - g_assert (gst_object_get_parent (object) == NULL); - - g_print ("parentage flags unparent ok %ld\n", vmsize () - usage1); - - gst_object_set_parent (object, object2); - g_assert (GST_OBJECT_FLOATING (object2)); - g_assert (!GST_OBJECT_FLOATING (object)); - g_assert (gst_object_get_parent (object) == object2); - - gst_object_unref (object); - g_assert (GST_OBJECT_DESTROYED (object)); - g_assert (!GST_OBJECT_FLOATING (object)); - g_assert (gst_object_get_parent (object) == NULL); - gst_object_unref (object); - - g_print ("parentage flags destroy ok %ld\n", vmsize () - usage1); - - for (i = 0; i < iters; i++) { - object = gst_object_new (); - object2 = gst_object_new (); - gst_object_set_parent (object2, object); - gst_object_unref (object); - gst_object_unref (object2); - } - g_print ("create/unref %d 2 parented objects %ld\n", iters, - vmsize () - usage1); - - g_print ("leaked: %ld\n", vmsize () - usage1); - - return (vmsize () - usage1 ? -1 : 0); -} diff --git a/tests/old/testsuite/refcounting/pad.c b/tests/old/testsuite/refcounting/pad.c deleted file mode 100644 index 1b8d53ed00..0000000000 --- a/tests/old/testsuite/refcounting/pad.c +++ /dev/null @@ -1,153 +0,0 @@ -#include <gst/gst.h> - -#define ITERS 100 -#include <stdlib.h> -#include "mem.h" - -GstStaticPadTemplate templ = GST_STATIC_PAD_TEMPLATE ("default", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - -int -main (int argc, gchar * argv[]) -{ - GstPad *pad; - GstPadTemplate *padtempl; - long usage1; - gint i, iters; - - gst_alloc_trace_set_flags_all (GST_ALLOC_TRACE_LIVE); - - gst_init (&argc, &argv); - - g_mem_profile (); - - if (argc == 2) - iters = atoi (argv[1]); - else - iters = ITERS; - - //gst_alloc_trace_print_all (); - - g_print ("starting pad test\n"); - usage1 = vmsize (); - - g_print ("DEBUG: creating new pad with name padname\n"); - pad = - gst_pad_new_from_template (gst_static_pad_template_get (&templ), - "padname"); - g_print ("DEBUG: unreffing new pad with name padname\n"); - gst_object_unref (GST_OBJECT (pad)); - g_print ("create/unref new pad %ld\n", vmsize () - usage1); - - for (i = 0; i < iters; i++) { - pad = - gst_pad_new_from_template (gst_static_pad_template_get (&templ), - "padname"); - gst_object_unref (GST_OBJECT (pad)); - } - g_print ("create/unref %d pads %ld\n", iters, vmsize () - usage1); - - pad = - gst_pad_new_from_template (gst_static_pad_template_get (&templ), - "padname"); - g_assert (GST_OBJECT_FLOATING (pad)); - gst_object_ref (GST_OBJECT (pad)); - gst_object_sink (GST_OBJECT (pad)); - g_assert (!GST_OBJECT_FLOATING (pad)); - gst_object_unref (GST_OBJECT (pad)); - g_print ("create/ref/sink/unref new pad %ld\n", vmsize () - usage1); - - for (i = 0; i < iters; i++) { - pad = - gst_pad_new_from_template (gst_static_pad_template_get (&templ), - "padname"); - gst_object_ref (GST_OBJECT (pad)); - gst_object_sink (GST_OBJECT (pad)); - gst_object_unref (GST_OBJECT (pad)); - } - g_print ("create/ref/sink/unref %d pads %ld\n", iters, vmsize () - usage1); - - pad = - gst_pad_new_from_template (gst_static_pad_template_get (&templ), - "padname"); - gst_object_ref (GST_OBJECT (pad)); - gst_object_unref (GST_OBJECT (pad)); - gst_object_unref (GST_OBJECT (pad)); - g_print ("create/ref/unref/unref pad %ld\n", vmsize () - usage1); - - for (i = 0; i < iters; i++) { - pad = - gst_pad_new_from_template (gst_static_pad_template_get (&templ), - "padname"); - gst_object_ref (GST_OBJECT (pad)); - gst_object_unref (GST_OBJECT (pad)); - gst_object_unref (GST_OBJECT (pad)); - } - g_print ("create/ref/unref/unref %d pads %ld\n", iters, vmsize () - usage1); - - pad = - gst_pad_new_from_template (gst_static_pad_template_get (&templ), - "padname"); - gst_object_ref (GST_OBJECT (pad)); - gst_object_unref (GST_OBJECT (pad)); - gst_object_unref (GST_OBJECT (pad)); - g_print ("create/ref/unref/unref pad %ld\n", vmsize () - usage1); - - for (i = 0; i < iters; i++) { - pad = - gst_pad_new_from_template (gst_static_pad_template_get (&templ), - "padname"); - gst_object_ref (GST_OBJECT (pad)); - gst_object_unref (GST_OBJECT (pad)); - gst_object_unref (GST_OBJECT (pad)); - } - g_print ("create/ref/unref/unref %d pads %ld\n", iters, vmsize () - usage1); - - for (i = 0; i < iters; i++) { - pad = - gst_pad_new_from_template (gst_static_pad_template_get (&templ), - "padname"); - gst_object_ref (GST_OBJECT (pad)); - gst_pad_set_name (pad, "testing123"); - gst_object_unref (GST_OBJECT (pad)); - gst_pad_set_name (pad, "testing123"); - gst_object_unref (GST_OBJECT (pad)); - } - g_print ("create/ref/unref/unref %d pads %ld with name\n", iters, - vmsize () - usage1); - - pad = - gst_pad_new_from_template (gst_static_pad_template_get (&templ), - "padname"); - for (i = 0; i < iters; i++) { - gst_pad_set_name (pad, "testing"); - } - gst_object_unref (GST_OBJECT (pad)); - g_print ("set name %d times %ld\n", iters, vmsize () - usage1); - - for (i = 0; i < iters; i++) { - padtempl = - gst_pad_template_new ("sink%d", GST_PAD_SINK, GST_PAD_SOMETIMES, - gst_caps_new_any ()); - gst_object_unref (GST_OBJECT (padtempl)); - } - g_print ("%d padtemplates create/unref %ld\n", iters, vmsize () - usage1); - - for (i = 0; i < iters; i++) { - padtempl = - gst_pad_template_new ("sink%d", GST_PAD_SINK, GST_PAD_SOMETIMES, - gst_caps_new_any ()); - pad = gst_pad_new_from_template (padtempl, "sink1"); - gst_object_unref (GST_OBJECT (pad)); - } - g_print ("%d pads create/unref from padtemplate %ld\n", iters, - vmsize () - usage1); - - g_print ("leaked: %ld\n", vmsize () - usage1); - - //gst_alloc_trace_print_all (); - - return 0; -} diff --git a/tests/old/testsuite/refcounting/sched.c b/tests/old/testsuite/refcounting/sched.c deleted file mode 100644 index 9ed1843c13..0000000000 --- a/tests/old/testsuite/refcounting/sched.c +++ /dev/null @@ -1,77 +0,0 @@ -#include <gst/gst.h> - -gint i = 0; -GstElement *pipeline; -GstPadChainFunction oss_chain; - -static GstElement * -make_and_check_element (gchar * type, gchar * name) -{ - GstElement *element = gst_element_factory_make (type, name); - - if (element == NULL) { - g_warning - ("Could not run test, because element type \"%s\" is not installed. Please retry when it is. Assuming it works for now...", - type); - exit (1); - } - - return element; -} - -static void -create_pipeline (void) -{ - GstElement *src; - GstElement *sink; - GstElement *id; - - pipeline = gst_pipeline_new ("pipeline"); - src = make_and_check_element ("sinesrc", "src"); - /** - * You need a sink with a loop-based element in here, if you want to kill opt, too. - * Osssink (chain-based) only breaks the basic scheduler. - */ - sink = make_and_check_element ("alsasink", "sink"); - - - gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL); - gst_element_link (src, sink); - - /** - * now make the bug appear - * I believe it has something to do with 2 chains being created in the scheduler - * but I haven't looked at it yet - * If you comment out the next 4 lines, everything works fine. - * And no, it's not because of identity, you may use any other element. - */ - gst_element_unlink (src, sink); - id = make_and_check_element ("identity", "id"); - gst_bin_add (GST_BIN (pipeline), id); - gst_element_link_many (src, id, sink, NULL); - - /* This pipeline will not be removed properly once we unref it */ - gst_element_set_state (pipeline, GST_STATE_PLAYING); -} - -gint -main (gint argc, gchar * argv[]) -{ - gst_init (&argc, &argv); - create_pipeline (); - - while (i < 300) { - /** - * only inc i when it works, so the program hangs when _iterate returns false, - * which it does after the first pipeline isn't unref'd properly and the next - * osssink refuses to work. - */ - if (gst_bin_iterate (GST_BIN (pipeline))) - i++; - if (i % 50 == 0) { - gst_object_unref (GST_OBJECT (pipeline)); - create_pipeline (); - } - } - return 0; -} diff --git a/tests/old/testsuite/refcounting/thread.c b/tests/old/testsuite/refcounting/thread.c deleted file mode 100644 index 862f4dc9e2..0000000000 --- a/tests/old/testsuite/refcounting/thread.c +++ /dev/null @@ -1,304 +0,0 @@ -#include <gst/gst.h> - -#define ITERS 100000 -#include <stdlib.h> -#include "mem.h" - -GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - -GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - -static GstElement * -create_thread (void) -{ - GstElement *thread; - GstElement *element; - - thread = gst_thread_new ("testthread"); - element = gst_element_new (); - gst_element_set_name (element, "test1"); - gst_bin_add (GST_BIN (thread), element); - element = gst_element_new (); - gst_element_set_name (element, "test2"); - gst_bin_add (GST_BIN (thread), element); - - return thread; -} - -static GstElement * -create_thread_ghostpads (void) -{ - GstElement *thread; - GstElement *element1, *element2; - - thread = gst_thread_new ("testthread"); - element1 = gst_element_new (); - gst_element_set_name (element1, "test1"); - gst_element_add_pad (element1, - gst_pad_new_from_template (gst_static_pad_template_get (&srctemplate), - "src1")); - gst_bin_add (GST_BIN (thread), element1); - element2 = gst_element_new (); - gst_element_set_name (element2, "test2"); - gst_element_add_pad (element1, - gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate), - "sink1")); - gst_bin_add (GST_BIN (thread), element2); - gst_element_link (element1, "src1", element2, "sink1"); - gst_element_add_ghost_pad (thread, gst_element_get_pad (element2, "sink1"), - "sink1"); - - return thread; -} - -static void -add_remove_test1 (void) -{ - GstElement *thread; - GstElement *element; - - thread = gst_thread_new ("testthread"); - element = gst_element_new (); - gst_element_set_name (element, "test1"); - g_assert (GST_OBJECT_FLOATING (element)); - gst_bin_add (GST_BIN (thread), element); - g_assert (!GST_OBJECT_FLOATING (element)); - gst_bin_remove (GST_BIN (thread), element); - - gst_object_unref (GST_OBJECT (thread)); -} - -static void -add_remove_test2 (void) -{ - GstElement *thread; - GstElement *element; - - thread = gst_thread_new ("testthread"); - element = gst_element_new (); - gst_element_set_name (element, "test1"); - gst_object_ref (GST_OBJECT (element)); - g_assert (GST_OBJECT_FLOATING (element)); - gst_bin_add (GST_BIN (thread), element); - g_assert (!GST_OBJECT_FLOATING (element)); - gst_bin_remove (GST_BIN (thread), element); - g_assert (!GST_OBJECT_FLOATING (element)); - g_assert (!GST_OBJECT_DESTROYED (element)); - - gst_object_unref (GST_OBJECT (element)); - g_assert (GST_OBJECT_DESTROYED (element)); - gst_object_unref (GST_OBJECT (element)); - - gst_object_unref (GST_OBJECT (thread)); -} - -static void -add_remove_test3 (void) -{ - GstElement *thread; - GstElement *element; - - thread = gst_thread_new ("testthread"); - element = gst_element_new (); - gst_element_set_name (element, "test1"); - g_assert (GST_OBJECT_FLOATING (element)); - gst_bin_add (GST_BIN (thread), element); - g_assert (!GST_OBJECT_FLOATING (element)); - - gst_object_unref (GST_OBJECT (element)); - g_assert (gst_bin_get_by_name (GST_BIN (thread), "test1") == NULL); - - gst_object_unref (GST_OBJECT (thread)); -} - -static void -add_remove_test4 (void) -{ - GstElement *thread, *thread2; - GstElement *element; - - thread = gst_thread_new ("testthread"); - element = gst_element_new (); - gst_element_set_name (element, "test1"); - g_assert (GST_OBJECT_FLOATING (element)); - gst_bin_add (GST_BIN (thread), element); - g_assert (!GST_OBJECT_FLOATING (element)); - - thread2 = create_thread (); - g_assert (GST_OBJECT_FLOATING (thread2)); - gst_bin_add (GST_BIN (thread), thread2); - g_assert (!GST_OBJECT_FLOATING (thread2)); - - gst_object_unref (GST_OBJECT (thread2)); - g_assert (gst_bin_get_by_name (GST_BIN (thread), "testthread") == NULL); - gst_object_unref (GST_OBJECT (element)); - g_assert (gst_bin_get_by_name (GST_BIN (thread), "test1") == NULL); - - gst_object_unref (GST_OBJECT (thread)); -} - -int -main (int argc, gchar * argv[]) -{ - GstElement *thread, *element; - long usage1; - gint i, iters; - - gst_init (&argc, &argv); - - if (argc == 2) - iters = atoi (argv[1]); - else - iters = ITERS; - - g_print ("starting test\n"); - usage1 = vmsize (); - - thread = gst_thread_new ("somethread"); - gst_object_unref (GST_OBJECT (thread)); - g_print ("create/unref new thread %ld\n", vmsize () - usage1); - - for (i = 0; i < iters; i++) { - thread = gst_thread_new ("somethread"); - gst_object_unref (GST_OBJECT (thread)); - } - g_print ("create/unref %d threads %ld\n", iters, vmsize () - usage1); - - thread = gst_thread_new ("somethread"); - g_assert (GST_OBJECT_FLOATING (thread)); - gst_object_ref (GST_OBJECT (thread)); - gst_object_sink (GST_OBJECT (thread)); - g_assert (!GST_OBJECT_FLOATING (thread)); - gst_object_unref (GST_OBJECT (thread)); - g_print ("create/ref/sink/unref new thread %ld\n", vmsize () - usage1); - - - for (i = 0; i < iters; i++) { - thread = gst_thread_new ("somethread"); - gst_object_ref (GST_OBJECT (thread)); - gst_object_sink (GST_OBJECT (thread)); - gst_object_unref (GST_OBJECT (thread)); - } - g_print ("create/ref/sink/unref %d threads %ld\n", iters, vmsize () - usage1); - - thread = gst_thread_new ("somethread"); - g_assert (!GST_OBJECT_DESTROYED (thread)); - gst_object_unref (GST_OBJECT (thread)); - g_assert (GST_OBJECT_DESTROYED (thread)); - gst_object_unref (GST_OBJECT (thread)); - g_print ("create/destroy/unref new thread %ld\n", vmsize () - usage1); - - for (i = 0; i < iters; i++) { - thread = gst_thread_new ("somethread"); - gst_object_unref (GST_OBJECT (thread)); - gst_object_unref (GST_OBJECT (thread)); - } - g_print ("create/destroy/unref %d thread %ld\n", iters, vmsize () - usage1); - - thread = gst_thread_new ("somethread"); - gst_object_ref (GST_OBJECT (thread)); - gst_object_unref (GST_OBJECT (thread)); - gst_object_unref (GST_OBJECT (thread)); - g_print ("create/ref/unref/unref new thread %ld\n", vmsize () - usage1); - - for (i = 0; i < iters; i++) { - thread = gst_thread_new ("somethread"); - gst_object_ref (GST_OBJECT (thread)); - gst_object_unref (GST_OBJECT (thread)); - gst_object_unref (GST_OBJECT (thread)); - } - g_print ("create/ref/unref/unref %d thread %ld\n", iters, vmsize () - usage1); - - thread = gst_thread_new ("somethread"); - gst_object_ref (GST_OBJECT (thread)); - gst_object_unref (GST_OBJECT (thread)); - gst_object_unref (GST_OBJECT (thread)); - gst_object_unref (GST_OBJECT (thread)); - g_print ("craete/ref/destroy/unref/unref new thread %ld\n", - vmsize () - usage1); - - for (i = 0; i < iters; i++) { - thread = gst_thread_new ("somethread"); - gst_object_ref (GST_OBJECT (thread)); - gst_object_unref (GST_OBJECT (thread)); - gst_object_unref (GST_OBJECT (thread)); - gst_object_unref (GST_OBJECT (thread)); - } - g_print ("craete/ref/destroy/unref/unref %d threads %ld\n", iters, - vmsize () - usage1); - - for (i = 0; i < iters; i++) { - thread = gst_thread_new ("somethread"); - gst_object_ref (GST_OBJECT (thread)); - gst_element_set_name (thread, "testing123"); - gst_object_unref (GST_OBJECT (thread)); - gst_element_set_name (thread, "testing123"); - gst_object_unref (GST_OBJECT (thread)); - gst_object_unref (GST_OBJECT (thread)); - } - g_print ("craete/ref/destroy/unref/unref %d threads with name %ld\n", iters, - vmsize () - usage1); - - thread = gst_thread_new ("somethread"); - for (i = 0; i < iters; i++) { - gst_element_set_name (thread, "testing"); - } - gst_object_unref (GST_OBJECT (thread)); - g_print ("set name %d times %ld\n", iters, vmsize () - usage1); - - for (i = 0; i < iters; i++) { - thread = gst_thread_new ("somethread"); - element = gst_element_new (); - gst_element_set_name (element, "test1"); - gst_bin_add (GST_BIN (thread), element); - gst_object_unref (GST_OBJECT (thread)); - } - g_print ("create/unref %d thread with one element %ld\n", iters, - vmsize () - usage1); - - for (i = 0; i < iters; i++) { - thread = create_thread (); - gst_object_unref (GST_OBJECT (thread)); - } - g_print ("create/unref %d thread with children %ld\n", iters, - vmsize () - usage1); - - for (i = 0; i < iters / 2; i++) { - thread = create_thread_ghostpads (); - gst_object_unref (GST_OBJECT (thread)); - } - g_print ("create/unref %d thread with children and ghostpads %ld\n", - iters / 2, vmsize () - usage1); - - for (i = 0; i < iters; i++) { - add_remove_test1 (); - } - g_print ("add/remove test1 %d in thread %ld\n", iters, vmsize () - usage1); - - for (i = 0; i < iters; i++) { - add_remove_test2 (); - } - g_print ("add/remove test2 %d in thread %ld\n", iters, vmsize () - usage1); - - for (i = 0; i < iters; i++) { - add_remove_test3 (); - } - g_print ("add/destroy/remove test3 %d in thread %ld\n", iters, - vmsize () - usage1); - - for (i = 0; i < iters; i++) { - add_remove_test4 (); - } - g_print ("add/destroy/remove test4 %d in thread %ld\n", iters, - vmsize () - usage1); - - g_print ("leaked: %ld\n", vmsize () - usage1); - - return (vmsize () - usage1 ? -1 : 0); -} diff --git a/tests/old/testsuite/registry/Makefile.am b/tests/old/testsuite/registry/Makefile.am deleted file mode 100644 index a95436eaa1..0000000000 --- a/tests/old/testsuite/registry/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -include ../Rules - -tests_pass = gst-print-formats -tests_fail = -tests_ignore = - - diff --git a/tests/old/testsuite/registry/gst-print-formats.c b/tests/old/testsuite/registry/gst-print-formats.c deleted file mode 100644 index 8faeec6247..0000000000 --- a/tests/old/testsuite/registry/gst-print-formats.c +++ /dev/null @@ -1,347 +0,0 @@ -/* GStreamer - * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu> - * 2000 Wim Taymans <wtay@chello.be> - * 2004 Thomas Vander Stichele <thomas@apestaart.org> - * - * gst-inspect.c: tool to inspect the GStreamer registry - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include <gst/gst.h> - -#include "gst/gst-i18n-app.h" - -#include <string.h> -#include <locale.h> -#include <glib/gprintf.h> - -#define static - -static void -print_pad_templates_info (GstElement * element, GstElementFactory * factory, - GstPadDirection dir) -{ - GstElementClass *gstelement_class; - const GList *pads; - GstPadTemplate *padtemplate; - - if (!factory->numpadtemplates) { - return; - } - - gstelement_class = GST_ELEMENT_CLASS (G_OBJECT_GET_CLASS (element)); - - pads = factory->padtemplates; - while (pads) { - padtemplate = (GstPadTemplate *) (pads->data); - pads = g_list_next (pads); - - if (padtemplate->direction == dir) { - if (padtemplate->caps) { - GstStructure *structure; - int i; - - for (i = 0; i < gst_caps_get_size (padtemplate->caps); i++) { - structure = gst_caps_get_structure (padtemplate->caps, i); - g_print (" %s\n", gst_structure_get_name (structure)); - } - } - } - } -} - -static void -print_element_list (const char *klass, GstPadDirection dir) -{ - GList *plugins; - - g_print ("Elements in %s:\n", klass); - for (plugins = gst_registry_pool_plugin_list (); plugins; - plugins = g_list_next (plugins)) { - GList *features; - GstPlugin *plugin; - - plugin = (GstPlugin *) (plugins->data); - - features = gst_plugin_get_feature_list (plugin); - while (features) { - GstPluginFeature *feature; - - feature = GST_PLUGIN_FEATURE (features->data); - - if (GST_IS_ELEMENT_FACTORY (feature)) { - GstElementFactory *factory; - GstElement *element; - - factory = GST_ELEMENT_FACTORY (feature); - if (strncmp (factory->details.klass, klass, strlen (klass)) == 0) { - g_print (" %s: %s (%d)\n", GST_PLUGIN_FEATURE_NAME (factory), - factory->details.longname, gst_plugin_feature_get_rank (feature)); - element = gst_element_factory_create (factory, NULL); - print_pad_templates_info (element, factory, dir); - gst_object_unref (GST_OBJECT (element)); - } - } - - features = g_list_next (features); - } - } - g_print ("\n"); -} - -static void -print_typefind_list (void) -{ - GList *plugins; - - g_print ("Typefind list:\n"); - for (plugins = gst_registry_pool_plugin_list (); plugins; - plugins = g_list_next (plugins)) { - GList *features; - GstPlugin *plugin; - - plugin = (GstPlugin *) (plugins->data); - - features = gst_plugin_get_feature_list (plugin); - while (features) { - GstPluginFeature *feature; - - feature = GST_PLUGIN_FEATURE (features->data); - - if (GST_IS_TYPE_FIND_FACTORY (feature)) { - GstTypeFindFactory *factory; - char *s; - - gst_plugin_load_file (plugin->filename, NULL); - - factory = GST_TYPE_FIND_FACTORY (feature); - g_print (" %s: (%d)\n", GST_PLUGIN_FEATURE_NAME (factory), - gst_plugin_feature_get_rank (feature)); - s = gst_caps_to_string (gst_type_find_factory_get_caps (factory)); - g_print (" %s\n", s); - g_free (s); - } - - features = g_list_next (features); - } - } - g_print ("\n"); -} - -static int -list_sort_func (gconstpointer a, gconstpointer b) -{ - return strcmp ((const char *) a, (const char *) b); -} - -static GList * -get_typefind_mime_list (void) -{ - GList *plugins; - GList *mime_list = NULL; - - for (plugins = gst_registry_pool_plugin_list (); plugins; - plugins = g_list_next (plugins)) { - GList *features; - GstPlugin *plugin; - - plugin = (GstPlugin *) (plugins->data); - - features = gst_plugin_get_feature_list (plugin); - while (features) { - GstPluginFeature *feature; - - feature = GST_PLUGIN_FEATURE (features->data); - - if (GST_IS_TYPE_FIND_FACTORY (feature)) { - GstTypeFindFactory *factory; - char *s; - int i; - const GstCaps *caps; - - factory = GST_TYPE_FIND_FACTORY (feature); - caps = gst_type_find_factory_get_caps (factory); - - if (gst_plugin_feature_get_rank (feature) > 0 && caps != NULL) { - for (i = 0; i < gst_caps_get_size (caps); i++) { - const GstStructure *structure = gst_caps_get_structure (caps, i); - - s = g_strdup (gst_structure_get_name (structure)); - mime_list = g_list_prepend (mime_list, s); - } - } - } - - features = g_list_next (features); - } - } - - return mime_list; -} - -GList * -g_list_uniqify (GList * list) -{ - GList *item; - - for (item = g_list_first (list); item; item = g_list_next (item)) { - GList *next_item = g_list_next (item); - - while (next_item && strcmp (item->data, next_item->data) == 0) { - g_free (next_item->data); - list = g_list_delete_link (list, next_item); - next_item = g_list_next (item); - } - } - - return list; -} - -static GList * -get_pad_templates_info (GstElement * element, GstElementFactory * factory, - GstPadDirection dir) -{ - GstElementClass *gstelement_class; - const GList *pads; - GstPadTemplate *padtemplate; - GList *mime_list = NULL; - - if (!factory->numpadtemplates) { - return NULL; - } - - gstelement_class = GST_ELEMENT_CLASS (G_OBJECT_GET_CLASS (element)); - - pads = factory->padtemplates; - while (pads) { - padtemplate = (GstPadTemplate *) (pads->data); - pads = g_list_next (pads); - - if (padtemplate->direction == dir) { - if (padtemplate->caps) { - GstStructure *structure; - int i; - - for (i = 0; i < gst_caps_get_size (padtemplate->caps); i++) { - structure = gst_caps_get_structure (padtemplate->caps, i); - mime_list = g_list_prepend (mime_list, - g_strdup (gst_structure_get_name (structure))); - } - } - } - } - return mime_list; -} - -static GList * -get_element_mime_list (const char *klass, GstPadDirection dir) -{ - GList *mime_list = NULL; - GList *plugins; - - for (plugins = gst_registry_pool_plugin_list (); plugins; - plugins = g_list_next (plugins)) { - GList *features; - GstPlugin *plugin; - - plugin = (GstPlugin *) (plugins->data); - - features = gst_plugin_get_feature_list (plugin); - while (features) { - GstPluginFeature *feature; - - feature = GST_PLUGIN_FEATURE (features->data); - - if (GST_IS_ELEMENT_FACTORY (feature)) { - GstElementFactory *factory; - GstElement *element; - - factory = GST_ELEMENT_FACTORY (feature); - if (strncmp (factory->details.klass, klass, strlen (klass)) == 0) { - if (gst_plugin_feature_get_rank (feature) > 0) { - GList *list; - - element = gst_element_factory_create (factory, NULL); - list = get_pad_templates_info (element, factory, dir); - mime_list = g_list_concat (mime_list, list); - gst_object_unref (GST_OBJECT (element)); - } - } - } - - features = g_list_next (features); - } - } - - return mime_list; -} - -static void -print_mime_list (void) -{ - GList *list; - GList *typefind_list; - GList *item; - GList *item2; - - typefind_list = get_typefind_mime_list (); - typefind_list = g_list_sort (typefind_list, list_sort_func); - typefind_list = g_list_uniqify (typefind_list); - - list = get_element_mime_list ("Codec/Demuxer", GST_PAD_SINK); - list = g_list_concat (list, get_element_mime_list ("Codec/Decoder", - GST_PAD_SINK)); - list = g_list_sort (list, list_sort_func); - list = g_list_uniqify (list); - - g_print ("MIME media type list:\n"); - for (item = g_list_first (list); item; item = g_list_next (item)) { - for (item2 = g_list_first (typefind_list); item2; - item2 = g_list_next (item2)) { - if (strcmp ((char *) item->data, (char *) item2->data) == 0) { - g_print (" %s\n", (char *) item->data); - } - } - } -} - - -int -main (int argc, char *argv[]) -{ - -#ifdef GETTEXT_PACKAGE - bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); - bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); - textdomain (GETTEXT_PACKAGE); -#endif - - gst_init (&argc, &argv); - - print_element_list ("Codec/Demuxer", GST_PAD_SINK); - print_element_list ("Codec/Decoder", GST_PAD_SINK); - print_element_list ("Codec/Muxer", GST_PAD_SRC); - print_element_list ("Codec/Encoder", GST_PAD_SRC); - print_typefind_list (); - print_mime_list (); - - return 0; -} diff --git a/tests/old/testsuite/schedulers/.gitignore b/tests/old/testsuite/schedulers/.gitignore deleted file mode 100644 index af15adb8b0..0000000000 --- a/tests/old/testsuite/schedulers/.gitignore +++ /dev/null @@ -1,17 +0,0 @@ -group_link -relink_sink -relink_src -unlink_sink -unlink_src -unref_sink -unref_src -useless_iteration -143777 -143777-2 -142183 -142183-2 -147713 -147819 -147894 -147894-2 -queue_link diff --git a/tests/old/testsuite/schedulers/142183-2.c b/tests/old/testsuite/schedulers/142183-2.c deleted file mode 100644 index c472974654..0000000000 --- a/tests/old/testsuite/schedulers/142183-2.c +++ /dev/null @@ -1,72 +0,0 @@ -/* GStreamer - * Copyright (C) 2004 Wim Taymans <wim@fluendo.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <gst/gst.h> - -static void -handoff_identity (GstElement * element) -{ - GstBin *parent; - - parent = GST_BIN (gst_element_get_parent (element)); - g_print ("identity handoff\n"); - /* element is unreffed and destroyed here, which will cause - * an assert */ - gst_bin_remove (parent, element); -} - -gint -main (gint argc, gchar ** argv) -{ - GstElement *pipeline, *src, *sink, *id; - - gst_init (&argc, &argv); - - g_print ("setting up...\n"); - /* setup pipeline */ - pipeline = gst_element_factory_make ("pipeline", NULL); - g_assert (pipeline); - src = gst_element_factory_make ("fakesrc", NULL); - g_assert (src); - id = gst_element_factory_make ("identity", NULL); - g_assert (id); - g_signal_connect (G_OBJECT (id), "handoff", (GCallback) handoff_identity, - NULL); - g_object_set (G_OBJECT (id), "loop-based", TRUE, NULL); - - sink = gst_element_factory_make ("fakesink", NULL); - g_assert (sink); - - gst_bin_add_many (GST_BIN (pipeline), src, id, sink, NULL); - gst_element_link_pads (src, "src", id, "sink"); - gst_element_link_pads (id, "src", sink, "sink"); - - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) - g_assert_not_reached (); - - gst_bin_iterate (GST_BIN (pipeline)); - gst_bin_iterate (GST_BIN (pipeline)); - g_print ("got past iteration, scheduler refs elements correctly\n"); - - g_print ("cleaning up...\n"); - gst_object_unref (GST_OBJECT (pipeline)); - src = id = sink = pipeline = NULL; - - g_print ("done.\n"); - return 0; -} diff --git a/tests/old/testsuite/schedulers/142183.c b/tests/old/testsuite/schedulers/142183.c deleted file mode 100644 index 8f56faf9a0..0000000000 --- a/tests/old/testsuite/schedulers/142183.c +++ /dev/null @@ -1,94 +0,0 @@ -/* GStreamer - * Copyright (C) 2004 Wim Taymans <wim@fluendo.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <unistd.h> - -#include <gst/gst.h> - -static void -handoff_identity (GstElement * element) -{ - GstBin *parent; - - parent = GST_BIN (gst_element_get_parent (element)); - g_print ("identity handoff\n"); - gst_bin_remove (parent, element); -} - -gint -main (gint argc, gchar ** argv) -{ - GstElement *pipeline, *src, *sink, *id; - - gst_init (&argc, &argv); - - g_print ("setting up...\n"); - /* setup pipeline */ - pipeline = gst_element_factory_make ("pipeline", NULL); - g_assert (pipeline); - src = gst_element_factory_make ("fakesrc", NULL); - g_assert (src); - id = gst_element_factory_make ("identity", NULL); - g_assert (id); - /* ref object here as it will be unparented and destroyed in the - * handoff signal, normally the scheduler should keep a ref to the - * currently scheduled elements but that's another bug displayed in - * 142183-2.c */ - gst_object_ref (GST_OBJECT (id)); - g_signal_connect (G_OBJECT (id), "handoff", (GCallback) handoff_identity, - NULL); - g_object_set (G_OBJECT (id), "loop-based", TRUE, NULL); - - sink = gst_element_factory_make ("fakesink", NULL); - g_assert (sink); - - gst_bin_add_many (GST_BIN (pipeline), src, id, sink, NULL); - /* this is what triggers the bug */ - gst_element_enable_threadsafe_properties (GST_ELEMENT (src)); - gst_element_enable_threadsafe_properties (GST_ELEMENT (id)); - gst_element_enable_threadsafe_properties (GST_ELEMENT (sink)); - - gst_element_link_pads (src, "src", id, "sink"); - gst_element_link_pads (id, "src", sink, "sink"); - - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) - g_assert_not_reached (); - - gst_bin_iterate (GST_BIN (pipeline)); - gst_bin_iterate (GST_BIN (pipeline)); - - /* 'cause we're going into deadlock mode */ - alarm (5); - - g_print ("adding identity back...\n"); - /* add identity back in */ - gst_bin_add_many (GST_BIN (pipeline), id, NULL); - - g_print ("going into possible deadlock... alarm at 5 seconds\n"); - gst_bin_iterate (GST_BIN (pipeline)); - gst_bin_iterate (GST_BIN (pipeline)); - g_print ("ok, no deadlock. bug 142183 fixed!\n"); - - g_print ("cleaning up...\n"); - gst_object_unref (GST_OBJECT (pipeline)); - gst_object_unref (GST_OBJECT (id)); - src = id = sink = pipeline = NULL; - - g_print ("done.\n"); - return 0; -} diff --git a/tests/old/testsuite/schedulers/143777-2.c b/tests/old/testsuite/schedulers/143777-2.c deleted file mode 100644 index 399bff2039..0000000000 --- a/tests/old/testsuite/schedulers/143777-2.c +++ /dev/null @@ -1,61 +0,0 @@ - -#include <gst/gst.h> - -int -main (int argc, char **argv) -{ - GstElement *src, *sink, *enc, *tee; - GstElement *pipeline; - int i; - - - gst_init (&argc, &argv); - pipeline = gst_element_factory_make ("pipeline", "pipeline"); - - src = gst_element_factory_make ("fakesrc", "src"); - g_assert (src); - tee = gst_element_factory_make ("tee", "tee1"); - g_assert (tee); - enc = gst_element_factory_make ("identity", "enc"); - g_assert (enc); - sink = gst_element_factory_make ("fakesink", "sink"); - g_assert (sink); - - gst_bin_add_many (GST_BIN (pipeline), src, tee, enc, sink, NULL); - if (!gst_element_link_many (src, tee, enc, sink, NULL)) - g_assert_not_reached (); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) - g_assert_not_reached (); - - for (i = 0; i < 5; i++) { - if (!gst_bin_iterate (GST_BIN (pipeline))) - g_assert_not_reached (); - g_print ("%d\n", i); - } - - if (gst_element_set_state (pipeline, GST_STATE_PAUSED) != GST_STATE_SUCCESS) - g_assert_not_reached (); - gst_element_unlink_many (tee, enc, sink, NULL); - gst_bin_remove_many (GST_BIN (pipeline), enc, sink, NULL); - - enc = gst_element_factory_make ("identity", "enc"); - g_assert (enc); - sink = gst_element_factory_make ("fakesink", "sink"); - g_assert (sink); - gst_bin_add_many (GST_BIN (pipeline), enc, sink, NULL); - if (!gst_element_link_many (tee, enc, sink, NULL)) - g_assert_not_reached (); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) - g_assert_not_reached (); - - for (i = 5; i < 10; i++) { - if (!gst_bin_iterate (GST_BIN (pipeline))) - g_assert_not_reached (); - g_print ("%d\n", i); - } - g_print ("cleaning up...\n"); - gst_object_unref (GST_OBJECT (pipeline)); - - g_print ("done.\n"); - return 0; -} diff --git a/tests/old/testsuite/schedulers/143777.c b/tests/old/testsuite/schedulers/143777.c deleted file mode 100644 index 9c33d6ba7c..0000000000 --- a/tests/old/testsuite/schedulers/143777.c +++ /dev/null @@ -1,72 +0,0 @@ -/* GStreamer - * Copyright (C) 2004 Benjamin Otte <otte@gnome.org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -/* - * This file reproduces the bug in the bugreport #143777, as can be seen at - * http://bugzilla.gnome.org/show_bug.cgi?id=143777 - the issue is that when - * pausing a pipeline while the chainhandler is still running, then unlinking - * the pad that's chain function is called and relinking it clears the buffer - * that was stored for sending the event. gst_pad_call_chain_function needs - * to check that. - * The fix is in gstpad.c, revision 1.327 - */ - -#include <gst/gst.h> - -gint -main (gint argc, gchar ** argv) -{ - GstElement *pipeline, *src, *sink, *id; - guint i = 0, j; - - gst_init (&argc, &argv); - - g_print ("setting up...\n"); - /* setup pipeline */ - pipeline = gst_element_factory_make ("pipeline", NULL); - g_assert (pipeline); - src = gst_element_factory_make ("fakesrc", NULL); - g_assert (src); - id = gst_element_factory_make ("identity", NULL); - g_assert (id); - sink = gst_element_factory_make ("fakesink", NULL); - g_assert (sink); - - gst_bin_add_many (GST_BIN (pipeline), src, id, sink, NULL); - while (i < 100) { - g_print ("running... (%d iterations)\n", i); - if (gst_element_set_state (pipeline, - GST_STATE_PLAYING) != GST_STATE_SUCCESS) - g_assert_not_reached (); - gst_element_link_many (src, id, sink, NULL); - for (j = 0; j < i; j++) - gst_bin_iterate (GST_BIN (pipeline)); - if (gst_element_set_state (pipeline, GST_STATE_PAUSED) != GST_STATE_SUCCESS) - g_assert_not_reached (); - gst_element_unlink_many (src, id, sink, NULL); - i++; - } - - g_print ("cleaning up...\n"); - g_assert (i == 100); - gst_object_unref (GST_OBJECT (pipeline)); - src = id = sink = pipeline = NULL; - - g_print ("done.\n"); - return 0; -} diff --git a/tests/old/testsuite/schedulers/147713.c b/tests/old/testsuite/schedulers/147713.c deleted file mode 100644 index 0a2dc07dfa..0000000000 --- a/tests/old/testsuite/schedulers/147713.c +++ /dev/null @@ -1,89 +0,0 @@ -/* GStreamer - * Copyright (C) 2004 Wim Taymanse <wim@fluendo.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <gst/gst.h> - -static gint src_handoff = 0; - -static void -handoff_src (GstElement * element) -{ - g_print ("src handoff\n"); - src_handoff++; -} - -static void -handoff_sink (GstElement * element) -{ - g_print ("sink handoff\n"); - g_assert (src_handoff == 1); -} - -gint -main (gint argc, gchar ** argv) -{ - GstElement *pipeline, *src, *sink, *id1, *id2; - - gst_init (&argc, &argv); - - g_print ("setting up...\n"); - /* setup pipeline */ - pipeline = gst_element_factory_make ("pipeline", NULL); - g_assert (pipeline); - src = gst_element_factory_make ("fakesrc", NULL); - g_assert (src); - g_object_set (G_OBJECT (src), "signal-handoffs", TRUE, NULL); - g_signal_connect (G_OBJECT (src), "handoff", (GCallback) handoff_src, NULL); - id1 = gst_element_factory_make ("identity", NULL); - g_assert (id1); - - id2 = gst_element_factory_make ("identity", NULL); - g_assert (id2); - g_object_set (G_OBJECT (id2), "loop-based", TRUE, NULL); - - sink = gst_element_factory_make ("fakesink", NULL); - g_assert (sink); - g_object_set (G_OBJECT (sink), "signal-handoffs", TRUE, NULL); - g_signal_connect (G_OBJECT (sink), "handoff", (GCallback) handoff_sink, NULL); - - gst_bin_add_many (GST_BIN (pipeline), src, id1, NULL); - gst_element_link_pads (src, "src", id1, "sink"); - - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) - g_assert_not_reached (); - - if (gst_element_set_state (id2, GST_STATE_PLAYING) != GST_STATE_SUCCESS) - g_assert_not_reached (); - if (gst_element_set_state (sink, GST_STATE_PLAYING) != GST_STATE_SUCCESS) - g_assert_not_reached (); - - gst_bin_add_many (GST_BIN (pipeline), sink, NULL); - gst_element_link_pads (id2, "src", sink, "sink"); - gst_element_link_pads (id1, "src", id2, "sink"); - gst_bin_add_many (GST_BIN (pipeline), id2, NULL); - - gst_bin_iterate (GST_BIN (pipeline)); - gst_bin_iterate (GST_BIN (pipeline)); - - g_print ("cleaning up...\n"); - gst_object_unref (GST_OBJECT (pipeline)); - src = id1 = id2 = sink = pipeline = NULL; - - g_print ("done.\n"); - return 0; -} diff --git a/tests/old/testsuite/schedulers/147819.c b/tests/old/testsuite/schedulers/147819.c deleted file mode 100644 index d8b30b337b..0000000000 --- a/tests/old/testsuite/schedulers/147819.c +++ /dev/null @@ -1,100 +0,0 @@ -/* GStreamer - * Copyright (C) 2004 Wim Taymans <wim@fluendo.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <unistd.h> - -#include <gst/gst.h> - -static gboolean handoff; - -static void -handoff_identity1 (GstElement * element) -{ - g_print ("identity1 handoff\n"); - handoff = TRUE; -} - -static void -handoff_identity2 (GstElement * element) -{ - g_print ("identity2 handoff\n"); - handoff = TRUE; -} - -gint -main (gint argc, gchar ** argv) -{ - GstElement *pipeline, *src, *sink, *id1, *id2; - - gst_init (&argc, &argv); - - g_print ("setting up...\n"); - /* setup pipeline */ - pipeline = gst_element_factory_make ("pipeline", NULL); - g_assert (pipeline); - src = gst_element_factory_make ("fakesrc", NULL); - g_assert (src); - id1 = gst_element_factory_make ("identity", NULL); - g_assert (id1); - g_object_set (G_OBJECT (id1), "loop-based", TRUE, NULL); - g_object_set (G_OBJECT (id1), "duplicate", 3, NULL); - g_signal_connect (G_OBJECT (id1), "handoff", (GCallback) handoff_identity1, - NULL); - - id2 = gst_element_factory_make ("identity", NULL); - g_assert (id2); - g_object_set (G_OBJECT (id2), "loop-based", TRUE, NULL); - g_signal_connect (G_OBJECT (id2), "handoff", (GCallback) handoff_identity2, - NULL); - - sink = gst_element_factory_make ("fakesink", NULL); - g_assert (sink); - - gst_bin_add_many (GST_BIN (pipeline), src, id1, id2, sink, NULL); - - gst_element_link_pads (src, "src", id1, "sink"); - gst_element_link_pads (id1, "src", id2, "sink"); - gst_element_link_pads (id2, "src", sink, "sink"); - - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) - g_assert_not_reached (); - - g_print ("running...\n"); - gst_bin_iterate (GST_BIN (pipeline)); - gst_bin_iterate (GST_BIN (pipeline)); - gst_bin_iterate (GST_BIN (pipeline)); - - /* do ugly stuff here */ - gst_object_ref (GST_OBJECT (id1)); - gst_bin_remove (GST_BIN (pipeline), id1); - gst_element_link_pads (src, "src", id1, "sink"); - gst_element_link_pads (id1, "src", id2, "sink"); - - gst_bin_iterate (GST_BIN (pipeline)); - gst_bin_iterate (GST_BIN (pipeline)); - gst_bin_iterate (GST_BIN (pipeline)); - gst_bin_iterate (GST_BIN (pipeline)); - gst_bin_iterate (GST_BIN (pipeline)); - - g_print ("cleaning up...\n"); - gst_object_unref (GST_OBJECT (pipeline)); - src = id1 = id2 = sink = pipeline = NULL; - - g_print ("done.\n"); - return 0; -} diff --git a/tests/old/testsuite/schedulers/147894-2.c b/tests/old/testsuite/schedulers/147894-2.c deleted file mode 100644 index 4eab00b057..0000000000 --- a/tests/old/testsuite/schedulers/147894-2.c +++ /dev/null @@ -1,136 +0,0 @@ -/* GStreamer - * Copyright (C) 2004 Wim Taymans <wim@fluendo.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <unistd.h> - -#include <gst/gst.h> - -static gboolean empty; -static gboolean bug; -static gboolean handoff; -static GstElement *pipeline2; - -static void -queue_empty (GstElement * element) -{ - g_print ("queue empty\n"); - if (!handoff) - bug = TRUE; -} - -static void -queue_filled (GstElement * element) -{ - g_print ("queue filled\n"); - empty = FALSE; - - /* read from the other end */ - handoff = FALSE; - bug = FALSE; - - alarm (5); - - g_print ("emptying queue with 5 second timeout...\n"); - while (!bug && !handoff) { - gst_bin_iterate (GST_BIN (pipeline2)); - } -} - -static void -handoff_identity (GstElement * element) -{ - g_print ("identity handoff\n"); - handoff = TRUE; -} - -gint -main (gint argc, gchar ** argv) -{ - GstElement *pipeline, *src, *sink, *queue, *id; - - gst_init (&argc, &argv); - - g_print ("setting up...\n"); - /* setup pipeline */ - pipeline = gst_element_factory_make ("pipeline", NULL); - g_assert (pipeline); - src = gst_element_factory_make ("fakesrc", NULL); - g_assert (src); - queue = gst_element_factory_make ("queue", NULL); - g_assert (queue); - g_signal_connect (G_OBJECT (queue), "overrun", (GCallback) queue_filled, - NULL); - g_signal_connect (G_OBJECT (queue), "underrun", (GCallback) queue_empty, - NULL); - gst_bin_add_many (GST_BIN (pipeline), src, queue, NULL); - - gst_element_link_pads (src, "src", queue, "sink"); - - /* second pipeline for sinks */ - pipeline2 = gst_element_factory_make ("pipeline", NULL); - g_assert (pipeline2); - id = gst_element_factory_make ("identity", NULL); - g_assert (id); - g_signal_connect (G_OBJECT (id), "handoff", (GCallback) handoff_identity, - NULL); - - sink = gst_element_factory_make ("fakesink", NULL); - g_assert (sink); - gst_bin_add_many (GST_BIN (pipeline2), id, sink, NULL); - - gst_element_link_pads (queue, "src", id, "sink"); - gst_element_link_pads (id, "src", sink, "sink"); - - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) - g_assert_not_reached (); - - if (gst_element_set_state (pipeline2, GST_STATE_PLAYING) != GST_STATE_SUCCESS) - g_assert_not_reached (); - - g_print ("running...\n"); - /* fill queue */ - empty = TRUE; - while (empty) { - gst_bin_iterate (GST_BIN (pipeline)); - } - g_assert (!bug); - - g_print ("relinking...\n"); - /* now unlink and link id and sink */ - gst_element_unlink_pads (id, "src", sink, "sink"); - gst_element_link_pads (id, "src", sink, "sink"); - - g_print ("running again...\n"); - /* fill queue */ - empty = TRUE; - while (empty) { - gst_bin_iterate (GST_BIN (pipeline)); - } - g_assert (!bug); - - /* trigger the bug */ - - - g_print ("cleaning up...\n"); - gst_object_unref (GST_OBJECT (pipeline)); - gst_object_unref (GST_OBJECT (pipeline2)); - src = id = sink = pipeline = pipeline2 = NULL; - - g_print ("done.\n"); - return 0; -} diff --git a/tests/old/testsuite/schedulers/147894.c b/tests/old/testsuite/schedulers/147894.c deleted file mode 100644 index e89bf2ac2f..0000000000 --- a/tests/old/testsuite/schedulers/147894.c +++ /dev/null @@ -1,142 +0,0 @@ -/* GStreamer - * Copyright (C) 2004 Wim Taymans <wim@fluendo.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <unistd.h> - -#include <gst/gst.h> - -static gboolean empty; -static gboolean bug; -static gboolean handoff; -static GstElement *pipeline2; - -static void -queue_empty (GstElement * element) -{ - g_print ("queue empty\n"); - if (!handoff) - bug = TRUE; -} - -static void -queue_filled (GstElement * element) -{ - g_print ("queue filled\n"); - empty = FALSE; - - /* read from the other end */ - handoff = FALSE; - bug = FALSE; - - alarm (5); - - g_print ("emptying queue with 5 second timeout...\n"); - while (!bug && !handoff) { - gst_bin_iterate (GST_BIN (pipeline2)); - } -} - -static void -handoff_identity (GstElement * element) -{ - g_print ("identity handoff\n"); - handoff = TRUE; -} - -gint -main (gint argc, gchar ** argv) -{ - GstElement *pipeline, *src, *sink, *queue, *id; - - gst_init (&argc, &argv); - - g_print ("setting up...\n"); - /* setup pipeline */ - pipeline = gst_element_factory_make ("pipeline", NULL); - g_assert (pipeline); - src = gst_element_factory_make ("fakesrc", NULL); - g_assert (src); - queue = gst_element_factory_make ("queue", NULL); - g_assert (queue); - g_signal_connect (G_OBJECT (queue), "overrun", (GCallback) queue_filled, - NULL); - g_signal_connect (G_OBJECT (queue), "underrun", (GCallback) queue_empty, - NULL); - gst_bin_add_many (GST_BIN (pipeline), src, queue, NULL); - - gst_element_link_pads (src, "src", queue, "sink"); - - /* second pipeline for sinks */ - pipeline2 = gst_element_factory_make ("pipeline", NULL); - g_assert (pipeline2); - id = gst_element_factory_make ("identity", NULL); - g_assert (id); - g_signal_connect (G_OBJECT (id), "handoff", (GCallback) handoff_identity, - NULL); - - sink = gst_element_factory_make ("fakesink", NULL); - g_assert (sink); - gst_bin_add_many (GST_BIN (pipeline2), id, sink, NULL); - - gst_element_link_pads (queue, "src", id, "sink"); - gst_element_link_pads (id, "src", sink, "sink"); - - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) - g_assert_not_reached (); - - if (gst_element_set_state (pipeline2, GST_STATE_PLAYING) != GST_STATE_SUCCESS) - g_assert_not_reached (); - - g_print ("running...\n"); - /* fill queue */ - empty = TRUE; - while (empty) { - gst_bin_iterate (GST_BIN (pipeline)); - } - g_assert (!bug); - - if (gst_element_set_state (pipeline2, GST_STATE_READY) != GST_STATE_SUCCESS) - g_assert_not_reached (); - - g_print ("relinking...\n"); - /* now unlink and link id and sink */ - gst_element_unlink_pads (id, "src", sink, "sink"); - gst_element_link_pads (id, "src", sink, "sink"); - - if (gst_element_set_state (pipeline2, GST_STATE_PLAYING) != GST_STATE_SUCCESS) - g_assert_not_reached (); - - g_print ("running again...\n"); - /* fill queue */ - empty = TRUE; - while (empty) { - gst_bin_iterate (GST_BIN (pipeline)); - } - g_assert (!bug); - - /* trigger the bug */ - - - g_print ("cleaning up...\n"); - gst_object_unref (GST_OBJECT (pipeline)); - gst_object_unref (GST_OBJECT (pipeline2)); - src = id = sink = pipeline = pipeline2 = NULL; - - g_print ("done.\n"); - return 0; -} diff --git a/tests/old/testsuite/schedulers/Makefile.am b/tests/old/testsuite/schedulers/Makefile.am deleted file mode 100644 index 391ac40476..0000000000 --- a/tests/old/testsuite/schedulers/Makefile.am +++ /dev/null @@ -1,30 +0,0 @@ -include ../Rules - -tests_pass = \ - unlink_src unlink_sink \ - relink_src relink_sink \ - unref_src unref_sink \ - 142183 142183-2 \ - 143777 143777-2 \ - 147713 \ - 147819 \ - 147894 147894-2 group_link \ - queue_link - -# don't enable this one unless it actually works. -# useless_iteration -tests_fail = -tests_ignore = - -unlink_src_SOURCES = unlink.c -unlink_src_CFLAGS = $(AM_CFLAGS) -DELEMENT=src -unlink_sink_SOURCES = unlink.c -unlink_sink_CFLAGS = $(AM_CFLAGS) -DELEMENT=sink -relink_src_SOURCES = relink.c -relink_src_CFLAGS = $(AM_CFLAGS) -DELEMENT=src -DOTHER_ELEMENT=sink -relink_sink_SOURCES = relink.c -relink_sink_CFLAGS = $(AM_CFLAGS) -DELEMENT=sink -DOTHER_ELEMENT=src -unref_src_SOURCES = unref.c -unref_src_CFLAGS = $(AM_CFLAGS) -DELEMENT=src -unref_sink_SOURCES = unref.c -unref_sink_CFLAGS = $(AM_CFLAGS) -DELEMENT=sink diff --git a/tests/old/testsuite/schedulers/group_link.c b/tests/old/testsuite/schedulers/group_link.c deleted file mode 100644 index e40c84d1ba..0000000000 --- a/tests/old/testsuite/schedulers/group_link.c +++ /dev/null @@ -1,66 +0,0 @@ -/* GStreamer - * Copyright (C) 2004 Wim Taymans <wim@fluendo.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <unistd.h> - -#include <gst/gst.h> - -gint -main (gint argc, gchar ** argv) -{ - GstElement *pipeline, *src, *id1, *id2, *sink; - - gst_init (&argc, &argv); - - g_print ("setting up...\n"); - /* setup pipeline */ - pipeline = gst_element_factory_make ("pipeline", NULL); - g_assert (pipeline); - src = gst_element_factory_make ("fakesrc", NULL); - g_assert (src); - id1 = gst_element_factory_make ("identity", NULL); - g_assert (id1); - id2 = gst_element_factory_make ("identity", NULL); - g_assert (id2); - g_object_set (G_OBJECT (id2), "loop-based", TRUE, NULL); - - sink = gst_element_factory_make ("fakesink", NULL); - g_assert (sink); - - gst_bin_add_many (GST_BIN (pipeline), src, id1, id2, sink, NULL); - - /* link is not accounted for here... */ - gst_element_link_pads (id1, "src", id2, "sink"); - - gst_element_link_pads (src, "src", id1, "sink"); - gst_element_link_pads (id2, "src", sink, "sink"); - - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) - g_assert_not_reached (); - - g_print ("running...\n"); - /* fill queue */ - gst_bin_iterate (GST_BIN (pipeline)); - - g_print ("cleaning up...\n"); - gst_object_unref (GST_OBJECT (pipeline)); - src = id1 = id2 = sink = pipeline = NULL; - - g_print ("done.\n"); - return 0; -} diff --git a/tests/old/testsuite/schedulers/queue_link.c b/tests/old/testsuite/schedulers/queue_link.c deleted file mode 100644 index f14d7b53e8..0000000000 --- a/tests/old/testsuite/schedulers/queue_link.c +++ /dev/null @@ -1,68 +0,0 @@ -/* GStreamer - * Copyright (C) 2004 Wim Taymans <wim@fluendo.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <unistd.h> - -#include <gst/gst.h> - -gint -main (gint argc, gchar ** argv) -{ - GstElement *pipeline, *thread, *bin, *src, *queue, *id1, *sink; - - gst_init (&argc, &argv); - - g_print ("setting up...\n"); - /* setup pipeline */ - pipeline = gst_element_factory_make ("pipeline", NULL); - g_assert (pipeline); - src = gst_element_factory_make ("fakesrc", NULL); - g_assert (src); - queue = gst_element_factory_make ("queue", NULL); - g_assert (queue); - - thread = gst_element_factory_make ("thread", NULL); - g_assert (thread); - bin = gst_element_factory_make ("bin", NULL); - g_assert (bin); - id1 = gst_element_factory_make ("identity", NULL); - g_assert (id1); - sink = gst_element_factory_make ("fakesink", NULL); - g_assert (sink); - - gst_bin_add_many (GST_BIN (bin), id1, sink, NULL); - gst_bin_add_many (GST_BIN (thread), bin, NULL); - gst_bin_add_many (GST_BIN (pipeline), src, queue, thread, NULL); - - gst_element_link_pads (src, "src", queue, "sink"); - gst_element_link_pads (queue, "src", id1, "sink"); - gst_element_link_pads (id1, "src", sink, "sink"); - - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) - g_assert_not_reached (); - - g_print ("unlinking...\n"); - - gst_object_ref (GST_OBJECT (queue)); - gst_bin_remove (GST_BIN (pipeline), queue); - gst_object_ref (GST_OBJECT (bin)); - gst_bin_remove (GST_BIN (thread), bin); - - g_print ("done.\n"); - return 0; -} diff --git a/tests/old/testsuite/schedulers/relink.c b/tests/old/testsuite/schedulers/relink.c deleted file mode 100644 index a76daf0df1..0000000000 --- a/tests/old/testsuite/schedulers/relink.c +++ /dev/null @@ -1,73 +0,0 @@ -/* GStreamer - * Copyright (C) 2004 Benjamin Otte <in7y118@public.uni-hamburg.de> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <gst/gst.h> - -GstElement *pipeline, *src, *sink; - -static void -cb_handoff (GstElement * element, GstBuffer * buffer, GstPad * pad, - gpointer unused) -{ - if (GST_PAD_PEER (pad)) { - g_print ("relinking...\n"); - gst_pad_unlink (pad, GST_PAD_PEER (pad)); - gst_bin_remove (GST_BIN (pipeline), OTHER_ELEMENT); - OTHER_ELEMENT = - gst_element_factory_make ("fake" G_STRINGIFY (OTHER_ELEMENT), NULL); - g_assert (OTHER_ELEMENT); - gst_bin_add (GST_BIN (pipeline), OTHER_ELEMENT); - gst_element_sync_state_with_parent (OTHER_ELEMENT); - gst_element_link (ELEMENT, OTHER_ELEMENT); - } -} - -gint -main (gint argc, gchar ** argv) -{ - guint i = 0; - - gst_init (&argc, &argv); - - g_print ("setting up...\n"); - /* setup pipeline */ - pipeline = gst_element_factory_make ("pipeline", NULL); - g_assert (pipeline); - src = gst_element_factory_make ("fakesrc", NULL); - g_assert (src); - sink = gst_element_factory_make ("fakesink", NULL); - g_assert (sink); - gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL); - gst_element_link (src, sink); - /* setup special stuff */ - g_object_set (ELEMENT, "signal-handoffs", TRUE, NULL); - g_signal_connect (ELEMENT, "handoff", (GCallback) cb_handoff, NULL); - - /* run pipeline */ - g_print ("running...\n"); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) - g_assert_not_reached (); - while (i++ < 10 && gst_bin_iterate (GST_BIN (pipeline))); - - g_print ("cleaning up...\n"); - gst_object_unref (GST_OBJECT (pipeline)); - pipeline = NULL; - - g_print ("done.\n"); - return 0; -} diff --git a/tests/old/testsuite/schedulers/unlink.c b/tests/old/testsuite/schedulers/unlink.c deleted file mode 100644 index 11ae3e5c12..0000000000 --- a/tests/old/testsuite/schedulers/unlink.c +++ /dev/null @@ -1,64 +0,0 @@ -/* GStreamer - * Copyright (C) 2004 Benjamin Otte <in7y118@public.uni-hamburg.de> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <gst/gst.h> - -static void -cb_handoff (GstElement * element, GstBuffer * buffer, GstPad * pad, - gpointer unused) -{ - if (GST_PAD_PEER (pad)) { - g_print ("unlinking...\n"); - gst_pad_unlink (pad, GST_PAD_PEER (pad)); - } -} - -gint -main (gint argc, gchar ** argv) -{ - GstElement *pipeline, *src, *sink; - - gst_init (&argc, &argv); - - g_print ("setting up...\n"); - /* setup pipeline */ - pipeline = gst_element_factory_make ("pipeline", NULL); - g_assert (pipeline); - src = gst_element_factory_make ("fakesrc", NULL); - g_assert (src); - sink = gst_element_factory_make ("fakesink", NULL); - g_assert (sink); - gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL); - gst_element_link (src, sink); - /* setup special stuff */ - g_object_set (ELEMENT, "signal-handoffs", TRUE, NULL); - g_signal_connect (ELEMENT, "handoff", (GCallback) cb_handoff, NULL); - - /* run pipeline */ - g_print ("running...\n"); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) - g_assert_not_reached (); - while (gst_bin_iterate (GST_BIN (pipeline))); - - g_print ("cleaning up...\n"); - gst_object_unref (GST_OBJECT (pipeline)); - pipeline = NULL; - - g_print ("done.\n"); - return 0; -} diff --git a/tests/old/testsuite/schedulers/unref.c b/tests/old/testsuite/schedulers/unref.c deleted file mode 100644 index 543620a7ac..0000000000 --- a/tests/old/testsuite/schedulers/unref.c +++ /dev/null @@ -1,61 +0,0 @@ -/* GStreamer - * Copyright (C) 2004 Benjamin Otte <in7y118@public.uni-hamburg.de> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <gst/gst.h> - -GstElement *pipeline, *src, *sink; - -static void -cb_handoff (GstElement * element, GstBuffer * buffer, GstPad * pad, - gpointer unused) -{ - if (pipeline) { - g_print ("unreffing...\n"); - gst_object_unref (GST_OBJECT (pipeline)); - pipeline = NULL; - } -} - -gint -main (gint argc, gchar ** argv) -{ - gst_init (&argc, &argv); - - g_print ("setting up...\n"); - /* setup pipeline */ - pipeline = gst_element_factory_make ("pipeline", NULL); - g_assert (pipeline); - src = gst_element_factory_make ("fakesrc", NULL); - g_assert (src); - sink = gst_element_factory_make ("fakesink", NULL); - g_assert (sink); - gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL); - gst_element_link (src, sink); - /* setup special stuff */ - g_object_set (ELEMENT, "signal-handoffs", TRUE, NULL); - g_signal_connect (ELEMENT, "handoff", (GCallback) cb_handoff, NULL); - - /* run pipeline */ - g_print ("running...\n"); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) - g_assert_not_reached (); - while (pipeline && gst_bin_iterate (GST_BIN (pipeline))); - - g_print ("done.\n"); - return 0; -} diff --git a/tests/old/testsuite/schedulers/useless_iteration.c b/tests/old/testsuite/schedulers/useless_iteration.c deleted file mode 100644 index d064c648c6..0000000000 --- a/tests/old/testsuite/schedulers/useless_iteration.c +++ /dev/null @@ -1,50 +0,0 @@ -/* GStreamer - * Copyright (C) 2004 Benjamin Otte <in7y118@public.uni-hamburg.de> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <gst/gst.h> - -gint -main (gint argc, gchar ** argv) -{ - GstElement *pipeline; - GError *error = NULL; - guint i = 0; - - gst_init (&argc, &argv); - - g_print ("setting up...\n"); - /* setup pipeline */ - pipeline = gst_parse_launch ("pipeline.( { fakesrc ! fakesink } )", &error); - g_assert (error == NULL); - g_assert (pipeline); - - /* run pipeline */ - g_print ("running...\n"); - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) - g_assert_not_reached (); - while (i < 100 && gst_bin_iterate (GST_BIN (pipeline))) - i++; - - g_print ("cleaning up... (%d iterations)\n", i); - g_assert (i == 100); - gst_object_unref (GST_OBJECT (pipeline)); - pipeline = NULL; - - g_print ("done.\n"); - return 0; -} diff --git a/tests/old/testsuite/states/.gitignore b/tests/old/testsuite/states/.gitignore deleted file mode 100644 index 9d274cca42..0000000000 --- a/tests/old/testsuite/states/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -Makefile -Makefile.in -*.o -*.lo -*.la -.deps -.libs - -bin -locked -parent diff --git a/tests/old/testsuite/states/Makefile.am b/tests/old/testsuite/states/Makefile.am deleted file mode 100644 index 2a01e7553e..0000000000 --- a/tests/old/testsuite/states/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -include ../Rules - -tests_pass = locked parent -tests_fail = -tests_ignore = bin diff --git a/tests/old/testsuite/states/bin.c b/tests/old/testsuite/states/bin.c deleted file mode 100644 index 65cb308ed9..0000000000 --- a/tests/old/testsuite/states/bin.c +++ /dev/null @@ -1,150 +0,0 @@ -/* GStreamer - * Copyright (C) <2004> Benjamin Otte <otte@gnome.org> - * - * bin.c: - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include <gst/gst.h> - -#define RETURN_NAME(x) ((x) == GST_STATE_SUCCESS ? "GST_STATE_SUCCESS" : \ - (x) == GST_STATE_ASYNC ? "GST_STATE_ASYNC" : "GST_STATE_FAILURE") -static void -assert_state (GstElement * element, GstElementState state) -{ - if (gst_element_get_state (element) != state) { - g_printerr ("%s: state is %s instead of %s", - GST_OBJECT_NAME (element), - gst_element_state_get_name (GST_STATE (element)), - gst_element_state_get_name (state)); - g_assert_not_reached (); - } -} - -static void -assert_state_change (GstElement * element, GstElementState new_state, - GstElementStateReturn result, GstElementState result_state) -{ - GstElementStateReturn ret = gst_element_set_state (element, new_state); - - if (ret != result) { - g_printerr ("%s: change state to %s returned %s instead of %s", - GST_OBJECT_NAME (element), gst_element_state_get_name (new_state), - RETURN_NAME (ret), RETURN_NAME (result)); - g_assert_not_reached (); - } - assert_state (element, result_state); -} - -static void -empty_bin (gchar * bin_name) -{ - /* Test the behaviour of empty bins. Since a bin's state is always the state - * of its highest child, nothing should change in here - * Return values when no error occured but the state didn't change should be - * GST_STATE_ASYNC */ - GstElement *bin = gst_element_factory_make (bin_name, NULL); - - /* obvious */ - assert_state (bin, GST_STATE_NULL); - /* see above */ - assert_state_change (bin, GST_STATE_READY, GST_STATE_ASYNC, GST_STATE_NULL); - assert_state_change (bin, GST_STATE_PAUSED, GST_STATE_ASYNC, GST_STATE_NULL); - assert_state_change (bin, GST_STATE_PLAYING, GST_STATE_ASYNC, GST_STATE_NULL); -} - -static void -test_adding_one_element (GstElement * bin) -{ - /* Tests behaviour of adding/removing elements to/from bins. It makes sure the - * state of the bin is always the highest of all contained children. */ - GstElementState test_states[] = { GST_STATE_READY, GST_STATE_PAUSED, - GST_STATE_PLAYING, GST_STATE_PAUSED, GST_STATE_READY, GST_STATE_NULL - }; - GstElement *test = gst_element_factory_make ("identity", NULL); - GstElementState bin_state = gst_element_get_state (bin); - gint i; - - g_assert (test); - gst_object_ref (GST_OBJECT (test)); - assert_state (test, GST_STATE_NULL); - gst_bin_add (GST_BIN (bin), test); - assert_state (bin, MAX (bin_state, GST_STATE_NULL)); - for (i = 0; i < G_N_ELEMENTS (test_states); i++) { - GstElementState test_state = test_states[i]; - - assert_state_change (test, test_state, GST_STATE_SUCCESS, test_state); - assert_state (test, test_state); - assert_state (bin, MAX (bin_state, test_state)); - gst_bin_remove (GST_BIN (bin), test); - assert_state (bin, bin_state); - gst_bin_add (GST_BIN (bin), test); - assert_state (test, test_state); - assert_state (bin, MAX (bin_state, test_state)); - } - gst_bin_remove (GST_BIN (bin), test); - gst_object_unref (GST_OBJECT (test)); - assert_state (bin, bin_state); -} - -static void -test_element_in_bin (gchar * bin_name) -{ - gint i; - GstElementState test_states[] = { GST_STATE_NULL, GST_STATE_READY, - GST_STATE_PAUSED, GST_STATE_PLAYING - }; - GstElement *id, *bin = gst_element_factory_make (bin_name, NULL); - - g_assert (bin); - - /* test correct behaviour in empty bins */ - test_adding_one_element (bin); - - id = gst_element_factory_make ("identity", NULL); - g_assert (id); - assert_state (id, GST_STATE_NULL); - gst_bin_add (GST_BIN (bin), id); - /* test correct behaviour in bins which contain elements in various states */ - for (i = 0; i < G_N_ELEMENTS (test_states); i++) { - GstElementState test_state = test_states[i]; - - assert_state_change (bin, test_state, GST_STATE_SUCCESS, test_state); - assert_state (id, test_state); - test_adding_one_element (bin); - } - - gst_object_unref (GST_OBJECT (bin)); -} - -gint -main (gint argc, gchar * argv[]) -{ - gst_init (&argc, &argv); - - /* test behaviour of empty bins */ - empty_bin ("bin"); - empty_bin ("thread"); - empty_bin ("pipeline"); - - /* test behaviour of adding/removing elements to/from all core bin types */ - test_element_in_bin ("bin"); - test_element_in_bin ("thread"); - test_element_in_bin ("pipeline"); - - return 0; -} diff --git a/tests/old/testsuite/states/locked.c b/tests/old/testsuite/states/locked.c deleted file mode 100644 index ecf969ec3e..0000000000 --- a/tests/old/testsuite/states/locked.c +++ /dev/null @@ -1,69 +0,0 @@ -/* GStreamer - * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include <gst/gst.h> - -gint -main (gint argc, gchar * argv[]) -{ - GstElement *pipeline; - GstElement *fakesrc1, *fakesink1; - GstElement *fakesrc2, *fakesink2; - - gst_init (&argc, &argv); - - pipeline = gst_pipeline_new ("pipeline"); - - fakesrc1 = gst_element_factory_make ("fakesrc", "fakesrc1"); - g_object_set (G_OBJECT (fakesrc1), "num_buffers", 5, NULL); - fakesink1 = gst_element_factory_make ("fakesink", "fakesink1"); - - gst_bin_add_many (GST_BIN (pipeline), fakesrc1, fakesink1, NULL); - gst_element_link_pads (fakesrc1, "src", fakesink1, "sink"); - - fakesrc2 = gst_element_factory_make ("fakesrc", "fakesrc2"); - g_object_set (G_OBJECT (fakesrc2), "num_buffers", 5, NULL); - fakesink2 = gst_element_factory_make ("fakesink", "fakesink2"); - - gst_bin_add_many (GST_BIN (pipeline), fakesrc2, fakesink2, NULL); - gst_element_link_pads (fakesrc2, "src", fakesink2, "sink"); - - g_signal_connect (G_OBJECT (pipeline), "deep_notify", - G_CALLBACK (gst_element_default_deep_notify), NULL); - - GST_FLAG_SET (fakesrc2, GST_ELEMENT_LOCKED_STATE); - GST_FLAG_SET (fakesink2, GST_ELEMENT_LOCKED_STATE); - - gst_element_set_state (pipeline, GST_STATE_PLAYING); - while (gst_bin_iterate (GST_BIN (pipeline))); - gst_element_set_state (pipeline, GST_STATE_READY); - - g_object_set (G_OBJECT (fakesrc1), "num_buffers", 5, NULL); - - GST_FLAG_UNSET (fakesrc2, GST_ELEMENT_LOCKED_STATE); - GST_FLAG_UNSET (fakesink2, GST_ELEMENT_LOCKED_STATE); - - gst_element_set_state (pipeline, GST_STATE_PLAYING); - while (gst_bin_iterate (GST_BIN (pipeline))); - gst_element_set_state (pipeline, GST_STATE_NULL); - - gst_object_unref (GST_OBJECT (pipeline)); - - return 0; -} diff --git a/tests/old/testsuite/states/parent.c b/tests/old/testsuite/states/parent.c deleted file mode 100644 index aa583c5aa3..0000000000 --- a/tests/old/testsuite/states/parent.c +++ /dev/null @@ -1,107 +0,0 @@ -/* GStreamer - * - * parent.c: test to check that setting state on a parent sets same state - * recursively on children - * - * Copyright (C) <2004> Thomas Vander Stichele <thomas at apestaart dot org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include <gst/gst.h> - -gint -main (gint argc, gchar * argv[]) -{ - GstElement *pipeline; - GstElement *bin1, *bin2; - GstElement *fakesrc, *identity, *fakesink; - - gst_init (&argc, &argv); - - /* - * +-pipeline----------------------------------------+ - * | +-bin2----------------------------------------+ | - * | | +-bin1-----------------------+ | | - * | | | +---------+ +----------+ | +----------+ | | - * | | | | fakesrc |---| identity |---| fakesink | | | - * | | | +---------+ +----------- | +----------+ | | - * | | +----------------------------+ | | - * | +---------------------------------------------+ | - * +-------------------------------------------------+ - */ - - pipeline = gst_pipeline_new ("pipeline"); - g_assert (pipeline); - bin1 = gst_bin_new ("bin1"); - g_assert (bin1); - bin2 = gst_bin_new ("bin2"); - g_assert (bin2); - - fakesrc = gst_element_factory_make ("fakesrc", "fakesrc"); - g_assert (fakesrc); - g_object_set (G_OBJECT (fakesrc), "num_buffers", 5, NULL); - identity = gst_element_factory_make ("identity", "identity"); - g_assert (identity); - fakesink = gst_element_factory_make ("fakesink", "fakesink"); - g_assert (fakesink); - - gst_bin_add_many (GST_BIN (bin1), fakesrc, identity, NULL); - g_assert (gst_element_link (fakesrc, identity)); - - gst_bin_add_many (GST_BIN (bin2), bin1, fakesink, NULL); - g_assert (gst_element_link (identity, fakesink)); - - gst_bin_add (GST_BIN (pipeline), bin2); - g_signal_connect (G_OBJECT (pipeline), "deep_notify", - G_CALLBACK (gst_element_default_deep_notify), NULL); - - /* setting pipeline to READY should bring in all children to READY */ - gst_element_set_state (pipeline, GST_STATE_READY); - g_assert (GST_STATE (bin1) == GST_STATE_READY); - g_assert (GST_STATE (bin2) == GST_STATE_READY); - g_assert (GST_STATE (fakesrc) == GST_STATE_READY); - g_assert (GST_STATE (identity) == GST_STATE_READY); - g_assert (GST_STATE (fakesink) == GST_STATE_READY); - - /* setting fakesink to PAUSED should set pipeline and bin2 to PAUSED */ - gst_element_set_state (fakesink, GST_STATE_PAUSED); - g_assert (GST_STATE (bin1) == GST_STATE_READY); - g_assert (GST_STATE (bin2) == GST_STATE_PAUSED); - g_assert (GST_STATE (fakesrc) == GST_STATE_READY); - g_assert (GST_STATE (identity) == GST_STATE_READY); - g_assert (GST_STATE (fakesink) == GST_STATE_PAUSED); - - /* setting fakesrc to PAUSED should set bin1 and fakesrc to PAUSED */ - gst_element_set_state (fakesrc, GST_STATE_PAUSED); - g_assert (GST_STATE (bin1) == GST_STATE_PAUSED); - g_assert (GST_STATE (bin2) == GST_STATE_PAUSED); - g_assert (GST_STATE (fakesrc) == GST_STATE_PAUSED); - g_assert (GST_STATE (identity) == GST_STATE_READY); - g_assert (GST_STATE (fakesink) == GST_STATE_PAUSED); - - /* setting bin1 to PAUSED, even though it is already, should set - * identity to PAUSED as well */ - gst_element_set_state (bin1, GST_STATE_PAUSED); - g_assert (GST_STATE (bin1) == GST_STATE_PAUSED); - g_assert (GST_STATE (bin2) == GST_STATE_PAUSED); - g_assert (GST_STATE (fakesrc) == GST_STATE_PAUSED); - g_assert (GST_STATE (identity) == GST_STATE_PAUSED); - g_assert (GST_STATE (fakesink) == GST_STATE_PAUSED); - - g_print ("passed.\n"); - return 0; -} diff --git a/tests/old/testsuite/tags/.gitignore b/tests/old/testsuite/tags/.gitignore deleted file mode 100644 index e3eed892cb..0000000000 --- a/tests/old/testsuite/tags/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -Makefile -Makefile.in -merge diff --git a/tests/old/testsuite/tags/Makefile.am b/tests/old/testsuite/tags/Makefile.am deleted file mode 100644 index ecb33ae970..0000000000 --- a/tests/old/testsuite/tags/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -include ../Rules - -tests_pass = merge -tests_fail = -tests_ignore = diff --git a/tests/old/testsuite/tags/merge.c b/tests/old/testsuite/tags/merge.c deleted file mode 100644 index 8b243afb12..0000000000 --- a/tests/old/testsuite/tags/merge.c +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de> - * - * parse1.c: Test various parsing stuff - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <gst/gst.h> - -#include <string.h> - - -/* multiple artists are possible */ -#define UTAG GST_TAG_ARTIST -#define UNFIXED1 "Britney Spears" -#define UNFIXED2 "Evanescene" -#define UNFIXED3 "AC/DC" -#define UNFIXED4 "The Prodigy" - -/* license is fixed */ -#define FTAG GST_TAG_LICENSE -#define FIXED1 "Lesser General Public License" -#define FIXED2 "Microsoft End User License Agreement" -#define FIXED3 "Mozilla Public License" -#define FIXED4 "Public Domain" - -/* checks that a tag contains the given values and not more values */ -static void -check (const GstTagList * list, const gchar * tag, gchar * value, ...) -{ - va_list args; - gchar *str; - guint i = 0; - - va_start (args, value); - while (value != NULL) { - g_assert (gst_tag_list_get_string_index (list, tag, i, &str)); - g_assert (strcmp (value, str) == 0); - g_free (str); - - value = va_arg (args, gchar *); - i++; - } - g_assert (i == gst_tag_list_get_tag_size (list, tag)); - va_end (args); -} - -#define NEW_LIST_FIXED(mode) G_STMT_START{ \ - if (list) gst_tag_list_free (list);\ - list = gst_tag_list_new (); \ - gst_tag_list_add (list, mode, FTAG, FIXED1, FTAG, FIXED2, FTAG, FIXED3, FTAG, FIXED4, NULL); \ -}G_STMT_END -#define NEW_LIST_UNFIXED(mode) G_STMT_START{ \ - if (list) gst_tag_list_free (list);\ - list = gst_tag_list_new (); \ - gst_tag_list_add (list, mode, UTAG, UNFIXED1, UTAG, UNFIXED2, UTAG, UNFIXED3, UTAG, UNFIXED4, NULL);\ -}G_STMT_END -#define NEW_LISTS_FIXED(mode) G_STMT_START{ \ - if (list) gst_tag_list_free (list);\ - list = gst_tag_list_new (); \ - gst_tag_list_add (list, GST_TAG_MERGE_APPEND, FTAG, FIXED1, FTAG, FIXED2, NULL); \ - if (list2) gst_tag_list_free (list2);\ - list2 = gst_tag_list_new (); \ - gst_tag_list_add (list2, GST_TAG_MERGE_APPEND, FTAG, FIXED3, FTAG, FIXED4, NULL); \ - if (merge) gst_tag_list_free (merge);\ - merge = gst_tag_list_merge (list, list2, mode); \ -}G_STMT_END -#define NEW_LISTS_UNFIXED(mode) G_STMT_START{ \ - if (list) gst_tag_list_free (list);\ - list = gst_tag_list_new (); \ - gst_tag_list_add (list, GST_TAG_MERGE_APPEND, UTAG, UNFIXED1, UTAG, UNFIXED2, NULL); \ - if (list2) gst_tag_list_free (list2);\ - list2 = gst_tag_list_new (); \ - gst_tag_list_add (list2, GST_TAG_MERGE_APPEND, UTAG, UNFIXED3, UTAG, UNFIXED4, NULL); \ - if (merge) gst_tag_list_free (merge);\ - merge = gst_tag_list_merge (list, list2, mode); \ -}G_STMT_END -gint -main (gint argc, gchar * argv[]) -{ - GstTagList *list = NULL, *list2 = NULL, *merge = NULL; - - gst_init (&argc, &argv); - - /* make sure the assumptions work */ - g_assert (gst_tag_is_fixed (FTAG)); - g_assert (!gst_tag_is_fixed (UTAG)); - /* we check string here only */ - g_assert (gst_tag_get_type (FTAG) == G_TYPE_STRING); - g_assert (gst_tag_get_type (UTAG) == G_TYPE_STRING); - - /* check additions */ - /* unfixed */ - NEW_LIST_UNFIXED (GST_TAG_MERGE_REPLACE_ALL); - check (list, UTAG, UNFIXED4, NULL); - NEW_LIST_UNFIXED (GST_TAG_MERGE_REPLACE); - check (list, UTAG, UNFIXED4, NULL); - NEW_LIST_UNFIXED (GST_TAG_MERGE_PREPEND); - check (list, UTAG, UNFIXED4, UNFIXED3, UNFIXED2, UNFIXED1, NULL); - NEW_LIST_UNFIXED (GST_TAG_MERGE_APPEND); - check (list, UTAG, UNFIXED1, UNFIXED2, UNFIXED3, UNFIXED4, NULL); - NEW_LIST_UNFIXED (GST_TAG_MERGE_KEEP); - check (list, UTAG, UNFIXED1, NULL); - NEW_LIST_UNFIXED (GST_TAG_MERGE_KEEP_ALL); - check (list, UTAG, NULL); - /* fixed */ - NEW_LIST_FIXED (GST_TAG_MERGE_REPLACE_ALL); - check (list, FTAG, FIXED4, NULL); - NEW_LIST_FIXED (GST_TAG_MERGE_REPLACE); - check (list, FTAG, FIXED4, NULL); - NEW_LIST_FIXED (GST_TAG_MERGE_PREPEND); - check (list, FTAG, FIXED4, NULL); - NEW_LIST_FIXED (GST_TAG_MERGE_APPEND); - check (list, FTAG, FIXED1, NULL); - NEW_LIST_FIXED (GST_TAG_MERGE_KEEP); - check (list, FTAG, FIXED1, NULL); - NEW_LIST_FIXED (GST_TAG_MERGE_KEEP_ALL); - check (list, FTAG, NULL); - - /* check merging */ - /* unfixed */ - NEW_LISTS_UNFIXED (GST_TAG_MERGE_REPLACE_ALL); - check (merge, UTAG, UNFIXED3, UNFIXED4, NULL); - NEW_LISTS_UNFIXED (GST_TAG_MERGE_REPLACE); - check (merge, UTAG, UNFIXED3, UNFIXED4, NULL); - NEW_LISTS_UNFIXED (GST_TAG_MERGE_PREPEND); - check (merge, UTAG, UNFIXED3, UNFIXED4, UNFIXED1, UNFIXED2, NULL); - NEW_LISTS_UNFIXED (GST_TAG_MERGE_APPEND); - check (merge, UTAG, UNFIXED1, UNFIXED2, UNFIXED3, UNFIXED4, NULL); - NEW_LISTS_UNFIXED (GST_TAG_MERGE_KEEP); - check (merge, UTAG, UNFIXED1, UNFIXED2, NULL); - NEW_LISTS_UNFIXED (GST_TAG_MERGE_KEEP_ALL); - check (merge, UTAG, UNFIXED1, UNFIXED2, NULL); - /* fixed */ - NEW_LISTS_FIXED (GST_TAG_MERGE_REPLACE_ALL); - check (merge, FTAG, FIXED3, NULL); - NEW_LISTS_FIXED (GST_TAG_MERGE_REPLACE); - check (merge, FTAG, FIXED3, NULL); - NEW_LISTS_FIXED (GST_TAG_MERGE_PREPEND); - check (merge, FTAG, FIXED3, NULL); - NEW_LISTS_FIXED (GST_TAG_MERGE_APPEND); - check (merge, FTAG, FIXED1, NULL); - NEW_LISTS_FIXED (GST_TAG_MERGE_KEEP); - check (merge, FTAG, FIXED1, NULL); - NEW_LISTS_FIXED (GST_TAG_MERGE_KEEP_ALL); - check (merge, FTAG, FIXED1, NULL); - - return 0; -} diff --git a/tests/old/testsuite/test_gst_init.c b/tests/old/testsuite/test_gst_init.c deleted file mode 100644 index 3331c3def3..0000000000 --- a/tests/old/testsuite/test_gst_init.c +++ /dev/null @@ -1,13 +0,0 @@ -#include <gst/gst.h> - -/* This tests that gst_init() doesn't segfault when passed two NULLs as - * parameters, and that it doesn't fail if gst_init() happens to get called - * a second time. */ -int -main (int argc, char *argv[]) -{ - gst_init (NULL, NULL); - gst_init (&argc, &argv); - - return 0; -} diff --git a/tests/old/testsuite/threads/.gitignore b/tests/old/testsuite/threads/.gitignore deleted file mode 100644 index 99fa4a1766..0000000000 --- a/tests/old/testsuite/threads/.gitignore +++ /dev/null @@ -1,22 +0,0 @@ -threada -threadb -threadc -threadd -threade -threadf -threadg -thread1 -thread2 -thread3 -thread4 -thread5 -queue -staticrec -signal3 -signal2 -signal1 -159852 -159566 -threadi-123775 -threadi-nfy1 -threadi-nfy2 diff --git a/tests/old/testsuite/threads/159566.c b/tests/old/testsuite/threads/159566.c deleted file mode 100644 index abb704c3e1..0000000000 --- a/tests/old/testsuite/threads/159566.c +++ /dev/null @@ -1,95 +0,0 @@ -#include <string.h> -#include <unistd.h> -#include <gst/gst.h> - -static GstElement *src1, *sink1; -static gboolean need_src1 = TRUE; -static gint iter = 0; - -static void -object_deep_notify (GObject * object, GstObject * orig, - GParamSpec * pspec, gchar ** excluded_props) -{ - GValue value = { 0, }; /* the important thing is that value.type = 0 */ - gchar *str = NULL; - - if (strcmp (pspec->name, "last-message") != 0) - return; - - if (GST_ELEMENT (orig) != src1 && GST_ELEMENT (orig) != sink1) - return; - - g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec)); - g_object_get_property (G_OBJECT (orig), pspec->name, &value); - - str = g_strdup_value_contents (&value); - g_value_unset (&value); - - if (strstr (str, "E (type:") != NULL) { - g_free (str); - return; - } - - if (iter++ == 100) { - g_print ("."); - iter = 0; - } - g_free (str); - if (need_src1 && GST_ELEMENT (orig) != src1) { - g_assert_not_reached (); - } else if (!need_src1 && GST_ELEMENT (orig) != sink1) { - g_assert_not_reached (); - } - need_src1 = !need_src1; -} - - -int -main (int argc, char **argv) -{ - GstElement *thread1, *thread2, *pipeline; - GstElement *src2, *sink2; - - gst_init (&argc, &argv); - - pipeline = gst_element_factory_make ("pipeline", "pipeline"); - thread1 = gst_element_factory_make ("thread", "thread1"); - g_assert (thread1); - - src1 = gst_element_factory_make ("fakesrc", "src1"); - g_assert (src1); - sink1 = gst_element_factory_make ("fakesink", "sink1"); - g_assert (sink1); - - thread2 = gst_element_factory_make ("thread", "thread2"); - g_assert (thread2); - - src2 = gst_element_factory_make ("fakesrc", "src2"); - g_assert (src2); - sink2 = gst_element_factory_make ("fakesink", "sink2"); - g_assert (sink2); - - gst_bin_add_many (GST_BIN (thread1), src1, sink1, NULL); - gst_bin_add_many (GST_BIN (thread2), src2, sink2, NULL); - - gst_bin_add (GST_BIN (pipeline), thread1); - gst_bin_add (GST_BIN (pipeline), thread2); - - g_signal_connect (G_OBJECT (pipeline), "deep_notify", - G_CALLBACK (object_deep_notify), NULL); - - if (!gst_element_link_many (src1, sink1, NULL)) - g_assert_not_reached (); - - if (!gst_element_link_many (src2, sink2, NULL)) - g_assert_not_reached (); - - /* run a bit */ - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) - g_assert_not_reached (); - - sleep (10000); - g_print ("done\n"); - - return 0; -} diff --git a/tests/old/testsuite/threads/159852.c b/tests/old/testsuite/threads/159852.c deleted file mode 100644 index a69b152f8b..0000000000 --- a/tests/old/testsuite/threads/159852.c +++ /dev/null @@ -1,33 +0,0 @@ -#include <unistd.h> -#include <gst/gst.h> - - - -static gpointer -iterate_bin (GstBin * bin) -{ - while (TRUE) { - gst_bin_iterate (bin); - } - return NULL; -} - -int -main (int argc, char **argv) -{ - gint i; - GstElement *bin; - - gst_init (&argc, &argv); - - for (i = 0; i < 20; i++) { - bin = gst_element_factory_make ("bin", "bin"); - gst_scheduler_factory_make (NULL, GST_ELEMENT (bin)); - - g_thread_create ((GThreadFunc) iterate_bin, bin, TRUE, NULL); - } - - sleep (5); - - return 0; -} diff --git a/tests/old/testsuite/threads/Makefile.am b/tests/old/testsuite/threads/Makefile.am deleted file mode 100644 index 4039237bec..0000000000 --- a/tests/old/testsuite/threads/Makefile.am +++ /dev/null @@ -1,35 +0,0 @@ -include ../Rules - -tests_pass = thread1 thread2 thread3 thread4 thread5 threade threadf signal1 159852 threadg threadi-123775 -tests_fail = 159566 signal3 - -# threadh - -# signal2 shows a genuine bug but is erratic in that it manages to survive -# half of the time; so we ignore it -tests_ignore = queue threadb threadc threadd staticrec threadi-nfy1 threadi-nfy2 signal2 - -thread1_SOURCES = thread.c -thread1_CFLAGS = -DTESTNUM=1 $(AM_CFLAGS) -thread2_SOURCES = thread.c -thread2_CFLAGS = -DTESTNUM=2 $(AM_CFLAGS) -thread3_SOURCES = thread.c -thread3_CFLAGS = -DTESTNUM=3 $(AM_CFLAGS) -thread4_SOURCES = thread.c -thread4_CFLAGS = -DTESTNUM=4 $(AM_CFLAGS) -thread5_SOURCES = thread.c -thread5_CFLAGS = -DTESTNUM=5 $(AM_CFLAGS) - -signal1_SOURCES = signals.c -signal1_CFLAGS = -DTESTNUM=1 $(AM_CFLAGS) -signal2_SOURCES = signals.c -signal2_CFLAGS = -DTESTNUM=2 $(AM_CFLAGS) -signal3_SOURCES = signals.c -signal3_CFLAGS = -DTESTNUM=3 $(AM_CFLAGS) - -threadi_123775_SOURCES = threadi.c -threadi_123775_CFLAGS = -DTESTNUM=123775 $(AM_CFLAGS) -threadi_nfy1_SOURCES = threadi.c -threadi_nfy1_CFLAGS = -DTESTNUM=999998 $(AM_CFLAGS) -threadi_nfy2_SOURCES = threadi.c -threadi_nfy2_CFLAGS = -DTESTNUM=999999 $(AM_CFLAGS) diff --git a/tests/old/testsuite/threads/queue.c b/tests/old/testsuite/threads/queue.c deleted file mode 100644 index a7048d47fb..0000000000 --- a/tests/old/testsuite/threads/queue.c +++ /dev/null @@ -1,89 +0,0 @@ -#include <gst/gst.h> - -#include <unistd.h> - -/* - * queue test code - * starts a fakesrc num_buffers=50 ! { queue ! fakesink } thread - * by first setting the output thread to play, then the whole pipeline - */ - -static volatile gint handoff_count = 0; - -/* handoff callback */ -static void -handoff (GstElement * element, gpointer data) -{ - ++handoff_count; - g_print ("handoff (%d) ", handoff_count); -} - -static void -construct_pipeline (GstElement * pipeline, GstElement * thread) -{ - GstElement *src, *sink, *queue; - - src = gst_element_factory_make ("fakesrc", NULL); - sink = gst_element_factory_make ("fakesink", "sink"); - queue = gst_element_factory_make ("queue", NULL); - - gst_bin_add_many (GST_BIN (thread), queue, sink, NULL); - gst_bin_add_many (GST_BIN (pipeline), src, thread, NULL); - - gst_element_link_many (src, queue, sink, NULL); - - g_object_set (G_OBJECT (src), "num_buffers", 50, NULL); - - g_object_set (G_OBJECT (sink), "signal-handoffs", TRUE, NULL); - g_signal_connect (G_OBJECT (sink), "handoff", G_CALLBACK (handoff), NULL); -} - -void -change_state (GstElement * element, GstBuffer * buf, GstElement * pipeline) -{ - gst_element_set_state (pipeline, GST_STATE_NULL); -} - -int -main (gint argc, gchar * argv[]) -{ - GstElement *pipeline; - GstElement *thread = NULL; - - gst_init (&argc, &argv); - - pipeline = gst_thread_new ("main_pipeline"); - thread = gst_element_factory_make ("thread", NULL); - construct_pipeline (pipeline, thread); - - g_print ("First run: to show the pipeline works\n"); - gst_element_set_state (pipeline, GST_STATE_PLAYING); - g_print ("SLEEPING 1 sec\n"); - sleep (1); - - g_print ("Pipeline done. Resetting to NULL.\n"); - gst_element_set_state (pipeline, GST_STATE_NULL); - - if (handoff_count == 0) { - g_print ("ERROR: no buffers have passed\n"); - return -1; - } - - handoff_count = 0; - - g_print - ("Second run: setting consumer thread to playing, then complete pipeline\n"); - gst_element_set_state (thread, GST_STATE_PLAYING); - g_print ("SLEEPING 1 sec\n"); - sleep (1); - gst_element_set_state (pipeline, gst_element_get_state (pipeline)); - g_print ("SLEEPING 2 sec\n"); - sleep (2); - - if (handoff_count == 0) { - g_print ("ERROR: no buffers have passed\n"); - return -1; - } - - return 0; -} diff --git a/tests/old/testsuite/threads/signals.c b/tests/old/testsuite/threads/signals.c deleted file mode 100644 index e4fe4ce100..0000000000 --- a/tests/old/testsuite/threads/signals.c +++ /dev/null @@ -1,231 +0,0 @@ -#include <unistd.h> -#include <gst/gst.h> - -#define GST_TYPE_TEST (gst_test_get_type ()) -#define GST_TEST(test) (G_TYPE_CHECK_INSTANCE_CAST ((test), GST_TYPE_TEST, GstTest)) -#define GST_IS_TEST(test) (G_TYPE_CHECK_INSTANCE_TYPE ((test), GST_TYPE_TEST)) -#define GST_TEST_CLASS(tclass) (G_TYPE_CHECK_CLASS_CAST ((tclass), GST_TYPE_TEST, GstTestClass)) -#define GST_IS_TEST_CLASS(tclass) (G_TYPE_CHECK_CLASS_TYPE ((tclass), GST_TYPE_TEST)) -#define GST_TEST_GET_CLASS(test) (G_TYPE_INSTANCE_GET_CLASS ((test), GST_TYPE_TEST, GstTestClass)) - -typedef struct _GstTest GstTest; -typedef struct _GstTestClass GstTestClass; - -struct _GstTest -{ - GstObject object; -}; - -struct _GstTestClass -{ - GstObjectClass parent_class; - - void (*test_signal1) (GstTest * test, gint an_int); - void (*test_signal2) (GstTest * test, gint an_int); -}; - -static GType gst_test_get_type (void); - -/* Element signals and args */ -enum -{ - TEST_SIGNAL1, - TEST_SIGNAL2, - /* add more above */ - LAST_SIGNAL -}; - -enum -{ - ARG_0, - ARG_TEST_PROP -}; - -static void gst_test_class_init (GstTestClass * klass); -static void gst_test_init (GstTest * test); -static void gst_test_dispose (GObject * object); - -static void signal2_handler (GstTest * test, gint anint); - -static void gst_test_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec); -static void gst_test_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec); - -static GstObjectClass *parent_class = NULL; - -static guint gst_test_signals[LAST_SIGNAL] = { 0 }; - -static GType -gst_test_get_type (void) -{ - static GType test_type = 0; - - if (!test_type) { - static const GTypeInfo test_info = { - sizeof (GstTestClass), - NULL, - NULL, - (GClassInitFunc) gst_test_class_init, - NULL, - NULL, - sizeof (GstTest), - 0, - (GInstanceInitFunc) gst_test_init, - NULL - }; - - test_type = g_type_register_static (GST_TYPE_OBJECT, "GstTest", - &test_info, 0); - } - return test_type; -} - -static void -gst_test_class_init (GstTestClass * klass) -{ - GObjectClass *gobject_class; - GstObjectClass *gstobject_class; - - gobject_class = (GObjectClass *) klass; - gstobject_class = (GstObjectClass *) klass; - - parent_class = g_type_class_ref (GST_TYPE_OBJECT); - - if (!g_thread_supported ()) - g_thread_init (NULL); - - gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_test_dispose); - gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_test_set_property); - gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_test_get_property); - - gst_test_signals[TEST_SIGNAL1] = - g_signal_new ("test-signal1", G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstTestClass, test_signal1), NULL, - NULL, gst_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT); - gst_test_signals[TEST_SIGNAL2] = - g_signal_new ("test-signal2", G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstTestClass, test_signal2), NULL, - NULL, gst_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT); - - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TEST_PROP, - g_param_spec_int ("test-prop", "Test Prop", "Test property", - 0, 1, 0, G_PARAM_READWRITE)); - - klass->test_signal2 = signal2_handler; -} - -static void -gst_test_init (GstTest * test) -{ -} - -static void -gst_test_dispose (GObject * object) -{ - GstTest *test; - - test = GST_TEST (object); - - G_OBJECT_CLASS (parent_class)->dispose (object); -} - -static void -gst_test_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec) -{ - GstTest *test; - - test = GST_TEST (object); - - switch (prop_id) { - case ARG_TEST_PROP: - g_value_get_int (value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_test_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec) -{ - GstTest *test; - - test = GST_TEST (object); - - switch (prop_id) { - case ARG_TEST_PROP: - g_value_set_int (value, 0); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_test_do_signal1 (GstTest * test) -{ - g_signal_emit (G_OBJECT (test), gst_test_signals[TEST_SIGNAL1], 0, 0); -} - -static void -signal2_handler (GstTest * test, gint anint) -{ -} - -static void -gst_test_do_signal2 (GstTest * test) -{ - g_signal_emit (G_OBJECT (test), gst_test_signals[TEST_SIGNAL2], 0, 0); -} - -static void -gst_test_do_prop (GstTest * test) -{ - g_object_notify (G_OBJECT (test), "test-prop"); -} - -static gpointer -run_thread (GstTest * test) -{ - gint i = 0; - - while (TRUE) { - if (TESTNUM == 1) - gst_test_do_signal1 (test); - if (TESTNUM == 2) - gst_test_do_signal2 (test); - if (TESTNUM == 3) - gst_test_do_prop (test); - if ((i++ % 10000) == 0) { - g_print ("."); - g_usleep (1); /* context switch */ - } - } - - return NULL; -} - -int -main (int argc, char **argv) -{ - gint i; - GstTest *test1, *test2; - - gst_init (&argc, &argv); - - test1 = g_object_new (GST_TYPE_TEST, NULL); - test2 = g_object_new (GST_TYPE_TEST, NULL); - - for (i = 0; i < 20; i++) { - g_thread_create ((GThreadFunc) run_thread, test1, TRUE, NULL); - g_thread_create ((GThreadFunc) run_thread, test2, TRUE, NULL); - } - sleep (5); - - return 0; -} diff --git a/tests/old/testsuite/threads/staticrec.c b/tests/old/testsuite/threads/staticrec.c deleted file mode 100644 index c77dff8a90..0000000000 --- a/tests/old/testsuite/threads/staticrec.c +++ /dev/null @@ -1,49 +0,0 @@ -#include <glib.h> - -GStaticRecMutex mutex = G_STATIC_REC_MUTEX_INIT; - -static void * -thread1 (void *t) -{ - gint i = 0; - - while (TRUE) { - g_static_rec_mutex_lock (&mutex); - if (i++ % 100000 == 0) - g_print ("*"); - g_static_rec_mutex_unlock (&mutex); - if (i++ % 100000 == 0) - g_print ("*"); - } - return NULL; -} - -static void * -thread2 (void *t) -{ - gint i = 0; - - while (TRUE) { - g_static_rec_mutex_lock (&mutex); - if (i++ % 100000 == 0) - g_print ("."); - g_static_rec_mutex_unlock (&mutex); - if (i++ % 100000 == 0) - g_print ("."); - } - return NULL; -} - -int -main (gint argc, gchar * argv[]) -{ - g_thread_init (NULL); - g_thread_create_full (thread1, - NULL, 0x200000, FALSE, TRUE, G_THREAD_PRIORITY_NORMAL, NULL); - g_thread_create_full (thread2, - NULL, 0x200000, FALSE, TRUE, G_THREAD_PRIORITY_NORMAL, NULL); - - g_usleep (G_MAXLONG); - - return 0; -} diff --git a/tests/old/testsuite/threads/thread.c b/tests/old/testsuite/threads/thread.c deleted file mode 100644 index 4614c414a4..0000000000 --- a/tests/old/testsuite/threads/thread.c +++ /dev/null @@ -1,128 +0,0 @@ -#include <gst/gst.h> - -/* - * FIXME: - * these tests should have a maximum run length, so that they get killed - * if they lock up, which they're bound to do. - */ - -void -usage (void) -{ - g_print ("compile this test with TESTNUM defined.\n" - " available TESTNUMs: \n" - " 1: stress test state change \n" - " 2: iterate once \n" - " 3: iterate twice \n" - " 4: state change while running \n" - " 5: state change in thread context\n"); -} - -static void -construct_pipeline (GstElement * pipeline) -{ - GstElement *src, *sink, *queue, *identity, *thread; - - src = gst_element_factory_make ("fakesrc", NULL); - sink = gst_element_factory_make ("fakesink", "sink"); - identity = gst_element_factory_make ("identity", NULL); - queue = gst_element_factory_make ("queue", NULL); - thread = gst_element_factory_make ("thread", NULL); - - gst_element_link_many (src, queue, identity, sink, NULL); - - gst_bin_add_many (GST_BIN (pipeline), src, queue, thread, NULL); - gst_bin_add_many (GST_BIN (thread), identity, sink, NULL); - - g_object_set (G_OBJECT (src), "num_buffers", 5, NULL); - //g_object_set (sink, "signal-handoffs", TRUE, NULL); -} - -void -change_state (GstElement * element, GstBuffer * buf, GstPad * pad, - GstElement * pipeline) -{ - gst_element_set_state (pipeline, GST_STATE_NULL); -} - -int -main (gint argc, gchar * argv[]) -{ - GstElement *pipeline; - - gst_init (&argc, &argv); - -#ifndef TESTNUM - usage (); - return -1; -#endif - - pipeline = gst_pipeline_new ("main_pipeline"); - construct_pipeline (pipeline); - - if (TESTNUM == 1) { - g_print ("thread test 1: stress test state changes...\n"); - - g_print ("NULL\n"); - gst_element_set_state (pipeline, GST_STATE_NULL); - g_print ("READY\n"); - gst_element_set_state (pipeline, GST_STATE_READY); - g_print ("NULL\n"); - gst_element_set_state (pipeline, GST_STATE_NULL); - g_print ("PAUSED\n"); - gst_element_set_state (pipeline, GST_STATE_PAUSED); - g_print ("READY\n"); - gst_element_set_state (pipeline, GST_STATE_READY); - g_print ("PAUSED\n"); - gst_element_set_state (pipeline, GST_STATE_PAUSED); - g_print ("PLAYING\n"); - gst_element_set_state (pipeline, GST_STATE_PLAYING); - /* element likely hits EOS and does a state transition to PAUSED */ - g_print ("READY\n"); - gst_element_set_state (pipeline, GST_STATE_READY); - g_print ("NULL\n"); - gst_element_set_state (pipeline, GST_STATE_NULL); - } - - if (TESTNUM == 2 || TESTNUM == 3) { - gst_element_set_state (pipeline, GST_STATE_PLAYING); - g_print ("running ...\n"); - while (gst_bin_iterate (GST_BIN (pipeline))); - g_print ("done ...\n"); - gst_element_set_state (pipeline, GST_STATE_NULL); - } - if (TESTNUM == 3) { - gst_element_set_state (pipeline, GST_STATE_PLAYING); - g_print ("running ...\n"); - while (gst_bin_iterate (GST_BIN (pipeline))); - g_print ("done ...\n"); - gst_element_set_state (pipeline, GST_STATE_NULL); - } - if (TESTNUM == 4) { - gint run; - - gst_element_set_state (pipeline, GST_STATE_PLAYING); - g_print ("running ...\n"); - for (run = 0; run < 3; run++) { - gst_bin_iterate (GST_BIN (pipeline)); - } - gst_element_set_state (pipeline, GST_STATE_NULL); - } - if (TESTNUM == 5) { - /* I don't think this test is supposed to work */ - GstElement *sink; - - sink = gst_bin_get_by_name (GST_BIN (pipeline), "sink"); - g_assert (sink); - - g_signal_connect (G_OBJECT (sink), "handoff", - G_CALLBACK (change_state), pipeline); - gst_element_set_state (pipeline, GST_STATE_PLAYING); - g_print ("running ...\n"); - while (gst_bin_iterate (GST_BIN (pipeline))); - g_print ("stopping ...\n"); - gst_element_set_state (pipeline, GST_STATE_NULL); - } - - return 0; -} diff --git a/tests/old/testsuite/threads/threadb.c b/tests/old/testsuite/threads/threadb.c deleted file mode 100644 index 496cc0076a..0000000000 --- a/tests/old/testsuite/threads/threadb.c +++ /dev/null @@ -1,80 +0,0 @@ -#include <gst/gst.h> - -/* threadb.c - * this tests if we can make a GstThread, put some stuff in it, - * dispatch it, and let it run from a main gst loop - * we repeat the main loop a hundred times to test thread reuse - * underneath GstThread - */ - -gboolean running = FALSE; - -static void -construct_pipeline (GstElement * pipeline) -{ - GstElement *src, *sink, *identity; - - src = gst_element_factory_make ("fakesrc", NULL); - identity = gst_element_factory_make ("identity", NULL); - sink = gst_element_factory_make ("fakesink", NULL); - g_assert (src); - g_assert (identity); - g_assert (sink); - - gst_element_link_many (src, identity, sink, NULL); - - gst_bin_add_many (GST_BIN (pipeline), src, identity, sink, NULL); - - g_object_set (G_OBJECT (src), "num_buffers", 5, NULL); -} - -void -state_changed (GstElement * el, gint arg1, gint arg2, gpointer user_data) -{ - GstElementState state = gst_element_get_state (el); - - g_print ("element %s has changed state to %s\n", - GST_ELEMENT_NAME (el), gst_element_state_get_name (state)); - if (state == GST_STATE_PLAYING) - running = TRUE; - /* if we move from PLAYING to PAUSED, we're done */ - if (state == GST_STATE_PAUSED && running) { - running = FALSE; - gst_main_quit (); - } -} - -int -main (gint argc, gchar * argv[]) -{ - int runs = 100; - int i; - gulong id; - GstElement *thread; - - gst_init (&argc, &argv); - - for (i = 0; i < runs; ++i) { - thread = gst_thread_new ("main_thread"); - g_assert (thread); - - /* connect state change signal */ - id = g_signal_connect (G_OBJECT (thread), "state_change", - G_CALLBACK (state_changed), NULL); - construct_pipeline (thread); - - g_print ("Setting thread to play\n"); - gst_element_set_state (thread, GST_STATE_PLAYING); - - g_print ("Going into the main GStreamer loop\n"); - gst_main (); - g_print ("Coming out of the main GStreamer loop\n"); - g_signal_handler_disconnect (G_OBJECT (thread), id); - gst_element_set_state (thread, GST_STATE_NULL); - g_print ("Unreffing thread\n"); - g_object_unref (G_OBJECT (thread)); - running = FALSE; - } - - return 0; -} diff --git a/tests/old/testsuite/threads/threadc.c b/tests/old/testsuite/threads/threadc.c deleted file mode 100644 index 7f9955cb57..0000000000 --- a/tests/old/testsuite/threads/threadc.c +++ /dev/null @@ -1,92 +0,0 @@ -#include <gst/gst.h> - -/* threadc.c - * this tests if we can make a GstThread, with enough cothreads to stress it - */ - -gboolean running = FALSE; -gboolean can_quit = FALSE; - -static void -construct_pipeline (GstElement * pipeline, gint identities) -{ - GstElement *src, *sink; - GstElement *identity = NULL; - GstElement *from; - int i; - - identity = NULL; - src = gst_element_factory_make ("fakesrc", NULL); - sink = gst_element_factory_make ("fakesink", NULL); - g_assert (src); - g_assert (sink); - gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL); - from = src; - - for (i = 0; i < identities; ++i) { - identity = gst_element_factory_make ("identity", NULL); - g_assert (identity); - gst_bin_add (GST_BIN (pipeline), identity); - gst_element_link (from, identity); - from = identity; - } - gst_element_link (identity, sink); - - g_object_set (G_OBJECT (src), "num_buffers", 10, "sizetype", 3, NULL); -} - -void -state_changed (GstElement * el, gint arg1, gint arg2, gpointer user_data) -{ - GstElementState state = gst_element_get_state (el); - - g_print ("element %s has changed state to %s\n", - GST_ELEMENT_NAME (el), gst_element_state_get_name (state)); - if (state == GST_STATE_PLAYING) - running = TRUE; - /* if we move from PLAYING to PAUSED, we're done */ - if (state == GST_STATE_PAUSED && running) { - while (!can_quit); - can_quit = FALSE; - g_print ("quitting main loop\n"); - gst_main_quit (); - } -} - -int -main (gint argc, gchar * argv[]) -{ - int runs = 290; - int i; - gulong id; - GstElement *thread; - - gst_init (&argc, &argv); - - for (i = 90; i < runs; ++i) { - thread = gst_thread_new ("main_thread"); - g_assert (thread); - - /* connect state change signal */ - id = g_signal_connect (G_OBJECT (thread), "state_change", - G_CALLBACK (state_changed), NULL); - construct_pipeline (thread, i / 10 + 1); - - g_print ("Setting thread to play with %d identities\n", i / 10 + 1); - if (gst_element_set_state (thread, GST_STATE_PLAYING) == GST_STATE_FAILURE) { - g_error ("Failed setting thread to play\n"); - } else { - g_print ("Going into the main GStreamer loop\n"); - can_quit = TRUE; /* we don't want gst_main_quit called before gst_main */ - gst_main (); - } - running = FALSE; - g_print ("Coming out of the main GStreamer loop\n"); - g_signal_handler_disconnect (G_OBJECT (thread), id); - gst_element_set_state (thread, GST_STATE_NULL); - g_print ("Unreffing thread\n"); - g_object_unref (G_OBJECT (thread)); - } - - return 0; -} diff --git a/tests/old/testsuite/threads/threadd.c b/tests/old/testsuite/threads/threadd.c deleted file mode 100644 index 79bfb573ca..0000000000 --- a/tests/old/testsuite/threads/threadd.c +++ /dev/null @@ -1,94 +0,0 @@ -#include <gst/gst.h> -#include <unistd.h> - -/* threadc.c - * this tests if we can make a GstThread, with enough cothreads to stress it - */ - -#define MAX_IDENTITIES 29 -#define RUNS_PER_IDENTITY 5 - -volatile gboolean running = FALSE; - -/* must be volatile, we're going to fool the compiler */ -volatile gboolean done = FALSE; - -static void -construct_pipeline (GstElement * pipeline, gint identities) -{ - GstElement *src, *sink, *identity = NULL; - GstElement *from; - int i; - - src = gst_element_factory_make ("fakesrc", NULL); - sink = gst_element_factory_make ("fakesink", NULL); - g_assert (src); - g_assert (sink); - gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL); - from = src; - - for (i = 0; i < identities; ++i) { - identity = gst_element_factory_make ("identity", NULL); - g_assert (identity); - gst_bin_add (GST_BIN (pipeline), identity); - gst_element_link (from, identity); - from = identity; - } - gst_element_link (identity, sink); - - g_object_set (G_OBJECT (src), "num_buffers", 10, "sizetype", 3, NULL); -} - -void -state_changed (GstElement * el, gint arg1, gint arg2, gpointer user_data) -{ - GstElementState state = gst_element_get_state (el); - - g_print ("element %s has changed state to %s\n", - GST_ELEMENT_NAME (el), gst_element_state_get_name (state)); - if (state == GST_STATE_PLAYING) - running = TRUE; - /* if we move from PLAYING to PAUSED, we're done */ - if (state == GST_STATE_PAUSED && running) - done = TRUE; -} - -int -main (gint argc, gchar * argv[]) -{ - int runs = MAX_IDENTITIES * RUNS_PER_IDENTITY; - int i; - gulong id; - GstElement *thread; - - gst_init (&argc, &argv); - - for (i = 0; i < runs; ++i) { - thread = gst_thread_new ("main_thread"); - g_assert (thread); - - /* connect state change signal */ - id = g_signal_connect (G_OBJECT (thread), "state_change", - G_CALLBACK (state_changed), NULL); - construct_pipeline (thread, i / RUNS_PER_IDENTITY + 1); - - g_print ("Setting thread to play with %d identities\n", - i / RUNS_PER_IDENTITY + 1); - done = FALSE; - if (gst_element_set_state (thread, GST_STATE_PLAYING) == GST_STATE_FAILURE) { - g_warning ("failed to go to PLAYING"); - } else { - g_print ("Waiting for thread PLAYING->PAUSED\n"); - while (!done) /* do nothing */ - ; - } - running = FALSE; - g_print ("Coming out of the main GStreamer loop\n"); - g_signal_handler_disconnect (G_OBJECT (thread), id); - gst_element_set_state (thread, GST_STATE_NULL); - g_print ("Unreffing thread\n"); - g_object_unref (G_OBJECT (thread)); - } - - return 0; -} diff --git a/tests/old/testsuite/threads/threade.c b/tests/old/testsuite/threads/threade.c deleted file mode 100644 index fbdb530f31..0000000000 --- a/tests/old/testsuite/threads/threade.c +++ /dev/null @@ -1,81 +0,0 @@ -#include <gst/gst.h> -#include <unistd.h> - -/* threadc.c - * this tests if we can make a GstBin and iterate it inside a GThread - */ - -#define MAX_IDENTITIES 29 -#define RUNS_PER_IDENTITY 5 - -volatile gboolean running = FALSE; -volatile gboolean done = FALSE; - -static void -construct_pipeline (GstElement * pipeline, gint identities) -{ - GstElement *src, *sink, *identity = NULL; - GstElement *from; - int i; - - src = gst_element_factory_make ("fakesrc", NULL); - sink = gst_element_factory_make ("fakesink", NULL); - g_assert (src); - g_assert (sink); - gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL); - from = src; - - for (i = 0; i < identities; ++i) { - identity = gst_element_factory_make ("identity", NULL); - g_assert (identity); - gst_bin_add (GST_BIN (pipeline), identity); - gst_element_link (from, identity); - from = identity; - } - gst_element_link (identity, sink); - - g_object_set (G_OBJECT (src), "num_buffers", 10, "sizetype", 3, NULL); -} - -static void -iterator (GstElement * bin) -{ - gst_element_set_state (bin, GST_STATE_PLAYING); - while (gst_bin_iterate (GST_BIN (bin))) - g_print ("+"); - gst_element_set_state (bin, GST_STATE_NULL); - g_print ("\n"); - done = TRUE; -} - -int -main (gint argc, gchar * argv[]) -{ - int runs = MAX_IDENTITIES * RUNS_PER_IDENTITY; - int i; - GstElement *pipeline; - - g_thread_init (NULL); - gst_init (&argc, &argv); - - for (i = 0; i < runs; ++i) { - pipeline = gst_pipeline_new ("main_pipeline"); - g_assert (pipeline); - - /* connect state change signal */ - construct_pipeline (pipeline, i / RUNS_PER_IDENTITY + 1); - - done = FALSE; - g_thread_create ((GThreadFunc) iterator, pipeline, FALSE, NULL); - g_print ("Created GThread\n"); - - g_print ("Waiting for thread PLAYING->PAUSED\n"); - while (!done) /* do nothing */ - ; - running = FALSE; - g_print ("Unreffing pipeline\n"); - g_object_unref (G_OBJECT (pipeline)); - } - - return 0; -} diff --git a/tests/old/testsuite/threads/threadf.c b/tests/old/testsuite/threads/threadf.c deleted file mode 100644 index fd5eeb4e89..0000000000 --- a/tests/old/testsuite/threads/threadf.c +++ /dev/null @@ -1,83 +0,0 @@ -#include <gst/gst.h> - -/* threadf.c - * this tests if we can make a GThread and construct and interate a pipeline - * inside it - * used to fail because of cothread ctx key not being reset on context - * destroy - */ - -#define MAX_IDENTITIES 29 -#define RUNS_PER_IDENTITY 5 - -volatile gboolean running = FALSE; -volatile gboolean done = FALSE; - -static void -construct_pipeline (GstElement * pipeline, gint identities) -{ - GstElement *src, *sink; - GstElement *identity = NULL; - GstElement *from; - int i; - - identity = NULL; - src = gst_element_factory_make ("fakesrc", NULL); - sink = gst_element_factory_make ("fakesink", NULL); - g_assert (src); - g_assert (sink); - gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL); - from = src; - - for (i = 0; i < identities; ++i) { - identity = gst_element_factory_make ("identity", NULL); - g_assert (identity); - gst_bin_add (GST_BIN (pipeline), identity); - if (!(gst_element_link (from, identity))) - g_print ("Warning: can't link identity with previous element\n"); - from = identity; - } - gst_element_link (identity, sink); - - g_object_set (G_OBJECT (src), "num_buffers", 10, "sizetype", 3, NULL); -} - -static void -thread (void) -{ - int runs = MAX_IDENTITIES * RUNS_PER_IDENTITY; - int i; - GstElement *pipeline; - - for (i = 30; i < runs; ++i) { - pipeline = gst_pipeline_new ("main_pipeline"); - g_assert (pipeline); - - g_print ("Run %d, using %d identities\n", i, i / RUNS_PER_IDENTITY + 1); - construct_pipeline (pipeline, i / RUNS_PER_IDENTITY + 1); - if (!gst_element_set_state (pipeline, GST_STATE_PLAYING)) - g_print ("WARNING: can't set pipeline to play\n"); - while (gst_bin_iterate (GST_BIN (pipeline))) - g_print ("+"); - g_print ("\n"); - g_print ("Unreffing pipeline\n"); - g_object_unref (G_OBJECT (pipeline)); - } - done = TRUE; -} - -int -main (gint argc, gchar * argv[]) -{ - done = FALSE; - - g_thread_init (NULL); - gst_init (&argc, &argv); - - g_thread_create ((GThreadFunc) thread, NULL, FALSE, NULL); - g_print ("main: created GThread\n"); - while (!done) - g_usleep (G_USEC_PER_SEC); - g_print ("main: done\n"); - return 0; -} diff --git a/tests/old/testsuite/threads/threadg.c b/tests/old/testsuite/threads/threadg.c deleted file mode 100644 index 73dc607a79..0000000000 --- a/tests/old/testsuite/threads/threadg.c +++ /dev/null @@ -1,63 +0,0 @@ -/* this tests if the GstThread is ok after removing all elements from it - * in PAUSED rather than NULL state. Currently it crashes with a mutex - * error - */ - -#include <gst/gst.h> - -int -main (int argc, char **argv) -{ - GstElement *thread, *pipeline; - GstElement *src, *sink, *queue; - int i; - - gst_init (&argc, &argv); - - pipeline = gst_element_factory_make ("pipeline", "pipeline"); - - src = gst_element_factory_make ("fakesrc", "src"); - g_assert (src); - - gst_bin_add (GST_BIN (pipeline), src); - - thread = gst_element_factory_make ("thread", "thread"); - g_assert (thread); - sink = gst_element_factory_make ("fakesink", "sink"); - g_assert (sink); - queue = gst_element_factory_make ("queue", "queue"); - g_assert (queue); - - gst_bin_add_many (GST_BIN (thread), queue, sink, NULL); - - gst_bin_add (GST_BIN (pipeline), thread); - - if (!gst_element_link_many (src, queue, sink, NULL)) - g_assert_not_reached (); - - - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) - g_assert_not_reached (); - - for (i = 0; i < 100; i++) { - if (!gst_bin_iterate (GST_BIN (pipeline))) - g_assert_not_reached (); - g_print ("%d\n", i); - } - - if (gst_element_set_state (pipeline, GST_STATE_PAUSED) != GST_STATE_SUCCESS) - g_assert_not_reached (); - - gst_bin_remove_many (GST_BIN (thread), queue, sink, NULL); - - if (gst_element_set_state (thread, GST_STATE_NULL) != GST_STATE_SUCCESS) - g_assert_not_reached (); - - gst_bin_remove (GST_BIN (pipeline), thread); - - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) - g_assert_not_reached (); - - - return 0; -} diff --git a/tests/old/testsuite/threads/threadh.c b/tests/old/testsuite/threads/threadh.c deleted file mode 100644 index 45f6323f50..0000000000 --- a/tests/old/testsuite/threads/threadh.c +++ /dev/null @@ -1,51 +0,0 @@ -#include <unistd.h> -#include <gst/gst.h> - -static GstElement *thread, *pipeline; -static GstElement *src, *sink; - -static void -handoff_src (GstElement * element) -{ - g_print ("identity handoff\n"); - - if (gst_element_set_state (thread, GST_STATE_PAUSED) != GST_STATE_SUCCESS) - g_assert_not_reached (); - - if (gst_element_set_state (sink, GST_STATE_READY) != GST_STATE_SUCCESS) - g_assert_not_reached (); - - gst_bin_remove (GST_BIN (thread), src); -} - -int -main (int argc, char **argv) -{ - gst_init (&argc, &argv); - - pipeline = gst_element_factory_make ("pipeline", "pipeline"); - - thread = gst_element_factory_make ("thread", "thread"); - g_assert (thread); - - src = gst_element_factory_make ("fakesrc", "src"); - g_assert (src); - g_signal_connect (G_OBJECT (src), "handoff", (GCallback) handoff_src, NULL); - g_object_set (G_OBJECT (src), "signal-handoffs", TRUE, NULL); - sink = gst_element_factory_make ("fakesink", "sink"); - g_assert (sink); - - gst_bin_add (GST_BIN (pipeline), thread); - - gst_bin_add_many (GST_BIN (thread), src, sink, NULL); - if (!gst_element_link_many (src, sink, NULL)) - g_assert_not_reached (); - - /* run a bit */ - if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) - g_assert_not_reached (); - - sleep (2); - - return 0; -} diff --git a/tests/old/testsuite/threads/threadi.c b/tests/old/testsuite/threads/threadi.c deleted file mode 100644 index 284e66363c..0000000000 --- a/tests/old/testsuite/threads/threadi.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Test three ways of going non-lineairly to PLAYING. Both tests have a - * thread containing a fakesrc/sink. - * - * Test1 tests by adding fakesrc/fakesink, setting fakesrc to PLAYING - * (which should increment the container state) and then synchronizing - * state and see if the bin iterates. This reflects bug #123775. - * - * Test2 does the same, but emits EOS directly. This will (in case of - * race conditions) sometimes lead to a state-change before the previous - * one succeeded. This bug is not fixed yet (999998). - * - * Test3 tests by adding fakesrc, putting thread to PLAYING, adding - * fakesink, syncing state and see if it iterates. The group is sometimes - * activated before fakesink is added to the bin, which is a bug in opt - * and a race in core that is not fixed yet (999999). - */ - -#include <gst/gst.h> - -static GstElement *pipeline, *fakesrc, *fakesink; - -static gboolean -cb_timeout (gpointer data) -{ - g_assert_not_reached (); - - return FALSE; -} - -static gboolean -cb_quit (gpointer data) -{ - gst_main_quit (); - - g_print ("Quit mainloop\n"); - - /* once */ - return FALSE; -} - -#if TESTNUM != 123775 -static void -cb_eos (gpointer data) -{ - g_print ("Received EOS\n"); - - g_idle_add ((GSourceFunc) cb_quit, NULL); -} -#else -static void -cb_data (gpointer data) -{ - static gboolean first = TRUE; - - g_print ("Received data\n"); - - if (first) { - first = FALSE; - g_idle_add ((GSourceFunc) cb_quit, NULL); - } -} -#endif - -static void -cb_state (GstElement * element, GstElementState old_state, - GstElementState new_state, gpointer data) -{ - g_print ("Changed state from %d to %d\n", old_state, new_state); -} - -static gboolean -cb_play (gpointer data) -{ - GstElementStateReturn res; - -#if TESTNUM != 999999 - g_print ("Setting state on fakesrc\n"); - gst_element_set_state (fakesrc, GST_STATE_PLAYING); - g_print ("Done\n"); -#else - g_print ("Setting state on pipeline w/o fakesink\n"); - gst_element_set_state (pipeline, GST_STATE_PLAYING); - g_print ("Adding fakesink\n"); - gst_bin_add (GST_BIN (pipeline), fakesink); - g_print ("Done\n"); -#endif - g_print ("Syncing state in pipeline\n"); - res = gst_bin_sync_children_state (GST_BIN (data)); - g_assert (res == GST_STATE_SUCCESS); - g_print ("Set to playing correctly: %d\n", GST_STATE (pipeline)); - - /* once */ - return FALSE; -} - -gint -main (gint argc, gchar * argv[]) -{ - gint id; - - gst_init (&argc, &argv); - - g_print ("Will do a test to see if bug %d is fixed\n", TESTNUM); - - pipeline = gst_thread_new ("p"); - g_signal_connect (pipeline, "state-change", G_CALLBACK (cb_state), NULL); - fakesrc = gst_element_factory_make ("fakesrc", "src"); - fakesink = gst_element_factory_make ("fakesink", "sink"); -#if TESTNUM != 123775 - g_object_set (G_OBJECT (fakesrc), "num-buffers", 0, NULL); - g_signal_connect (pipeline, "eos", G_CALLBACK (cb_eos), NULL); -#else - g_object_set (G_OBJECT (fakesink), "signal-handoffs", TRUE, NULL); - g_signal_connect (fakesink, "handoff", G_CALLBACK (cb_data), NULL); -#endif - -#if TESTNUM != 999999 - gst_bin_add_many (GST_BIN (pipeline), fakesrc, fakesink, NULL); -#else - gst_bin_add (GST_BIN (pipeline), fakesrc); -#endif - - gst_element_link (fakesrc, fakesink); - g_idle_add ((GSourceFunc) cb_play, pipeline); - - /* give 5 seconds */ - id = g_timeout_add (5000, (GSourceFunc) cb_timeout, NULL); - g_print ("Enter mainloop\n"); - gst_main (); - g_source_remove (id); - - gst_element_set_state (pipeline, GST_STATE_NULL); - gst_object_unref (GST_OBJECT (pipeline)); - - g_print ("Done with test to show bug %d, fixed correctly\n", TESTNUM); - - return 0; -} diff --git a/testsuite/caps/caps.h b/testsuite/caps/caps.h index 9c36868f1c..ea1f32f1b8 100644 --- a/testsuite/caps/caps.h +++ b/testsuite/caps/caps.h @@ -16,6 +16,7 @@ static const gchar *caps_list[] = { */ "video/x-raw-rgb, bpp = (int) 32, depth = (int) 24, endianness = (int) BIG_ENDIAN, red_mask = (int) 0x000000FF, framerate = (double) [ 0, max ]", "video/x-raw-rgb, bpp = (int) 32, depth = (int) 24, endianness = (int) BIG_ENDIAN, red_mask = (int) 0xFF000000, framerate = (double) [ 0, max ]", + "video/x-raw-rgb,\\ bpp=(int)32", "ANY", "EMPTY" };