From d7b4691c3b8b73b1e721cd75c129043fd4efa970 Mon Sep 17 00:00:00 2001 From: Stefan Kost Date: Mon, 29 Aug 2005 19:59:52 +0000 Subject: [PATCH] check/gst-libs/controller.c: more tests 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 | 84 ++++++++++++++++----------- check/gst-libs/controller.c | 43 +++++++++++++- docs/gst/tmpl/gstutils.sgml | 16 +++++ docs/libs/gstreamer-libs-sections.txt | 6 +- docs/libs/tmpl/gstdataprotocol.sgml | 28 +++++++++ examples/controller/audio-example.c | 49 ++++++++++------ gst/gstclock.h | 4 +- tests/check/libs/controller.c | 43 +++++++++++++- tests/old/examples/controller/audio-example.c | 49 ++++++++++------ tools/gst-inspect.c | 22 ++++++- 10 files changed, 262 insertions(+), 82 deletions(-) diff --git a/ChangeLog b/ChangeLog index b6754d2..af18842 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2005-08-30 Stefan Kost + + * 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 * gst/gstutils.c (gst_util_uint64_scale): New 3733t funct10n. @@ -882,7 +898,7 @@ * check/gstcheck.h: add ASSERT_BUFFER_REFCOUNT -2005-08-13 Tim-Philipp Müller +2005-08-13 Tim-Philipp M??ller * docs/gst/gstreamer-sections.txt: * gst/gsttag.c: (_gst_tag_initialize), (gst_tag_register): @@ -892,7 +908,7 @@ is re-registered, unless it is re-registered with a different type (#308438). -2005-08-12 Tim-Philipp Müller +2005-08-12 Tim-Philipp M??ller * docs/pwg/appendix-porting.xml: * docs/pwg/building-state.xml: @@ -922,13 +938,13 @@ Actually implement (re)setting the target on a ghostpad as described in the docs. -2005-08-10 Tim-Philipp Müller +2005-08-10 Tim-Philipp M??ller * 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 +2005-08-10 Tim-Philipp M??ller * gst/base/gsttypefindhelper.c: (helper_find_peek), (gst_type_find_helper): @@ -940,7 +956,7 @@ returned by _peek() until typefinding is done and only free them then. -2005-08-09 Tim-Philipp Müller +2005-08-09 Tim-Philipp M??ller * docs/gst/gstreamer-sections.txt: * gst/gstutils.h: @@ -951,7 +967,7 @@ * gst/base/gstbasetransform.c: (gst_base_transform_buffer_alloc): Fix a pretty good memleak. -2005-08-08 Tim-Philipp Müller +2005-08-08 Tim-Philipp M??ller * gst/gstiterator.h: Fix wrong include and 'make distcheck'. @@ -961,7 +977,7 @@ * gst/gstbin.c: (bin_bus_handler): Use gst_element_post_message() instead. -2005-08-08 Tim-Philipp Müller +2005-08-08 Tim-Philipp M??ller * gst/base/gstadapter.h: * gst/base/gstbasesink.h: @@ -1222,7 +1238,7 @@ * tools/gst-xmlinspect.c: (print_element_info), (main): deactivate and remove dparams (libgstcontrol) -2005-08-01 Tim-Philipp Müller +2005-08-01 Tim-Philipp M??ller * gst/elements/gsttypefindelement.c: (gst_type_find_element_have_type), (gst_type_find_element_init), @@ -1231,7 +1247,7 @@ * gst/elements/gsttypefindelement.h: Set caps on all outgoing buffers, not just the first one. -2005-08-01 Tim-Philipp Müller +2005-08-01 Tim-Philipp M??ller * gst/elements/gsttypefindelement.c: (gst_type_find_element_have_type), @@ -1242,7 +1258,7 @@ * gst/elements/gsttypefindelement.h: Set caps on first outgoing buffer when we've found the type. -2005-08-01 Tim-Philipp Müller +2005-08-01 Tim-Philipp M??ller * docs/gst/gstreamer-docs.sgml: * docs/gst/gstreamer-sections.txt: @@ -1250,7 +1266,7 @@ * docs/gst/tmpl/gstschedulerfactory.sgml: Remove some old cruft from docs. -2005-07-31 Tim-Philipp Müller +2005-07-31 Tim-Philipp M??ller * gst/gstpad.h: Fix inline docs for GstPadLinkReturn. @@ -1260,7 +1276,7 @@ * docs/gst/gstreamer-sections.txt: New API: gst_structure_has_name(). -2005-07-30 Tim-Philipp Müller +2005-07-30 Tim-Philipp M??ller * configure.ac: Use AC_SYS_LARGEFILE, which will set _FILE_OFFSET_BITS=64 @@ -1924,7 +1940,7 @@ * gst/gstghostpad.c: (gst_ghost_pad_do_activate_push): Don't hold the lock for too long. -2005-07-16 Tim-Philipp Müller +2005-07-16 Tim-Philipp M??ller * gst/base/gstbasesrc.c: (gst_base_src_default_negotiate): Don't unref the caps we passed to gst_caps_make_writable() after @@ -1950,7 +1966,7 @@ * docs/design/part-gstpipeline.txt: Updated docs, mostly DISCONT related. -2005-07-15 Tim-Philipp Müller +2005-07-15 Tim-Philipp M??ller * docs/pwg/building-pads.xml: s/GST_PAD_LINK_REFUSED/FALSE/ in gst_my_filter_setcaps() @@ -2817,7 +2833,7 @@ * gst/gstpad.c: (_gst_do_pass_data_accumulator): Make work (??). -2005-06-29 Tim-Philipp Müller +2005-06-29 Tim-Philipp M??ller * gst/elements/gstfilesink.c: (gst_filesink_render): Simplify code so that we don't have to handle short @@ -3475,7 +3491,7 @@ (gst_system_clock_obtain): Set the name on object construction. Avoid double-checked locking. -2005-06-20 Tim-Philipp Müller +2005-06-20 Tim-Philipp M??ller * gst/gsturi.c: (gst_element_make_from_uri): Fix potential endless loop. @@ -4085,7 +4101,7 @@ Clear queue when going to READY. Remove IN_SETCAPS flag too. -2005-05-17 Tim-Philipp Müller +2005-05-17 Tim-Philipp M??ller * gst/base/gstbasesrc.c: (gst_basesrc_change_state): Remove implicit cast from gboolean to GstElementStateReturn; @@ -4226,12 +4242,12 @@ (find_common_root, object_has_ancestor, ghost_up, remove_pad): Helpers for pad_link_maybe_ghosting. -2005-05-13 Tim-Philipp Müller +2005-05-13 Tim-Philipp M??ller * configure.ac: Require GLib >= 2.4.0 (for the g_atomic_* funcs) -2005-05-13 Tim-Philipp Müller +2005-05-13 Tim-Philipp M??ller * docs/design/part-element-source.txt: Mention GstPushSrc @@ -4259,7 +4275,7 @@ * 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 +2005-05-12 Tim-Philipp M??ller * gst/base/gstbasesrc.c: (gst_basesrc_do_seek): Discont event offset format should be GST_FORMAT_BYTES, @@ -4494,7 +4510,7 @@ * 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 +2005-05-06 Tim-Philipp M??ller * docs/gst/Makefile.am: * docs/gst/gstreamer-docs.sgml: @@ -6050,7 +6066,7 @@ make the time that debugging functions print relative to when gst_init was called -2005-02-18 Tim-Philipp Müller +2005-02-18 Tim-Philipp M??ller * gst/gsttaginterface.c: Fix inline docs: tag setter vararg functions are NULL-terminated, @@ -6091,7 +6107,7 @@ * docs/libs/Makefile.am: make sure popt is added to gtk-doc flags. Fixes #147782. -2005-02-09 Tim-Philipp Müller +2005-02-09 Tim-Philipp M??ller * docs/faq/using.xml: Fix typo in FAQ (artssink => artsdsink) @@ -6101,7 +6117,7 @@ * tools/gst-launch.1.in: Fix typo (#166699). -2005-02-08 Tim-Philipp Müller +2005-02-08 Tim-Philipp M??ller * docs/faq/using.xml: Add -v argument to fakesrc/fakesink gst-launch line, @@ -6139,7 +6155,7 @@ 2005-02-07 Thomas Vander Stichele - patch by: Tim Philipp-Müller + patch by: Tim Philipp-M??ller * configure.ac: * gst/gstpad.c: @@ -6325,7 +6341,7 @@ (gst_dpman_get_manager) restructured DParam docs -2005-01-25 Tim-Philipp Müller +2005-01-25 Tim-Philipp M??ller * gst-element-check.m4: Only check for gst-inspect if we haven't already @@ -6351,7 +6367,7 @@ * gst/gstelement.h: fixing incomplete docs -2005-01-24 Tim-Philipp Müller +2005-01-24 Tim-Philipp M??ller * gst/elements/gstfilesink.c: (gst_filesink_handle_event): Don't unref seek event twice when fflush() fails @@ -10125,7 +10141,7 @@ 2004-05-03 David Schleef - * testsuite/caps/Makefile.am: Fix spelling of Ηρατοσθενες + * testsuite/caps/Makefile.am: Fix spelling of ?????????????????????? * testsuite/caps/erathostenes.c: * testsuite/caps/eratosthenes.c: (eratosthenes), (main): @@ -10444,7 +10460,7 @@ (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(). @@ -11408,7 +11424,7 @@ * docs/pwg/building-boiler.xml: add cvs login line and s/anonymous/anoncvs/ -2004-04-03 Tim-Phillip Müller +2004-04-03 Tim-Phillip M??ller reviewed by Benjamin Otte @@ -11569,7 +11585,7 @@ * po/LINGUAS: * po/az.po: - adding Azerbaijani (Mətin Əmirov) + adding Azerbaijani (M??tin ??mirov) 2004-03-28 Martin Soto @@ -11659,7 +11675,7 @@ * docs/pwg/other-oneton.xml: Document one-to-n elements, demuxers and parsers. -2004-03-25 Tim-Philipp Müller +2004-03-25 Tim-Philipp M??ller reviewed by: David Schleef @@ -11830,7 +11846,7 @@ * gst/gstvalue.h: Clean up a little bit. -2004-03-21 Tim-Philipp Müller +2004-03-21 Tim-Philipp M??ller reviewed by Benjamin Otte @@ -13528,7 +13544,7 @@ * 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) . 2004-01-28 David Schleef diff --git a/check/gst-libs/controller.c b/check/gst-libs/controller.c index dfe9510..e7c334f 100644 --- a/check/gst-libs/controller.c +++ b/check/gst-libs/controller.c @@ -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); diff --git a/docs/gst/tmpl/gstutils.sgml b/docs/gst/tmpl/gstutils.sgml index e507318..025afd1 100644 --- a/docs/gst/tmpl/gstutils.sgml +++ b/docs/gst/tmpl/gstutils.sgml @@ -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: diff --git a/docs/libs/gstreamer-libs-sections.txt b/docs/libs/gstreamer-libs-sections.txt index 8e294f1..dee0736 100644 --- a/docs/libs/gstreamer-libs-sections.txt +++ b/docs/libs/gstreamer-libs-sections.txt @@ -15,7 +15,7 @@
gstgetbits -libs/getbits/gstgetbits.h +gst/getbits/gstgetbits.h gst_getbits_t GstGetbitsCallback gst_getbits_init @@ -94,7 +94,7 @@ swab32
gstdataprotocol -libs/dataprotocol/dataprotocol.h +gst/dataprotocol/dataprotocol.h GstDPHeaderFlag GstDPPayloadType @@ -124,7 +124,7 @@ gst_dp_validate_packet
gstcontroller GstController -libs/controller/gstcontroller.h +gst/controller/gstcontroller.h GstController GstValueArray GstInterpolateMode diff --git a/docs/libs/tmpl/gstdataprotocol.sgml b/docs/libs/tmpl/gstdataprotocol.sgml index 1bb87c8..c5446c9 100644 --- a/docs/libs/tmpl/gstdataprotocol.sgml +++ b/docs/libs/tmpl/gstdataprotocol.sgml @@ -50,6 +50,34 @@ network connections also need a protocol to do this. @GST_DP_PAYLOAD_CAPS: @GST_DP_PAYLOAD_EVENT_NONE: + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/controller/audio-example.c b/examples/controller/audio-example.c index 8193ed7..6081dbc 100644 --- a/examples/controller/audio-example.c +++ b/examples/controller/audio-example.c @@ -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: diff --git a/gst/gstclock.h b/gst/gstclock.h index f244275..7f209a4 100644 --- a/gst/gstclock.h +++ b/gst/gstclock.h @@ -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 { \ diff --git a/tests/check/libs/controller.c b/tests/check/libs/controller.c index dfe9510..e7c334f 100644 --- a/tests/check/libs/controller.c +++ b/tests/check/libs/controller.c @@ -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); diff --git a/tests/old/examples/controller/audio-example.c b/tests/old/examples/controller/audio-example.c index 8193ed7..6081dbc 100644 --- a/tests/old/examples/controller/audio-example.c +++ b/tests/old/examples/controller/audio-example.c @@ -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: diff --git a/tools/gst-inspect.c b/tools/gst-inspect.c index c441d48..1ca991f 100644 --- a/tools/gst-inspect.c +++ b/tools/gst-inspect.c @@ -26,6 +26,7 @@ #endif #include +#include #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: -- 2.7.4