check/gst-libs/controller.c: more tests
authorStefan Kost <ensonic@users.sourceforge.net>
Mon, 29 Aug 2005 19:59:52 +0000 (19:59 +0000)
committerStefan Kost <ensonic@users.sourceforge.net>
Mon, 29 Aug 2005 19:59:52 +0000 (19:59 +0000)
Original commit message from CVS:
* check/gst-libs/controller.c: (GST_START_TEST),
(gst_controller_suite):
more tests
* docs/gst/tmpl/gstutils.sgml:
* docs/libs/gstreamer-libs-sections.txt:
* docs/libs/tmpl/gstdataprotocol.sgml:
include path fixes
* examples/controller/audio-example.c: (main):
controller example works now
* gst/gstclock.h:
doc fixes
* tools/gst-inspect.c: (print_element_properties_info):
show param spec flags

ChangeLog
check/gst-libs/controller.c
docs/gst/tmpl/gstutils.sgml
docs/libs/gstreamer-libs-sections.txt
docs/libs/tmpl/gstdataprotocol.sgml
examples/controller/audio-example.c
gst/gstclock.h
tests/check/libs/controller.c
tests/old/examples/controller/audio-example.c
tools/gst-inspect.c

index b6754d2..af18842 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2005-08-30  Stefan Kost  <ensonic@users.sf.net>
+
+       * check/gst-libs/controller.c: (GST_START_TEST),
+       (gst_controller_suite):
+          more tests
+       * docs/gst/tmpl/gstutils.sgml:
+       * docs/libs/gstreamer-libs-sections.txt:
+       * docs/libs/tmpl/gstdataprotocol.sgml:
+          include path fixes
+       * examples/controller/audio-example.c: (main):
+          controller example works now
+       * gst/gstclock.h:
+          doc fixes
+       * tools/gst-inspect.c: (print_element_properties_info):
+          show param spec flags
+
 2005-08-29  Andy Wingo  <wingo@pobox.com>
 
        * gst/gstutils.c (gst_util_uint64_scale): New 3733t funct10n.
        * check/gstcheck.h:
          add ASSERT_BUFFER_REFCOUNT
 
