From 7533cf8523a5f1188fe25ac8a9dbc763b39ccfe6 Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Wed, 30 Nov 2005 16:08:31 +0000 Subject: [PATCH] move all of these under tests Original commit message from CVS: move all of these under tests --- ChangeLog | 218 +++ Makefile.am | 32 +- check/.gitignore | 2 - check/Makefile.am | 110 -- check/elements/.gitignore | 4 - check/elements/fakesrc.c | 273 ---- check/elements/fdsrc.c | 211 --- check/elements/identity.c | 138 -- check/generic/.gitignore | 2 - check/generic/states.c | 93 -- check/gst-libs/.gitignore | 3 - check/gst-libs/controller.c | 629 --------- check/gst-libs/gdp.c | 312 ---- check/gst/.gitignore | 23 - check/gst/capslist.h | 31 - check/gst/gst.c | 111 -- check/gst/gstbin.c | 817 ----------- check/gst/gstbuffer.c | 302 ---- check/gst/gstbus.c | 256 ---- check/gst/gstcaps.c | 362 ----- check/gst/gstelement.c | 180 --- check/gst/gstevent.c | 416 ------ check/gst/gstghostpad.c | 362 ----- check/gst/gstiterator.c | 197 --- check/gst/gstmessage.c | 220 --- check/gst/gstminiobject.c | 210 --- check/gst/gstobject.c | 474 ------- check/gst/gstpad.c | 419 ------ check/gst/gstpipeline.c | 525 ------- check/gst/gstplugin.c | 331 ----- check/gst/gstsegment.c | 532 ------- check/gst/gststructure.c | 171 --- check/gst/gstsystemclock.c | 220 --- check/gst/gsttag.c | 244 ---- check/gst/gstutils.c | 305 ---- check/gst/gstvalue.c | 1407 ------------------- check/net/.gitignore | 3 - check/net/gstnetclientclock.c | 143 -- check/net/gstnettimeprovider.c | 140 -- check/pipelines/.gitignore | 4 - check/pipelines/cleanup.c | 132 -- check/pipelines/simple_launch_lines.c | 225 --- check/pipelines/stress.c | 88 -- check/states/.gitignore | 2 - check/states/sinks.c | 470 ------- configure.ac | 29 +- examples/Makefile.am | 29 - examples/appreader/.gitignore | 1 - examples/appreader/Makefile.am | 5 - examples/appreader/appreader.c | 76 - examples/controller/.gitignore | 4 - examples/controller/Makefile.am | 5 - examples/controller/audio-example.c | 78 - examples/cutter/.gitignore | 4 - examples/cutter/Makefile.am | 5 - examples/cutter/cutter.c | 203 --- examples/cutter/cutter.h | 14 - examples/events/Makefile.am | 4 - examples/events/seek.c | 68 - examples/helloworld/.gitignore | 4 - examples/helloworld/Makefile.am | 4 - examples/helloworld/helloworld.c | 87 -- examples/helloworld2/.gitignore | 1 - examples/helloworld2/Makefile.am | 5 - examples/helloworld2/helloworld2.c | 133 -- examples/launch/.gitignore | 5 - examples/launch/Makefile.am | 7 - examples/launch/mp3parselaunch.c | 35 - examples/launch/mp3play | 4 - examples/manual/.gitignore | 39 - examples/manual/Makefile.am | 104 -- examples/manual/extract.pl | 78 - examples/metadata/Makefile.am | 4 - examples/metadata/read-metadata.c | 207 --- examples/mixer/.gitignore | 5 - examples/mixer/Makefile.am | 5 - examples/mixer/mixer.c | 398 ------ examples/mixer/mixer.h | 12 - examples/pingpong/.gitignore | 12 - examples/pingpong/Makefile.am | 5 - examples/pingpong/pingpong.c | 99 -- examples/plugins/.gitignore | 10 - examples/plugins/Makefile.am | 12 - examples/plugins/example.c | 426 ------ examples/plugins/example.h | 87 -- examples/pwg/.gitignore | 18 - examples/pwg/Makefile.am | 88 -- examples/pwg/extract.pl | 78 - examples/queue/.gitignore | 4 - examples/queue/Makefile.am | 5 - examples/queue/queue.c | 94 -- examples/queue2/.gitignore | 4 - examples/queue2/Makefile.am | 5 - examples/queue2/queue2.c | 76 - examples/queue3/.gitignore | 4 - examples/queue3/Makefile.am | 5 - examples/queue3/queue3.c | 76 - examples/queue4/.gitignore | 4 - examples/queue4/Makefile.am | 5 - examples/queue4/queue4.c | 84 -- examples/retag/.gitignore | 5 - examples/retag/Makefile.am | 7 - examples/retag/retag.c | 103 -- examples/retag/transcode.c | 105 -- examples/thread/.gitignore | 4 - examples/thread/Makefile.am | 5 - examples/thread/thread.c | 79 -- examples/typefind/.gitignore | 4 - examples/typefind/Makefile.am | 5 - examples/typefind/typefind.c | 60 - examples/xml/.gitignore | 6 - examples/xml/Makefile.am | 7 - examples/xml/createxml.c | 92 -- examples/xml/runxml.c | 61 - tests/Makefile.am | 35 +- tests/check/Makefile.am | 24 +- testsuite/.gitignore | 14 - testsuite/Makefile.am | 38 - testsuite/Rules | 33 - testsuite/caps/.gitignore | 36 - testsuite/caps/Makefile.am | 33 - testsuite/caps/app_fixate.c | 51 - testsuite/caps/audioscale.c | 174 --- testsuite/caps/caps.c | 159 --- testsuite/caps/caps.h | 18 - testsuite/caps/caps_strings | 263 ---- testsuite/caps/compatibility.c | 93 -- testsuite/caps/deserialize.c | 85 -- testsuite/caps/enumcaps.c | 95 -- testsuite/caps/eratosthenes.c | 71 - testsuite/caps/filtercaps.c | 49 - testsuite/caps/fixed.c | 82 -- testsuite/caps/fraction-convert.c | 139 -- testsuite/caps/fraction-multiply-and-zero.c | 131 -- testsuite/caps/intersect2.c | 121 -- testsuite/caps/intersection.c | 111 -- testsuite/caps/normalisation.c | 85 -- testsuite/caps/random.c | 69 - testsuite/caps/renegotiate.c | 150 -- testsuite/caps/sets.c | 81 -- testsuite/caps/simplify.c | 125 -- testsuite/caps/string-conversions.c | 205 --- testsuite/caps/structure.c | 25 - testsuite/caps/subtract.c | 63 - testsuite/caps/union.c | 34 - testsuite/debug/.gitignore | 5 - testsuite/debug/Makefile.am | 5 - testsuite/debug/category.c | 84 -- testsuite/debug/commandline.c | 118 -- testsuite/debug/global.c | 112 -- testsuite/debug/output.c | 127 -- testsuite/debug/printf_extension.c | 48 - testsuite/dlopen/.gitignore | 1 - testsuite/dlopen/Makefile.am | 41 - testsuite/dlopen/dlopen_gst.c | 28 - testsuite/dlopen/loadgst.c | 26 - testsuite/elements/.gitignore | 16 - testsuite/elements/Makefile.am | 15 - testsuite/elements/gst-inspect-check.in | 90 -- testsuite/elements/struct_i386.h | 148 -- testsuite/elements/struct_size.c | 69 - testsuite/indexers/.gitignore | 9 - testsuite/indexers/Makefile.am | 5 - testsuite/indexers/cache1.c | 114 -- testsuite/indexers/indexdump.c | 81 -- testsuite/parse/.gitignore | 9 - testsuite/parse/Makefile.am | 5 - testsuite/parse/parse1.c | 229 --- testsuite/parse/parse2.c | 212 --- testsuite/plugin/.gitignore | 16 - testsuite/plugin/Makefile.am | 16 - testsuite/plugin/README | 59 - testsuite/plugin/dynamic.c | 23 - testsuite/plugin/linked.c | 22 - testsuite/plugin/loading.c | 60 - testsuite/plugin/registry.c | 17 - testsuite/plugin/static.c | 22 - testsuite/plugin/static2.c | 49 - testsuite/plugin/testplugin.c | 18 - testsuite/plugin/testplugin2.c | 18 - testsuite/plugin/testplugin2_s.c | 18 - testsuite/plugin/testplugin_s.c | 18 - testsuite/refcounting/.gitignore | 14 - testsuite/refcounting/Makefile.am | 14 - testsuite/refcounting/bin.c | 318 ----- testsuite/refcounting/element.c | 139 -- testsuite/refcounting/element_pad.c | 115 -- testsuite/refcounting/mainloop.c | 32 - testsuite/refcounting/mem.c | 31 - testsuite/refcounting/mem.h | 1 - testsuite/refcounting/object.c | 160 --- testsuite/refcounting/pad.c | 153 -- testsuite/refcounting/sched.c | 77 - testsuite/refcounting/thread.c | 304 ---- testsuite/states/.gitignore | 11 - testsuite/states/Makefile.am | 5 - testsuite/states/bin.c | 158 --- testsuite/states/locked.c | 105 -- testsuite/states/parent.c | 111 -- testsuite/threads/.gitignore | 19 - testsuite/threads/159566.c | 96 -- testsuite/threads/159852.c | 33 - testsuite/threads/Makefile.am | 33 - testsuite/threads/queue.c | 89 -- testsuite/threads/signals.c | 231 --- testsuite/threads/staticrec.c | 49 - testsuite/threads/thread.c | 128 -- testsuite/threads/threadb.c | 80 -- testsuite/threads/threadc.c | 93 -- testsuite/threads/threadd.c | 95 -- testsuite/threads/threade.c | 81 -- testsuite/threads/threadf.c | 83 -- testsuite/threads/threadg.c | 67 - testsuite/threads/threadh.c | 53 - testsuite/threads/threadi.c | 139 -- 215 files changed, 266 insertions(+), 22251 deletions(-) delete mode 100644 check/.gitignore delete mode 100644 check/Makefile.am delete mode 100644 check/elements/.gitignore delete mode 100644 check/elements/fakesrc.c delete mode 100644 check/elements/fdsrc.c delete mode 100644 check/elements/identity.c delete mode 100644 check/generic/.gitignore delete mode 100644 check/generic/states.c delete mode 100644 check/gst-libs/.gitignore delete mode 100644 check/gst-libs/controller.c delete mode 100644 check/gst-libs/gdp.c delete mode 100644 check/gst/.gitignore delete mode 100644 check/gst/capslist.h delete mode 100644 check/gst/gst.c delete mode 100644 check/gst/gstbin.c delete mode 100644 check/gst/gstbuffer.c delete mode 100644 check/gst/gstbus.c delete mode 100644 check/gst/gstcaps.c delete mode 100644 check/gst/gstelement.c delete mode 100644 check/gst/gstevent.c delete mode 100644 check/gst/gstghostpad.c delete mode 100644 check/gst/gstiterator.c delete mode 100644 check/gst/gstmessage.c delete mode 100644 check/gst/gstminiobject.c delete mode 100644 check/gst/gstobject.c delete mode 100644 check/gst/gstpad.c delete mode 100644 check/gst/gstpipeline.c delete mode 100644 check/gst/gstplugin.c delete mode 100644 check/gst/gstsegment.c delete mode 100644 check/gst/gststructure.c delete mode 100644 check/gst/gstsystemclock.c delete mode 100644 check/gst/gsttag.c delete mode 100644 check/gst/gstutils.c delete mode 100644 check/gst/gstvalue.c delete mode 100644 check/net/.gitignore delete mode 100644 check/net/gstnetclientclock.c delete mode 100644 check/net/gstnettimeprovider.c delete mode 100644 check/pipelines/.gitignore delete mode 100644 check/pipelines/cleanup.c delete mode 100644 check/pipelines/simple_launch_lines.c delete mode 100644 check/pipelines/stress.c delete mode 100644 check/states/.gitignore delete mode 100644 check/states/sinks.c delete mode 100644 examples/Makefile.am delete mode 100644 examples/appreader/.gitignore delete mode 100644 examples/appreader/Makefile.am delete mode 100644 examples/appreader/appreader.c delete mode 100644 examples/controller/.gitignore delete mode 100644 examples/controller/Makefile.am delete mode 100644 examples/controller/audio-example.c delete mode 100644 examples/cutter/.gitignore delete mode 100644 examples/cutter/Makefile.am delete mode 100644 examples/cutter/cutter.c delete mode 100644 examples/cutter/cutter.h delete mode 100644 examples/events/Makefile.am delete mode 100644 examples/events/seek.c delete mode 100644 examples/helloworld/.gitignore delete mode 100644 examples/helloworld/Makefile.am delete mode 100644 examples/helloworld/helloworld.c delete mode 100644 examples/helloworld2/.gitignore delete mode 100644 examples/helloworld2/Makefile.am delete mode 100644 examples/helloworld2/helloworld2.c delete mode 100644 examples/launch/.gitignore delete mode 100644 examples/launch/Makefile.am delete mode 100644 examples/launch/mp3parselaunch.c delete mode 100755 examples/launch/mp3play delete mode 100644 examples/manual/.gitignore delete mode 100644 examples/manual/Makefile.am delete mode 100755 examples/manual/extract.pl delete mode 100644 examples/metadata/Makefile.am delete mode 100644 examples/metadata/read-metadata.c delete mode 100644 examples/mixer/.gitignore delete mode 100644 examples/mixer/Makefile.am delete mode 100644 examples/mixer/mixer.c delete mode 100644 examples/mixer/mixer.h delete mode 100644 examples/pingpong/.gitignore delete mode 100644 examples/pingpong/Makefile.am delete mode 100644 examples/pingpong/pingpong.c delete mode 100644 examples/plugins/.gitignore delete mode 100644 examples/plugins/Makefile.am delete mode 100644 examples/plugins/example.c delete mode 100644 examples/plugins/example.h delete mode 100644 examples/pwg/.gitignore delete mode 100644 examples/pwg/Makefile.am delete mode 100755 examples/pwg/extract.pl delete mode 100644 examples/queue/.gitignore delete mode 100644 examples/queue/Makefile.am delete mode 100644 examples/queue/queue.c delete mode 100644 examples/queue2/.gitignore delete mode 100644 examples/queue2/Makefile.am delete mode 100644 examples/queue2/queue2.c delete mode 100644 examples/queue3/.gitignore delete mode 100644 examples/queue3/Makefile.am delete mode 100644 examples/queue3/queue3.c delete mode 100644 examples/queue4/.gitignore delete mode 100644 examples/queue4/Makefile.am delete mode 100644 examples/queue4/queue4.c delete mode 100644 examples/retag/.gitignore delete mode 100644 examples/retag/Makefile.am delete mode 100644 examples/retag/retag.c delete mode 100644 examples/retag/transcode.c delete mode 100644 examples/thread/.gitignore delete mode 100644 examples/thread/Makefile.am delete mode 100644 examples/thread/thread.c delete mode 100644 examples/typefind/.gitignore delete mode 100644 examples/typefind/Makefile.am delete mode 100644 examples/typefind/typefind.c delete mode 100644 examples/xml/.gitignore delete mode 100644 examples/xml/Makefile.am delete mode 100644 examples/xml/createxml.c delete mode 100644 examples/xml/runxml.c delete mode 100644 testsuite/.gitignore delete mode 100644 testsuite/Makefile.am delete mode 100644 testsuite/Rules delete mode 100644 testsuite/caps/.gitignore delete mode 100644 testsuite/caps/Makefile.am delete mode 100644 testsuite/caps/app_fixate.c delete mode 100644 testsuite/caps/audioscale.c delete mode 100644 testsuite/caps/caps.c delete mode 100644 testsuite/caps/caps.h delete mode 100644 testsuite/caps/caps_strings delete mode 100644 testsuite/caps/compatibility.c delete mode 100644 testsuite/caps/deserialize.c delete mode 100644 testsuite/caps/enumcaps.c delete mode 100644 testsuite/caps/eratosthenes.c delete mode 100644 testsuite/caps/filtercaps.c delete mode 100644 testsuite/caps/fixed.c delete mode 100644 testsuite/caps/fraction-convert.c delete mode 100644 testsuite/caps/fraction-multiply-and-zero.c delete mode 100644 testsuite/caps/intersect2.c delete mode 100644 testsuite/caps/intersection.c delete mode 100644 testsuite/caps/normalisation.c delete mode 100644 testsuite/caps/random.c delete mode 100644 testsuite/caps/renegotiate.c delete mode 100644 testsuite/caps/sets.c delete mode 100644 testsuite/caps/simplify.c delete mode 100644 testsuite/caps/string-conversions.c delete mode 100644 testsuite/caps/structure.c delete mode 100644 testsuite/caps/subtract.c delete mode 100644 testsuite/caps/union.c delete mode 100644 testsuite/debug/.gitignore delete mode 100644 testsuite/debug/Makefile.am delete mode 100644 testsuite/debug/category.c delete mode 100644 testsuite/debug/commandline.c delete mode 100644 testsuite/debug/global.c delete mode 100644 testsuite/debug/output.c delete mode 100644 testsuite/debug/printf_extension.c delete mode 100644 testsuite/dlopen/.gitignore delete mode 100644 testsuite/dlopen/Makefile.am delete mode 100644 testsuite/dlopen/dlopen_gst.c delete mode 100644 testsuite/dlopen/loadgst.c delete mode 100644 testsuite/elements/.gitignore delete mode 100644 testsuite/elements/Makefile.am delete mode 100755 testsuite/elements/gst-inspect-check.in delete mode 100644 testsuite/elements/struct_i386.h delete mode 100644 testsuite/elements/struct_size.c delete mode 100644 testsuite/indexers/.gitignore delete mode 100644 testsuite/indexers/Makefile.am delete mode 100644 testsuite/indexers/cache1.c delete mode 100644 testsuite/indexers/indexdump.c delete mode 100644 testsuite/parse/.gitignore delete mode 100644 testsuite/parse/Makefile.am delete mode 100644 testsuite/parse/parse1.c delete mode 100644 testsuite/parse/parse2.c delete mode 100644 testsuite/plugin/.gitignore delete mode 100644 testsuite/plugin/Makefile.am delete mode 100644 testsuite/plugin/README delete mode 100644 testsuite/plugin/dynamic.c delete mode 100644 testsuite/plugin/linked.c delete mode 100644 testsuite/plugin/loading.c delete mode 100644 testsuite/plugin/registry.c delete mode 100644 testsuite/plugin/static.c delete mode 100644 testsuite/plugin/static2.c delete mode 100644 testsuite/plugin/testplugin.c delete mode 100644 testsuite/plugin/testplugin2.c delete mode 100644 testsuite/plugin/testplugin2_s.c delete mode 100644 testsuite/plugin/testplugin_s.c delete mode 100644 testsuite/refcounting/.gitignore delete mode 100644 testsuite/refcounting/Makefile.am delete mode 100644 testsuite/refcounting/bin.c delete mode 100644 testsuite/refcounting/element.c delete mode 100644 testsuite/refcounting/element_pad.c delete mode 100644 testsuite/refcounting/mainloop.c delete mode 100644 testsuite/refcounting/mem.c delete mode 100644 testsuite/refcounting/mem.h delete mode 100644 testsuite/refcounting/object.c delete mode 100644 testsuite/refcounting/pad.c delete mode 100644 testsuite/refcounting/sched.c delete mode 100644 testsuite/refcounting/thread.c delete mode 100644 testsuite/states/.gitignore delete mode 100644 testsuite/states/Makefile.am delete mode 100644 testsuite/states/bin.c delete mode 100644 testsuite/states/locked.c delete mode 100644 testsuite/states/parent.c delete mode 100644 testsuite/threads/.gitignore delete mode 100644 testsuite/threads/159566.c delete mode 100644 testsuite/threads/159852.c delete mode 100644 testsuite/threads/Makefile.am delete mode 100644 testsuite/threads/queue.c delete mode 100644 testsuite/threads/signals.c delete mode 100644 testsuite/threads/staticrec.c delete mode 100644 testsuite/threads/thread.c delete mode 100644 testsuite/threads/threadb.c delete mode 100644 testsuite/threads/threadc.c delete mode 100644 testsuite/threads/threadd.c delete mode 100644 testsuite/threads/threade.c delete mode 100644 testsuite/threads/threadf.c delete mode 100644 testsuite/threads/threadg.c delete mode 100644 testsuite/threads/threadh.c delete mode 100644 testsuite/threads/threadi.c diff --git a/ChangeLog b/ChangeLog index 1b435cf6f6..d4c650967b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,221 @@ +2005-11-30 Thomas Vander Stichele + + * Makefile.am: + * check/.cvsignore: + * check/Makefile.am: + * check/elements/.cvsignore: + * check/elements/fakesrc.c: + * check/elements/fdsrc.c: + * check/elements/identity.c: + * check/generic/.cvsignore: + * check/generic/states.c: + * check/gst-libs/.cvsignore: + * check/gst-libs/controller.c: + * check/gst-libs/gdp.c: + * check/gst/.cvsignore: + * check/gst/capslist.h: + * check/gst/gst.c: + * check/gst/gstbin.c: + * check/gst/gstbuffer.c: + * check/gst/gstbus.c: + * check/gst/gstcaps.c: + * check/gst/gstelement.c: + * check/gst/gstevent.c: + * check/gst/gstghostpad.c: + * check/gst/gstiterator.c: + * check/gst/gstmessage.c: + * check/gst/gstminiobject.c: + * check/gst/gstobject.c: + * check/gst/gstpad.c: + * check/gst/gstpipeline.c: + * check/gst/gstplugin.c: + * check/gst/gstsegment.c: + * check/gst/gststructure.c: + * check/gst/gstsystemclock.c: + * check/gst/gsttag.c: + * check/gst/gstutils.c: + * check/gst/gstvalue.c: + * check/net/.cvsignore: + * check/net/gstnetclientclock.c: + * check/net/gstnettimeprovider.c: + * check/pipelines/.cvsignore: + * check/pipelines/cleanup.c: + * check/pipelines/simple_launch_lines.c: + * check/pipelines/stress.c: + * check/states/.cvsignore: + * check/states/sinks.c: + * configure.ac: + * examples/Makefile.am: + * examples/appreader/.cvsignore: + * examples/appreader/Makefile.am: + * examples/appreader/appreader.c: + * examples/controller/.cvsignore: + * examples/controller/Makefile.am: + * examples/controller/audio-example.c: + * examples/cutter/.cvsignore: + * examples/cutter/Makefile.am: + * examples/cutter/cutter.c: + * examples/cutter/cutter.h: + * examples/events/Makefile.am: + * examples/events/seek.c: + * examples/helloworld/.cvsignore: + * examples/helloworld/Makefile.am: + * examples/helloworld/helloworld.c: + * examples/helloworld2/.cvsignore: + * examples/helloworld2/Makefile.am: + * examples/helloworld2/helloworld2.c: + * examples/launch/.cvsignore: + * examples/launch/Makefile.am: + * examples/launch/mp3parselaunch.c: + * examples/launch/mp3play: + * examples/manual/.cvsignore: + * examples/manual/Makefile.am: + * examples/manual/extract.pl: + * examples/metadata/Makefile.am: + * examples/metadata/read-metadata.c: + * examples/mixer/.cvsignore: + * examples/mixer/Makefile.am: + * examples/mixer/mixer.c: + * examples/mixer/mixer.h: + * examples/pingpong/.cvsignore: + * examples/pingpong/Makefile.am: + * examples/pingpong/pingpong.c: + * examples/plugins/.cvsignore: + * examples/plugins/Makefile.am: + * examples/plugins/example.c: + * examples/plugins/example.h: + * examples/pwg/.cvsignore: + * examples/pwg/Makefile.am: + * examples/pwg/extract.pl: + * examples/queue/.cvsignore: + * examples/queue/Makefile.am: + * examples/queue/queue.c: + * examples/queue2/.cvsignore: + * examples/queue2/Makefile.am: + * examples/queue2/queue2.c: + * examples/queue3/.cvsignore: + * examples/queue3/Makefile.am: + * examples/queue3/queue3.c: + * examples/queue4/.cvsignore: + * examples/queue4/Makefile.am: + * examples/queue4/queue4.c: + * examples/retag/.cvsignore: + * examples/retag/Makefile.am: + * examples/retag/retag.c: + * examples/retag/transcode.c: + * examples/thread/.cvsignore: + * examples/thread/Makefile.am: + * examples/thread/thread.c: + * examples/typefind/.cvsignore: + * examples/typefind/Makefile.am: + * examples/typefind/typefind.c: + * examples/xml/.cvsignore: + * examples/xml/Makefile.am: + * examples/xml/createxml.c: + * examples/xml/runxml.c: + * tests/Makefile.am: + * tests/check/Makefile.am: + * testsuite/.cvsignore: + * testsuite/Makefile.am: + * testsuite/Rules: + * testsuite/caps/.cvsignore: + * testsuite/caps/Makefile.am: + * testsuite/caps/app_fixate.c: + * testsuite/caps/audioscale.c: + * testsuite/caps/caps.c: + * testsuite/caps/caps.h: + * testsuite/caps/caps_strings: + * testsuite/caps/compatibility.c: + * testsuite/caps/deserialize.c: + * testsuite/caps/enumcaps.c: + * testsuite/caps/eratosthenes.c: + * testsuite/caps/filtercaps.c: + * testsuite/caps/fixed.c: + * testsuite/caps/fraction-convert.c: + * testsuite/caps/fraction-multiply-and-zero.c: + * testsuite/caps/intersect2.c: + * testsuite/caps/intersection.c: + * testsuite/caps/normalisation.c: + * testsuite/caps/random.c: + * testsuite/caps/renegotiate.c: + * testsuite/caps/sets.c: + * testsuite/caps/simplify.c: + * testsuite/caps/string-conversions.c: + * testsuite/caps/structure.c: + * testsuite/caps/subtract.c: + * testsuite/caps/union.c: + * testsuite/debug/.cvsignore: + * testsuite/debug/Makefile.am: + * testsuite/debug/category.c: + * testsuite/debug/commandline.c: + * testsuite/debug/global.c: + * testsuite/debug/output.c: + * testsuite/debug/printf_extension.c: + * testsuite/dlopen/.cvsignore: + * testsuite/dlopen/Makefile.am: + * testsuite/dlopen/dlopen_gst.c: + * testsuite/dlopen/loadgst.c: + * testsuite/elements/.cvsignore: + * testsuite/elements/Makefile.am: + * testsuite/elements/gst-inspect-check.in: + * testsuite/elements/struct_i386.h: + * testsuite/elements/struct_size.c: + * testsuite/indexers/.cvsignore: + * testsuite/indexers/Makefile.am: + * testsuite/indexers/cache1.c: + * testsuite/indexers/indexdump.c: + * testsuite/parse/.cvsignore: + * testsuite/parse/Makefile.am: + * testsuite/parse/parse1.c: + * testsuite/parse/parse2.c: + * testsuite/plugin/.cvsignore: + * testsuite/plugin/Makefile.am: + * testsuite/plugin/README: + * testsuite/plugin/dynamic.c: + * testsuite/plugin/linked.c: + * testsuite/plugin/loading.c: + * testsuite/plugin/registry.c: + * testsuite/plugin/static.c: + * testsuite/plugin/static2.c: + * testsuite/plugin/testplugin.c: + * testsuite/plugin/testplugin2.c: + * testsuite/plugin/testplugin2_s.c: + * testsuite/plugin/testplugin_s.c: + * testsuite/refcounting/.cvsignore: + * testsuite/refcounting/Makefile.am: + * testsuite/refcounting/bin.c: + * testsuite/refcounting/element.c: + * testsuite/refcounting/element_pad.c: + * testsuite/refcounting/mainloop.c: + * testsuite/refcounting/mem.c: + * testsuite/refcounting/mem.h: + * testsuite/refcounting/object.c: + * testsuite/refcounting/pad.c: + * testsuite/refcounting/sched.c: + * testsuite/refcounting/thread.c: + * testsuite/states/.cvsignore: + * testsuite/states/Makefile.am: + * testsuite/states/bin.c: + * testsuite/states/locked.c: + * testsuite/states/parent.c: + * testsuite/threads/.cvsignore: + * testsuite/threads/159566.c: + * testsuite/threads/159852.c: + * testsuite/threads/Makefile.am: + * testsuite/threads/queue.c: + * testsuite/threads/signals.c: + * testsuite/threads/staticrec.c: + * testsuite/threads/thread.c: + * testsuite/threads/threadb.c: + * testsuite/threads/threadc.c: + * testsuite/threads/threadd.c: + * testsuite/threads/threade.c: + * testsuite/threads/threadf.c: + * testsuite/threads/threadg.c: + * testsuite/threads/threadh.c: + * testsuite/threads/threadi.c: + move all of these under tests + 2005-11-30 Thomas Vander Stichele * configure.ac: diff --git a/Makefile.am b/Makefile.am index 08d6f2ef90..48c6173899 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,27 +1,5 @@ DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc --enable-docbook -if BUILD_TESTS -## SUBDIRS_TESTS = tests testsuite -## FIXME: write tests from scratch -SUBDIRS_TESTS = -if HAVE_CHECK -SUBDIRS_CHECK = check -else -SUBDIRS_CHECK = -endif -else -SUBDIRS_TESTS = -SUBDIRS_CHECK = -endif - -if BUILD_EXAMPLES -## FIXME: write examples from scratch -# SUBDIRS_EXAMPLES = examples -SUBDIRS_EXAMPLES = -else -SUBDIRS_EXAMPLES = -endif - all-local: gst-element-check-@GST_MAJORMINOR@.m4 gst-element-check-@GST_MAJORMINOR@.m4: gst-element-check.m4 @@ -34,9 +12,6 @@ aclocal_DATA = gst-element-check-@GST_MAJORMINOR@.m4 SUBDIRS = \ gst libs plugins tools \ - $(SUBDIRS_CHECK) \ - $(SUBDIRS_TESTS) \ - $(SUBDIRS_EXAMPLES) \ docs \ pkgconfig po \ common @@ -44,9 +19,6 @@ SUBDIRS = \ # These are all the possible subdirs DIST_SUBDIRS = \ gst libs plugins tools \ - check \ - tests testsuite \ - examples \ docs \ pkgconfig po \ common @@ -119,10 +91,10 @@ endif if HAVE_CHECK check-valgrind: - cd check && make check-valgrind + cd tests/check && make check-valgrind check-torture: - cd check && make torture + cd tests/check && make torture else check-valgrind: echo "'check' library not installed, skipping" diff --git a/check/.gitignore b/check/.gitignore deleted file mode 100644 index 597c6e864c..0000000000 --- a/check/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -test-registry.xml -*.gcno diff --git a/check/Makefile.am b/check/Makefile.am deleted file mode 100644 index a4c5a2d501..0000000000 --- a/check/Makefile.am +++ /dev/null @@ -1,110 +0,0 @@ -include $(top_srcdir)/common/check.mak - -CHECK_REGISTRY = $(top_builddir)/check/test-registry.xml - -GST_TOOLS_DIR = $(top_builddir)/tools - -REGISTRY_ENVIRONMENT = \ - GST_REGISTRY=$(CHECK_REGISTRY) - -TESTS_ENVIRONMENT = \ - $(REGISTRY_ENVIRONMENT) \ - GST_PLUGIN_SYSTEM_PATH= \ - GST_PLUGIN_PATH=$(top_builddir)/plugins - -plugindir = $(libdir)/gstreamer-@GST_MAJORMINOR@ - -# override to _not_ install the test plugins -install-pluginLTLIBRARIES: - -# ths core dumps of some machines have PIDs appended -CLEANFILES = core.* test-registry.xml - -SUPPRESSIONS = $(top_srcdir)/common/gst.supp - -clean-local: clean-local-check - -# checks to fix -# gst/gstplugin - -check_PROGRAMS = \ - gst/gst \ - gst/gstbin \ - gst/gstbuffer \ - gst/gstbus \ - gst/gstcaps \ - gst/gstelement \ - gst/gstevent \ - gst/gstghostpad \ - gst/gstiterator \ - gst/gstmessage \ - gst/gstminiobject \ - gst/gstobject \ - gst/gstpad \ - gst/gstplugin \ - gst/gstsegment \ - gst/gstsystemclock \ - gst/gststructure \ - gst/gsttag \ - gst/gstutils \ - gst/gstvalue \ - elements/fakesrc \ - elements/identity \ - elements/fdsrc \ - generic/states \ - pipelines/simple_launch_lines \ - pipelines/stress \ - pipelines/cleanup \ - states/sinks \ - gst-libs/controller \ - gst-libs/gdp \ - net/gstnetclientclock \ - net/gstnettimeprovider - -# failing tests -noinst_PROGRAMS = \ - gst/gstpipeline - -TESTS = $(check_PROGRAMS) - -noinst_HEADERS = gst/capslist.h - -AM_CFLAGS = $(GST_OBJ_CFLAGS) $(CHECK_CFLAGS) -LDADD = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ - $(GST_OBJ_LIBS) \ - $(CHECK_LIBS) - -gst_libs_gdp_SOURCES = \ - gst-libs/gdp.c \ - $(top_srcdir)/libs/gst/dataprotocol/dataprotocol.c -gst_libs_gdp_CFLAGS = $(AM_CFLAGS) - -elements_fdsrc_CFLAGS=$(GST_OBJ_CFLAGS) $(CHECK_CFLAGS) -DTESTFILE=\"$(top_srcdir)/configure.ac\" - -gst_libs_controller_LDADD = \ - $(top_builddir)/libs/gst/controller/libgstcontroller-@GST_MAJORMINOR@.la \ - $(LDADD) - -net_gstnetclientclock_LDADD = \ - $(top_builddir)/libs/gst/net/libgstnet-@GST_MAJORMINOR@.la \ - $(LDADD) -net_gstnettimeprovider_LDADD = \ - $(top_builddir)/libs/gst/net/libgstnet-@GST_MAJORMINOR@.la \ - $(LDADD) - -# valgrind testing -# these just need valgrind fixing, period -VALGRIND_TO_FIX = - -VALGRIND_IGNORE = \ - pipelines/stress - -# these need fixing because the threads cause segfaults under valgrind -TESTS_THREADED = \ - gst/gstminiobject \ - gst/gstobject - -VALGRIND_TESTS_DISABLE = \ - $(TESTS_THREADED) \ - $(VALGRIND_IGNORE) \ - $(VALGRIND_TO_FIX) diff --git a/check/elements/.gitignore b/check/elements/.gitignore deleted file mode 100644 index a9f599cac6..0000000000 --- a/check/elements/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -.dirstamp -fakesrc -fdsrc -identity diff --git a/check/elements/fakesrc.c b/check/elements/fakesrc.c deleted file mode 100644 index d2c6c822be..0000000000 --- a/check/elements/fakesrc.c +++ /dev/null @@ -1,273 +0,0 @@ -/* GStreamer - * - * unit test for fakesrc - * - * Copyright (C) <2005> Thomas Vander Stichele - * - * 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 - -gboolean have_eos = FALSE; - -GstPad *mysinkpad; - -static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - -gboolean -event_func (GstPad * pad, GstEvent * event) -{ - if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) { - have_eos = TRUE; - gst_event_unref (event); - return TRUE; - } - - gst_event_unref (event); - return FALSE; -} - -GstElement * -setup_fakesrc () -{ - GstElement *fakesrc; - - GST_DEBUG ("setup_fakesrc"); - fakesrc = gst_check_setup_element ("fakesrc"); - mysinkpad = gst_check_setup_sink_pad (fakesrc, &sinktemplate, NULL); - gst_pad_set_event_function (mysinkpad, event_func); - gst_pad_set_active (mysinkpad, TRUE); - return fakesrc; -} - -void -cleanup_fakesrc (GstElement * fakesrc) -{ - gst_check_teardown_sink_pad (fakesrc); - gst_check_teardown_element (fakesrc); -} - -GST_START_TEST (test_num_buffers) -{ - GstElement *src; - - src = setup_fakesrc (); - g_object_set (G_OBJECT (src), "num-buffers", 3, NULL); - fail_unless (gst_element_set_state (src, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - while (!have_eos) { - g_usleep (1000); - } - - fail_unless (g_list_length (buffers) == 3); - g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL); - g_list_free (buffers); - - fail_unless (gst_element_set_state (src, - GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null"); - - /* cleanup */ - cleanup_fakesrc (src); -} - -GST_END_TEST; - -GST_START_TEST (test_sizetype_empty) -{ - GstElement *src; - GList *l; - - src = setup_fakesrc (); - - g_object_set (G_OBJECT (src), "sizetype", 1, NULL); - g_object_set (G_OBJECT (src), "num-buffers", 100, NULL); - - fail_unless (gst_element_set_state (src, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - while (!have_eos) { - g_usleep (1000); - } - - fail_unless (g_list_length (buffers) == 100); - l = buffers; - while (l) { - GstBuffer *buf = l->data; - - fail_unless (GST_BUFFER_SIZE (buf) == 0); - l = l->next; - } - g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL); - g_list_free (buffers); - - fail_unless (gst_element_set_state (src, - GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null"); - - /* cleanup */ - cleanup_fakesrc (src); -} - -GST_END_TEST; - -GST_START_TEST (test_sizetype_fixed) -{ - GstElement *src; - GList *l; - - src = setup_fakesrc (); - - g_object_set (G_OBJECT (src), "sizetype", 2, NULL); - g_object_set (G_OBJECT (src), "sizemax", 8192, NULL); - g_object_set (G_OBJECT (src), "num-buffers", 100, NULL); - - fail_unless (gst_element_set_state (src, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - while (!have_eos) { - g_usleep (1000); - } - - fail_unless (g_list_length (buffers) == 100); - l = buffers; - while (l) { - GstBuffer *buf = l->data; - - fail_unless (GST_BUFFER_SIZE (buf) == 8192); - l = l->next; - } - g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL); - g_list_free (buffers); - - fail_unless (gst_element_set_state (src, - GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null"); - - /* cleanup */ - cleanup_fakesrc (src); -} - -GST_END_TEST; - -GST_START_TEST (test_sizetype_random) -{ - GstElement *src; - GList *l; - - src = setup_fakesrc (); - - g_object_set (G_OBJECT (src), "sizetype", 3, NULL); - g_object_set (G_OBJECT (src), "sizemin", 4096, NULL); - g_object_set (G_OBJECT (src), "sizemax", 8192, NULL); - g_object_set (G_OBJECT (src), "num-buffers", 100, NULL); - - fail_unless (gst_element_set_state (src, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - while (!have_eos) { - g_usleep (1000); - } - - fail_unless (g_list_length (buffers) == 100); - l = buffers; - while (l) { - GstBuffer *buf = l->data; - - fail_if (GST_BUFFER_SIZE (buf) > 8192); - fail_if (GST_BUFFER_SIZE (buf) < 4096); - l = l->next; - } - g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL); - g_list_free (buffers); - - fail_unless (gst_element_set_state (src, - GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null"); - - /* cleanup */ - cleanup_fakesrc (src); -} - -GST_END_TEST; - -GST_START_TEST (test_no_preroll) -{ - GstElement *src; - GstStateChangeReturn ret; - - src = setup_fakesrc (); - - g_object_set (G_OBJECT (src), "is-live", TRUE, NULL); - - ret = gst_element_set_state (src, GST_STATE_PAUSED); - - fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, - "error going to paused the first time"); - - ret = gst_element_set_state (src, GST_STATE_PAUSED); - - fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, - "error going to paused the second time"); - - fail_unless (gst_element_set_state (src, - GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null"); - - /* cleanup */ - cleanup_fakesrc (src); -} - -GST_END_TEST; - -Suite * -fakesrc_suite (void) -{ - Suite *s = suite_create ("fakesrc"); - TCase *tc_chain = tcase_create ("general"); - - suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, test_num_buffers); - tcase_add_test (tc_chain, test_sizetype_empty); - tcase_add_test (tc_chain, test_sizetype_fixed); - tcase_add_test (tc_chain, test_sizetype_random); - tcase_add_test (tc_chain, test_no_preroll); - - return s; -} - -int -main (int argc, char **argv) -{ - int nf; - - Suite *s = fakesrc_suite (); - SRunner *sr = srunner_create (s); - - gst_check_init (&argc, &argv); - - srunner_run_all (sr, CK_NORMAL); - nf = srunner_ntests_failed (sr); - srunner_free (sr); - - return nf; -} diff --git a/check/elements/fdsrc.c b/check/elements/fdsrc.c deleted file mode 100644 index ef748fc96f..0000000000 --- a/check/elements/fdsrc.c +++ /dev/null @@ -1,211 +0,0 @@ -/* GStreamer - * - * unit test for fdsrc - * - * Copyright (C) <2005> Jan Schmidt - * - * 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 - -gboolean have_eos = FALSE; - -GstPad *mysinkpad; - -static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - -gboolean -event_func (GstPad * pad, GstEvent * event) -{ - if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) { - have_eos = TRUE; - gst_event_unref (event); - return TRUE; - } - - gst_event_unref (event); - return FALSE; -} - -GstElement * -setup_fdsrc () -{ - GstElement *fdsrc; - - GST_DEBUG ("setup_fdsrc"); - fdsrc = gst_check_setup_element ("fdsrc"); - mysinkpad = gst_check_setup_sink_pad (fdsrc, &sinktemplate, NULL); - gst_pad_set_event_function (mysinkpad, event_func); - gst_pad_set_active (mysinkpad, TRUE); - return fdsrc; -} - -void -cleanup_fdsrc (GstElement * fdsrc) -{ - gst_check_teardown_sink_pad (fdsrc); - gst_check_teardown_element (fdsrc); -} - -GST_START_TEST (test_num_buffers) -{ - GstElement *src; - gint pipe_fd[2]; - gchar data[4096]; - - fail_if (pipe (pipe_fd) < 0); - - src = setup_fdsrc (); - g_object_set (G_OBJECT (src), "num-buffers", 3, NULL); - g_object_set (G_OBJECT (src), "fd", pipe_fd[0], NULL); - fail_unless (gst_element_set_state (src, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - memset (data, 0, 4096); - while (!have_eos) { - fail_if (write (pipe_fd[1], data, 4096) < 0); - g_usleep (100); - } - - fail_unless (g_list_length (buffers) == 3); - fail_unless (gst_element_set_state (src, - GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null"); - - /* cleanup */ - cleanup_fdsrc (src); - close (pipe_fd[0]); - close (pipe_fd[1]); - g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL); - g_list_free (buffers); -} - -GST_END_TEST; - -GST_START_TEST (test_nonseeking) -{ - GstElement *src; - GstQuery *seeking_query; - gint pipe_fd[2]; - gchar data[4096]; - gboolean seekable; - - fail_if (pipe (pipe_fd) < 0); - - src = setup_fdsrc (); - g_object_set (G_OBJECT (src), "num-buffers", 3, NULL); - g_object_set (G_OBJECT (src), "fd", pipe_fd[0], NULL); - fail_unless (gst_element_set_state (src, - GST_STATE_PAUSED) == GST_STATE_CHANGE_SUCCESS, - "could not set to paused"); - - memset (data, 0, 4096); - fail_if (write (pipe_fd[1], data, 4096) < 0); - - /* Test that fdsrc is non-seekable with a pipe */ - fail_unless ((seeking_query = gst_query_new_seeking (GST_FORMAT_BYTES)) - != NULL); - fail_unless (gst_element_query (src, seeking_query) == TRUE); - gst_query_parse_seeking (seeking_query, NULL, &seekable, NULL, NULL); - fail_unless (seekable == FALSE); - gst_query_unref (seeking_query); - - fail_unless (gst_element_set_state (src, - GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null"); - - /* cleanup */ - cleanup_fdsrc (src); - close (pipe_fd[0]); - close (pipe_fd[1]); -} - -GST_END_TEST; - -GST_START_TEST (test_seeking) -{ - GstElement *src; - gint in_fd; - GstQuery *seeking_query; - gboolean seekable; - -#ifndef TESTFILE -#error TESTFILE not defined -#endif - fail_if ((in_fd = open (TESTFILE, O_RDONLY)) < 0); - src = setup_fdsrc (); - - g_object_set (G_OBJECT (src), "fd", in_fd, NULL); - fail_unless (gst_element_set_state (src, - GST_STATE_PAUSED) == GST_STATE_CHANGE_SUCCESS, - "could not set to paused"); - - /* Test that fdsrc is seekable with a file fd */ - fail_unless ((seeking_query = gst_query_new_seeking (GST_FORMAT_BYTES)) - != NULL); - fail_unless (gst_element_query (src, seeking_query) == TRUE); - gst_query_parse_seeking (seeking_query, NULL, &seekable, NULL, NULL); - fail_unless (seekable == TRUE); - gst_query_unref (seeking_query); - - fail_unless (gst_element_set_state (src, - GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null"); - - /* cleanup */ - cleanup_fdsrc (src); - close (in_fd); -} - -GST_END_TEST; - -Suite * -fdsrc_suite (void) -{ - Suite *s = suite_create ("fdsrc"); - TCase *tc_chain = tcase_create ("general"); - - suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, test_num_buffers); - tcase_add_test (tc_chain, test_nonseeking); - tcase_add_test (tc_chain, test_seeking); - - return s; -} - -int -main (int argc, char **argv) -{ - int nf; - - Suite *s = fdsrc_suite (); - SRunner *sr = srunner_create (s); - - gst_check_init (&argc, &argv); - - srunner_run_all (sr, CK_NORMAL); - nf = srunner_ntests_failed (sr); - srunner_free (sr); - - return nf; -} diff --git a/check/elements/identity.c b/check/elements/identity.c deleted file mode 100644 index af3c6d3e57..0000000000 --- a/check/elements/identity.c +++ /dev/null @@ -1,138 +0,0 @@ -/* GStreamer - * - * unit test for identity - * - * Copyright (C) <2005> Thomas Vander Stichele - * - * 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 - -GList *buffers = NULL; -gboolean have_eos = FALSE; - -/* For ease of programming we use globals to keep refs for our floating - * src and sink pads we create; otherwise we always have to do get_pad, - * get_peer, and then remove references in every test function */ -GstPad *mysrcpad, *mysinkpad; - - -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); - -gboolean -event_func (GstPad * pad, GstEvent * event) -{ - if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) { - have_eos = TRUE; - gst_event_unref (event); - return TRUE; - } - - gst_event_unref (event); - return FALSE; -} - -GstElement * -setup_identity () -{ - GstElement *identity; - - GST_DEBUG ("setup_identity"); - - identity = gst_check_setup_element ("identity"); - mysrcpad = gst_check_setup_src_pad (identity, &srctemplate, NULL); - mysinkpad = gst_check_setup_sink_pad (identity, &sinktemplate, NULL); - gst_pad_set_event_function (mysinkpad, event_func); - gst_pad_set_active (mysrcpad, TRUE); - gst_pad_set_active (mysinkpad, TRUE); - - return identity; -} - -void -cleanup_identity (GstElement * identity) -{ - GST_DEBUG ("cleanup_identity"); - - gst_check_teardown_src_pad (identity); - gst_check_teardown_sink_pad (identity); - gst_check_teardown_element (identity); -} - -GST_START_TEST (test_one_buffer) -{ - GstElement *identity; - GstBuffer *buffer; - - identity = setup_identity (); - fail_unless (gst_element_set_state (identity, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - buffer = gst_buffer_new_and_alloc (4); - ASSERT_BUFFER_REFCOUNT (buffer, "buffer", 1); - memcpy (GST_BUFFER_DATA (buffer), "data", 4); - /* pushing gives away my reference ... */ - gst_pad_push (mysrcpad, buffer); - /* ... but it should end up being collected on the global buffer list */ - fail_unless (g_list_length (buffers) == 1); - fail_unless ((GstBuffer *) (g_list_first (buffers)->data) == buffer); - ASSERT_BUFFER_REFCOUNT (buffer, "buffer", 1); - - /* cleanup */ - cleanup_identity (identity); -} - -GST_END_TEST; - -Suite * -identity_suite (void) -{ - Suite *s = suite_create ("identity"); - TCase *tc_chain = tcase_create ("general"); - - suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, test_one_buffer); - - return s; -} - -int -main (int argc, char **argv) -{ - int nf; - - Suite *s = identity_suite (); - SRunner *sr = srunner_create (s); - - gst_check_init (&argc, &argv); - - srunner_run_all (sr, CK_NORMAL); - nf = srunner_ntests_failed (sr); - srunner_free (sr); - - return nf; -} diff --git a/check/generic/.gitignore b/check/generic/.gitignore deleted file mode 100644 index b9eed5cd47..0000000000 --- a/check/generic/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -.dirstamp -states diff --git a/check/generic/states.c b/check/generic/states.c deleted file mode 100644 index ac1faeaca7..0000000000 --- a/check/generic/states.c +++ /dev/null @@ -1,93 +0,0 @@ -/* GStreamer - * - * unit test for state changes on all elements - * - * Copyright (C) <2005> Thomas Vander Stichele - * - * 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 - -GST_START_TEST (test_state_changes) -{ - GstElement *element; - GList *features, *f; - - features = gst_registry_get_feature_list (gst_registry_get_default (), - GST_TYPE_ELEMENT_FACTORY); - - for (f = features; f; f = f->next) { - GstPluginFeature *feature = f->data; - const gchar *name = gst_plugin_feature_get_name (feature); - - GST_DEBUG ("testing element %s", name); - element = gst_element_factory_make (name, name); - - gst_element_set_state (element, GST_STATE_READY); - gst_element_set_state (element, GST_STATE_PAUSED); - gst_element_set_state (element, GST_STATE_PLAYING); - - gst_element_set_state (element, GST_STATE_PAUSED); - gst_element_set_state (element, GST_STATE_READY); - gst_element_set_state (element, GST_STATE_NULL); - gst_element_set_state (element, GST_STATE_PAUSED); - gst_element_set_state (element, GST_STATE_READY); - gst_element_set_state (element, GST_STATE_PLAYING); - gst_element_set_state (element, GST_STATE_PAUSED); - gst_element_set_state (element, GST_STATE_NULL); - - gst_object_unref (GST_OBJECT (element)); - } - gst_task_cleanup_all (); -} - -GST_END_TEST; - -Suite * -states_suite (void) -{ - Suite *s = suite_create ("states"); - TCase *tc_chain = tcase_create ("general"); - - /* Use a long timeout, as we test all elements and take - * at least 0.2 seconds each */ - tcase_set_timeout (tc_chain, 120); - - suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, test_state_changes); - - return s; -} - -int -main (int argc, char **argv) -{ - int nf; - - Suite *s = states_suite (); - SRunner *sr = srunner_create (s); - - gst_check_init (&argc, &argv); - - srunner_run_all (sr, CK_NORMAL); - nf = srunner_ntests_failed (sr); - srunner_free (sr); - - return nf; -} diff --git a/check/gst-libs/.gitignore b/check/gst-libs/.gitignore deleted file mode 100644 index 0b88a81915..0000000000 --- a/check/gst-libs/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -.dirstamp -gdp -controller diff --git a/check/gst-libs/controller.c b/check/gst-libs/controller.c deleted file mode 100644 index 030943285a..0000000000 --- a/check/gst-libs/controller.c +++ /dev/null @@ -1,629 +0,0 @@ -/* GStreamer - * - * unit test for the controller library - * - * Copyright (C) <2005> Stefan Kost - * - * 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 - -/* LOCAL TEST ELEMENT */ - -enum -{ - ARG_ULONG = 1, - ARG_DOUBLE, - ARG_BOOLEAN, - ARG_READONLY, - ARG_STATIC, - ARG_CONSTRUCTONLY, - ARG_COUNT -}; - -#define GST_TYPE_TEST_MONO_SOURCE (gst_test_mono_source_get_type ()) -#define GST_TEST_MONO_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TEST_MONO_SOURCE, GstTestMonoSource)) -#define GST_TEST_MONO_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_TEST_MONO_SOURCE, GstTestMonoSourceClass)) -#define GST_IS_TEST_MONO_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TEST_MONO_SOURCE)) -#define GST_IS_TEST_MONO_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_TEST_MONO_SOURCE)) -#define GST_TEST_MONO_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_TEST_MONO_SOURCE, GstTestMonoSourceClass)) - -typedef struct _GstTestMonoSource GstTestMonoSource; -typedef struct _GstTestMonoSourceClass GstTestMonoSourceClass; - -struct _GstTestMonoSource -{ - GstElement parent; - gulong val_ulong; - gdouble val_double; - gboolean val_boolean; -}; -struct _GstTestMonoSourceClass -{ - GstElementClass parent_class; -}; - -GType gst_test_mono_source_get_type (void); - -static void -gst_test_mono_source_get_property (GObject * object, - guint property_id, GValue * value, GParamSpec * pspec) -{ - GstTestMonoSource *self = GST_TEST_MONO_SOURCE (object); - - switch (property_id) { - case ARG_ULONG: - g_value_set_ulong (value, self->val_ulong); - break; - case ARG_DOUBLE: - g_value_set_double (value, self->val_double); - break; - case ARG_BOOLEAN: - g_value_set_boolean (value, self->val_boolean); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - -static void -gst_test_mono_source_set_property (GObject * object, - guint property_id, const GValue * value, GParamSpec * pspec) -{ - GstTestMonoSource *self = GST_TEST_MONO_SOURCE (object); - - switch (property_id) { - case ARG_ULONG: - self->val_ulong = g_value_get_ulong (value); - break; - case ARG_DOUBLE: - self->val_double = g_value_get_double (value); - break; - case ARG_BOOLEAN: - self->val_boolean = g_value_get_boolean (value); - break; - case ARG_CONSTRUCTONLY: - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - -static void -gst_test_mono_source_class_init (GstTestMonoSourceClass * klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - - gobject_class->set_property = gst_test_mono_source_set_property; - gobject_class->get_property = gst_test_mono_source_get_property; - - g_object_class_install_property (gobject_class, ARG_ULONG, - g_param_spec_ulong ("ulong", - "ulong prop", - "ulong number parameter for the test_mono_source", - 0, G_MAXULONG, 0, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE)); - - g_object_class_install_property (gobject_class, ARG_DOUBLE, - g_param_spec_double ("double", - "double prop", - "double number parameter for the test_mono_source", - 0.0, 100.0, 0.0, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE)); - - g_object_class_install_property (gobject_class, ARG_BOOLEAN, - g_param_spec_boolean ("boolean", - "boolean prop", - "boolean parameter for the test_mono_source", - FALSE, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE)); - - g_object_class_install_property (gobject_class, ARG_READONLY, - g_param_spec_ulong ("readonly", - "readonly prop", - "readonly parameter for the test_mono_source", - 0, G_MAXULONG, 0, G_PARAM_READABLE | GST_PARAM_CONTROLLABLE)); - - g_object_class_install_property (gobject_class, ARG_STATIC, - g_param_spec_ulong ("static", - "static prop", - "static parameter for the test_mono_source", - 0, G_MAXULONG, 0, G_PARAM_READWRITE)); - - g_object_class_install_property (gobject_class, ARG_CONSTRUCTONLY, - g_param_spec_ulong ("construct-only", - "construct-only prop", - "construct-only parameter for the test_mono_source", - 0, G_MAXULONG, 0, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); -} - -static void -gst_test_mono_source_base_init (GstTestMonoSourceClass * klass) -{ - static const GstElementDetails details = { - "Monophonic source for unit tests", - "Source/Audio/MonoSource", - "Use in unit tests", - "Stefan Kost " - }; - GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - - gst_element_class_set_details (element_class, &details); -} - -GType -gst_test_mono_source_get_type (void) -{ - static GType type = 0; - - if (type == 0) { - static const GTypeInfo info = { - (guint16) sizeof (GstTestMonoSourceClass), - (GBaseInitFunc) gst_test_mono_source_base_init, // base_init - NULL, // base_finalize - (GClassInitFunc) gst_test_mono_source_class_init, // class_init - NULL, // class_finalize - NULL, // class_data - (guint16) sizeof (GstTestMonoSource), - 0, // n_preallocs - NULL, // instance_init - NULL // value_table - }; - type = - g_type_register_static (GST_TYPE_ELEMENT, "GstTestMonoSource", &info, - 0); - } - return type; -} - -static gboolean -plugin_init (GstPlugin * plugin) -{ - gboolean res = TRUE; - - res &= gst_element_register (plugin, "testmonosource", GST_RANK_NONE, - GST_TYPE_TEST_MONO_SOURCE); - return res; -} - -GST_PLUGIN_DEFINE_STATIC (GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "gst-test", - "controller test plugin - several unit test support elements", - plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN); - -/* -static void __attribute__ ((constructor)) -_gst_plugin_static_init__plugin_init (void) -{ - static GstPluginDesc plugin_desc_ = { - GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "gst-test", - "controller test plugin - several unit test support elements", - plugin_init, - VERSION, - GST_LICENSE, - PACKAGE, - GST_PACKAGE, - GST_ORIGIN, - GST_PADDING_INIT - }; - _gst_plugin_register_static (&plugin_desc_); -} -*/ -/* TESTS */ -/* double init should not harm */ -GST_START_TEST (controller_init) -{ - gst_controller_init (NULL, NULL); -} - -GST_END_TEST; - -/* tests for an element with no controlled params */ -GST_START_TEST (controller_new_fail1) -{ - GstController *ctrl; - GstElement *elem; - - elem = gst_element_factory_make ("fakesrc", "test_source"); - - /* that property should not exist */ - ctrl = gst_controller_new (G_OBJECT (elem), "_schrompf_", NULL); - fail_unless (ctrl == NULL, NULL); - - gst_object_unref (elem); -} - -GST_END_TEST; - -/* tests for an element with controlled params, but none given */ -GST_START_TEST (controller_new_fail2) -{ - GstController *ctrl; - GstElement *elem; - - elem = gst_element_factory_make ("testmonosource", "test_source"); - - /* no property given */ - ctrl = gst_controller_new (G_OBJECT (elem), NULL); - fail_unless (ctrl == NULL, NULL); - - gst_object_unref (elem); -} - -GST_END_TEST; - -/* tests for readonly params */ -GST_START_TEST (controller_new_fail3) -{ - GstController *ctrl; - GstElement *elem; - - elem = gst_element_factory_make ("testmonosource", "test_source"); - - /* that property should exist and but is readonly */ - ASSERT_CRITICAL (ctrl = - gst_controller_new (G_OBJECT (elem), "readonly", NULL)); - fail_unless (ctrl == NULL, NULL); - - gst_object_unref (elem); -} - -GST_END_TEST; - -/* tests for static params */ -GST_START_TEST (controller_new_fail4) -{ - GstController *ctrl; - GstElement *elem; - - elem = gst_element_factory_make ("testmonosource", "test_source"); - - /* that property should exist and but is not controlable */ - ASSERT_CRITICAL (ctrl = gst_controller_new (G_OBJECT (elem), "static", NULL)); - fail_unless (ctrl == NULL, NULL); - - gst_object_unref (elem); -} - -GST_END_TEST; - -/* tests for static params */ -GST_START_TEST (controller_new_fail5) -{ - GstController *ctrl; - GstElement *elem; - - elem = gst_element_factory_make ("testmonosource", "test_source"); - - /* that property should exist and but is construct-only */ - ASSERT_CRITICAL (ctrl = - gst_controller_new (G_OBJECT (elem), "construct-only", NULL)); - fail_unless (ctrl == NULL, NULL); - - gst_object_unref (elem); -} - -GST_END_TEST; - - -/* tests for an element with controlled params */ -GST_START_TEST (controller_new_okay1) -{ - GstController *ctrl; - GstElement *elem; - - elem = gst_element_factory_make ("testmonosource", "test_source"); - - /* that property should exist and should be controllable */ - ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL); - fail_unless (ctrl != NULL, NULL); - - GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); - g_object_unref (ctrl); - gst_object_unref (elem); -} - -GST_END_TEST; - -/* tests for an element with several controlled params */ -GST_START_TEST (controller_new_okay2) -{ - GstController *ctrl; - GstElement *elem; - - elem = gst_element_factory_make ("testmonosource", "test_source"); - - /* that property should exist and should be controllable */ - ctrl = gst_controller_new (G_OBJECT (elem), "ulong", "double", NULL); - fail_unless (ctrl != NULL, NULL); - - GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); - g_object_unref (ctrl); - gst_object_unref (elem); -} - -GST_END_TEST; - -/* controlling several params should return the same controller */ -GST_START_TEST (controller_new_okay3) -{ - GstController *ctrl1, *ctrl2; - GstElement *elem; - - elem = gst_element_factory_make ("testmonosource", "test_source"); - - /* that property should exist and should be controllable */ - ctrl1 = gst_controller_new (G_OBJECT (elem), "ulong", NULL); - fail_unless (ctrl1 != NULL, NULL); - - /* that property should exist and should be controllable */ - ctrl2 = gst_controller_new (G_OBJECT (elem), "double", NULL); - fail_unless (ctrl2 != NULL, NULL); - fail_unless (ctrl1 == ctrl2, NULL); - - GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl1)->ref_count); - g_object_unref (ctrl1); - gst_object_unref (elem); -} - -GST_END_TEST; - -/* controlling a params twice should be handled */ -GST_START_TEST (controller_param_twice) -{ - GstController *ctrl; - GstElement *elem; - gboolean res; - - elem = gst_element_factory_make ("testmonosource", "test_source"); - - /* that property should exist and should be controllable */ - ctrl = gst_controller_new (G_OBJECT (elem), "ulong", "ulong", NULL); - fail_unless (ctrl != NULL, NULL); - - /* it should have been added at least once, let remove it */ - res = gst_controller_remove_properties (ctrl, "ulong", NULL); - fail_unless (res, NULL); - - /* removing it agian should not work */ - res = gst_controller_remove_properties (ctrl, "ulong", NULL); - fail_unless (!res, NULL); - - GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); - g_object_unref (ctrl); - gst_object_unref (elem); -} - -GST_END_TEST; - -/* tests if we cleanup properly */ -GST_START_TEST (controller_finalize) -{ - GstController *ctrl; - GstElement *elem; - - elem = gst_element_factory_make ("testmonosource", "test_source"); - - /* that property should exist and should be controllable */ - ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL); - fail_unless (ctrl != NULL, NULL); - - /* free the controller */ - g_object_unref (ctrl); - - /* object shouldn't have a controller anymore */ - ctrl = gst_object_get_controller (G_OBJECT (elem)); - fail_unless (ctrl == NULL, NULL); - - gst_object_unref (elem); -} - -GST_END_TEST; - -/* test timed value handling without interpolation */ -GST_START_TEST (controller_interpolate_none) -{ - GstController *ctrl; - GstElement *elem; - gboolean res; - GValue val_ulong = { 0, }; - - elem = gst_element_factory_make ("testmonosource", "test_source"); - - /* that property should exist and should be controllable */ - ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL); - fail_unless (ctrl != NULL, NULL); - - /* set interpolation mode */ - gst_controller_set_interpolation_mode (ctrl, "ulong", GST_INTERPOLATE_NONE); - - /* set control values */ - g_value_init (&val_ulong, G_TYPE_ULONG); - g_value_set_ulong (&val_ulong, 0); - res = gst_controller_set (ctrl, "ulong", 0 * GST_SECOND, &val_ulong); - fail_unless (res, NULL); - g_value_set_ulong (&val_ulong, 100); - res = gst_controller_set (ctrl, "ulong", 2 * GST_SECOND, &val_ulong); - fail_unless (res, NULL); - - /* now pull in values for some timestamps */ - gst_controller_sync_values (ctrl, 0 * GST_SECOND); - fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 0, NULL); - gst_controller_sync_values (ctrl, 1 * GST_SECOND); - fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 0, NULL); - gst_controller_sync_values (ctrl, 2 * GST_SECOND); - fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 100, NULL); - - GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); - g_object_unref (ctrl); - gst_object_unref (elem); -} - -GST_END_TEST; - -/* test timed value handling in trigger mode */ -GST_START_TEST (controller_interpolate_trigger) -{ - GstController *ctrl; - GstElement *elem; - gboolean res; - GValue val_ulong = { 0, }; - - elem = gst_element_factory_make ("testmonosource", "test_source"); - - /* that property should exist and should be controllable */ - ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL); - fail_unless (ctrl != NULL, NULL); - - /* set interpolation mode */ - gst_controller_set_interpolation_mode (ctrl, "ulong", - GST_INTERPOLATE_TRIGGER); - - /* set control values */ - g_value_init (&val_ulong, G_TYPE_ULONG); - g_value_set_ulong (&val_ulong, 50); - res = gst_controller_set (ctrl, "ulong", 0 * GST_SECOND, &val_ulong); - fail_unless (res, NULL); - g_value_set_ulong (&val_ulong, 100); - res = gst_controller_set (ctrl, "ulong", 2 * GST_SECOND, &val_ulong); - fail_unless (res, NULL); - - /* now pull in values for some timestamps */ - gst_controller_sync_values (ctrl, 0 * GST_SECOND); - fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 50, NULL); - GST_TEST_MONO_SOURCE (elem)->val_ulong = 0; - gst_controller_sync_values (ctrl, 1 * GST_SECOND); - fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 0, NULL); - gst_controller_sync_values (ctrl, 2 * GST_SECOND); - fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 100, NULL); - - GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); - g_object_unref (ctrl); - gst_object_unref (elem); -} - -GST_END_TEST; - -/* test timed value handling with linear interpolation */ -GST_START_TEST (controller_interpolate_linear) -{ - GstController *ctrl; - GstElement *elem; - gboolean res; - GValue val_ulong = { 0, }; - - elem = gst_element_factory_make ("testmonosource", "test_source"); - - /* that property should exist and should be controllable */ - ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL); - fail_unless (ctrl != NULL, NULL); - - /* set interpolation mode */ - gst_controller_set_interpolation_mode (ctrl, "ulong", GST_INTERPOLATE_LINEAR); - - /* set control values */ - g_value_init (&val_ulong, G_TYPE_ULONG); - g_value_set_ulong (&val_ulong, 0); - res = gst_controller_set (ctrl, "ulong", 0 * GST_SECOND, &val_ulong); - fail_unless (res, NULL); - g_value_set_ulong (&val_ulong, 100); - res = gst_controller_set (ctrl, "ulong", 2 * GST_SECOND, &val_ulong); - fail_unless (res, NULL); - - /* now pull in values for some timestamps */ - gst_controller_sync_values (ctrl, 0 * GST_SECOND); - fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 0, NULL); - gst_controller_sync_values (ctrl, 1 * GST_SECOND); - fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 50, NULL); - gst_controller_sync_values (ctrl, 2 * GST_SECOND); - fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 100, NULL); - - GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count); - g_object_unref (ctrl); - gst_object_unref (elem); -} - -GST_END_TEST; - -/* tests if we can run helper methods against any GObject */ -GST_START_TEST (controller_helper_any_gobject) -{ - GstElement *elem; - gboolean res; - - elem = gst_element_factory_make ("bin", "test_elem"); - - /* that element is not controllable */ - res = gst_object_sync_values (G_OBJECT (elem), 0LL); - fail_unless (res == FALSE, NULL); - - gst_object_unref (elem); -} - -GST_END_TEST; - - -Suite * -gst_controller_suite (void) -{ - Suite *s = suite_create ("Controller"); - TCase *tc = tcase_create ("general"); - - suite_add_tcase (s, tc); - tcase_add_test (tc, controller_init); - tcase_add_test (tc, controller_new_fail1); - tcase_add_test (tc, controller_new_fail2); - tcase_add_test (tc, controller_new_fail3); - tcase_add_test (tc, controller_new_fail4); - tcase_add_test (tc, controller_new_fail5); - tcase_add_test (tc, controller_new_okay1); - tcase_add_test (tc, controller_new_okay2); - tcase_add_test (tc, controller_new_okay3); - tcase_add_test (tc, controller_param_twice); - tcase_add_test (tc, controller_finalize); - tcase_add_test (tc, controller_interpolate_none); - tcase_add_test (tc, controller_interpolate_trigger); - tcase_add_test (tc, controller_interpolate_linear); - tcase_add_test (tc, controller_helper_any_gobject); - - return s; -} - -int -main (int argc, char **argv) -{ - int nf; - - Suite *s = gst_controller_suite (); - SRunner *sr = srunner_create (s); - - gst_check_init (&argc, &argv); - gst_controller_init (NULL, NULL); - - srunner_run_all (sr, CK_NORMAL); - nf = srunner_ntests_failed (sr); - srunner_free (sr); - - return nf; -} diff --git a/check/gst-libs/gdp.c b/check/gst-libs/gdp.c deleted file mode 100644 index ea85b90c2c..0000000000 --- a/check/gst-libs/gdp.c +++ /dev/null @@ -1,312 +0,0 @@ -/* GStreamer - * - * unit test for data protocol - * - * Copyright (C) <2004> Thomas Vander Stichele - * - * 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 "libs/gst/dataprotocol/dp-private.h" /* private header */ - -/* test our method of reading and writing headers using TO/FROM_BE */ -GST_START_TEST (test_conversion) -{ - guint8 array[9]; - guint8 write_array[9]; - guint16 read_two, expect_two; - guint32 read_four, expect_four; - guint64 read_eight, expect_eight; - int i; - - for (i = 0; i < 9; ++i) { - array[i] = i * 0x10; - } - - /* read 8 16 bits */ - for (i = 0; i < 8; ++i) { - read_two = GST_READ_UINT16_BE (array + i); - expect_two = array[i] * (1 << 8) + array[i + 1]; - fail_unless (read_two == expect_two, - "GST_READ_UINT16_BE %d: read %d != %d\n", i, read_two, expect_two); - } - - /* write 8 16 bits */ - for (i = 0; i < 8; ++i) { - GST_WRITE_UINT16_BE (&write_array[i], read_two); - fail_unless (memcmp (array + 7, write_array + i, 2) == 0, - "GST_WRITE_UINT16_BE %d: memcmp failed", i); - } - - /* read 5 32 bits */ - for (i = 0; i < 5; ++i) { - read_four = GST_READ_UINT32_BE (array + i); - expect_four = array[i] * (1 << 24) + array[i + 1] * (1 << 16) - + array[i + 2] * (1 << 8) + array[i + 3]; - fail_unless (read_four == expect_four, - "GST_READ_UINT32_BE %d: read %d != %d\n", i, read_four, expect_four); - } - - /* read 2 64 bits */ - for (i = 0; i < 2; ++i) { - read_eight = GST_READ_UINT64_BE (array + i); - expect_eight = array[i] * (1LL << 56) + array[i + 1] * (1LL << 48) - + array[i + 2] * (1LL << 40) + array[i + 3] * (1LL << 32) - + array[i + 4] * (1 << 24) + array[i + 5] * (1 << 16) - + array[i + 6] * (1 << 8) + array[i + 7]; - fail_unless (read_eight == expect_eight, - "GST_READ_UINT64_BE %d: read %" G_GUINT64_FORMAT - " != %" G_GUINT64_FORMAT "\n", i, read_eight, expect_eight); - } - - /* write 1 64 bit */ - GST_WRITE_UINT64_BE (&write_array[0], read_eight); - fail_unless (memcmp (array + 1, write_array, 8) == 0, - "GST_WRITE_UINT64_BE: memcmp failed"); -} - -GST_END_TEST; - -/* test creation of header from buffer and back again */ -GST_START_TEST (test_buffer) -{ - GstBuffer *buffer; - GstBuffer *newbuffer; - - guint header_length; - guint8 *header; - - /* create buffer */ - g_message ("Creating a new 8-byte buffer with ts 0.5 sec, dur 1 sec\n"); - buffer = gst_buffer_new_and_alloc (8); - GST_BUFFER_TIMESTAMP (buffer) = (GstClockTime) (GST_SECOND * 0.5); - GST_BUFFER_DURATION (buffer) = (GstClockTime) GST_SECOND; - GST_BUFFER_OFFSET (buffer) = (guint64) 10; - GST_BUFFER_OFFSET_END (buffer) = (guint64) 19; - GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_IN_CAPS); - memmove (GST_BUFFER_DATA (buffer), "a buffer", 8); - - /* create a buffer with CRC checking */ - fail_unless (gst_dp_header_from_buffer (buffer, GST_DP_HEADER_FLAG_CRC, - &header_length, &header), "Could not create header from buffer."); - - /* validate the header */ - fail_unless (gst_dp_validate_header (header_length, header), - "Could not validate header"); - /* create a new, empty buffer with the right size */ - newbuffer = gst_dp_buffer_from_header (header_length, header); - fail_unless (newbuffer != NULL, "Could not create a new buffer from header"); - fail_unless (GST_IS_BUFFER (newbuffer), "Created buffer is not a GstBuffer"); - /* read/copy the data */ - memmove (GST_BUFFER_DATA (newbuffer), GST_BUFFER_DATA (buffer), - GST_BUFFER_SIZE (buffer)); - /* validate the buffer */ - fail_unless (gst_dp_validate_payload (header_length, header, - GST_BUFFER_DATA (newbuffer)), "Could not validate payload"); - - g_message ("new buffer timestamp: %" GST_TIME_FORMAT "\n", - GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (newbuffer))); - g_message ("new buffer duration: %" GST_TIME_FORMAT "\n", - GST_TIME_ARGS (GST_BUFFER_DURATION (newbuffer))); - g_message ("new buffer offset: %" G_GUINT64_FORMAT "\n", - GST_BUFFER_OFFSET (newbuffer)); - g_message ("new buffer offset_end: %" G_GUINT64_FORMAT "\n", - GST_BUFFER_OFFSET_END (newbuffer)); - fail_unless (GST_BUFFER_TIMESTAMP (newbuffer) == - GST_BUFFER_TIMESTAMP (buffer), "Timestamps don't match !"); - fail_unless (GST_BUFFER_DURATION (newbuffer) == GST_BUFFER_DURATION (buffer), - "Durations don't match !"); - fail_unless (GST_BUFFER_OFFSET (newbuffer) == GST_BUFFER_OFFSET (buffer), - "Offsets don't match !"); - fail_unless (GST_BUFFER_OFFSET_END (newbuffer) == - GST_BUFFER_OFFSET_END (buffer), "Offset ends don't match !"); - fail_unless (GST_BUFFER_FLAG_IS_SET (newbuffer, GST_BUFFER_FLAG_IN_CAPS), - "GST_BUFFER_IN_CAPS flag should have been copied !"); - - /* clean up */ - gst_buffer_unref (buffer); - gst_buffer_unref (newbuffer); - g_free (header); -} - -GST_END_TEST; - -GST_START_TEST (test_caps) -{ - gchar *string, *newstring; - GstCaps *caps, *newcaps; - - guint header_length; - guint8 *header, *payload; - - caps = gst_caps_from_string ("audio/x-raw-float, " - "rate = (int) [ 11025, 48000 ], " - "channels = (int) [ 1, 2 ], " "endianness = (int) BYTE_ORDER, " - "width = (int) 32, " "buffer-frames = (int) 0"); - string = gst_caps_to_string (caps); - g_message ("Created caps: %s\n", string); - fail_unless (gst_dp_packet_from_caps (caps, 0, &header_length, &header, - &payload), "Could not create packet from caps."); - - /* validate the packet */ - fail_unless (gst_dp_validate_packet (header_length, header, payload), - "Could not validate packet"); - newcaps = gst_dp_caps_from_packet (header_length, header, payload); - fail_unless (newcaps != NULL, "Could not create caps from packet"); - fail_unless (GST_IS_CAPS (newcaps)); - newstring = gst_caps_to_string (newcaps); - g_message ("Received caps: %s\n", newstring); - fail_unless (strcmp (string, newstring) == 0, - "Created caps do not match original caps"); - - /* cleanup */ - gst_caps_unref (caps); - gst_caps_unref (newcaps); - g_free (header); - g_free (payload); - g_free (string); - g_free (newstring); -} - -GST_END_TEST; - -GST_START_TEST (test_event) -{ - GstEvent *send; - GstEvent *receive; - guint header_length; - guint8 *header, *payload; - - g_message ("Testing EOS event at 1s\n"); - send = gst_event_new_eos (); - GST_EVENT_TIMESTAMP (send) = GST_SECOND; - fail_unless (gst_dp_packet_from_event (send, GST_DP_HEADER_FLAG_CRC, - &header_length, &header, &payload), - "Could not create packet from eos event"); - - receive = gst_dp_event_from_packet (header_length, header, payload); - - g_message ("EOS, timestamp %" GST_TIME_FORMAT "\n", - GST_TIME_ARGS (GST_EVENT_TIMESTAMP (receive))); - fail_unless (GST_EVENT_TYPE (receive) == GST_EVENT_EOS, - "Received event is not EOS"); - fail_unless (GST_EVENT_TIMESTAMP (receive) == GST_SECOND, - "EOS timestamp is not 1.0 sec"); - - /* clean up */ - g_free (header); - g_free (payload); - gst_event_unref (send); - gst_event_unref (receive); - - g_message ("Testing FLUSH event at 2s\n"); - send = gst_event_new_flush_start (); - GST_EVENT_TIMESTAMP (send) = GST_SECOND * 2; - fail_unless (gst_dp_packet_from_event (send, GST_DP_HEADER_FLAG_CRC, - &header_length, &header, &payload), - "Could not create packet from flush event"); - - receive = gst_dp_event_from_packet (header_length, header, payload); - - g_message ("Flush, timestamp %" GST_TIME_FORMAT "\n", - GST_TIME_ARGS (GST_EVENT_TIMESTAMP (receive))); - fail_unless (GST_EVENT_TYPE (receive) == GST_EVENT_FLUSH_START, - "Received event is not flush"); - fail_unless (GST_EVENT_TIMESTAMP (receive) == GST_SECOND * 2, - "Flush timestamp is not 2.0 sec"); - - /* clean up */ - g_free (header); - g_free (payload); - gst_event_unref (send); - gst_event_unref (receive); - - g_message ("Testing SEEK event with 1 second at 3 seconds\n"); - send = - gst_event_new_seek (1.0, GST_FORMAT_TIME, 0, GST_SEEK_TYPE_SET, - GST_SECOND, GST_SEEK_TYPE_NONE, 0); - GST_EVENT_TIMESTAMP (send) = GST_SECOND * 3; - fail_unless (gst_dp_packet_from_event (send, GST_DP_HEADER_FLAG_CRC, - &header_length, &header, &payload), - "Could not create packet from seek event"); - - receive = gst_dp_event_from_packet (header_length, header, payload); - - { - gdouble rate; - GstFormat format; - GstSeekFlags flags; - GstSeekType cur_type, stop_type; - gint64 cur, stop; - - gst_event_parse_seek (receive, &rate, &format, &flags, - &cur_type, &cur, &stop_type, &stop); - - g_message ("Seek, timestamp %" GST_TIME_FORMAT ", to %" GST_TIME_FORMAT - "\n", GST_TIME_ARGS (GST_EVENT_TIMESTAMP (receive)), - GST_TIME_ARGS (cur)); - fail_unless (GST_EVENT_TYPE (receive) == GST_EVENT_SEEK, - "Returned event is not seek"); - fail_unless (GST_EVENT_TIMESTAMP (receive) == GST_SECOND * 3, - "Seek timestamp is not 3.0 sec"); - fail_unless (format == GST_FORMAT_TIME, "Seek format is not time"); - fail_unless (cur == GST_SECOND, "Seek cur is not 1.0 sec"); - } - - /* clean up */ - g_free (header); - g_free (payload); - gst_event_unref (send); - gst_event_unref (receive); -} - -GST_END_TEST; - -Suite * -gst_data_protocol_suite (void) -{ - Suite *s = suite_create ("data protocol"); - TCase *tc_chain = tcase_create ("general"); - - suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, test_conversion); - tcase_add_test (tc_chain, test_buffer); - tcase_add_test (tc_chain, test_caps); - tcase_add_test (tc_chain, test_event); - - return s; -} - -int -main (int argc, char **argv) -{ - int nf; - - Suite *s = gst_data_protocol_suite (); - SRunner *sr = srunner_create (s); - - gst_check_init (&argc, &argv); - gst_dp_init (); - - srunner_run_all (sr, CK_NORMAL); - nf = srunner_ntests_failed (sr); - srunner_free (sr); - - return nf; -} diff --git a/check/gst/.gitignore b/check/gst/.gitignore deleted file mode 100644 index 31d6a1fb73..0000000000 --- a/check/gst/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -.dirstamp -gst -gstbin -gstbuffer -gstbus -gstcaps -gstdata -gstelement -gstevent -gstghostpad -gstiterator -gstmessage -gstminiobject -gstobject -gstpad -gstpipeline -gstplugin -gstsegment -gststructure -gstsystemclock -gsttag -gstutils -gstvalue diff --git a/check/gst/capslist.h b/check/gst/capslist.h deleted file mode 100644 index b8458e64e7..0000000000 --- a/check/gst/capslist.h +++ /dev/null @@ -1,31 +0,0 @@ -#include - -/* 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 ]", - "video/x-raw-rgb,\\ bpp=(int)32", - /* Test fraction type */ - "test/gst-fraction, fraction = (fraction) 1/8", - "test/gst-fraction, fraction = (fraction) MIN", - "test/gst-fraction, fraction = (fraction) MAX", - /* Test fraction range */ - "test/gst-fraction-range, fraction = (fraction) [ 1/3, 1/4 ]", - "test/gst-fraction-range, fraction = (fraction) [ MIN, MAX ]", - /* Test lists of fractions and fraction ranges */ - "test/gst-fraction-range, fraction = (fraction) { [ 1/3, 1/4 ], 1/8 }", - "test/gst-fraction-range, fraction = (fraction) { [ 1/3, 1/4 ], [ 1/8, 2/8 ] }", - "ANY", - "EMPTY" -}; - diff --git a/check/gst/gst.c b/check/gst/gst.c deleted file mode 100644 index 76e37ce36c..0000000000 --- a/check/gst/gst.c +++ /dev/null @@ -1,111 +0,0 @@ -/* GStreamer - * Copyright (C) <2005> Thomas Vander Stichele - * - * gst.c: Unit test for gst.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_START_TEST (test_init) -{ - /* don't segfault with NULL, NULL */ - gst_init (NULL, NULL); - /* allow calling twice. well, actually, thrice. */ - gst_init (NULL, NULL); -} - -GST_END_TEST; - -GST_START_TEST (test_deinit) -{ - gst_init (NULL, NULL); - - gst_deinit (); -} - -GST_END_TEST; - -GST_START_TEST (test_deinit_sysclock) -{ - GstClock *clock; - - gst_init (NULL, NULL); - - clock = gst_system_clock_obtain (); - gst_object_unref (clock); - - gst_deinit (); -} - -GST_END_TEST; - -/* tests if we can create an element from a compiled-in plugin */ -GST_START_TEST (test_new_pipeline) -{ - GstElement *pipeline; - - pipeline = gst_pipeline_new ("pipeline"); - gst_object_unref (pipeline); -} - -GST_END_TEST; - -/* tests if we can load an element from a plugin */ -GST_START_TEST (test_new_fakesrc) -{ - GstElement *element; - - element = gst_element_factory_make ("fakesrc", NULL); - gst_object_unref (element); -} - -GST_END_TEST; - - -Suite * -gst_suite (void) -{ - Suite *s = suite_create ("Gst"); - TCase *tc_chain = tcase_create ("gst tests"); - - suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, test_init); - tcase_add_test (tc_chain, test_deinit); - tcase_add_test (tc_chain, test_deinit_sysclock); - tcase_add_test (tc_chain, test_new_pipeline); - tcase_add_test (tc_chain, test_new_fakesrc); - - return s; -} - -int -main (int argc, char **argv) -{ - int nf; - - Suite *s = gst_suite (); - SRunner *sr = srunner_create (s); - - gst_check_init (&argc, &argv); - - srunner_run_all (sr, CK_NORMAL); - nf = srunner_ntests_failed (sr); - srunner_free (sr); - - return nf; -} diff --git a/check/gst/gstbin.c b/check/gst/gstbin.c deleted file mode 100644 index a71a4d8ede..0000000000 --- a/check/gst/gstbin.c +++ /dev/null @@ -1,817 +0,0 @@ -/* GStreamer - * Copyright (C) 2005 Wim Taymans - * Copyright (C) 2005 Thomas Vander Stichele - * - * gstbin.c: Unit test for GstBin - * - * 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 -pop_messages (GstBus * bus, int count) -{ - GstMessage *message; - - int i; - - GST_DEBUG ("popping %d messages", count); - for (i = 0; i < count; ++i) { - message = gst_bus_poll (bus, GST_MESSAGE_STATE_CHANGED, -1); - - fail_unless (message && GST_MESSAGE_TYPE (message) - == GST_MESSAGE_STATE_CHANGED, "did not get GST_MESSAGE_STATE_CHANGED"); - - gst_message_unref (message); - } - GST_DEBUG ("popped %d messages", count); -} - -GST_START_TEST (test_interface) -{ - GstBin *bin, *bin2; - GstElement *filesrc; - GstIterator *it; - gpointer item; - - bin = GST_BIN (gst_bin_new (NULL)); - fail_unless (bin != NULL, "Could not create bin"); - - filesrc = gst_element_factory_make ("filesrc", NULL); - fail_unless (filesrc != NULL, "Could not create filesrc"); - fail_unless (GST_IS_URI_HANDLER (filesrc), "Filesrc not a URI handler"); - gst_bin_add (bin, filesrc); - - fail_unless (gst_bin_get_by_interface (bin, GST_TYPE_URI_HANDLER) == filesrc); - it = gst_bin_iterate_all_by_interface (bin, GST_TYPE_URI_HANDLER); - fail_unless (it != NULL); - fail_unless (gst_iterator_next (it, &item) == GST_ITERATOR_OK); - fail_unless (item == (gpointer) filesrc); - fail_unless (gst_iterator_next (it, &item) == GST_ITERATOR_DONE); - gst_iterator_free (it); - - gst_bin_add_many (bin, - gst_element_factory_make ("identity", NULL), - gst_element_factory_make ("identity", NULL), - gst_element_factory_make ("identity", NULL), NULL); - fail_unless (gst_bin_get_by_interface (bin, GST_TYPE_URI_HANDLER) == filesrc); - it = gst_bin_iterate_all_by_interface (bin, GST_TYPE_URI_HANDLER); - fail_unless (it != NULL); - fail_unless (gst_iterator_next (it, &item) == GST_ITERATOR_OK); - fail_unless (item == (gpointer) filesrc); - fail_unless (gst_iterator_next (it, &item) == GST_ITERATOR_DONE); - gst_iterator_free (it); - - bin2 = bin; - bin = GST_BIN (gst_bin_new (NULL)); - fail_unless (bin != NULL); - 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); - fail_unless (gst_bin_get_by_interface (bin, GST_TYPE_URI_HANDLER) == filesrc); - it = gst_bin_iterate_all_by_interface (bin, GST_TYPE_URI_HANDLER); - fail_unless (gst_iterator_next (it, &item) == GST_ITERATOR_OK); - fail_unless (item == (gpointer) filesrc); - fail_unless (gst_iterator_next (it, &item) == GST_ITERATOR_DONE); - gst_iterator_free (it); - - gst_bin_add (bin, gst_element_factory_make ("filesrc", NULL)); - gst_bin_add (bin2, gst_element_factory_make ("filesrc", NULL)); - it = gst_bin_iterate_all_by_interface (bin, GST_TYPE_URI_HANDLER); - fail_unless (gst_iterator_next (it, &item) == GST_ITERATOR_OK); - fail_unless (gst_iterator_next (it, &item) == GST_ITERATOR_OK); - fail_unless (gst_iterator_next (it, &item) == GST_ITERATOR_OK); - fail_unless (gst_iterator_next (it, &item) == GST_ITERATOR_DONE); - gst_iterator_free (it); - - gst_object_unref (bin); -} - -GST_END_TEST; - -GST_START_TEST (test_message_state_changed) -{ - GstBin *bin; - GstBus *bus; - GstMessage *message; - GstStateChangeReturn ret; - - bin = GST_BIN (gst_bin_new (NULL)); - fail_unless (bin != NULL, "Could not create bin"); - ASSERT_OBJECT_REFCOUNT (bin, "bin", 1); - - bus = g_object_new (gst_bus_get_type (), NULL); - gst_element_set_bus (GST_ELEMENT_CAST (bin), bus); - - /* change state, spawning a message, causing an incref on the bin */ - ret = gst_element_set_state (GST_ELEMENT (bin), GST_STATE_READY); - fail_unless (ret == GST_STATE_CHANGE_SUCCESS); - - ASSERT_OBJECT_REFCOUNT (bin, "bin", 2); - - /* get and unref the message, causing a decref on the bin */ - message = gst_bus_poll (bus, GST_MESSAGE_STATE_CHANGED, -1); - - fail_unless (message && GST_MESSAGE_TYPE (message) - == GST_MESSAGE_STATE_CHANGED, "did not get GST_MESSAGE_STATE_CHANGED"); - - gst_message_unref (message); - - ASSERT_OBJECT_REFCOUNT (bin, "bin", 1); - - /* clean up */ - ret = gst_element_set_state (GST_ELEMENT (bin), GST_STATE_NULL); - fail_unless (ret == GST_STATE_CHANGE_SUCCESS); - - gst_object_unref (bus); - gst_object_unref (bin); -} - -GST_END_TEST; - -GST_START_TEST (test_message_state_changed_child) -{ - GstBin *bin; - GstElement *src; - GstBus *bus; - GstMessage *message; - GstStateChangeReturn ret; - - bin = GST_BIN (gst_bin_new (NULL)); - fail_unless (bin != NULL, "Could not create bin"); - ASSERT_OBJECT_REFCOUNT (bin, "bin", 1); - - bus = g_object_new (gst_bus_get_type (), NULL); - gst_element_set_bus (GST_ELEMENT_CAST (bin), bus); - - src = gst_element_factory_make ("fakesrc", NULL); - fail_if (src == NULL, "Could not create fakesrc"); - gst_bin_add (bin, src); - ASSERT_OBJECT_REFCOUNT (bin, "bin", 1); - ASSERT_OBJECT_REFCOUNT (src, "src", 1); - - /* change state, spawning two messages: - * - first for fakesrc, forwarded to bin's bus, causing incref on fakesrc - * - second for bin, causing an incref on the bin */ - GST_DEBUG ("setting bin to READY"); - ret = gst_element_set_state (GST_ELEMENT (bin), GST_STATE_READY); - fail_unless (ret == GST_STATE_CHANGE_SUCCESS); - - ASSERT_OBJECT_REFCOUNT (src, "src", 2); - ASSERT_OBJECT_REFCOUNT (bin, "bin", 2); - - /* get and unref the message, causing a decref on the src */ - message = gst_bus_poll (bus, GST_MESSAGE_STATE_CHANGED, -1); - fail_unless (message && GST_MESSAGE_TYPE (message) - == GST_MESSAGE_STATE_CHANGED, "did not get GST_MESSAGE_STATE_CHANGED"); - - fail_unless (message->src == GST_OBJECT (src)); - gst_message_unref (message); - - ASSERT_OBJECT_REFCOUNT (src, "src", 1); - ASSERT_OBJECT_REFCOUNT (bin, "bin", 2); - - /* get and unref message 2, causing a decref on the bin */ - message = gst_bus_poll (bus, GST_MESSAGE_STATE_CHANGED, -1); - fail_unless (message && GST_MESSAGE_TYPE (message) - == GST_MESSAGE_STATE_CHANGED, "did not get GST_MESSAGE_STATE_CHANGED"); - - fail_unless (message->src == GST_OBJECT (bin)); - gst_message_unref (message); - - ASSERT_OBJECT_REFCOUNT (src, "src", 1); - ASSERT_OBJECT_REFCOUNT (bin, "bin", 1); - - /* clean up */ - ret = gst_element_set_state (GST_ELEMENT (bin), GST_STATE_NULL); - fail_unless (ret == GST_STATE_CHANGE_SUCCESS); - gst_object_unref (bus); - gst_object_unref (bin); -} - -GST_END_TEST; - -GST_START_TEST (test_message_state_changed_children) -{ - GstPipeline *pipeline; - GstElement *src, *sink; - GstBus *bus; - GstStateChangeReturn ret; - GstState current, pending; - - pipeline = GST_PIPELINE (gst_pipeline_new (NULL)); - fail_unless (pipeline != NULL, "Could not create pipeline"); - ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); - - src = gst_element_factory_make ("fakesrc", NULL); - fail_if (src == NULL, "Could not create fakesrc"); - /* need to silence the element as the deep_notify refcounts the - * parents while running */ - g_object_set (G_OBJECT (src), "silent", TRUE, NULL); - gst_bin_add (GST_BIN (pipeline), src); - - sink = gst_element_factory_make ("fakesink", NULL); - /* need to silence the element as the deep_notify refcounts the - * parents while running */ - g_object_set (G_OBJECT (sink), "silent", TRUE, NULL); - fail_if (sink == NULL, "Could not create fakesink"); - gst_bin_add (GST_BIN (pipeline), sink); - - fail_unless (gst_element_link (src, sink), "could not link src and sink"); - - ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); - ASSERT_OBJECT_REFCOUNT (src, "src", 1); - ASSERT_OBJECT_REFCOUNT (sink, "sink", 1); - - bus = gst_pipeline_get_bus (pipeline); - - /* change state to READY, spawning three messages */ - GST_DEBUG ("setting pipeline to READY"); - ret = gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_READY); - fail_unless (ret == GST_STATE_CHANGE_SUCCESS); - - /* each object is referenced by a message */ - ASSERT_OBJECT_REFCOUNT (bus, "bus", 2); - ASSERT_OBJECT_REFCOUNT (src, "src", 2); - ASSERT_OBJECT_REFCOUNT (sink, "sink", 2); - ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 2); - - pop_messages (bus, 3); - fail_if (gst_bus_have_pending (bus), "unexpected pending messages"); - - ASSERT_OBJECT_REFCOUNT (bus, "bus", 2); - ASSERT_OBJECT_REFCOUNT (src, "src", 1); - ASSERT_OBJECT_REFCOUNT (sink, "sink", 1); - ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); - - /* change state to PAUSED, spawning three messages */ - GST_DEBUG ("setting pipeline to PAUSED"); - ret = gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PAUSED); - fail_unless (ret == GST_STATE_CHANGE_ASYNC); - ret = - gst_element_get_state (GST_ELEMENT (pipeline), ¤t, &pending, - GST_CLOCK_TIME_NONE); - fail_unless (ret == GST_STATE_CHANGE_SUCCESS); - fail_unless (current == GST_STATE_PAUSED); - fail_unless (pending == GST_STATE_VOID_PENDING); - - /* wait for async thread to settle down */ - while (GST_OBJECT_REFCOUNT_VALUE (pipeline) > 2) - THREAD_SWITCH (); - - /* each object is referenced by a message; - * base_src is blocked in the push and has an extra refcount. - * base_sink_chain has taken a refcount on the sink, and is blocked on - * preroll */ - ASSERT_OBJECT_REFCOUNT (src, "src", 3); - ASSERT_OBJECT_REFCOUNT (sink, "sink", 3); - ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 2); - - pop_messages (bus, 3); - fail_if ((gst_bus_pop (bus)) != NULL); - - ASSERT_OBJECT_REFCOUNT (bus, "bus", 2); - ASSERT_OBJECT_REFCOUNT (src, "src", 2); - ASSERT_OBJECT_REFCOUNT (sink, "sink", 2); - ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); - - /* change state to PLAYING, spawning three messages */ - GST_DEBUG ("setting pipeline to PLAYING"); - ret = gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING); - fail_unless (ret == GST_STATE_CHANGE_SUCCESS); - ret = - gst_element_get_state (GST_ELEMENT (pipeline), ¤t, &pending, - GST_CLOCK_TIME_NONE); - fail_unless (ret == GST_STATE_CHANGE_SUCCESS); - fail_unless (current == GST_STATE_PLAYING); - fail_unless (pending == GST_STATE_VOID_PENDING); - - /* each object is referenced by one message - * src might have an extra reference if it's still pushing - * sink might have an extra reference if it's still blocked on preroll - * pipeline posted a new-clock message too. */ - ASSERT_OBJECT_REFCOUNT_BETWEEN (src, "src", 2, 3); - ASSERT_OBJECT_REFCOUNT_BETWEEN (sink, "sink", 2, 3); - ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 3); - - pop_messages (bus, 3); - fail_if ((gst_bus_pop (bus)) != NULL); - - ASSERT_OBJECT_REFCOUNT (bus, "bus", 2); - /* src might have an extra reference if it's still pushing */ - ASSERT_OBJECT_REFCOUNT_BETWEEN (src, "src", 1, 2); - /* sink might have an extra reference if it's still blocked on preroll */ - ASSERT_OBJECT_REFCOUNT_BETWEEN (sink, "sink", 1, 2); - ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); - - /* go back to READY, spawning six messages */ - GST_DEBUG ("setting pipeline to READY"); - ret = gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_READY); - fail_unless (ret == GST_STATE_CHANGE_SUCCESS); - - /* each object is referenced by two messages */ - ASSERT_OBJECT_REFCOUNT (src, "src", 3); - ASSERT_OBJECT_REFCOUNT (sink, "sink", 3); - ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 3); - - pop_messages (bus, 6); - fail_if ((gst_bus_pop (bus)) != NULL); - - ASSERT_OBJECT_REFCOUNT (src, "src", 1); - ASSERT_OBJECT_REFCOUNT (sink, "sink", 1); - ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); - - /* setting pipeline to NULL flushes the bus automatically */ - ret = gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL); - fail_unless (ret == GST_STATE_CHANGE_SUCCESS); - - ASSERT_OBJECT_REFCOUNT (src, "src", 1); - ASSERT_OBJECT_REFCOUNT (sink, "sink", 1); - ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); - - /* clean up */ - gst_object_unref (bus); - gst_object_unref (pipeline); -} - -GST_END_TEST; - -GST_START_TEST (test_watch_for_state_change) -{ - GstElement *src, *sink, *bin; - GstBus *bus; - GstStateChangeReturn ret; - - bin = gst_element_factory_make ("bin", NULL); - fail_unless (bin != NULL, "Could not create bin"); - - bus = g_object_new (gst_bus_get_type (), NULL); - gst_element_set_bus (GST_ELEMENT_CAST (bin), bus); - - src = gst_element_factory_make ("fakesrc", NULL); - fail_if (src == NULL, "Could not create fakesrc"); - sink = gst_element_factory_make ("fakesink", NULL); - fail_if (sink == NULL, "Could not create fakesink"); - - gst_bin_add (GST_BIN (bin), sink); - gst_bin_add (GST_BIN (bin), src); - - fail_unless (gst_element_link (src, sink), "could not link src and sink"); - - /* change state, spawning two times three messages */ - ret = gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PAUSED); - fail_unless (ret == GST_STATE_CHANGE_ASYNC); - ret = - gst_element_get_state (GST_ELEMENT (bin), NULL, NULL, - GST_CLOCK_TIME_NONE); - fail_unless (ret == GST_STATE_CHANGE_SUCCESS); - - pop_messages (bus, 6); - - fail_unless (gst_bus_have_pending (bus) == FALSE, - "Unexpected messages on bus"); - - ret = gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PLAYING); - fail_unless (ret == GST_STATE_CHANGE_SUCCESS); - - pop_messages (bus, 3); - - /* this one might return either SUCCESS or ASYNC, likely SUCCESS */ - gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PAUSED); - gst_element_get_state (GST_ELEMENT (bin), NULL, NULL, GST_CLOCK_TIME_NONE); - - pop_messages (bus, 3); - - fail_unless (gst_bus_have_pending (bus) == FALSE, - "Unexpected messages on bus"); - - /* setting bin to NULL flushes the bus automatically */ - ret = gst_element_set_state (GST_ELEMENT (bin), GST_STATE_NULL); - fail_unless (ret == GST_STATE_CHANGE_SUCCESS); - - /* clean up */ - gst_object_unref (bus); - gst_object_unref (bin); -} - -GST_END_TEST; - -/* adding an element with linked pads to a bin unlinks the - * pads */ -GST_START_TEST (test_add_linked) -{ - GstElement *src, *sink; - GstPad *srcpad, *sinkpad; - GstElement *pipeline; - - pipeline = gst_pipeline_new (NULL); - fail_unless (pipeline != NULL, "Could not create pipeline"); - - src = gst_element_factory_make ("fakesrc", NULL); - fail_if (src == NULL, "Could not create fakesrc"); - sink = gst_element_factory_make ("fakesink", NULL); - fail_if (sink == NULL, "Could not create fakesink"); - - srcpad = gst_element_get_pad (src, "src"); - fail_unless (srcpad != NULL); - sinkpad = gst_element_get_pad (sink, "sink"); - fail_unless (sinkpad != NULL); - - fail_unless (gst_pad_link (srcpad, sinkpad) == GST_PAD_LINK_OK); - - /* pads are linked now */ - fail_unless (gst_pad_is_linked (srcpad)); - fail_unless (gst_pad_is_linked (sinkpad)); - - /* adding element to bin voids hierarchy so pads are unlinked */ - gst_bin_add (GST_BIN (pipeline), src); - - /* check if pads really are unlinked */ - fail_unless (!gst_pad_is_linked (srcpad)); - fail_unless (!gst_pad_is_linked (sinkpad)); - - /* cannot link pads in wrong hierarchy */ - fail_unless (gst_pad_link (srcpad, sinkpad) == GST_PAD_LINK_WRONG_HIERARCHY); - - /* adding other element to bin as well */ - gst_bin_add (GST_BIN (pipeline), sink); - - /* now we can link again */ - fail_unless (gst_pad_link (srcpad, sinkpad) == GST_PAD_LINK_OK); - - /* check if pads really are linked */ - fail_unless (gst_pad_is_linked (srcpad)); - fail_unless (gst_pad_is_linked (sinkpad)); - - gst_object_unref (srcpad); - gst_object_unref (sinkpad); - gst_object_unref (pipeline); -} - -GST_END_TEST; - -/* g_print ("%10s: %4d => %4d\n", GST_OBJECT_NAME (msg->src), old, new); */ - -#define ASSERT_STATE_CHANGE_MSG(bus,element,old_state,new_state,num) \ - { \ - GstMessage *msg; \ - GstState old = 0, new = 0, pending = 0; \ - msg = gst_bus_poll (bus, GST_MESSAGE_STATE_CHANGED, GST_SECOND); \ - fail_if (msg == NULL, "No state change message within 1 second (#" \ - G_STRINGIFY (num) ")"); \ - gst_message_parse_state_changed (msg, &old, &new, &pending); \ - fail_if (msg->src != GST_OBJECT (element), G_STRINGIFY(element) \ - " should have changed state next (#" G_STRINGIFY (num) ")"); \ - fail_if (old != old_state || new != new_state, "state change is not " \ - G_STRINGIFY (old_state) " => " G_STRINGIFY (new_state)); \ - gst_message_unref (msg); \ - } - -GST_START_TEST (test_children_state_change_order_flagged_sink) -{ - GstElement *src, *identity, *sink, *pipeline; - GstStateChangeReturn ret; - GstState current, pending; - GstBus *bus; - - pipeline = gst_pipeline_new (NULL); - fail_unless (pipeline != NULL, "Could not create pipeline"); - - bus = gst_element_get_bus (pipeline); - fail_unless (bus != NULL, "Pipeline has no bus?!"); - - src = gst_element_factory_make ("fakesrc", NULL); - fail_if (src == NULL, "Could not create fakesrc"); - - identity = gst_element_factory_make ("identity", NULL); - fail_if (identity == NULL, "Could not create identity"); - - sink = gst_element_factory_make ("fakesink", NULL); - fail_if (sink == NULL, "Could not create fakesink"); - - gst_bin_add_many (GST_BIN (pipeline), src, identity, sink, NULL); - - fail_unless (gst_element_link (src, identity) == TRUE); - fail_unless (gst_element_link (identity, sink) == TRUE); - - /* (1) Test state change with fakesink being a regular sink */ - ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); - fail_if (ret != GST_STATE_CHANGE_ASYNC, - "State change to PLAYING did not return ASYNC"); - ret = - gst_element_get_state (pipeline, ¤t, &pending, GST_CLOCK_TIME_NONE); - fail_if (ret != GST_STATE_CHANGE_SUCCESS, "State change to PLAYING failed"); - fail_if (current != GST_STATE_PLAYING, "State change to PLAYING failed"); - fail_if (pending != GST_STATE_VOID_PENDING, "State change to PLAYING failed"); - - /* NULL => READY */ - ASSERT_STATE_CHANGE_MSG (bus, sink, GST_STATE_NULL, GST_STATE_READY, 101); - ASSERT_STATE_CHANGE_MSG (bus, identity, GST_STATE_NULL, GST_STATE_READY, 102); - ASSERT_STATE_CHANGE_MSG (bus, src, GST_STATE_NULL, GST_STATE_READY, 103); - ASSERT_STATE_CHANGE_MSG (bus, pipeline, GST_STATE_NULL, GST_STATE_READY, 104); - - /* READY => PAUSED */ - /* because of pre-rolling, sink will return ASYNC on state - * change and change state later when it has a buffer */ - ASSERT_STATE_CHANGE_MSG (bus, identity, GST_STATE_READY, GST_STATE_PAUSED, - 105); -#if 0 - /* From here on, all bets are off. Usually the source changes state next, - * but it might just as well be that the first buffer produced by the - * source reaches the sink before the source has finished its state change, - * in which case the sink will commit its new state before the source ... */ - ASSERT_STATE_CHANGE_MSG (bus, src, GST_STATE_READY, GST_STATE_PAUSED, 106); - ASSERT_STATE_CHANGE_MSG (bus, sink, GST_STATE_READY, GST_STATE_PAUSED, 107); - ASSERT_STATE_CHANGE_MSG (bus, pipeline, GST_STATE_READY, GST_STATE_PAUSED, - 108); - - /* PAUSED => PLAYING */ - ASSERT_STATE_CHANGE_MSG (bus, sink, GST_STATE_PAUSED, GST_STATE_PLAYING, 109); - ASSERT_STATE_CHANGE_MSG (bus, identity, GST_STATE_PAUSED, GST_STATE_PLAYING, - 110); - ASSERT_STATE_CHANGE_MSG (bus, src, GST_STATE_PAUSED, GST_STATE_PLAYING, 111); - ASSERT_STATE_CHANGE_MSG (bus, pipeline, GST_STATE_PAUSED, GST_STATE_PLAYING, - 112); -#else - pop_messages (bus, 3); /* pop remaining ready => paused messages off the bus */ - pop_messages (bus, 4); /* pop paused => playing messages off the bus */ -#endif - - /* don't set to NULL that will set the bus flushing and kill our messages */ - ret = gst_element_set_state (pipeline, GST_STATE_READY); - fail_if (ret != GST_STATE_CHANGE_SUCCESS, "State change to READY failed"); - ret = gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE); - fail_if (ret != GST_STATE_CHANGE_SUCCESS, "State change to READY failed"); - - /* TODO: do we need to check downwards state change order as well? */ - pop_messages (bus, 4); /* pop playing => paused messages off the bus */ - pop_messages (bus, 4); /* pop paused => ready messages off the bus */ - - ASSERT_OBJECT_REFCOUNT (src, "src", 1); - ASSERT_OBJECT_REFCOUNT (sink, "sink", 1); - ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); - - ret = gst_element_set_state (pipeline, GST_STATE_NULL); - fail_if (ret != GST_STATE_CHANGE_SUCCESS, "State change to NULL failed"); - - ASSERT_OBJECT_REFCOUNT (src, "src", 1); - ASSERT_OBJECT_REFCOUNT (sink, "sink", 1); - ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); - - gst_object_unref (bus); - gst_object_unref (pipeline); -} - -GST_END_TEST; - - -GST_START_TEST (test_children_state_change_order_semi_sink) -{ - GstElement *src, *identity, *sink, *pipeline; - GstStateChangeReturn ret; - GstState current, pending; - GstBus *bus; - - /* (2) Now again, but check other code path where we don't have - * a proper sink correctly flagged as such, but a 'semi-sink' */ - pipeline = gst_pipeline_new (NULL); - fail_unless (pipeline != NULL, "Could not create pipeline"); - - bus = gst_element_get_bus (pipeline); - fail_unless (bus != NULL, "Pipeline has no bus?!"); - - src = gst_element_factory_make ("fakesrc", NULL); - fail_if (src == NULL, "Could not create fakesrc"); - - identity = gst_element_factory_make ("identity", NULL); - fail_if (identity == NULL, "Could not create identity"); - - sink = gst_element_factory_make ("fakesink", NULL); - fail_if (sink == NULL, "Could not create fakesink"); - - gst_bin_add_many (GST_BIN (pipeline), src, identity, sink, NULL); - - fail_unless (gst_element_link (src, identity) == TRUE); - fail_unless (gst_element_link (identity, sink) == TRUE); - - /* this is not very nice but should work just fine in this case. */ - GST_OBJECT_FLAG_UNSET (sink, GST_ELEMENT_IS_SINK); /* <======== */ - - ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); - fail_if (ret != GST_STATE_CHANGE_ASYNC, "State change to PLAYING not ASYNC"); - ret = - gst_element_get_state (pipeline, ¤t, &pending, GST_CLOCK_TIME_NONE); - fail_if (ret != GST_STATE_CHANGE_SUCCESS, "State change to PLAYING failed"); - fail_if (current != GST_STATE_PLAYING, "State change to PLAYING failed"); - fail_if (pending != GST_STATE_VOID_PENDING, "State change to PLAYING failed"); - - /* NULL => READY */ - ASSERT_STATE_CHANGE_MSG (bus, sink, GST_STATE_NULL, GST_STATE_READY, 201); - ASSERT_STATE_CHANGE_MSG (bus, identity, GST_STATE_NULL, GST_STATE_READY, 202); - ASSERT_STATE_CHANGE_MSG (bus, src, GST_STATE_NULL, GST_STATE_READY, 203); - ASSERT_STATE_CHANGE_MSG (bus, pipeline, GST_STATE_NULL, GST_STATE_READY, 204); - - /* READY => PAUSED */ - /* because of pre-rolling, sink will return ASYNC on state - * change and change state later when it has a buffer */ - ASSERT_STATE_CHANGE_MSG (bus, identity, GST_STATE_READY, GST_STATE_PAUSED, - 205); -#if 0 - /* From here on, all bets are off. Usually the source changes state next, - * but it might just as well be that the first buffer produced by the - * source reaches the sink before the source has finished its state change, - * in which case the sink will commit its new state before the source ... */ - ASSERT_STATE_CHANGE_MSG (bus, src, GST_STATE_READY, GST_STATE_PAUSED, 206); - ASSERT_STATE_CHANGE_MSG (bus, sink, GST_STATE_READY, GST_STATE_PAUSED, 207); - ASSERT_STATE_CHANGE_MSG (bus, pipeline, GST_STATE_READY, GST_STATE_PAUSED, - 208); - - /* PAUSED => PLAYING */ - ASSERT_STATE_CHANGE_MSG (bus, sink, GST_STATE_PAUSED, GST_STATE_PLAYING, 209); - ASSERT_STATE_CHANGE_MSG (bus, identity, GST_STATE_PAUSED, GST_STATE_PLAYING, - 210); - ASSERT_STATE_CHANGE_MSG (bus, src, GST_STATE_PAUSED, GST_STATE_PLAYING, 211); - ASSERT_STATE_CHANGE_MSG (bus, pipeline, GST_STATE_PAUSED, GST_STATE_PLAYING, - 212); -#else - pop_messages (bus, 3); /* pop remaining ready => paused messages off the bus */ - pop_messages (bus, 4); /* pop paused => playing messages off the bus */ -#endif - - /* don't set to NULL that will set the bus flushing and kill our messages */ - ret = gst_element_set_state (pipeline, GST_STATE_READY); - fail_if (ret != GST_STATE_CHANGE_SUCCESS, "State change to READY failed"); - - /* TODO: do we need to check downwards state change order as well? */ - pop_messages (bus, 4); /* pop playing => paused messages off the bus */ - pop_messages (bus, 4); /* pop paused => ready messages off the bus */ - - while (GST_OBJECT_REFCOUNT_VALUE (pipeline) > 1) - THREAD_SWITCH (); - - ASSERT_OBJECT_REFCOUNT (src, "src", 1); - ASSERT_OBJECT_REFCOUNT (sink, "sink", 1); - ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); - - ret = gst_element_set_state (pipeline, GST_STATE_NULL); - fail_if (ret != GST_STATE_CHANGE_SUCCESS, "State change to NULL failed"); - - ASSERT_OBJECT_REFCOUNT (src, "src", 1); - ASSERT_OBJECT_REFCOUNT (sink, "sink", 1); - ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); - - gst_object_unref (bus); - gst_object_unref (pipeline); -} - -GST_END_TEST; - -GST_START_TEST (test_children_state_change_order_two_sink) -{ - GstElement *src, *tee, *identity, *sink1, *sink2, *pipeline; - GstStateChangeReturn ret; - GstBus *bus; - - pipeline = gst_pipeline_new (NULL); - fail_unless (pipeline != NULL, "Could not create pipeline"); - - bus = gst_element_get_bus (pipeline); - fail_unless (bus != NULL, "Pipeline has no bus?!"); - - src = gst_element_factory_make ("fakesrc", NULL); - fail_if (src == NULL, "Could not create fakesrc"); - - tee = gst_element_factory_make ("tee", NULL); - fail_if (tee == NULL, "Could not create tee"); - - identity = gst_element_factory_make ("identity", NULL); - fail_if (identity == NULL, "Could not create identity"); - - sink1 = gst_element_factory_make ("fakesink", NULL); - fail_if (sink1 == NULL, "Could not create fakesink1"); - - sink2 = gst_element_factory_make ("fakesink", NULL); - fail_if (sink2 == NULL, "Could not create fakesink2"); - - gst_bin_add_many (GST_BIN (pipeline), src, tee, identity, sink1, sink2, NULL); - - fail_unless (gst_element_link (src, tee) == TRUE); - fail_unless (gst_element_link (tee, identity) == TRUE); - fail_unless (gst_element_link (identity, sink1) == TRUE); - fail_unless (gst_element_link (tee, sink2) == TRUE); - - ret = gst_element_set_state (pipeline, GST_STATE_READY); - fail_if (ret != GST_STATE_CHANGE_SUCCESS, "State change to READY failed"); - - /* NULL => READY */ - { - GstMessage *msg; - GstState old = 0, new = 0, pending = 0; - GstObject *first, *second; - - msg = gst_bus_poll (bus, GST_MESSAGE_STATE_CHANGED, GST_SECOND); - fail_if (msg == NULL, "No state change message within 1 second (#201)"); - - gst_message_parse_state_changed (msg, &old, &new, &pending); - first = gst_object_ref (msg->src); - - fail_if (first != GST_OBJECT (sink1) && first != GST_OBJECT (sink2), - "sink1 or sink2 should have changed state next #(202)"); - gst_message_unref (msg); - - msg = gst_bus_poll (bus, GST_MESSAGE_STATE_CHANGED, GST_SECOND); - fail_if (msg == NULL, "No state change message within 1 second (#201)"); - - gst_message_parse_state_changed (msg, &old, &new, &pending); - second = gst_object_ref (msg->src); - - fail_if (second != GST_OBJECT (sink1) && second != GST_OBJECT (sink2), - "sink1 or sink2 should have changed state next #(202)"); - gst_message_unref (msg); - - fail_if (second == first, "got state change from same object"); - - gst_object_unref (first); - gst_object_unref (second); - } - ASSERT_STATE_CHANGE_MSG (bus, identity, GST_STATE_NULL, GST_STATE_READY, 203); - ASSERT_STATE_CHANGE_MSG (bus, tee, GST_STATE_NULL, GST_STATE_READY, 204); - ASSERT_STATE_CHANGE_MSG (bus, src, GST_STATE_NULL, GST_STATE_READY, 205); - ASSERT_STATE_CHANGE_MSG (bus, pipeline, GST_STATE_NULL, GST_STATE_READY, 206); - - ASSERT_OBJECT_REFCOUNT (src, "src", 1); - ASSERT_OBJECT_REFCOUNT (tee, "tee", 1); - ASSERT_OBJECT_REFCOUNT (identity, "identity", 1); - ASSERT_OBJECT_REFCOUNT (sink1, "sink1", 1); - ASSERT_OBJECT_REFCOUNT (sink2, "sink2", 1); - ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); - - ret = gst_element_set_state (pipeline, GST_STATE_NULL); - fail_if (ret != GST_STATE_CHANGE_SUCCESS, "State change to NULL failed"); - - ASSERT_OBJECT_REFCOUNT (src, "src", 1); - ASSERT_OBJECT_REFCOUNT (tee, "tee", 1); - ASSERT_OBJECT_REFCOUNT (identity, "identity", 1); - ASSERT_OBJECT_REFCOUNT (sink1, "sink1", 1); - ASSERT_OBJECT_REFCOUNT (sink2, "sink2", 1); - ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); - - gst_object_unref (bus); - gst_object_unref (pipeline); -} - -GST_END_TEST; - -Suite * -gst_bin_suite (void) -{ - Suite *s = suite_create ("GstBin"); - TCase *tc_chain = tcase_create ("bin tests"); - - tcase_set_timeout (tc_chain, 0); - - suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, test_interface); - tcase_add_test (tc_chain, test_children_state_change_order_flagged_sink); - tcase_add_test (tc_chain, test_children_state_change_order_semi_sink); - tcase_add_test (tc_chain, test_children_state_change_order_two_sink); - tcase_add_test (tc_chain, test_message_state_changed); - tcase_add_test (tc_chain, test_message_state_changed_child); - tcase_add_test (tc_chain, test_message_state_changed_children); - tcase_add_test (tc_chain, test_watch_for_state_change); - tcase_add_test (tc_chain, test_add_linked); - - return s; -} - -int -main (int argc, char **argv) -{ - int nf; - - Suite *s = gst_bin_suite (); - SRunner *sr = srunner_create (s); - - gst_check_init (&argc, &argv); - - srunner_run_all (sr, CK_NORMAL); - nf = srunner_ntests_failed (sr); - srunner_free (sr); - - return nf; -} diff --git a/check/gst/gstbuffer.c b/check/gst/gstbuffer.c deleted file mode 100644 index 24611b40f1..0000000000 --- a/check/gst/gstbuffer.c +++ /dev/null @@ -1,302 +0,0 @@ -/* GStreamer - * - * unit test for GstBuffer - * - * Copyright (C) <2005> Thomas Vander Stichele - * - * 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_START_TEST (test_caps) -{ - GstBuffer *buffer; - GstCaps *caps, *caps2; - - buffer = gst_buffer_new_and_alloc (4); - caps = gst_caps_from_string ("audio/x-raw-int"); - ASSERT_CAPS_REFCOUNT (caps, "caps", 1); - - fail_unless (GST_BUFFER_CAPS (buffer) == NULL); - - gst_buffer_set_caps (buffer, caps); - ASSERT_CAPS_REFCOUNT (caps, "caps", 2); - - fail_unless (GST_BUFFER_CAPS (buffer) == caps); - ASSERT_CAPS_REFCOUNT (caps, "caps", 2); - - caps2 = gst_caps_from_string ("audio/x-raw-float"); - ASSERT_CAPS_REFCOUNT (caps2, "caps2", 1); - - gst_buffer_set_caps (buffer, caps2); - ASSERT_CAPS_REFCOUNT (caps, "caps", 1); - ASSERT_CAPS_REFCOUNT (caps2, "caps2", 2); - - gst_buffer_set_caps (buffer, NULL); - ASSERT_CAPS_REFCOUNT (caps, "caps", 1); - ASSERT_CAPS_REFCOUNT (caps2, "caps2", 1); - - /* clean up, with caps2 still set as caps */ - gst_buffer_set_caps (buffer, caps2); - ASSERT_CAPS_REFCOUNT (caps2, "caps2", 2); - gst_buffer_unref (buffer); - ASSERT_CAPS_REFCOUNT (caps2, "caps2", 1); - gst_caps_unref (caps); - gst_caps_unref (caps2); -} - -GST_END_TEST; - - -GST_START_TEST (test_subbuffer) -{ - GstBuffer *buffer, *sub; - - buffer = gst_buffer_new_and_alloc (4); - memset (GST_BUFFER_DATA (buffer), 0, 4); - - sub = gst_buffer_create_sub (buffer, 1, 2); - fail_if (sub == NULL, "create_sub of buffer returned NULL"); - fail_unless (GST_BUFFER_SIZE (sub) == 2, "subbuffer has wrong size"); - fail_unless (memcmp (GST_BUFFER_DATA (buffer) + 1, GST_BUFFER_DATA (sub), - 2) == 0, "subbuffer contains the wrong data"); - ASSERT_BUFFER_REFCOUNT (buffer, "parent", 2); - ASSERT_BUFFER_REFCOUNT (sub, "subbuffer", 1); - - /* clean up */ - gst_buffer_unref (sub); - gst_buffer_unref (buffer); -} - -GST_END_TEST; - -GST_START_TEST (test_is_span_fast) -{ - GstBuffer *buffer, *sub1, *sub2; - - buffer = gst_buffer_new_and_alloc (4); - - sub1 = gst_buffer_create_sub (buffer, 0, 2); - fail_if (sub1 == NULL, "create_sub of buffer returned NULL"); - - sub2 = gst_buffer_create_sub (buffer, 2, 2); - fail_if (sub2 == NULL, "create_sub of buffer returned NULL"); - - fail_if (gst_buffer_is_span_fast (buffer, sub2) == TRUE, - "a parent buffer can't be span_fasted"); - - fail_if (gst_buffer_is_span_fast (sub1, buffer) == TRUE, - "a parent buffer can't be span_fasted"); - - fail_if (gst_buffer_is_span_fast (sub1, sub2) == FALSE, - "two subbuffers next to each other should be span_fast"); - - /* clean up */ - gst_buffer_unref (sub1); - gst_buffer_unref (sub2); - gst_buffer_unref (buffer); -} - -GST_END_TEST; - -GST_START_TEST (test_span) -{ - GstBuffer *buffer, *sub1, *sub2, *span; - - buffer = gst_buffer_new_and_alloc (4); - memcpy (GST_BUFFER_DATA (buffer), "data", 4); - - ASSERT_CRITICAL (gst_buffer_span (NULL, 1, NULL, 2)); - ASSERT_CRITICAL (gst_buffer_span (buffer, 1, NULL, 2)); - ASSERT_CRITICAL (gst_buffer_span (NULL, 1, buffer, 2)); - ASSERT_CRITICAL (gst_buffer_span (buffer, 0, buffer, 10)); - - sub1 = gst_buffer_create_sub (buffer, 0, 2); - fail_if (sub1 == NULL, "create_sub of buffer returned NULL"); - - sub2 = gst_buffer_create_sub (buffer, 2, 2); - fail_if (sub2 == NULL, "create_sub of buffer returned NULL"); - - ASSERT_BUFFER_REFCOUNT (buffer, "parent", 3); - ASSERT_BUFFER_REFCOUNT (sub1, "sub1", 1); - ASSERT_BUFFER_REFCOUNT (sub2, "sub2", 1); - - /* span will create a new subbuffer from the parent */ - span = gst_buffer_span (sub1, 0, sub2, 4); - fail_unless (GST_BUFFER_SIZE (span) == 4, "spanned buffer is wrong size"); - ASSERT_BUFFER_REFCOUNT (buffer, "parent", 4); - ASSERT_BUFFER_REFCOUNT (sub1, "sub1", 1); - ASSERT_BUFFER_REFCOUNT (sub2, "sub2", 1); - ASSERT_BUFFER_REFCOUNT (span, "span", 1); - fail_unless (memcmp (GST_BUFFER_DATA (span), "data", 4) == 0, - "spanned buffer contains the wrong data"); - gst_buffer_unref (span); - ASSERT_BUFFER_REFCOUNT (buffer, "parent", 3); - - /* span from non-contiguous buffers will create new buffers */ - span = gst_buffer_span (sub2, 0, sub1, 4); - fail_unless (GST_BUFFER_SIZE (span) == 4, "spanned buffer is wrong size"); - ASSERT_BUFFER_REFCOUNT (buffer, "parent", 3); - ASSERT_BUFFER_REFCOUNT (sub1, "sub1", 1); - ASSERT_BUFFER_REFCOUNT (sub2, "sub2", 1); - ASSERT_BUFFER_REFCOUNT (span, "span", 1); - fail_unless (memcmp (GST_BUFFER_DATA (span), "tada", 4) == 0, - "spanned buffer contains the wrong data"); - gst_buffer_unref (span); - ASSERT_BUFFER_REFCOUNT (buffer, "parent", 3); - - /* span with different sizes */ - span = gst_buffer_span (sub1, 1, sub2, 3); - fail_unless (GST_BUFFER_SIZE (span) == 3, "spanned buffer is wrong size"); - ASSERT_BUFFER_REFCOUNT (buffer, "parent", 4); - ASSERT_BUFFER_REFCOUNT (sub1, "sub1", 1); - ASSERT_BUFFER_REFCOUNT (sub2, "sub2", 1); - ASSERT_BUFFER_REFCOUNT (span, "span", 1); - fail_unless (memcmp (GST_BUFFER_DATA (span), "ata", 3) == 0, - "spanned buffer contains the wrong data"); - gst_buffer_unref (span); - ASSERT_BUFFER_REFCOUNT (buffer, "parent", 3); - - span = gst_buffer_span (sub2, 0, sub1, 3); - fail_unless (GST_BUFFER_SIZE (span) == 3, "spanned buffer is wrong size"); - ASSERT_BUFFER_REFCOUNT (buffer, "parent", 3); - ASSERT_BUFFER_REFCOUNT (sub1, "sub1", 1); - ASSERT_BUFFER_REFCOUNT (sub2, "sub2", 1); - ASSERT_BUFFER_REFCOUNT (span, "span", 1); - fail_unless (memcmp (GST_BUFFER_DATA (span), "tad", 3) == 0, - "spanned buffer contains the wrong data"); - gst_buffer_unref (span); - ASSERT_BUFFER_REFCOUNT (buffer, "parent", 3); - -/* clean up */ - gst_buffer_unref (sub1); - gst_buffer_unref (sub2); - gst_buffer_unref (buffer); -} - -GST_END_TEST; - - -static const char ro_memory[] = "abcdefghijklmnopqrstuvwxyz"; - -static GstBuffer * -create_read_only_buffer (void) -{ - GstBuffer *buf; - - buf = (GstBuffer *) gst_mini_object_new (GST_TYPE_BUFFER); - - /* assign some read-only data to the new buffer */ - GST_BUFFER_DATA (buf) = (guint8 *) ro_memory; - GST_BUFFER_SIZE (buf) = sizeof (ro_memory); - - GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_READONLY); - - return buf; -} - -GST_START_TEST (test_make_writable) -{ - GstBuffer *buf, *buf2; - - /* create read-only buffer and make it writable */ - buf = create_read_only_buffer (); - fail_unless (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_READONLY), - "read-only buffer should have read-only flag set"); - buf = gst_buffer_make_writable (buf); - fail_unless (!GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_READONLY), - "writable buffer must not have read-only flag set"); - GST_BUFFER_DATA (buf)[4] = 'a'; - gst_buffer_unref (buf); - - /* alloc'ed buffer with refcount 1 should be writable */ - buf = gst_buffer_new_and_alloc (32); - fail_unless (!GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_READONLY), - "_new_and_alloc'ed buffer must not have read-only flag set"); - buf2 = gst_buffer_make_writable (buf); - fail_unless (buf == buf2, - "_make_writable() should have returned same buffer"); - gst_buffer_unref (buf2); - - /* alloc'ed buffer with refcount >1 should be copied */ - buf = gst_buffer_new_and_alloc (32); - fail_unless (!GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_READONLY), - "_new_and_alloc'ed buffer must not have read-only flag set"); - gst_buffer_ref (buf); - buf2 = gst_buffer_make_writable (buf); - fail_unless (buf != buf2, "_make_writable() should have returned a copy!"); - gst_buffer_unref (buf2); - gst_buffer_unref (buf); -} - -GST_END_TEST; - -GST_START_TEST (test_subbuffer_make_writable) -{ - GstBuffer *buf, *sub_buf; - - /* create sub-buffer of read-only buffer and make it writable */ - buf = create_read_only_buffer (); - fail_unless (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_READONLY), - "read-only buffer should have read-only flag set"); - - sub_buf = gst_buffer_create_sub (buf, 0, 8); - fail_unless (GST_BUFFER_FLAG_IS_SET (sub_buf, GST_BUFFER_FLAG_READONLY), - "sub-buffer of read-only buffer should have read-only flag set"); - - sub_buf = gst_buffer_make_writable (sub_buf); - fail_unless (!GST_BUFFER_FLAG_IS_SET (sub_buf, GST_BUFFER_FLAG_READONLY), - "writable buffer must not have read-only flag set"); - GST_BUFFER_DATA (sub_buf)[4] = 'a'; - gst_buffer_unref (sub_buf); - gst_buffer_unref (buf); -} - -GST_END_TEST; - -Suite * -gst_test_suite (void) -{ - Suite *s = suite_create ("GstBuffer"); - TCase *tc_chain = tcase_create ("general"); - - suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, test_caps); - tcase_add_test (tc_chain, test_subbuffer); - tcase_add_test (tc_chain, test_subbuffer_make_writable); - tcase_add_test (tc_chain, test_make_writable); - tcase_add_test (tc_chain, test_is_span_fast); - tcase_add_test (tc_chain, test_span); - return s; -} - -int -main (int argc, char **argv) -{ - int nf; - - Suite *s = gst_test_suite (); - SRunner *sr = srunner_create (s); - - gst_check_init (&argc, &argv); - - srunner_run_all (sr, CK_NORMAL); - nf = srunner_ntests_failed (sr); - srunner_free (sr); - - return nf; -} diff --git a/check/gst/gstbus.c b/check/gst/gstbus.c deleted file mode 100644 index ebe9fe1420..0000000000 --- a/check/gst/gstbus.c +++ /dev/null @@ -1,256 +0,0 @@ -/* GStreamer - * Copyright (C) 2005 Andy Wingo - * - * gstbus.c: Unit test for the message bus - * - * 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 GstBus *test_bus = NULL; -static GMainLoop *main_loop; - -#define NUM_MESSAGES 1000 -#define NUM_THREADS 10 - -static gpointer -pound_bus_with_messages (gpointer data) -{ - gint thread_id = GPOINTER_TO_INT (data); - gint i; - - for (i = 0; i < NUM_MESSAGES; i++) { - GstMessage *m; - GstStructure *s; - - s = gst_structure_new ("test_message", - "thread_id", G_TYPE_INT, thread_id, "msg_id", G_TYPE_INT, i, NULL); - m = gst_message_new_application (NULL, s); - gst_bus_post (test_bus, m); - } - return NULL; -} - -static void -pull_messages () -{ - GstMessage *m; - const GstStructure *s; - guint message_ids[NUM_THREADS]; - gint i; - - for (i = 0; i < NUM_THREADS; i++) - message_ids[i] = 0; - - while (1) { - gint _t, _i; - - m = gst_bus_pop (test_bus); - if (!m) - break; - g_return_if_fail (GST_MESSAGE_TYPE (m) == GST_MESSAGE_APPLICATION); - - s = gst_message_get_structure (m); - if (!gst_structure_get_int (s, "thread_id", &_t)) - g_critical ("Invalid message"); - if (!gst_structure_get_int (s, "msg_id", &_i)) - g_critical ("Invalid message"); - - g_return_if_fail (_t < NUM_THREADS); - g_return_if_fail (_i == message_ids[_t]++); - - gst_message_unref (m); - } - - for (i = 0; i < NUM_THREADS; i++) - g_return_if_fail (message_ids[i] == NUM_MESSAGES); -} - -GST_START_TEST (test_hammer_bus) -{ - GThread *threads[NUM_THREADS]; - gint i; - - test_bus = gst_bus_new (); - - for (i = 0; i < NUM_THREADS; i++) - threads[i] = g_thread_create (pound_bus_with_messages, GINT_TO_POINTER (i), - TRUE, NULL); - - for (i = 0; i < NUM_THREADS; i++) - g_thread_join (threads[i]); - - pull_messages (); - - gst_object_unref ((GstObject *) test_bus); -} -GST_END_TEST static gboolean -message_func_eos (GstBus * bus, GstMessage * message, gpointer data) -{ - const GstStructure *s; - gint i; - - g_return_val_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_EOS, FALSE); - - GST_DEBUG ("got EOS message"); - - s = gst_message_get_structure (message); - if (!gst_structure_get_int (s, "msg_id", &i)) - g_critical ("Invalid message"); - - return i != 9; -} - -static gboolean -message_func_app (GstBus * bus, GstMessage * message, gpointer data) -{ - const GstStructure *s; - gint i; - - g_return_val_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_APPLICATION, - FALSE); - - GST_DEBUG ("got APP message"); - - s = gst_message_get_structure (message); - if (!gst_structure_get_int (s, "msg_id", &i)) - g_critical ("Invalid message"); - - return i != 9; -} - -static gboolean -send_messages (gpointer data) -{ - GstMessage *m; - GstStructure *s; - gint i; - - for (i = 0; i < 10; i++) { - s = gst_structure_new ("test_message", "msg_id", G_TYPE_INT, i, NULL); - m = gst_message_new_application (NULL, s); - gst_bus_post (test_bus, m); - s = gst_structure_new ("test_message", "msg_id", G_TYPE_INT, i, NULL); - m = gst_message_new_custom (GST_MESSAGE_EOS, NULL, s); - gst_bus_post (test_bus, m); - } - - return FALSE; -} - -/* test if adding a signal watch for different message types calls the - * respective callbacks. */ -GST_START_TEST (test_watch) -{ - guint id; - - test_bus = gst_bus_new (); - - main_loop = g_main_loop_new (NULL, FALSE); - - id = gst_bus_add_watch (test_bus, gst_bus_async_signal_func, NULL); - g_signal_connect (test_bus, "message::eos", (GCallback) message_func_eos, - NULL); - g_signal_connect (test_bus, "message::application", - (GCallback) message_func_app, NULL); - - g_idle_add ((GSourceFunc) send_messages, NULL); - while (g_main_context_pending (NULL)) - g_main_context_iteration (NULL, FALSE); - - g_source_remove (id); - g_main_loop_unref (main_loop); - - gst_object_unref ((GstObject *) test_bus); -} -GST_END_TEST static gint messages_seen = 0; - -static void -message_func (GstBus * bus, GstMessage * message, gpointer data) -{ - g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_APPLICATION); - - messages_seen++; -} - -static void -send_10_app_messages (void) -{ - GstMessage *m; - GstStructure *s; - gint i; - - for (i = 0; i < 10; i++) { - s = gst_structure_new ("test_message", "msg_id", G_TYPE_INT, i, NULL); - m = gst_message_new_application (NULL, s); - gst_bus_post (test_bus, m); - } -} - -/* test that you get the same messages from a poll as from signal watches. */ -GST_START_TEST (test_watch_with_poll) -{ - guint i; - - test_bus = gst_bus_new (); - - gst_bus_add_signal_watch (test_bus); - g_signal_connect (test_bus, "message", (GCallback) message_func, NULL); - - send_10_app_messages (); - - for (i = 0; i < 10; i++) - gst_message_unref (gst_bus_poll (test_bus, GST_MESSAGE_APPLICATION, - GST_CLOCK_TIME_NONE)); - - fail_if (gst_bus_have_pending (test_bus), "unexpected messages on bus"); - fail_unless (messages_seen == 10, "signal handler didn't get 10 messages"); - - gst_bus_remove_signal_watch (test_bus); - - gst_object_unref (test_bus); -} -GST_END_TEST Suite * gstbus_suite (void) -{ - Suite *s = suite_create ("GstBus"); - TCase *tc_chain = tcase_create ("stresstest"); - - tcase_set_timeout (tc_chain, 20); - - suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, test_hammer_bus); - tcase_add_test (tc_chain, test_watch); - tcase_add_test (tc_chain, test_watch_with_poll); - return s; -} - -int -main (int argc, char **argv) -{ - int nf; - - Suite *s = gstbus_suite (); - SRunner *sr = srunner_create (s); - - gst_check_init (&argc, &argv); - - srunner_run_all (sr, CK_NORMAL); - nf = srunner_ntests_failed (sr); - srunner_free (sr); - - return nf; -} diff --git a/check/gst/gstcaps.c b/check/gst/gstcaps.c deleted file mode 100644 index b31da8d76e..0000000000 --- a/check/gst/gstcaps.c +++ /dev/null @@ -1,362 +0,0 @@ -/* GStreamer - * Copyright (C) 2005 Andy Wingo - * Copyright (C) <2005> Thomas Vander Stichele - * - * gstcaps.c: Unit test for GstCaps - * - * 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 "capslist.h" - -GST_START_TEST (test_from_string) -{ - GstCaps *caps; - GstCaps *caps2; - gchar *to_str; - int i; - - for (i = 0; i < G_N_ELEMENTS (caps_list); i++) { - caps = gst_caps_from_string (caps_list[i]); - fail_if (caps == NULL, - "Could not create caps from string %s\n", caps_list[i]); - to_str = gst_caps_to_string (caps); - fail_if (to_str == NULL, - "Could not convert caps back to string %s\n", caps_list[i]); - caps2 = gst_caps_from_string (caps_list[i]); - fail_if (caps2 == NULL, "Could not create caps from string %s\n", to_str); - - fail_unless (gst_caps_is_equal (caps, caps2)); - - g_free (caps); - g_free (caps2); - g_free (to_str); - } -} - -GST_END_TEST; - -GST_START_TEST (test_buffer) -{ - GstCaps *c1; - GstBuffer *buffer; - - buffer = gst_buffer_new_and_alloc (1000); - c1 = gst_caps_new_simple ("audio/x-raw-int", - "buffer", GST_TYPE_BUFFER, buffer, NULL); - - GST_DEBUG ("caps: %" GST_PTR_FORMAT, c1); - - gst_buffer_set_caps (buffer, c1); /* gives away our c1 ref */ - gst_buffer_unref (buffer); -} - -GST_END_TEST; - -GST_START_TEST (test_double_append) -{ - GstStructure *s1; - GstCaps *c1; - - c1 = gst_caps_new_any (); - s1 = gst_structure_from_string ("audio/x-raw-int,rate=44100", NULL); - gst_caps_append_structure (c1, s1); - ASSERT_CRITICAL (gst_caps_append_structure (c1, s1)); - - gst_caps_unref (c1); -} - -GST_END_TEST; - -GST_START_TEST (test_mutability) -{ - GstStructure *s1; - GstCaps *c1; - gint ret; - - c1 = gst_caps_new_any (); - s1 = gst_structure_from_string ("audio/x-raw-int,rate=44100", NULL); - gst_structure_set (s1, "rate", G_TYPE_INT, 48000, NULL); - gst_caps_append_structure (c1, s1); - gst_structure_set (s1, "rate", G_TYPE_INT, 22500, NULL); - gst_caps_ref (c1); - ASSERT_CRITICAL (gst_structure_set (s1, "rate", G_TYPE_INT, 11250, NULL)); - fail_unless (gst_structure_get_int (s1, "rate", &ret)); - fail_unless (ret == 22500); - ASSERT_CRITICAL (gst_caps_set_simple (c1, "rate", G_TYPE_INT, 11250, NULL)); - fail_unless (gst_structure_get_int (s1, "rate", &ret)); - fail_unless (ret == 22500); - gst_caps_unref (c1); - gst_structure_set (s1, "rate", G_TYPE_INT, 11250, NULL); - fail_unless (gst_structure_get_int (s1, "rate", &ret)); - fail_unless (ret == 11250); - gst_caps_set_simple (c1, "rate", G_TYPE_INT, 1, NULL); - fail_unless (gst_structure_get_int (s1, "rate", &ret)); - fail_unless (ret == 1); - gst_caps_unref (c1); -} - -GST_END_TEST; - -GST_START_TEST (test_static_caps) -{ - GstStaticCaps scaps = GST_STATIC_CAPS ("audio/x-raw-int,rate=44100"); - GstCaps *caps1; - GstCaps *caps2; - - /* caps creation */ - caps1 = gst_static_caps_get (&scaps); - fail_unless (caps1 != NULL); - /* 1 refcount core, one from us */ - fail_unless (GST_CAPS_REFCOUNT (caps1) == 2); - - /* caps should be the same */ - caps2 = gst_static_caps_get (&scaps); - fail_unless (caps2 != NULL); - /* 1 refcount core, two from us */ - fail_unless (GST_CAPS_REFCOUNT (caps1) == 3); - /* caps must be equal */ - fail_unless (caps1 == caps2); - - gst_caps_unref (caps1); - gst_caps_unref (caps2); -} - -GST_END_TEST; - -static const gchar non_simple_caps_string[] = - "video/x-raw-yuv, format=(fourcc)I420, framerate=(fraction)[ 1/100, 100 ], " - "width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-raw-yuv, " - "format=(fourcc)YUY2, framerate=(fraction)[ 1/100, 100 ], width=(int)[ 16, 4096 ], " - "height=(int)[ 16, 4096 ]; video/x-raw-rgb, bpp=(int)8, depth=(int)8, " - "endianness=(int)1234, framerate=(fraction)[ 1/100, 100 ], width=(int)[ 16, 4096 ], " - "height=(int)[ 16, 4096 ]; video/x-raw-yuv, " - "format=(fourcc){ I420, YUY2, YV12 }, width=(int)[ 16, 4096 ], " - "height=(int)[ 16, 4096 ], framerate=(fraction)[ 1/100, 100 ]"; - -static gboolean -check_fourcc_list (const GValue * format_value) -{ - const GValue *fourcc_value; - gboolean got_yv12 = FALSE; - gboolean got_i420 = FALSE; - gboolean got_yuy2 = FALSE; - guint32 fourcc; - - fourcc_value = gst_value_list_get_value (format_value, 0); - fail_unless (fourcc_value != NULL); - fail_unless (GST_VALUE_HOLDS_FOURCC (fourcc_value)); - fourcc = gst_value_get_fourcc (fourcc_value); - fail_unless (fourcc != 0); - got_i420 = got_i420 || (fourcc == GST_STR_FOURCC ("I420")); - got_yuy2 = got_yuy2 || (fourcc == GST_STR_FOURCC ("YUY2")); - got_yv12 = got_yv12 || (fourcc == GST_STR_FOURCC ("YV12")); - - fourcc_value = gst_value_list_get_value (format_value, 1); - fail_unless (fourcc_value != NULL); - fail_unless (GST_VALUE_HOLDS_FOURCC (fourcc_value)); - fourcc = gst_value_get_fourcc (fourcc_value); - fail_unless (fourcc != 0); - got_i420 = got_i420 || (fourcc == GST_STR_FOURCC ("I420")); - got_yuy2 = got_yuy2 || (fourcc == GST_STR_FOURCC ("YUY2")); - got_yv12 = got_yv12 || (fourcc == GST_STR_FOURCC ("YV12")); - - fourcc_value = gst_value_list_get_value (format_value, 2); - fail_unless (fourcc_value != NULL); - fail_unless (GST_VALUE_HOLDS_FOURCC (fourcc_value)); - fourcc = gst_value_get_fourcc (fourcc_value); - fail_unless (fourcc != 0); - got_i420 = got_i420 || (fourcc == GST_STR_FOURCC ("I420")); - got_yuy2 = got_yuy2 || (fourcc == GST_STR_FOURCC ("YUY2")); - got_yv12 = got_yv12 || (fourcc == GST_STR_FOURCC ("YV12")); - - return (got_i420 && got_yuy2 && got_yv12); -} - -GST_START_TEST (test_simplify) -{ - GstStructure *s1, *s2; - gboolean did_simplify; - GstCaps *caps; - - caps = gst_caps_from_string (non_simple_caps_string); - fail_unless (caps != NULL, - "gst_caps_from_string (non_simple_caps_string) failed"); - - did_simplify = gst_caps_do_simplify (caps); - fail_unless (did_simplify == TRUE, - "gst_caps_do_simplify() should have worked"); - - /* check simplified caps, should be: - * - * video/x-raw-rgb, bpp=(int)8, depth=(int)8, endianness=(int)1234, - * framerate=(fraction)[ 1/100, 100 ], width=(int)[ 16, 4096 ], - * height=(int)[ 16, 4096 ]; - * video/x-raw-yuv, format=(fourcc){ YV12, YUY2, I420 }, - * width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], - * framerate=(fraction)[ 1/100, 100 ] - */ - fail_unless (gst_caps_get_size (caps) == 2); - s1 = gst_caps_get_structure (caps, 0); - s2 = gst_caps_get_structure (caps, 1); - fail_unless (s1 != NULL); - fail_unless (s2 != NULL); - - if (!gst_structure_has_name (s1, "video/x-raw-rgb")) { - GstStructure *tmp; - - tmp = s1; - s1 = s2; - s2 = tmp; - } - - fail_unless (gst_structure_has_name (s1, "video/x-raw-rgb")); - { - const GValue *framerate_value; - const GValue *width_value; - const GValue *height_value; - const GValue *val_fps; - GValue test_fps = { 0, }; - gint bpp, depth, endianness; - gint min_width, max_width; - gint min_height, max_height; - - fail_unless (gst_structure_get_int (s1, "bpp", &bpp)); - fail_unless (bpp == 8); - - fail_unless (gst_structure_get_int (s1, "depth", &depth)); - fail_unless (depth == 8); - - fail_unless (gst_structure_get_int (s1, "endianness", &endianness)); - fail_unless (endianness == G_LITTLE_ENDIAN); - - g_value_init (&test_fps, GST_TYPE_FRACTION); - framerate_value = gst_structure_get_value (s1, "framerate"); - fail_unless (framerate_value != NULL); - fail_unless (GST_VALUE_HOLDS_FRACTION_RANGE (framerate_value)); - - val_fps = gst_value_get_fraction_range_min (framerate_value); - gst_value_set_fraction (&test_fps, 1, 100); - fail_unless (gst_value_compare (&test_fps, val_fps) == GST_VALUE_EQUAL); - - val_fps = gst_value_get_fraction_range_max (framerate_value); - gst_value_set_fraction (&test_fps, 100, 1); - fail_unless (gst_value_compare (&test_fps, val_fps) == GST_VALUE_EQUAL); - - g_value_unset (&test_fps); - - width_value = gst_structure_get_value (s1, "width"); - fail_unless (width_value != NULL); - fail_unless (GST_VALUE_HOLDS_INT_RANGE (width_value)); - min_width = gst_value_get_int_range_min (width_value); - max_width = gst_value_get_int_range_max (width_value); - fail_unless (min_width == 16 && max_width == 4096); - - height_value = gst_structure_get_value (s1, "height"); - fail_unless (height_value != NULL); - fail_unless (GST_VALUE_HOLDS_INT_RANGE (height_value)); - min_height = gst_value_get_int_range_min (height_value); - max_height = gst_value_get_int_range_max (height_value); - fail_unless (min_height == 16 && max_height == 4096); - } - - fail_unless (gst_structure_has_name (s2, "video/x-raw-yuv")); - { - const GValue *framerate_value; - const GValue *format_value; - const GValue *width_value; - const GValue *height_value; - const GValue *val_fps; - GValue test_fps = { 0, }; - gint min_width, max_width; - gint min_height, max_height; - - format_value = gst_structure_get_value (s2, "format"); - fail_unless (format_value != NULL); - fail_unless (GST_VALUE_HOLDS_LIST (format_value)); - fail_unless (gst_value_list_get_size (format_value) == 3); - fail_unless (check_fourcc_list (format_value) == TRUE); - - g_value_init (&test_fps, GST_TYPE_FRACTION); - framerate_value = gst_structure_get_value (s2, "framerate"); - fail_unless (framerate_value != NULL); - fail_unless (GST_VALUE_HOLDS_FRACTION_RANGE (framerate_value)); - - val_fps = gst_value_get_fraction_range_min (framerate_value); - gst_value_set_fraction (&test_fps, 1, 100); - fail_unless (gst_value_compare (&test_fps, val_fps) == GST_VALUE_EQUAL); - - val_fps = gst_value_get_fraction_range_max (framerate_value); - gst_value_set_fraction (&test_fps, 100, 1); - fail_unless (gst_value_compare (&test_fps, val_fps) == GST_VALUE_EQUAL); - - g_value_unset (&test_fps); - - width_value = gst_structure_get_value (s2, "width"); - fail_unless (width_value != NULL); - fail_unless (GST_VALUE_HOLDS_INT_RANGE (width_value)); - min_width = gst_value_get_int_range_min (width_value); - max_width = gst_value_get_int_range_max (width_value); - fail_unless (min_width == 16 && max_width == 4096); - - height_value = gst_structure_get_value (s2, "height"); - fail_unless (height_value != NULL); - fail_unless (GST_VALUE_HOLDS_INT_RANGE (height_value)); - min_height = gst_value_get_int_range_min (height_value); - max_height = gst_value_get_int_range_max (height_value); - fail_unless (min_height == 16 && max_height == 4096); - } - - gst_caps_unref (caps); -} - -GST_END_TEST; - -Suite * -gst_caps_suite (void) -{ - Suite *s = suite_create ("GstCaps"); - TCase *tc_chain = tcase_create ("mutability"); - - suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, test_from_string); - tcase_add_test (tc_chain, test_double_append); - tcase_add_test (tc_chain, test_mutability); - tcase_add_test (tc_chain, test_buffer); - tcase_add_test (tc_chain, test_static_caps); - tcase_add_test (tc_chain, test_simplify); - - return s; -} - -int -main (int argc, char **argv) -{ - int nf; - - Suite *s = gst_caps_suite (); - SRunner *sr = srunner_create (s); - - gst_check_init (&argc, &argv); - - srunner_run_all (sr, CK_NORMAL); - nf = srunner_ntests_failed (sr); - srunner_free (sr); - - return nf; -} diff --git a/check/gst/gstelement.c b/check/gst/gstelement.c deleted file mode 100644 index 8d00af9b9f..0000000000 --- a/check/gst/gstelement.c +++ /dev/null @@ -1,180 +0,0 @@ -/* GStreamer - * Copyright (C) 2005 Thomas Vander Stichele - * - * gstelement.c: Unit test for GstElement - * - * 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_START_TEST (test_add_remove_pad) -{ - GstElement *e; - GstPad *p; - - /* getting an existing element class is cheating, but easier */ - e = gst_element_factory_make ("fakesrc", "source"); - - /* create a new floating pad with refcount 1 */ - p = gst_pad_new ("source", GST_PAD_SRC); - ASSERT_OBJECT_REFCOUNT (p, "pad", 1); - /* ref it for ourselves */ - gst_object_ref (p); - ASSERT_OBJECT_REFCOUNT (p, "pad", 2); - /* adding it sinks the pad -> not floating, same refcount */ - gst_element_add_pad (e, p); - ASSERT_OBJECT_REFCOUNT (p, "pad", 2); - - /* removing it reduces the refcount */ - gst_element_remove_pad (e, p); - ASSERT_OBJECT_REFCOUNT (p, "pad", 1); - - /* clean up our own reference */ - gst_object_unref (p); -} - -GST_END_TEST; - -GST_START_TEST (test_add_pad_unref_element) -{ - GstElement *e; - GstPad *p; - - /* getting an existing element class is cheating, but easier */ - e = gst_element_factory_make ("fakesrc", "source"); - - /* create a new floating pad with refcount 1 */ - p = gst_pad_new ("source", GST_PAD_SRC); - ASSERT_OBJECT_REFCOUNT (p, "pad", 1); - /* ref it for ourselves */ - gst_object_ref (p); - ASSERT_OBJECT_REFCOUNT (p, "pad", 2); - /* adding it sinks the pad -> not floating, same refcount */ - gst_element_add_pad (e, p); - ASSERT_OBJECT_REFCOUNT (p, "pad", 2); - - /* unreffing the element should clean it up */ - gst_object_unref (GST_OBJECT (e)); - - ASSERT_OBJECT_REFCOUNT (p, "pad", 1); - - /* clean up our own reference */ - gst_object_unref (p); -} - -GST_END_TEST; - -GST_START_TEST (test_error_no_bus) -{ - GstElement *e; - - e = gst_element_factory_make ("fakesrc", "source"); - - /* I don't want errors shown */ - gst_debug_set_default_threshold (GST_LEVEL_NONE); - - GST_ELEMENT_ERROR (e, RESOURCE, OPEN_READ, ("I could not read"), ("debug")); - - gst_object_unref (e); -} - -GST_END_TEST; - -/* link and run two elements without putting them in a pipeline */ -GST_START_TEST (test_link) -{ - GstElement *src, *sink; - - src = gst_element_factory_make ("fakesrc", "source"); - sink = gst_element_factory_make ("fakesink", "sink"); - - fail_unless (gst_element_link_pads (src, "src", sink, "sink")); - - /* do sink to source state change */ - gst_element_set_state (sink, GST_STATE_PAUSED); - gst_element_set_state (src, GST_STATE_PAUSED); - - /* wait for preroll */ - gst_element_get_state (sink, NULL, NULL, GST_CLOCK_TIME_NONE); - - /* play some more */ - gst_element_set_state (sink, GST_STATE_PLAYING); - gst_element_set_state (src, GST_STATE_PLAYING); - - g_usleep (G_USEC_PER_SEC); - - /* and stop */ - gst_element_set_state (sink, GST_STATE_PAUSED); - gst_element_set_state (src, GST_STATE_PAUSED); - - /* wait for preroll */ - gst_element_get_state (sink, NULL, NULL, GST_CLOCK_TIME_NONE); - - gst_element_set_state (sink, GST_STATE_NULL); - gst_element_set_state (src, GST_STATE_NULL); -} - -GST_END_TEST; - -/* linking two elements without pads should fail */ -GST_START_TEST (test_link_no_pads) -{ - GstElement *src, *sink; - - src = gst_bin_new ("src"); - sink = gst_bin_new ("sink"); - - fail_if (gst_element_link (src, sink)); - - gst_object_unref (src); - gst_object_unref (sink); -} - -GST_END_TEST; - -Suite * -gst_element_suite (void) -{ - Suite *s = suite_create ("GstElement"); - TCase *tc_chain = tcase_create ("element tests"); - - suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, test_add_remove_pad); - tcase_add_test (tc_chain, test_add_pad_unref_element); - tcase_add_test (tc_chain, test_error_no_bus); - tcase_add_test (tc_chain, test_link); - tcase_add_test (tc_chain, test_link_no_pads); - - return s; -} - -int -main (int argc, char **argv) -{ - int nf; - - Suite *s = gst_element_suite (); - SRunner *sr = srunner_create (s); - - gst_check_init (&argc, &argv); - - srunner_run_all (sr, CK_NORMAL); - nf = srunner_ntests_failed (sr); - srunner_free (sr); - - return nf; -} diff --git a/check/gst/gstevent.c b/check/gst/gstevent.c deleted file mode 100644 index 6cc792cb5b..0000000000 --- a/check/gst/gstevent.c +++ /dev/null @@ -1,416 +0,0 @@ -/* GStreamer - * Copyright (C) 2005 Jan Schmidt - * - * gstevent.c: Unit test for event handling - * - * 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_START_TEST (create_custom_events) -{ - GstEvent *event, *event2; - GstStructure *structure; - - /* FLUSH_START */ - { - event = gst_event_new_flush_start (); - fail_if (event == NULL); - fail_unless (GST_EVENT_TYPE (event) == GST_EVENT_FLUSH_START); - fail_unless (GST_EVENT_IS_UPSTREAM (event)); - fail_unless (GST_EVENT_IS_DOWNSTREAM (event)); - fail_if (GST_EVENT_IS_SERIALIZED (event)); - gst_event_unref (event); - } - /* FLUSH_STOP */ - { - event = gst_event_new_flush_stop (); - fail_if (event == NULL); - fail_unless (GST_EVENT_TYPE (event) == GST_EVENT_FLUSH_STOP); - fail_unless (GST_EVENT_IS_UPSTREAM (event)); - fail_unless (GST_EVENT_IS_DOWNSTREAM (event)); - fail_unless (GST_EVENT_IS_SERIALIZED (event)); - gst_event_unref (event); - } - /* EOS */ - { - event = gst_event_new_eos (); - fail_if (event == NULL); - fail_unless (GST_EVENT_TYPE (event) == GST_EVENT_EOS); - fail_if (GST_EVENT_IS_UPSTREAM (event)); - fail_unless (GST_EVENT_IS_DOWNSTREAM (event)); - fail_unless (GST_EVENT_IS_SERIALIZED (event)); - gst_event_unref (event); - } - /* NEWSEGMENT */ - { - gdouble rate; - GstFormat format; - gint64 start, end, base; - gboolean update; - - event = - gst_event_new_new_segment (FALSE, 0.5, GST_FORMAT_TIME, 1, G_MAXINT64, - 0xdeadbeef); - fail_if (event == NULL); - fail_unless (GST_EVENT_TYPE (event) == GST_EVENT_NEWSEGMENT); - fail_if (GST_EVENT_IS_UPSTREAM (event)); - fail_unless (GST_EVENT_IS_DOWNSTREAM (event)); - fail_unless (GST_EVENT_IS_SERIALIZED (event)); - - gst_event_parse_new_segment (event, &update, &rate, &format, &start, &end, - &base); - fail_unless (update == FALSE); - fail_unless (rate == 0.5); - fail_unless (format == GST_FORMAT_TIME); - fail_unless (start == 1); - fail_unless (end == G_MAXINT64); - fail_unless (base == 0xdeadbeef); - - gst_event_unref (event); - } - /* TAGS */ - { - GstTagList *taglist = gst_tag_list_new (); - GstTagList *tl2 = NULL; - - event = gst_event_new_tag (taglist); - fail_if (taglist == NULL); - fail_if (event == NULL); - fail_unless (GST_EVENT_TYPE (event) == GST_EVENT_TAG); - fail_if (GST_EVENT_IS_UPSTREAM (event)); - fail_unless (GST_EVENT_IS_DOWNSTREAM (event)); - fail_unless (GST_EVENT_IS_SERIALIZED (event)); - - gst_event_parse_tag (event, &tl2); - fail_unless (taglist == tl2); - gst_event_unref (event); - } - - /* FIXME: Add tests for QOS when it is implemented. */ - - /* SEEK */ - { - gdouble rate; - GstFormat format; - GstSeekFlags flags; - GstSeekType cur_type, stop_type; - gint64 cur, stop; - - event = gst_event_new_seek (0.5, GST_FORMAT_BYTES, - GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE, - GST_SEEK_TYPE_SET, 1, GST_SEEK_TYPE_NONE, 0xdeadbeef); - - fail_if (event == NULL); - fail_unless (GST_EVENT_TYPE (event) == GST_EVENT_SEEK); - fail_unless (GST_EVENT_IS_UPSTREAM (event)); - fail_if (GST_EVENT_IS_DOWNSTREAM (event)); - fail_if (GST_EVENT_IS_SERIALIZED (event)); - - gst_event_parse_seek (event, &rate, &format, &flags, &cur_type, &cur, - &stop_type, &stop); - fail_unless (rate == 0.5); - fail_unless (format == GST_FORMAT_BYTES); - fail_unless (flags == (GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE)); - fail_unless (cur_type == GST_SEEK_TYPE_SET); - fail_unless (cur == 1); - fail_unless (stop_type == GST_SEEK_TYPE_NONE); - fail_unless (stop == 0xdeadbeef); - - gst_event_unref (event); - } - - /* NAVIGATION */ - { - structure = gst_structure_new ("application/x-gst-navigation", "event", - G_TYPE_STRING, "key-press", "key", G_TYPE_STRING, "mon", NULL); - fail_if (structure == NULL); - event = gst_event_new_navigation (structure); - fail_if (event == NULL); - fail_unless (GST_EVENT_TYPE (event) == GST_EVENT_NAVIGATION); - fail_unless (GST_EVENT_IS_UPSTREAM (event)); - fail_if (GST_EVENT_IS_DOWNSTREAM (event)); - fail_if (GST_EVENT_IS_SERIALIZED (event)); - - fail_unless (gst_event_get_structure (event) == structure); - gst_event_unref (event); - } - - /* Custom event types */ - { - structure = gst_structure_empty_new ("application/x-custom"); - fail_if (structure == NULL); - event = gst_event_new_custom (GST_EVENT_CUSTOM_UPSTREAM, structure); - fail_if (event == NULL); - fail_unless (GST_EVENT_TYPE (event) == GST_EVENT_CUSTOM_UPSTREAM); - fail_unless (GST_EVENT_IS_UPSTREAM (event)); - fail_if (GST_EVENT_IS_DOWNSTREAM (event)); - fail_if (GST_EVENT_IS_SERIALIZED (event)); - fail_unless (gst_event_get_structure (event) == structure); - gst_event_unref (event); - - /* Decided not to test the other custom enum types, as they - * only differ by the value of the enum passed to gst_event_new_custom - */ - } - - /* Event copying */ - { - structure = gst_structure_empty_new ("application/x-custom"); - fail_if (structure == NULL); - event = gst_event_new_custom (GST_EVENT_CUSTOM_BOTH, structure); - - fail_if (event == NULL); - event2 = gst_event_copy (event); - fail_if (event2 == NULL); - fail_unless (GST_EVENT_TYPE (event) == GST_EVENT_TYPE (event2)); - - /* The structure should have been duplicated */ - fail_if (gst_event_get_structure (event) == - gst_event_get_structure (event2)); - gst_event_unref (event); - gst_event_unref (event2); - } -} - -GST_END_TEST; - -GTimeVal sent_event_time; -GstEvent *got_event_before_q, *got_event_after_q; -GTimeVal got_event_time; - -static gboolean -event_probe (GstPad * pad, GstMiniObject ** data, gpointer user_data) -{ - gboolean before_q = (gboolean) GPOINTER_TO_INT (user_data); - - fail_unless (GST_IS_EVENT (data)); - - if (before_q) { - switch (GST_EVENT_TYPE (GST_EVENT (data))) { - case GST_EVENT_CUSTOM_UPSTREAM: - case GST_EVENT_CUSTOM_BOTH: - case GST_EVENT_CUSTOM_BOTH_OOB: - if (got_event_before_q != NULL) - break; - gst_event_ref (data); - g_get_current_time (&got_event_time); - got_event_before_q = GST_EVENT (data); - break; - default: - break; - } - } else { - switch (GST_EVENT_TYPE (GST_EVENT (data))) { - case GST_EVENT_CUSTOM_DOWNSTREAM: - case GST_EVENT_CUSTOM_DOWNSTREAM_OOB: - case GST_EVENT_CUSTOM_BOTH: - case GST_EVENT_CUSTOM_BOTH_OOB: - if (got_event_after_q != NULL) - break; - gst_event_ref (data); - g_get_current_time (&got_event_time); - got_event_after_q = GST_EVENT (data); - break; - default: - break; - } - } - - return TRUE; -} - -static void test_event - (GstBin * pipeline, GstEventType type, GstPad * pad, - gboolean expect_before_q, GstPad * fake_srcpad) -{ - GstEvent *event; - gint i; - - got_event_before_q = got_event_after_q = NULL; - - gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING); - gst_element_get_state (GST_ELEMENT (pipeline), NULL, NULL, - GST_CLOCK_TIME_NONE); - - event = gst_event_new_custom (type, - gst_structure_empty_new ("application/x-custom")); - g_get_current_time (&sent_event_time); - got_event_time.tv_sec = 0; - got_event_time.tv_usec = 0; - - fail_unless (gst_pad_set_blocked (fake_srcpad, TRUE) == TRUE); - gst_pad_push_event (pad, event); - fail_unless (gst_pad_set_blocked (fake_srcpad, FALSE) == TRUE); - - /* Wait up to 5 seconds for the event to appear */ - if (expect_before_q) { - for (i = 0; i < 500; i++) { - g_usleep (G_USEC_PER_SEC / 100); - if (got_event_before_q != NULL) - break; - } - fail_if (got_event_before_q == NULL); - fail_unless (GST_EVENT_TYPE (got_event_before_q) == type); - } else { - for (i = 0; i < 500; i++) { - g_usleep (G_USEC_PER_SEC / 100); - if (got_event_after_q != NULL) - break; - } - fail_if (got_event_after_q == NULL); - fail_unless (GST_EVENT_TYPE (got_event_after_q) == type); - } - - gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PAUSED); - gst_element_get_state (GST_ELEMENT (pipeline), NULL, NULL, - GST_CLOCK_TIME_NONE); - - if (got_event_before_q) - gst_event_unref (got_event_before_q); - if (got_event_after_q) - gst_event_unref (got_event_after_q); - - got_event_before_q = got_event_after_q = NULL; -} - -static gint64 -timediff (GTimeVal * end, GTimeVal * start) -{ - return (end->tv_sec - start->tv_sec) * G_USEC_PER_SEC + - (end->tv_usec - start->tv_usec); -} - -GST_START_TEST (send_custom_events) -{ - /* Run some tests on custom events. Checking for serialisation and whatnot. - * pipeline is fakesrc ! queue ! fakesink */ - GstBin *pipeline; - GstElement *fakesrc, *fakesink, *queue; - GstPad *srcpad, *sinkpad; - - fail_if ((pipeline = (GstBin *) gst_pipeline_new ("testpipe")) == NULL); - fail_if ((fakesrc = gst_element_factory_make ("fakesrc", NULL)) == NULL); - fail_if ((fakesink = gst_element_factory_make ("fakesink", NULL)) == NULL); - fail_if ((queue = gst_element_factory_make ("queue", NULL)) == NULL); - - gst_bin_add_many (pipeline, fakesrc, queue, fakesink, NULL); - fail_unless (gst_element_link_many (fakesrc, queue, fakesink, NULL)); - - g_object_set (G_OBJECT (fakesink), "sync", FALSE, NULL); - - /* Send 100 buffers per sec */ - g_object_set (G_OBJECT (fakesrc), "silent", TRUE, "datarate", 100, - "sizemax", 1, "sizetype", 2, NULL); - g_object_set (G_OBJECT (queue), "max-size-buffers", 0, "max-size-time", - (guint64) GST_SECOND, "max-size-bytes", 0, NULL); - g_object_set (G_OBJECT (fakesink), "silent", TRUE, "sync", TRUE, NULL); - - fail_if ((srcpad = gst_element_get_pad (fakesrc, "src")) == NULL); - gst_pad_add_event_probe (srcpad, (GCallback) event_probe, - GINT_TO_POINTER (TRUE)); - - fail_if ((sinkpad = gst_element_get_pad (fakesink, "sink")) == NULL); - gst_pad_add_event_probe (sinkpad, (GCallback) event_probe, - GINT_TO_POINTER (FALSE)); - - /* Upstream events */ - test_event (pipeline, GST_EVENT_CUSTOM_UPSTREAM, sinkpad, TRUE, srcpad); - fail_unless (timediff (&got_event_time, - &sent_event_time) < G_USEC_PER_SEC / 2, - "GST_EVENT_CUSTOM_UP took to long to reach source: %" - G_GINT64_FORMAT " us", timediff (&got_event_time, &sent_event_time)); - - test_event (pipeline, GST_EVENT_CUSTOM_BOTH, sinkpad, TRUE, srcpad); - fail_unless (timediff (&got_event_time, - &sent_event_time) < G_USEC_PER_SEC / 2, - "GST_EVENT_CUSTOM_BOTH took to long to reach source: %" - G_GINT64_FORMAT " us", timediff (&got_event_time, &sent_event_time)); - - test_event (pipeline, GST_EVENT_CUSTOM_BOTH_OOB, sinkpad, TRUE, srcpad); - fail_unless (timediff (&got_event_time, - &sent_event_time) < G_USEC_PER_SEC / 2, - "GST_EVENT_CUSTOM_BOTH_OOB took to long to reach source: %" - G_GINT64_FORMAT " us", timediff (&got_event_time, &sent_event_time)); - - /* Out of band downstream events */ - test_event (pipeline, GST_EVENT_CUSTOM_DOWNSTREAM_OOB, srcpad, FALSE, srcpad); - fail_unless (timediff (&got_event_time, - &sent_event_time) < G_USEC_PER_SEC / 2, - "GST_EVENT_CUSTOM_DS_OOB took to long to reach source: %" - G_GINT64_FORMAT " us", timediff (&got_event_time, &sent_event_time)); - - test_event (pipeline, GST_EVENT_CUSTOM_BOTH_OOB, srcpad, FALSE, srcpad); - fail_unless (timediff (&got_event_time, - &sent_event_time) < G_USEC_PER_SEC / 2, - "GST_EVENT_CUSTOM_BOTH_OOB took to long to reach source: %" - G_GINT64_FORMAT " us", timediff (&got_event_time, &sent_event_time)); - - /* In-band downstream events are expected to take at least 1 second - * to traverse the the queue */ - test_event (pipeline, GST_EVENT_CUSTOM_DOWNSTREAM, srcpad, FALSE, srcpad); - fail_unless (timediff (&got_event_time, - &sent_event_time) >= G_USEC_PER_SEC / 2, - "GST_EVENT_CUSTOM_DS arrived too quickly for an in-band event: %" - G_GINT64_FORMAT " us", timediff (&got_event_time, &sent_event_time)); - - test_event (pipeline, GST_EVENT_CUSTOM_BOTH, srcpad, FALSE, srcpad); - fail_unless (timediff (&got_event_time, - &sent_event_time) >= G_USEC_PER_SEC / 2, - "GST_EVENT_CUSTOM_BOTH arrived too quickly for an in-band event: %" - G_GINT64_FORMAT " us", timediff (&got_event_time, &sent_event_time)); - - gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL); - gst_element_get_state (GST_ELEMENT (pipeline), NULL, NULL, - GST_CLOCK_TIME_NONE); - - gst_object_unref (pipeline); -} - -GST_END_TEST; - -Suite * -gstevents_suite (void) -{ - Suite *s = suite_create ("GstEvent"); - TCase *tc_chain = tcase_create ("customevents"); - - tcase_set_timeout (tc_chain, 20); - - suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, create_custom_events); - tcase_add_test (tc_chain, send_custom_events); - return s; -} - -int -main (int argc, char **argv) -{ - int nf; - - Suite *s = gstevents_suite (); - SRunner *sr = srunner_create (s); - - gst_check_init (&argc, &argv); - - srunner_run_all (sr, CK_NORMAL); - nf = srunner_ntests_failed (sr); - srunner_free (sr); - - return nf; -} diff --git a/check/gst/gstghostpad.c b/check/gst/gstghostpad.c deleted file mode 100644 index 6dec9014b1..0000000000 --- a/check/gst/gstghostpad.c +++ /dev/null @@ -1,362 +0,0 @@ -/* GStreamer - * Copyright (C) 2005 Wim Taymans - * - * gstghostpad.c: Unit test for GstGhostPad - * - * 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 - -/* test if removing a bin also cleans up the ghostpads - */ -GST_START_TEST (test_remove1) -{ - GstElement *b1, *b2, *src, *sink; - GstPad *srcpad, *sinkpad; - GstPadLinkReturn ret; - - b1 = gst_element_factory_make ("pipeline", NULL); - b2 = gst_element_factory_make ("bin", NULL); - src = gst_element_factory_make ("fakesrc", NULL); - sink = gst_element_factory_make ("fakesink", NULL); - - fail_unless (gst_bin_add (GST_BIN (b2), sink)); - fail_unless (gst_bin_add (GST_BIN (b1), src)); - fail_unless (gst_bin_add (GST_BIN (b1), b2)); - - sinkpad = gst_element_get_pad (sink, "sink"); - gst_element_add_pad (b2, gst_ghost_pad_new ("sink", sinkpad)); - gst_object_unref (sinkpad); - - srcpad = gst_element_get_pad (src, "src"); - /* get the ghostpad */ - sinkpad = gst_element_get_pad (b2, "sink"); - - ret = gst_pad_link (srcpad, sinkpad); - fail_unless (ret == GST_PAD_LINK_OK); - gst_object_unref (srcpad); - gst_object_unref (sinkpad); - - /* now remove the bin with the ghostpad, b2 is disposed - * now. */ - gst_bin_remove (GST_BIN (b1), b2); - - srcpad = gst_element_get_pad (src, "src"); - /* pad cannot be linked now */ - fail_if (gst_pad_is_linked (srcpad)); -} - -GST_END_TEST; - -/* test if removing a bin also cleans up the ghostpads - */ -GST_START_TEST (test_remove2) -{ - GstElement *b1, *b2, *src, *sink; - GstPad *srcpad, *sinkpad; - GstPadLinkReturn ret; - - b1 = gst_element_factory_make ("pipeline", NULL); - b2 = gst_element_factory_make ("bin", NULL); - src = gst_element_factory_make ("fakesrc", NULL); - sink = gst_element_factory_make ("fakesink", NULL); - - fail_unless (gst_bin_add (GST_BIN (b2), sink)); - fail_unless (gst_bin_add (GST_BIN (b1), src)); - fail_unless (gst_bin_add (GST_BIN (b1), b2)); - - sinkpad = gst_element_get_pad (sink, "sink"); - gst_element_add_pad (b2, gst_ghost_pad_new ("sink", sinkpad)); - gst_object_unref (sinkpad); - - srcpad = gst_element_get_pad (src, "src"); - /* get the ghostpad */ - sinkpad = gst_element_get_pad (b2, "sink"); - - ret = gst_pad_link (srcpad, sinkpad); - fail_unless (ret == GST_PAD_LINK_OK); - gst_object_unref (srcpad); - gst_object_unref (sinkpad); - - /* now remove the sink from the bin */ - gst_bin_remove (GST_BIN (b2), sink); - - srcpad = gst_element_get_pad (src, "src"); - /* pad is still linked to ghostpad */ - fail_if (!gst_pad_is_linked (srcpad)); -} - -GST_END_TEST; - -#if 0 -/* test if a ghost pad without a target can be linked - * It can't because it has incompatible caps... - */ -GST_START_TEST (test_ghost_pad_notarget) -{ - GstElement *b1, *b2, *sink; - GstPad *srcpad, *sinkpad; - GstPadLinkReturn ret; - - b1 = gst_element_factory_make ("pipeline", NULL); - b2 = gst_element_factory_make ("bin", NULL); - sink = gst_element_factory_make ("fakesink", NULL); - - fail_unless (gst_bin_add (GST_BIN (b1), sink)); - fail_unless (gst_bin_add (GST_BIN (b1), b2)); - - srcpad = gst_ghost_pad_new_no_target ("src", GST_PAD_SRC); - fail_unless (srcpad != NULL); - sinkpad = gst_element_get_pad (sink, "sink"); - fail_unless (sinkpad != NULL); - - ret = gst_pad_link (srcpad, sinkpad); - fail_unless (ret == GST_PAD_LINK_OK); -} - -GST_END_TEST; -#endif - -/* test if linking fails over different bins using a pipeline - * like this: - * - * fakesrc num_buffers=10 ! ( fakesink ) - * - */ -GST_START_TEST (test_link) -{ - GstElement *b1, *b2, *src, *sink; - GstPad *srcpad, *sinkpad, *gpad; - GstPadLinkReturn ret; - - b1 = gst_element_factory_make ("pipeline", NULL); - b2 = gst_element_factory_make ("bin", NULL); - src = gst_element_factory_make ("fakesrc", NULL); - sink = gst_element_factory_make ("fakesink", NULL); - - fail_unless (gst_bin_add (GST_BIN (b2), sink)); - fail_unless (gst_bin_add (GST_BIN (b1), src)); - fail_unless (gst_bin_add (GST_BIN (b1), b2)); - - srcpad = gst_element_get_pad (src, "src"); - fail_unless (srcpad != NULL); - sinkpad = gst_element_get_pad (sink, "sink"); - fail_unless (sinkpad != NULL); - - /* linking in different hierarchies should fail */ - ret = gst_pad_link (srcpad, sinkpad); - fail_unless (ret == GST_PAD_LINK_WRONG_HIERARCHY); - - /* now setup a ghostpad */ - gpad = gst_ghost_pad_new ("sink", sinkpad); - gst_object_unref (sinkpad); - /* need to ref as _add_pad takes ownership */ - gst_object_ref (gpad); - gst_element_add_pad (b2, gpad); - - /* our new sinkpad */ - sinkpad = gpad; - - /* and linking should work now */ - ret = gst_pad_link (srcpad, sinkpad); - fail_unless (ret == GST_PAD_LINK_OK); -} - -GST_END_TEST; - -/* test if ghostpads are created automagically when using - * gst_element_link_pads. - * - * fakesrc num_buffers=10 ! ( identity ) ! fakesink - */ -GST_START_TEST (test_ghost_pads) -{ - GstElement *b1, *b2, *src, *i1, *sink; - GstPad *gsink, *gsrc, *gisrc, *gisink, *isink, *isrc, *fsrc, *fsink; - GstStateChangeReturn ret; - - b1 = gst_element_factory_make ("pipeline", NULL); - b2 = gst_element_factory_make ("bin", NULL); - src = gst_element_factory_make ("fakesrc", NULL); - g_object_set (src, "num-buffers", (int) 10, NULL); - i1 = gst_element_factory_make ("identity", NULL); - sink = gst_element_factory_make ("fakesink", NULL); - - fail_unless (gst_bin_add (GST_BIN (b2), i1)); - fail_unless (gst_bin_add (GST_BIN (b1), src)); - fail_unless (gst_bin_add (GST_BIN (b1), b2)); - fail_unless (gst_bin_add (GST_BIN (b1), sink)); - fail_unless (gst_element_link_pads (src, NULL, i1, NULL)); - fail_unless (gst_element_link_pads (i1, NULL, sink, NULL)); - GST_OBJECT_LOCK (b2); - fail_unless (b2->numsinkpads == 1); - fail_unless (GST_IS_GHOST_PAD (b2->sinkpads->data)); - fail_unless (b2->numsrcpads == 1); - fail_unless (GST_IS_GHOST_PAD (b2->srcpads->data)); - GST_OBJECT_UNLOCK (b2); - - fsrc = gst_element_get_pad (src, "src"); - fail_unless (fsrc != NULL); - gsink = GST_PAD (gst_object_ref (b2->sinkpads->data)); - fail_unless (gsink != NULL); - gsrc = GST_PAD (gst_object_ref (b2->srcpads->data)); - fail_unless (gsrc != NULL); - fsink = gst_element_get_pad (sink, "sink"); - fail_unless (fsink != NULL); - - isink = gst_element_get_pad (i1, "sink"); - fail_unless (isink != NULL); - isrc = gst_element_get_pad (i1, "src"); - fail_unless (isrc != NULL); - gisrc = gst_pad_get_peer (isink); - fail_unless (gisrc != NULL); - gisink = gst_pad_get_peer (isrc); - fail_unless (gisink != NULL); - - /* all objects above have one refcount owned by us as well */ - - ASSERT_OBJECT_REFCOUNT (fsrc, "fsrc", 3); /* parent and gisrc */ - ASSERT_OBJECT_REFCOUNT (gsink, "gsink", 2); /* parent */ - ASSERT_OBJECT_REFCOUNT (gsrc, "gsrc", 2); /* parent */ - ASSERT_OBJECT_REFCOUNT (fsink, "fsink", 3); /* parent and gisink */ - - ASSERT_OBJECT_REFCOUNT (gisrc, "gisrc", 2); /* parent */ - ASSERT_OBJECT_REFCOUNT (isink, "isink", 3); /* parent and gsink */ - ASSERT_OBJECT_REFCOUNT (gisink, "gisink", 2); /* parent */ - ASSERT_OBJECT_REFCOUNT (isrc, "isrc", 3); /* parent and gsrc */ - - ret = gst_element_set_state (b1, GST_STATE_PLAYING); - ret = gst_element_get_state (b1, NULL, NULL, GST_CLOCK_TIME_NONE); - fail_unless (ret == GST_STATE_CHANGE_SUCCESS); - - ret = gst_element_set_state (b1, GST_STATE_NULL); - ret = gst_element_get_state (b1, NULL, NULL, GST_CLOCK_TIME_NONE); - fail_unless (ret == GST_STATE_CHANGE_SUCCESS); - - gst_object_unref (b1); - /* unreffing the bin will unref all elements, which will unlink and unparent - * all pads */ - - /* wait for thread to settle down */ - while (GST_OBJECT_REFCOUNT_VALUE (fsrc) > 2) - THREAD_SWITCH (); - - ASSERT_OBJECT_REFCOUNT (fsrc, "fsrc", 2); /* gisrc */ - ASSERT_OBJECT_REFCOUNT (gsink, "gsink", 1); - ASSERT_OBJECT_REFCOUNT (gsrc, "gsink", 1); - ASSERT_OBJECT_REFCOUNT (fsink, "fsink", 2); /* gisink */ - - ASSERT_OBJECT_REFCOUNT (gisrc, "gisrc", 1); /* gsink */ - ASSERT_OBJECT_REFCOUNT (isink, "isink", 2); /* gsink */ - ASSERT_OBJECT_REFCOUNT (gisink, "gisink", 1); /* gsrc */ - ASSERT_OBJECT_REFCOUNT (isrc, "isrc", 2); /* gsrc */ - - gst_object_unref (gsink); - ASSERT_OBJECT_REFCOUNT (isink, "isink", 1); - ASSERT_OBJECT_REFCOUNT (gisrc, "gisrc", 1); - ASSERT_OBJECT_REFCOUNT (fsrc, "fsrc", 2); /* gisrc */ - gst_object_unref (gisrc); - ASSERT_OBJECT_REFCOUNT (fsrc, "fsrc", 1); - - gst_object_unref (gsrc); - ASSERT_OBJECT_REFCOUNT (isrc, "isrc", 1); - ASSERT_OBJECT_REFCOUNT (gisink, "gisink", 1); - ASSERT_OBJECT_REFCOUNT (fsink, "fsink", 2); /* gisrc */ - gst_object_unref (gisink); - ASSERT_OBJECT_REFCOUNT (fsink, "fsink", 1); - - gst_object_unref (fsrc); - gst_object_unref (isrc); - gst_object_unref (isink); - gst_object_unref (fsink); -} - -GST_END_TEST; - -GST_START_TEST (test_ghost_pads_bin) -{ - GstBin *pipeline; - GstBin *srcbin; - GstBin *sinkbin; - GstElement *src; - GstElement *sink; - GstPad *srcghost; - GstPad *sinkghost; - - pipeline = GST_BIN (gst_pipeline_new ("pipe")); - - srcbin = GST_BIN (gst_bin_new ("srcbin")); - gst_bin_add (pipeline, GST_ELEMENT (srcbin)); - - sinkbin = GST_BIN (gst_bin_new ("sinkbin")); - gst_bin_add (pipeline, GST_ELEMENT (sinkbin)); - - src = gst_element_factory_make ("fakesrc", "src"); - gst_bin_add (srcbin, src); - srcghost = gst_ghost_pad_new ("src", gst_element_get_pad (src, "src")); - gst_element_add_pad (GST_ELEMENT (srcbin), srcghost); - - sink = gst_element_factory_make ("fakesink", "sink"); - gst_bin_add (sinkbin, sink); - sinkghost = gst_ghost_pad_new ("sink", gst_element_get_pad (sink, "sink")); - gst_element_add_pad (GST_ELEMENT (sinkbin), sinkghost); - - gst_element_link (GST_ELEMENT (srcbin), GST_ELEMENT (sinkbin)); - - fail_unless (GST_PAD_PEER (srcghost) != NULL); - fail_unless (GST_PAD_PEER (sinkghost) != NULL); - fail_unless (GST_PAD_PEER (gst_ghost_pad_get_target (GST_GHOST_PAD - (srcghost))) != NULL); - fail_unless (GST_PAD_PEER (gst_ghost_pad_get_target (GST_GHOST_PAD - (sinkghost))) != NULL); -} - -GST_END_TEST; - -Suite * -gst_ghost_pad_suite (void) -{ - Suite *s = suite_create ("GstGhostPad"); - TCase *tc_chain = tcase_create ("ghost pad tests"); - - suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, test_remove1); - tcase_add_test (tc_chain, test_remove2); - tcase_add_test (tc_chain, test_link); - tcase_add_test (tc_chain, test_ghost_pads); - tcase_add_test (tc_chain, test_ghost_pads_bin); -/* tcase_add_test (tc_chain, test_ghost_pad_notarget); */ - - return s; -} - -int -main (int argc, char **argv) -{ - int nf; - - Suite *s = gst_ghost_pad_suite (); - SRunner *sr = srunner_create (s); - - gst_check_init (&argc, &argv); - - srunner_run_all (sr, CK_NORMAL); - nf = srunner_ntests_failed (sr); - srunner_free (sr); - - return nf; -} diff --git a/check/gst/gstiterator.c b/check/gst/gstiterator.c deleted file mode 100644 index 369d39c34a..0000000000 --- a/check/gst/gstiterator.c +++ /dev/null @@ -1,197 +0,0 @@ -/* GStreamer - * Copyright (C) 2005 Andy Wingo - * - * gstiterator.c: Unit test for iterators - * - * 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 GList * -make_list_of_ints (gint n) -{ - GList *ret = NULL; - gint i; - - for (i = 0; i < n; i++) - ret = g_list_prepend (ret, GINT_TO_POINTER (i)); - - return g_list_reverse (ret); -} - -#define NUM_ELEMENTS 10 - -GST_START_TEST (test_manual_iteration) -{ - GList *l; - guint32 cookie = 0; - GMutex *m; - GstIterator *iter; - GstIteratorResult res; - gpointer item; - gint i = 0; - - l = make_list_of_ints (NUM_ELEMENTS); - m = g_mutex_new (); - - iter = gst_iterator_new_list (G_TYPE_INT, m, &cookie, &l, NULL, NULL, NULL); - - fail_unless (iter != NULL); - - while (1) { - res = gst_iterator_next (iter, &item); - if (i < NUM_ELEMENTS) { - fail_unless (res == GST_ITERATOR_OK); - fail_unless (GPOINTER_TO_INT (item) == i); - i++; - continue; - } else { - fail_unless (res == GST_ITERATOR_DONE); - break; - } - } - - /* clean up */ - gst_iterator_free (iter); - g_mutex_free (m); -} - -GST_END_TEST; - -GST_START_TEST (test_resync) -{ - GList *l; - guint32 cookie = 0; - GMutex *m; - GstIterator *iter; - GstIteratorResult res; - gpointer item; - gint i = 0; - gboolean hacked_list = FALSE; - - l = make_list_of_ints (NUM_ELEMENTS); - m = g_mutex_new (); - - iter = gst_iterator_new_list (G_TYPE_INT, m, &cookie, &l, NULL, NULL, NULL); - - fail_unless (iter != NULL); - - while (1) { - res = gst_iterator_next (iter, &item); - if (i < NUM_ELEMENTS / 2) { - fail_unless (res == GST_ITERATOR_OK); - fail_unless (GPOINTER_TO_INT (item) == i); - i++; - continue; - } else if (!hacked_list) { - /* here's where we test resync */ - fail_unless (res == GST_ITERATOR_OK); - l = g_list_prepend (l, GINT_TO_POINTER (-1)); - cookie++; - hacked_list = TRUE; - continue; - } else { - fail_unless (res == GST_ITERATOR_RESYNC); - gst_iterator_resync (iter); - res = gst_iterator_next (iter, &item); - fail_unless (res == GST_ITERATOR_OK); - fail_unless (GPOINTER_TO_INT (item) == -1); - break; - } - } - - /* clean up */ - gst_iterator_free (iter); - g_mutex_free (m); -} - -GST_END_TEST; - -static gboolean -add_fold_func (gpointer item, GValue * ret, gpointer user_data) -{ - g_value_set_int (ret, g_value_get_int (ret) + GPOINTER_TO_INT (item)); - return TRUE; -} - -GST_START_TEST (test_fold) -{ - GList *l; - guint32 cookie = 0; - GMutex *m; - GstIterator *iter; - GstIteratorResult res; - gint i, expected; - GValue ret = { 0, }; - - l = make_list_of_ints (NUM_ELEMENTS); - m = g_mutex_new (); - iter = gst_iterator_new_list (G_TYPE_INT, m, &cookie, &l, NULL, NULL, NULL); - fail_unless (iter != NULL); - - expected = 0; - for (i = 0; i < NUM_ELEMENTS; i++) - expected += i; - - g_value_init (&ret, G_TYPE_INT); - g_value_set_int (&ret, 0); - - res = gst_iterator_fold (iter, add_fold_func, &ret, NULL); - - fail_unless (res == GST_ITERATOR_DONE); - fail_unless (g_value_get_int (&ret) == expected); - - /* clean up */ - gst_iterator_free (iter); - g_mutex_free (m); -} - -GST_END_TEST; - -Suite * -gstiterator_suite (void) -{ - Suite *s = suite_create ("GstIterator"); - TCase *tc_chain = tcase_create ("correctness"); - - tcase_set_timeout (tc_chain, 0); - - suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, test_manual_iteration); - tcase_add_test (tc_chain, test_resync); - tcase_add_test (tc_chain, test_fold); - return s; -} - -int -main (int argc, char **argv) -{ - int nf; - - Suite *s = gstiterator_suite (); - SRunner *sr = srunner_create (s); - - gst_check_init (&argc, &argv); - - srunner_run_all (sr, CK_NORMAL); - nf = srunner_ntests_failed (sr); - srunner_free (sr); - - return nf; -} diff --git a/check/gst/gstmessage.c b/check/gst/gstmessage.c deleted file mode 100644 index a96711340e..0000000000 --- a/check/gst/gstmessage.c +++ /dev/null @@ -1,220 +0,0 @@ -/* GStreamer - * - * unit test for GstMessage - * - * Copyright (C) <2005> Wim Taymans - * - * 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 GQuark domain; - -GST_START_TEST (test_parsing) -{ - GstMessage *message; - - domain = g_quark_from_string ("test"); - - /* GST_MESSAGE_EOS */ - { - message = gst_message_new_eos (NULL); - fail_if (message == NULL); - fail_unless (GST_MESSAGE_TYPE (message) == GST_MESSAGE_EOS); - fail_unless (GST_MESSAGE_SRC (message) == NULL); - gst_message_unref (message); - } - /* GST_MESSAGE_ERROR */ - { - GError *error = NULL; - gchar *debug; - - error = g_error_new (domain, 10, "test error"); - fail_if (error == NULL); - message = gst_message_new_error (NULL, error, "error string"); - fail_if (message == NULL); - fail_unless (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ERROR); - fail_unless (GST_MESSAGE_SRC (message) == NULL); - - g_error_free (error); - error = NULL; - debug = NULL; - - gst_message_parse_error (message, &error, &debug); - fail_if (error == NULL); - fail_if (debug == NULL); - fail_unless (strcmp (error->message, "test error") == 0); - fail_unless (error->domain == domain); - fail_unless (error->code == 10); - fail_unless (strcmp (debug, "error string") == 0); - - gst_message_unref (message); - g_error_free (error); - g_free (debug); - } - /* GST_MESSAGE_WARNING */ - { - GError *warning = NULL; - gchar *debug; - - warning = g_error_new (domain, 10, "test warning"); - fail_if (warning == NULL); - message = gst_message_new_warning (NULL, warning, "warning string"); - fail_if (message == NULL); - fail_unless (GST_MESSAGE_TYPE (message) == GST_MESSAGE_WARNING); - fail_unless (GST_MESSAGE_SRC (message) == NULL); - - g_error_free (warning); - warning = NULL; - debug = NULL; - - gst_message_parse_warning (message, &warning, &debug); - fail_if (warning == NULL); - fail_if (debug == NULL); - fail_unless (strcmp (warning->message, "test warning") == 0); - fail_unless (warning->domain == domain); - fail_unless (warning->code == 10); - fail_unless (strcmp (debug, "warning string") == 0); - - gst_message_unref (message); - g_error_free (warning); - g_free (debug); - } - /* GST_MESSAGE_INFO */ - { - } - /* GST_MESSAGE_TAG */ - { - GstTagList *tag; - - /* FIXME, do some more tag adding */ - tag = gst_tag_list_new (); - fail_if (tag == NULL); - message = gst_message_new_tag (NULL, tag); - fail_if (message == NULL); - fail_unless (GST_MESSAGE_TYPE (message) == GST_MESSAGE_TAG); - fail_unless (GST_MESSAGE_SRC (message) == NULL); - tag = NULL; - gst_message_parse_tag (message, &tag); - fail_if (tag == NULL); - /* FIXME, check the actual tags */ - gst_message_unref (message); - gst_tag_list_free (tag); - } - /* GST_MESSAGE_BUFFERING */ - { - } - /* GST_MESSAGE_STATE_CHANGED */ - { - GstState oldstate, newstate, pending; - - oldstate = GST_STATE_PAUSED; - newstate = GST_STATE_PLAYING; - pending = GST_STATE_VOID_PENDING; - - message = gst_message_new_state_changed (NULL, oldstate, newstate, pending); - fail_if (message == NULL); - fail_unless (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STATE_CHANGED); - fail_unless (GST_MESSAGE_SRC (message) == NULL); - - /* set some wrong values to check if the parse method overwrites them - * with the good values */ - oldstate = GST_STATE_READY; - newstate = GST_STATE_READY; - pending = GST_STATE_READY; - gst_message_parse_state_changed (message, &oldstate, &newstate, &pending); - fail_unless (oldstate == GST_STATE_PAUSED); - fail_unless (newstate == GST_STATE_PLAYING); - fail_unless (pending == GST_STATE_VOID_PENDING); - - gst_message_unref (message); - } - /* GST_MESSAGE_STEP_DONE */ - { - } - /* GST_MESSAGE_NEW_CLOCK */ - { - } - /* GST_MESSAGE_STRUCTURE_CHANGE */ - { - } - /* GST_MESSAGE_STREAM_STATUS */ - { - } - /* GST_MESSAGE_APPLICATION */ - { - GstStructure *structure; - const GstStructure *struc; - gint some_int; - gdouble a_double; - - structure = gst_structure_new ("test_struct", - "some_int", G_TYPE_INT, 10, - "a_double", G_TYPE_DOUBLE, (gdouble) 1.8, NULL); - fail_if (structure == NULL); - message = gst_message_new_application (NULL, structure); - fail_if (message == NULL); - struc = gst_message_get_structure (message); - fail_if (struc == NULL); - fail_unless (gst_structure_get_int (struc, "some_int", &some_int)); - fail_unless (gst_structure_get_double (struc, "a_double", &a_double)); - fail_unless (some_int == 10); - fail_unless (a_double == 1.8); - - gst_message_unref (message); - } - - /* - void gst_message_parse_tag (GstMessage *message, GstTagList **tag_list); - void gst_message_parse_state_changed (GstMessage *message, GstState *old_state, - GstState *new_state); - void gst_message_parse_error (GstMessage *message, GError **gerror, gchar **debug); - void gst_message_parse_warning (GstMessage *message, GError **gerror, gchar **debug); - */ - - - -} - -GST_END_TEST Suite * -gst_data_suite (void) -{ - Suite *s = suite_create ("GstMessage"); - TCase *tc_chain = tcase_create ("general"); - - suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, test_parsing); - - return s; -} - -int -main (int argc, char **argv) -{ - int nf; - - Suite *s = gst_data_suite (); - SRunner *sr = srunner_create (s); - - gst_check_init (&argc, &argv); - - srunner_run_all (sr, CK_NORMAL); - nf = srunner_ntests_failed (sr); - srunner_free (sr); - - return nf; -} diff --git a/check/gst/gstminiobject.c b/check/gst/gstminiobject.c deleted file mode 100644 index 5043370222..0000000000 --- a/check/gst/gstminiobject.c +++ /dev/null @@ -1,210 +0,0 @@ -/* GStreamer - * - * unit test for GstMiniObject - * - * Copyright (C) <2005> Thomas Vander Stichele - * - * 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_START_TEST (test_copy) -{ - GstBuffer *buffer, *copy; - - buffer = gst_buffer_new_and_alloc (4); - - copy = GST_BUFFER (gst_mini_object_copy (GST_MINI_OBJECT (buffer))); - - fail_if (copy == NULL, "Copy of buffer returned NULL"); - fail_unless (GST_BUFFER_SIZE (copy) == 4, - "Copy of buffer has different size"); -} - -GST_END_TEST; - -GST_START_TEST (test_is_writable) -{ - GstBuffer *buffer; - GstMiniObject *mobj; - - buffer = gst_buffer_new_and_alloc (4); - mobj = GST_MINI_OBJECT (buffer); - - fail_unless (gst_mini_object_is_writable (mobj), - "A buffer with one ref should be writable"); - - GST_MINI_OBJECT_FLAG_SET (mobj, GST_MINI_OBJECT_FLAG_READONLY); - fail_if (gst_mini_object_is_writable (mobj), - "A buffer with READONLY set should not be writable"); - GST_MINI_OBJECT_FLAG_UNSET (mobj, GST_MINI_OBJECT_FLAG_READONLY); - fail_unless (gst_mini_object_is_writable (mobj), - "A buffer with one ref and READONLY not set should be writable"); - - fail_if (gst_mini_object_ref (mobj) == NULL, "Could not ref the mobj"); - - fail_if (gst_mini_object_is_writable (mobj), - "A buffer with two refs should not be writable"); -} - -GST_END_TEST; - -GST_START_TEST (test_make_writable) -{ - GstBuffer *buffer; - GstMiniObject *mobj, *mobj2, *mobj3; - - buffer = gst_buffer_new_and_alloc (4); - mobj = GST_MINI_OBJECT (buffer); - - mobj2 = gst_mini_object_make_writable (mobj); - fail_unless (GST_IS_BUFFER (mobj2), "make_writable did not return a buffer"); - fail_unless (mobj == mobj2, - "make_writable returned a copy for a buffer with refcount 1"); - - mobj2 = gst_mini_object_ref (mobj); - mobj3 = gst_mini_object_make_writable (mobj); - fail_unless (GST_IS_BUFFER (mobj3), "make_writable did not return a buffer"); - fail_if (mobj == mobj3, - "make_writable returned same object for a buffer with refcount > 1"); - - fail_unless (GST_MINI_OBJECT_REFCOUNT_VALUE (mobj) == 1, - "refcount of original mobj object should be back to 1"); - - mobj2 = gst_mini_object_make_writable (mobj); - fail_unless (GST_IS_BUFFER (mobj2), "make_writable did not return a buffer"); - fail_unless (mobj == mobj2, - "make_writable returned a copy for a buffer with refcount 1"); - -} - -GST_END_TEST; - -gint num_threads = 10; -gint refs_per_thread = 10000; - -/* test thread-safe refcounting of GstMiniObject */ -void -thread_ref (GstMiniObject * mobj) -{ - int j; - - THREAD_START (); - - for (j = 0; j < refs_per_thread; ++j) { - gst_mini_object_ref (mobj); - - if (j % num_threads == 0) - THREAD_SWITCH (); - } - GST_DEBUG ("thread stopped"); -} - -GST_START_TEST (test_ref_threaded) -{ - GstBuffer *buffer; - GstMiniObject *mobj; - gint expected; - - buffer = gst_buffer_new_and_alloc (4); - - mobj = GST_MINI_OBJECT (buffer); - - MAIN_START_THREADS (num_threads, thread_ref, mobj); - - MAIN_STOP_THREADS (); - - expected = num_threads * refs_per_thread + 1; - ASSERT_MINI_OBJECT_REFCOUNT (mobj, "miniobject", expected); -} - -GST_END_TEST; - -void -thread_unref (GstMiniObject * mobj) -{ - int j; - - THREAD_START (); - - for (j = 0; j < refs_per_thread; ++j) { - gst_mini_object_unref (mobj); - - if (j % num_threads == 0) - THREAD_SWITCH (); - } -} - -GST_START_TEST (test_unref_threaded) -{ - GstBuffer *buffer; - GstMiniObject *mobj; - int i; - - buffer = gst_buffer_new_and_alloc (4); - - mobj = GST_MINI_OBJECT (buffer); - - for (i = 0; i < num_threads * refs_per_thread; ++i) - gst_mini_object_ref (mobj); - - MAIN_START_THREADS (num_threads, thread_unref, mobj); - - MAIN_STOP_THREADS (); - - ASSERT_MINI_OBJECT_REFCOUNT (mobj, "miniobject", 1); - - /* final unref */ - gst_mini_object_unref (mobj); -} - -GST_END_TEST; - -Suite * -gst_mini_object_suite (void) -{ - Suite *s = suite_create ("GstMiniObject"); - TCase *tc_chain = tcase_create ("general"); - - /* turn off timeout */ - tcase_set_timeout (tc_chain, 60); - - suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, test_copy); - tcase_add_test (tc_chain, test_is_writable); - tcase_add_test (tc_chain, test_make_writable); - tcase_add_test (tc_chain, test_ref_threaded); - tcase_add_test (tc_chain, test_unref_threaded); - return s; -} - -int -main (int argc, char **argv) -{ - int nf; - - Suite *s = gst_mini_object_suite (); - SRunner *sr = srunner_create (s); - - gst_check_init (&argc, &argv); - - srunner_run_all (sr, CK_NORMAL); - nf = srunner_ntests_failed (sr); - srunner_free (sr); - - return nf; -} diff --git a/check/gst/gstobject.c b/check/gst/gstobject.c deleted file mode 100644 index 4afd5bdb6e..0000000000 --- a/check/gst/gstobject.c +++ /dev/null @@ -1,474 +0,0 @@ -/* GStreamer - * - * unit test for GstObject - * - * Copyright (C) <2004> Thomas Vander Stichele - * - * 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 - -/* - Create a fake subclass - */ -typedef struct _GstFakeObjectClass GstFakeObjectClass; -typedef struct _GstFakeObject GstFakeObject; - -struct _GstFakeObject -{ - GstObject object; -}; - -struct _GstFakeObjectClass -{ - GstObjectClass parent_class; -}; - -GType _gst_fake_object_type = 0; - -//static GstObjectClass *parent_class = NULL; -//static guint gst_fake_object_signals[LAST_SIGNAL] = { 0 }; - -GType -gst_fake_object_get_type (void) -{ - if (!_gst_fake_object_type) { - static const GTypeInfo fake_object_info = { - sizeof (GstFakeObjectClass), - NULL, //gst_fake_object_base_class_init, - NULL, //gst_fake_object_base_class_finalize, - NULL, //(GClassInitFunc) gst_fake_object_class_init, - NULL, - NULL, - sizeof (GstFakeObject), - 0, - NULL, //(GInstanceInitFunc) gst_fake_object_init, - NULL - }; - - _gst_fake_object_type = g_type_register_static (GST_TYPE_OBJECT, - "GstFakeObject", &fake_object_info, 0); - } - return _gst_fake_object_type; -} - -/* g_object_new on abstract GstObject should fail */ -GST_START_TEST (test_fail_abstract_new) -{ - GstObject *object; - - ASSERT_CRITICAL (object = g_object_new (gst_object_get_type (), NULL)); - fail_unless (object == NULL, "Created an instance of abstract GstObject"); -} - -GST_END_TEST -/* g_object_new on GstFakeObject should succeed */ -GST_START_TEST (test_fake_object_new) -{ - GstObject *object; - - object = g_object_new (gst_fake_object_get_type (), NULL); - fail_if (object == NULL, "Failed to create instance of GstFakeObject"); - fail_unless (GST_IS_OBJECT (object), - "GstFakeObject instance is not a GstObject"); -} - -GST_END_TEST -/* GstFakeObject name tests */ -GST_START_TEST (test_fake_object_name) -{ - GstObject *object; - gchar *name; - gchar *name2; - - object = g_object_new (gst_fake_object_get_type (), NULL); - - name = gst_object_get_name (object); - fail_if (name == NULL, "Newly created object has no name"); - fail_if (strncmp (name, "fakeobject", 10) != 0, - "Random name %s does not start with Gst", name); - - /* give a random name by setting with NULL; - * GstFakeObject class -> fakeobject%d */ - gst_object_set_name (object, NULL); - name = gst_object_get_name (object); - fail_if (name == NULL, "Random name was not assigned"); - fail_if (strncmp (name, "fakeobject", 10) != 0, - "Random name %s does not start with Gst", name); - g_free (name); - - gst_object_set_name (object, "fake"); - name = gst_object_get_name (object); - fail_if (name == NULL, "Failed to get name of GstFakeObject"); - fail_if (strcmp (name, "fake") != 0, "Name of GstFakeObject is not 'fake'"); - - /* change the gotten name to see that it's a copy and not the original */ - name[0] = 'm'; - name2 = gst_object_get_name (object); - fail_if (strcmp (name2, "fake") != 0, - "Copy of object name affected actual object name"); - g_free (name); - g_free (name2); -} - -GST_END_TEST -/* thread function for threaded name change test */ - gpointer thread_name_object (GstObject * object) -{ - gchar *thread_id = g_strdup_printf ("%p", g_thread_self ()); - - THREAD_START (); - - /* give main thread a head start */ - g_usleep (100000); - - /* write our name repeatedly */ - g_message ("THREAD %s: starting loop\n", thread_id); - while (THREAD_TEST_RUNNING ()) { - gst_object_set_name (object, thread_id); - /* a minimal sleep invokes a thread switch */ - THREAD_SWITCH (); - } - - /* thread is done, so let's return */ - g_message ("THREAD %s: set name\n", thread_id); - g_free (thread_id); - - return NULL; -} - -/* - * main thread sets and gets name while other threads set the name - * constantly; fails because lock is released inbetween set and get - */ - -GST_START_TEST (test_fake_object_name_threaded_wrong) -{ - GstObject *object; - gchar *name; - gint i; - gboolean expected_failure = FALSE; - - g_message ("\nTEST: set/get without lock\n"); - - object = g_object_new (gst_fake_object_get_type (), NULL); - gst_object_set_name (object, "main"); - - MAIN_START_THREADS (5, thread_name_object, object); - - /* start looping and set/get name repeatedly */ - for (i = 0; i < 1000; ++i) { - gst_object_set_name (object, "main"); - THREAD_SWITCH (); - name = gst_object_get_name (object); - if (strcmp (name, "main") != 0) { - g_message ("MAIN: expected failure during run %d\n", i); - expected_failure = TRUE; - g_free (name); - break; - } - g_free (name); - } - MAIN_STOP_THREADS (); - - fail_unless (expected_failure, "name did not get changed"); -} - -GST_END_TEST -/* - * main thread sets and gets name directly on struct inside the object lock - * succeed because lock is held during set/get, and threads are locked out - */ -GST_START_TEST (test_fake_object_name_threaded_right) -{ - GstObject *object; - gchar *name; - gint i; - - g_message ("\nTEST: set/get inside lock\n"); - - object = g_object_new (gst_fake_object_get_type (), NULL); - gst_object_set_name (object, "main"); - - MAIN_START_THREADS (5, thread_name_object, object); - - /* start looping and set/get name repeatedly */ - for (i = 0; i < 1000; ++i) { - GST_OBJECT_LOCK (object); - g_free (GST_OBJECT_NAME (object)); - GST_OBJECT_NAME (object) = g_strdup ("main"); - THREAD_SWITCH (); - name = g_strdup (GST_OBJECT_NAME (object)); - GST_OBJECT_UNLOCK (object); - - fail_unless (strcmp (name, "main") == 0, - "Name got changed while lock held during run %d", i); - g_free (name); - } - MAIN_STOP_THREADS (); -} - -GST_END_TEST -/* - * main thread creates lots of objects - * child threads sets default names on objects - * then main thread checks uniqueness of object names - */ - GList * object_list = NULL; -gint num_objects = 1000; -gint num_threads = 5; - -/* thread function for threaded default name change test */ -gpointer -thread_name_object_default (int *i) -{ - int j; - - THREAD_START (); - - for (j = *i; j < num_objects; j += num_threads) { - GstObject *o = GST_OBJECT (g_list_nth_data (object_list, j)); - - /* g_message ("THREAD %p: setting default name on object %d\n", - g_thread_self (), j); */ - gst_object_set_name (o, NULL); - THREAD_SWITCH (); - } - - /* thread is done, so let's return */ - g_message ("THREAD %p: set name\n", g_thread_self ()); - g_free (i); - - return NULL; -} - -static gint -gst_object_name_compare (GstObject * o, GstObject * p) -{ - gint result; - - GST_OBJECT_LOCK (o); - GST_OBJECT_LOCK (p); - - if (o->name == NULL && p->name == NULL) { - result = 0; - } else if (o->name == NULL) { - result = -1; - } else if (p->name == NULL) { - result = 1; - } else { - result = strcmp (o->name, p->name); - } - - GST_OBJECT_UNLOCK (p); - GST_OBJECT_UNLOCK (o); - - return result; -} - -GST_START_TEST (test_fake_object_name_threaded_unique) -{ - GstObject *object; - gint i; - gint *ip; - gchar *name1, *name2; - GList *l; - - g_message ("\nTEST: uniqueness of default names\n"); - - for (i = 0; i < num_objects; ++i) { - object = g_object_new (gst_fake_object_get_type (), NULL); - object_list = g_list_append (object_list, object); - } - - MAIN_INIT (); - - mark_point (); - for (i = 0; i < num_threads; ++i) { - ip = g_new (gint, 1); - *ip = i; - MAIN_START_THREAD_FUNCTION (i, thread_name_object_default, ip); - } - - mark_point (); - MAIN_SYNCHRONIZE (); - mark_point (); - MAIN_STOP_THREADS (); - - /* sort GList based on object name */ - /* FIXME: sort and test */ - g_list_sort (object_list, (GCompareFunc) gst_object_name_compare); - - name1 = gst_object_get_name (GST_OBJECT (object_list->data)); - for (l = object_list->next; l->next; l = l->next) { - g_message ("object with name %s\n", name1); - name2 = gst_object_get_name (GST_OBJECT (l->data)); - fail_if (strcmp (name1, name2) == 0, "Two objects with name %s", name2); - g_free (name1); - name1 = name2; - } - - /* free stuff */ - g_list_foreach (object_list, (GFunc) g_object_unref, NULL); -} - -GST_END_TEST -/* parentage test on GstFakeObject */ -GST_START_TEST (test_fake_object_parentage) -{ - GstObject *object1, *object2; - GstObject *parent; - gboolean result; - - /* create new object */ - object1 = g_object_new (gst_fake_object_get_type (), NULL); - fail_if (object1 == NULL, "Failed to create instance of GstFakeObject"); - fail_unless (GST_IS_OBJECT (object1), - "GstFakeObject instance is not a GstObject"); - fail_unless (GST_OBJECT_IS_FLOATING (object1), - "GstFakeObject instance is not floating"); - - /* check the parent */ - parent = gst_object_get_parent (object1); - fail_if (parent != NULL, "GstFakeObject has parent"); - /* try to set a NULL parent, this should give a warning */ - ASSERT_CRITICAL (result = gst_object_set_parent (object1, NULL)); - fail_if (result == TRUE, "GstFakeObject accepted NULL parent"); - /* try to set itself as parent, we expect a warning here */ - ASSERT_CRITICAL (result = gst_object_set_parent (object1, object1)); - fail_if (result == TRUE, "GstFakeObject accepted itself as parent"); - - /* should still be floating */ - fail_unless (GST_OBJECT_IS_FLOATING (object1), - "GstFakeObject instance is not floating"); - - /* create another object */ - object2 = g_object_new (gst_fake_object_get_type (), NULL); - fail_if (object2 == NULL, - "Failed to create another instance of GstFakeObject"); - fail_unless (GST_IS_OBJECT (object2), - "second GstFakeObject instance is not a GstObject"); - fail_unless (GST_OBJECT_IS_FLOATING (object1), - "GstFakeObject instance is not floating"); - - /* try to set other object as parent */ - result = gst_object_set_parent (object1, object2); - fail_if (result == FALSE, - "GstFakeObject could not accept other object as parent"); - - /* should not be floating anymore */ - fail_if (GST_OBJECT_IS_FLOATING (object1), - "GstFakeObject instance is still floating"); - /* parent should still be floating */ - fail_unless (GST_OBJECT_IS_FLOATING (object2), - "GstFakeObject instance is not floating"); - - /* check the parent */ - parent = gst_object_get_parent (object1); - fail_if (parent != object2, "GstFakeObject has wrong parent"); - gst_object_unref (parent); - /* try to set other object as parent again */ - result = gst_object_set_parent (object1, object2); - fail_if (result == TRUE, "GstFakeObject could set parent twice"); - - /* ref before unparenting */ - gst_object_ref (object1); - /* clear parent of object */ - gst_object_unparent (object1); - - /* check the parent */ - parent = gst_object_get_parent (object1); - fail_if (parent != NULL, "GstFakeObject has parent"); - - /* object should not be floating */ - fail_if (GST_OBJECT_IS_FLOATING (object1), - "GstFakeObject instance is floating again"); - - gst_object_unref (object1); - gst_object_unref (object2); -} - -GST_END_TEST -/* parentage test dispose on GstFakeObject, since our testcase - * does not handle the parent relation completely, the parent does - * not hold a ref to the child, we cannot dispose the parent to - * dipose the child as well. This test needs to be run with DEBUG - * info to check if the finalize methods are called correctly. */ -GST_START_TEST (test_fake_object_parentage_dispose) -{ - GstObject *object1, *object2; - gboolean result; - - object1 = g_object_new (gst_fake_object_get_type (), NULL); - fail_if (object1 == NULL, "Failed to create instance of GstFakeObject"); - - object2 = g_object_new (gst_fake_object_get_type (), NULL); - fail_if (object2 == NULL, "Failed to create instance of GstFakeObject"); - - /* try to set other object as parent */ - result = gst_object_set_parent (object1, object2); - fail_if (result == FALSE, - "GstFakeObject could not accept other object as parent"); - - /* clear parent of object */ - gst_object_unparent (object1); - - /* now dispose parent */ - gst_object_unref (object2); -} - -GST_END_TEST -/* test: try renaming a parented object, make sure it fails */ - Suite * gst_object_suite (void) -{ - Suite *s = suite_create ("GstObject"); - TCase *tc_chain = tcase_create ("general"); - - /* turn off timeout */ - tcase_set_timeout (tc_chain, 60); - - suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, test_fake_object_new); - tcase_add_test (tc_chain, test_fake_object_name); - tcase_add_test (tc_chain, test_fake_object_name_threaded_wrong); - tcase_add_test (tc_chain, test_fake_object_name_threaded_right); - tcase_add_test (tc_chain, test_fake_object_name_threaded_unique); - tcase_add_test (tc_chain, test_fake_object_parentage); - tcase_add_test (tc_chain, test_fake_object_parentage_dispose); - //tcase_add_checked_fixture (tc_chain, setup, teardown); - - /* SEGV tests go last so we can debug the others */ - tcase_add_test_raise_signal (tc_chain, test_fail_abstract_new, SIGSEGV); - return s; -} - -int -main (int argc, char **argv) -{ - int nf; - - Suite *s = gst_object_suite (); - SRunner *sr = srunner_create (s); - - gst_check_init (&argc, &argv); - - srunner_run_all (sr, CK_NORMAL); - nf = srunner_ntests_failed (sr); - srunner_free (sr); - - return nf; -} diff --git a/check/gst/gstpad.c b/check/gst/gstpad.c deleted file mode 100644 index 1221c83afa..0000000000 --- a/check/gst/gstpad.c +++ /dev/null @@ -1,419 +0,0 @@ -/* GStreamer - * Copyright (C) <2005> Thomas Vander Stichele - * - * gstpad.c: Unit test for GstPad - * - * 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_START_TEST (test_link) -{ - GstPad *src, *sink; - GstPadTemplate *srct; - - GstPadLinkReturn ret; - gchar *name; - - src = gst_pad_new ("source", GST_PAD_SRC); - fail_if (src == NULL); - ASSERT_OBJECT_REFCOUNT (src, "source pad", 1); - - name = gst_pad_get_name (src); - fail_unless (strcmp (name, "source") == 0); - ASSERT_OBJECT_REFCOUNT (src, "source pad", 1); - g_free (name); - - sink = gst_pad_new ("sink", GST_PAD_SINK); - fail_if (sink == NULL); - - /* linking without templates or caps should fail */ - ret = gst_pad_link (src, sink); - ASSERT_OBJECT_REFCOUNT (src, "source pad", 1); - ASSERT_OBJECT_REFCOUNT (sink, "sink pad", 1); - fail_unless (ret == GST_PAD_LINK_NOFORMAT); - - ASSERT_CRITICAL (gst_pad_get_pad_template (NULL)); - - srct = gst_pad_get_pad_template (src); - fail_unless (srct == NULL); - ASSERT_OBJECT_REFCOUNT (src, "source pad", 1); - - /* clean up */ - ASSERT_OBJECT_REFCOUNT (src, "source pad", 1); - gst_object_unref (src); - gst_object_unref (sink); -} - -GST_END_TEST; - -/* threaded link/unlink */ -/* use globals */ -GstPad *src, *sink; - -void -thread_link_unlink (gpointer data) -{ - THREAD_START (); - - while (THREAD_TEST_RUNNING ()) { - gst_pad_link (src, sink); - gst_pad_unlink (src, sink); - THREAD_SWITCH (); - } -} - -GST_START_TEST (test_link_unlink_threaded) -{ - GstCaps *caps; - int i; - - src = gst_pad_new ("source", GST_PAD_SRC); - fail_if (src == NULL); - sink = gst_pad_new ("sink", GST_PAD_SINK); - fail_if (sink == NULL); - - caps = gst_caps_from_string ("foo/bar"); - gst_pad_set_caps (src, caps); - gst_pad_set_caps (sink, caps); - - MAIN_START_THREADS (5, thread_link_unlink, NULL); - for (i = 0; i < 1000; ++i) { - gst_pad_is_linked (src); - gst_pad_is_linked (sink); - THREAD_SWITCH (); - } - MAIN_STOP_THREADS (); -} - -GST_END_TEST; - -GST_START_TEST (test_refcount) -{ - GstPad *src, *sink; - GstCaps *caps; - GstPadLinkReturn plr; - - sink = gst_pad_new ("sink", GST_PAD_SINK); - fail_if (sink == NULL); - - src = gst_pad_new ("src", GST_PAD_SRC); - fail_if (src == NULL); - - caps = gst_caps_from_string ("foo/bar"); - /* one for me */ - ASSERT_CAPS_REFCOUNT (caps, "caps", 1); - - gst_pad_set_caps (src, caps); - gst_pad_set_caps (sink, caps); - /* one for me and one for each set_caps */ - ASSERT_CAPS_REFCOUNT (caps, "caps", 3); - - plr = gst_pad_link (src, sink); - fail_unless (GST_PAD_LINK_SUCCESSFUL (plr)); - ASSERT_CAPS_REFCOUNT (caps, "caps", 3); - - gst_pad_unlink (src, sink); - ASSERT_CAPS_REFCOUNT (caps, "caps", 3); - - /* cleanup */ - gst_object_unref (src); - gst_object_unref (sink); - ASSERT_CAPS_REFCOUNT (caps, "caps", 1); - - gst_caps_unref (caps); -} - -GST_END_TEST; - -GST_START_TEST (test_get_allowed_caps) -{ - GstPad *src, *sink; - GstCaps *caps, *gotcaps; - GstBuffer *buffer; - GstPadLinkReturn plr; - - ASSERT_CRITICAL (gst_pad_get_allowed_caps (NULL)); - - buffer = gst_buffer_new (); - ASSERT_CRITICAL (gst_pad_get_allowed_caps ((GstPad *) buffer)); - gst_buffer_unref (buffer); - - sink = gst_pad_new ("sink", GST_PAD_SINK); - ASSERT_CRITICAL (gst_pad_get_allowed_caps (sink)); - - src = gst_pad_new ("src", GST_PAD_SRC); - fail_if (src == NULL); - caps = gst_pad_get_allowed_caps (src); - fail_unless (caps == NULL); - - caps = gst_caps_from_string ("foo/bar"); - - gst_pad_set_caps (src, caps); - gst_pad_set_caps (sink, caps); - ASSERT_CAPS_REFCOUNT (caps, "caps", 3); - - plr = gst_pad_link (src, sink); - fail_unless (GST_PAD_LINK_SUCCESSFUL (plr)); - - gotcaps = gst_pad_get_allowed_caps (src); - fail_if (gotcaps == NULL); - fail_unless (gst_caps_is_equal (gotcaps, caps)); - - ASSERT_CAPS_REFCOUNT (gotcaps, "gotcaps", 1); - gst_caps_unref (gotcaps); - - gst_pad_unlink (src, sink); - - /* cleanup */ - ASSERT_CAPS_REFCOUNT (caps, "caps", 3); - ASSERT_OBJECT_REFCOUNT (src, "src", 1); - ASSERT_OBJECT_REFCOUNT (sink, "sink", 1); - - gst_object_unref (src); - gst_object_unref (sink); - - ASSERT_CAPS_REFCOUNT (caps, "caps", 1); - gst_caps_unref (caps); -} - -GST_END_TEST; - -static gboolean -name_is_valid (const gchar * name, GstPadPresence presence) -{ - GstPadTemplate *new; - - new = gst_pad_template_new (name, GST_PAD_SRC, presence, GST_CAPS_ANY); - if (new) { - gst_object_unref (GST_OBJECT (new)); - return TRUE; - } - return FALSE; -} - -GST_START_TEST (test_name_is_valid) -{ - gboolean result = FALSE; - - fail_unless (name_is_valid ("src", GST_PAD_ALWAYS)); - ASSERT_WARNING (name_is_valid ("src%", GST_PAD_ALWAYS)); - ASSERT_WARNING (result = name_is_valid ("src%d", GST_PAD_ALWAYS)); - fail_if (result); - - fail_unless (name_is_valid ("src", GST_PAD_REQUEST)); - ASSERT_WARNING (name_is_valid ("src%s%s", GST_PAD_REQUEST)); - ASSERT_WARNING (name_is_valid ("src%c", GST_PAD_REQUEST)); - ASSERT_WARNING (name_is_valid ("src%", GST_PAD_REQUEST)); - ASSERT_WARNING (name_is_valid ("src%dsrc", GST_PAD_REQUEST)); - - fail_unless (name_is_valid ("src", GST_PAD_SOMETIMES)); - fail_unless (name_is_valid ("src%c", GST_PAD_SOMETIMES)); -} - -GST_END_TEST; - -static gboolean -_probe_handler (GstPad * pad, GstBuffer * buffer, gpointer userdata) -{ - gint ret = GPOINTER_TO_INT (userdata); - - if (ret == 1) - return TRUE; - return FALSE; -} - -GST_START_TEST (test_push_unlinked) -{ - GstPad *src; - GstCaps *caps; - GstBuffer *buffer; - gulong id; - - src = gst_pad_new ("src", GST_PAD_SRC); - fail_if (src == NULL); - caps = gst_pad_get_allowed_caps (src); - fail_unless (caps == NULL); - - caps = gst_caps_from_string ("foo/bar"); - - gst_pad_set_caps (src, caps); - ASSERT_CAPS_REFCOUNT (caps, "caps", 2); - - /* pushing on an unlinked pad will drop the buffer */ - buffer = gst_buffer_new (); - gst_buffer_ref (buffer); - fail_unless (gst_pad_push (src, buffer) == GST_FLOW_NOT_LINKED); - ASSERT_MINI_OBJECT_REFCOUNT (buffer, "buffer", 1); - gst_buffer_unref (buffer); - - /* adding a probe that returns FALSE will drop the buffer without trying - * to chain */ - id = gst_pad_add_buffer_probe (src, (GCallback) _probe_handler, - GINT_TO_POINTER (0)); - buffer = gst_buffer_new (); - gst_buffer_ref (buffer); - fail_unless (gst_pad_push (src, buffer) == GST_FLOW_OK); - ASSERT_MINI_OBJECT_REFCOUNT (buffer, "buffer", 1); - gst_buffer_unref (buffer); - gst_pad_remove_buffer_probe (src, id); - - /* adding a probe that returns TRUE will still chain the buffer, - * and hence drop because pad is unlinked */ - id = gst_pad_add_buffer_probe (src, (GCallback) _probe_handler, - GINT_TO_POINTER (1)); - buffer = gst_buffer_new (); - gst_buffer_ref (buffer); - fail_unless (gst_pad_push (src, buffer) == GST_FLOW_NOT_LINKED); - ASSERT_MINI_OBJECT_REFCOUNT (buffer, "buffer", 1); - gst_buffer_unref (buffer); - gst_pad_remove_buffer_probe (src, id); - - - /* cleanup */ - ASSERT_CAPS_REFCOUNT (caps, "caps", 2); - ASSERT_OBJECT_REFCOUNT (src, "src", 1); - - gst_object_unref (src); - - ASSERT_CAPS_REFCOUNT (caps, "caps", 1); - gst_caps_unref (caps); -} - -GST_END_TEST; - -GST_START_TEST (test_push_linked) -{ - GstPad *src, *sink; - GstPadLinkReturn plr; - GstCaps *caps; - GstBuffer *buffer; - ulong id; - - /* setup */ - sink = gst_pad_new ("sink", GST_PAD_SINK); - fail_if (sink == NULL); - gst_pad_set_chain_function (sink, gst_check_chain_func); - - src = gst_pad_new ("src", GST_PAD_SRC); - fail_if (src == NULL); - - caps = gst_caps_from_string ("foo/bar"); - /* one for me */ - ASSERT_CAPS_REFCOUNT (caps, "caps", 1); - - gst_pad_set_caps (src, caps); - gst_pad_set_caps (sink, caps); - /* one for me and one for each set_caps */ - ASSERT_CAPS_REFCOUNT (caps, "caps", 3); - - plr = gst_pad_link (src, sink); - fail_unless (GST_PAD_LINK_SUCCESSFUL (plr)); - ASSERT_CAPS_REFCOUNT (caps, "caps", 3); - - /* test */ - /* pushing on a linked pad will drop the ref to the buffer */ - buffer = gst_buffer_new (); - gst_buffer_ref (buffer); - fail_unless (gst_pad_push (src, buffer) == GST_FLOW_OK); - ASSERT_MINI_OBJECT_REFCOUNT (buffer, "buffer", 2); - gst_buffer_unref (buffer); - fail_unless_equals_int (g_list_length (buffers), 1); - buffer = GST_BUFFER (buffers->data); - ASSERT_MINI_OBJECT_REFCOUNT (buffer, "buffer", 1); - gst_buffer_unref (buffer); - g_list_free (buffers); - buffers = NULL; - - /* adding a probe that returns FALSE will drop the buffer without trying - * to chain */ - id = gst_pad_add_buffer_probe (src, (GCallback) _probe_handler, - GINT_TO_POINTER (0)); - buffer = gst_buffer_new (); - gst_buffer_ref (buffer); - fail_unless (gst_pad_push (src, buffer) == GST_FLOW_OK); - ASSERT_MINI_OBJECT_REFCOUNT (buffer, "buffer", 1); - gst_buffer_unref (buffer); - gst_pad_remove_buffer_probe (src, id); - fail_unless_equals_int (g_list_length (buffers), 0); - - /* adding a probe that returns TRUE will still chain the buffer */ - id = gst_pad_add_buffer_probe (src, (GCallback) _probe_handler, - GINT_TO_POINTER (1)); - buffer = gst_buffer_new (); - gst_buffer_ref (buffer); - fail_unless (gst_pad_push (src, buffer) == GST_FLOW_OK); - gst_pad_remove_buffer_probe (src, id); - - ASSERT_MINI_OBJECT_REFCOUNT (buffer, "buffer", 2); - gst_buffer_unref (buffer); - fail_unless_equals_int (g_list_length (buffers), 1); - buffer = GST_BUFFER (buffers->data); - ASSERT_MINI_OBJECT_REFCOUNT (buffer, "buffer", 1); - gst_buffer_unref (buffer); - g_list_free (buffers); - buffers = NULL; - - /* teardown */ - gst_pad_unlink (src, sink); - ASSERT_CAPS_REFCOUNT (caps, "caps", 3); - gst_object_unref (src); - gst_object_unref (sink); - ASSERT_CAPS_REFCOUNT (caps, "caps", 1); - - gst_caps_unref (caps); -} - -GST_END_TEST; - - -Suite * -gst_pad_suite (void) -{ - Suite *s = suite_create ("GstPad"); - TCase *tc_chain = tcase_create ("general"); - - /* turn off timeout */ - tcase_set_timeout (tc_chain, 60); - - suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, test_link); - tcase_add_test (tc_chain, test_refcount); - tcase_add_test (tc_chain, test_get_allowed_caps); - tcase_add_test (tc_chain, test_link_unlink_threaded); - tcase_add_test (tc_chain, test_name_is_valid); - tcase_add_test (tc_chain, test_push_unlinked); - tcase_add_test (tc_chain, test_push_linked); - return s; -} - -int -main (int argc, char **argv) -{ - int nf; - - Suite *s = gst_pad_suite (); - SRunner *sr = srunner_create (s); - - gst_check_init (&argc, &argv); - - srunner_run_all (sr, CK_NORMAL); - nf = srunner_ntests_failed (sr); - srunner_free (sr); - - return nf; -} diff --git a/check/gst/gstpipeline.c b/check/gst/gstpipeline.c deleted file mode 100644 index 99d58ca148..0000000000 --- a/check/gst/gstpipeline.c +++ /dev/null @@ -1,525 +0,0 @@ -/* GStreamer - * Copyright (C) 2005 Thomas Vander Stichele - * - * gstpipeline.c: Unit test for GstPipeline - * - * 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 WAIT_TIME (300 * GST_MSECOND) - -/* an empty pipeline can go to PLAYING in one go */ -GST_START_TEST (test_async_state_change_empty) -{ - GstPipeline *pipeline; - - pipeline = GST_PIPELINE (gst_pipeline_new (NULL)); - fail_unless (pipeline != NULL, "Could not create pipeline"); - - fail_unless_equals_int (gst_element_set_state (GST_ELEMENT (pipeline), - GST_STATE_PLAYING), GST_STATE_CHANGE_SUCCESS); - - gst_object_unref (pipeline); -} - -GST_END_TEST; - -GST_START_TEST (test_async_state_change_fake_ready) -{ - GstPipeline *pipeline; - GstElement *src, *sink; - - pipeline = GST_PIPELINE (gst_pipeline_new (NULL)); - fail_unless (pipeline != NULL, "Could not create pipeline"); - - src = gst_element_factory_make ("fakesrc", NULL); - sink = gst_element_factory_make ("fakesink", NULL); - - gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL); - gst_element_link (src, sink); - - fail_unless_equals_int (gst_element_set_state (GST_ELEMENT (pipeline), - GST_STATE_READY), GST_STATE_CHANGE_SUCCESS); - - gst_object_unref (pipeline); -} - -GST_END_TEST; - - -GST_START_TEST (test_async_state_change_fake) -{ - GstPipeline *pipeline; - GstElement *src, *sink; - GstBus *bus; - gboolean done = FALSE; - - pipeline = GST_PIPELINE (gst_pipeline_new (NULL)); - fail_unless (pipeline != NULL, "Could not create pipeline"); - - src = gst_element_factory_make ("fakesrc", NULL); - sink = gst_element_factory_make ("fakesink", NULL); - - gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL); - gst_element_link (src, sink); - - bus = gst_pipeline_get_bus (pipeline); - - fail_unless_equals_int (gst_element_set_state (GST_ELEMENT (pipeline), - GST_STATE_PLAYING), GST_STATE_CHANGE_ASYNC); - - while (!done) { - GstMessage *message; - GstState old, new, pending; - - message = gst_bus_poll (bus, GST_MESSAGE_STATE_CHANGED, -1); - if (message) { - gst_message_parse_state_changed (message, &old, &new, &pending); - GST_DEBUG_OBJECT (message->src, "state change from %d to %d", old, new); - if (message->src == GST_OBJECT (pipeline) && new == GST_STATE_PLAYING) - done = TRUE; - gst_message_unref (message); - } - } - - fail_unless_equals_int (gst_element_set_state (GST_ELEMENT (pipeline), - GST_STATE_NULL), GST_STATE_CHANGE_SUCCESS); - - gst_object_unref (bus); - gst_object_unref (pipeline); -} - -GST_END_TEST; - -GST_START_TEST (test_get_bus) -{ - GstPipeline *pipeline; - GstBus *bus; - - pipeline = GST_PIPELINE (gst_pipeline_new (NULL)); - fail_unless (pipeline != NULL, "Could not create pipeline"); - ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); - - bus = gst_pipeline_get_bus (pipeline); - ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline after get_bus", 1); - ASSERT_OBJECT_REFCOUNT (bus, "bus", 2); - - gst_object_unref (pipeline); - - ASSERT_OBJECT_REFCOUNT (bus, "bus after unref pipeline", 1); - gst_object_unref (bus); -} - -GST_END_TEST; - -GMainLoop *loop = NULL; - -gboolean -message_received (GstBus * bus, GstMessage * message, gpointer data) -{ - GstElement *pipeline = GST_ELEMENT (data); - GstMessageType type = message->type; - - GST_DEBUG ("message received"); - switch (type) { - case GST_MESSAGE_STATE_CHANGED: - { - GstState old, new, pending; - - GST_DEBUG ("state change message received"); - gst_message_parse_state_changed (message, &old, &new, &pending); - GST_DEBUG ("new state %d", new); - if (message->src == GST_OBJECT (pipeline) && new == GST_STATE_PLAYING) { - GST_DEBUG ("quitting main loop"); - g_main_loop_quit (loop); - } - } - break; - case GST_MESSAGE_ERROR: - { - g_print ("error\n"); - } - break; - default: - break; - } - - return TRUE; -} - -GST_START_TEST (test_bus) -{ - GstElement *pipeline; - GstElement *src, *sink; - GstBus *bus; - guint id; - GstState current; - GstStateChangeReturn ret; - - pipeline = gst_pipeline_new (NULL); - fail_unless (pipeline != NULL, "Could not create pipeline"); - ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1); - - src = gst_element_factory_make ("fakesrc", NULL); - fail_unless (src != NULL); - sink = gst_element_factory_make ("fakesink", NULL); - fail_unless (sink != NULL); - - gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL); - fail_unless (gst_element_link (src, sink)); - - bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); - ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline after get_bus", 1); - ASSERT_OBJECT_REFCOUNT (bus, "bus", 2); - - id = gst_bus_add_watch (bus, message_received, pipeline); - ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline after add_watch", 1); - ASSERT_OBJECT_REFCOUNT (bus, "bus after add_watch", 3); - - ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); - fail_unless (ret == GST_STATE_CHANGE_ASYNC); - - loop = g_main_loop_new (NULL, FALSE); - GST_DEBUG ("going into main loop"); - g_main_loop_run (loop); - GST_DEBUG ("left main loop"); - - /* PLAYING now */ - - ASSERT_OBJECT_REFCOUNT_BETWEEN (pipeline, "pipeline after gone to playing", 1, - 3); - - /* cleanup */ - GST_DEBUG ("cleanup"); - - ret = gst_element_set_state (pipeline, GST_STATE_NULL); - fail_unless (ret == GST_STATE_CHANGE_SUCCESS); - ret = gst_element_get_state (pipeline, ¤t, NULL, GST_CLOCK_TIME_NONE); - fail_unless (ret == GST_STATE_CHANGE_SUCCESS); - fail_unless (current == GST_STATE_NULL, "state is not NULL but %d", current); - - ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline at start of cleanup", 1); - ASSERT_OBJECT_REFCOUNT (bus, "bus at start of cleanup", 3); - - fail_unless (g_source_remove (id)); - ASSERT_OBJECT_REFCOUNT (bus, "bus after removing source", 2); - - GST_DEBUG ("unreffing pipeline"); - gst_object_unref (pipeline); - - ASSERT_OBJECT_REFCOUNT (bus, "bus after unref pipeline", 1); - gst_object_unref (bus); -} - -GST_END_TEST; - -static GMutex *probe_lock; -static GCond *probe_cond; - -static gboolean -sink_pad_probe (GstPad * pad, GstBuffer * buffer, - GstClockTime * first_timestamp) -{ - fail_if (GST_BUFFER_TIMESTAMP (buffer) == GST_CLOCK_TIME_NONE, - "testing if buffer timestamps are right, but got CLOCK_TIME_NONE"); - - if (*first_timestamp == GST_CLOCK_TIME_NONE) { - *first_timestamp = GST_BUFFER_TIMESTAMP (buffer); - } - - g_mutex_lock (probe_lock); - g_cond_signal (probe_cond); - g_mutex_unlock (probe_lock); - - return TRUE; -} - -GST_START_TEST (test_base_time) -{ - GstElement *pipeline, *fakesrc, *fakesink; - GstPad *sink; - GstClockTime observed, lower, upper, base, stream; - GstClock *clock; - - pipeline = gst_element_factory_make ("pipeline", "pipeline"); - fakesrc = gst_element_factory_make ("fakesrc", "fakesrc"); - fakesink = gst_element_factory_make ("fakesink", "fakesink"); - - fail_unless (pipeline && fakesrc && fakesink, "couldn't make elements"); - - g_object_set (fakesrc, "is-live", (gboolean) TRUE, NULL); - - gst_bin_add_many (GST_BIN (pipeline), fakesrc, fakesink, NULL); - gst_element_link (fakesrc, fakesink); - - sink = gst_element_get_pad (fakesink, "sink"); - gst_pad_add_buffer_probe (sink, G_CALLBACK (sink_pad_probe), &observed); - - fail_unless (gst_element_set_state (pipeline, GST_STATE_PAUSED) - == GST_STATE_CHANGE_NO_PREROLL, "expected no-preroll from live pipeline"); - - clock = gst_system_clock_obtain (); - fail_unless (clock && GST_IS_CLOCK (clock), "i want a clock dammit"); - gst_pipeline_use_clock (GST_PIPELINE (pipeline), clock); - - fail_unless (gst_pipeline_get_last_stream_time (GST_PIPELINE (pipeline)) == 0, - "stream time doesn't start off at 0"); - - probe_lock = g_mutex_new (); - probe_cond = g_cond_new (); - - /* test the first: that base time is being distributed correctly, timestamps - are correct relative to the running clock and base time */ - { - lower = gst_clock_get_time (clock); - - observed = GST_CLOCK_TIME_NONE; - - gst_element_set_state (pipeline, GST_STATE_PLAYING); - fail_unless (gst_element_get_state (pipeline, NULL, NULL, - GST_CLOCK_TIME_NONE) - == GST_STATE_CHANGE_SUCCESS, "failed state change"); - - g_mutex_lock (probe_lock); - while (observed == GST_CLOCK_TIME_NONE) - g_cond_wait (probe_cond, probe_lock); - g_mutex_unlock (probe_lock); - - /* now something a little more than lower was distributed as the base time, - * and the buffer was timestamped between 0 and upper-base - */ - - base = gst_element_get_base_time (pipeline); - fail_if (base == GST_CLOCK_TIME_NONE); - - /* set stream time */ - gst_element_set_state (pipeline, GST_STATE_PAUSED); - - /* pulling upper here makes sure that the pipeline's new stream time has - already been computed */ - upper = gst_clock_get_time (clock); - - fail_unless (gst_element_get_state (pipeline, NULL, NULL, - GST_CLOCK_TIME_NONE) - == GST_STATE_CHANGE_NO_PREROLL, "failed state change"); - - fail_if (observed == GST_CLOCK_TIME_NONE, "no timestamp recorded"); - - fail_unless (base >= lower, "early base time: %" GST_TIME_FORMAT " < %" - GST_TIME_FORMAT, GST_TIME_ARGS (base), GST_TIME_ARGS (lower)); - fail_unless (upper >= base, "bogus base time: %" GST_TIME_FORMAT " > %" - GST_TIME_FORMAT, GST_TIME_ARGS (base), GST_TIME_ARGS (upper)); - - stream = gst_pipeline_get_last_stream_time (GST_PIPELINE (pipeline)); - - fail_unless (stream > 0, "bogus new stream time: %" GST_TIME_FORMAT " > %" - GST_TIME_FORMAT, GST_TIME_ARGS (stream), GST_TIME_ARGS (0)); - fail_unless (stream <= upper, - "bogus new stream time: %" GST_TIME_FORMAT " > %" GST_TIME_FORMAT, - GST_TIME_ARGS (stream), GST_TIME_ARGS (upper)); - - fail_unless (observed <= stream, "timestamps outrun stream time: %" - GST_TIME_FORMAT " > %" GST_TIME_FORMAT, - GST_TIME_ARGS (observed), GST_TIME_ARGS (stream)); - fail_unless (observed >= 0, "early timestamp: %" GST_TIME_FORMAT " < %" - GST_TIME_FORMAT, GST_TIME_ARGS (observed), - GST_TIME_ARGS (lower - base)); - fail_unless (observed <= upper - base, - "late timestamp: %" GST_TIME_FORMAT " > %" GST_TIME_FORMAT, - GST_TIME_ARGS (observed), GST_TIME_ARGS (upper - base)); - } - - /* test the second: that the base time is redistributed when we go to PLAYING - again */ - { - GstClockID clock_id; - GstClockTime oldbase = base, oldstream = stream; - - /* let some time pass */ - clock_id = gst_clock_new_single_shot_id (clock, upper + WAIT_TIME); - fail_unless (gst_clock_id_wait (clock_id, NULL) == GST_CLOCK_OK, - "unexpected clock_id_wait return"); - gst_clock_id_unref (clock_id); - - lower = gst_clock_get_time (clock); - fail_if (lower == GST_CLOCK_TIME_NONE); - - observed = GST_CLOCK_TIME_NONE; - - fail_unless (lower >= upper + WAIT_TIME, "clock did not advance?"); - - gst_element_set_state (pipeline, GST_STATE_PLAYING); - fail_unless (gst_element_get_state (pipeline, NULL, NULL, - GST_CLOCK_TIME_NONE) - == GST_STATE_CHANGE_SUCCESS, "failed state change"); - - g_mutex_lock (probe_lock); - while (observed == GST_CLOCK_TIME_NONE) - g_cond_wait (probe_cond, probe_lock); - g_mutex_unlock (probe_lock); - - /* now the base time should have advanced by more than WAIT_TIME compared - * to what it was. The buffer will be timestamped between the last stream - * time and upper minus base. - */ - - base = gst_element_get_base_time (pipeline); - fail_if (base == GST_CLOCK_TIME_NONE); - - /* set stream time */ - gst_element_set_state (pipeline, GST_STATE_PAUSED); - - /* new stream time already set */ - upper = gst_clock_get_time (clock); - - fail_unless (gst_element_get_state (pipeline, NULL, NULL, - GST_CLOCK_TIME_NONE) - == GST_STATE_CHANGE_NO_PREROLL, "failed state change"); - - fail_if (observed == GST_CLOCK_TIME_NONE, "no timestamp recorded"); - - stream = gst_pipeline_get_last_stream_time (GST_PIPELINE (pipeline)); - - fail_unless (base >= oldbase + WAIT_TIME, "base time not reset"); - fail_unless (upper >= base + stream, "bogus base time: %" - GST_TIME_FORMAT " > %" GST_TIME_FORMAT, GST_TIME_ARGS (base), - GST_TIME_ARGS (upper)); - - fail_unless (lower >= base); - fail_unless (observed >= lower - base, "early timestamp: %" - GST_TIME_FORMAT " < %" GST_TIME_FORMAT, - GST_TIME_ARGS (observed), GST_TIME_ARGS (lower - base)); - fail_unless (observed <= upper - base, "late timestamp: %" - GST_TIME_FORMAT " > %" GST_TIME_FORMAT, - GST_TIME_ARGS (observed), GST_TIME_ARGS (upper - base)); - fail_unless (stream - oldstream <= upper - lower, - "insufficient stream time: %" GST_TIME_FORMAT " > %" GST_TIME_FORMAT, - GST_TIME_ARGS (observed), GST_TIME_ARGS (upper)); - } - - /* test the third: that if I set CLOCK_TIME_NONE as the stream time, that the - base time is not changed */ - { - GstClockID clock_id; - GstClockTime oldbase = base, oldobserved = observed; - GstClockReturn ret; - - /* let some time pass */ - clock_id = gst_clock_new_single_shot_id (clock, upper + WAIT_TIME); - ret = gst_clock_id_wait (clock_id, NULL); - fail_unless (ret == GST_CLOCK_OK, - "unexpected clock_id_wait return %d", ret); - gst_clock_id_unref (clock_id); - - lower = gst_clock_get_time (clock); - - observed = GST_CLOCK_TIME_NONE; - - fail_unless (lower >= upper + WAIT_TIME, "clock did not advance?"); - - /* bling */ - gst_pipeline_set_new_stream_time (GST_PIPELINE (pipeline), - GST_CLOCK_TIME_NONE); - - gst_element_set_state (pipeline, GST_STATE_PLAYING); - fail_unless (gst_element_get_state (pipeline, NULL, NULL, - GST_CLOCK_TIME_NONE) - == GST_STATE_CHANGE_SUCCESS, "failed state change"); - - g_mutex_lock (probe_lock); - while (observed == GST_CLOCK_TIME_NONE) - g_cond_wait (probe_cond, probe_lock); - g_mutex_unlock (probe_lock); - - /* now the base time should be the same as it was, and the timestamp should - * be more than WAIT_TIME past what it was. - */ - - base = gst_element_get_base_time (pipeline); - - /* set stream time */ - gst_element_set_state (pipeline, GST_STATE_PAUSED); - - /* new stream time already set */ - upper = gst_clock_get_time (clock); - - fail_unless (gst_element_get_state (pipeline, NULL, NULL, - GST_CLOCK_TIME_NONE) - == GST_STATE_CHANGE_NO_PREROLL, "failed state change"); - - fail_if (observed == GST_CLOCK_TIME_NONE, "no timestamp recorded"); - - fail_unless (gst_pipeline_get_last_stream_time (GST_PIPELINE (pipeline)) - == GST_CLOCK_TIME_NONE, "stream time was reset"); - - fail_unless (base == oldbase, "base time was reset"); - - fail_unless (observed >= lower - base, "early timestamp: %" - GST_TIME_FORMAT " < %" GST_TIME_FORMAT, - GST_TIME_ARGS (observed), GST_TIME_ARGS (lower - base)); - fail_unless (observed <= upper - base, "late timestamp: %" - GST_TIME_FORMAT " > %" GST_TIME_FORMAT, - GST_TIME_ARGS (observed), GST_TIME_ARGS (upper - base)); - fail_unless (observed - oldobserved >= WAIT_TIME, - "insufficient tstamp delta: %" GST_TIME_FORMAT " > %" GST_TIME_FORMAT, - GST_TIME_ARGS (observed), GST_TIME_ARGS (oldobserved)); - } - - gst_object_unref (sink); - gst_object_unref (clock); - gst_object_unref (pipeline); -} - -GST_END_TEST; - -Suite * -gst_pipeline_suite (void) -{ - Suite *s = suite_create ("GstPipeline"); - TCase *tc_chain = tcase_create ("pipeline tests"); - - tcase_set_timeout (tc_chain, 0); - - suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, test_async_state_change_empty); - tcase_add_test (tc_chain, test_async_state_change_fake_ready); - tcase_add_test (tc_chain, test_async_state_change_fake); - tcase_add_test (tc_chain, test_get_bus); - tcase_add_test (tc_chain, test_bus); - tcase_add_test (tc_chain, test_base_time); - - return s; -} - -int -main (int argc, char **argv) -{ - int nf; - - Suite *s = gst_pipeline_suite (); - SRunner *sr = srunner_create (s); - - gst_check_init (&argc, &argv); - - srunner_set_log (sr, "test.log"); - srunner_run_all (sr, CK_NORMAL); - nf = srunner_ntests_failed (sr); - srunner_free (sr); - - return nf; -} diff --git a/check/gst/gstplugin.c b/check/gst/gstplugin.c deleted file mode 100644 index 8362dfd2db..0000000000 --- a/check/gst/gstplugin.c +++ /dev/null @@ -1,331 +0,0 @@ -/* GStreamer - * - * unit test for GstPlugin - * - * Copyright 2004 Thomas Vander Stichele - * Copyright 2005 David Schleef - * - * 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 "config.h" - -#include - -static gboolean -register_check_elements (GstPlugin * plugin) -{ - return TRUE; -} - -static GstPluginDesc plugin_desc = { - GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "check elements", - "check elements", - register_check_elements, - VERSION, - GST_LICENSE, - PACKAGE, - GST_PACKAGE_NAME, - GST_PACKAGE_ORIGIN, - - GST_PADDING_INIT -}; - -GST_START_TEST (test_register_static) -{ - GstPlugin *plugin; - - _gst_plugin_register_static (&plugin_desc); - - plugin = g_object_new (GST_TYPE_PLUGIN, NULL); - - gst_object_unref (plugin); -} - -GST_END_TEST; - -GST_START_TEST (test_registry) -{ - GList *g; - GstRegistry *registry; - - registry = gst_registry_get_default (); - - for (g = registry->plugins; g; g = g->next) { - GstPlugin *plugin = GST_PLUGIN (g->data); - - ASSERT_OBJECT_REFCOUNT (plugin, "plugin in registry", 1); - GST_DEBUG ("refcount %d %s", GST_OBJECT_REFCOUNT_VALUE (plugin), - plugin->desc.name); - } - for (g = registry->features; g; g = g->next) { - GstPluginFeature *feature = GST_PLUGIN_FEATURE (g->data); - - fail_if (GST_OBJECT_REFCOUNT_VALUE (feature) != 1, - "Feature in registry should have refcount of 1"); - GST_DEBUG ("refcount %d %s", GST_OBJECT_REFCOUNT_VALUE (feature), - feature->name); - } -} - -GST_END_TEST; - -GST_START_TEST (test_load_gstelements) -{ - GstPlugin *unloaded_plugin; - GstPlugin *loaded_plugin; - - unloaded_plugin = gst_default_registry_find_plugin ("gstelements"); - fail_if (unloaded_plugin == NULL, "Failed to find gstelements plugin"); - fail_if (GST_OBJECT_REFCOUNT_VALUE (unloaded_plugin) != 2, - "Refcount of unloaded plugin in registry initially should be 2"); - GST_DEBUG ("refcount %d", GST_OBJECT_REFCOUNT_VALUE (unloaded_plugin)); - - loaded_plugin = gst_plugin_load (unloaded_plugin); - fail_if (loaded_plugin == NULL, "Failed to load plugin"); - - if (loaded_plugin != unloaded_plugin) { - fail_if (GST_OBJECT_REFCOUNT_VALUE (loaded_plugin) != 2, - "Refcount of loaded plugin in registry should be 2"); - GST_DEBUG ("refcount %d", GST_OBJECT_REFCOUNT_VALUE (loaded_plugin)); - fail_if (GST_OBJECT_REFCOUNT_VALUE (unloaded_plugin) != 1, - "Refcount of replaced plugin should be 1"); - GST_DEBUG ("refcount %d", GST_OBJECT_REFCOUNT_VALUE (unloaded_plugin)); - } - - gst_object_unref (unloaded_plugin); - gst_object_unref (loaded_plugin); -} - -GST_END_TEST; - -GST_START_TEST (test_registry_get_plugin_list) -{ - GList *list; - GstPlugin *plugin; - - plugin = gst_default_registry_find_plugin ("gstelements"); - fail_if (GST_OBJECT_REFCOUNT_VALUE (plugin) != 2, - "Refcount of plugin in registry should be 2"); - - list = gst_registry_get_plugin_list (gst_registry_get_default ()); - - fail_if (GST_OBJECT_REFCOUNT_VALUE (plugin) != 3, - "Refcount of plugin in registry+list should be 3"); - - gst_plugin_list_free (list); - - fail_if (GST_OBJECT_REFCOUNT_VALUE (plugin) != 2, - "Refcount of plugin in after list free should be 2"); - - gst_object_unref (plugin); -} - -GST_END_TEST; - -GST_START_TEST (test_find_plugin) -{ - GstPlugin *plugin; - - plugin = gst_registry_find_plugin (gst_registry_get_default (), - "gstelements"); - fail_if (plugin == NULL, "Failed to find gstelements plugin"); - ASSERT_OBJECT_REFCOUNT (plugin, "plugin", 2); - - fail_unless_equals_string (plugin->desc.version, VERSION); - fail_unless_equals_string (plugin->desc.license, "LGPL"); - fail_unless_equals_string (plugin->desc.source, "gstreamer"); - fail_unless_equals_string (plugin->desc.package, GST_PACKAGE_NAME); - fail_unless_equals_string (plugin->desc.origin, GST_PACKAGE_ORIGIN); - - gst_object_unref (plugin); -} - -GST_END_TEST; - - -GST_START_TEST (test_find_feature) -{ - GstPluginFeature *feature; - - feature = gst_registry_find_feature (gst_registry_get_default (), - "identity", GST_TYPE_ELEMENT_FACTORY); - fail_if (feature == NULL, "Failed to find identity element factory"); - fail_if (strcmp (feature->plugin_name, "gstelements"), - "Expected identity to be from gstelements plugin"); - - fail_if (GST_OBJECT_REFCOUNT_VALUE (feature) != 2, - "Refcount of feature should be 2"); - GST_DEBUG ("refcount %d", GST_OBJECT_REFCOUNT_VALUE (feature)); - - gst_object_unref (feature); -} - -GST_END_TEST; - -GST_START_TEST (test_find_element) -{ - GstElementFactory *element_factory; - - element_factory = gst_element_factory_find ("identity"); - fail_if (element_factory == NULL, "Failed to find identity element factory"); - - fail_if (GST_OBJECT_REFCOUNT_VALUE (element_factory) != 2, - "Refcount of plugin in registry+feature should be 2"); - - gst_object_unref (element_factory); -} - -GST_END_TEST; - -#if 0 -guint8 * -peek (gpointer data, gint64 offset, guint size) -{ - return NULL; -} - -void -suggest (gpointer data, guint probability, const GstCaps * caps) -{ - -} - -GST_START_TEST (test_typefind) -{ - GstPlugin *plugin; - GstPluginFeature *feature; - GstTypeFind typefind = { - peek, - suggest, - NULL, - NULL, - GST_PADDING_INIT - }; - - plugin = gst_default_registry_find_plugin ("typefindfunctions"); - fail_if (plugin == NULL, "Failed to find typefind functions"); - fail_if (GST_OBJECT_REFCOUNT_VALUE (plugin) != 2, - "Refcount of plugin in registry should be 2"); - fail_if (gst_plugin_is_loaded (plugin), "Expected plugin to be unloaded"); - - feature = gst_registry_find_feature (gst_registry_get_default (), - "audio/x-au", GST_TYPE_TYPE_FIND_FACTORY); - fail_if (feature == NULL, "Failed to find audio/x-aw typefind factory"); - fail_if (feature->plugin != plugin, - "Expected identity to be from gstelements plugin"); - - fail_if (GST_OBJECT_REFCOUNT_VALUE (plugin) != 3, - "Refcount of plugin in registry+feature should be 3"); - - gst_type_find_factory_call_function (GST_TYPE_FIND_FACTORY (feature), - &typefind); - - gst_object_unref (feature->plugin); - - fail_if (GST_OBJECT_REFCOUNT_VALUE (plugin) != 1, - "Refcount of plugin in after list free should be 1"); - - gst_object_unref (plugin); -} - -GST_END_TEST; -#endif - -GST_START_TEST (test_version_checks) -{ - fail_if (gst_default_registry_check_feature_version ("identity", - GST_VERSION_MAJOR, GST_VERSION_MINOR, GST_VERSION_MICRO) == FALSE, - "Unexpected version check result"); - - fail_if (gst_default_registry_check_feature_version ("identity", - GST_VERSION_MAJOR + 1, GST_VERSION_MINOR, GST_VERSION_MICRO) == TRUE, - "Unexpected version check result"); - - fail_if (gst_default_registry_check_feature_version ("identity", - GST_VERSION_MAJOR, GST_VERSION_MINOR + 1, GST_VERSION_MICRO) == TRUE, - "Unexpected version check result"); - - fail_if (gst_default_registry_check_feature_version ("identity", - GST_VERSION_MAJOR, GST_VERSION_MINOR, GST_VERSION_MICRO + 1) == TRUE, - "Unexpected version check result"); - - if (GST_VERSION_MAJOR > 0) { - fail_if (gst_default_registry_check_feature_version ("identity", - GST_VERSION_MAJOR - 1, GST_VERSION_MINOR, - GST_VERSION_MICRO) == FALSE, "Unexpected version check result"); - } - - if (GST_VERSION_MINOR > 0) { - fail_if (gst_default_registry_check_feature_version ("identity", - GST_VERSION_MAJOR, GST_VERSION_MINOR - 1, - GST_VERSION_MICRO) == FALSE, "Unexpected version check result"); - } - - if (GST_VERSION_MICRO > 0) { - fail_if (gst_default_registry_check_feature_version ("identity", - GST_VERSION_MAJOR, GST_VERSION_MINOR, - GST_VERSION_MICRO - 1) == FALSE, "Unexpected version check result"); - } - - fail_if (gst_default_registry_check_feature_version ("entityid", - GST_VERSION_MAJOR, GST_VERSION_MINOR, GST_VERSION_MICRO) == TRUE, - "Unexpected version check result"); -} - -GST_END_TEST; - -Suite * -gst_plugin_suite (void) -{ - Suite *s = suite_create ("GstPlugin"); - TCase *tc_chain = tcase_create ("general"); - - /* turn off timeout */ - tcase_set_timeout (tc_chain, 60); - - suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, test_register_static); - tcase_add_test (tc_chain, test_registry); - tcase_add_test (tc_chain, test_load_gstelements); - tcase_add_test (tc_chain, test_registry_get_plugin_list); - tcase_add_test (tc_chain, test_find_plugin); - tcase_add_test (tc_chain, test_find_feature); - tcase_add_test (tc_chain, test_find_element); - tcase_add_test (tc_chain, test_version_checks); - //tcase_add_test (tc_chain, test_typefind); - - return s; -} - -int -main (int argc, char **argv) -{ - int nf; - - Suite *s = gst_plugin_suite (); - SRunner *sr = srunner_create (s); - - gst_check_init (&argc, &argv); - - srunner_run_all (sr, CK_NORMAL); - nf = srunner_ntests_failed (sr); - srunner_free (sr); - - return nf; -} diff --git a/check/gst/gstsegment.c b/check/gst/gstsegment.c deleted file mode 100644 index e32715e93b..0000000000 --- a/check/gst/gstsegment.c +++ /dev/null @@ -1,532 +0,0 @@ -/* GStreamer - * Copyright (C) 2005 Jan Schmidt - * - * gstsegment.c: Unit test for segments - * - * 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 - -/* mess with the segment structure in the bytes format */ -GST_START_TEST (segment_seek_nosize) -{ - GstSegment segment; - gboolean res; - gint64 cstart, cstop; - gboolean update; - - gst_segment_init (&segment, GST_FORMAT_BYTES); - - /* configure segment to start 100 */ - gst_segment_set_seek (&segment, 1.0, - GST_FORMAT_BYTES, - GST_SEEK_FLAG_NONE, - GST_SEEK_TYPE_SET, 100, GST_SEEK_TYPE_NONE, -1, &update); - fail_unless (segment.start == 100); - fail_unless (segment.stop == -1); - - /* configure segment to stop relative, should not do anything since - * size is unknown. */ - gst_segment_set_seek (&segment, 1.0, - GST_FORMAT_BYTES, - GST_SEEK_FLAG_NONE, - GST_SEEK_TYPE_NONE, 200, GST_SEEK_TYPE_CUR, -100, &update); - fail_unless (segment.start == 100); - fail_unless (segment.stop == -1); - - /* do some clipping on the open range */ - /* completely outside */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 0, 50, &cstart, &cstop); - fail_unless (res == FALSE); - - /* touching lower bound */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 50, 100, &cstart, &cstop); - fail_unless (res == FALSE); - - /* partially inside */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 50, 150, &cstart, &cstop); - fail_unless (res == TRUE); - fail_unless (cstart == 100); - fail_unless (cstop == 150); - - /* inside, touching lower bound */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, - 100, 150, &cstart, &cstop); - fail_unless (res == TRUE); - fail_unless (cstart == 100); - fail_unless (cstop == 150); - - /* completely inside */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, - 150, 200, &cstart, &cstop); - fail_unless (res == TRUE); - fail_unless (cstart == 150); - fail_unless (cstop == 200); - - /* invalid start */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, -1, 100, &cstart, &cstop); - fail_unless (res == FALSE); - - /* start outside */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 50, -1, &cstart, &cstop); - fail_unless (res == TRUE); - fail_unless (cstart == 100); - fail_unless (cstop == -1); - - /* start on lower bound */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 100, -1, &cstart, &cstop); - fail_unless (res == TRUE); - fail_unless (cstart == 100); - fail_unless (cstop == -1); - - /* start inside */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 150, -1, &cstart, &cstop); - fail_unless (res == TRUE); - fail_unless (cstart == 150); - fail_unless (cstop == -1); - - /* add 100 to start, set stop to 300 */ - gst_segment_set_seek (&segment, 1.0, - GST_FORMAT_BYTES, - GST_SEEK_FLAG_NONE, - GST_SEEK_TYPE_CUR, 100, GST_SEEK_TYPE_SET, 300, &update); - fail_unless (segment.start == 200); - fail_unless (segment.stop == 300); - - /* add 100 to start (to 300), set stop to 200, this is not allowed. - * nothing should be updated in the segment. */ - ASSERT_CRITICAL (gst_segment_set_seek (&segment, 1.0, - GST_FORMAT_BYTES, - GST_SEEK_FLAG_NONE, - GST_SEEK_TYPE_CUR, 100, GST_SEEK_TYPE_SET, 200, &update)); - fail_unless (segment.start == 200); - fail_unless (segment.stop == 300); - - /* seek relative to end, should not do anything since size is - * unknown. */ - gst_segment_set_seek (&segment, 1.0, - GST_FORMAT_BYTES, - GST_SEEK_FLAG_NONE, - GST_SEEK_TYPE_END, -300, GST_SEEK_TYPE_END, -100, &update); - fail_unless (segment.start == 200); - fail_unless (segment.stop == 300); - - /* completely outside */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 0, 50, &cstart, &cstop); - fail_unless (res == FALSE); - - /* touching lower bound */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 50, 200, &cstart, &cstop); - fail_unless (res == FALSE); - - /* partially inside */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 50, 250, &cstart, &cstop); - fail_unless (res == TRUE); - fail_unless (cstart == 200); - fail_unless (cstop == 250); - - /* inside, touching lower bound */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, - 200, 250, &cstart, &cstop); - fail_unless (res == TRUE); - fail_unless (cstart == 200); - fail_unless (cstop == 250); - - /* completely inside */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, - 250, 290, &cstart, &cstop); - fail_unless (res == TRUE); - fail_unless (cstart == 250); - fail_unless (cstop == 290); - - /* partially inside */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, - 250, 350, &cstart, &cstop); - fail_unless (res == TRUE); - fail_unless (cstart == 250); - fail_unless (cstop == 300); - - /* invalid start */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, -1, 100, &cstart, &cstop); - fail_unless (res == FALSE); - - /* start outside */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 50, -1, &cstart, &cstop); - fail_unless (res == TRUE); - fail_unless (cstart == 200); - fail_unless (cstop == 300); - - /* start on lower bound */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 200, -1, &cstart, &cstop); - fail_unless (res == TRUE); - fail_unless (cstart == 200); - fail_unless (cstop == 300); - - /* start inside */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 250, -1, &cstart, &cstop); - fail_unless (res == TRUE); - fail_unless (cstart == 250); - fail_unless (cstop == 300); - - /* start outside on boundary */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 300, -1, &cstart, &cstop); - fail_unless (res == FALSE); - - /* start completely outside */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 350, -1, &cstart, &cstop); - fail_unless (res == FALSE); -} - -GST_END_TEST; - -/* mess with the segment structure in the bytes format */ -GST_START_TEST (segment_seek_size) -{ - GstSegment segment; - gboolean res; - gint64 cstart, cstop; - gboolean update; - - gst_segment_init (&segment, GST_FORMAT_BYTES); - gst_segment_set_duration (&segment, GST_FORMAT_BYTES, 200); - - /* configure segment to start 100 */ - gst_segment_set_seek (&segment, 1.0, - GST_FORMAT_BYTES, - GST_SEEK_FLAG_NONE, - GST_SEEK_TYPE_SET, 100, GST_SEEK_TYPE_NONE, -1, &update); - fail_unless (segment.start == 100); - fail_unless (segment.stop == -1); - - /* configure segment to stop relative, does not update stop - * since we did not set it before. */ - gst_segment_set_seek (&segment, 1.0, - GST_FORMAT_BYTES, - GST_SEEK_FLAG_NONE, - GST_SEEK_TYPE_NONE, 200, GST_SEEK_TYPE_CUR, -100, &update); - fail_unless (segment.start == 100); - fail_unless (segment.stop == -1); - - /* do some clipping on the open range */ - /* completely outside */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 0, 50, &cstart, &cstop); - fail_unless (res == FALSE); - - /* touching lower bound */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 50, 100, &cstart, &cstop); - fail_unless (res == FALSE); - - /* partially inside */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 50, 150, &cstart, &cstop); - fail_unless (res == TRUE); - fail_unless (cstart == 100); - fail_unless (cstop == 150); - - /* inside, touching lower bound */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, - 100, 150, &cstart, &cstop); - fail_unless (res == TRUE); - fail_unless (cstart == 100); - fail_unless (cstop == 150); - - /* completely inside */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, - 150, 200, &cstart, &cstop); - fail_unless (res == TRUE); - fail_unless (cstart == 150); - fail_unless (cstop == 200); - - /* partially inside, clip to size */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, - 150, 300, &cstart, &cstop); - fail_unless (res == TRUE); - fail_unless (cstart == 150); - fail_unless (cstop == 200); - - /* invalid start */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, -1, 100, &cstart, &cstop); - fail_unless (res == FALSE); - - /* start outside */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 50, -1, &cstart, &cstop); - fail_unless (res == TRUE); - fail_unless (cstart == 100); - fail_unless (cstop == -1); - - /* start on lower bound */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 100, -1, &cstart, &cstop); - fail_unless (res == TRUE); - fail_unless (cstart == 100); - fail_unless (cstop == -1); - - /* start inside */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 150, -1, &cstart, &cstop); - fail_unless (res == TRUE); - fail_unless (cstart == 150); - fail_unless (cstop == -1); - - /* add 100 to start, set stop to 300, stop clips to 200 */ - gst_segment_set_seek (&segment, 1.0, - GST_FORMAT_BYTES, - GST_SEEK_FLAG_NONE, - GST_SEEK_TYPE_CUR, 100, GST_SEEK_TYPE_SET, 300, &update); - fail_unless (segment.start == 200); - fail_unless (segment.stop == 200); - - /* add 100 to start (to 300), set stop to 200, this clips start - * to duration */ - gst_segment_set_seek (&segment, 1.0, - GST_FORMAT_BYTES, - GST_SEEK_FLAG_NONE, - GST_SEEK_TYPE_CUR, 100, GST_SEEK_TYPE_SET, 200, &update); - fail_unless (segment.start == 200); - fail_unless (segment.stop == 200); - - /* seek relative to end */ - gst_segment_set_seek (&segment, 1.0, - GST_FORMAT_BYTES, - GST_SEEK_FLAG_NONE, - GST_SEEK_TYPE_END, -100, GST_SEEK_TYPE_END, -20, &update); - fail_unless (segment.start == 100); - fail_unless (segment.stop == 180); - - /* completely outside */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 0, 50, &cstart, &cstop); - fail_unless (res == FALSE); - - /* touching lower bound */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 50, 100, &cstart, &cstop); - fail_unless (res == FALSE); - - /* partially inside */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 50, 150, &cstart, &cstop); - fail_unless (res == TRUE); - fail_unless (cstart == 100); - fail_unless (cstop == 150); - - /* inside, touching lower bound */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, - 100, 150, &cstart, &cstop); - fail_unless (res == TRUE); - fail_unless (cstart == 100); - fail_unless (cstop == 150); - - /* completely inside */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, - 150, 170, &cstart, &cstop); - fail_unless (res == TRUE); - fail_unless (cstart == 150); - fail_unless (cstop == 170); - - /* partially inside */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, - 150, 250, &cstart, &cstop); - fail_unless (res == TRUE); - fail_unless (cstart == 150); - fail_unless (cstop == 180); - - /* invalid start */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, -1, 100, &cstart, &cstop); - fail_unless (res == FALSE); - - /* start outside */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 50, -1, &cstart, &cstop); - fail_unless (res == TRUE); - fail_unless (cstart == 100); - fail_unless (cstop == 180); - - /* start on lower bound */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 100, -1, &cstart, &cstop); - fail_unless (res == TRUE); - fail_unless (cstart == 100); - fail_unless (cstop == 180); - - /* start inside */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 150, -1, &cstart, &cstop); - fail_unless (res == TRUE); - fail_unless (cstart == 150); - fail_unless (cstop == 180); - - /* start outside on boundary */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 180, -1, &cstart, &cstop); - fail_unless (res == FALSE); - - /* start completely outside */ - res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 250, -1, &cstart, &cstop); - fail_unless (res == FALSE); -} - -GST_END_TEST; - -/* mess with the segment structure in the bytes format */ -GST_START_TEST (segment_newsegment_open) -{ - GstSegment segment; - - gst_segment_init (&segment, GST_FORMAT_BYTES); - - /* time should also work for starting from 0 */ - gst_segment_set_newsegment (&segment, FALSE, 1.0, GST_FORMAT_TIME, 0, -1, 0); - - fail_unless (segment.rate == 1.0); - fail_unless (segment.format == GST_FORMAT_BYTES); - fail_unless (segment.flags == 0); - fail_unless (segment.start == 0); - fail_unless (segment.stop == -1); - fail_unless (segment.time == 0); - fail_unless (segment.accum == 0); - fail_unless (segment.last_stop == -1); - fail_unless (segment.duration == -1); - - /* we set stop but in the wrong format, stop stays open. */ - gst_segment_set_newsegment (&segment, FALSE, 1.0, GST_FORMAT_TIME, 0, 200, 0); - - fail_unless (segment.start == 0); - fail_unless (segment.stop == -1); - fail_unless (segment.time == 0); - fail_unless (segment.accum == 0); - - /* update, nothing changes */ - gst_segment_set_newsegment (&segment, TRUE, 1.0, GST_FORMAT_BYTES, 0, -1, 0); - - fail_unless (segment.start == 0); - fail_unless (segment.stop == -1); - fail_unless (segment.time == 0); - fail_unless (segment.accum == 0); - - /* update */ - gst_segment_set_newsegment (&segment, TRUE, 1.0, - GST_FORMAT_BYTES, 100, -1, 100); - - fail_unless (segment.start == 100); - fail_unless (segment.stop == -1); - fail_unless (segment.time == 100); - fail_unless (segment.accum == 100); - - /* last_stop unknown, accum does not change */ - gst_segment_set_newsegment (&segment, FALSE, 1.0, GST_FORMAT_BYTES, 0, -1, 0); - - fail_unless (segment.start == 0); - fail_unless (segment.stop == -1); - fail_unless (segment.time == 0); - fail_unless (segment.accum == 100); - - gst_segment_set_last_stop (&segment, GST_FORMAT_BYTES, 200); - - /* last_stop 200, accum changes */ - gst_segment_set_newsegment (&segment, FALSE, 1.0, GST_FORMAT_BYTES, 0, -1, 0); - - fail_unless (segment.start == 0); - fail_unless (segment.stop == -1); - fail_unless (segment.time == 0); - fail_unless (segment.accum == 300); - -} - -GST_END_TEST; - - -/* mess with the segment structure in the bytes format */ -GST_START_TEST (segment_newsegment_closed) -{ - GstSegment segment; - - gst_segment_init (&segment, GST_FORMAT_BYTES); - - gst_segment_set_newsegment (&segment, FALSE, 1.0, - GST_FORMAT_BYTES, 0, 200, 0); - - fail_unless (segment.rate == 1.0); - fail_unless (segment.format == GST_FORMAT_BYTES); - fail_unless (segment.flags == 0); - fail_unless (segment.start == 0); - fail_unless (segment.stop == 200); - fail_unless (segment.time == 0); - fail_unless (segment.accum == 0); - fail_unless (segment.last_stop == -1); - fail_unless (segment.duration == -1); - - /* do an update */ - gst_segment_set_newsegment (&segment, TRUE, 1.0, GST_FORMAT_BYTES, 0, 300, 0); - - fail_unless (segment.start == 0); - fail_unless (segment.stop == 300); - fail_unless (segment.time == 0); - fail_unless (segment.accum == 0); - - /* and a new accumulated one */ - gst_segment_set_newsegment (&segment, FALSE, 1.0, - GST_FORMAT_BYTES, 100, 400, 300); - - fail_unless (segment.start == 100); - fail_unless (segment.stop == 400); - fail_unless (segment.time == 300); - fail_unless (segment.accum == 300); - - /* and a new updated one */ - gst_segment_set_newsegment (&segment, TRUE, 1.0, - GST_FORMAT_BYTES, 100, 500, 300); - - fail_unless (segment.start == 100); - fail_unless (segment.stop == 500); - fail_unless (segment.time == 300); - fail_unless (segment.accum == 300); - - /* and a new partially updated one */ - gst_segment_set_newsegment (&segment, TRUE, 1.0, - GST_FORMAT_BYTES, 200, 500, 400); - - fail_unless (segment.start == 200); - fail_unless (segment.stop == 500); - fail_unless (segment.time == 400); - fail_unless (segment.accum == 400); -} - -GST_END_TEST; - -Suite * -gstsegments_suite (void) -{ - Suite *s = suite_create ("GstSegment"); - TCase *tc_chain = tcase_create ("segments"); - - tcase_set_timeout (tc_chain, 20); - - suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, segment_seek_nosize); - tcase_add_test (tc_chain, segment_seek_size); - tcase_add_test (tc_chain, segment_newsegment_open); - tcase_add_test (tc_chain, segment_newsegment_closed); - return s; -} - -int -main (int argc, char **argv) -{ - int nf; - - Suite *s = gstsegments_suite (); - SRunner *sr = srunner_create (s); - - gst_check_init (&argc, &argv); - - srunner_run_all (sr, CK_NORMAL); - nf = srunner_ntests_failed (sr); - srunner_free (sr); - - return nf; -} diff --git a/check/gst/gststructure.c b/check/gst/gststructure.c deleted file mode 100644 index e775de24e3..0000000000 --- a/check/gst/gststructure.c +++ /dev/null @@ -1,171 +0,0 @@ -/* GStreamer - * Copyright (C) <2005> Thomas Vander Stichele - * - * gststructure.c: Unit tests for GstStructure - * - * 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_START_TEST (test_from_string_int) -{ - const char *strings[] = { - "video/x-raw-rgb, width = (int) 123456", - "video/x-raw-rgb, stride = (int) -123456", - "video/x-raw-rgb, red_mask = (int) 0xFFFF", - "video/x-raw-rgb, red_mask = (int) 0x0000FFFF", - "video/x-raw-rgb, red_mask = (int) 0x7FFFFFFF", - "video/x-raw-rgb, red_mask = (int) 0x80000000", - "video/x-raw-rgb, red_mask = (int) 0xFF000000", - /* result from - * gst-launch ... ! "video/x-raw-rgb, red_mask=(int)0xFF000000" ! ... */ - "video/x-raw-rgb,\\ red_mask=(int)0xFF000000", - }; - gint results[] = { - 123456, - -123456, - 0xFFFF, - 0xFFFF, - 0x7FFFFFFF, - 0x80000000, - 0xFF000000, - 0xFF000000, - }; - GstStructure *structure; - int i; - - for (i = 0; i < G_N_ELEMENTS (strings); ++i) { - const char *s; - const gchar *name; - gint value; - - s = strings[i]; - - structure = gst_structure_from_string (s, NULL); - fail_if (structure == NULL, "Could not get structure from string %s", s); - name = gst_structure_nth_field_name (structure, 0); - fail_unless (gst_structure_get_int (structure, name, &value)); - fail_unless (value == results[i], - "Value %d is not the expected result %d for string %s", - value, results[i], s); - - /* cleanup */ - gst_structure_free (structure); - } -} - -GST_END_TEST; - -/* Test type conversions from string */ -GST_START_TEST (test_from_string) -{ - GstStructure *structure; - const gchar *s; - const GValue *val; - - s = "test-string,value=1"; - structure = gst_structure_from_string (s, NULL); - fail_if (structure == NULL, "Could not get structure from string %s", s); - fail_unless ((val = gst_structure_get_value (structure, "value")) != NULL); - fail_unless (G_VALUE_HOLDS_INT (val)); - gst_structure_free (structure); - - s = "test-string,value=1.0"; - structure = gst_structure_from_string (s, NULL); - fail_if (structure == NULL, "Could not get structure from string %s", s); - fail_unless ((val = gst_structure_get_value (structure, "value")) != NULL); - fail_unless (G_VALUE_HOLDS_DOUBLE (val)); - gst_structure_free (structure); - - s = "test-string,value=1/1"; - structure = gst_structure_from_string (s, NULL); - fail_if (structure == NULL, "Could not get structure from string %s", s); - fail_unless ((val = gst_structure_get_value (structure, "value")) != NULL); - fail_unless (GST_VALUE_HOLDS_FRACTION (val)); - gst_structure_free (structure); - - s = "test-string,value=bar"; - structure = gst_structure_from_string (s, NULL); - fail_if (structure == NULL, "Could not get structure from string %s", s); - fail_unless ((val = gst_structure_get_value (structure, "value")) != NULL); - fail_unless (G_VALUE_HOLDS_STRING (val)); - gst_structure_free (structure); -} - -GST_END_TEST; - -Suite * -gst_value_suite (void) -{ - Suite *s = suite_create ("GstStructure"); - TCase *tc_chain = tcase_create ("general"); - - suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, test_from_string_int); - return s; -} - -GST_START_TEST (test_structure_new) -{ - GstStructure *s; - GError *e; - GQuark domain; - - s = gst_structure_new ("name", "key", G_TYPE_STRING, "value", NULL); - fail_unless (strcmp (gst_structure_get_string (s, "key"), "value") == 0); - gst_structure_free (s); - - domain = g_quark_from_string ("test"); - e = g_error_new (domain, 0, "a test error"); - s = gst_structure_new ("name", "key", GST_TYPE_G_ERROR, e, NULL); - g_error_free (e); - gst_structure_free (s); -} - -GST_END_TEST; - -Suite * -gst_structure_suite (void) -{ - Suite *s = suite_create ("GstStructure"); - TCase *tc_chain = tcase_create ("general"); - - suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, test_from_string_int); - tcase_add_test (tc_chain, test_from_string); - tcase_add_test (tc_chain, test_structure_new); - return s; -} - -int -main (int argc, char **argv) -{ - int nf; - - Suite *s = gst_structure_suite (); - SRunner *sr = srunner_create (s); - - gst_check_init (&argc, &argv); - - srunner_run_all (sr, CK_NORMAL); - nf = srunner_ntests_failed (sr); - srunner_free (sr); - - return nf; -} diff --git a/check/gst/gstsystemclock.c b/check/gst/gstsystemclock.c deleted file mode 100644 index 14baaf0a14..0000000000 --- a/check/gst/gstsystemclock.c +++ /dev/null @@ -1,220 +0,0 @@ -/* GStreamer - * Copyright (C) 2005 Wim Taymans - * - * gstsystemclock.c: Unit test for GstSystemClock - * - * 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_START_TEST (test_signedness) -{ - GstClockTime time[] = { 0, 1, G_MAXUINT64 / GST_SECOND }; - GstClockTimeDiff diff[] = - { 0, 1, -1, G_MAXINT64 / GST_SECOND, G_MININT64 / GST_SECOND }; - guint i; - - for (i = 0; i < G_N_ELEMENTS (time); i++) { - fail_if (time[i] != (time[i] * GST_SECOND / GST_SECOND)); - } - for (i = 0; i < G_N_ELEMENTS (diff); i++) { - fail_if (diff[i] != (diff[i] * GST_SECOND / GST_SECOND)); - } -} - -GST_END_TEST -#define TIME_UNIT (GST_SECOND / 5) - static void -gst_clock_debug (GstClock * clock) -{ - GstClockTime time; - - time = gst_clock_get_time (clock); - g_message ("Clock info: time %" G_GUINT64_FORMAT "\n", time); -} - -static gboolean -ok_callback (GstClock * clock, GstClockTime time, - GstClockID id, gpointer user_data) -{ - g_message ("unlocked async id %p\n", id); - return FALSE; -} - -static gboolean -error_callback (GstClock * clock, GstClockTime time, - GstClockID id, gpointer user_data) -{ - g_message ("unlocked unscheduled async id %p, this is wrong\n", id); - fail_if (TRUE); - - return FALSE; -} - -GST_START_TEST (test_single_shot) -{ - GstClock *clock; - GstClockID id, id2; - GstClockTime base; - GstClockReturn result; - - clock = gst_system_clock_obtain (); - fail_unless (clock != NULL, "Could not create instance of GstSystemClock"); - - gst_clock_debug (clock); - base = gst_clock_get_time (clock); - - id = gst_clock_new_single_shot_id (clock, base + TIME_UNIT); - fail_unless (id != NULL, "Could not create single shot id"); - - g_message ("waiting one second\n"); - result = gst_clock_id_wait (id, NULL); - gst_clock_debug (clock); - fail_unless (result == GST_CLOCK_OK, "Waiting did not return OK"); - - g_message ("waiting in the past\n"); - result = gst_clock_id_wait (id, NULL); - gst_clock_debug (clock); - fail_unless (result == GST_CLOCK_EARLY, "Waiting did not return EARLY"); - gst_clock_id_unref (id); - - id = gst_clock_new_single_shot_id (clock, base + 2 * TIME_UNIT); - g_message ("waiting one second async id %p\n", id); - result = gst_clock_id_wait_async (id, ok_callback, NULL); - gst_clock_id_unref (id); - fail_unless (result == GST_CLOCK_OK, "Waiting did not return OK"); - g_usleep (TIME_UNIT / (2 * 1000)); - - id = gst_clock_new_single_shot_id (clock, base + 5 * TIME_UNIT); - g_message ("waiting one second async, with cancel on id %p\n", id); - result = gst_clock_id_wait_async (id, error_callback, NULL); - fail_unless (result == GST_CLOCK_OK, "Waiting did not return OK"); - g_usleep (TIME_UNIT / (2 * 1000)); - g_message ("cancel id %p after half a time unit\n", id); - gst_clock_id_unschedule (id); - gst_clock_id_unref (id); - g_message ("canceled id %p\n", id); - - g_message ("waiting multiple one second async, with cancel\n"); - id = gst_clock_new_single_shot_id (clock, base + 5 * TIME_UNIT); - id2 = gst_clock_new_single_shot_id (clock, base + 6 * TIME_UNIT); - g_message ("waiting id %p\n", id); - result = gst_clock_id_wait_async (id, ok_callback, NULL); - fail_unless (result == GST_CLOCK_OK, "Waiting did not return OK"); - gst_clock_id_unref (id); - g_message ("waiting id %p\n", id2); - result = gst_clock_id_wait_async (id2, error_callback, NULL); - fail_unless (result == GST_CLOCK_OK, "Waiting did not return OK"); - g_usleep (TIME_UNIT / (2 * 1000)); - g_message ("cancel id %p after half a time unit\n", id2); - gst_clock_id_unschedule (id2); - g_message ("canceled id %p\n", id2); - gst_clock_id_unref (id2); - g_usleep (TIME_UNIT / (2 * 1000)); -} - -GST_END_TEST -GST_START_TEST (test_periodic_shot) -{ - GstClock *clock; - GstClockID id, id2; - GstClockTime base; - GstClockReturn result; - - clock = gst_system_clock_obtain (); - fail_unless (clock != NULL, "Could not create instance of GstSystemClock"); - - gst_clock_debug (clock); - base = gst_clock_get_time (clock); - - /* signal every half a time unit */ - id = gst_clock_new_periodic_id (clock, base + TIME_UNIT, TIME_UNIT / 2); - fail_unless (id != NULL, "Could not create periodic id"); - - g_message ("waiting one time unit\n"); - result = gst_clock_id_wait (id, NULL); - gst_clock_debug (clock); - fail_unless (result == GST_CLOCK_OK, "Waiting did not return OK"); - - g_message ("waiting for the next\n"); - result = gst_clock_id_wait (id, NULL); - gst_clock_debug (clock); - fail_unless (result == GST_CLOCK_OK, "Waiting did not return OK"); - - g_message ("waiting for the next async %p\n", id); - result = gst_clock_id_wait_async (id, ok_callback, NULL); - fail_unless (result == GST_CLOCK_OK, "Waiting did not return OK"); - g_usleep (TIME_UNIT / (2 * 1000)); - - g_message ("waiting some more for the next async %p\n", id); - result = gst_clock_id_wait_async (id, ok_callback, NULL); - fail_unless (result == GST_CLOCK_OK, "Waiting did not return OK"); - g_usleep (TIME_UNIT / (2 * 1000)); - - id2 = gst_clock_new_periodic_id (clock, base + TIME_UNIT, TIME_UNIT / 2); - fail_unless (id2 != NULL, "Could not create second periodic id"); - - g_message ("waiting some more for another async %p\n", id2); - result = gst_clock_id_wait_async (id2, ok_callback, NULL); - fail_unless (result == GST_CLOCK_OK, "Waiting did not return OK"); - g_usleep (TIME_UNIT / (2 * 1000)); - - g_message ("unschedule %p\n", id); - gst_clock_id_unschedule (id); - - /* entry cannot be used again */ - result = gst_clock_id_wait_async (id, error_callback, NULL); - fail_unless (result == GST_CLOCK_UNSCHEDULED, - "Waiting did not return UNSCHEDULED"); - result = gst_clock_id_wait (id, NULL); - fail_unless (result == GST_CLOCK_UNSCHEDULED, - "Waiting did not return UNSCHEDULED"); - g_usleep (TIME_UNIT / (2 * 1000)); - - /* clean up */ - gst_clock_id_unref (id); -} - -GST_END_TEST Suite * gst_systemclock_suite (void) -{ - Suite *s = suite_create ("GstSystemClock"); - TCase *tc_chain = tcase_create ("waiting"); - - suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, test_signedness); - tcase_add_test (tc_chain, test_single_shot); - tcase_add_test (tc_chain, test_periodic_shot); - - return s; -} - -int -main (int argc, char **argv) -{ - int nf; - - Suite *s = gst_systemclock_suite (); - SRunner *sr = srunner_create (s); - - gst_check_init (&argc, &argv); - - srunner_run_all (sr, CK_NORMAL); - nf = srunner_ntests_failed (sr); - srunner_free (sr); - - return nf; -} diff --git a/check/gst/gsttag.c b/check/gst/gsttag.c deleted file mode 100644 index 1fab1df2ee..0000000000 --- a/check/gst/gsttag.c +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright (C) 2003 Benjamin Otte - * - * 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 - -#include - -/* multiple artists are possible */ -#define UTAG GST_TAG_ARTIST -#define UNFIXED1 "Britney Spears" -#define UNFIXED2 "Evanescence" -#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_tags (const GstTagList * list, const gchar * tag, gchar * value, ...) -{ - va_list args; - gchar *str; - guint i = 0; - - va_start (args, value); - while (value != NULL) { - fail_unless (gst_tag_list_get_string_index (list, tag, i, &str)); - fail_unless (strcmp (value, str) == 0); - g_free (str); - - value = va_arg (args, gchar *); - i++; - } - fail_unless (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; - - -GST_START_TEST (test_merge) -{ - GstTagList *list = NULL, *list2 = NULL, *merge = NULL; - - /* make sure the assumptions work */ - fail_unless (gst_tag_is_fixed (FTAG)); - fail_unless (!gst_tag_is_fixed (UTAG)); - /* we check string here only */ - fail_unless (gst_tag_get_type (FTAG) == G_TYPE_STRING); - fail_unless (gst_tag_get_type (UTAG) == G_TYPE_STRING); - - /* check additions */ - - /* unfixed */ - NEW_LIST_UNFIXED (GST_TAG_MERGE_REPLACE_ALL); - check_tags (list, UTAG, UNFIXED4, NULL); - NEW_LIST_UNFIXED (GST_TAG_MERGE_REPLACE); - check_tags (list, UTAG, UNFIXED4, NULL); - NEW_LIST_UNFIXED (GST_TAG_MERGE_PREPEND); - check_tags (list, UTAG, UNFIXED4, UNFIXED3, UNFIXED2, UNFIXED1, NULL); - NEW_LIST_UNFIXED (GST_TAG_MERGE_APPEND); - check_tags (list, UTAG, UNFIXED1, UNFIXED2, UNFIXED3, UNFIXED4, NULL); - NEW_LIST_UNFIXED (GST_TAG_MERGE_KEEP); - check_tags (list, UTAG, UNFIXED1, NULL); - NEW_LIST_UNFIXED (GST_TAG_MERGE_KEEP_ALL); - check_tags (list, UTAG, NULL); - - /* fixed */ - NEW_LIST_FIXED (GST_TAG_MERGE_REPLACE_ALL); - check_tags (list, FTAG, FIXED4, NULL); - NEW_LIST_FIXED (GST_TAG_MERGE_REPLACE); - check_tags (list, FTAG, FIXED4, NULL); - NEW_LIST_FIXED (GST_TAG_MERGE_PREPEND); - check_tags (list, FTAG, FIXED4, NULL); - NEW_LIST_FIXED (GST_TAG_MERGE_APPEND); - check_tags (list, FTAG, FIXED1, NULL); - NEW_LIST_FIXED (GST_TAG_MERGE_KEEP); - check_tags (list, FTAG, FIXED1, NULL); - NEW_LIST_FIXED (GST_TAG_MERGE_KEEP_ALL); - check_tags (list, FTAG, NULL); - - /* check merging */ - /* unfixed */ - NEW_LISTS_UNFIXED (GST_TAG_MERGE_REPLACE_ALL); - check_tags (merge, UTAG, UNFIXED3, UNFIXED4, NULL); - NEW_LISTS_UNFIXED (GST_TAG_MERGE_REPLACE); - check_tags (merge, UTAG, UNFIXED3, UNFIXED4, NULL); - NEW_LISTS_UNFIXED (GST_TAG_MERGE_PREPEND); - check_tags (merge, UTAG, UNFIXED3, UNFIXED4, UNFIXED1, UNFIXED2, NULL); - NEW_LISTS_UNFIXED (GST_TAG_MERGE_APPEND); - check_tags (merge, UTAG, UNFIXED1, UNFIXED2, UNFIXED3, UNFIXED4, NULL); - NEW_LISTS_UNFIXED (GST_TAG_MERGE_KEEP); - check_tags (merge, UTAG, UNFIXED1, UNFIXED2, NULL); - NEW_LISTS_UNFIXED (GST_TAG_MERGE_KEEP_ALL); - check_tags (merge, UTAG, UNFIXED1, UNFIXED2, NULL); - - /* fixed */ - NEW_LISTS_FIXED (GST_TAG_MERGE_REPLACE_ALL); - check_tags (merge, FTAG, FIXED3, NULL); - NEW_LISTS_FIXED (GST_TAG_MERGE_REPLACE); - check_tags (merge, FTAG, FIXED3, NULL); - NEW_LISTS_FIXED (GST_TAG_MERGE_PREPEND); - check_tags (merge, FTAG, FIXED3, NULL); - NEW_LISTS_FIXED (GST_TAG_MERGE_APPEND); - check_tags (merge, FTAG, FIXED1, NULL); - NEW_LISTS_FIXED (GST_TAG_MERGE_KEEP); - check_tags (merge, FTAG, FIXED1, NULL); - NEW_LISTS_FIXED (GST_TAG_MERGE_KEEP_ALL); - check_tags (merge, FTAG, FIXED1, NULL); - - /* clean up */ - if (list) - gst_tag_list_free (list); - if (list2) - gst_tag_list_free (list2); - if (merge) - gst_tag_list_free (merge); -} - -GST_END_TEST -GST_START_TEST (test_date_tags) -{ - GstTagList *tag_list, *tag_list2; - GDate *date, *date2; - gchar *str; - - date = g_date_new_dmy (14, 10, 2005); - tag_list = gst_tag_list_new (); - gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND, GST_TAG_DATE, date, NULL); - - str = gst_structure_to_string (tag_list); - fail_if (str == NULL); - fail_if (strstr (str, "2005-10-14") == NULL); - - tag_list2 = gst_structure_from_string (str, NULL); - fail_if (tag_list2 == NULL); - fail_if (!gst_tag_list_get_date (tag_list2, GST_TAG_DATE, &date2)); - gst_tag_list_free (tag_list2); - g_free (str); - - fail_if (g_date_compare (date, date2) != 0); - fail_if (g_date_get_day (date) != 14); - fail_if (g_date_get_month (date) != 10); - fail_if (g_date_get_year (date) != 2005); - fail_if (g_date_get_day (date2) != 14); - fail_if (g_date_get_month (date2) != 10); - fail_if (g_date_get_year (date2) != 2005); - g_date_free (date2); - - gst_tag_list_free (tag_list); - g_date_free (date); -} -GST_END_TEST Suite * gst_tag_suite (void) -{ - Suite *s = suite_create ("GstTag"); - TCase *tc_chain = tcase_create ("general"); - - suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, test_merge); - tcase_add_test (tc_chain, test_date_tags); - - return s; -} - -int -main (int argc, char **argv) -{ - int nf; - - Suite *s = gst_tag_suite (); - SRunner *sr = srunner_create (s); - - gst_check_init (&argc, &argv); - - srunner_run_all (sr, CK_NORMAL); - nf = srunner_ntests_failed (sr); - srunner_free (sr); - - return nf; -} diff --git a/check/gst/gstutils.c b/check/gst/gstutils.c deleted file mode 100644 index 2812420e3f..0000000000 --- a/check/gst/gstutils.c +++ /dev/null @@ -1,305 +0,0 @@ -/* GStreamer - * Copyright (C) <2005> Thomas Vander Stichele - * - * gstutils.c: Unit test for functions in gstutils - * - * 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 SPECIAL_POINTER(x) ((void*)(19283847+(x))) - -static int n_data_probes = 0; -static int n_buffer_probes = 0; -static int n_event_probes = 0; - -static gboolean -data_probe (GstPad * pad, GstMiniObject * obj, gpointer data) -{ - n_data_probes++; - g_assert (GST_IS_MINI_OBJECT (obj)); - g_assert (data == SPECIAL_POINTER (0)); - return TRUE; -} - -static gboolean -buffer_probe (GstPad * pad, GstBuffer * obj, gpointer data) -{ - n_buffer_probes++; - g_assert (GST_IS_BUFFER (obj)); - g_assert (data == SPECIAL_POINTER (1)); - return TRUE; -} - -static gboolean -event_probe (GstPad * pad, GstEvent * obj, gpointer data) -{ - n_event_probes++; - g_assert (GST_IS_EVENT (obj)); - g_assert (data == SPECIAL_POINTER (2)); - return TRUE; -} - -GST_START_TEST (test_buffer_probe_n_times) -{ - GstElement *pipeline, *fakesrc, *fakesink; - GstBus *bus; - GstMessage *message; - GstPad *pad; - - pipeline = gst_element_factory_make ("pipeline", NULL); - fakesrc = gst_element_factory_make ("fakesrc", NULL); - fakesink = gst_element_factory_make ("fakesink", NULL); - - g_object_set (fakesrc, "num-buffers", (int) 10, NULL); - - gst_bin_add_many (GST_BIN (pipeline), fakesrc, fakesink, NULL); - gst_element_link (fakesrc, fakesink); - - pad = gst_element_get_pad (fakesink, "sink"); - gst_pad_add_data_probe (pad, G_CALLBACK (data_probe), SPECIAL_POINTER (0)); - gst_pad_add_buffer_probe (pad, G_CALLBACK (buffer_probe), - SPECIAL_POINTER (1)); - gst_pad_add_event_probe (pad, G_CALLBACK (event_probe), SPECIAL_POINTER (2)); - gst_object_unref (pad); - - gst_element_set_state (pipeline, GST_STATE_PLAYING); - - bus = gst_element_get_bus (pipeline); - message = gst_bus_poll (bus, GST_MESSAGE_EOS, -1); - gst_message_unref (message); - gst_object_unref (bus); - - gst_element_set_state (pipeline, GST_STATE_NULL); - gst_object_unref (pipeline); - - g_assert (n_buffer_probes == 10); /* one for every buffer */ - g_assert (n_event_probes == 2); /* new segment and eos */ - g_assert (n_data_probes == 12); /* duh */ -} GST_END_TEST; - -static int n_data_probes_once = 0; -static int n_buffer_probes_once = 0; -static int n_event_probes_once = 0; - -static gboolean -data_probe_once (GstPad * pad, GstMiniObject * obj, guint * data) -{ - n_data_probes_once++; - g_assert (GST_IS_MINI_OBJECT (obj)); - - gst_pad_remove_data_probe (pad, *data); - - return TRUE; -} - -static gboolean -buffer_probe_once (GstPad * pad, GstBuffer * obj, guint * data) -{ - n_buffer_probes_once++; - g_assert (GST_IS_BUFFER (obj)); - - gst_pad_remove_buffer_probe (pad, *data); - - return TRUE; -} - -static gboolean -event_probe_once (GstPad * pad, GstEvent * obj, guint * data) -{ - n_event_probes_once++; - g_assert (GST_IS_EVENT (obj)); - - gst_pad_remove_event_probe (pad, *data); - - return TRUE; -} - -GST_START_TEST (test_buffer_probe_once) -{ - GstElement *pipeline, *fakesrc, *fakesink; - GstBus *bus; - GstMessage *message; - GstPad *pad; - guint id1, id2, id3; - - pipeline = gst_element_factory_make ("pipeline", NULL); - fakesrc = gst_element_factory_make ("fakesrc", NULL); - fakesink = gst_element_factory_make ("fakesink", NULL); - - g_object_set (fakesrc, "num-buffers", (int) 10, NULL); - - gst_bin_add_many (GST_BIN (pipeline), fakesrc, fakesink, NULL); - gst_element_link (fakesrc, fakesink); - - pad = gst_element_get_pad (fakesink, "sink"); - id1 = gst_pad_add_data_probe (pad, G_CALLBACK (data_probe_once), &id1); - id2 = gst_pad_add_buffer_probe (pad, G_CALLBACK (buffer_probe_once), &id2); - id3 = gst_pad_add_event_probe (pad, G_CALLBACK (event_probe_once), &id3); - gst_object_unref (pad); - - gst_element_set_state (pipeline, GST_STATE_PLAYING); - - bus = gst_element_get_bus (pipeline); - message = gst_bus_poll (bus, GST_MESSAGE_EOS, -1); - gst_message_unref (message); - gst_object_unref (bus); - - gst_element_set_state (pipeline, GST_STATE_NULL); - gst_object_unref (pipeline); - - g_assert (n_buffer_probes_once == 1); /* can we hit it and quit? */ - g_assert (n_event_probes_once == 1); /* i said, can we hit it and quit? */ - g_assert (n_data_probes_once == 1); /* let's hit it and quit!!! */ -} GST_END_TEST; - -GST_START_TEST (test_math_scale) -{ - fail_if (gst_util_uint64_scale_int (1, 1, 1) != 1); - - fail_if (gst_util_uint64_scale_int (10, 10, 1) != 100); - fail_if (gst_util_uint64_scale_int (10, 10, 2) != 50); - - fail_if (gst_util_uint64_scale_int (0, 10, 2) != 0); - fail_if (gst_util_uint64_scale_int (0, 0, 2) != 0); - - fail_if (gst_util_uint64_scale_int (G_MAXUINT32, 5, 1) != G_MAXUINT32 * 5LL); - fail_if (gst_util_uint64_scale_int (G_MAXUINT32, 10, 2) != G_MAXUINT32 * 5LL); - - fail_if (gst_util_uint64_scale_int (G_MAXUINT32, 1, 5) != G_MAXUINT32 / 5LL); - fail_if (gst_util_uint64_scale_int (G_MAXUINT32, 2, 10) != G_MAXUINT32 / 5LL); - - /* not quite overflow */ - fail_if (gst_util_uint64_scale_int (G_MAXUINT64 - 1, 10, - 10) != G_MAXUINT64 - 1); - fail_if (gst_util_uint64_scale_int (G_MAXUINT64 - 1, G_MAXINT32, - G_MAXINT32) != G_MAXUINT64 - 1); - fail_if (gst_util_uint64_scale_int (G_MAXUINT64 - 100, G_MAXINT32, - G_MAXINT32) != G_MAXUINT64 - 100); - - /* overflow */ - fail_if (gst_util_uint64_scale_int (G_MAXUINT64 - 1, 10, 1) != G_MAXUINT64); - fail_if (gst_util_uint64_scale_int (G_MAXUINT64 - 1, G_MAXINT32, - 1) != G_MAXUINT64); - -} GST_END_TEST; - -GST_START_TEST (test_math_scale_uint64) -{ - fail_if (gst_util_uint64_scale (1, 1, 1) != 1); - - fail_if (gst_util_uint64_scale (10, 10, 1) != 100); - fail_if (gst_util_uint64_scale (10, 10, 2) != 50); - - fail_if (gst_util_uint64_scale (0, 10, 2) != 0); - fail_if (gst_util_uint64_scale (0, 0, 2) != 0); - - fail_if (gst_util_uint64_scale (G_MAXUINT32, 5, 1) != G_MAXUINT32 * 5LL); - fail_if (gst_util_uint64_scale (G_MAXUINT32, 10, 2) != G_MAXUINT32 * 5LL); - - fail_if (gst_util_uint64_scale (G_MAXUINT32, 1, 5) != G_MAXUINT32 / 5LL); - fail_if (gst_util_uint64_scale (G_MAXUINT32, 2, 10) != G_MAXUINT32 / 5LL); - - /* not quite overflow */ - fail_if (gst_util_uint64_scale (G_MAXUINT64 - 1, 10, 10) != G_MAXUINT64 - 1); - fail_if (gst_util_uint64_scale (G_MAXUINT64 - 1, G_MAXUINT32, - G_MAXUINT32) != G_MAXUINT64 - 1); - fail_if (gst_util_uint64_scale (G_MAXUINT64 - 100, G_MAXUINT32, - G_MAXUINT32) != G_MAXUINT64 - 100); - - fail_if (gst_util_uint64_scale (G_MAXUINT64 - 1, 10, 10) != G_MAXUINT64 - 1); - fail_if (gst_util_uint64_scale (G_MAXUINT64 - 1, G_MAXUINT64, - G_MAXUINT64) != G_MAXUINT64 - 1); - fail_if (gst_util_uint64_scale (G_MAXUINT64 - 100, G_MAXUINT64, - G_MAXUINT64) != G_MAXUINT64 - 100); - - /* overflow */ - fail_if (gst_util_uint64_scale (G_MAXUINT64 - 1, 10, 1) != G_MAXUINT64); - fail_if (gst_util_uint64_scale (G_MAXUINT64 - 1, G_MAXUINT64, - 1) != G_MAXUINT64); - -} GST_END_TEST; - -GST_START_TEST (test_math_scale_random) -{ - guint64 val, num, denom, res; - GRand *rand; - gint i; - - rand = g_rand_new (); - - i = 1000000; - while (i--) { - guint64 check, diff; - - val = ((guint64) g_rand_int (rand)) << 32 | g_rand_int (rand); - num = ((guint64) g_rand_int (rand)) << 32 | g_rand_int (rand); - denom = ((guint64) g_rand_int (rand)) << 32 | g_rand_int (rand); - - res = gst_util_uint64_scale (val, num, denom); - check = gst_gdouble_to_guint64 (gst_guint64_to_gdouble (val) * - gst_guint64_to_gdouble (num) / gst_guint64_to_gdouble (denom)); - - if (res < G_MAXUINT64 && check < G_MAXUINT64) { - if (res > check) - diff = res - check; - else - diff = check - res; - - /* some arbitrary value, really.. someone do the proper math to get - * the upper bound */ - if (diff > 20000) - fail_if (diff > 20000); - } - } - g_rand_free (rand); - -} - -GST_END_TEST; - -Suite * -gst_utils_suite (void) -{ - Suite *s = suite_create ("GstUtils"); - TCase *tc_chain = tcase_create ("general"); - - suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, test_buffer_probe_n_times); - tcase_add_test (tc_chain, test_buffer_probe_once); - tcase_add_test (tc_chain, test_math_scale); - tcase_add_test (tc_chain, test_math_scale_uint64); - tcase_add_test (tc_chain, test_math_scale_random); - return s; -} - -int -main (int argc, char **argv) -{ - int nf; - - Suite *s = gst_utils_suite (); - SRunner *sr = srunner_create (s); - - gst_check_init (&argc, &argv); - - srunner_run_all (sr, CK_NORMAL); - nf = srunner_ntests_failed (sr); - srunner_free (sr); - - return nf; -} diff --git a/check/gst/gstvalue.c b/check/gst/gstvalue.c deleted file mode 100644 index 32992dc14a..0000000000 --- a/check/gst/gstvalue.c +++ /dev/null @@ -1,1407 +0,0 @@ -/* GStreamer - * Copyright (C) <2004> David Schleef - * Copyright (C) <2005> Thomas Vander Stichele - * - * gstvalue.c: Unit tests for GstValue - * - * 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_START_TEST (test_deserialize_buffer) -{ - GValue value = { 0 }; - GstBuffer *buf; - - g_value_init (&value, GST_TYPE_BUFFER); - fail_unless (gst_value_deserialize (&value, "1234567890abcdef")); - buf = GST_BUFFER (gst_value_get_mini_object (&value)); - - ASSERT_MINI_OBJECT_REFCOUNT (buf, "buffer", 1); - - /* cleanup */ - gst_buffer_unref (buf); -} - -GST_END_TEST; - -GST_START_TEST (test_deserialize_gint64) -{ - GValue value = { 0 }; - const char *strings[] = { - "12345678901", - "-12345678901", - }; - gint64 results[] = { - 12345678901LL, - -12345678901LL, - }; - int i; - - g_value_init (&value, G_TYPE_INT64); - - for (i = 0; i < G_N_ELEMENTS (strings); ++i) { - fail_unless (gst_value_deserialize (&value, strings[i]), - "could not deserialize %s (%d)", strings[i], i); - fail_unless (g_value_get_int64 (&value) == results[i], - "resulting value is %" G_GINT64_FORMAT ", not %" G_GINT64_FORMAT - ", for string %s (%d)", g_value_get_int64 (&value), - results[i], strings[i], i); - } -} - -GST_END_TEST; - -GST_START_TEST (test_deserialize_gstfraction) -{ - GValue value = { 0 }; - const char *strings[] = { - "4/5", - "-8/9" - }; - gint64 result_numers[] = { - 4, - -8 - }; - gint64 result_denoms[] = { - 5, - 9 - }; - - int i; - - g_value_init (&value, GST_TYPE_FRACTION); - for (i = 0; i < G_N_ELEMENTS (strings); ++i) { - fail_unless (gst_value_deserialize (&value, strings[i]), - "could not deserialize %s (%d)", strings[i], i); - fail_unless (gst_value_get_fraction_numerator (&value) == result_numers[i], - "resulting numerator value is %d, not %d" - ", for string %s (%d)", gst_value_get_fraction_numerator (&value), - result_numers[i], strings[i], i); - fail_unless (gst_value_get_fraction_denominator (&value) == - result_denoms[i], "resulting denominator value is %d, not %d" - ", for string %s (%d)", gst_value_get_fraction_denominator (&value), - result_denoms[i], strings[i], i); - } -} - -GST_END_TEST; - -GST_START_TEST (test_deserialize_gint) -{ - GValue value = { 0 }; - const char *strings[] = { - "123456", - "-123456", - "0xFFFF", - "0x0000FFFF", - /* a positive long long, serializing to highest possible positive sint */ - "0x7FFFFFFF", - /* a positive long long, serializing to lowest possible negative sint */ - "0x80000000", - /* a negative long long, serializing to lowest possible negative sint */ - "0xFFFFFFFF80000000", - "0xFF000000", - /* a positive long long serializing to -1 */ - "0xFFFFFFFF", - "0xFFFFFFFF", - /* a negative long long serializing to -1 */ - "0xFFFFFFFFFFFFFFFF", - "0xFFFFFFFFFFFFFFFF", - "0xEFFFFFFF", - }; - gint results[] = { - 123456, - -123456, - 0xFFFF, - 0xFFFF, - 0x7FFFFFFF, - 0x80000000, - 0x80000000, - 0xFF000000, - -1, - 0xFFFFFFFF, - -1, - /* cast needs to be explicit because of unsigned -> signed */ - (gint) 0xFFFFFFFFFFFFFFFFLL, - 0xEFFFFFFF, - }; - int i; - - g_value_init (&value, G_TYPE_INT); - - for (i = 0; i < G_N_ELEMENTS (strings); ++i) { - fail_unless (gst_value_deserialize (&value, strings[i]), - "could not deserialize %s (%d)", strings[i], i); - fail_unless (g_value_get_int (&value) == results[i], - "resulting value is %d, not %d, for string %s (%d)", - g_value_get_int (&value), results[i], strings[i], i); - } -} - -GST_END_TEST; - -GST_START_TEST (test_deserialize_gint_failures) -{ - GValue value = { 0 }; - const char *strings[] = { - "-", /* not a complete number */ - "- TEST", /* not a complete number */ - "0x0000000100000000", /* lowest long long that cannot fit in 32 bits */ - "0xF000000000000000", - "0xFFFFFFF000000000", - "0xFFFFFFFF00000000", - "0x10000000000000000", /* first number too long to fit into a long long */ - /* invent a new processor first before trying to make this one pass */ - "0x10000000000000000000000000000000000000000000", - }; - int i; - - g_value_init (&value, G_TYPE_INT); - - for (i = 0; i < G_N_ELEMENTS (strings); ++i) { - fail_if (gst_value_deserialize (&value, strings[i]), - "deserialized %s (%d), while it should have failed", strings[i], i); - } -} - -GST_END_TEST; - -GST_START_TEST (test_deserialize_guint) -{ - GValue value = { 0 }; - const char *strings[] = { - "123456", - "-123456", - "0xFFFF", - "0x0000FFFF", - /* a positive long long, serializing to highest possible positive sint */ - "0x7FFFFFFF", - /* a positive long long, serializing to lowest possible negative sint */ - "0x80000000", - "2147483648", - /* a negative long long, serializing to lowest possible negative sint */ - "0xFFFFFFFF80000000", - /* a value typically used for rgb masks */ - "0xFF000000", - /* a positive long long serializing to highest possible positive uint */ - "0xFFFFFFFF", - "0xFFFFFFFF", - /* a negative long long serializing to highest possible positive uint */ - "0xFFFFFFFFFFFFFFFF", - "0xEFFFFFFF", - }; - guint results[] = { - 123456, - -123456, - 0xFFFF, - 0xFFFF, - 0x7FFFFFFF, - 0x80000000, - (guint) 2147483648LL, - 0x80000000, - 0xFF000000, - 0xFFFFFFFF, - G_MAXUINT, - (guint) 0xFFFFFFFFFFFFFFFFLL, - 0xEFFFFFFF, - }; - int i; - - g_value_init (&value, G_TYPE_UINT); - - for (i = 0; i < G_N_ELEMENTS (strings); ++i) { - fail_unless (gst_value_deserialize (&value, strings[i]), - "could not deserialize %s (%d)", strings[i], i); - fail_unless (g_value_get_uint (&value) == results[i], - "resulting value is %d, not %d, for string %s (%d)", - g_value_get_uint (&value), results[i], strings[i], i); - } -} - -GST_END_TEST; - -GST_START_TEST (test_deserialize_guint_failures) -{ - GValue value = { 0 }; - const char *strings[] = { - "-", /* not a complete number */ - "- TEST", /* not a complete number */ -#if 0 -/* FIXME: these values should not be deserializable, since they overflow - * the target format */ - "0x0000000100000000", /* lowest long long that cannot fit in 32 bits */ - "0xF000000000000000", - "0xFFFFFFF000000000", - "0xFFFFFFFF00000000", - "0x10000000000000000", /* first number too long to fit into a long long */ - /* invent a new processor first before trying to make this one pass */ - "0x10000000000000000000000000000000000000000000", -#endif - }; - int i; - - g_value_init (&value, G_TYPE_UINT); - - for (i = 0; i < G_N_ELEMENTS (strings); ++i) { - fail_if (gst_value_deserialize (&value, strings[i]), - "deserialized %s (%d), while it should have failed", strings[i], i); - } -} - -GST_END_TEST; - - -GST_START_TEST (test_string) -{ - gchar *try[] = { - "Dude", - "Hi, I'm a string", - "tüüüt!" - }; - gchar *tmp; - GValue v = { 0, }; - guint i; - - 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); - fail_if (tmp == NULL, "couldn't serialize: %s\n", try[i]); - fail_unless (gst_value_deserialize (&v, tmp), - "couldn't deserialize: %s\n", tmp); - g_free (tmp); - - fail_unless (g_str_equal (g_value_get_string (&v), try[i]), - "\nserialized : %s\ndeserialized: %s", try[i], - g_value_get_string (&v)); - } - /* NULL strings should not be serializable */ - g_value_set_string (&v, NULL); - fail_unless (gst_value_serialize (&v) == NULL); - g_value_unset (&v); -} - -GST_END_TEST; - -GST_START_TEST (test_deserialize_string) -{ - struct - { - gchar *from; - gchar *to; - } tests[] = { - { - "", ""}, /* empty strings */ - { - "\"\"", ""}, /* 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)) { - fail_if (tests[i].to == NULL, - "I got %s instead of a failure", g_value_get_string (&v)); - fail_unless (g_str_equal (g_value_get_string (&v), tests[i].to), - "\nwanted: %s\ngot : %s", tests[i].to, g_value_get_string (&v)); - } else { - fail_if (tests[i].to != NULL, "failed, but wanted: %s", tests[i].to); - ret = FALSE; - } - } - g_value_unset (&v); -} - -GST_END_TEST; - -GST_START_TEST (test_value_compare) -{ - GValue value1 = { 0 }; - GValue value2 = { 0 }; - - 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); - fail_unless (gst_value_compare (&value1, &value2) == GST_VALUE_LESS_THAN); - fail_unless (gst_value_compare (&value2, &value1) == GST_VALUE_GREATER_THAN); - fail_unless (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); - fail_unless (gst_value_compare (&value1, &value2) == GST_VALUE_LESS_THAN); - fail_unless (gst_value_compare (&value2, &value1) == GST_VALUE_GREATER_THAN); - fail_unless (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"); - fail_unless (gst_value_compare (&value1, &value2) == GST_VALUE_LESS_THAN); - fail_unless (gst_value_compare (&value2, &value1) == GST_VALUE_GREATER_THAN); - fail_unless (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')); - fail_unless (gst_value_compare (&value1, &value2) == GST_VALUE_UNORDERED); - fail_unless (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); - fail_unless (gst_value_compare (&value1, &value2) == GST_VALUE_LESS_THAN); - fail_unless (gst_value_compare (&value2, &value1) == GST_VALUE_GREATER_THAN); - fail_unless (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); - fail_unless (gst_value_compare (&value1, &value2) == GST_VALUE_LESS_THAN); - fail_unless (gst_value_compare (&value2, &value1) == GST_VALUE_GREATER_THAN); - fail_unless (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); - fail_unless (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); - fail_unless (gst_value_compare (&value1, &value2) == GST_VALUE_LESS_THAN); - fail_unless (gst_value_compare (&value2, &value1) == GST_VALUE_GREATER_THAN); - fail_unless (gst_value_compare (&value1, &value1) == GST_VALUE_EQUAL); - g_value_unset (&value1); - g_value_unset (&value2); - -} - -GST_END_TEST; - -GST_START_TEST (test_value_intersect) -{ - GValue dest = { 0 }; - GValue src1 = { 0 }; - GValue src2 = { 0 }; - GValue item = { 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 (&src2, 20); - ret = gst_value_intersect (&dest, &src1, &src2); - fail_unless (ret == FALSE); - g_value_unset (&src1); - g_value_unset (&src2); - - 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); - - fail_unless (gst_value_intersect (&dest, &src1, &src2)); - fail_unless (GST_VALUE_HOLDS_FOURCC (&dest)); - fail_unless (gst_value_get_fourcc (&dest) == - GST_MAKE_FOURCC ('Y', 'U', 'Y', '2')); -} - -GST_END_TEST; - - -GST_START_TEST (test_value_subtract_int) -{ - GValue dest = { 0 }; - GValue src1 = { 0 }; - GValue src2 = { 0 }; - const GValue *tmp; - gboolean ret; - - /* int <-> int - */ - g_value_init (&src1, G_TYPE_INT); - g_value_set_int (&src1, 10); - g_value_init (&src2, G_TYPE_INT); - g_value_set_int (&src2, 20); - /* subtract as in sets, result is 10 */ - ret = gst_value_subtract (&dest, &src1, &src2); - fail_unless (ret == TRUE); - fail_unless (gst_value_compare (&dest, &src1) == GST_VALUE_EQUAL); - g_value_unset (&dest); - - /* same values, yields empty set */ - ret = gst_value_subtract (&dest, &src1, &src1); - fail_unless (ret == FALSE); - g_value_unset (&src1); - g_value_unset (&src2); - - /* int <-> int_range - */ - - /* would yield an empty set */ - g_value_init (&src1, G_TYPE_INT); - g_value_set_int (&src1, 10); - g_value_init (&src2, GST_TYPE_INT_RANGE); - gst_value_set_int_range (&src2, 0, 20); - ret = gst_value_subtract (&dest, &src1, &src2); - fail_unless (ret == FALSE); - - /* and the other way around, should create a list of two ranges. */ - ret = gst_value_subtract (&dest, &src2, &src1); - fail_unless (ret == TRUE); - fail_unless (GST_VALUE_HOLDS_LIST (&dest) == TRUE); - tmp = gst_value_list_get_value (&dest, 0); - fail_unless (GST_VALUE_HOLDS_INT_RANGE (tmp) == TRUE); - fail_unless (gst_value_get_int_range_min (tmp) == 0); - fail_unless (gst_value_get_int_range_max (tmp) == 9); - tmp = gst_value_list_get_value (&dest, 1); - fail_unless (GST_VALUE_HOLDS_INT_RANGE (tmp) == TRUE); - fail_unless (gst_value_get_int_range_min (tmp) == 11); - fail_unless (gst_value_get_int_range_max (tmp) == 20); - g_value_unset (&dest); - g_value_unset (&src1); - g_value_unset (&src2); - - /* border case 1, empty set */ - g_value_init (&src1, G_TYPE_INT); - g_value_set_int (&src1, 10); - g_value_init (&src2, GST_TYPE_INT_RANGE); - gst_value_set_int_range (&src2, 10, 20); - ret = gst_value_subtract (&dest, &src1, &src2); - fail_unless (ret == FALSE); - - /* and the other way around, should create a new range. */ - ret = gst_value_subtract (&dest, &src2, &src1); - fail_unless (ret == TRUE); - fail_unless (GST_VALUE_HOLDS_INT_RANGE (&dest) == TRUE); - fail_unless (gst_value_get_int_range_min (&dest) == 11); - fail_unless (gst_value_get_int_range_max (&dest) == 20); - g_value_unset (&dest); - g_value_unset (&src1); - g_value_unset (&src2); - - /* border case 2, empty set */ - g_value_init (&src1, G_TYPE_INT); - g_value_set_int (&src1, 20); - g_value_init (&src2, GST_TYPE_INT_RANGE); - gst_value_set_int_range (&src2, 10, 20); - ret = gst_value_subtract (&dest, &src1, &src2); - fail_unless (ret == FALSE); - - /* and the other way around, should create a new range. */ - ret = gst_value_subtract (&dest, &src2, &src1); - fail_unless (ret == TRUE); - fail_unless (GST_VALUE_HOLDS_INT_RANGE (&dest) == TRUE); - fail_unless (gst_value_get_int_range_min (&dest) == 10); - fail_unless (gst_value_get_int_range_max (&dest) == 19); - g_value_unset (&dest); - g_value_unset (&src1); - g_value_unset (&src2); - - /* case 3, valid set */ - g_value_init (&src1, G_TYPE_INT); - g_value_set_int (&src1, 0); - g_value_init (&src2, GST_TYPE_INT_RANGE); - gst_value_set_int_range (&src2, 10, 20); - ret = gst_value_subtract (&dest, &src1, &src2); - fail_unless (ret == TRUE); - fail_unless (G_VALUE_HOLDS_INT (&dest) == TRUE); - fail_unless (gst_value_compare (&dest, &src1) == GST_VALUE_EQUAL); - g_value_unset (&dest); - - /* and the other way around, should keep the range. */ - ret = gst_value_subtract (&dest, &src2, &src1); - fail_unless (ret == TRUE); - fail_unless (GST_VALUE_HOLDS_INT_RANGE (&dest) == TRUE); - fail_unless (gst_value_get_int_range_min (&dest) == 10); - fail_unless (gst_value_get_int_range_max (&dest) == 20); - g_value_unset (&dest); - g_value_unset (&src1); - g_value_unset (&src2); - - /* int_range <-> int_range - */ - - /* same range, empty set */ - g_value_init (&src1, GST_TYPE_INT_RANGE); - gst_value_set_int_range (&src1, 10, 20); - g_value_init (&src2, GST_TYPE_INT_RANGE); - gst_value_set_int_range (&src2, 10, 20); - ret = gst_value_subtract (&dest, &src1, &src2); - fail_unless (ret == FALSE); - ret = gst_value_subtract (&dest, &src2, &src1); - fail_unless (ret == FALSE); - g_value_unset (&src1); - g_value_unset (&src2); - - /* non overlapping ranges */ - g_value_init (&src1, GST_TYPE_INT_RANGE); - gst_value_set_int_range (&src1, 10, 20); - g_value_init (&src2, GST_TYPE_INT_RANGE); - gst_value_set_int_range (&src2, 30, 40); - ret = gst_value_subtract (&dest, &src1, &src2); - fail_unless (ret == TRUE); - fail_unless (GST_VALUE_HOLDS_INT_RANGE (&dest) == TRUE); - fail_unless (gst_value_get_int_range_min (&dest) == 10); - fail_unless (gst_value_get_int_range_max (&dest) == 20); - g_value_unset (&dest); - /* the other way */ - ret = gst_value_subtract (&dest, &src2, &src1); - fail_unless (ret == TRUE); - fail_unless (GST_VALUE_HOLDS_INT_RANGE (&dest) == TRUE); - fail_unless (gst_value_get_int_range_min (&dest) == 30); - fail_unless (gst_value_get_int_range_max (&dest) == 40); - g_value_unset (&dest); - g_value_unset (&src1); - g_value_unset (&src2); - - /* completely overlapping ranges */ - g_value_init (&src1, GST_TYPE_INT_RANGE); - gst_value_set_int_range (&src1, 10, 20); - g_value_init (&src2, GST_TYPE_INT_RANGE); - gst_value_set_int_range (&src2, 10, 30); - ret = gst_value_subtract (&dest, &src1, &src2); - fail_unless (ret == FALSE); - /* the other way */ - ret = gst_value_subtract (&dest, &src2, &src1); - fail_unless (ret == TRUE); - fail_unless (GST_VALUE_HOLDS_INT_RANGE (&dest) == TRUE); - fail_unless (gst_value_get_int_range_min (&dest) == 21); - fail_unless (gst_value_get_int_range_max (&dest) == 30); - g_value_unset (&dest); - g_value_unset (&src1); - g_value_unset (&src2); - - /* partially overlapping ranges */ - g_value_init (&src1, GST_TYPE_INT_RANGE); - gst_value_set_int_range (&src1, 10, 20); - g_value_init (&src2, GST_TYPE_INT_RANGE); - gst_value_set_int_range (&src2, 15, 30); - ret = gst_value_subtract (&dest, &src1, &src2); - fail_unless (ret == TRUE); - fail_unless (GST_VALUE_HOLDS_INT_RANGE (&dest) == TRUE); - fail_unless (gst_value_get_int_range_min (&dest) == 10); - fail_unless (gst_value_get_int_range_max (&dest) == 14); - g_value_unset (&dest); - /* the other way */ - ret = gst_value_subtract (&dest, &src2, &src1); - fail_unless (ret == TRUE); - fail_unless (GST_VALUE_HOLDS_INT_RANGE (&dest) == TRUE); - fail_unless (gst_value_get_int_range_min (&dest) == 21); - fail_unless (gst_value_get_int_range_max (&dest) == 30); - g_value_unset (&dest); - g_value_unset (&src1); - g_value_unset (&src2); - - /* create a hole { int_range, int_range } */ - g_value_init (&src1, GST_TYPE_INT_RANGE); - gst_value_set_int_range (&src1, 10, 30); - g_value_init (&src2, GST_TYPE_INT_RANGE); - gst_value_set_int_range (&src2, 15, 20); - ret = gst_value_subtract (&dest, &src1, &src2); - fail_unless (ret == TRUE); - fail_unless (GST_VALUE_HOLDS_LIST (&dest) == TRUE); - tmp = gst_value_list_get_value (&dest, 0); - fail_unless (GST_VALUE_HOLDS_INT_RANGE (tmp) == TRUE); - fail_unless (gst_value_get_int_range_min (tmp) == 10); - fail_unless (gst_value_get_int_range_max (tmp) == 14); - tmp = gst_value_list_get_value (&dest, 1); - fail_unless (GST_VALUE_HOLDS_INT_RANGE (tmp) == TRUE); - fail_unless (gst_value_get_int_range_min (tmp) == 21); - fail_unless (gst_value_get_int_range_max (tmp) == 30); - g_value_unset (&dest); - /* the other way */ - ret = gst_value_subtract (&dest, &src2, &src1); - fail_unless (ret == FALSE); - g_value_unset (&src1); - g_value_unset (&src2); - - /* create a hole, { int, int } */ - g_value_init (&src1, GST_TYPE_INT_RANGE); - gst_value_set_int_range (&src1, 10, 30); - g_value_init (&src2, GST_TYPE_INT_RANGE); - gst_value_set_int_range (&src2, 11, 29); - ret = gst_value_subtract (&dest, &src1, &src2); - fail_unless (ret == TRUE); - fail_unless (GST_VALUE_HOLDS_LIST (&dest) == TRUE); - tmp = gst_value_list_get_value (&dest, 0); - fail_unless (G_VALUE_HOLDS_INT (tmp) == TRUE); - fail_unless (g_value_get_int (tmp) == 10); - tmp = gst_value_list_get_value (&dest, 1); - fail_unless (G_VALUE_HOLDS_INT (tmp) == TRUE); - fail_unless (g_value_get_int (tmp) == 30); - g_value_unset (&dest); - /* the other way */ - ret = gst_value_subtract (&dest, &src2, &src1); - fail_unless (ret == FALSE); - g_value_unset (&src1); - g_value_unset (&src2); - - /* create a hole, { int, int_range } */ - g_value_init (&src1, GST_TYPE_INT_RANGE); - gst_value_set_int_range (&src1, 10, 30); - g_value_init (&src2, GST_TYPE_INT_RANGE); - gst_value_set_int_range (&src2, 11, 28); - ret = gst_value_subtract (&dest, &src1, &src2); - fail_unless (ret == TRUE); - fail_unless (GST_VALUE_HOLDS_LIST (&dest) == TRUE); - tmp = gst_value_list_get_value (&dest, 0); - fail_unless (G_VALUE_HOLDS_INT (tmp) == TRUE); - fail_unless (g_value_get_int (tmp) == 10); - tmp = gst_value_list_get_value (&dest, 1); - fail_unless (GST_VALUE_HOLDS_INT_RANGE (tmp) == TRUE); - fail_unless (gst_value_get_int_range_min (tmp) == 29); - fail_unless (gst_value_get_int_range_max (tmp) == 30); - g_value_unset (&dest); - /* the other way */ - ret = gst_value_subtract (&dest, &src2, &src1); - fail_unless (ret == FALSE); - g_value_unset (&src1); - g_value_unset (&src2); - - /* create a hole, { int_range, int } */ - g_value_init (&src1, GST_TYPE_INT_RANGE); - gst_value_set_int_range (&src1, 10, 30); - g_value_init (&src2, GST_TYPE_INT_RANGE); - gst_value_set_int_range (&src2, 12, 29); - ret = gst_value_subtract (&dest, &src1, &src2); - fail_unless (ret == TRUE); - fail_unless (GST_VALUE_HOLDS_LIST (&dest) == TRUE); - tmp = gst_value_list_get_value (&dest, 0); - fail_unless (GST_VALUE_HOLDS_INT_RANGE (tmp) == TRUE); - fail_unless (gst_value_get_int_range_min (tmp) == 10); - fail_unless (gst_value_get_int_range_max (tmp) == 11); - tmp = gst_value_list_get_value (&dest, 1); - fail_unless (G_VALUE_HOLDS_INT (tmp) == TRUE); - fail_unless (g_value_get_int (tmp) == 30); - g_value_unset (&dest); - /* the other way */ - ret = gst_value_subtract (&dest, &src2, &src1); - fail_unless (ret == FALSE); - g_value_unset (&src1); - g_value_unset (&src2); -} - -GST_END_TEST; - -GST_START_TEST (test_value_subtract_double) -{ - GValue dest = { 0 }; - GValue src1 = { 0 }; - GValue src2 = { 0 }; - const GValue *tmp; - gboolean ret; - - /* double <-> double - */ - g_value_init (&src1, G_TYPE_DOUBLE); - g_value_set_double (&src1, 10.0); - g_value_init (&src2, G_TYPE_DOUBLE); - g_value_set_double (&src2, 20.0); - /* subtract as in sets, result is 10 */ - ret = gst_value_subtract (&dest, &src1, &src2); - fail_unless (ret == TRUE); - fail_unless (gst_value_compare (&dest, &src1) == GST_VALUE_EQUAL); - g_value_unset (&dest); - - /* same values, yields empty set */ - ret = gst_value_subtract (&dest, &src1, &src1); - fail_unless (ret == FALSE); - g_value_unset (&src1); - g_value_unset (&src2); - - /* double <-> double_range - */ - - /* would yield an empty set */ - g_value_init (&src1, G_TYPE_DOUBLE); - g_value_set_double (&src1, 10.0); - g_value_init (&src2, GST_TYPE_DOUBLE_RANGE); - gst_value_set_double_range (&src2, 0.0, 20.0); - ret = gst_value_subtract (&dest, &src1, &src2); - fail_unless (ret == FALSE); - - /* and the other way around, we cannot create open ranges - * so the result is the range again */ - ret = gst_value_subtract (&dest, &src2, &src1); - fail_unless (ret == TRUE); - fail_unless (GST_VALUE_HOLDS_DOUBLE_RANGE (&dest) == TRUE); - fail_unless (gst_value_get_double_range_min (&dest) == 0.0); - fail_unless (gst_value_get_double_range_max (&dest) == 20.0); - g_value_unset (&dest); - g_value_unset (&src1); - g_value_unset (&src2); - - /* border case 1, empty set */ - g_value_init (&src1, G_TYPE_DOUBLE); - g_value_set_double (&src1, 10.0); - g_value_init (&src2, GST_TYPE_DOUBLE_RANGE); - gst_value_set_double_range (&src2, 10.0, 20.0); - ret = gst_value_subtract (&dest, &src1, &src2); - fail_unless (ret == FALSE); - - /* and the other way around, should keep same range as - * we don't have open ranges. */ - ret = gst_value_subtract (&dest, &src2, &src1); - fail_unless (ret == TRUE); - fail_unless (GST_VALUE_HOLDS_DOUBLE_RANGE (&dest) == TRUE); - fail_unless (gst_value_get_double_range_min (&dest) == 10.0); - fail_unless (gst_value_get_double_range_max (&dest) == 20.0); - g_value_unset (&dest); - g_value_unset (&src1); - g_value_unset (&src2); - - /* border case 2, empty set */ - g_value_init (&src1, G_TYPE_DOUBLE); - g_value_set_double (&src1, 20.0); - g_value_init (&src2, GST_TYPE_DOUBLE_RANGE); - gst_value_set_double_range (&src2, 10.0, 20.0); - ret = gst_value_subtract (&dest, &src1, &src2); - fail_unless (ret == FALSE); - - /* and the other way around, should keep same range as - * we don't have open ranges. */ - ret = gst_value_subtract (&dest, &src2, &src1); - fail_unless (ret == TRUE); - fail_unless (GST_VALUE_HOLDS_DOUBLE_RANGE (&dest) == TRUE); - fail_unless (gst_value_get_double_range_min (&dest) == 10.0); - fail_unless (gst_value_get_double_range_max (&dest) == 20.0); - g_value_unset (&dest); - g_value_unset (&src1); - g_value_unset (&src2); - - /* case 3, valid set */ - g_value_init (&src1, G_TYPE_DOUBLE); - g_value_set_double (&src1, 0.0); - g_value_init (&src2, GST_TYPE_DOUBLE_RANGE); - gst_value_set_double_range (&src2, 10.0, 20.0); - ret = gst_value_subtract (&dest, &src1, &src2); - fail_unless (ret == TRUE); - fail_unless (G_VALUE_HOLDS_DOUBLE (&dest) == TRUE); - fail_unless (gst_value_compare (&dest, &src1) == GST_VALUE_EQUAL); - g_value_unset (&dest); - - /* and the other way around, should keep the range. */ - ret = gst_value_subtract (&dest, &src2, &src1); - fail_unless (ret == TRUE); - fail_unless (GST_VALUE_HOLDS_DOUBLE_RANGE (&dest) == TRUE); - fail_unless (gst_value_get_double_range_min (&dest) == 10.0); - fail_unless (gst_value_get_double_range_max (&dest) == 20.0); - g_value_unset (&dest); - g_value_unset (&src1); - g_value_unset (&src2); - - /* double_range <-> double_range - */ - - /* same range, empty set */ - g_value_init (&src1, GST_TYPE_DOUBLE_RANGE); - gst_value_set_double_range (&src1, 10.0, 20.0); - g_value_init (&src2, GST_TYPE_DOUBLE_RANGE); - gst_value_set_double_range (&src2, 10.0, 20.0); - ret = gst_value_subtract (&dest, &src1, &src2); - fail_unless (ret == FALSE); - ret = gst_value_subtract (&dest, &src2, &src1); - fail_unless (ret == FALSE); - g_value_unset (&src1); - g_value_unset (&src2); - - /* non overlapping ranges */ - g_value_init (&src1, GST_TYPE_DOUBLE_RANGE); - gst_value_set_double_range (&src1, 10.0, 20.0); - g_value_init (&src2, GST_TYPE_DOUBLE_RANGE); - gst_value_set_double_range (&src2, 30.0, 40.0); - ret = gst_value_subtract (&dest, &src1, &src2); - fail_unless (ret == TRUE); - fail_unless (GST_VALUE_HOLDS_DOUBLE_RANGE (&dest) == TRUE); - fail_unless (gst_value_get_double_range_min (&dest) == 10.0); - fail_unless (gst_value_get_double_range_max (&dest) == 20.0); - g_value_unset (&dest); - /* the other way */ - ret = gst_value_subtract (&dest, &src2, &src1); - fail_unless (ret == TRUE); - fail_unless (GST_VALUE_HOLDS_DOUBLE_RANGE (&dest) == TRUE); - fail_unless (gst_value_get_double_range_min (&dest) == 30.0); - fail_unless (gst_value_get_double_range_max (&dest) == 40.0); - g_value_unset (&dest); - g_value_unset (&src1); - g_value_unset (&src2); - - /* completely overlapping ranges */ - g_value_init (&src1, GST_TYPE_DOUBLE_RANGE); - gst_value_set_double_range (&src1, 10.0, 20.0); - g_value_init (&src2, GST_TYPE_DOUBLE_RANGE); - gst_value_set_double_range (&src2, 10.0, 30.0); - ret = gst_value_subtract (&dest, &src1, &src2); - fail_unless (ret == FALSE); - /* the other way */ - ret = gst_value_subtract (&dest, &src2, &src1); - fail_unless (ret == TRUE); - fail_unless (GST_VALUE_HOLDS_DOUBLE_RANGE (&dest) == TRUE); - fail_unless (gst_value_get_double_range_min (&dest) == 20.0); - fail_unless (gst_value_get_double_range_max (&dest) == 30.0); - g_value_unset (&dest); - g_value_unset (&src1); - g_value_unset (&src2); - - /* partially overlapping ranges */ - g_value_init (&src1, GST_TYPE_DOUBLE_RANGE); - gst_value_set_double_range (&src1, 10.0, 20.0); - g_value_init (&src2, GST_TYPE_DOUBLE_RANGE); - gst_value_set_double_range (&src2, 15.0, 30.0); - ret = gst_value_subtract (&dest, &src1, &src2); - fail_unless (ret == TRUE); - fail_unless (GST_VALUE_HOLDS_DOUBLE_RANGE (&dest) == TRUE); - fail_unless (gst_value_get_double_range_min (&dest) == 10.0); - fail_unless (gst_value_get_double_range_max (&dest) == 15.0); - g_value_unset (&dest); - /* the other way */ - ret = gst_value_subtract (&dest, &src2, &src1); - fail_unless (ret == TRUE); - fail_unless (GST_VALUE_HOLDS_DOUBLE_RANGE (&dest) == TRUE); - fail_unless (gst_value_get_double_range_min (&dest) == 20.0); - fail_unless (gst_value_get_double_range_max (&dest) == 30.0); - g_value_unset (&dest); - g_value_unset (&src1); - g_value_unset (&src2); - - /* create a hole { double_range, double_range } */ - g_value_init (&src1, GST_TYPE_DOUBLE_RANGE); - gst_value_set_double_range (&src1, 10.0, 30.0); - g_value_init (&src2, GST_TYPE_DOUBLE_RANGE); - gst_value_set_double_range (&src2, 15.0, 20.0); - ret = gst_value_subtract (&dest, &src1, &src2); - fail_unless (ret == TRUE); - fail_unless (GST_VALUE_HOLDS_LIST (&dest) == TRUE); - tmp = gst_value_list_get_value (&dest, 0); - fail_unless (GST_VALUE_HOLDS_DOUBLE_RANGE (tmp) == TRUE); - fail_unless (gst_value_get_double_range_min (tmp) == 10.0); - fail_unless (gst_value_get_double_range_max (tmp) == 15.0); - tmp = gst_value_list_get_value (&dest, 1); - fail_unless (GST_VALUE_HOLDS_DOUBLE_RANGE (tmp) == TRUE); - fail_unless (gst_value_get_double_range_min (tmp) == 20.0); - fail_unless (gst_value_get_double_range_max (tmp) == 30.0); - g_value_unset (&dest); - /* the other way */ - ret = gst_value_subtract (&dest, &src2, &src1); - fail_unless (ret == FALSE); - g_value_unset (&src1); - g_value_unset (&src2); -} - -GST_END_TEST; - -/* Test arithmetic subtraction of fractions */ -GST_START_TEST (test_value_subtract_fraction) -{ - GValue result = { 0 }; - GValue src1 = { 0 }; - GValue src2 = { 0 }; - - /* Subtract 1/4 from 1/2 */ - g_value_init (&src1, GST_TYPE_FRACTION); - g_value_init (&src2, GST_TYPE_FRACTION); - g_value_init (&result, GST_TYPE_FRACTION); - gst_value_set_fraction (&src1, 1, 2); - gst_value_set_fraction (&src2, 1, 4); - fail_unless (gst_value_fraction_subtract (&result, &src1, &src2) == TRUE); - fail_unless (gst_value_get_fraction_numerator (&result) == 1); - fail_unless (gst_value_get_fraction_denominator (&result) == 4); - - g_value_unset (&src1); - g_value_unset (&src2); - g_value_unset (&result); - - /* Subtract 1/12 from 7/8 */ - g_value_init (&src1, GST_TYPE_FRACTION); - g_value_init (&src2, GST_TYPE_FRACTION); - g_value_init (&result, GST_TYPE_FRACTION); - gst_value_set_fraction (&src1, 7, 8); - gst_value_set_fraction (&src2, 1, 12); - fail_unless (gst_value_fraction_subtract (&result, &src1, &src2) == TRUE); - fail_unless (gst_value_get_fraction_numerator (&result) == 19); - fail_unless (gst_value_get_fraction_denominator (&result) == 24); - - g_value_unset (&src1); - g_value_unset (&src2); - g_value_unset (&result); - - /* Subtract 12/13 from 4/3 */ - g_value_init (&src1, GST_TYPE_FRACTION); - g_value_init (&src2, GST_TYPE_FRACTION); - g_value_init (&result, GST_TYPE_FRACTION); - gst_value_set_fraction (&src1, 4, 3); - gst_value_set_fraction (&src2, 12, 13); - fail_unless (gst_value_fraction_subtract (&result, &src1, &src2) == TRUE); - fail_unless (gst_value_get_fraction_numerator (&result) == 16); - fail_unless (gst_value_get_fraction_denominator (&result) == 39); - - g_value_unset (&src1); - g_value_unset (&src2); - g_value_unset (&result); - - /* Subtract 1/12 from 7/8 */ -} - -GST_END_TEST; - -/* Test set subtraction operations on fraction ranges */ -GST_START_TEST (test_value_subtract_fraction_range) -{ - GValue dest = { 0 }; - GValue src1 = { 0 }; - GValue src2 = { 0 }; - GValue cmp = { 0 }; - const GValue *tmp; - gboolean ret; - - /* Value for tests */ - g_value_init (&cmp, GST_TYPE_FRACTION); - - /* fraction <-> fraction - */ - g_value_init (&src1, GST_TYPE_FRACTION); - gst_value_set_fraction (&src1, 10, 1); - g_value_init (&src2, GST_TYPE_FRACTION); - gst_value_set_fraction (&src2, 20, 1); - gst_value_set_fraction (&src1, 10, 1); - - /* subtract as in sets, result is 10 */ - ret = gst_value_subtract (&dest, &src1, &src2); - fail_unless (ret == TRUE); - fail_unless (gst_value_compare (&dest, &src1) == GST_VALUE_EQUAL); - g_value_unset (&dest); - - /* same values, yields empty set */ - ret = gst_value_subtract (&dest, &src1, &src1); - fail_unless (ret == FALSE); - g_value_unset (&src1); - g_value_unset (&src2); - - /* fraction <-> fraction_range - */ - - /* would yield an empty set */ - g_value_init (&src1, GST_TYPE_FRACTION); - gst_value_set_fraction (&src1, 10, 1); - g_value_init (&src2, GST_TYPE_FRACTION_RANGE); - gst_value_set_fraction_range_full (&src2, 0, 1, 20, 1); - ret = gst_value_subtract (&dest, &src1, &src2); - fail_unless (ret == FALSE); - - /* and the other way around, we cannot create open ranges - * so the result is the range again */ - ret = gst_value_subtract (&dest, &src2, &src1); - fail_unless (ret == TRUE); - fail_unless (GST_VALUE_HOLDS_FRACTION_RANGE (&dest) == TRUE); - gst_value_set_fraction (&cmp, 0, 1); - fail_unless (gst_value_compare (gst_value_get_fraction_range_min (&dest), - &cmp) == GST_VALUE_EQUAL); - gst_value_set_fraction (&cmp, 20, 1); - fail_unless (gst_value_compare (gst_value_get_fraction_range_max (&dest), - &cmp) == GST_VALUE_EQUAL); - g_value_unset (&dest); - g_value_unset (&src1); - g_value_unset (&src2); - - /* border case 1, empty set */ - g_value_init (&src1, GST_TYPE_FRACTION); - gst_value_set_fraction (&src1, 10, 1); - g_value_init (&src2, GST_TYPE_FRACTION_RANGE); - gst_value_set_fraction_range_full (&src2, 10, 1, 20, 1); - ret = gst_value_subtract (&dest, &src1, &src2); - fail_unless (ret == FALSE); - - /* and the other way around, should keep same range as - * we don't have open ranges. */ - ret = gst_value_subtract (&dest, &src2, &src1); - fail_unless (ret == TRUE); - fail_unless (GST_VALUE_HOLDS_FRACTION_RANGE (&dest) == TRUE); - gst_value_set_fraction (&cmp, 10, 1); - fail_unless (gst_value_compare (gst_value_get_fraction_range_min (&dest), - &cmp) == GST_VALUE_EQUAL); - gst_value_set_fraction (&cmp, 20, 1); - fail_unless (gst_value_compare (gst_value_get_fraction_range_max (&dest), - &cmp) == GST_VALUE_EQUAL); - g_value_unset (&dest); - g_value_unset (&src1); - g_value_unset (&src2); - - /* case 2, valid set */ - g_value_init (&src1, GST_TYPE_FRACTION); - gst_value_set_fraction (&src1, 0, 1); - g_value_init (&src2, GST_TYPE_FRACTION_RANGE); - gst_value_set_fraction_range_full (&src2, 10, 1, 20, 1); - ret = gst_value_subtract (&dest, &src1, &src2); - fail_unless (ret == TRUE); - fail_unless (GST_VALUE_HOLDS_FRACTION (&dest) == TRUE); - fail_unless (gst_value_compare (&dest, &src1) == GST_VALUE_EQUAL); - g_value_unset (&dest); - - /* and the other way around, should keep the range. */ - ret = gst_value_subtract (&dest, &src2, &src1); - fail_unless (ret == TRUE); - fail_unless (GST_VALUE_HOLDS_FRACTION_RANGE (&dest) == TRUE); - fail_unless (gst_value_compare (&dest, &src2) == GST_VALUE_EQUAL); - g_value_unset (&dest); - g_value_unset (&src1); - g_value_unset (&src2); - - /* fraction_range <-> fraction_range - */ - - /* same range, empty set */ - g_value_init (&src1, GST_TYPE_FRACTION_RANGE); - gst_value_set_fraction_range_full (&src1, 10, 2, 20, 2); - g_value_init (&src2, GST_TYPE_FRACTION_RANGE); - gst_value_set_fraction_range_full (&src2, 10, 2, 20, 2); - ret = gst_value_subtract (&dest, &src1, &src2); - fail_unless (ret == FALSE); - ret = gst_value_subtract (&dest, &src2, &src1); - fail_unless (ret == FALSE); - g_value_unset (&src1); - g_value_unset (&src2); - - /* non overlapping ranges */ - g_value_init (&src1, GST_TYPE_FRACTION_RANGE); - gst_value_set_fraction_range_full (&src1, 10, 2, 10, 1); - g_value_init (&src2, GST_TYPE_FRACTION_RANGE); - gst_value_set_fraction_range_full (&src2, 30, 2, 40, 2); - ret = gst_value_subtract (&dest, &src1, &src2); - fail_unless (ret == TRUE); - fail_unless (GST_VALUE_HOLDS_FRACTION_RANGE (&dest) == TRUE); - gst_value_set_fraction (&cmp, 5, 1); - fail_unless (gst_value_compare (gst_value_get_fraction_range_min (&dest), - &cmp) == GST_VALUE_EQUAL); - gst_value_set_fraction (&cmp, 10, 1); - fail_unless (gst_value_compare (gst_value_get_fraction_range_max (&dest), - &cmp) == GST_VALUE_EQUAL); - - g_value_unset (&dest); - /* the other way */ - ret = gst_value_subtract (&dest, &src2, &src1); - fail_unless (ret == TRUE); - fail_unless (GST_VALUE_HOLDS_FRACTION_RANGE (&dest) == TRUE); - gst_value_set_fraction (&cmp, 15, 1); - fail_unless (gst_value_compare (gst_value_get_fraction_range_min (&dest), - &cmp) == GST_VALUE_EQUAL); - gst_value_set_fraction (&cmp, 20, 1); - fail_unless (gst_value_compare (gst_value_get_fraction_range_max (&dest), - &cmp) == GST_VALUE_EQUAL); - g_value_unset (&dest); - g_value_unset (&src1); - g_value_unset (&src2); - - /* completely overlapping ranges */ - g_value_init (&src1, GST_TYPE_FRACTION_RANGE); - gst_value_set_fraction_range_full (&src1, 10, 1, 20, 1); - g_value_init (&src2, GST_TYPE_FRACTION_RANGE); - gst_value_set_fraction_range_full (&src2, 10, 1, 30, 1); - ret = gst_value_subtract (&dest, &src1, &src2); - fail_unless (ret == FALSE); - /* the other way */ - ret = gst_value_subtract (&dest, &src2, &src1); - fail_unless (ret == TRUE); - fail_unless (GST_VALUE_HOLDS_FRACTION_RANGE (&dest) == TRUE); - gst_value_set_fraction (&cmp, 20, 1); - fail_unless (gst_value_compare (gst_value_get_fraction_range_min (&dest), - &cmp) == GST_VALUE_EQUAL); - gst_value_set_fraction (&cmp, 30, 1); - fail_unless (gst_value_compare (gst_value_get_fraction_range_max (&dest), - &cmp) == GST_VALUE_EQUAL); - g_value_unset (&dest); - g_value_unset (&src1); - g_value_unset (&src2); - - /* partially overlapping ranges */ - g_value_init (&src1, GST_TYPE_FRACTION_RANGE); - gst_value_set_fraction_range_full (&src1, 10, 1, 20, 1); - g_value_init (&src2, GST_TYPE_FRACTION_RANGE); - gst_value_set_fraction_range_full (&src2, 15, 1, 30, 1); - ret = gst_value_subtract (&dest, &src1, &src2); - fail_unless (ret == TRUE); - fail_unless (GST_VALUE_HOLDS_FRACTION_RANGE (&dest) == TRUE); - gst_value_set_fraction (&cmp, 10, 1); - fail_unless (gst_value_compare (gst_value_get_fraction_range_min (&dest), - &cmp) == GST_VALUE_EQUAL); - gst_value_set_fraction (&cmp, 15, 1); - fail_unless (gst_value_compare (gst_value_get_fraction_range_max (&dest), - &cmp) == GST_VALUE_EQUAL); - g_value_unset (&dest); - - /* the other way */ - ret = gst_value_subtract (&dest, &src2, &src1); - fail_unless (ret == TRUE); - fail_unless (GST_VALUE_HOLDS_FRACTION_RANGE (&dest) == TRUE); - gst_value_set_fraction (&cmp, 20, 1); - fail_unless (gst_value_compare (gst_value_get_fraction_range_min (&dest), - &cmp) == GST_VALUE_EQUAL); - gst_value_set_fraction (&cmp, 30, 1); - fail_unless (gst_value_compare (gst_value_get_fraction_range_max (&dest), - &cmp) == GST_VALUE_EQUAL); - g_value_unset (&dest); - g_value_unset (&src1); - g_value_unset (&src2); - - /* create a hole { double_range, double_range } */ - g_value_init (&src1, GST_TYPE_FRACTION_RANGE); - gst_value_set_fraction_range_full (&src1, 10, 1, 30, 1); - g_value_init (&src2, GST_TYPE_FRACTION_RANGE); - gst_value_set_fraction_range_full (&src2, 15, 1, 20, 1); - ret = gst_value_subtract (&dest, &src1, &src2); - fail_unless (ret == TRUE); - fail_unless (GST_VALUE_HOLDS_LIST (&dest) == TRUE); - /* 1st list entry */ - tmp = gst_value_list_get_value (&dest, 0); - fail_unless (GST_VALUE_HOLDS_FRACTION_RANGE (tmp) == TRUE); - gst_value_set_fraction (&cmp, 10, 1); - fail_unless (gst_value_compare (gst_value_get_fraction_range_min (tmp), - &cmp) == GST_VALUE_EQUAL); - gst_value_set_fraction (&cmp, 15, 1); - fail_unless (gst_value_compare (gst_value_get_fraction_range_max (tmp), - &cmp) == GST_VALUE_EQUAL); - /* 2nd list entry */ - tmp = gst_value_list_get_value (&dest, 1); - fail_unless (GST_VALUE_HOLDS_FRACTION_RANGE (tmp) == TRUE); - gst_value_set_fraction (&cmp, 20, 1); - fail_unless (gst_value_compare (gst_value_get_fraction_range_min (tmp), - &cmp) == GST_VALUE_EQUAL); - gst_value_set_fraction (&cmp, 30, 1); - fail_unless (gst_value_compare (gst_value_get_fraction_range_max (tmp), - &cmp) == GST_VALUE_EQUAL); - g_value_unset (&dest); - /* the other way */ - ret = gst_value_subtract (&dest, &src2, &src1); - fail_unless (ret == FALSE); - g_value_unset (&src1); - g_value_unset (&src2); - - g_value_unset (&cmp); -} - -GST_END_TEST; - -GST_START_TEST (test_date) -{ - GstStructure *s; - GDate *date, *date2; - gchar *str; - - date = g_date_new_dmy (22, 9, 2005); - - s = gst_structure_new ("media/x-type", "SOME_DATE_TAG", GST_TYPE_DATE, - date, NULL); - - fail_unless (gst_structure_has_field_typed (s, "SOME_DATE_TAG", - GST_TYPE_DATE)); - fail_unless (gst_structure_get_date (s, "SOME_DATE_TAG", &date2)); - fail_unless (date2 != NULL); - fail_unless (g_date_valid (date2)); - fail_unless (g_date_compare (date, date2) == 0); - - g_date_free (date); - g_date_free (date2); - date = NULL; - date2 = NULL; - - str = gst_structure_to_string (s); - gst_structure_free (s); - s = NULL; - - fail_unless (g_str_equal (str, - "media/x-type, SOME_DATE_TAG=(GstDate)2005-09-22")); - - s = gst_structure_from_string (str, NULL); - g_free (str); - str = NULL; - - fail_unless (s != NULL); - fail_unless (gst_structure_has_name (s, "media/x-type")); - fail_unless (gst_structure_has_field_typed (s, "SOME_DATE_TAG", - GST_TYPE_DATE)); - fail_unless (gst_structure_get_date (s, "SOME_DATE_TAG", &date)); - fail_unless (date != NULL); - fail_unless (g_date_valid (date)); - fail_unless (g_date_get_day (date) == 22); - fail_unless (g_date_get_month (date) == 9); - fail_unless (g_date_get_year (date) == 2005); - g_date_free (date); - date = NULL; - - str = gst_structure_to_string (s); - gst_structure_free (s); - s = NULL; - - fail_unless (g_str_equal (str, - "media/x-type, SOME_DATE_TAG=(GstDate)2005-09-22")); - g_free (str); - str = NULL; -} - -GST_END_TEST; - -GST_START_TEST (test_fraction_range) -{ - GValue range = { 0, }; - GValue start = { 0, }, end = { - 0,}; - GValue src = { 0, }, dest = { - 0,}; - GValue range2 = { 0, }; - - g_value_init (&range, GST_TYPE_FRACTION_RANGE); - g_value_init (&range2, GST_TYPE_FRACTION_RANGE); - g_value_init (&start, GST_TYPE_FRACTION); - g_value_init (&end, GST_TYPE_FRACTION); - g_value_init (&src, GST_TYPE_FRACTION); - - gst_value_set_fraction (&src, 1, 2); - - /* Check that a intersection of fraction & range = fraction */ - gst_value_set_fraction (&start, 1, 4); - gst_value_set_fraction (&end, 2, 3); - gst_value_set_fraction_range (&range, &start, &end); - - fail_unless (gst_value_intersect (&dest, &src, &range) == TRUE); - fail_unless (G_VALUE_TYPE (&dest) == GST_TYPE_FRACTION); - fail_unless (gst_value_compare (&dest, &src) == GST_VALUE_EQUAL); - - /* Check that a intersection selects the overlapping range */ - gst_value_set_fraction (&start, 1, 3); - gst_value_set_fraction (&end, 2, 3); - gst_value_set_fraction_range (&range2, &start, &end); - g_value_unset (&dest); - fail_unless (gst_value_intersect (&dest, &range, &range2) == TRUE); - fail_unless (G_VALUE_TYPE (&dest) == GST_TYPE_FRACTION_RANGE); - - gst_value_set_fraction_range (&range2, &start, &end); - fail_unless (gst_value_compare (&dest, &range2) == GST_VALUE_EQUAL); - - /* Check that non intersection ranges don't intersect */ - gst_value_set_fraction (&start, 4, 2); - gst_value_set_fraction (&end, 5, 2); - gst_value_set_fraction_range (&range2, &start, &end); - g_value_unset (&dest); - fail_unless (gst_value_intersect (&dest, &range, &range2) == FALSE); - - g_value_unset (&start); - g_value_unset (&end); - g_value_unset (&range); - g_value_unset (&range2); - g_value_unset (&src); -} - -GST_END_TEST; - -Suite * -gst_value_suite (void) -{ - Suite *s = suite_create ("GstValue"); - TCase *tc_chain = tcase_create ("general"); - - suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, test_deserialize_buffer); - tcase_add_test (tc_chain, test_deserialize_gint); - tcase_add_test (tc_chain, test_deserialize_gint_failures); - tcase_add_test (tc_chain, test_deserialize_guint); - tcase_add_test (tc_chain, test_deserialize_guint_failures); - tcase_add_test (tc_chain, test_deserialize_gint64); - tcase_add_test (tc_chain, test_deserialize_gstfraction); - tcase_add_test (tc_chain, test_string); - tcase_add_test (tc_chain, test_deserialize_string); - tcase_add_test (tc_chain, test_value_compare); - tcase_add_test (tc_chain, test_value_intersect); - tcase_add_test (tc_chain, test_value_subtract_int); - tcase_add_test (tc_chain, test_value_subtract_double); - tcase_add_test (tc_chain, test_value_subtract_fraction); - tcase_add_test (tc_chain, test_value_subtract_fraction_range); - tcase_add_test (tc_chain, test_date); - tcase_add_test (tc_chain, test_fraction_range); - - return s; -} - -int -main (int argc, char **argv) -{ - int nf; - - Suite *s = gst_value_suite (); - SRunner *sr = srunner_create (s); - - gst_check_init (&argc, &argv); - - srunner_run_all (sr, CK_NORMAL); - nf = srunner_ntests_failed (sr); - srunner_free (sr); - - return nf; -} diff --git a/check/net/.gitignore b/check/net/.gitignore deleted file mode 100644 index 39e5411e56..0000000000 --- a/check/net/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -.dirstamp -gstnetclientclock -gstnettimeprovider diff --git a/check/net/gstnetclientclock.c b/check/net/gstnetclientclock.c deleted file mode 100644 index 8ff6bc49e7..0000000000 --- a/check/net/gstnetclientclock.c +++ /dev/null @@ -1,143 +0,0 @@ -/* GStreamer - * Copyright (C) 2005 Andy Wingo - * - * gstnetclientclock.c: Unit test for the network client clock - * - * 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 - -GST_START_TEST (test_instantiation) -{ - GstClock *client, *local; - - local = gst_system_clock_obtain (); - client = gst_net_client_clock_new (NULL, "127.0.0.1", 1234, GST_SECOND); - fail_unless (local != NULL, "failed to get system clock"); - fail_unless (client != NULL, "failed to get network client clock"); - - /* one for gstreamer, one for us */ - ASSERT_OBJECT_REFCOUNT (local, "system clock", 2); - ASSERT_OBJECT_REFCOUNT (client, "network client clock", 1); - - gst_object_unref (client); - - ASSERT_OBJECT_REFCOUNT (local, "system clock", 2); - - gst_object_unref (local); -} - -GST_END_TEST; - -GST_START_TEST (test_functioning) -{ - GstNetTimeProvider *ntp; - GstClock *client, *server; - GstClockTime basex, basey, rate_num, rate_denom; - GstClockTime servtime, clienttime; - gint port; - - server = gst_system_clock_obtain (); - fail_unless (server != NULL, "failed to get system clock"); - - /* move the clock ahead 100 seconds */ - gst_clock_get_calibration (server, &basex, &basey, &rate_num, &rate_denom); - basey += 100 * GST_SECOND; - gst_clock_set_calibration (server, basex, basey, rate_num, rate_denom); - - ntp = gst_net_time_provider_new (server, "127.0.0.1", 0); - fail_unless (ntp != NULL, "failed to create network time provider"); - - g_object_get (ntp, "port", &port, NULL); - - client = gst_net_client_clock_new (NULL, "127.0.0.1", port, GST_SECOND); - fail_unless (client != NULL, "failed to get network client clock"); - - g_object_get (client, "port", &port, NULL); - - /* let the clocks synchronize */ - g_usleep (G_USEC_PER_SEC / 2); - - servtime = gst_clock_get_time (server); - clienttime = gst_clock_get_time (client); - - /* can't in general make a precise assertion here, because this depends on - * system load and a lot of things. however within half a second they should - * at least be within 1/10 of a second of each other... */ - if (servtime > clienttime) - fail_unless (servtime - clienttime < 100 * GST_MSECOND, - "clocks not in sync (%" GST_TIME_FORMAT ")", - GST_TIME_ARGS (servtime - clienttime)); - else - fail_unless (clienttime - servtime < 100 * GST_MSECOND, - "clocks not in sync (%" GST_TIME_FORMAT ")", - GST_TIME_ARGS (clienttime - servtime)); - - /* - g_print ("diff: %" GST_TIME_FORMAT, - GST_TIME_ARGS (servtime > clienttime ? servtime - clienttime - : clienttime - servtime)); - */ - - /* one for gstreamer, one for ntp, one for us */ - ASSERT_OBJECT_REFCOUNT (server, "system clock", 3); - ASSERT_OBJECT_REFCOUNT (client, "network client clock", 1); - - gst_object_unref (ntp); - - ASSERT_OBJECT_REFCOUNT (server, "system clock", 2); - - gst_object_unref (client); - gst_object_unref (server); -} - -GST_END_TEST; - -Suite * -gst_net_client_clock_suite (void) -{ - Suite *s = suite_create ("GstNetClientClock"); - TCase *tc_chain = tcase_create ("generic tests"); - - tcase_set_timeout (tc_chain, 0); - - suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, test_instantiation); - tcase_add_test (tc_chain, test_functioning); - - return s; -} - -int -main (int argc, char **argv) -{ - int nf; - - Suite *s = gst_net_client_clock_suite (); - SRunner *sr = srunner_create (s); - - gst_check_init (&argc, &argv); - - srunner_run_all (sr, CK_NORMAL); - nf = srunner_ntests_failed (sr); - srunner_free (sr); - - return nf; -} diff --git a/check/net/gstnettimeprovider.c b/check/net/gstnettimeprovider.c deleted file mode 100644 index e0008da115..0000000000 --- a/check/net/gstnettimeprovider.c +++ /dev/null @@ -1,140 +0,0 @@ -/* GStreamer - * Copyright (C) 2005 Andy Wingo - * - * gstnettimeprovider.c: Unit test for the network time provider - * - * 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 - -GST_START_TEST (test_refcounts) -{ - GstNetTimeProvider *ntp; - GstClock *clock; - - clock = gst_system_clock_obtain (); - fail_unless (clock != NULL, "failed to get system clock"); - - /* one for gstreamer, one for us */ - ASSERT_OBJECT_REFCOUNT (clock, "system clock", 2); - - ntp = gst_net_time_provider_new (clock, NULL, 0); - fail_unless (ntp != NULL, "failed to create net time provider"); - - /* one for ntp, one for gstreamer, one for us */ - ASSERT_OBJECT_REFCOUNT (clock, "system clock", 3); - /* one for us */ - ASSERT_OBJECT_REFCOUNT (ntp, "net time provider", 1); - - gst_object_unref (ntp); - ASSERT_OBJECT_REFCOUNT (clock, "net time provider", 2); - - gst_object_unref (clock); -} - -GST_END_TEST; - -GST_START_TEST (test_functioning) -{ - GstNetTimeProvider *ntp; - GstNetTimePacket *packet; - GstClock *clock; - GstClockTime local; - struct sockaddr_in servaddr; - gint port = -1, sockfd, ret; - socklen_t len; - - clock = gst_system_clock_obtain (); - fail_unless (clock != NULL, "failed to get system clock"); - ntp = gst_net_time_provider_new (clock, "127.0.0.1", 0); - fail_unless (ntp != NULL, "failed to create net time provider"); - - g_object_get (ntp, "port", &port, NULL); - fail_unless (port > 0); - - sockfd = socket (AF_INET, SOCK_DGRAM, 0); - fail_if (sockfd < 0, "socket failed"); - - memset (&servaddr, 0, sizeof (servaddr)); - servaddr.sin_family = AF_INET; - servaddr.sin_port = htons (port); - inet_aton ("127.0.0.1", &servaddr.sin_addr); - - packet = gst_net_time_packet_new (NULL); - fail_unless (packet != NULL, "failed to create packet"); - - packet->local_time = local = gst_clock_get_time (clock); - - len = sizeof (servaddr); - ret = gst_net_time_packet_send (packet, sockfd, - (struct sockaddr *) &servaddr, len); - - fail_unless (ret == GST_NET_TIME_PACKET_SIZE, "failed to send packet"); - - g_free (packet); - - packet = gst_net_time_packet_receive (sockfd, (struct sockaddr *) &servaddr, - &len); - - fail_unless (packet != NULL, "failed to receive packet"); - fail_unless (packet->local_time == local, "local time is not the same"); - fail_unless (packet->remote_time > local, "remote time not after local time"); - fail_unless (packet->remote_time < gst_clock_get_time (clock), - "remote time in the future"); - - g_free (packet); - - close (sockfd); - - gst_object_unref (ntp); - gst_object_unref (clock); -} - -GST_END_TEST; - -Suite * -gst_net_time_provider_suite (void) -{ - Suite *s = suite_create ("GstNetTimeProvider"); - TCase *tc_chain = tcase_create ("generic tests"); - - suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, test_refcounts); - tcase_add_test (tc_chain, test_functioning); - - return s; -} - -int -main (int argc, char **argv) -{ - int nf; - - Suite *s = gst_net_time_provider_suite (); - SRunner *sr = srunner_create (s); - - gst_check_init (&argc, &argv); - - srunner_run_all (sr, CK_NORMAL); - nf = srunner_ntests_failed (sr); - srunner_free (sr); - - return nf; -} diff --git a/check/pipelines/.gitignore b/check/pipelines/.gitignore deleted file mode 100644 index b67fcb7198..0000000000 --- a/check/pipelines/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -.dirstamp -cleanup -simple_launch_lines -stress diff --git a/check/pipelines/cleanup.c b/check/pipelines/cleanup.c deleted file mode 100644 index b268e461b1..0000000000 --- a/check/pipelines/cleanup.c +++ /dev/null @@ -1,132 +0,0 @@ -/* GStreamer - * Copyright (C) <2005> Thomas Vander Stichele - * - * cleanup.c: Unit test for cleanup of pipelines - * - * 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 * -setup_pipeline (gchar * pipe_descr) -{ - GstElement *pipeline; - - pipeline = gst_parse_launch (pipe_descr, NULL); - g_return_val_if_fail (GST_IS_PIPELINE (pipeline), NULL); - return pipeline; -} - -/* events is a mask of expected events. tevent is the expected terminal event. - the poll call will time out after half a second. - */ -static void -run_pipeline (GstElement * pipeline, gchar * descr, - GstMessageType events, GstMessageType tevent) -{ - GstBus *bus; - GstMessageType revent; - - bus = gst_element_get_bus (pipeline); - g_assert (bus); - gst_element_set_state (pipeline, GST_STATE_PLAYING); - - while (1) { - GstMessage *message = gst_bus_poll (bus, GST_MESSAGE_ANY, GST_SECOND / 2); - - if (message) { - revent = GST_MESSAGE_TYPE (message); - gst_message_unref (message); - } else { - revent = GST_MESSAGE_UNKNOWN; - } - - if (revent == tevent) { - break; - } else if (revent == GST_MESSAGE_UNKNOWN) { - g_critical ("Unexpected timeout in gst_bus_poll, looking for %d: %s", - tevent, descr); - break; - } else if (revent & events) { - continue; - } - g_critical ("Unexpected message received of type %d, looking for %d: %s", - revent, tevent, descr); - } - - gst_element_set_state (pipeline, GST_STATE_NULL); - gst_object_unref (pipeline); - gst_object_unref (bus); -} - -GST_START_TEST (test_pipeline_unref) -{ - gchar *s; - GstElement *pipeline, *src, *sink; - - s = "fakesrc name=src num-buffers=20 ! fakesink name=sink"; - pipeline = setup_pipeline (s); - /* get_by_name takes a ref */ - src = gst_bin_get_by_name (GST_BIN (pipeline), "src"); - fail_if (src == NULL); - sink = gst_bin_get_by_name (GST_BIN (pipeline), "sink"); - fail_if (sink == NULL); - - run_pipeline (pipeline, s, GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED, - GST_MESSAGE_EOS); - while (GST_OBJECT_REFCOUNT_VALUE (src) > 1) - THREAD_SWITCH (); - ASSERT_OBJECT_REFCOUNT (src, "src", 1); - ASSERT_OBJECT_REFCOUNT (sink, "sink", 1); - gst_object_unref (src); - gst_object_unref (sink); -} - -GST_END_TEST; - -Suite * -cleanup_suite (void) -{ - Suite *s = suite_create ("Pipeline cleanup"); - TCase *tc_chain = tcase_create ("linear"); - - /* time out after 20s, not the default 3 */ - tcase_set_timeout (tc_chain, 20); - - suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, test_pipeline_unref); - return s; -} - -int -main (int argc, char **argv) -{ - int nf; - - Suite *s = cleanup_suite (); - SRunner *sr = srunner_create (s); - - gst_check_init (&argc, &argv); - - srunner_run_all (sr, CK_NORMAL); - nf = srunner_ntests_failed (sr); - srunner_free (sr); - - return nf; -} diff --git a/check/pipelines/simple_launch_lines.c b/check/pipelines/simple_launch_lines.c deleted file mode 100644 index c588181569..0000000000 --- a/check/pipelines/simple_launch_lines.c +++ /dev/null @@ -1,225 +0,0 @@ -/* GStreamer - * Copyright (C) 2005 Andy Wingo - * - * simple_launch_lines.c: Unit test for simple pipelines - * - * 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 * -setup_pipeline (gchar * pipe_descr) -{ - GstElement *pipeline; - - pipeline = gst_parse_launch (pipe_descr, NULL); - fail_unless (GST_IS_PIPELINE (pipeline)); - return pipeline; -} - -/* - * run_pipeline: - * @pipe: the pipeline to run - * @desc: the description for use in messages - * @message_types: is a mask of expected message_types - * @tmessage: is the expected terminal message - * - * the poll call will time out after half a second. - */ -static void -run_pipeline (GstElement * pipeline, gchar * descr, - GstMessageType message_types, GstMessageType tmessage) -{ - GstBus *bus; - GstMessageType rmessage; - GstStateChangeReturn ret; - - fail_if (pipeline == NULL); - bus = gst_element_get_bus (pipeline); - fail_if (bus == NULL); - - ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); - ret = gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE); - - if (ret != GST_STATE_CHANGE_SUCCESS) { - g_critical ("Couldn't set pipeline to PLAYING"); - goto done; - } - - while (1) { - GstMessage *message = gst_bus_poll (bus, GST_MESSAGE_ANY, GST_SECOND / 2); - - if (message) { - rmessage = GST_MESSAGE_TYPE (message); - gst_message_unref (message); - } else { - rmessage = GST_MESSAGE_UNKNOWN; - } - - if (rmessage == tmessage) { - break; - } else if (rmessage == GST_MESSAGE_UNKNOWN) { - g_critical ("Unexpected timeout in gst_bus_poll, looking for %d: %s", - tmessage, descr); - break; - } else if (rmessage & message_types) { - continue; - } - g_critical ("Unexpected message received of type %d, looking for %d: %s", - rmessage, tmessage, descr); - } - -done: - gst_element_set_state (pipeline, GST_STATE_NULL); - gst_object_unref (pipeline); - gst_object_unref (bus); -} - -GST_START_TEST (test_2_elements) -{ - gchar *s; - - s = "fakesrc can-activate-push=false ! fakesink can-activate-pull=true"; - run_pipeline (setup_pipeline (s), s, - GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED, GST_MESSAGE_UNKNOWN); - - s = "fakesrc can-activate-push=true ! fakesink can-activate-pull=false"; - run_pipeline (setup_pipeline (s), s, - GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED, GST_MESSAGE_UNKNOWN); - - s = "fakesrc can-activate-push=false num-buffers=10 ! fakesink can-activate-pull=true"; - run_pipeline (setup_pipeline (s), s, - GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED, GST_MESSAGE_EOS); - - s = "fakesrc can-activate-push=true num-buffers=10 ! fakesink can-activate-pull=false"; - run_pipeline (setup_pipeline (s), s, - GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED, GST_MESSAGE_EOS); - - s = "fakesrc can-activate-push=false ! fakesink can-activate-pull=false"; - ASSERT_CRITICAL (run_pipeline (setup_pipeline (s), s, - GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED, - GST_MESSAGE_UNKNOWN)); -} - -GST_END_TEST; - -static void -got_handoff (GstElement * sink, GstBuffer * buf, GstPad * pad, gpointer unused) -{ - gst_element_post_message - (sink, gst_message_new_application (NULL, gst_structure_new ("foo", - NULL))); -} - -static void -assert_live_count (GType type, gint live) -{ - GstAllocTrace *trace; - const gchar *name; - - if (gst_alloc_trace_available ()) { - name = g_type_name (type); - fail_if (name == NULL); - trace = gst_alloc_trace_get (name); - if (trace) { - g_return_if_fail (trace->live == live); - } - } else { - g_print ("\nSkipping live count tests; recompile with traces to enable\n"); - } -} - -GST_START_TEST (test_stop_from_app) -{ - GstElement *fakesrc, *fakesink, *pipeline; - GstBus *bus; - GstMessageType rmessage; - GstMessage *message; - - assert_live_count (GST_TYPE_BUFFER, 0); - - fakesrc = gst_element_factory_make ("fakesrc", NULL); - fakesink = gst_element_factory_make ("fakesink", NULL); - pipeline = gst_element_factory_make ("pipeline", NULL); - - fail_unless (fakesrc && fakesink && pipeline); - - gst_bin_add_many (GST_BIN (pipeline), fakesrc, fakesink, NULL); - gst_element_link (fakesrc, fakesink); - - g_object_set (fakesink, "signal-handoffs", (gboolean) TRUE, NULL); - g_signal_connect (fakesink, "handoff", G_CALLBACK (got_handoff), NULL); - - gst_element_set_state (pipeline, GST_STATE_PLAYING); - - bus = gst_element_get_bus (pipeline); - fail_if (bus == NULL); - - /* will time out after half a second */ - message = gst_bus_poll (bus, GST_MESSAGE_APPLICATION, GST_SECOND / 2); - if (message) { - rmessage = GST_MESSAGE_TYPE (message); - gst_message_unref (message); - } else { - rmessage = GST_MESSAGE_UNKNOWN; - } - fail_unless (rmessage == GST_MESSAGE_APPLICATION, - "polled message is not APPLICATION but %s", - gst_message_type_get_name (rmessage)); - - gst_element_set_state (pipeline, GST_STATE_NULL); - gst_object_unref (pipeline); - gst_object_unref (bus); - - assert_live_count (GST_TYPE_BUFFER, 0); -} - -GST_END_TEST; - -Suite * -simple_launch_lines_suite (void) -{ - Suite *s = suite_create ("Pipelines"); - TCase *tc_chain = tcase_create ("linear"); - - /* time out after 20s, not the default 3 */ - tcase_set_timeout (tc_chain, 0); - - suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, test_2_elements); - tcase_add_test (tc_chain, test_stop_from_app); - return s; -} - -int -main (int argc, char **argv) -{ - int nf; - - Suite *s = simple_launch_lines_suite (); - SRunner *sr = srunner_create (s); - - gst_check_init (&argc, &argv); - - srunner_run_all (sr, CK_NORMAL); - nf = srunner_ntests_failed (sr); - srunner_free (sr); - - return nf; -} diff --git a/check/pipelines/stress.c b/check/pipelines/stress.c deleted file mode 100644 index aff1f10f9e..0000000000 --- a/check/pipelines/stress.c +++ /dev/null @@ -1,88 +0,0 @@ -/* GStreamer - * Copyright (C) 2005 Andy Wingo - * - * simple_launch_lines.c: Unit test for simple pipelines - * - * 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_START_TEST (test_stress) -{ - GstElement *fakesrc, *fakesink, *pipeline; - gint i; - - fakesrc = gst_element_factory_make ("fakesrc", NULL); - fakesink = gst_element_factory_make ("fakesink", NULL); - pipeline = gst_element_factory_make ("pipeline", NULL); - - g_return_if_fail (fakesrc && fakesink && pipeline); - - gst_bin_add_many (GST_BIN (pipeline), fakesrc, fakesink, NULL); - gst_element_link (fakesrc, fakesink); - - i = 100; - while (i--) { - gst_element_set_state (pipeline, GST_STATE_PAUSED); - gst_element_set_state (pipeline, GST_STATE_PLAYING); - - gst_element_set_state (pipeline, GST_STATE_PAUSED); - gst_element_set_state (pipeline, GST_STATE_PLAYING); - gst_element_set_state (pipeline, GST_STATE_PAUSED); - gst_element_set_state (pipeline, GST_STATE_READY); - gst_element_set_state (pipeline, GST_STATE_PLAYING); - gst_element_set_state (pipeline, GST_STATE_PAUSED); - gst_element_set_state (pipeline, GST_STATE_READY); - gst_element_set_state (pipeline, GST_STATE_PAUSED); - gst_element_set_state (pipeline, GST_STATE_NULL); - } - - gst_object_unref (pipeline); -} - -GST_END_TEST Suite * -simple_launch_lines_suite (void) -{ - Suite *s = suite_create ("stress"); - TCase *tc_chain = tcase_create ("linear"); - - /* time out after 20s, not the default 3 */ - tcase_set_timeout (tc_chain, 0); - - suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, test_stress); - return s; -} - -int -main (int argc, char **argv) -{ - int nf; - - Suite *s = simple_launch_lines_suite (); - SRunner *sr = srunner_create (s); - - gst_check_init (&argc, &argv); - - srunner_run_all (sr, CK_NORMAL); - nf = srunner_ntests_failed (sr); - srunner_free (sr); - - return nf; -} diff --git a/check/states/.gitignore b/check/states/.gitignore deleted file mode 100644 index da90f2427f..0000000000 --- a/check/states/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -sinks -.dirstamp diff --git a/check/states/sinks.c b/check/states/sinks.c deleted file mode 100644 index 1fb292b312..0000000000 --- a/check/states/sinks.c +++ /dev/null @@ -1,470 +0,0 @@ -/* GStreamer - * - * unit test for sinks - * - * Copyright (C) <2005> Wim Taymans - * - * 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 -pop_state_change_message (GstBus * bus, GstElement * src, GstState old, - GstState new, GstState pending) -{ - GstMessage *message = NULL; - GstState _old, _new, _pending; - - message = gst_bus_poll (bus, GST_MESSAGE_STATE_CHANGED, GST_SECOND); - fail_unless (message != NULL, - "Expected state change message, but got nothing"); - - gst_message_parse_state_changed (message, &_old, &_new, &_pending); - - fail_unless (GST_MESSAGE_SRC (message) == (GstObject *) src, - "Unexpected state change order"); - fail_unless (old == _old, "Unexpected old state"); - fail_unless (new == _new, "Unexpected new state"); - fail_unless (pending == _pending, "Unexpected pending state"); - - gst_message_unref (message); -} - -/* a sink should go ASYNC to PAUSE. forcing PLAYING is possible */ -GST_START_TEST (test_sink) -{ - GstElement *sink; - GstStateChangeReturn ret; - GstState current, pending; - - sink = gst_element_factory_make ("fakesink", "sink"); - - ret = gst_element_set_state (sink, GST_STATE_PAUSED); - fail_unless (ret == GST_STATE_CHANGE_ASYNC, "no async state return"); - - ret = gst_element_set_state (sink, GST_STATE_PLAYING); - fail_unless (ret == GST_STATE_CHANGE_ASYNC, "no forced async state change"); - - ret = gst_element_get_state (sink, ¤t, &pending, 0); - fail_unless (ret == GST_STATE_CHANGE_ASYNC, "not changing state async"); - fail_unless (current == GST_STATE_READY, "bad current state"); - fail_unless (pending == GST_STATE_PLAYING, "bad pending state"); - - ret = gst_element_set_state (sink, GST_STATE_PAUSED); - fail_unless (ret == GST_STATE_CHANGE_ASYNC, "no async going back to paused"); - - ret = gst_element_set_state (sink, GST_STATE_READY); - fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "failed to go to ready"); - - ret = gst_element_set_state (sink, GST_STATE_NULL); - fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "failed to go to null"); - - gst_object_unref (sink); -} - -GST_END_TEST -/* a sink should go ASYNC to PAUSE and PLAYING, when linking a src, it - * should complete the state change. */ -GST_START_TEST (test_sink_completion) -{ - GstElement *sink, *src; - GstStateChangeReturn ret; - GstState current, pending; - - sink = gst_element_factory_make ("fakesink", "sink"); - - ret = gst_element_set_state (sink, GST_STATE_PLAYING); - fail_unless (ret == GST_STATE_CHANGE_ASYNC, "no async state return"); - - ret = gst_element_get_state (sink, ¤t, &pending, 0); - fail_unless (ret == GST_STATE_CHANGE_ASYNC, "not changing state async"); - fail_unless (current == GST_STATE_READY, "bad current state"); - fail_unless (pending == GST_STATE_PLAYING, "bad pending state"); - - src = gst_element_factory_make ("fakesrc", "src"); - gst_element_link (src, sink); - - ret = gst_element_set_state (src, GST_STATE_PLAYING); - fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "no success state return"); - - /* now wait for final state */ - ret = gst_element_get_state (sink, ¤t, &pending, GST_CLOCK_TIME_NONE); - fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "failed to change state"); - fail_unless (current == GST_STATE_PLAYING, "bad current state"); - fail_unless (pending == GST_STATE_VOID_PENDING, "bad pending state"); - - ret = gst_element_set_state (sink, GST_STATE_NULL); - fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "failed to go to null"); - - ret = gst_element_set_state (src, GST_STATE_NULL); - fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "failed to go to null"); - - gst_object_unref (sink); - gst_object_unref (src); -} - -GST_END_TEST -/* a sink should go ASYNC to PAUSE. PAUSE should complete when - * prerolled. */ -GST_START_TEST (test_src_sink) -{ - GstElement *sink, *src, *pipeline; - GstStateChangeReturn ret; - GstState current, pending; - GstPad *srcpad, *sinkpad; - - pipeline = gst_pipeline_new ("pipeline"); - src = gst_element_factory_make ("fakesrc", "src"); - sink = gst_element_factory_make ("fakesink", "sink"); - - gst_bin_add (GST_BIN (pipeline), src); - gst_bin_add (GST_BIN (pipeline), sink); - - srcpad = gst_element_get_pad (src, "src"); - sinkpad = gst_element_get_pad (sink, "sink"); - gst_pad_link (srcpad, sinkpad); - gst_object_unref (srcpad); - gst_object_unref (sinkpad); - - ret = gst_element_set_state (pipeline, GST_STATE_PAUSED); - fail_unless (ret == GST_STATE_CHANGE_ASYNC, "no async state return"); - ret = gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE); - fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "no success state return"); - - ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); - fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "cannot start play"); - - ret = - gst_element_get_state (pipeline, ¤t, &pending, GST_CLOCK_TIME_NONE); - fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "not playing"); - fail_unless (current == GST_STATE_PLAYING, "not playing"); - fail_unless (pending == GST_STATE_VOID_PENDING, "not playing"); - ret = gst_element_set_state (pipeline, GST_STATE_NULL); - fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "cannot null pipeline"); - - gst_object_unref (pipeline); - -} - -GST_END_TEST -/* a pipeline with live source should return NO_PREROLL in - * PAUSE. When removing the live source it should return ASYNC - * from the sink */ -GST_START_TEST (test_livesrc_remove) -{ - GstElement *sink, *src, *pipeline; - GstStateChangeReturn ret; - GstState current, pending; - GstPad *srcpad, *sinkpad; - - pipeline = gst_pipeline_new ("pipeline"); - src = gst_element_factory_make ("fakesrc", "src"); - g_object_set (G_OBJECT (src), "is-live", TRUE, NULL); - sink = gst_element_factory_make ("fakesink", "sink"); - - gst_bin_add (GST_BIN (pipeline), src); - gst_bin_add (GST_BIN (pipeline), sink); - - srcpad = gst_element_get_pad (src, "src"); - sinkpad = gst_element_get_pad (sink, "sink"); - gst_pad_link (srcpad, sinkpad); - gst_object_unref (srcpad); - gst_object_unref (sinkpad); - - ret = gst_element_set_state (pipeline, GST_STATE_PAUSED); - fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, - "no no_preroll state return"); - - ret = gst_element_get_state (src, ¤t, &pending, GST_CLOCK_TIME_NONE); - fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, "not paused"); - fail_unless (current == GST_STATE_PAUSED, "not paused"); - fail_unless (pending == GST_STATE_VOID_PENDING, "not playing"); - - gst_bin_remove (GST_BIN (pipeline), src); - - ret = gst_element_get_state (pipeline, ¤t, &pending, 0); - fail_unless (ret == GST_STATE_CHANGE_ASYNC, "not async"); - fail_unless (current == GST_STATE_PAUSED, "not paused"); - fail_unless (pending == GST_STATE_PAUSED, "not paused"); -} - -GST_END_TEST -/* the sink should go ASYNC to PAUSE. The live source should go - * NO_PREROLL to PAUSE. the pipeline returns NO_PREROLL. An - * attempt to go to PLAYING will return ASYNC. polling state - * completion should return SUCCESS when the sink is gone to - * PLAYING. */ -GST_START_TEST (test_livesrc_sink) -{ - GstElement *sink, *src, *pipeline; - GstStateChangeReturn ret; - GstState current, pending; - GstPad *srcpad, *sinkpad; - GstBus *bus; - - pipeline = gst_pipeline_new ("pipeline"); - src = gst_element_factory_make ("fakesrc", "src"); - g_object_set (G_OBJECT (src), "is-live", TRUE, NULL); - sink = gst_element_factory_make ("fakesink", "sink"); - - gst_bin_add (GST_BIN (pipeline), src); - gst_bin_add (GST_BIN (pipeline), sink); - - srcpad = gst_element_get_pad (src, "src"); - sinkpad = gst_element_get_pad (sink, "sink"); - gst_pad_link (srcpad, sinkpad); - gst_object_unref (srcpad); - gst_object_unref (sinkpad); - - bus = gst_element_get_bus (pipeline); - - ret = gst_element_set_state (pipeline, GST_STATE_PAUSED); - fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, - "no no_preroll state return"); - - pop_state_change_message (bus, sink, GST_STATE_NULL, GST_STATE_READY, - GST_STATE_VOID_PENDING); - pop_state_change_message (bus, src, GST_STATE_NULL, GST_STATE_READY, - GST_STATE_VOID_PENDING); - pop_state_change_message (bus, pipeline, GST_STATE_NULL, GST_STATE_READY, - GST_STATE_PAUSED); - - /* this order only holds true for live sources because they do not push - buffers in PAUSED */ - pop_state_change_message (bus, src, GST_STATE_READY, GST_STATE_PAUSED, - GST_STATE_VOID_PENDING); - pop_state_change_message (bus, pipeline, GST_STATE_READY, GST_STATE_PAUSED, - GST_STATE_VOID_PENDING); - - ret = gst_element_set_state (pipeline, GST_STATE_PAUSED); - fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, - "no no_preroll state return the second time"); - - ret = gst_element_get_state (src, ¤t, &pending, GST_CLOCK_TIME_NONE); - fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, "not paused"); - fail_unless (current == GST_STATE_PAUSED, "not paused"); - fail_unless (pending == GST_STATE_VOID_PENDING, "not playing"); - - /* don't block here */ - ret = gst_element_get_state (sink, ¤t, &pending, 0); - fail_unless (ret == GST_STATE_CHANGE_ASYNC, "not async"); - fail_unless (current == GST_STATE_READY, "not ready"); - fail_unless (pending == GST_STATE_PAUSED, "not paused"); - - ret = - gst_element_get_state (pipeline, ¤t, &pending, GST_CLOCK_TIME_NONE); - fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, "not paused"); - fail_unless (current == GST_STATE_PAUSED, "not paused"); - fail_unless (pending == GST_STATE_VOID_PENDING, "not playing"); - - ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); - fail_unless (ret == GST_STATE_CHANGE_ASYNC, "not async"); - ret = - gst_element_get_state (pipeline, ¤t, &pending, GST_CLOCK_TIME_NONE); - fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "not playing"); - fail_unless (current == GST_STATE_PLAYING, "not playing"); - fail_unless (pending == GST_STATE_VOID_PENDING, "not playing"); - - /* now we have four messages on the bus: src from paused to playing, sink from - ready to paused and paused to playing, and pipeline from paused to playing. - the pipeline message should be last, and the sink messages should go in - order, but the src message can be interleaved with the sink one. */ - { - GstMessage *m; - GstState old, new, pending; - gint n_src = 1, n_sink = 2; - - while (n_src + n_sink > 0) { - m = gst_bus_poll (bus, GST_MESSAGE_STATE_CHANGED, GST_SECOND); - fail_unless (m != NULL, "expected state change message"); - gst_message_parse_state_changed (m, &old, &new, &pending); - if (GST_MESSAGE_SRC (m) == (GstObject *) src) { - fail_unless (n_src == 1, "already got one message from the src"); - n_src--; - fail_unless (old == GST_STATE_PAUSED, "unexpected old"); - fail_unless (new == GST_STATE_PLAYING, "unexpected new (got %d)", new); - fail_unless (pending == GST_STATE_VOID_PENDING, "unexpected pending"); - } else if (GST_MESSAGE_SRC (m) == (GstObject *) sink) { - if (n_sink == 2) { - fail_unless (old == GST_STATE_READY, "unexpected old"); - fail_unless (new == GST_STATE_PAUSED, "unexpected new"); - fail_unless (pending == GST_STATE_PLAYING, "unexpected pending"); - } else if (n_sink == 1) { - fail_unless (old == GST_STATE_PAUSED, "unexpected old"); - fail_unless (new == GST_STATE_PLAYING, "unexpected new"); - fail_unless (pending == GST_STATE_VOID_PENDING, "unexpected pending"); - } else { - g_assert_not_reached (); - } - n_sink--; - } else { - g_critical - ("Unexpected state change message src %s (%d src %d sink pending)", - GST_OBJECT_NAME (GST_MESSAGE_SRC (m)), n_src, n_sink); - } - gst_message_unref (m); - } - } - - pop_state_change_message (bus, pipeline, GST_STATE_PAUSED, GST_STATE_PLAYING, - GST_STATE_VOID_PENDING); - - gst_object_unref (bus); - gst_element_set_state (pipeline, GST_STATE_NULL); - gst_object_unref (pipeline); -} - -GST_END_TEST; - -/* The sink should go ASYNC to PLAYING. The source should go - * to PLAYING with SUCCESS. The pipeline returns ASYNC. */ -GST_START_TEST (test_livesrc2_sink) -{ - GstElement *sink, *src, *pipeline; - GstStateChangeReturn ret; - GstState current, pending; - GstPad *srcpad, *sinkpad; - - pipeline = gst_pipeline_new ("pipeline"); - src = gst_element_factory_make ("fakesrc", "src"); - g_object_set (G_OBJECT (src), "is-live", TRUE, NULL); - sink = gst_element_factory_make ("fakesink", "sink"); - - gst_bin_add (GST_BIN (pipeline), src); - gst_bin_add (GST_BIN (pipeline), sink); - - srcpad = gst_element_get_pad (src, "src"); - sinkpad = gst_element_get_pad (sink, "sink"); - gst_pad_link (srcpad, sinkpad); - gst_object_unref (srcpad); - gst_object_unref (sinkpad); - - ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); - fail_unless (ret == GST_STATE_CHANGE_ASYNC, "no async state return"); - - ret = gst_element_get_state (src, ¤t, &pending, GST_CLOCK_TIME_NONE); - fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "not playing"); - fail_unless (current == GST_STATE_PLAYING, "not playing"); - fail_unless (pending == GST_STATE_VOID_PENDING, "not playing"); - - ret = - gst_element_get_state (pipeline, ¤t, &pending, GST_CLOCK_TIME_NONE); - fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "not playing"); - fail_unless (current == GST_STATE_PLAYING, "not playing"); - fail_unless (pending == GST_STATE_VOID_PENDING, "not playing"); - - /* and back down */ - ret = gst_element_set_state (pipeline, GST_STATE_PAUSED); - fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, - "no no_preroll state return"); - - ret = gst_element_get_state (src, ¤t, &pending, GST_CLOCK_TIME_NONE); - fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL, "not no_preroll"); - fail_unless (current == GST_STATE_PAUSED, "not paused"); - fail_unless (pending == GST_STATE_VOID_PENDING, "not paused"); - - /* sink state is not known.. it might be prerolled or not */ - - /* and to READY */ - ret = gst_element_set_state (pipeline, GST_STATE_READY); - fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "no success state return"); - - ret = gst_element_get_state (src, ¤t, &pending, GST_CLOCK_TIME_NONE); - fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "not success"); - fail_unless (current == GST_STATE_READY, "not ready"); - fail_unless (pending == GST_STATE_VOID_PENDING, "not ready"); - - ret = gst_element_get_state (sink, ¤t, &pending, GST_CLOCK_TIME_NONE); - fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "not success"); - fail_unless (current == GST_STATE_READY, "not ready"); - fail_unless (pending == GST_STATE_VOID_PENDING, "not ready"); -} - -GST_END_TEST; - -GST_START_TEST (test_livesrc3_sink) -{ - GstElement *sink, *src, *pipeline; - GstStateChangeReturn ret; - GstState current, pending; - GstPad *srcpad, *sinkpad; - - pipeline = gst_pipeline_new ("pipeline"); - src = gst_element_factory_make ("fakesrc", "src"); - g_object_set (G_OBJECT (src), "is-live", TRUE, NULL); - sink = gst_element_factory_make ("fakesink", "sink"); - - gst_bin_add (GST_BIN (pipeline), src); - gst_bin_add (GST_BIN (pipeline), sink); - - srcpad = gst_element_get_pad (src, "src"); - sinkpad = gst_element_get_pad (sink, "sink"); - gst_pad_link (srcpad, sinkpad); - gst_object_unref (srcpad); - gst_object_unref (sinkpad); - - ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); - fail_unless (ret == GST_STATE_CHANGE_ASYNC, "no async state return"); - - ret = - gst_element_get_state (pipeline, ¤t, &pending, GST_CLOCK_TIME_NONE); - fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "not playing"); - fail_unless (current == GST_STATE_PLAYING, "not playing"); - fail_unless (pending == GST_STATE_VOID_PENDING, "not playing"); - - /* and back down */ - ret = gst_element_set_state (pipeline, GST_STATE_NULL); - fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "no success state return"); -} - -GST_END_TEST; - -/* test: try changing state of sinks */ -Suite * -gst_object_suite (void) -{ - Suite *s = suite_create ("Sinks"); - TCase *tc_chain = tcase_create ("general"); - - suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, test_sink); - tcase_add_test (tc_chain, test_sink_completion); - tcase_add_test (tc_chain, test_src_sink); - tcase_add_test (tc_chain, test_livesrc_remove); - tcase_add_test (tc_chain, test_livesrc_sink); - tcase_add_test (tc_chain, test_livesrc2_sink); - tcase_add_test (tc_chain, test_livesrc3_sink); - - return s; -} - -int -main (int argc, char **argv) -{ - int nf; - - Suite *s = gst_object_suite (); - SRunner *sr = srunner_create (s); - - gst_check_init (&argc, &argv); - - srunner_run_all (sr, CK_NORMAL); - nf = srunner_ntests_failed (sr); - srunner_free (sr); - - return nf; -} diff --git a/configure.ac b/configure.ac index cd3ebaf728..ac2a53be44 100644 --- a/configure.ac +++ b/configure.ac @@ -485,36 +485,9 @@ plugins/Makefile plugins/indexers/Makefile plugins/elements/Makefile po/Makefile.in -check/Makefile tests/Makefile tests/benchmarks/Makefile -testsuite/Makefile -testsuite/caps/Makefile -testsuite/debug/Makefile -testsuite/dlopen/Makefile -testsuite/elements/Makefile -testsuite/indexers/Makefile -testsuite/parse/Makefile -testsuite/plugin/Makefile -testsuite/refcounting/Makefile -testsuite/states/Makefile -testsuite/threads/Makefile -examples/Makefile -examples/controller/Makefile -examples/cutter/Makefile -examples/helloworld/Makefile -examples/launch/Makefile -examples/manual/Makefile -examples/mixer/Makefile -examples/metadata/Makefile -examples/pingpong/Makefile -examples/plugins/Makefile -examples/pwg/Makefile -examples/queue/Makefile -examples/retag/Makefile -examples/thread/Makefile -examples/typefind/Makefile -examples/xml/Makefile +tests/check/Makefile tools/Makefile common/Makefile common/m4/Makefile diff --git a/examples/Makefile.am b/examples/Makefile.am deleted file mode 100644 index e73eaab0a7..0000000000 --- a/examples/Makefile.am +++ /dev/null @@ -1,29 +0,0 @@ -if GST_DISABLE_LOADSAVE -GST_LOADSAVE_DIRS = -else -GST_LOADSAVE_DIRS = xml typefind -endif - -dirs = \ - helloworld \ - queue \ - launch \ - thread \ - plugins \ - mixer \ - metadata \ - controller \ - cutter \ - pingpong \ - manual \ - pwg \ - retag - -#queue2 \ -#queue3 \ -#queue4 - -SUBDIRS = $(dirs) \ - $(GST_LOADSAVE_DIRS) - -DIST_SUBDIRS = $(dirs) xml typefind diff --git a/examples/appreader/.gitignore b/examples/appreader/.gitignore deleted file mode 100644 index 2167b1baf8..0000000000 --- a/examples/appreader/.gitignore +++ /dev/null @@ -1 +0,0 @@ -appreader diff --git a/examples/appreader/Makefile.am b/examples/appreader/Makefile.am deleted file mode 100644 index 68b2265bef..0000000000 --- a/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/examples/appreader/appreader.c b/examples/appreader/appreader.c deleted file mode 100644 index 730d547a4f..0000000000 --- a/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 (pipeline); - - return 0; -} diff --git a/examples/controller/.gitignore b/examples/controller/.gitignore deleted file mode 100644 index 228a5fa898..0000000000 --- a/examples/controller/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -audio-example -*.bb -*.bbg -*.da diff --git a/examples/controller/Makefile.am b/examples/controller/Makefile.am deleted file mode 100644 index 4ab183eccf..0000000000 --- a/examples/controller/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -noinst_PROGRAMS = audio-example - -audio_example_CFLAGS = $(GST_OBJ_CFLAGS) -I$(top_builddir)/libs -audio_example_LDADD = $(GST_OBJ_LIBS) -audio_example_LDFLAGS = $(top_builddir)/libs/gst/controller/libgstcontroller-@GST_MAJORMINOR@.la diff --git a/examples/controller/audio-example.c b/examples/controller/audio-example.c deleted file mode 100644 index 77711c140b..0000000000 --- a/examples/controller/audio-example.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * audio-example.c - * - * Build a pipeline with testaudiosource->alsasink - * and sweep frequency and volume - * - */ - -#include -#include - -gint -main (gint argc, gchar ** argv) -{ - gint res = 1; - GstElement *src, *sink; - GstElement *bin; - GstController *ctrl; - GstClock *clock; - GstClockID clock_id; - GstClockReturn wait_ret; - GValue vol = { 0, }; - - gst_init (&argc, &argv); - gst_controller_init (&argc, &argv); - - // build pipeline - bin = gst_pipeline_new ("pipeline"); - clock = gst_pipeline_get_clock (GST_PIPELINE (bin)); - src = gst_element_factory_make ("audiotestsrc", "gen_audio"); - sink = gst_element_factory_make ("alsasink", "play_audio"); - gst_bin_add_many (GST_BIN (bin), src, sink, NULL); - if (!gst_element_link (src, sink)) { - GST_WARNING ("can't link elements"); - goto Error; - } - // add a controller to the source - if (!(ctrl = gst_controller_new (G_OBJECT (src), "freq", "volume", NULL))) { - GST_WARNING ("can't control source element"); - goto Error; - } - // set interpolation - gst_controller_set_interpolation_mode (ctrl, "volume", - GST_INTERPOLATE_LINEAR); - gst_controller_set_interpolation_mode (ctrl, "freq", GST_INTERPOLATE_LINEAR); - - // set control values - g_value_init (&vol, G_TYPE_DOUBLE); - g_value_set_double (&vol, 0.0); - gst_controller_set (ctrl, "volume", 0 * GST_SECOND, &vol); - g_value_set_double (&vol, 1.0); - gst_controller_set (ctrl, "volume", 5 * GST_SECOND, &vol); - g_value_set_double (&vol, 440.0); - gst_controller_set (ctrl, "freq", 0 * GST_SECOND, &vol); - g_value_set_double (&vol, 3520.0); - gst_controller_set (ctrl, "freq", 3 * GST_SECOND, &vol); - g_value_set_double (&vol, 880.0); - gst_controller_set (ctrl, "freq", 6 * GST_SECOND, &vol); - - clock_id = - gst_clock_new_single_shot_id (clock, - gst_clock_get_time (clock) + (7 * GST_SECOND)); - - // run for 7 seconds - if (gst_element_set_state (bin, GST_STATE_PLAYING)) { - if ((wait_ret = gst_clock_id_wait (clock_id, NULL)) != GST_CLOCK_OK) { - GST_WARNING ("clock_id_wait returned: %d", wait_ret); - } - gst_element_set_state (bin, GST_STATE_NULL); - } - // cleanup - g_object_unref (G_OBJECT (ctrl)); - g_object_unref (G_OBJECT (clock)); - g_object_unref (G_OBJECT (bin)); - res = 0; -Error: - return (res); -} diff --git a/examples/cutter/.gitignore b/examples/cutter/.gitignore deleted file mode 100644 index d1442f38e5..0000000000 --- a/examples/cutter/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -cutter -*.bb -*.bbg -*.da diff --git a/examples/cutter/Makefile.am b/examples/cutter/Makefile.am deleted file mode 100644 index 5285612a45..0000000000 --- a/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/examples/cutter/cutter.c b/examples/cutter/cutter.c deleted file mode 100644 index aa98167935..0000000000 --- a/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 (filesink); - gst_object_unref (main_bin); - - exit (0); -} diff --git a/examples/cutter/cutter.h b/examples/cutter/cutter.h deleted file mode 100644 index d3ac594776..0000000000 --- a/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/examples/events/Makefile.am b/examples/events/Makefile.am deleted file mode 100644 index ef74b46b5d..0000000000 --- a/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/examples/events/seek.c b/examples/events/seek.c deleted file mode 100644 index 4e45f53731..0000000000 --- a/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/examples/helloworld/.gitignore b/examples/helloworld/.gitignore deleted file mode 100644 index 5fffd1801f..0000000000 --- a/examples/helloworld/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -helloworld -*.bb -*.bbg -*.da diff --git a/examples/helloworld/Makefile.am b/examples/helloworld/Makefile.am deleted file mode 100644 index a7d1bd9c25..0000000000 --- a/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/examples/helloworld/helloworld.c b/examples/helloworld/helloworld.c deleted file mode 100644 index 0c2f3ac73e..0000000000 --- a/examples/helloworld/helloworld.c +++ /dev/null @@ -1,87 +0,0 @@ -#include -#include - -static void -event_loop (GstElement * pipe) -{ - GstBus *bus; - GstMessage *message = NULL; - - bus = gst_element_get_bus (GST_ELEMENT (pipe)); - - while (TRUE) { - message = gst_bus_poll (bus, GST_MESSAGE_ANY, -1); - - g_assert (message != NULL); - - switch (message->type) { - case GST_MESSAGE_EOS: - gst_message_unref (message); - return; - case GST_MESSAGE_WARNING: - case GST_MESSAGE_ERROR:{ - GError *gerror; - gchar *debug; - - gst_message_parse_error (message, &gerror, &debug); - gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug); - gst_message_unref (message); - g_error_free (gerror); - g_free (debug); - return; - } - default: - gst_message_unref (message); - break; - } - } -} - -int -main (int argc, char *argv[]) -{ - GstElement *bin, *filesrc, *decoder, *audiosink; - - 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; - } - /* and an audio sink */ - audiosink = gst_element_factory_make ("alsasink", "play_audio"); - g_assert (audiosink); - - /* add objects to the main pipeline */ - gst_bin_add_many (GST_BIN (bin), filesrc, decoder, audiosink, NULL); - - /* link the elements */ - gst_element_link_many (filesrc, decoder, audiosink, NULL); - - /* start playing */ - gst_element_set_state (bin, GST_STATE_PLAYING); - - /* Run event loop listening for bus messages until EOS or ERROR */ - event_loop (bin); - - /* stop the bin */ - gst_element_set_state (bin, GST_STATE_NULL); - - exit (0); -} diff --git a/examples/helloworld2/.gitignore b/examples/helloworld2/.gitignore deleted file mode 100644 index 907ddb903c..0000000000 --- a/examples/helloworld2/.gitignore +++ /dev/null @@ -1 +0,0 @@ -helloworld2 diff --git a/examples/helloworld2/Makefile.am b/examples/helloworld2/Makefile.am deleted file mode 100644 index 8e00b0ac04..0000000000 --- a/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/examples/helloworld2/helloworld2.c b/examples/helloworld2/helloworld2.c deleted file mode 100644 index e78b0b0a12..0000000000 --- a/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 (pipeline); - - exit (0); -} diff --git a/examples/launch/.gitignore b/examples/launch/.gitignore deleted file mode 100644 index 6654cce4b3..0000000000 --- a/examples/launch/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -mp3play -mp3parselaunch -*.bb -*.bbg -*.da diff --git a/examples/launch/Makefile.am b/examples/launch/Makefile.am deleted file mode 100644 index c1b9f298b4..0000000000 --- a/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/examples/launch/mp3parselaunch.c b/examples/launch/mp3parselaunch.c deleted file mode 100644 index 5fe06de550..0000000000 --- a/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/examples/launch/mp3play b/examples/launch/mp3play deleted file mode 100755 index 5577c3b851..0000000000 --- a/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/examples/manual/.gitignore b/examples/manual/.gitignore deleted file mode 100644 index 964c94afd4..0000000000 --- a/examples/manual/.gitignore +++ /dev/null @@ -1,39 +0,0 @@ -Makefile -Makefile.in -*.c -*.o -*.lo -*.la -.deps -.libs - -dynamic -elementget -elementmake -gnome -fakesrc -helloworld -helloworld2 -init -popt -queue -threads -bin -decodebin -elementcreate -elementfactory -elementlink -ghostpad -pad -playbin -query -typefind - -xml-mp3 -xml -xmlTest.gst -README - -*.bb -*.bbg -*.da diff --git a/examples/manual/Makefile.am b/examples/manual/Makefile.am deleted file mode 100644 index 0230defa0c..0000000000 --- a/examples/manual/Makefile.am +++ /dev/null @@ -1,104 +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) - -goption_CFLAGS = -DGETTEXT_PACKAGE="\"gstreamer-0.9\"" - -#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 = \ - bus \ - dynamic \ - $(GNOME) \ - elementcreate \ - elementmake \ - elementfactory \ - elementget \ - elementlink \ - bin \ - pad \ - ghostpad \ - helloworld \ - init \ - goption \ - query \ - typefind \ - probe \ - 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 - -bus.c: $(top_srcdir)/docs/manual/basics-bus.xml - $(PERL_PATH) $(srcdir)/extract.pl $@ \ - $(top_srcdir)/docs/manual/basics-bus.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 goption.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 - -typefind.c dynamic.c: $(top_srcdir)/docs/manual/advanced-autoplugging.xml - $(PERL_PATH) $(srcdir)/extract.pl $@ \ - $(top_srcdir)/docs/manual/advanced-autoplugging.xml - -probe.c 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 goption -tests_fail = -tests_ignore = - -noinst_PROGRAMS = $(EXAMPLES) -LDADD = $(GST_OBJ_LIBS) diff --git a/examples/manual/extract.pl b/examples/manual/extract.pl deleted file mode 100755 index 5c257c70a0..0000000000 --- a/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/examples/metadata/Makefile.am b/examples/metadata/Makefile.am deleted file mode 100644 index 61d2eb8153..0000000000 --- a/examples/metadata/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -noinst_PROGRAMS = read-metadata - -read_metadata_LDADD = $(GST_OBJ_LIBS) -read_metadata_CFLAGS = $(GST_OBJ_CFLAGS) diff --git a/examples/metadata/read-metadata.c b/examples/metadata/read-metadata.c deleted file mode 100644 index 766bb415ea..0000000000 --- a/examples/metadata/read-metadata.c +++ /dev/null @@ -1,207 +0,0 @@ -/* GStreamer - * Copyright (C) 2003 Thomas Vander Stichele - * 2003 Benjamin Otte - * 2005 Andy Wingo - * 2005 Jan Schmidt - * - * gst-metadata.c: Use GStreamer to display metadata within files. - * - * 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 - -char *filename = NULL; -GstElement *pipeline = NULL; -GstElement *source = NULL; - -#define NEW_PIPE_PER_FILE - -static gboolean -message_loop (GstElement * element, GstTagList ** tags) -{ - GstBus *bus; - gboolean done = FALSE; - - bus = gst_element_get_bus (element); - g_return_val_if_fail (bus != NULL, FALSE); - g_return_val_if_fail (tags != NULL, FALSE); - - while (!done) { - GstMessage *message; - - message = gst_bus_poll (bus, GST_MESSAGE_ANY, 0); - if (message == NULL) - /* All messages read, we're done */ - break; - - switch (GST_MESSAGE_TYPE (message)) { - case GST_MESSAGE_ERROR: - case GST_MESSAGE_EOS: - gst_message_unref (message); - return TRUE; - case GST_MESSAGE_TAG: - { - GstTagList *new_tags; - - gst_message_parse_tag (message, &new_tags); - if (*tags) - *tags = gst_tag_list_merge (*tags, new_tags, GST_TAG_MERGE_KEEP_ALL); - else - *tags = new_tags; - break; - } - default: - break; - } - gst_message_unref (message); - } - gst_object_unref (bus); - return TRUE; -} - -static void -make_pipeline () -{ - GstElement *decodebin; - - if (pipeline != NULL) - gst_object_unref (pipeline); - - pipeline = gst_pipeline_new (NULL); - - source = gst_element_factory_make ("filesrc", "source"); - g_assert (GST_IS_ELEMENT (source)); - decodebin = gst_element_factory_make ("decodebin", "decodebin"); - g_assert (GST_IS_ELEMENT (decodebin)); - - gst_bin_add_many (GST_BIN (pipeline), source, decodebin, NULL); - gst_element_link (source, decodebin); -} - -static void -print_tag (const GstTagList * list, const gchar * tag, gpointer unused) -{ - gint i, count; - - count = gst_tag_list_get_tag_size (list, tag); - - for (i = 0; i < count; i++) { - gchar *str; - - if (gst_tag_get_type (tag) == G_TYPE_STRING) { - if (!gst_tag_list_get_string_index (list, tag, i, &str)) - g_assert_not_reached (); - } else { - str = - g_strdup_value_contents (gst_tag_list_get_value_index (list, tag, i)); - } - - if (i == 0) { - g_print (" %15s: %s\n", gst_tag_get_nick (tag), str); - } else { - g_print (" : %s\n", str); - } - - g_free (str); - } -} - -int -main (int argc, char *argv[]) -{ - guint i = 1; - - setlocale (LC_ALL, ""); - - gst_init (&argc, &argv); - - if (argc < 2) { - g_print ("Please give filenames to read metadata from\n\n"); - return 1; - } - - make_pipeline (); - while (i < argc) { - GstStateChangeReturn sret; - GstState state; - GstTagList *tags = NULL; - - filename = argv[i]; - g_object_set (source, "location", filename, NULL); - - GST_DEBUG ("Starting reading for %s", filename); - - /* Decodebin will only commit to PAUSED if it actually finds a type; - * otherwise the state change fails */ - sret = gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PAUSED); - - if (GST_STATE_CHANGE_ASYNC == sret) { - if (GST_STATE_CHANGE_SUCCESS != - gst_element_get_state (GST_ELEMENT (pipeline), &state, NULL, - 5 * GST_SECOND)) { - g_print ("State change failed for %s. Aborting\n", filename); - break; - } - } else if (sret != GST_STATE_CHANGE_SUCCESS) { - g_print ("%s - Could not read file\n", filename); - goto next_file; - } - - if (!message_loop (GST_ELEMENT (pipeline), &tags)) { - g_print ("Failed in message reading for %s\n", argv[i]); - } - - if (tags) { - g_print ("Metadata for %s:\n", argv[i]); - gst_tag_list_foreach (tags, print_tag, NULL); - gst_tag_list_free (tags); - tags = NULL; - } else - g_print ("No metadata found for %s\n", argv[i]); - - sret = gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL); -#ifndef NEW_PIPE_PER_FILE - if (GST_STATE_CHANGE_ASYNC == sret) { - if (GST_STATE_CHANGE_FAILURE == - gst_element_get_state (GST_ELEMENT (pipeline), &state, NULL, - GST_CLOCK_TIME_NONE)) { - g_print ("State change failed. Aborting"); - break; - } - } -#endif - - next_file: - i++; - -#ifdef NEW_PIPE_PER_FILE - make_pipeline (); -#endif - } - - if (pipeline) - gst_object_unref (pipeline); - return 0; -} diff --git a/examples/mixer/.gitignore b/examples/mixer/.gitignore deleted file mode 100644 index 0ba0585042..0000000000 --- a/examples/mixer/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -helloworld -mixer -*.bb -*.bbg -*.da diff --git a/examples/mixer/Makefile.am b/examples/mixer/Makefile.am deleted file mode 100644 index a1f226a00e..0000000000 --- a/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/examples/mixer/mixer.c b/examples/mixer/mixer.c deleted file mode 100644 index aebb0cb406..0000000000 --- a/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 (typefind); - gst_object_unref (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_SCHEDULER (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 (audiosink); - - gst_object_unref (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 (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/examples/mixer/mixer.h b/examples/mixer/mixer.h deleted file mode 100644 index 76e55f6ea3..0000000000 --- a/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/examples/pingpong/.gitignore b/examples/pingpong/.gitignore deleted file mode 100644 index 53dd624638..0000000000 --- a/examples/pingpong/.gitignore +++ /dev/null @@ -1,12 +0,0 @@ -Makefile -Makefile.in -*.o -*.lo -*.la -.deps -.libs - -pingpong -*.bb -*.bbg -*.da diff --git a/examples/pingpong/Makefile.am b/examples/pingpong/Makefile.am deleted file mode 100644 index feaa456b6e..0000000000 --- a/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/examples/pingpong/pingpong.c b/examples/pingpong/pingpong.c deleted file mode 100644 index 59f7be64f2..0000000000 --- a/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/examples/plugins/.gitignore b/examples/plugins/.gitignore deleted file mode 100644 index 1eec6ddd7c..0000000000 --- a/examples/plugins/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -Makefile -Makefile.in -*.o -*.lo -*.la -.deps -.libs -*.bb -*.bbg -*.da diff --git a/examples/plugins/Makefile.am b/examples/plugins/Makefile.am deleted file mode 100644 index 16d260df08..0000000000 --- a/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/examples/plugins/example.c b/examples/plugins/example.c deleted file mode 100644 index d87ebf03c1..0000000000 --- a/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 GstStateChangeReturn gst_example_change_state (GstElement * element, - GstStateChange transition); - -/* 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 GstStateChangeReturn -gst_example_change_state (GstElement * element, GstStateChange transition) -{ - GstExample *example; - - /* cast to our plugin */ - example = GST_EXAMPLE (element); - - /* we perform our actions based on the state transition - * of the element */ - switch (transition) { - /* The NULL to READY transition is used to - * create threads (if any), and/or open devices */ - case GST_STATE_CHANGE_NULL_TO_READY: - break; - case GST_STATE_CHANGE_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_CHANGE_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_CHANGE_PLAYING_TO_PAUSED: - break; - /* In the PAUSED to READY state, the element should reset - * its internal state and close any devices. */ - case GST_STATE_CHANGE_PAUSED_TO_READY: - break; - /* The element should free all resources, terminate threads - * and put itself into its initial state again */ - case GST_STATE_CHANGE_READY_TO_NULL: - break; - } - - /* Then we call the parent state change handler */ - return parent_class->change_state (element, transition); -} - - -/* 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/examples/plugins/example.h b/examples/plugins/example.h deleted file mode 100644 index 33003bcc75..0000000000 --- a/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/examples/pwg/.gitignore b/examples/pwg/.gitignore deleted file mode 100644 index 14c2d7ac06..0000000000 --- a/examples/pwg/.gitignore +++ /dev/null @@ -1,18 +0,0 @@ -boilerplate.c -caps.func -chain2.c -chain.c -chain.func -convertcaps.c -filter.h -forwardcaps.c -getcaps.c -init.func -pads.c -properties.c -range.c -register.func -state.c -state.func -task.c -test.c diff --git a/examples/pwg/Makefile.am b/examples/pwg/Makefile.am deleted file mode 100644 index e1647ae735..0000000000 --- a/examples/pwg/Makefile.am +++ /dev/null @@ -1,88 +0,0 @@ -INCLUDES = $(GST_OBJ_CFLAGS) \ - -DVERSION="\"0.0.1\"" - -libboilerplate_la_SOURCES = boilerplate.c -libpads_la_SOURCES = pads.c -libchain_la_SOURCES = chain.c -libchain2_la_SOURCES = chain2.c -libstate_la_SOURCES = state.c -libproperties_la_SOURCES = properties.c -libforwardcaps_la_SOURCES = forwardcaps.c -libconvertcaps_la_SOURCES = convertcaps.c -libgetcaps_la_SOURCES = getcaps.c -libtask_la_SOURCES = task.c -librange_la_SOURCES = range.c -DISTCLEANFILES = \ - boilerplate.c pads.c chain.c chain2.c state.c properties.c \ - forwardcaps.c convertcaps.c getcaps.c task.c range.c \ - init.func caps.func chain.func state.func register.func filter.h - -EXTRA_DIST = extract.pl - -EXAMPLES = \ - libboilerplate.la \ - libpads.la \ - libchain.la \ - libchain2.la \ - libstate.la \ - libproperties.la \ - libforwardcaps.la \ - libconvertcaps.la \ - libgetcaps.la \ - libtask.la \ - librange.la - -EXAMPLE_APPS = \ - test - -filter.h register.func: $(top_srcdir)/docs/pwg/building-boiler.xml - $(PERL_PATH) $(srcdir)/extract.pl $@ \ - $(top_srcdir)/docs/pwg/building-boiler.xml - -boilerplate.c: $(top_srcdir)/docs/pwg/building-boiler.xml filter.h register.func - $(PERL_PATH) $(srcdir)/extract.pl $@ \ - $(top_srcdir)/docs/pwg/building-boiler.xml - -caps.func init.func: $(top_srcdir)/docs/pwg/building-pads.xml filter.h - $(PERL_PATH) $(srcdir)/extract.pl $@ \ - $(top_srcdir)/docs/pwg/building-pads.xml - -pads.c: $(top_srcdir)/docs/pwg/building-pads.xml register.func caps.func init.func - $(PERL_PATH) $(srcdir)/extract.pl $@ \ - $(top_srcdir)/docs/pwg/building-pads.xml - -chain.func: $(top_srcdir)/docs/pwg/building-chainfn.xml - $(PERL_PATH) $(srcdir)/extract.pl $@ \ - $(top_srcdir)/docs/pwg/building-chainfn.xml - -chain.c chain2.c: $(top_srcdir)/docs/pwg/building-chainfn.xml register.func caps.func init.func chain.func - $(PERL_PATH) $(srcdir)/extract.pl $@ \ - $(top_srcdir)/docs/pwg/building-chainfn.xml - -state.func: $(top_srcdir)/docs/pwg/building-state.xml - $(PERL_PATH) $(srcdir)/extract.pl $@ \ - $(top_srcdir)/docs/pwg/building-state.xml - -state.c: $(top_srcdir)/docs/pwg/building-state.xml register.func caps.func init.func chain.func state.func - $(PERL_PATH) $(srcdir)/extract.pl $@ \ - $(top_srcdir)/docs/pwg/building-state.xml - -properties.c: $(top_srcdir)/docs/pwg/building-props.xml filter.h register.func - $(PERL_PATH) $(srcdir)/extract.pl $@ \ - $(top_srcdir)/docs/pwg/building-props.xml - -test.c: $(top_srcdir)/docs/pwg/building-testapp.xml - $(PERL_PATH) $(srcdir)/extract.pl $@ \ - $(top_srcdir)/docs/pwg/building-testapp.xml - -forwardcaps.c convertcaps.c getcaps.c: $(top_srcdir)/docs/pwg/advanced-negotiation.xml init.func register.func chain.func state.func - $(PERL_PATH) $(srcdir)/extract.pl $@ \ - $(top_srcdir)/docs/pwg/advanced-negotiation.xml - -task.c range.c: $(top_srcdir)/docs/pwg/advanced-scheduling.xml register.func - $(PERL_PATH) $(srcdir)/extract.pl $@ \ - $(top_srcdir)/docs/pwg/advanced-scheduling.xml - -noinst_PROGRAMS = $(EXAMPLE_APPS) -noinst_LTLIBRARIES = $(EXAMPLES) -LDADD = $(GST_OBJ_LIBS) diff --git a/examples/pwg/extract.pl b/examples/pwg/extract.pl deleted file mode 100755 index 5c257c70a0..0000000000 --- a/examples/pwg/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/examples/queue/.gitignore b/examples/queue/.gitignore deleted file mode 100644 index 80ea866872..0000000000 --- a/examples/queue/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -queue -*.bb -*.bbg -*.da diff --git a/examples/queue/Makefile.am b/examples/queue/Makefile.am deleted file mode 100644 index 9d668392a3..0000000000 --- a/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/examples/queue/queue.c b/examples/queue/queue.c deleted file mode 100644 index 514fd35def..0000000000 --- a/examples/queue/queue.c +++ /dev/null @@ -1,94 +0,0 @@ -#include -#include - -/* This example uses the queue element to create a buffer between 2 elements. - * The scheduler automatically uses 2 threads, 1 to feed and another to consume - * data from the queue buffer - */ - -/* Event loop to listen to events posted on the GstBus from the pipeline. Exits - * on EOS or ERROR events - */ -static void -event_loop (GstElement * pipe) -{ - GstBus *bus; - GstMessage *message = NULL; - - bus = gst_element_get_bus (GST_ELEMENT (pipe)); - - while (TRUE) { - message = gst_bus_poll (bus, GST_MESSAGE_ANY, -1); - g_assert (message != NULL); - - switch (message->type) { - case GST_MESSAGE_EOS: - gst_message_unref (message); - return; - case GST_MESSAGE_WARNING: - case GST_MESSAGE_ERROR:{ - GError *gerror; - gchar *debug; - - gst_message_parse_error (message, &gerror, &debug); - gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug); - gst_message_unref (message); - g_error_free (gerror); - g_free (debug); - return; - } - default: - gst_message_unref (message); - break; - } - } -} - -int -main (int argc, char *argv[]) -{ - GstElement *filesrc, *audiosink, *decode, *queue; - GstElement *pipeline; - - 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); - - decode = gst_element_factory_make ("mad", "decode"); - g_assert (decode != NULL); - - queue = gst_element_factory_make ("queue", "queue"); - g_assert (queue != NULL); - - /* and an audio sink */ - audiosink = gst_element_factory_make ("alsasink", "play_audio"); - g_assert (audiosink != NULL); - - /* add objects to the main pipeline */ - gst_bin_add_many (GST_BIN (pipeline), filesrc, decode, queue, audiosink, - NULL); - - gst_element_link_many (filesrc, decode, queue, audiosink, NULL); - - /* start playing */ - gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING); - - /* Listen for EOS */ - event_loop (pipeline); - - gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL); - - exit (0); -} diff --git a/examples/queue2/.gitignore b/examples/queue2/.gitignore deleted file mode 100644 index fcbde93534..0000000000 --- a/examples/queue2/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -queue2 -*.bb -*.bbg -*.da diff --git a/examples/queue2/Makefile.am b/examples/queue2/Makefile.am deleted file mode 100644 index 5b2aa36b49..0000000000 --- a/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/examples/queue2/queue2.c b/examples/queue2/queue2.c deleted file mode 100644 index 49b67ff459..0000000000 --- a/examples/queue2/queue2.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, *audiosink, *queue; - GstElement *pipeline; - - gst_init (&argc, &argv); - - if (argc != 2) { - g_print ("usage: %s \n", argv[0]); - exit (-1); - } - - /* 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 */ - audiosink = gst_element_factory_make ("alsasink", "play_audio"); - g_assert (audiosink != 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 (pipeline), audiosink); - - gst_pad_link(gst_element_get_pad(queue,"src"), - gst_element_get_pad(audiosink,"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/examples/queue3/.gitignore b/examples/queue3/.gitignore deleted file mode 100644 index 7e70b37ffc..0000000000 --- a/examples/queue3/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -queue3 -*.bb -*.bbg -*.da diff --git a/examples/queue3/Makefile.am b/examples/queue3/Makefile.am deleted file mode 100644 index f229f3f152..0000000000 --- a/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/examples/queue3/queue3.c b/examples/queue3/queue3.c deleted file mode 100644 index 3a17854d7d..0000000000 --- a/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/examples/queue4/.gitignore b/examples/queue4/.gitignore deleted file mode 100644 index 7e190c534c..0000000000 --- a/examples/queue4/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -queue4 -*.bb -*.bbg -*.da diff --git a/examples/queue4/Makefile.am b/examples/queue4/Makefile.am deleted file mode 100644 index 9b3911de8e..0000000000 --- a/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/examples/queue4/queue4.c b/examples/queue4/queue4.c deleted file mode 100644 index 8ea60d89e7..0000000000 --- a/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/examples/retag/.gitignore b/examples/retag/.gitignore deleted file mode 100644 index 1948113728..0000000000 --- a/examples/retag/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -retag -transcode -*.bb -*.bbg -*.da diff --git a/examples/retag/Makefile.am b/examples/retag/Makefile.am deleted file mode 100644 index 9e9e8cd71c..0000000000 --- a/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/examples/retag/retag.c b/examples/retag/retag.c deleted file mode 100644 index 668da88af8..0000000000 --- a/examples/retag/retag.c +++ /dev/null @@ -1,103 +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; - 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_KEEP); - /* 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_many (filesrc, tag_changer, filesink, NULL)) - g_assert_not_reached (); - - /* 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/examples/retag/transcode.c b/examples/retag/transcode.c deleted file mode 100644 index e818b89f32..0000000000 --- a/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/examples/thread/.gitignore b/examples/thread/.gitignore deleted file mode 100644 index 74051926de..0000000000 --- a/examples/thread/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -thread -*.bb -*.bbg -*.da diff --git a/examples/thread/Makefile.am b/examples/thread/Makefile.am deleted file mode 100644 index 86a7c19abf..0000000000 --- a/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/examples/thread/thread.c b/examples/thread/thread.c deleted file mode 100644 index 6de6692a6e..0000000000 --- a/examples/thread/thread.c +++ /dev/null @@ -1,79 +0,0 @@ -#include <stdlib.h> -#include <gst/gst.h> - -static GMainLoop *loop; - -/* 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); - - g_main_loop_quit (loop); - g_main_loop_unref (loop); -} - -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); - - loop = g_main_loop_new (NULL, FALSE); - - gst_object_unref (thread); - - exit (0); -} diff --git a/examples/typefind/.gitignore b/examples/typefind/.gitignore deleted file mode 100644 index 6c4ae04786..0000000000 --- a/examples/typefind/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -typefind -*.bb -*.bbg -*.da diff --git a/examples/typefind/Makefile.am b/examples/typefind/Makefile.am deleted file mode 100644 index cc998021af..0000000000 --- a/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/examples/typefind/typefind.c b/examples/typefind/typefind.c deleted file mode 100644 index 1640ce29e9..0000000000 --- a/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 ("1.0"); - doc->xmlRootNode = xmlNewDocNode (doc, NULL, "Capabilities", NULL); - - parent = xmlNewChild (doc->xmlRootNode, NULL, "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/examples/xml/.gitignore b/examples/xml/.gitignore deleted file mode 100644 index 7b9745aa5f..0000000000 --- a/examples/xml/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -createxml -runxml -xmlTest.gst -*.bb -*.bbg -*.da diff --git a/examples/xml/Makefile.am b/examples/xml/Makefile.am deleted file mode 100644 index 11d3cf1270..0000000000 --- a/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/examples/xml/createxml.c b/examples/xml/createxml.c deleted file mode 100644 index d1426e2d08..0000000000 --- a/examples/xml/createxml.c +++ /dev/null @@ -1,92 +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, - "http://gstreamer.net/gst-test/1.0/"); - if (ns == NULL) { - xmlNodePtr root = xmlDocGetRootElement (parent->doc); - - /* add namespace to root node */ - ns = xmlNewNs (root, "http://gstreamer.net/gst-test/1.0/", "test"); - } - child = xmlNewChild (parent, ns, "comment", NULL); - - xmlNewChild (child, NULL, "text", (gchar *) 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/examples/xml/runxml.c b/examples/xml/runxml.c deleted file mode 100644 index 698ea67fbf..0000000000 --- a/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 (children->name, "comment")) { - xmlNodePtr nodes = children->xmlChildrenNode; - - while (nodes) { - if (!strcmp (nodes->name, "text")) { - gchar *name = g_strdup (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, argv[1], NULL); - else - ret = gst_xml_parse_file (xml, "xmlTest.gst", NULL); - - g_assert (ret == TRUE); - - pipeline = gst_xml_get_element (xml, "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/Makefile.am b/tests/Makefile.am index 09fe762daf..c51ee87cd9 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,3 +1,34 @@ -SUBDIRS = benchmarks - EXTRA_DIST = README + +if BUILD_TESTS +## SUBDIRS_TESTS = tests testsuite +## FIXME: write tests from scratch +SUBDIRS_TESTS = +if HAVE_CHECK +SUBDIRS_CHECK = check +else +SUBDIRS_CHECK = +endif +else +SUBDIRS_TESTS = +SUBDIRS_CHECK = +endif + +if BUILD_EXAMPLES +## FIXME: write examples from scratch +# SUBDIRS_EXAMPLES = examples +SUBDIRS_EXAMPLES = +else +SUBDIRS_EXAMPLES = +endif + +SUBDIRS = \ + benchmarks \ + $(SUBDIRS_CHECK) \ + $(SUBDIRS_TESTS) \ + $(SUBDIRS_EXAMPLES) + +# These are all the possible subdirs +DIST_SUBDIRS = \ + benchmarks \ + check diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am index a4c5a2d501..f6e6ede231 100644 --- a/tests/check/Makefile.am +++ b/tests/check/Makefile.am @@ -51,15 +51,15 @@ check_PROGRAMS = \ elements/fakesrc \ elements/identity \ elements/fdsrc \ + generic/sinks \ generic/states \ - pipelines/simple_launch_lines \ + pipelines/simple-launch-lines \ pipelines/stress \ pipelines/cleanup \ - states/sinks \ - gst-libs/controller \ - gst-libs/gdp \ - net/gstnetclientclock \ - net/gstnettimeprovider + libs/controller \ + libs/gdp \ + libs/gstnetclientclock \ + libs/gstnettimeprovider # failing tests noinst_PROGRAMS = \ @@ -74,21 +74,21 @@ LDADD = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \ $(GST_OBJ_LIBS) \ $(CHECK_LIBS) -gst_libs_gdp_SOURCES = \ - gst-libs/gdp.c \ +libs_gdp_SOURCES = \ + libs/gdp.c \ $(top_srcdir)/libs/gst/dataprotocol/dataprotocol.c -gst_libs_gdp_CFLAGS = $(AM_CFLAGS) +libs_gdp_CFLAGS = $(AM_CFLAGS) elements_fdsrc_CFLAGS=$(GST_OBJ_CFLAGS) $(CHECK_CFLAGS) -DTESTFILE=\"$(top_srcdir)/configure.ac\" -gst_libs_controller_LDADD = \ +libs_controller_LDADD = \ $(top_builddir)/libs/gst/controller/libgstcontroller-@GST_MAJORMINOR@.la \ $(LDADD) -net_gstnetclientclock_LDADD = \ +libs_gstnetclientclock_LDADD = \ $(top_builddir)/libs/gst/net/libgstnet-@GST_MAJORMINOR@.la \ $(LDADD) -net_gstnettimeprovider_LDADD = \ +libs_gstnettimeprovider_LDADD = \ $(top_builddir)/libs/gst/net/libgstnet-@GST_MAJORMINOR@.la \ $(LDADD) diff --git a/testsuite/.gitignore b/testsuite/.gitignore deleted file mode 100644 index 4fa802d8bf..0000000000 --- a/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/testsuite/Makefile.am b/testsuite/Makefile.am deleted file mode 100644 index 58308989ed..0000000000 --- a/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 = \ - caps \ - $(GST_DEBUG_DIRS) \ - dlopen \ - elements indexers \ - $(GST_PARSE_DIRS) \ - plugin refcounting states threads - -DIST_SUBDIRS = \ - caps \ - debug \ - dlopen \ - elements indexers \ - parse \ - plugin refcounting states threads - -tests_pass = -tests_fail = -tests_ignore = - -# we makes them, we gots to clean them -CLEANFILES += test-registry.xml - diff --git a/testsuite/Rules b/testsuite/Rules deleted file mode 100644 index 6eda0d4191..0000000000 --- a/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/testsuite/caps/.gitignore b/testsuite/caps/.gitignore deleted file mode 100644 index 5419534b31..0000000000 --- a/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/testsuite/caps/Makefile.am b/testsuite/caps/Makefile.am deleted file mode 100644 index c5752bf56d..0000000000 --- a/testsuite/caps/Makefile.am +++ /dev/null @@ -1,33 +0,0 @@ -include ../Rules - -tests_pass = \ - app_fixate \ - enumcaps \ - intersection \ - compatibility \ - deserialize \ - normalisation \ - union \ - string-conversions \ - fixed \ - fraction-convert \ - fraction-multiply-and-zero \ - intersect2 \ - caps \ - audioscale \ - filtercaps \ - eratosthenes \ - renegotiate \ - subtract \ - sets \ - simplify \ - random \ - structure - -EXTRA_DIST = caps_strings - -noinst_HEADERS = \ - caps.h - -tests_fail = -tests_ignore = diff --git a/testsuite/caps/app_fixate.c b/testsuite/caps/app_fixate.c deleted file mode 100644 index 52658e7ee2..0000000000 --- a/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/testsuite/caps/audioscale.c b/testsuite/caps/audioscale.c deleted file mode 100644 index 1dd8ad1050..0000000000 --- a/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_unref (caps); - gst_caps_unref (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/testsuite/caps/caps.c b/testsuite/caps/caps.c deleted file mode 100644 index bf8cabbfaa..0000000000 --- a/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_unref (caps); - - caps = gst_caps_new_any (); - g_assert (caps != NULL); - gst_caps_unref (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_unref (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_unref (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_unref (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_unref (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_unref (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_unref (caps); - gst_caps_unref (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_unref (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_unref (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_unref (caps); - gst_caps_unref (caps1); - gst_caps_unref (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_unref (caps1); -} - -int -main (int argc, char *argv[]) -{ - gst_init (&argc, &argv); - - test1 (); - test2 (); - test3 (); - - return 0; -} diff --git a/testsuite/caps/caps.h b/testsuite/caps/caps.h deleted file mode 100644 index 3024eeca9f..0000000000 --- a/testsuite/caps/caps.h +++ /dev/null @@ -1,18 +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 ]", - "ANY", - "EMPTY" -}; - diff --git a/testsuite/caps/caps_strings b/testsuite/caps/caps_strings deleted file mode 100644 index 72f90522c4..0000000000 --- a/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/testsuite/caps/compatibility.c b/testsuite/caps/compatibility.c deleted file mode 100644 index 9b24e7f7f9..0000000000 --- a/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/testsuite/caps/deserialize.c b/testsuite/caps/deserialize.c deleted file mode 100644 index 70e7e79e66..0000000000 --- a/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; - guint 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_unref (caps); - } - - g_print ("parsed each structure individually\n"); - abort (); - } - - gst_caps_unref (caps); - g_free (list[i]); - } - - g_free (list); - g_free (data); - g_free (filename); - - return 0; -} diff --git a/testsuite/caps/enumcaps.c b/testsuite/caps/enumcaps.c deleted file mode 100644 index ac36e7ba3a..0000000000 --- a/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_unref (caps); - gst_caps_unref (res_caps); - - /* yes */ - return 0; -} diff --git a/testsuite/caps/eratosthenes.c b/testsuite/caps/eratosthenes.c deleted file mode 100644 index 85049564e9..0000000000 --- a/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/testsuite/caps/filtercaps.c b/testsuite/caps/filtercaps.c deleted file mode 100644 index 4061e3412a..0000000000 --- a/testsuite/caps/filtercaps.c +++ /dev/null @@ -1,49 +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)); - /* get_allowed_caps doesn't mean anything if you aren't connected */ - g_assert (!caps); - - return 0; -} diff --git a/testsuite/caps/fixed.c b/testsuite/caps/fixed.c deleted file mode 100644 index e0913d2ee9..0000000000 --- a/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/testsuite/caps/fraction-convert.c b/testsuite/caps/fraction-convert.c deleted file mode 100644 index 6c30195710..0000000000 --- a/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/testsuite/caps/fraction-multiply-and-zero.c b/testsuite/caps/fraction-multiply-and-zero.c deleted file mode 100644 index 50c0a53e75..0000000000 --- a/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/testsuite/caps/intersect2.c b/testsuite/caps/intersect2.c deleted file mode 100644 index d240993faf..0000000000 --- a/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_unref (caps1); - gst_caps_unref (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_unref (caps1); - gst_caps_unref (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_unref (caps1); - gst_caps_unref (caps2); - gst_caps_unref (caps3); - gst_caps_unref (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_unref (caps1); - gst_caps_unref (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_unref (caps1); - gst_caps_unref (caps2); - - return 0; -} diff --git a/testsuite/caps/intersection.c b/testsuite/caps/intersection.c deleted file mode 100644 index bda8950ce7..0000000000 --- a/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/testsuite/caps/normalisation.c b/testsuite/caps/normalisation.c deleted file mode 100644 index 0690574a8d..0000000000 --- a/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/testsuite/caps/random.c b/testsuite/caps/random.c deleted file mode 100644 index e95b01cb40..0000000000 --- a/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_unref (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/testsuite/caps/renegotiate.c b/testsuite/caps/renegotiate.c deleted file mode 100644 index 7ff14b2872..0000000000 --- a/testsuite/caps/renegotiate.c +++ /dev/null @@ -1,150 +0,0 @@ - -#include <gst/gst.h> -#include <string.h> -#include <unistd.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_unref (icaps); - g_print ("returning %d\n", rate); - return gst_caps_copy (mycaps); - } - gst_caps_unref (icaps); - } - - return NULL; -} - -int -main (int argc, char *argv[]) -{ - GstElement *pipeline; - GError *error = NULL; - GstIterator *iter1, *iter2; - gint done1 = FALSE, done2 = FALSE; - gpointer element; - - 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); - } - - iter1 = gst_bin_iterate_elements (GST_BIN (pipeline)); - while (!done1) { - switch (gst_iterator_next (iter1, &element)) { - case GST_ITERATOR_OK: - { - gpointer pad; - - iter2 = gst_element_iterate_pads (element); - while (!done2) { - switch (gst_iterator_next (iter2, &pad)) { - case GST_ITERATOR_OK: - if (gst_pad_get_direction (pad) == GST_PAD_SRC) { - g_signal_connect (G_OBJECT (pad), "fixate", - G_CALLBACK (my_fixate), NULL); - } - gst_object_unref (pad); - break; - case GST_ITERATOR_DONE: - done2 = TRUE; - break; - case GST_ITERATOR_RESYNC: - case GST_ITERATOR_ERROR: - exit (1); - break; - } - } - gst_iterator_free (iter2); - - gst_object_unref (element); - break; - } - case GST_ITERATOR_DONE: - done1 = TRUE; - break; - case GST_ITERATOR_RESYNC: - case GST_ITERATOR_ERROR: - exit (1); - break; - } - } - gst_iterator_free (iter1); - - /*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); - } - } - */ - /* Like totally not sure how to do this in THREADED. Punting for now! */ - - sleep (5); - - return 0; -} diff --git a/testsuite/caps/sets.c b/testsuite/caps/sets.c deleted file mode 100644 index e279427f07..0000000000 --- a/testsuite/caps/sets.c +++ /dev/null @@ -1,81 +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", strlen (eins)); - g_print (" B = %u\n", 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", 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_unref (test3); - test3 = gst_caps_union (test2, two); - g_print (" A + B = %u\n", 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_unref (test2); - gst_caps_unref (test3); - gst_caps_unref (test4); - } else { - g_print (" ANY CAPS\n\n"); - } - gst_caps_unref (test); - gst_caps_unref (two); - gst_caps_unref (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/testsuite/caps/simplify.c b/testsuite/caps/simplify.c deleted file mode 100644 index 6adb65ce3e..0000000000 --- a/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), strlen (before), - gst_caps_get_size (caps), 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_unref (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_unref (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_unref (temp2); - gst_caps_unref (temp); - } - } - gst_caps_unref (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/testsuite/caps/string-conversions.c b/testsuite/caps/string-conversions.c deleted file mode 100644 index e28c3bdd1a..0000000000 --- a/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/testsuite/caps/structure.c b/testsuite/caps/structure.c deleted file mode 100644 index 84c607e454..0000000000 --- a/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/testsuite/caps/subtract.c b/testsuite/caps/subtract.c deleted file mode 100644 index 9d1053ca6a..0000000000 --- a/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_unref (test); - test = gst_caps_subtract (two, two); - g_assert (gst_caps_is_empty (test)); - gst_caps_unref (test); - test = gst_caps_subtract (two, one); - g_assert (gst_caps_is_empty (test)); - gst_caps_unref (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_unref (test); - test = gst_caps_subtract (test2, one); - g_assert (gst_caps_is_empty (test)); - gst_caps_unref (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/testsuite/caps/union.c b/testsuite/caps/union.c deleted file mode 100644 index 798f6faa2a..0000000000 --- a/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/testsuite/debug/.gitignore b/testsuite/debug/.gitignore deleted file mode 100644 index 592d5994d7..0000000000 --- a/testsuite/debug/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -category -commandline -global -output -printf_extension diff --git a/testsuite/debug/Makefile.am b/testsuite/debug/Makefile.am deleted file mode 100644 index b38ca39daf..0000000000 --- a/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/testsuite/debug/category.c b/testsuite/debug/category.c deleted file mode 100644 index 350dfa41da..0000000000 --- a/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/testsuite/debug/commandline.c b/testsuite/debug/commandline.c deleted file mode 100644 index fbfafe7949..0000000000 --- a/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/testsuite/debug/global.c b/testsuite/debug/global.c deleted file mode 100644 index f8fc02bed8..0000000000 --- a/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/testsuite/debug/output.c b/testsuite/debug/output.c deleted file mode 100644 index 8360322418..0000000000 --- a/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/testsuite/debug/printf_extension.c b/testsuite/debug/printf_extension.c deleted file mode 100644 index 67e9d3ce46..0000000000 --- a/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/testsuite/dlopen/.gitignore b/testsuite/dlopen/.gitignore deleted file mode 100644 index 3f9346b8de..0000000000 --- a/testsuite/dlopen/.gitignore +++ /dev/null @@ -1 +0,0 @@ -dlopen_gst diff --git a/testsuite/dlopen/Makefile.am b/testsuite/dlopen/Makefile.am deleted file mode 100644 index 646d3a7fcf..0000000000 --- a/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/testsuite/dlopen/dlopen_gst.c b/testsuite/dlopen/dlopen_gst.c deleted file mode 100644 index 2aa4008d4a..0000000000 --- a/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/testsuite/dlopen/loadgst.c b/testsuite/dlopen/loadgst.c deleted file mode 100644 index 54bfe694b0..0000000000 --- a/testsuite/dlopen/loadgst.c +++ /dev/null @@ -1,26 +0,0 @@ - -#include <gst/gst.h> - - -void -do_test (void) -{ - GstElement *pipeline; - int i; - - 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++) { - g_usleep (1000); - g_print ("%s", (i & 1) ? "+" : "-"); - } - g_print ("\n"); - - gst_element_set_state (pipeline, GST_STATE_NULL); - gst_object_unref (pipeline); -} diff --git a/testsuite/elements/.gitignore b/testsuite/elements/.gitignore deleted file mode 100644 index 24f01829e8..0000000000 --- a/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/testsuite/elements/Makefile.am b/testsuite/elements/Makefile.am deleted file mode 100644 index 1f6e48148e..0000000000 --- a/testsuite/elements/Makefile.am +++ /dev/null @@ -1,15 +0,0 @@ -include ../Rules - -tests_pass = gst-inspect-check struct_size -tests_fail = -tests_ignore = - -noinst_HEADERS = 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) - -EXTRA_DIST = gst-inspect-check.in diff --git a/testsuite/elements/gst-inspect-check.in b/testsuite/elements/gst-inspect-check.in deleted file mode 100755 index 55b5cdb1ac..0000000000 --- a/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/testsuite/elements/struct_i386.h b/testsuite/elements/struct_i386.h deleted file mode 100644 index 0ffa5bb631..0000000000 --- a/testsuite/elements/struct_i386.h +++ /dev/null @@ -1,148 +0,0 @@ -/* Generated by GStreamer-0.8.4.1 */ -Struct list[] = { - {"GstPoptOption", sizeof (GstPoptOption), 28} - , - {"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/testsuite/elements/struct_size.c b/testsuite/elements/struct_size.c deleted file mode 100644 index 1343125c02..0000000000 --- a/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/testsuite/indexers/.gitignore b/testsuite/indexers/.gitignore deleted file mode 100644 index 2b7e86e5ab..0000000000 --- a/testsuite/indexers/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -Makefile -Makefile.in -*.o -*.lo -*.la -.deps -.libs -indexdump -cache1 diff --git a/testsuite/indexers/Makefile.am b/testsuite/indexers/Makefile.am deleted file mode 100644 index 829c2fd4e6..0000000000 --- a/testsuite/indexers/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -include ../Rules - -tests_pass = cache1 indexdump -tests_fail = -tests_ignore = diff --git a/testsuite/indexers/cache1.c b/testsuite/indexers/cache1.c deleted file mode 100644 index cd04851230..0000000000 --- a/testsuite/indexers/cache1.c +++ /dev/null @@ -1,114 +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/testsuite/indexers/indexdump.c b/testsuite/indexers/indexdump.c deleted file mode 100644 index a8c48969b5..0000000000 --- a/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/testsuite/parse/.gitignore b/testsuite/parse/.gitignore deleted file mode 100644 index 5dbe8a305a..0000000000 --- a/testsuite/parse/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -Makefile -Makefile.in -*.o -*.lo -*.la -.deps -.libs -parse1 -parse2 diff --git a/testsuite/parse/Makefile.am b/testsuite/parse/Makefile.am deleted file mode 100644 index 0b71559a49..0000000000 --- a/testsuite/parse/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -include ../Rules - -tests_pass = parse1 parse2 -tests_fail = -tests_ignore = diff --git a/testsuite/parse/parse1.c b/testsuite/parse/parse1.c deleted file mode 100644 index 5a6c338642..0000000000 --- a/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 (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_CHANGE_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_CHANGE_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/testsuite/parse/parse2.c b/testsuite/parse/parse2.c deleted file mode 100644 index 60e3323cd8..0000000000 --- a/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 (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_CHANGE_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_CHANGE_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 (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/testsuite/plugin/.gitignore b/testsuite/plugin/.gitignore deleted file mode 100644 index bd44ca109e..0000000000 --- a/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/testsuite/plugin/Makefile.am b/testsuite/plugin/Makefile.am deleted file mode 100644 index 803c3841c8..0000000000 --- a/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/testsuite/plugin/README b/testsuite/plugin/README deleted file mode 100644 index f8898c59d0..0000000000 --- a/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/testsuite/plugin/dynamic.c b/testsuite/plugin/dynamic.c deleted file mode 100644 index 27b173aa41..0000000000 --- a/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/testsuite/plugin/linked.c b/testsuite/plugin/linked.c deleted file mode 100644 index 368d3415c5..0000000000 --- a/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/testsuite/plugin/loading.c b/testsuite/plugin/loading.c deleted file mode 100644 index 11d34a298d..0000000000 --- a/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/testsuite/plugin/registry.c b/testsuite/plugin/registry.c deleted file mode 100644 index 85a76e2f8c..0000000000 --- a/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/testsuite/plugin/static.c b/testsuite/plugin/static.c deleted file mode 100644 index 368d3415c5..0000000000 --- a/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/testsuite/plugin/static2.c b/testsuite/plugin/static2.c deleted file mode 100644 index 1ab30d0f36..0000000000 --- a/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/testsuite/plugin/testplugin.c b/testsuite/plugin/testplugin.c deleted file mode 100644 index d2ee604b96..0000000000 --- a/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/testsuite/plugin/testplugin2.c b/testsuite/plugin/testplugin2.c deleted file mode 100644 index 47d2ad37d3..0000000000 --- a/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/testsuite/plugin/testplugin2_s.c b/testsuite/plugin/testplugin2_s.c deleted file mode 100644 index 00c47d8f8d..0000000000 --- a/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/testsuite/plugin/testplugin_s.c b/testsuite/plugin/testplugin_s.c deleted file mode 100644 index b17605d5be..0000000000 --- a/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/testsuite/refcounting/.gitignore b/testsuite/refcounting/.gitignore deleted file mode 100644 index 85d236abb2..0000000000 --- a/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/testsuite/refcounting/Makefile.am b/testsuite/refcounting/Makefile.am deleted file mode 100644 index 0a0ed82441..0000000000 --- a/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/testsuite/refcounting/bin.c b/testsuite/refcounting/bin.c deleted file mode 100644 index 7d31a3bcb3..0000000000 --- a/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_IS_FLOATING (element)); - gst_bin_add (GST_BIN (bin), element); - g_assert (!GST_OBJECT_IS_FLOATING (element)); - gst_bin_remove (GST_BIN (bin), element); - - gst_object_unref (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 (element); - g_assert (GST_OBJECT_IS_FLOATING (element)); - gst_bin_add (GST_BIN (bin), element); - g_assert (!GST_OBJECT_IS_FLOATING (element)); - gst_bin_remove (GST_BIN (bin), element); - g_assert (!GST_OBJECT_IS_FLOATING (element)); - g_assert (!GST_OBJECT_IS_DESTROYED (element)); - - gst_object_unref (element); -#if 0 - g_assert (GST_OBJECT_IS_DESTROYED (element)); - gst_object_unref (element); -#endif - - gst_object_unref (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 (element); - g_assert (gst_bin_get_by_name (GST_BIN (bin), "test1") == NULL); - - gst_object_unref (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 (bin2); - g_assert (gst_bin_get_by_name (GST_BIN (bin), "testbin") == NULL); - gst_object_unref (element); - g_assert (gst_bin_get_by_name (GST_BIN (bin), "test1") == NULL); - - gst_object_unref (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 (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 (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_IS_FLOATING (bin)); - gst_object_ref (bin); - gst_object_sink (GST_OBJECT (bin)); - g_assert (!GST_OBJECT_IS_FLOATING (bin)); - gst_object_unref (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 (bin); - gst_object_sink (GST_OBJECT (bin)); - gst_object_unref (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_IS_DESTROYED (bin)); - gst_object_unref (bin); -#if 0 - g_assert (GST_OBJECT_IS_DESTROYED (bin)); - gst_object_unref (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 (bin); -#if 0 - gst_object_unref (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 (bin); - gst_object_unref (bin); - gst_object_unref (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 (bin); - gst_object_unref (bin); - gst_object_unref (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 (bin); - gst_object_unref (bin); - gst_object_unref (bin); -#if 0 - gst_object_unref (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 (bin); - gst_object_unref (bin); - gst_object_unref (bin); -#if 0 - gst_object_unref (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 (bin); - gst_element_set_name (bin, "testing123"); - gst_object_unref (bin); - gst_element_set_name (bin, "testing123"); - gst_object_unref (bin); -#if 0 - gst_object_unref (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 (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 (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 (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/testsuite/refcounting/element.c b/testsuite/refcounting/element.c deleted file mode 100644 index da0f54130e..0000000000 --- a/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 (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 (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_IS_FLOATING (element)); - gst_object_ref (element); - gst_object_sink (GST_OBJECT (element)); - g_assert (!GST_OBJECT_IS_FLOATING (element)); - gst_object_unref (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 (element); - gst_object_sink (GST_OBJECT (element)); - gst_object_unref (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_IS_DESTROYED (element)); - gst_object_unref (element); - g_assert (GST_OBJECT_IS_DESTROYED (element)); - gst_object_unref (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 (element); - gst_object_unref (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 (element); - gst_object_unref (element); - gst_object_unref (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 (element); - gst_object_unref (element); - gst_object_unref (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 (element); - gst_object_unref (element); - gst_object_unref (element); - gst_object_unref (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 (element); - gst_object_unref (element); - gst_object_unref (element); - gst_object_unref (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 (element); - gst_element_set_name (element, "testing123"); - gst_object_unref (element); - gst_element_set_name (element, "testing123"); - gst_object_unref (element); - gst_object_unref (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 (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/testsuite/refcounting/element_pad.c b/testsuite/refcounting/element_pad.c deleted file mode 100644 index 5220801530..0000000000 --- a/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_IS_FLOATING (element)); - g_assert (!GST_OBJECT_IS_FLOATING (pad)); - g_assert (gst_pad_get_parent (pad) == element); - gst_object_unref (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 (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 (element); - g_assert (!GST_PAD_IS_LINKED (gst_element_get_pad (element2, "src"))); - gst_object_unref (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 (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 (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 (pad); - gst_element_remove_pad (element, pad); - g_assert (gst_pad_get_parent (pad) == NULL); - gst_object_unref (pad); - gst_object_unref (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 (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 (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/testsuite/refcounting/mainloop.c b/testsuite/refcounting/mainloop.c deleted file mode 100644 index 0e14a92ef3..0000000000 --- a/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/testsuite/refcounting/mem.c b/testsuite/refcounting/mem.c deleted file mode 100644 index 5911dc61de..0000000000 --- a/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/testsuite/refcounting/mem.h b/testsuite/refcounting/mem.h deleted file mode 100644 index 28999db2c3..0000000000 --- a/testsuite/refcounting/mem.h +++ /dev/null @@ -1 +0,0 @@ -int vmsize(); diff --git a/testsuite/refcounting/object.c b/testsuite/refcounting/object.c deleted file mode 100644 index 5646f71ef1..0000000000 --- a/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/testsuite/refcounting/pad.c b/testsuite/refcounting/pad.c deleted file mode 100644 index 0c0eac65bb..0000000000 --- a/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 (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 (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_IS_FLOATING (pad)); - gst_object_ref (pad); - gst_object_sink (GST_OBJECT (pad)); - g_assert (!GST_OBJECT_IS_FLOATING (pad)); - gst_object_unref (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 (pad); - gst_object_sink (GST_OBJECT (pad)); - gst_object_unref (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 (pad); - gst_object_unref (pad); - gst_object_unref (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 (pad); - gst_object_unref (pad); - gst_object_unref (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 (pad); - gst_object_unref (pad); - gst_object_unref (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 (pad); - gst_object_unref (pad); - gst_object_unref (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 (pad); - gst_pad_set_name (pad, "testing123"); - gst_object_unref (pad); - gst_pad_set_name (pad, "testing123"); - gst_object_unref (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 (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 (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 (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/testsuite/refcounting/sched.c b/testsuite/refcounting/sched.c deleted file mode 100644 index f9fcb85ff1..0000000000 --- a/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 (pipeline); - create_pipeline (); - } - } - return 0; -} diff --git a/testsuite/refcounting/thread.c b/testsuite/refcounting/thread.c deleted file mode 100644 index a2294c610e..0000000000 --- a/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 (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 (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 (element); - g_assert (GST_OBJECT_DESTROYED (element)); - gst_object_unref (element); - - gst_object_unref (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 (element); - g_assert (gst_bin_get_by_name (GST_BIN (thread), "test1") == NULL); - - gst_object_unref (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 (thread2); - g_assert (gst_bin_get_by_name (GST_BIN (thread), "testthread") == NULL); - gst_object_unref (element); - g_assert (gst_bin_get_by_name (GST_BIN (thread), "test1") == NULL); - - gst_object_unref (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 (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 (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 (thread); - gst_object_sink (GST_OBJECT (thread)); - g_assert (!GST_OBJECT_FLOATING (thread)); - gst_object_unref (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 (thread); - gst_object_sink (GST_OBJECT (thread)); - gst_object_unref (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 (thread); - g_assert (GST_OBJECT_DESTROYED (thread)); - gst_object_unref (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 (thread); - gst_object_unref (thread); - } - g_print ("create/destroy/unref %d thread %ld\n", iters, vmsize () - usage1); - - thread = gst_thread_new ("somethread"); - gst_object_ref (thread); - gst_object_unref (thread); - gst_object_unref (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 (thread); - gst_object_unref (thread); - gst_object_unref (thread); - } - g_print ("create/ref/unref/unref %d thread %ld\n", iters, vmsize () - usage1); - - thread = gst_thread_new ("somethread"); - gst_object_ref (thread); - gst_object_unref (thread); - gst_object_unref (thread); - gst_object_unref (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 (thread); - gst_object_unref (thread); - gst_object_unref (thread); - gst_object_unref (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 (thread); - gst_element_set_name (thread, "testing123"); - gst_object_unref (thread); - gst_element_set_name (thread, "testing123"); - gst_object_unref (thread); - gst_object_unref (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 (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 (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 (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 (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/testsuite/states/.gitignore b/testsuite/states/.gitignore deleted file mode 100644 index 9d274cca42..0000000000 --- a/testsuite/states/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -Makefile -Makefile.in -*.o -*.lo -*.la -.deps -.libs - -bin -locked -parent diff --git a/testsuite/states/Makefile.am b/testsuite/states/Makefile.am deleted file mode 100644 index 2a01e7553e..0000000000 --- a/testsuite/states/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -include ../Rules - -tests_pass = locked parent -tests_fail = -tests_ignore = bin diff --git a/testsuite/states/bin.c b/testsuite/states/bin.c deleted file mode 100644 index a62b0a78ff..0000000000 --- a/testsuite/states/bin.c +++ /dev/null @@ -1,158 +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_CHANGE_SUCCESS ? "GST_STATE_CHANGE_SUCCESS" : \ - (x) == GST_STATE_CHANGE_ASYNC ? "GST_STATE_CHANGE_ASYNC" : "GST_STATE_CHANGE_FAILURE") -static void -assert_state (GstElement * element, GstState state) -{ - GstState current, pending; - - gst_element_get_state (element, ¤t, &pending, NULL); - if (current != 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, GstState new_state, - GstStateChangeReturn result, GstState result_state) -{ - GstStateChangeReturn 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_CHANGE_ASYNC */ - GstElement *bin = gst_element_factory_make (bin_name, NULL); - - g_assert (bin); - /* obvious */ - assert_state (bin, GST_STATE_NULL); - /* see above */ - assert_state_change (bin, GST_STATE_READY, GST_STATE_CHANGE_SUCCESS, - GST_STATE_READY); - assert_state_change (bin, GST_STATE_PAUSED, GST_STATE_CHANGE_SUCCESS, - GST_STATE_PAUSED); - assert_state_change (bin, GST_STATE_PLAYING, GST_STATE_CHANGE_SUCCESS, - GST_STATE_PLAYING); -} - -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. */ - GstState 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); - GstState bin_state; - gint i; - - gst_element_get_state (bin, &bin_state, NULL, NULL); - g_assert (test); - gst_object_ref (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++) { - GstState test_state = test_states[i]; - - assert_state_change (test, test_state, GST_STATE_CHANGE_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 (test); - assert_state (bin, bin_state); -} - -static void -test_element_in_bin (gchar * bin_name) -{ - gint i; - GstState 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++) { - GstState test_state = test_states[i]; - - assert_state_change (bin, test_state, GST_STATE_CHANGE_SUCCESS, test_state); - assert_state (id, test_state); - test_adding_one_element (bin); - } - - gst_object_unref (bin); -} - -gint -main (gint argc, gchar * argv[]) -{ - gst_init (&argc, &argv); - - /* test behaviour of empty bins */ - empty_bin ("bin"); - empty_bin ("pipeline"); - - g_print ("how far\n"); - /* test behaviour of adding/removing elements to/from all core bin types */ - test_element_in_bin ("bin"); - test_element_in_bin ("pipeline"); - - return 0; -} diff --git a/testsuite/states/locked.c b/testsuite/states/locked.c deleted file mode 100644 index aa4a7a719d..0000000000 --- a/testsuite/states/locked.c +++ /dev/null @@ -1,105 +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 "unistd.h" - -#include <gst/gst.h> - -static GMainLoop *loop; - -static gboolean -message_received (GstBus * bus, GstMessage * message, GstPipeline * pipeline) -{ - g_print ("message %p\n", message); - - if (message->type == GST_MESSAGE_EOS) { - g_print ("EOS!!\n"); - if (g_main_loop_is_running (loop)) - g_main_loop_quit (loop); - } - gst_message_unref (message); - - return TRUE; -} - -gint -main (gint argc, gchar * argv[]) -{ - GstElement *pipeline; - GstElement *fakesrc1, *fakesink1; - GstElement *fakesrc2, *fakesink2; - GstBus *bus; - - gst_init (&argc, &argv); - - pipeline = gst_pipeline_new ("pipeline"); - - loop = g_main_loop_new (NULL, FALSE); - bus = gst_element_get_bus (pipeline); - gst_bus_add_watch (bus, GST_MESSAGE_EOS, (GstBusFunc) message_received, - (gpointer) pipeline); - gst_object_unref (bus); - - 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 (GST_BIN (pipeline), fakesrc1); - gst_bin_add (GST_BIN (pipeline), fakesink1); - gst_pad_link (gst_element_get_pad (fakesrc1, "src"), - gst_element_get_pad (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 (GST_BIN (pipeline), fakesrc2); - gst_bin_add (GST_BIN (pipeline), fakesink2); - gst_pad_link (gst_element_get_pad (fakesrc2, "src"), - gst_element_get_pad (fakesink2, "sink")); - - g_signal_connect (G_OBJECT (pipeline), "deep_notify", - G_CALLBACK (gst_object_default_deep_notify), NULL); - - GST_OBJECT_FLAG_SET (fakesrc2, GST_ELEMENT_LOCKED_STATE); - GST_OBJECT_FLAG_SET (fakesink2, GST_ELEMENT_LOCKED_STATE); - - g_print ("play..\n"); - gst_element_set_state (pipeline, GST_STATE_PLAYING); - - g_main_loop_run (loop); - - g_object_set (G_OBJECT (fakesrc1), "num_buffers", 5, NULL); - - gst_element_set_state (pipeline, GST_STATE_READY); - - GST_OBJECT_FLAG_UNSET (fakesrc2, GST_ELEMENT_LOCKED_STATE); - GST_OBJECT_FLAG_UNSET (fakesink2, GST_ELEMENT_LOCKED_STATE); - - g_print ("play..\n"); - gst_element_set_state (pipeline, GST_STATE_PLAYING); - - g_main_loop_run (loop); - - gst_element_set_state (pipeline, GST_STATE_NULL); - - gst_object_unref (pipeline); - - return 0; -} diff --git a/testsuite/states/parent.c b/testsuite/states/parent.c deleted file mode 100644 index fe8b2441c6..0000000000 --- a/testsuite/states/parent.c +++ /dev/null @@ -1,111 +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_object_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 not affect pipeline and bin2 */ - gst_element_set_state (fakesink, GST_STATE_PAUSED); - 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 fakesrc to PAUSED should not affect bin1 */ - gst_element_set_state (fakesrc, GST_STATE_PAUSED); - g_assert (GST_STATE (bin1) == GST_STATE_READY); - g_assert (GST_STATE (bin2) == GST_STATE_READY); - g_assert (GST_STATE (fakesrc) == GST_STATE_PAUSED); - g_assert (GST_STATE (identity) == GST_STATE_READY); - g_assert (GST_STATE (fakesink) == GST_STATE_READY); - - /* setting bin1 to PAUSED, even though it is already, should set - * identity to PAUSED as well */ - gst_element_set_state (bin1, GST_STATE_PAUSED); - gst_element_get_state (bin2, NULL, NULL, NULL); - g_assert (GST_STATE (bin1) == GST_STATE_PAUSED); - g_assert (GST_STATE (bin2) == GST_STATE_READY); - g_assert (GST_STATE (fakesrc) == GST_STATE_PAUSED); - g_assert (GST_STATE (identity) == GST_STATE_PAUSED); - g_assert (GST_STATE (fakesink) == GST_STATE_PAUSED); - - gst_element_set_state (pipeline, GST_STATE_PLAYING); - g_usleep (1000000); - - g_print ("passed.\n"); - return 0; -} diff --git a/testsuite/threads/.gitignore b/testsuite/threads/.gitignore deleted file mode 100644 index 1c2a290b69..0000000000 --- a/testsuite/threads/.gitignore +++ /dev/null @@ -1,19 +0,0 @@ -threada -threadb -threadc -threadd -threade -threadf -threadg -thread1 -thread2 -thread3 -thread4 -thread5 -queue -staticrec -signal3 -signal2 -signal1 -159852 -159566 diff --git a/testsuite/threads/159566.c b/testsuite/threads/159566.c deleted file mode 100644 index 000bae8c66..0000000000 --- a/testsuite/threads/159566.c +++ /dev/null @@ -1,96 +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_CHANGE_SUCCESS) - g_assert_not_reached (); - - sleep (10000); - g_print ("done\n"); - - return 0; -} diff --git a/testsuite/threads/159852.c b/testsuite/threads/159852.c deleted file mode 100644 index a69b152f8b..0000000000 --- a/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/testsuite/threads/Makefile.am b/testsuite/threads/Makefile.am deleted file mode 100644 index 0ca822d921..0000000000 --- a/testsuite/threads/Makefile.am +++ /dev/null @@ -1,33 +0,0 @@ -include ../Rules - -tests_pass = thread1 thread2 thread3 thread4 thread5 threade threadf signal1 159852 threadg threadi-123775 -tests_fail = 159566 signal2 signal3 - -# threadh - -tests_ignore = queue threadb threadc threadd staticrec threadi-nfy1 threadi-nfy2 - -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/testsuite/threads/queue.c b/testsuite/threads/queue.c deleted file mode 100644 index a7048d47fb..0000000000 --- a/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/testsuite/threads/signals.c b/testsuite/threads/signals.c deleted file mode 100644 index e4fe4ce100..0000000000 --- a/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/testsuite/threads/staticrec.c b/testsuite/threads/staticrec.c deleted file mode 100644 index c77dff8a90..0000000000 --- a/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/testsuite/threads/thread.c b/testsuite/threads/thread.c deleted file mode 100644 index 4614c414a4..0000000000 --- a/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/testsuite/threads/threadb.c b/testsuite/threads/threadb.c deleted file mode 100644 index 11daa85311..0000000000 --- a/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) -{ - GstState 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/testsuite/threads/threadc.c b/testsuite/threads/threadc.c deleted file mode 100644 index a3885a663f..0000000000 --- a/testsuite/threads/threadc.c +++ /dev/null @@ -1,93 +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) -{ - GstState 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_CHANGE_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/testsuite/threads/threadd.c b/testsuite/threads/threadd.c deleted file mode 100644 index 6343af9ce9..0000000000 --- a/testsuite/threads/threadd.c +++ /dev/null @@ -1,95 +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) -{ - GstState 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_CHANGE_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/testsuite/threads/threade.c b/testsuite/threads/threade.c deleted file mode 100644 index fbdb530f31..0000000000 --- a/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/testsuite/threads/threadf.c b/testsuite/threads/threadf.c deleted file mode 100644 index fd5eeb4e89..0000000000 --- a/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/testsuite/threads/threadg.c b/testsuite/threads/threadg.c deleted file mode 100644 index bdf2264abc..0000000000 --- a/testsuite/threads/threadg.c +++ /dev/null @@ -1,67 +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_CHANGE_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_CHANGE_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_CHANGE_SUCCESS) - g_assert_not_reached (); - - gst_bin_remove (GST_BIN (pipeline), thread); - - if (gst_element_set_state (pipeline, - GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) - g_assert_not_reached (); - - - return 0; -} diff --git a/testsuite/threads/threadh.c b/testsuite/threads/threadh.c deleted file mode 100644 index a2d6462228..0000000000 --- a/testsuite/threads/threadh.c +++ /dev/null @@ -1,53 +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_CHANGE_SUCCESS) - g_assert_not_reached (); - - if (gst_element_set_state (sink, GST_STATE_READY) != GST_STATE_CHANGE_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_CHANGE_SUCCESS) - g_assert_not_reached (); - - sleep (2); - - return 0; -} diff --git a/testsuite/threads/threadi.c b/testsuite/threads/threadi.c deleted file mode 100644 index a8edf2b30c..0000000000 --- a/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, GstState old_state, - GstState new_state, gpointer data) -{ - g_print ("Changed state from %d to %d\n", old_state, new_state); -} - -static gboolean -cb_play (gpointer data) -{ - GstStateChangeReturn 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_CHANGE_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 (pipeline); - - g_print ("Done with test to show bug %d, fixed correctly\n", TESTNUM); - - return 0; -}