-2005-08-13  Tim-Philipp Müller  <tim at centricular dot net>
+2005-08-13  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * docs/gst/gstreamer-sections.txt:
        * gst/gsttag.c: (_gst_tag_initialize), (gst_tag_register):
          is re-registered, unless it is re-registered with a 
          different type (#308438).
 
-2005-08-12  Tim-Philipp Müller  <tim at centricular dot net>
+2005-08-12  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * docs/pwg/appendix-porting.xml:
        * docs/pwg/building-state.xml:
        Actually implement (re)setting the target on a ghostpad
        as described in the docs.
 
-2005-08-10  Tim-Philipp Müller  <tim at centricular dot net>
+2005-08-10  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * gst/gst.c: (gst_init_check_with_popt_table), (init_pre):
          Check whether GST_DEBUG_NO_COLOR environment variable is
          set and disable coloured debug output if that is the case.
 
-2005-08-10  Tim-Philipp Müller  <tim at centricular dot net>
+2005-08-10  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * gst/base/gsttypefindhelper.c: (helper_find_peek),
        (gst_type_find_helper):
          returned by _peek() until typefinding is done and only
          free them then.
 
-2005-08-09  Tim-Philipp Müller  <tim at centricular dot net>
+2005-08-09  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * docs/gst/gstreamer-sections.txt:
        * gst/gstutils.h:
        * gst/base/gstbasetransform.c: (gst_base_transform_buffer_alloc):
          Fix a pretty good memleak.
 
-2005-08-08  Tim-Philipp Müller  <tim at centricular dot net>
+2005-08-08  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * gst/gstiterator.h:
          Fix wrong include and 'make distcheck'.
        * gst/gstbin.c: (bin_bus_handler):
          Use gst_element_post_message() instead.
 
-2005-08-08  Tim-Philipp Müller  <tim at centricular dot net>
+2005-08-08  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * gst/base/gstadapter.h:
        * gst/base/gstbasesink.h:
        * tools/gst-xmlinspect.c: (print_element_info), (main):
           deactivate and remove dparams (libgstcontrol)
 
-2005-08-01  Tim-Philipp Müller  <tim at centricular dot net>
+2005-08-01  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * gst/elements/gsttypefindelement.c:
        (gst_type_find_element_have_type), (gst_type_find_element_init),
        * gst/elements/gsttypefindelement.h:
          Set caps on all outgoing buffers, not just the first one.
 
-2005-08-01  Tim-Philipp Müller  <tim at centricular dot net>
+2005-08-01  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * gst/elements/gsttypefindelement.c:
        (gst_type_find_element_have_type),
        * gst/elements/gsttypefindelement.h:
          Set caps on first outgoing buffer when we've found the type.
 
-2005-08-01  Tim-Philipp Müller  <tim at centricular dot net>
+2005-08-01  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * docs/gst/gstreamer-docs.sgml:
        * docs/gst/gstreamer-sections.txt:
        * docs/gst/tmpl/gstschedulerfactory.sgml:
          Remove some old cruft from docs.
 
-2005-07-31  Tim-Philipp Müller  <tim at centricular dot net>
+2005-07-31  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * gst/gstpad.h:
          Fix inline docs for GstPadLinkReturn.
        * docs/gst/gstreamer-sections.txt:
          New API: gst_structure_has_name().
 
-2005-07-30  Tim-Philipp Müller  <tim at centricular dot net>
+2005-07-30  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * configure.ac:
          Use AC_SYS_LARGEFILE, which will set _FILE_OFFSET_BITS=64
        * gst/gstghostpad.c: (gst_ghost_pad_do_activate_push):
        Don't hold the lock for too long.
 
-2005-07-16  Tim-Philipp Müller  <tim at centricular dot net>
+2005-07-16  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * gst/base/gstbasesrc.c: (gst_base_src_default_negotiate):
          Don't unref the caps we passed to gst_caps_make_writable() after
        * docs/design/part-gstpipeline.txt:
        Updated docs, mostly DISCONT related.
 
-2005-07-15  Tim-Philipp Müller  <tim at centricular dot net>
+2005-07-15  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * docs/pwg/building-pads.xml:
          s/GST_PAD_LINK_REFUSED/FALSE/ in gst_my_filter_setcaps()
        * gst/gstpad.c: (_gst_do_pass_data_accumulator):
          Make work (??).
 
-2005-06-29  Tim-Philipp Müller  <tim at centricular dot net>
+2005-06-29  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * gst/elements/gstfilesink.c: (gst_filesink_render):
          Simplify code so that we don't have to handle short
        (gst_system_clock_obtain): Set the name on object construction.
        Avoid double-checked locking.
 
-2005-06-20  Tim-Philipp Müller  <tim at centricular dot net>
+2005-06-20  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * gst/gsturi.c: (gst_element_make_from_uri):
          Fix potential endless loop.
        Clear queue when going to READY.
        Remove IN_SETCAPS flag too.
 
-2005-05-17  Tim-Philipp Müller  <tim at centricular dot net>
+2005-05-17  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * gst/base/gstbasesrc.c: (gst_basesrc_change_state):
          Remove implicit cast from gboolean to GstElementStateReturn;
        (find_common_root, object_has_ancestor, ghost_up, remove_pad):
        Helpers for pad_link_maybe_ghosting.
 
-2005-05-13  Tim-Philipp Müller  <tim at centricular dot net>
+2005-05-13  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * configure.ac:
          Require GLib >= 2.4.0 (for the g_atomic_* funcs)
 
-2005-05-13  Tim-Philipp Müller  <tim at centricular dot net>
+2005-05-13  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * docs/design/part-element-source.txt:
          Mention GstPushSrc
        * gst/gstbin.c: (gst_bin_class_init), (gst_bin_query):
          Implement _query on a bin, similar to _send_event.
 
-2005-05-12  Tim-Philipp Müller  <tim at centricular dot net>
+2005-05-12  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * gst/base/gstbasesrc.c: (gst_basesrc_do_seek):
          Discont event offset format should be GST_FORMAT_BYTES,
        * gst/gstpad.c: (gst_pad_alloc_buffer), (gst_pad_push):
        Also set caps if we use the fallback buffer alloc.
 
-2005-05-06  Tim-Philipp Müller  <tim at centricular dot net>
+2005-05-06  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * docs/gst/Makefile.am:
        * docs/gst/gstreamer-docs.sgml:
          make the time that debugging functions print relative to when
          gst_init was called
 
-2005-02-18  Tim-Philipp Müller  <tim at centricular dot net>
+2005-02-18  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * gst/gsttaginterface.c:
          Fix inline docs: tag setter vararg functions are NULL-terminated,
        * docs/libs/Makefile.am:
          make sure popt is added to gtk-doc flags.  Fixes #147782.
 
-2005-02-09  Tim-Philipp Müller  <tim at centricular dot net>
+2005-02-09  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * docs/faq/using.xml:
          Fix typo in FAQ (artssink => artsdsink)
        * tools/gst-launch.1.in:
          Fix typo (#166699).
 
-2005-02-08  Tim-Philipp Müller  <tim at centricular dot net>
+2005-02-08  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * docs/faq/using.xml:
          Add -v argument to fakesrc/fakesink gst-launch line,
 
 2005-02-07  Thomas Vander Stichele  <thomas at apestaart dot org>
 
-       patch by: Tim Philipp-Müller
+       patch by: Tim Philipp-M??ller
 
        * configure.ac:
        * gst/gstpad.c:
        (gst_dpman_get_manager)
          restructured DParam docs
 
-2005-01-25  Tim-Philipp Müller  <tim at centricular dot net>
+2005-01-25  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * gst-element-check.m4:
          Only check for gst-inspect if we haven't already
        * gst/gstelement.h:
          fixing incomplete docs
 
-2005-01-24  Tim-Philipp Müller  <tim at centricular dot net>
+2005-01-24  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * gst/elements/gstfilesink.c: (gst_filesink_handle_event):
          Don't unref seek event twice when fflush() fails
 
 2004-05-03  David Schleef  <ds@schleef.org>
 
-       * testsuite/caps/Makefile.am: Fix spelling of Ηρατοσθενες
+       * testsuite/caps/Makefile.am: Fix spelling of ??????????????????????
        * testsuite/caps/erathostenes.c:
        * testsuite/caps/eratosthenes.c: (eratosthenes), (main):
 
        (gst_caps_is_any), (gst_caps_is_empty), (gst_caps_is_chained),
        (gst_caps_is_fixed), (gst_caps_is_always_compatible),
        (gst_caps_intersect), (gst_caps_normalize),
-       (gst_caps_transform_to_string):  Patch from Tim-Philipp Müller
+       (gst_caps_transform_to_string):  Patch from Tim-Philipp M??ller
        to fix GST_CAPS() and GST_IS_CAPS(). (bug #141304)
        * gst/gstcaps.h: use GST_IS_CAPS().
 
        * docs/pwg/building-boiler.xml:
          add cvs login line and s/anonymous/anoncvs/
 
-2004-04-03  Tim-Phillip Müller  <t.i.m@zen.co.uk>
+2004-04-03  Tim-Phillip M??ller  <t.i.m@zen.co.uk>
 
        reviewed by Benjamin Otte  <otte@gnome.org>
 
 
        * po/LINGUAS:
        * po/az.po:
-          adding Azerbaijani (Mətin Əmirov)
+          adding Azerbaijani (M??tin ??mirov)
 
 2004-03-28  Martin Soto  <martinsoto@users.sourceforge.net>
 
        * docs/pwg/other-oneton.xml:
          Document one-to-n elements, demuxers and parsers.
 
-2004-03-25  Tim-Philipp Müller <t.i.m@zen.co.uk>
+2004-03-25  Tim-Philipp M??ller <t.i.m@zen.co.uk>
 
        reviewed by: David Schleef  <ds@schleef.org>
 
 
        * gst/gstvalue.h: Clean up a little bit.
 
-2004-03-21  Tim-Philipp Müller <t.i.m@zen.co.uk>
+2004-03-21  Tim-Philipp M??ller <t.i.m@zen.co.uk>
 
        reviewed by Benjamin Otte  <otte@gnome.org>
 
 
        * docs/random/mimetypes:
          Update docs to point to correct elements for various mimetypes, and
-         some more errors pointed out by Stéphane LOEUILLET (aka LeRoutier)
+         some more errors pointed out by St??phane LOEUILLET (aka LeRoutier)
          <stephane.loeuillet@tiscali.fr>.
 
 2004-01-28  David Schleef  <ds@schleef.org>
index dfe9510..e7c334f 100644 (file)
@@ -181,7 +181,7 @@ GST_PLUGIN_DEFINE_STATIC (GST_VERSION_MAJOR,
 GST_END_TEST;
 
 /* tests for an element with no controlled params */
-GST_START_TEST (controller_new_fail)
+GST_START_TEST (controller_new_fail1)
 {
   GstController *ctrl;
   GstElement *elem;
@@ -197,6 +197,23 @@ GST_START_TEST (controller_new_fail)
 
 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);
+
+  g_object_unref (elem);
+}
+
+GST_END_TEST;
+
 /* tests for an element with controlled params */
 GST_START_TEST (controller_new_okay1)
 {
@@ -215,9 +232,27 @@ GST_START_TEST (controller_new_okay1)
 
 GST_END_TEST;
 
-/* controlling several params should return the same controller */
+/* 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);
+
+  g_object_unref (ctrl);
+  g_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;
 
@@ -356,9 +391,11 @@ gst_controller_suite (void)
 
   suite_add_tcase (s, tc);
   tcase_add_test (tc, controller_init);
-  tcase_add_test (tc, controller_new_fail);
+  tcase_add_test (tc, controller_new_fail1);
+  tcase_add_test (tc, controller_new_fail2);
   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);
index e507318..025afd1 100644 (file)
@@ -48,6 +48,14 @@ various utility functions
 @\
     parent_type_as_macro:
 @\
+    parent_type_as_macro:
+@\
+    parent_type_as_macro:
+@\
+    parent_type_as_macro:
+@\
+    parent_type_as_macro:
+@\
     parent_type_as_macro: 
 @interface_type: 
 @interface_type_as_macro: 
@@ -74,6 +82,14 @@ various utility functions
 @\
     interface_as_function:
 @\
+    interface_as_function:
+@\
+    interface_as_function:
+@\
+    interface_as_function:
+@\
+    interface_as_function:
+@\
     interface_as_function: 
 
 
index 8e294f1..dee0736 100644 (file)
@@ -15,7 +15,7 @@
 
 <SECTION>
 <FILE>gstgetbits</FILE>
-<INCLUDE>libs/getbits/gstgetbits.h</INCLUDE>
+<INCLUDE>gst/getbits/gstgetbits.h</INCLUDE>
 gst_getbits_t
 GstGetbitsCallback
 gst_getbits_init
@@ -94,7 +94,7 @@ swab32
 
 <SECTION>
 <FILE>gstdataprotocol</FILE>
-<INCLUDE>libs/dataprotocol/dataprotocol.h</INCLUDE>
+<INCLUDE>gst/dataprotocol/dataprotocol.h</INCLUDE>
 GstDPHeaderFlag
 GstDPPayloadType
 
@@ -124,7 +124,7 @@ gst_dp_validate_packet
 <SECTION>
 <FILE>gstcontroller</FILE>
 <TITLE>GstController</TITLE>
-<INCLUDE>libs/controller/gstcontroller.h</INCLUDE>
+<INCLUDE>gst/controller/gstcontroller.h</INCLUDE>
 GstController
 GstValueArray
 GstInterpolateMode
index 1bb87c8..c5446c9 100644 (file)
@@ -50,6 +50,34 @@ network connections also need a protocol to do this.
 @GST_DP_PAYLOAD_CAPS: 
 @GST_DP_PAYLOAD_EVENT_NONE: 
 
+<!-- ##### MACRO GST_DP_HEADER_LENGTH ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO GST_DP_VERSION_MAJOR ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO GST_DP_VERSION_MINOR ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### FUNCTION gst_dp_init ##### -->
+<para>
+
+</para>
+
+
+
 <!-- ##### FUNCTION gst_dp_header_payload_length ##### -->
 <para>
 
index 8193ed7..6081dbc 100644 (file)
@@ -14,49 +14,64 @@ main (gint argc, gchar ** argv)
 {
   gint res = 1;
   GstElement *src, *sink;
-  GstBin *bin;
+  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_BIN (gst_pipeline_new ("pipeline"));
+  bin = gst_pipeline_new ("pipeline");
+  clock = gst_pipeline_get_clock (GST_PIPELINE (bin));
   /* TODO make this "testaudiosrc", when its ready */
   src = gst_element_factory_make ("sinesrc", "gen_audio");
   sink = gst_element_factory_make ("alsasink", "play_audio");
-  gst_bin_add_many (bin, src, sink, NULL);
-
+  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), "frequency", "volume", NULL))) {
+  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", 1 * GST_SECOND, &vol);
+  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);
 
-  // iterate two seconds
-  /*
-     if(gst_element_set_state (bin, GST_STATE_PLAYING))
-     {
-     while (gst_bin_iterate (bin))
-     {
-     }
-     }
-     gst_element_set_state (bin, GST_STATE_NULL);
-   */
+  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:
index f244275..7f209a4 100644 (file)
@@ -133,7 +133,7 @@ G_STMT_START {                                              \
  * GST_TIMESPEC_TO_TIME:
  * @ts: the timespec to convert
  *
- * Convert a GstTimeSpec to a GstClockTime
+ * Convert a struct timespec (see man pselect) to a GstClockTime
  *
  * Returns: the result as #GstClockTime
  */
@@ -143,7 +143,7 @@ G_STMT_START {                                              \
  * @t: The GstClockTime to convert
  * @ts: The target timespec
  *
- * Convert a GstClockTime to a GstTimeSpec
+ * Convert a GstClockTime to a struct timespec (see man pselect)
  */
 #define GST_TIME_TO_TIMESPEC(t,ts)                     \
 G_STMT_START {                                                 \
index dfe9510..e7c334f 100644 (file)
@@ -181,7 +181,7 @@ GST_PLUGIN_DEFINE_STATIC (GST_VERSION_MAJOR,
 GST_END_TEST;
 
 /* tests for an element with no controlled params */
-GST_START_TEST (controller_new_fail)
+GST_START_TEST (controller_new_fail1)
 {
   GstController *ctrl;
   GstElement *elem;
@@ -197,6 +197,23 @@ GST_START_TEST (controller_new_fail)
 
 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);
+
+  g_object_unref (elem);
+}
+
+GST_END_TEST;
+
 /* tests for an element with controlled params */
 GST_START_TEST (controller_new_okay1)
 {
@@ -215,9 +232,27 @@ GST_START_TEST (controller_new_okay1)
 
 GST_END_TEST;
 
-/* controlling several params should return the same controller */
+/* 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);
+
+  g_object_unref (ctrl);
+  g_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;
 
@@ -356,9 +391,11 @@ gst_controller_suite (void)
 
   suite_add_tcase (s, tc);
   tcase_add_test (tc, controller_init);
-  tcase_add_test (tc, controller_new_fail);
+  tcase_add_test (tc, controller_new_fail1);
+  tcase_add_test (tc, controller_new_fail2);
   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);
index 8193ed7..6081dbc 100644 (file)
@@ -14,49 +14,64 @@ main (gint argc, gchar ** argv)
 {
   gint res = 1;
   GstElement *src, *sink;
-  GstBin *bin;
+  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_BIN (gst_pipeline_new ("pipeline"));
+  bin = gst_pipeline_new ("pipeline");
+  clock = gst_pipeline_get_clock (GST_PIPELINE (bin));
   /* TODO make this "testaudiosrc", when its ready */
   src = gst_element_factory_make ("sinesrc", "gen_audio");
   sink = gst_element_factory_make ("alsasink", "play_audio");
-  gst_bin_add_many (bin, src, sink, NULL);
-
+  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), "frequency", "volume", NULL))) {
+  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", 1 * GST_SECOND, &vol);
+  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);
 
-  // iterate two seconds
-  /*
-     if(gst_element_set_state (bin, GST_STATE_PLAYING))
-     {
-     while (gst_bin_iterate (bin))
-     {
-     }
-     }
-     gst_element_set_state (bin, GST_STATE_NULL);
-   */
+  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:
index c441d48..1ca991f 100644 (file)
@@ -26,6 +26,7 @@
 #endif
 
 #include <gst/gst.h>
+#include <gst/controller/gst-controller.h>
 
 #include "gst/gst-i18n-app.h"
 
@@ -264,6 +265,7 @@ print_element_properties_info (GstElement * element)
   GParamSpec **property_specs;
   guint num_properties, i;
   gboolean readable;
+  gboolean first_flag;
 
   property_specs = g_object_class_list_properties
       (G_OBJECT_GET_CLASS (element), &num_properties);
@@ -277,13 +279,27 @@ print_element_properties_info (GstElement * element)
     readable = FALSE;
 
     g_value_init (&value, param->value_type);
+
+    n_print ("  %-20s: %s\n", g_param_spec_get_name (param),
+        g_param_spec_get_blurb (param));
+
+    first_flag = TRUE;
+    n_print ("%-23.23s flags:. ", "");
     if (param->flags & G_PARAM_READABLE) {
       g_object_get_property (G_OBJECT (element), param->name, &value);
       readable = TRUE;
+      g_print ((first_flag ? "readable" : ", readble"));
+      first_flag = FALSE;
     }
-
-    n_print ("  %-20s: %s\n", g_param_spec_get_name (param),
-        g_param_spec_get_blurb (param));
+    if (param->flags & G_PARAM_WRITABLE) {
+      g_print ((first_flag ? "writable" : ", writable"));
+      first_flag = FALSE;
+    }
+    if (param->flags & GST_PARAM_CONTROLLABLE) {
+      g_print ((first_flag ? "controllable" : ", controllable"));
+      first_flag = FALSE;
+    }
+    n_print ("\n");
 
     switch (G_VALUE_TYPE (&value)) {
       case G_TYPE_STRING: