From 20efddd11efd6c7218e7ca582d336086b5b55063 Mon Sep 17 00:00:00 2001 From: Stefan Kost Date: Mon, 1 Aug 2005 16:17:31 +0000 Subject: [PATCH] deactivate and remove dparams (libgstcontrol) Original commit message from CVS: deactivate and remove dparams (libgstcontrol) --- ChangeLog | 42 + configure.ac | 2 - docs/gst/tmpl/gstbasesrc.sgml | 1 + docs/gst/tmpl/gstelement.sgml | 55 +- docs/gst/tmpl/gstevent.sgml | 410 +++---- docs/gst/tmpl/gstfakesrc.sgml | 3 + docs/gst/tmpl/gstformat.sgml | 11 - docs/gst/tmpl/gstghostpad.sgml | 5 - docs/gst/tmpl/gstpad.sgml | 11 +- docs/gst/tmpl/gstquery.sgml | 10 - docs/gst/tmpl/gststructure.sgml | 10 + docs/gst/tmpl/gsttaglist.sgml | 11 +- docs/gst/tmpl/gstvalue.sgml | 17 - docs/libs/gstreamer-libs-docs.sgml | 17 +- docs/libs/gstreamer-libs-sections.txt | 88 -- docs/libs/gstreamer-libs.types | 8 +- libs/gst/Makefile.am | 2 +- libs/gst/control/.gitignore | 5 - libs/gst/control/Makefile.am | 25 - libs/gst/control/control.c | 42 - libs/gst/control/control.h | 37 - libs/gst/control/dparam.c | 386 ------- libs/gst/control/dparam.h | 108 -- libs/gst/control/dparam_smooth.c | 467 -------- libs/gst/control/dparam_smooth.h | 75 -- libs/gst/control/dparamcommon.h | 32 - libs/gst/control/dparammanager.c | 1113 ------------------- libs/gst/control/dparammanager.h | 186 ---- libs/gst/control/dplinearinterp.c | 87 -- libs/gst/control/dplinearinterp.h | 56 - libs/gst/control/unitconvert.c | 456 -------- libs/gst/control/unitconvert.h | 79 -- tests/old/testsuite/Makefile.am | 4 +- tests/old/testsuite/dynparams/.gitignore | 5 - tests/old/testsuite/dynparams/Makefile.am | 7 - tests/old/testsuite/dynparams/dparamstest.c | 318 ------ testsuite/Makefile.am | 4 +- testsuite/dynparams/.gitignore | 5 - testsuite/dynparams/Makefile.am | 7 - testsuite/dynparams/dparamstest.c | 318 ------ tools/Makefile.am | 4 - tools/gst-inspect.c | 58 - tools/gst-xmlinspect.c | 55 - 43 files changed, 229 insertions(+), 4413 deletions(-) delete mode 100644 libs/gst/control/.gitignore delete mode 100644 libs/gst/control/Makefile.am delete mode 100644 libs/gst/control/control.c delete mode 100644 libs/gst/control/control.h delete mode 100644 libs/gst/control/dparam.c delete mode 100644 libs/gst/control/dparam.h delete mode 100644 libs/gst/control/dparam_smooth.c delete mode 100644 libs/gst/control/dparam_smooth.h delete mode 100644 libs/gst/control/dparamcommon.h delete mode 100644 libs/gst/control/dparammanager.c delete mode 100644 libs/gst/control/dparammanager.h delete mode 100644 libs/gst/control/dplinearinterp.c delete mode 100644 libs/gst/control/dplinearinterp.h delete mode 100644 libs/gst/control/unitconvert.c delete mode 100644 libs/gst/control/unitconvert.h delete mode 100644 tests/old/testsuite/dynparams/.gitignore delete mode 100644 tests/old/testsuite/dynparams/Makefile.am delete mode 100644 tests/old/testsuite/dynparams/dparamstest.c delete mode 100644 testsuite/dynparams/.gitignore delete mode 100644 testsuite/dynparams/Makefile.am delete mode 100644 testsuite/dynparams/dparamstest.c diff --git a/ChangeLog b/ChangeLog index 1c07ca982d..9c39dabb02 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,45 @@ +2005-08-01 Stefan Kost + + * configure.ac: + * docs/gst/tmpl/gstbasesrc.sgml: + * docs/gst/tmpl/gstelement.sgml: + * docs/gst/tmpl/gstevent.sgml: + * docs/gst/tmpl/gstfakesrc.sgml: + * docs/gst/tmpl/gstformat.sgml: + * docs/gst/tmpl/gstghostpad.sgml: + * docs/gst/tmpl/gstpad.sgml: + * docs/gst/tmpl/gstquery.sgml: + * docs/gst/tmpl/gststructure.sgml: + * docs/gst/tmpl/gsttaglist.sgml: + * docs/gst/tmpl/gstvalue.sgml: + * docs/libs/gstreamer-libs-docs.sgml: + * docs/libs/gstreamer-libs-sections.txt: + * docs/libs/gstreamer-libs.types: + * libs/gst/Makefile.am: + * libs/gst/control/.cvsignore: + * libs/gst/control/Makefile.am: + * libs/gst/control/control.c: + * libs/gst/control/control.h: + * libs/gst/control/dparam.c: + * libs/gst/control/dparam.h: + * libs/gst/control/dparam_smooth.c: + * libs/gst/control/dparam_smooth.h: + * libs/gst/control/dparamcommon.h: + * libs/gst/control/dparammanager.c: + * libs/gst/control/dparammanager.h: + * libs/gst/control/dplinearinterp.c: + * libs/gst/control/dplinearinterp.h: + * libs/gst/control/unitconvert.c: + * libs/gst/control/unitconvert.h: + * testsuite/Makefile.am: + * testsuite/dynparams/.cvsignore: + * testsuite/dynparams/Makefile.am: + * testsuite/dynparams/dparamstest.c: + * tools/Makefile.am: + * tools/gst-inspect.c: (print_element_info), (main): + * tools/gst-xmlinspect.c: (print_element_info), (main): + deactivate and remove dparams (libgstcontrol) + 2005-08-01 Tim-Philipp Müller * gst/elements/gsttypefindelement.c: diff --git a/configure.ac b/configure.ac index 1d05ae0221..4e9b3d3760 100644 --- a/configure.ac +++ b/configure.ac @@ -630,7 +630,6 @@ gst/parse/Makefile gst/registries/Makefile libs/Makefile libs/gst/Makefile -libs/gst/control/Makefile libs/gst/dataprotocol/Makefile libs/gst/getbits/Makefile po/Makefile.in @@ -648,7 +647,6 @@ testsuite/caps/Makefile testsuite/cleanup/Makefile testsuite/debug/Makefile testsuite/dlopen/Makefile -testsuite/dynparams/Makefile testsuite/elements/Makefile testsuite/indexers/Makefile testsuite/negotiation/Makefile diff --git a/docs/gst/tmpl/gstbasesrc.sgml b/docs/gst/tmpl/gstbasesrc.sgml index 0fa71a62a3..ada1af9eee 100644 --- a/docs/gst/tmpl/gstbasesrc.sgml +++ b/docs/gst/tmpl/gstbasesrc.sgml @@ -36,6 +36,7 @@ GstBaseSrc @segment_start: @segment_end: @segment_loop: +@need_discont: @offset: @size: @num_buffers: diff --git a/docs/gst/tmpl/gstelement.sgml b/docs/gst/tmpl/gstelement.sgml index 489dc9638c..703e7ddea1 100644 --- a/docs/gst/tmpl/gstelement.sgml +++ b/docs/gst/tmpl/gstelement.sgml @@ -91,14 +91,6 @@ and gst_element_set_clock(). You can wait for the clock to reach a given @sinkpads: @pads_cookie: - - - - - -@gstelement: the object which received the signal. -@arg1: - @@ -106,6 +98,14 @@ and gst_element_set_clock(). You can wait for the clock to reach a given @gstelement: the object which received the signal. + + + + + +@gstelement: the object which received the signal. +@arg1: + @@ -114,7 +114,7 @@ and gst_element_set_clock(). You can wait for the clock to reach a given @gstelement: the object which received the signal. @arg1: - + @@ -220,33 +220,6 @@ The Element is going from the READY state to the NULL state. - - -Helper macro to create query type functions - - -@functionname: The function name -@...: list of query types. - - - - -Halper macro to create element format functions - - -@functionname: The function name -@...: formats - - - - -A helper macro to create a mask function - - -@functionname: the name of the mask function -@...: Masks - - This enum defines the standard flags that an element may have. @@ -594,9 +567,17 @@ Sets the parent of an element. @element: +@rate: +@format: +@flags: +@cur_type: +@cur: +@stop_type: +@stop: +@Returns: + @seek_type: @offset: -@Returns: diff --git a/docs/gst/tmpl/gstevent.sgml b/docs/gst/tmpl/gstevent.sgml index d47b3986c5..f4575c480a 100644 --- a/docs/gst/tmpl/gstevent.sgml +++ b/docs/gst/tmpl/gstevent.sgml @@ -39,6 +39,7 @@ gst_event_new_flush() creates a new flush event. @type: @timestamp: @src: +@structure: @@ -46,22 +47,16 @@ The different major types of events. @GST_EVENT_UNKNOWN: unknown event. +@GST_EVENT_FLUSH_START: +@GST_EVENT_FLUSH_STOP: @GST_EVENT_EOS: an end-of-stream event. -@GST_EVENT_FLUSH: a flush event. -@GST_EVENT_DISCONTINUOUS: a discontinuous event to indicate the stream has a discontinuity. +@GST_EVENT_NEWSEGMENT: +@GST_EVENT_TAG: +@GST_EVENT_FILLER: @GST_EVENT_QOS: a quality of service event @GST_EVENT_SEEK: a seek event. -@GST_EVENT_SIZE: a size suggestion for a peer element -@GST_EVENT_RATE: adjust the output rate of an element @GST_EVENT_NAVIGATION: -@GST_EVENT_TAG: - - - - - - - +@GST_EVENT_CUSTOM_START: @@ -94,74 +89,6 @@ The source object that generated this event @event: The event to query - - -Check if the event is an interrupt event - - -@event: The event to check - - - - -Shift for the format in the GstSeekType - - - - - - -Shift for the method in the GstSeekType - - - - - - -Shift for the flags in the GstSeekType - - - - - - -Mask for the format in the GstSeekType - - - - - - -Mask for the method in the GstSeekType - - - - - - -Mask for the flags in the GstSeekType - - - - - - -Event flags are used when querying for supported events - - -@GST_EVENT_FLAG_NONE: no value -@GST_RATE_FLAG_NEGATIVE: indicates negative rates are supported - - - -A convenience macro to create event mask functions - - -@type: The type of the first argument of the function -@functionname: the name of the function -@...: event masks, the last element is marked with 0 - - The different types of seek events. When constructing a seek event a format, @@ -190,129 +117,10 @@ in a pipeline. -@GST_SEEK_METHOD_CUR: Seek to an relative position -@GST_SEEK_METHOD_SET: Seek to an absolute position -@GST_SEEK_METHOD_END: Seek relative to the end of the stream -@GST_SEEK_FLAG_FLUSH: Flush any pending data while seeking -@GST_SEEK_FLAG_ACCURATE: Seek as accurately as possible -@GST_SEEK_FLAG_KEY_UNIT: Seek to a nearby key unit -@GST_SEEK_FLAG_SEGMENT_LOOP: Loop between start and stop in a segmented seek - - - -The accuracy about a seek operation gives more information of how the seek was -performed, namly if the seek was accurate or fuzzy. - - -@GST_SEEK_CERTAIN: The seek was exact -@GST_SEEK_FUZZY: The seek was fuzzy, exact position can not be guaranteed - - - -Get the seektype of the GST_EVENT_SEEK. - - -@event: The event to query. - - - - -The format of the seek value - - -@event: The event operate on - - - - -The seek method to use as one of #GstSeekType - - -@event: The event operate on - - - - -The optional seek flags - - -@event: The event operate on - - - - -Get the offset of the seek event. - - -@event: The event to query. - - - - -The event stop position for a segment seek - - -@event: The event to query - - - - -Indicates how accurate the event was performed. - - -@event: The event to query - - - - -The offset of the discont event. A discont event can hold up to 8 different -format/value pairs. - - -@event: The event to query -@i: The offset/value pair. - - - - -Get the number of offset/value pairs this event has. - - -@event: The event to query. - - - - -The format of the size event. - - -@event: The event to query - - - - -The value of the size event - - -@event: The event to query - - - - -Get access to the rate vale field - - -@event: The event to query - - - - - - - -@type: -@Returns: - +@GST_SEEK_TYPE_NONE: +@GST_SEEK_TYPE_CUR: +@GST_SEEK_TYPE_SET: +@GST_SEEK_TYPE_END: @@ -339,100 +147,164 @@ Copy the event using the event specific copy function @Returns: A new event that is a copy of the given input event - + -@masks: -@mask: +@type: +@structure: @Returns: + + + + + +@event: +@Returns: + + + + + + + +@Returns: + + + + + + + +@Returns: + + + + + + + +@Returns: + + + + + + + +@rate: +@format: +@start_value: +@stop_value: +@base: +@Returns: + + + + + + + +@event: +@rate: +@format: +@start_value: +@end_value: +@base: + + + + + + + +@taglist: +@Returns: + +@list: + + + + + + + +@event: +@taglist: + + + + +Create a new dummy event that should be ignored + + +@Returns: + + + + + + + +@proportion: +@diff: +@timestamp: +@Returns: + + + + + + + +@event: +@proportion: +@diff: +@timestamp: + + -@type: -@offset: -@Returns: - - - - - - - -@type: -@start: +@rate: +@format: +@flags: +@cur_type: +@cur: +@stop_type: @stop: @Returns: - - - - - - - -@format: -@value: -@Returns: - - - - - - - -@rate: -@format1: -@Varargs: -@Returns: -@new_media: +@type: +@offset: - - - - - -@rate: -@format1: -@var_args: -@Returns: - -@new_media: - - - + @event: +@rate: @format: -@start_value: -@end_value: -@Returns: - -@value: +@flags: +@cur_type: +@cur: +@stop_type: +@stop: - + -Create a new dummy event that should be ignored + - - - - -Create a new flush event. - - -@done: +@structure: @Returns: diff --git a/docs/gst/tmpl/gstfakesrc.sgml b/docs/gst/tmpl/gstfakesrc.sgml index 9acacf214d..57e11cccf2 100644 --- a/docs/gst/tmpl/gstfakesrc.sgml +++ b/docs/gst/tmpl/gstfakesrc.sgml @@ -30,6 +30,9 @@ GstFakeSrc @gstfakesrc: the object which received the signal. @arg1: +@: +@: +@: diff --git a/docs/gst/tmpl/gstformat.sgml b/docs/gst/tmpl/gstformat.sgml index 353899a5dc..ae7b43d8b6 100644 --- a/docs/gst/tmpl/gstformat.sgml +++ b/docs/gst/tmpl/gstformat.sgml @@ -54,17 +54,6 @@ A format definition @nick: A short nick of the format @description: A longer description of the format - - -A convenience function to define a function that returns an array -of formats. - - -@type: The type of the first argument of the function -@functionname: The name of the function -@...: comma separated list of functions closed with 0 - - diff --git a/docs/gst/tmpl/gstghostpad.sgml b/docs/gst/tmpl/gstghostpad.sgml index c760eedd1a..b92fdbd2c0 100644 --- a/docs/gst/tmpl/gstghostpad.sgml +++ b/docs/gst/tmpl/gstghostpad.sgml @@ -23,11 +23,6 @@ Pseudo link pads - - - - - diff --git a/docs/gst/tmpl/gstpad.sgml b/docs/gst/tmpl/gstpad.sgml index eb933fdd43..fa5a64d5b2 100644 --- a/docs/gst/tmpl/gstpad.sgml +++ b/docs/gst/tmpl/gstpad.sgml @@ -300,12 +300,13 @@ The direction of a pad. The result of a pad link. -@GST_PAD_LINK_NOSCHED: -@GST_PAD_LINK_NOFORMAT: -@GST_PAD_LINK_REFUSED: the link was refused. -@GST_PAD_LINK_WRONG_DIRECTION: -@GST_PAD_LINK_WAS_LINKED: @GST_PAD_LINK_OK: the link succeeded. +@GST_PAD_LINK_WRONG_HIERARCHY: +@GST_PAD_LINK_WAS_LINKED: +@GST_PAD_LINK_WRONG_DIRECTION: +@GST_PAD_LINK_NOFORMAT: +@GST_PAD_LINK_NOSCHED: +@GST_PAD_LINK_REFUSED: the link was refused. diff --git a/docs/gst/tmpl/gstquery.sgml b/docs/gst/tmpl/gstquery.sgml index efea5bc2e7..3fcf8be151 100644 --- a/docs/gst/tmpl/gstquery.sgml +++ b/docs/gst/tmpl/gstquery.sgml @@ -48,16 +48,6 @@ A Query Type definition @nick: a short nick @description: a longer description of the query type - - -Convenience function to define a function that returns an array of query types. - - -@type: Type of first argument for function -@functionname: The name of the function -@...: query types, 0 to end the list - - diff --git a/docs/gst/tmpl/gststructure.sgml b/docs/gst/tmpl/gststructure.sgml index d9d15e58d8..14fd72eb34 100644 --- a/docs/gst/tmpl/gststructure.sgml +++ b/docs/gst/tmpl/gststructure.sgml @@ -101,6 +101,16 @@ Generic structure containing fields of names and values @Returns: + + + + + +@structure: +@name: +@Returns: + + diff --git a/docs/gst/tmpl/gsttaglist.sgml b/docs/gst/tmpl/gsttaglist.sgml index 2164017f57..b45b44696e 100644 --- a/docs/gst/tmpl/gsttaglist.sgml +++ b/docs/gst/tmpl/gsttaglist.sgml @@ -606,16 +606,7 @@ List of tags and values used to describe media metadata -@list: -@Returns: - - - - - - - -@tag_event: +@taglist: @Returns: diff --git a/docs/gst/tmpl/gstvalue.sgml b/docs/gst/tmpl/gstvalue.sgml index 97e3caa792..72251a33ee 100644 --- a/docs/gst/tmpl/gstvalue.sgml +++ b/docs/gst/tmpl/gstvalue.sgml @@ -106,14 +106,6 @@ Checks if the give GValue contains a LIST value. @x: the #GValue to check - - -Checks if the give GValue contains a FIXED_LIST value. - - -@x: the #GValue to check - - Checks if the give GValue contains a CAPS value. @@ -235,15 +227,6 @@ GST_VALUE_GREATER_THAN or GST_VALUE_UNORDERED @serialize: @deserialize: - - - - - -@type: -@Returns: - - diff --git a/docs/libs/gstreamer-libs-docs.sgml b/docs/libs/gstreamer-libs-docs.sgml index 21cf7c6957..55a8120248 100644 --- a/docs/libs/gstreamer-libs-docs.sgml +++ b/docs/libs/gstreamer-libs-docs.sgml @@ -6,14 +6,8 @@ - - - - - - @@ -43,15 +37,6 @@ --> - - gstcontrol - &GstControl; - &GstDParamManager; - &GstDParam; - &GstDParamSmooth; - &GstDParamLinInterp; - &GstUnitConvert; - diff --git a/docs/libs/gstreamer-libs-sections.txt b/docs/libs/gstreamer-libs-sections.txt index d331ecf0f1..8c59a4bda8 100644 --- a/docs/libs/gstreamer-libs-sections.txt +++ b/docs/libs/gstreamer-libs-sections.txt @@ -111,91 +111,3 @@ gst_dp_validate_packet -# GstControl library - -
-gstcontrol -GstControl -libs/control/control.h -gst_control_init - - -
- -
-gstdpman -GstDParamManager -libs/control/control.h -GstDParamManager -gst_dpman_new -gst_dpman_add_required_dparam_callback -gst_dpman_add_required_dparam_direct -gst_dpman_add_required_dparam_array -gst_dpman_remove_required_dparam -gst_dpman_attach_dparam -gst_dpman_detach_dparam -gst_dpman_get_dparam -gst_dpman_get_dparam_type -gst_dpman_list_dparam_specs -gst_dpman_get_param_spec -gst_dpman_set_rate -gst_dpman_register_mode -gst_dpman_set_mode -gst_dpman_set_parent -gst_dpman_get_manager -gst_dpman_bypass_dparam - - -
- -
-gstdparam -GstDParam -libs/control/control.h -GstDParam -gst_dparam_new -gst_dparam_attach -gst_dparam_detach -gst_dparam_do_update_default - - -
- -
-gstdpsmooth -GstDParamSmooth -libs/control/control.h -GstDParamSmooth -gst_dpsmooth_new - - -
- -
-gstdplinint -GstDParamLinInterp -libs/control/control.h -GstDParamLinInterp -gst_dp_linint_new - - -
- -
-gstunitconvert -GstUnitConvert -libs/control/control.h -GstUnitConvert -gst_unitconv_new -gst_unitconv_set_convert_units -gst_unitconv_convert_value -gst_unitconv_unit_spec -gst_unitconv_unit_exists -gst_unitconv_unit_is_logarithmic -gst_unitconv_register_unit -gst_unitconv_register_convert_func -gst_unitconv_register_convert_property - - -
- diff --git a/docs/libs/gstreamer-libs.types b/docs/libs/gstreamer-libs.types index a8d4b0c38a..aaaf415a81 100644 --- a/docs/libs/gstreamer-libs.types +++ b/docs/libs/gstreamer-libs.types @@ -1,9 +1,3 @@ #include -#include -gst_object_get_type -gst_dparam_get_type -gst_dpman_get_type -gst_dpsmooth_get_type -gst_dp_linint_get_type -gst_unitconv_get_type + diff --git a/libs/gst/Makefile.am b/libs/gst/Makefile.am index e778366c40..049515328c 100644 --- a/libs/gst/Makefile.am +++ b/libs/gst/Makefile.am @@ -1 +1 @@ -SUBDIRS = control dataprotocol getbits +SUBDIRS = dataprotocol getbits diff --git a/libs/gst/control/.gitignore b/libs/gst/control/.gitignore deleted file mode 100644 index 1d7497234e..0000000000 --- a/libs/gst/control/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -*.bb -*.bbg -*.da -*.def -*.gcno diff --git a/libs/gst/control/Makefile.am b/libs/gst/control/Makefile.am deleted file mode 100644 index 03785ea826..0000000000 --- a/libs/gst/control/Makefile.am +++ /dev/null @@ -1,25 +0,0 @@ -lib_LTLIBRARIES = libgstcontrol-@GST_MAJORMINOR@.la - -libgstcontrol_@GST_MAJORMINOR@_includedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/control -libgstcontrol_@GST_MAJORMINOR@_include_HEADERS = \ - control.h \ - dparammanager.h \ - dparam.h \ - dparam_smooth.h \ - unitconvert.h \ - dparamcommon.h \ - dplinearinterp.h - -libgstcontrol_@GST_MAJORMINOR@_la_SOURCES = \ - control.c \ - dparammanager.c \ - dparam.c \ - dparam_smooth.c \ - unitconvert.c \ - dplinearinterp.c - -libgstcontrol_@GST_MAJORMINOR@_la_CFLAGS = $(GST_OBJ_CFLAGS) -I$(top_srcdir)/libs -libgstcontrol_@GST_MAJORMINOR@_la_LDFLAGS = @GST_LIB_LDFLAGS@ -# control uses log and exp, so we need -lm if xml is disabled -libgstcontrol_@GST_MAJORMINOR@_la_LIBADD = $(GST_OBJ_LIBS) -lm - diff --git a/libs/gst/control/control.c b/libs/gst/control/control.c deleted file mode 100644 index 750144443a..0000000000 --- a/libs/gst/control/control.c +++ /dev/null @@ -1,42 +0,0 @@ -/* GStreamer - * Copyright (C) 2001 Steve Baker - * - * gstcontrol.c: GStreamer control utility library - * - * 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 "control.h" - -GST_DEBUG_CATEGORY (_gst_control_debug); -#define GST_CAT_DEFAULT _gst_control_debug - -/** - * gst_control_init: - * @argc: pointer to application's argc - * @argv: pointer to application's argv - * - * Initializes the GStreamer control library, registering modes and units - */ -void -gst_control_init (int *argc, char **argv[]) -{ - GST_DEBUG_CATEGORY_INIT (_gst_control_debug, "control", 0, "libgstcontrol"); - _gst_dpman_initialize (); - _gst_unitconv_initialize (); -} diff --git a/libs/gst/control/control.h b/libs/gst/control/control.h deleted file mode 100644 index 048918245a..0000000000 --- a/libs/gst/control/control.h +++ /dev/null @@ -1,37 +0,0 @@ -/* GStreamer - * Copyright (C) 2001 Steve Baker - * - * gstcontrol.h: GStreamer control utility library - * - * 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_CONTROL_H__ -#define __GST_CONTROL_H__ - -#include -#include -#include -#include -#include - -G_BEGIN_DECLS - -void gst_control_init (int *argc, char **argv[]); - -G_END_DECLS - -#endif /* __GST_CONTROL_H__ */ diff --git a/libs/gst/control/dparam.c b/libs/gst/control/dparam.c deleted file mode 100644 index 32b67c958c..0000000000 --- a/libs/gst/control/dparam.c +++ /dev/null @@ -1,386 +0,0 @@ -/* GStreamer - * Copyright (C) 2001 Steve Baker - * - * gstdparam.c: Dynamic Parameter - * - * 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 "dparam.h" -#include "dparammanager.h" -#include - -GST_DEBUG_CATEGORY_EXTERN (_gst_control_debug); -#define GST_CAT_DEFAULT _gst_control_debug - -static void gst_dparam_class_init (GstDParamClass * klass); -static void gst_dparam_init (GstDParam * dparam); -static void gst_dparam_dispose (GObject * object); -static void gst_dparam_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec); -static void gst_dparam_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec); - -enum -{ - ARG_0, - ARG_VALUE_FLOAT, - ARG_VALUE_DOUBLE, - ARG_VALUE_INT, - ARG_VALUE_INT64, -}; - -enum -{ - VALUE_CHANGED, - LAST_SIGNAL -}; - -static guint gst_dparam_signals[LAST_SIGNAL] = { 0 }; - -GType -gst_dparam_get_type (void) -{ - static GType dparam_type = 0; - - if (!dparam_type) { - static const GTypeInfo dparam_info = { - sizeof (GstDParamClass), - NULL, - NULL, - (GClassInitFunc) gst_dparam_class_init, - NULL, - NULL, - sizeof (GstDParam), - 0, - (GInstanceInitFunc) gst_dparam_init, - }; - - dparam_type = - g_type_register_static (GST_TYPE_OBJECT, "GstDParam", &dparam_info, 0); - } - return dparam_type; -} - -static void -gst_dparam_class_init (GstDParamClass * klass) -{ - GObjectClass *gobject_class; - GstDParamClass *dparam_class; - GstObjectClass *gstobject_class; - - gobject_class = (GObjectClass *) klass; - dparam_class = (GstDParamClass *) klass; - gstobject_class = (GstObjectClass *) klass; - - gobject_class->get_property = gst_dparam_get_property; - gobject_class->set_property = gst_dparam_set_property; - - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_VALUE_FLOAT, - g_param_spec_float ("value_float", "Float Value", - "The value that should be changed if gfloat is the type", - -G_MAXFLOAT, G_MAXFLOAT, 0.0F, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_VALUE_DOUBLE, - g_param_spec_double ("value_double", "Double Value", - "The value that should be changed if gdouble is the type", - -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_VALUE_INT, - g_param_spec_int ("value_int", "Integer Value", - "The value that should be changed if gint is the type", - G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_VALUE_INT64, - g_param_spec_int64 ("value_int64", "64 bit Integer Value", - "The value that should be changed if gint64 is the type", - G_MININT64, G_MAXINT64, 0, G_PARAM_READWRITE)); - - gobject_class->dispose = gst_dparam_dispose; - - gst_dparam_signals[VALUE_CHANGED] = - g_signal_new ("value-changed", G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstDParamClass, value_changed), NULL, - NULL, gst_marshal_VOID__VOID, G_TYPE_NONE, 0); - /*gstobject_class->save_thyself = gst_dparam_save_thyself; */ - -} - -static void -gst_dparam_init (GstDParam * dparam) -{ - g_return_if_fail (dparam != NULL); - GST_DPARAM_TYPE (dparam) = 0; - GST_DPARAM_NEXT_UPDATE_TIMESTAMP (dparam) = 0LL; - GST_DPARAM_LAST_UPDATE_TIMESTAMP (dparam) = 0LL; - GST_DPARAM_READY_FOR_UPDATE (dparam) = FALSE; - dparam->lock = g_mutex_new (); -} - -/** - * gst_dparam_new: - * @type: the type that this dparam will store - * - * Create a new dynamic parameter controller. - * - * Returns: a new instance of GstDParam - */ -GstDParam * -gst_dparam_new (GType type) -{ - GstDParam *dparam; - - dparam = g_object_new (gst_dparam_get_type (), NULL); - dparam->do_update_func = gst_dparam_do_update_default; - - GST_DPARAM_TYPE (dparam) = type; - - return dparam; -} - - -static void -gst_dparam_get_property (GObject * object, guint prop_id, GValue * value, - GParamSpec * pspec) -{ - GstDParam *dparam; - - g_return_if_fail (GST_IS_DPARAM (object)); - dparam = GST_DPARAM (object); - - switch (prop_id) { - case ARG_VALUE_FLOAT: - g_value_set_float (value, dparam->value_float); - break; - - case ARG_VALUE_DOUBLE: - g_value_set_double (value, dparam->value_double); - break; - - case ARG_VALUE_INT: - g_value_set_int (value, dparam->value_int); - break; - - case ARG_VALUE_INT64: - g_value_set_int64 (value, dparam->value_int64); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_dparam_set_property (GObject * object, guint prop_id, const GValue * value, - GParamSpec * pspec) -{ - GstDParam *dparam; - - g_return_if_fail (GST_IS_DPARAM (object)); - dparam = GST_DPARAM (object); - GST_DPARAM_LOCK (dparam); - - switch (prop_id) { - case ARG_VALUE_FLOAT: - GST_DEBUG ("setting value from %g to %g", dparam->value_float, - g_value_get_float (value)); - dparam->value_float = g_value_get_float (value); - GST_DPARAM_NEXT_UPDATE_TIMESTAMP (dparam) = - GST_DPARAM_LAST_UPDATE_TIMESTAMP (dparam); - GST_DPARAM_READY_FOR_UPDATE (dparam) = TRUE; - break; - - case ARG_VALUE_DOUBLE: - GST_DEBUG ("setting value from %g to %g", - dparam->value_double, g_value_get_double (value)); - dparam->value_double = g_value_get_double (value); - GST_DPARAM_NEXT_UPDATE_TIMESTAMP (dparam) = - GST_DPARAM_LAST_UPDATE_TIMESTAMP (dparam); - GST_DPARAM_READY_FOR_UPDATE (dparam) = TRUE; - break; - - case ARG_VALUE_INT: - GST_DEBUG ("setting value from %d to %d", dparam->value_int, - g_value_get_int (value)); - dparam->value_int = g_value_get_int (value); - GST_DPARAM_NEXT_UPDATE_TIMESTAMP (dparam) = - GST_DPARAM_LAST_UPDATE_TIMESTAMP (dparam); - GST_DPARAM_READY_FOR_UPDATE (dparam) = TRUE; - break; - - case ARG_VALUE_INT64: - GST_DEBUG ("setting value from %" - G_GINT64_FORMAT " to %" - G_GINT64_FORMAT, dparam->value_int64, g_value_get_int64 (value)); - dparam->value_int64 = g_value_get_int64 (value); - GST_DPARAM_NEXT_UPDATE_TIMESTAMP (dparam) = - GST_DPARAM_LAST_UPDATE_TIMESTAMP (dparam); - GST_DPARAM_READY_FOR_UPDATE (dparam) = TRUE; - break; - - default: - break; - } - - /* note that this signal is sent while we still have the lock. */ - g_signal_emit (G_OBJECT (dparam), gst_dparam_signals[VALUE_CHANGED], 0); - GST_DPARAM_UNLOCK (dparam); -} - -/** - * gst_dparam_do_update_default: - * @dparam: the parameter to update - * @timestamp: when should the update take place - * @value: the new value - * @update_info: unused here - * - * Default implementation for changing a dynamic parameter. - * Subclasses might overwrite the behaviour of this. - * - */ -void -gst_dparam_do_update_default (GstDParam * dparam, gint64 timestamp, - GValue * value, GstDParamUpdateInfo update_info) -{ - GST_DPARAM_LOCK (dparam); - - g_return_if_fail (G_VALUE_TYPE (value) == GST_DPARAM_TYPE (dparam)); - GST_DEBUG ("updating value for %s(%p)", GST_DPARAM_NAME (dparam), dparam); - - switch (G_VALUE_TYPE (value)) { - case G_TYPE_FLOAT: - g_value_set_float (value, dparam->value_float); - break; - - case G_TYPE_DOUBLE: - g_value_set_double (value, dparam->value_double); - break; - - case G_TYPE_INT: - g_value_set_int (value, dparam->value_int); - break; - - case G_TYPE_INT64: - g_value_set_int64 (value, dparam->value_int64); - break; - - default: - break; - } - - GST_DPARAM_LAST_UPDATE_TIMESTAMP (dparam) = timestamp; - GST_DPARAM_NEXT_UPDATE_TIMESTAMP (dparam) = timestamp; - GST_DPARAM_READY_FOR_UPDATE (dparam) = FALSE; - - GST_DPARAM_UNLOCK (dparam); -} - -static void -gst_dparam_dispose (GObject * object) -{ - GstDParam *dparam = GST_DPARAM (object); - gchar *dparam_name = g_strdup (GST_DPARAM_NAME (dparam)); - - GST_DEBUG ("disposing of %s", dparam_name); - if (GST_DPARAM_MANAGER (dparam)) { - gst_dpman_detach_dparam (GST_DPARAM_MANAGER (dparam), dparam_name); - } - g_free (dparam_name); -} - -/** - * gst_dparam_attach - * @dparam: GstDParam instance - * @manager: the GstDParamManager that this dparam belongs to - * @param_spec: the specification for the parameter - * @unit_name: the name of the unit - * - * Adding the parameter controller to the manager using the - * supplied specs and unit. - * See also gst_dpman_attach_dparam(). - */ -void -gst_dparam_attach (GstDParam * dparam, GstDParamManager * manager, - GParamSpec * param_spec, gchar * unit_name) -{ - GValue value = { 0, }; - - g_return_if_fail (dparam != NULL); - g_return_if_fail (GST_IS_DPARAM (dparam)); - g_return_if_fail (manager != NULL); - g_return_if_fail (GST_IS_DPMAN (manager)); - g_return_if_fail (param_spec != NULL); - g_return_if_fail (unit_name != NULL); - g_return_if_fail (G_IS_PARAM_SPEC (param_spec)); - g_return_if_fail (G_PARAM_SPEC_VALUE_TYPE (param_spec) == - GST_DPARAM_TYPE (dparam)); - - gst_object_set_name (GST_OBJECT (dparam), g_param_spec_get_name (param_spec)); - GST_DPARAM_PARAM_SPEC (dparam) = param_spec; - GST_DPARAM_MANAGER (dparam) = manager; - GST_DPARAM_UNIT_NAME (dparam) = unit_name; - GST_DPARAM_IS_LOG (dparam) = gst_unitconv_unit_is_logarithmic (unit_name); - GST_DEBUG ("attaching %s to dparam %p", GST_DPARAM_NAME (dparam), dparam); - - // get default value from param-spec and set in dparam - g_value_init (&value, param_spec->value_type); - g_param_value_set_default (param_spec, &value); - switch (G_PARAM_SPEC_VALUE_TYPE (param_spec)) { - case G_TYPE_FLOAT: - dparam->value_float = g_value_get_float (&value); - break; - - case G_TYPE_DOUBLE: - dparam->value_double = g_value_get_double (&value); - break; - - case G_TYPE_INT: - dparam->value_int = g_value_get_int (&value); - break; - - case G_TYPE_INT64: - dparam->value_int64 = g_value_get_int64 (&value); - break; - - default: - break; - } -} - -/** - * gst_dparam_detach - * @dparam: GstDParam instance - * - * Removes a previousely added parameter controller. - */ -void -gst_dparam_detach (GstDParam * dparam) -{ - - g_return_if_fail (dparam != NULL); - g_return_if_fail (GST_IS_DPARAM (dparam)); - - GST_DEBUG ("detaching %s from dparam %p", GST_DPARAM_NAME (dparam), dparam); - - gst_object_set_name (GST_OBJECT (dparam), NULL); - GST_DPARAM_PARAM_SPEC (dparam) = NULL; - GST_DPARAM_MANAGER (dparam) = NULL; -} diff --git a/libs/gst/control/dparam.h b/libs/gst/control/dparam.h deleted file mode 100644 index dfbbfd809e..0000000000 --- a/libs/gst/control/dparam.h +++ /dev/null @@ -1,108 +0,0 @@ -/* GStreamer - * Copyright (C) 2001 Steve Baker - * - * gstdparam.h: Dynamic Parameter functionality - * - * 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_DPARAM_H__ -#define __GST_DPARAM_H__ - -#include -#include "dparamcommon.h" - -G_BEGIN_DECLS - -#define GST_TYPE_DPARAM (gst_dparam_get_type ()) -#define GST_DPARAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_DPARAM,GstDParam)) -#define GST_DPARAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_DPARAM,GstDParam)) -#define GST_IS_DPARAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_DPARAM)) -#define GST_IS_DPARAM_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_DPARAM)) - -#define GST_DPARAM_NAME(dparam) (GST_OBJECT_NAME(dparam)) -#define GST_DPARAM_PARENT(dparam) (GST_OBJECT_PARENT(dparam)) -#define GST_DPARAM_CHANGE_VALUE(dparam) ((dparam)->change_value) -#define GST_DPARAM_PARAM_SPEC(dparam) ((dparam)->param_spec) -#define GST_DPARAM_MANAGER(dparam) ((dparam)->manager) -#define GST_DPARAM_TYPE(dparam) ((dparam)->type) -#define GST_DPARAM_UNIT_NAME(dparam) ((dparam)->unit_name) -#define GST_DPARAM_IS_LOG(dparam) ((dparam)->is_log) -#define GST_DPARAM_META_VALUES(dparam) ((dparam)->meta_values) -#define GST_DPARAM_META_PARAM_SPECS(dparam) ((dparam)->meta_param_specs) -#define GST_DPARAM_LOCK(dparam) (g_mutex_lock((dparam)->lock)) -#define GST_DPARAM_UNLOCK(dparam) (g_mutex_unlock((dparam)->lock)) - -#define GST_DPARAM_READY_FOR_UPDATE(dparam) ((dparam)->ready_for_update) -#define GST_DPARAM_NEXT_UPDATE_TIMESTAMP(dparam) ((dparam)->next_update_timestamp) -#define GST_DPARAM_LAST_UPDATE_TIMESTAMP(dparam) ((dparam)->last_update_timestamp) - -#define GST_DPARAM_DO_UPDATE(dparam, timestamp, value, update_info) \ - ((dparam->do_update_func)(dparam, timestamp, value, update_info)) - -typedef struct _GstDParamClass GstDParamClass; - -typedef enum { - GST_DPARAM_UPDATE_FIRST, - GST_DPARAM_UPDATE_NORMAL -} GstDParamUpdateInfo; - -typedef void (*GstDParamDoUpdateFunction) (GstDParam *dparam, gint64 timestamp, GValue *value, GstDParamUpdateInfo update_info); - -struct _GstDParam { - GstObject object; - - GstDParamDoUpdateFunction do_update_func; - - GMutex *lock; - - gfloat value_float; - gdouble value_double; - gint value_int; - gint64 value_int64; - - GstDParamManager *manager; - GParamSpec *param_spec; - GType type; - gboolean ready_for_update; - - gint64 next_update_timestamp; - gint64 last_update_timestamp; - gchar *unit_name; - gboolean is_log; - - gpointer _gst_reserved[GST_PADDING]; -}; - -struct _GstDParamClass { - GstObjectClass parent_class; - - /* signal callbacks */ - void (*value_changed) (GstDParam *dparam); - - gpointer _gst_reserved[GST_PADDING]; -}; - - -GType gst_dparam_get_type (void); -GstDParam* gst_dparam_new (GType type); -void gst_dparam_attach (GstDParam *dparam, GstDParamManager *manager, GParamSpec *param_spec, gchar *unit_name); -void gst_dparam_detach (GstDParam *dparam); -void gst_dparam_do_update_default (GstDParam *dparam, gint64 timestamp, GValue *value, GstDParamUpdateInfo update_info); - -G_END_DECLS - -#endif /* __GST_DPARAM_H__ */ diff --git a/libs/gst/control/dparam_smooth.c b/libs/gst/control/dparam_smooth.c deleted file mode 100644 index 0f4d9db966..0000000000 --- a/libs/gst/control/dparam_smooth.c +++ /dev/null @@ -1,467 +0,0 @@ -/* GStreamer - * Copyright (C) 2001 Steve Baker - * - * gstdparam_smooth.c: Realtime smoothed dynamic parameter - * - * 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 "dparam_smooth.h" -#include "dparammanager.h" - -GST_DEBUG_CATEGORY_EXTERN (_gst_control_debug); -#define GST_CAT_DEFAULT _gst_control_debug - -static void gst_dpsmooth_class_init (GstDParamSmoothClass * klass); -static void gst_dpsmooth_init (GstDParamSmooth * dparam); -static void gst_dpsmooth_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec); -static void gst_dpsmooth_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec); -static void gst_dpsmooth_do_update_float (GstDParam * dparam, gint64 timestamp, - GValue * value, GstDParamUpdateInfo update_info); -static void gst_dpsmooth_value_changed_float (GstDParam * dparam); -static void gst_dpsmooth_do_update_double (GstDParam * dparam, gint64 timestamp, - GValue * value, GstDParamUpdateInfo update_info); -static void gst_dpsmooth_value_changed_double (GstDParam * dparam); - -enum -{ - ARG_0, - ARG_UPDATE_PERIOD, - ARG_SLOPE_TIME, - ARG_SLOPE_DELTA_FLOAT, - ARG_SLOPE_DELTA_DOUBLE, - ARG_SLOPE_DELTA_INT, - ARG_SLOPE_DELTA_INT64, -}; - -GType -gst_dpsmooth_get_type (void) -{ - static GType dpsmooth_type = 0; - - if (!dpsmooth_type) { - static const GTypeInfo dpsmooth_info = { - sizeof (GstDParamSmoothClass), - NULL, - NULL, - (GClassInitFunc) gst_dpsmooth_class_init, - NULL, - NULL, - sizeof (GstDParamSmooth), - 0, - (GInstanceInitFunc) gst_dpsmooth_init, - }; - - dpsmooth_type = - g_type_register_static (GST_TYPE_DPARAM, "GstDParamSmooth", - &dpsmooth_info, 0); - } - return dpsmooth_type; -} - -static void -gst_dpsmooth_class_init (GstDParamSmoothClass * klass) -{ - GObjectClass *gobject_class; - GstDParamSmoothClass *dpsmooth_class; - GstObjectClass *gstobject_class; - - gobject_class = (GObjectClass *) klass; - dpsmooth_class = (GstDParamSmoothClass *) klass; - gstobject_class = (GstObjectClass *) klass; - - gobject_class->get_property = gst_dpsmooth_get_property; - gobject_class->set_property = gst_dpsmooth_set_property; - - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_UPDATE_PERIOD, - g_param_spec_int64 ("update_period", - "Update Period (nanoseconds)", - "Number of nanoseconds between updates", - 0LL, G_MAXINT64, 2000000LL, G_PARAM_READWRITE)); - - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SLOPE_TIME, - g_param_spec_int64 ("slope_time", - "Slope Time (nanoseconds)", - "The time period to define slope_delta by", - 0LL, G_MAXINT64, 10000000LL, G_PARAM_READWRITE)); - - g_object_class_install_property (G_OBJECT_CLASS (klass), - ARG_SLOPE_DELTA_FLOAT, - g_param_spec_float ("slope_delta_float", "Slope Delta float", - "The amount a float value can change for a given slope_time", - 0.0F, G_MAXFLOAT, 0.2F, G_PARAM_READWRITE)); - - g_object_class_install_property (G_OBJECT_CLASS (klass), - ARG_SLOPE_DELTA_DOUBLE, - g_param_spec_double ("slope_delta_double", "Slope Delta double", - "The amount a double value can change for a given slope_time", - 0.0, G_MAXDOUBLE, 0.2, G_PARAM_READWRITE)); - - /*gstobject_class->save_thyself = gst_dparam_save_thyself; */ - -} - -static void -gst_dpsmooth_init (GstDParamSmooth * dpsmooth) -{ - g_return_if_fail (dpsmooth != NULL); -} - -/** - * gst_dpsmooth_new: - * @type: the type that this dparam will store - * - * Create a new dynamic parameter controller which smoothes control changes. - * - * Returns: a new instance of GstDParam - */ -GstDParam * -gst_dpsmooth_new (GType type) -{ - GstDParam *dparam; - GstDParamSmooth *dpsmooth; - - dpsmooth = g_object_new (gst_dpsmooth_get_type (), NULL); - dparam = GST_DPARAM (dpsmooth); - - GST_DPARAM_TYPE (dparam) = type; - - switch (type) { - case G_TYPE_FLOAT:{ - dparam->do_update_func = gst_dpsmooth_do_update_float; - g_signal_connect (G_OBJECT (dpsmooth), "value_changed", - G_CALLBACK (gst_dpsmooth_value_changed_float), NULL); - break; - } - case G_TYPE_DOUBLE:{ - dparam->do_update_func = gst_dpsmooth_do_update_double; - g_signal_connect (G_OBJECT (dpsmooth), "value_changed", - G_CALLBACK (gst_dpsmooth_value_changed_double), NULL); - break; - } - default: - /* we don't support this type here */ - dparam->do_update_func = gst_dparam_do_update_default; - break; - } - return dparam; -} - -static void -gst_dpsmooth_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec) -{ - GstDParam *dparam; - GstDParamSmooth *dpsmooth; - - g_return_if_fail (GST_IS_DPSMOOTH (object)); - - dpsmooth = GST_DPSMOOTH (object); - dparam = GST_DPARAM (object); - - GST_DPARAM_LOCK (dparam); - - switch (prop_id) { - case ARG_UPDATE_PERIOD: - dpsmooth->update_period = g_value_get_int64 (value); - GST_DPARAM_READY_FOR_UPDATE (dparam) = TRUE; - break; - - case ARG_SLOPE_TIME: - dpsmooth->slope_time = g_value_get_int64 (value); - GST_DEBUG ("dpsmooth->slope_time:%" - G_GINT64_FORMAT, dpsmooth->slope_time); - GST_DPARAM_READY_FOR_UPDATE (dparam) = TRUE; - break; - - case ARG_SLOPE_DELTA_FLOAT: - dpsmooth->slope_delta_float = g_value_get_float (value); - GST_DPARAM_READY_FOR_UPDATE (dparam) = TRUE; - break; - - case ARG_SLOPE_DELTA_DOUBLE: - dpsmooth->slope_delta_double = g_value_get_double (value); - GST_DPARAM_READY_FOR_UPDATE (dparam) = TRUE; - break; - - default: - break; - } - GST_DPARAM_UNLOCK (dparam); -} - -static void -gst_dpsmooth_get_property (GObject * object, guint prop_id, GValue * value, - GParamSpec * pspec) -{ - GstDParam *dparam; - GstDParamSmooth *dpsmooth; - - g_return_if_fail (GST_IS_DPSMOOTH (object)); - - dpsmooth = GST_DPSMOOTH (object); - dparam = GST_DPARAM (object); - - switch (prop_id) { - case ARG_UPDATE_PERIOD: - g_value_set_int64 (value, dpsmooth->update_period); - break; - case ARG_SLOPE_TIME: - g_value_set_int64 (value, dpsmooth->slope_time); - break; - case ARG_SLOPE_DELTA_FLOAT: - g_value_set_float (value, dpsmooth->slope_delta_float); - break; - case ARG_SLOPE_DELTA_DOUBLE: - g_value_set_double (value, dpsmooth->slope_delta_double); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_dpsmooth_value_changed_float (GstDParam * dparam) -{ - GstDParamSmooth *dpsmooth; - gfloat time_ratio; - - g_return_if_fail (GST_IS_DPSMOOTH (dparam)); - dpsmooth = GST_DPSMOOTH (dparam); - - if (GST_DPARAM_IS_LOG (dparam)) { - dparam->value_float = log (dparam->value_float); - } - dpsmooth->start_float = dpsmooth->current_float; - dpsmooth->diff_float = dparam->value_float - dpsmooth->start_float; - - time_ratio = ABS (dpsmooth->diff_float) / dpsmooth->slope_delta_float; - dpsmooth->duration_interp = - (gint64) (time_ratio * (gfloat) dpsmooth->slope_time); - - dpsmooth->need_interp_times = TRUE; - - GST_DEBUG ("%f to %f ratio:%f duration:%" - G_GINT64_FORMAT "\n", - dpsmooth->start_float, dparam->value_float, time_ratio, - dpsmooth->duration_interp); -} - -static void -gst_dpsmooth_do_update_float (GstDParam * dparam, gint64 timestamp, - GValue * value, GstDParamUpdateInfo update_info) -{ - gfloat time_ratio; - GstDParamSmooth *dpsmooth = GST_DPSMOOTH (dparam); - - GST_DPARAM_LOCK (dparam); - - if (dpsmooth->need_interp_times) { - dpsmooth->start_interp = timestamp; - dpsmooth->end_interp = timestamp + dpsmooth->duration_interp; - dpsmooth->need_interp_times = FALSE; - } - - if ((update_info == GST_DPARAM_UPDATE_FIRST) - || (timestamp >= dpsmooth->end_interp)) { - if (GST_DPARAM_IS_LOG (dparam)) { - g_value_set_float (value, exp (dparam->value_float)); - } else { - g_value_set_float (value, dparam->value_float); - } - dpsmooth->current_float = dparam->value_float; - - GST_DEBUG ("interp finished at %" G_GINT64_FORMAT, timestamp); - - GST_DPARAM_LAST_UPDATE_TIMESTAMP (dparam) = timestamp; - GST_DPARAM_NEXT_UPDATE_TIMESTAMP (dparam) = timestamp; - - GST_DPARAM_READY_FOR_UPDATE (dparam) = FALSE; - GST_DPARAM_UNLOCK (dparam); - return; - } - - if (timestamp <= dpsmooth->start_interp) { - if (GST_DPARAM_IS_LOG (dparam)) { - g_value_set_float (value, exp (dpsmooth->start_float)); - } else { - g_value_set_float (value, dpsmooth->start_float); - } - GST_DPARAM_LAST_UPDATE_TIMESTAMP (dparam) = timestamp; - GST_DPARAM_NEXT_UPDATE_TIMESTAMP (dparam) = - dpsmooth->start_interp + dpsmooth->update_period; - - GST_DEBUG ("interp started at %" G_GINT64_FORMAT, timestamp); - - GST_DPARAM_UNLOCK (dparam); - return; - - } - - time_ratio = - (gfloat) (timestamp - - dpsmooth->start_interp) / (gfloat) dpsmooth->duration_interp; - - GST_DEBUG ("start:%" G_GINT64_FORMAT " current:%" G_GINT64_FORMAT " end:%" - G_GINT64_FORMAT " ratio%f", dpsmooth->start_interp, timestamp, - dpsmooth->end_interp, time_ratio); - GST_DEBUG ("pre start:%f current:%f target:%f", dpsmooth->start_float, - dpsmooth->current_float, dparam->value_float); - - dpsmooth->current_float = - dpsmooth->start_float + (dpsmooth->diff_float * time_ratio); - - GST_DPARAM_NEXT_UPDATE_TIMESTAMP (dparam) = - timestamp + dpsmooth->update_period; - if (GST_DPARAM_NEXT_UPDATE_TIMESTAMP (dparam) > dpsmooth->end_interp) { - GST_DPARAM_NEXT_UPDATE_TIMESTAMP (dparam) = dpsmooth->end_interp; - } - - GST_DPARAM_LAST_UPDATE_TIMESTAMP (dparam) = timestamp; - - if (GST_DPARAM_IS_LOG (dparam)) { - g_value_set_float (value, exp (dpsmooth->current_float)); - } else { - g_value_set_float (value, dpsmooth->current_float); - } - - GST_DEBUG ("post start:%f current:%f target:%f", dpsmooth->start_float, - dpsmooth->current_float, dparam->value_float); - - GST_DPARAM_UNLOCK (dparam); -} - -static void -gst_dpsmooth_value_changed_double (GstDParam * dparam) -{ - GstDParamSmooth *dpsmooth; - gdouble time_ratio; - - g_return_if_fail (GST_IS_DPSMOOTH (dparam)); - dpsmooth = GST_DPSMOOTH (dparam); - - if (GST_DPARAM_IS_LOG (dparam)) { - dparam->value_double = log (dparam->value_double); - } - dpsmooth->start_double = dpsmooth->current_double; - dpsmooth->diff_double = dparam->value_double - dpsmooth->start_double; - - time_ratio = ABS (dpsmooth->diff_double) / dpsmooth->slope_delta_double; - dpsmooth->duration_interp = - (gint64) (time_ratio * (gdouble) dpsmooth->slope_time); - - dpsmooth->need_interp_times = TRUE; - - GST_DEBUG ("%f to %f ratio:%f duration:%" - G_GINT64_FORMAT "\n", - dpsmooth->start_double, dparam->value_double, time_ratio, - dpsmooth->duration_interp); -} - -static void -gst_dpsmooth_do_update_double (GstDParam * dparam, gint64 timestamp, - GValue * value, GstDParamUpdateInfo update_info) -{ - gdouble time_ratio; - GstDParamSmooth *dpsmooth = GST_DPSMOOTH (dparam); - - GST_DPARAM_LOCK (dparam); - - if (dpsmooth->need_interp_times) { - dpsmooth->start_interp = timestamp; - dpsmooth->end_interp = timestamp + dpsmooth->duration_interp; - dpsmooth->need_interp_times = FALSE; - } - - if ((update_info == GST_DPARAM_UPDATE_FIRST) - || (timestamp >= dpsmooth->end_interp)) { - if (GST_DPARAM_IS_LOG (dparam)) { - g_value_set_double (value, exp (dparam->value_double)); - } else { - g_value_set_double (value, dparam->value_double); - } - dpsmooth->current_double = dparam->value_double; - - GST_DEBUG ("interp finished at %" G_GINT64_FORMAT, timestamp); - - GST_DPARAM_LAST_UPDATE_TIMESTAMP (dparam) = timestamp; - GST_DPARAM_NEXT_UPDATE_TIMESTAMP (dparam) = timestamp; - - GST_DPARAM_READY_FOR_UPDATE (dparam) = FALSE; - GST_DPARAM_UNLOCK (dparam); - return; - } - - if (timestamp <= dpsmooth->start_interp) { - if (GST_DPARAM_IS_LOG (dparam)) { - g_value_set_double (value, exp (dpsmooth->start_double)); - } else { - g_value_set_double (value, dpsmooth->start_double); - } - GST_DPARAM_LAST_UPDATE_TIMESTAMP (dparam) = timestamp; - GST_DPARAM_NEXT_UPDATE_TIMESTAMP (dparam) = - dpsmooth->start_interp + dpsmooth->update_period; - - GST_DEBUG ("interp started at %" G_GINT64_FORMAT, timestamp); - - GST_DPARAM_UNLOCK (dparam); - return; - - } - - time_ratio = - (gdouble) (timestamp - - dpsmooth->start_interp) / (gdouble) dpsmooth->duration_interp; - - GST_DEBUG ("start:%" G_GINT64_FORMAT " current:%" G_GINT64_FORMAT " end:%" - G_GINT64_FORMAT " ratio%f", dpsmooth->start_interp, timestamp, - dpsmooth->end_interp, time_ratio); - GST_DEBUG ("pre start:%f current:%f target:%f", dpsmooth->start_double, - dpsmooth->current_double, dparam->value_double); - - dpsmooth->current_double = - dpsmooth->start_double + (dpsmooth->diff_double * time_ratio); - - GST_DPARAM_NEXT_UPDATE_TIMESTAMP (dparam) = - timestamp + dpsmooth->update_period; - if (GST_DPARAM_NEXT_UPDATE_TIMESTAMP (dparam) > dpsmooth->end_interp) { - GST_DPARAM_NEXT_UPDATE_TIMESTAMP (dparam) = dpsmooth->end_interp; - } - - GST_DPARAM_LAST_UPDATE_TIMESTAMP (dparam) = timestamp; - - if (GST_DPARAM_IS_LOG (dparam)) { - g_value_set_double (value, exp (dpsmooth->current_double)); - } else { - g_value_set_double (value, dpsmooth->current_double); - } - - GST_DEBUG ("post start:%f current:%f target:%f", dpsmooth->start_double, - dpsmooth->current_double, dparam->value_double); - - GST_DPARAM_UNLOCK (dparam); -} diff --git a/libs/gst/control/dparam_smooth.h b/libs/gst/control/dparam_smooth.h deleted file mode 100644 index 3731e9e5ac..0000000000 --- a/libs/gst/control/dparam_smooth.h +++ /dev/null @@ -1,75 +0,0 @@ -/* GStreamer - * Copyright (C) 2001 Steve Baker - * - * gstdparam_smooth.h: Realtime smoothed dynamic parameter - * - * 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_DPSMOOTH_H__ -#define __GST_DPSMOOTH_H__ - -#include "dparam.h" - -G_BEGIN_DECLS - -#define GST_TYPE_DPSMOOTH (gst_dpsmooth_get_type ()) -#define GST_DPSMOOTH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_DPSMOOTH,GstDParamSmooth)) -#define GST_DPSMOOTH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_DPSMOOTH,GstDParamSmooth)) -#define GST_IS_DPSMOOTH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_DPSMOOTH)) -#define GST_IS_DPSMOOTH_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_DPSMOOTH)) - -typedef struct _GstDParamSmoothClass GstDParamSmoothClass; -typedef struct _GstDParamSmooth GstDParamSmooth; - -struct _GstDParamSmooth { - GstDParam dparam; - - gint64 start_interp; - gint64 end_interp; - gint64 duration_interp; - - gfloat start_float; - gfloat diff_float; - gfloat current_float; - gdouble start_double; - gdouble diff_double; - gdouble current_double; - - gint64 update_period; - gint64 slope_time; - gfloat slope_delta_float; - gdouble slope_delta_double; - - gboolean need_interp_times; - - gpointer _gst_reserved[GST_PADDING]; -}; - -struct _GstDParamSmoothClass { - GstDParamClass parent_class; - - /* signal callbacks */ - gpointer _gst_reserved[GST_PADDING]; -}; - -GType gst_dpsmooth_get_type (void); - -GstDParam* gst_dpsmooth_new (GType type); - -G_END_DECLS - -#endif /* __GST_DPSMOOTH_H__ */ diff --git a/libs/gst/control/dparamcommon.h b/libs/gst/control/dparamcommon.h deleted file mode 100644 index 05e1e9fb3d..0000000000 --- a/libs/gst/control/dparamcommon.h +++ /dev/null @@ -1,32 +0,0 @@ -/* GStreamer - * Copyright (C) 2001 Steve Baker - * - * gstdparamcommon.h: Dynamic Parameter common header - * - * 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_DPCOMMON_H__ -#define __GST_DPCOMMON_H__ - -G_BEGIN_DECLS - -typedef struct _GstDParam GstDParam; -typedef struct _GstDParamManager GstDParamManager; - -G_END_DECLS - -#endif /* __GST_DPCOMMON_H__ */ diff --git a/libs/gst/control/dparammanager.c b/libs/gst/control/dparammanager.c deleted file mode 100644 index dfbb400de7..0000000000 --- a/libs/gst/control/dparammanager.c +++ /dev/null @@ -1,1113 +0,0 @@ -/* GStreamer - * Copyright (C) 2001 Steve Baker - * - * gstdparammanager.c: Dynamic Parameter group functionality - * - * 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 "dparammanager.h" -#include -#include -#include - -GST_DEBUG_CATEGORY_EXTERN (_gst_control_debug); -#define GST_CAT_DEFAULT _gst_control_debug - -static GHashTable *_element_registry = NULL; -static gboolean _gst_dpman_init_done = FALSE; - -enum -{ - NEW_REQUIRED_DPARAM, - LAST_SIGNAL -}; - -static void gst_dpman_class_init (GstDParamManagerClass * klass); -static void gst_dpman_init (GstDParamManager * dpman); -static void gst_dpman_dispose (GObject * object); -static GstDParamWrapper *gst_dpman_new_wrapper (GstDParamManager * dpman, - GParamSpec * param_spec, gchar * unit_name, - GstDPMUpdateMethod update_method); -static GstDParamWrapper *gst_dpman_get_wrapper (GstDParamManager * dpman, - const gchar * dparam_name); -static void gst_dpman_state_changed (GstElement * element, gint old_state, - gint new_state, GstDParamManager * dpman); -static gboolean gst_dpman_preprocess_synchronous (GstDParamManager * dpman, - guint frames, gint64 timestamp); -static gboolean gst_dpman_preprocess_asynchronous (GstDParamManager * dpman, - guint frames, gint64 timestamp); -static gboolean gst_dpman_process_asynchronous (GstDParamManager * dpman, - guint frame_count); -static gboolean gst_dpman_preprocess_noop (GstDParamManager * dpman, - guint frames, gint64 timestamp); -static gboolean gst_dpman_process_noop (GstDParamManager * dpman, - guint frame_count); -static void gst_dpman_setup_synchronous (GstDParamManager * dpman); -static void gst_dpman_setup_asynchronous (GstDParamManager * dpman); -static void gst_dpman_setup_disabled (GstDParamManager * dpman); -static void gst_dpman_teardown_synchronous (GstDParamManager * dpman); -static void gst_dpman_teardown_asynchronous (GstDParamManager * dpman); -static void gst_dpman_teardown_disabled (GstDParamManager * dpman); - -static GObjectClass *parent_class; -static guint gst_dpman_signals[LAST_SIGNAL] = { 0 }; - -void -_gst_dpman_initialize () -{ - if (_gst_dpman_init_done) - return; - - _gst_dpman_init_done = TRUE; - _element_registry = g_hash_table_new (NULL, NULL); -} - -GType -gst_dpman_get_type (void) -{ - static GType dpman_type = 0; - - if (!dpman_type) { - static const GTypeInfo dpman_info = { - sizeof (GstDParamManagerClass), - NULL, - NULL, - (GClassInitFunc) gst_dpman_class_init, - NULL, - NULL, - sizeof (GstDParamManager), - 0, - (GInstanceInitFunc) gst_dpman_init, - }; - - dpman_type = - g_type_register_static (GST_TYPE_OBJECT, "GstDParamManager", - &dpman_info, 0); - } - return dpman_type; -} - -static void -gst_dpman_class_init (GstDParamManagerClass * klass) -{ - GstObjectClass *gstobject_class; - GObjectClass *gobject_class; - - parent_class = g_type_class_peek_parent (klass); - - gstobject_class = (GstObjectClass *) klass; - gobject_class = (GObjectClass *) klass; - gobject_class->dispose = gst_dpman_dispose; - - klass->modes = g_hash_table_new (g_str_hash, g_str_equal); - - gst_dpman_register_mode (klass, "synchronous", - gst_dpman_preprocess_synchronous, gst_dpman_process_noop, - gst_dpman_setup_synchronous, gst_dpman_teardown_synchronous); - gst_dpman_register_mode (klass, "asynchronous", - gst_dpman_preprocess_asynchronous, gst_dpman_process_asynchronous, - gst_dpman_setup_asynchronous, gst_dpman_teardown_asynchronous); - gst_dpman_register_mode (klass, "disabled", - gst_dpman_preprocess_noop, gst_dpman_process_noop, - gst_dpman_setup_disabled, gst_dpman_teardown_disabled); - - - gst_dpman_signals[NEW_REQUIRED_DPARAM] = - g_signal_new ("new-required-dparam", G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstDParamManagerClass, - new_required_dparam), NULL, NULL, gst_marshal_VOID__STRING, - G_TYPE_NONE, 1, G_TYPE_STRING); -} - -static void -gst_dpman_init (GstDParamManager * dpman) -{ - GST_DPMAN_DPARAMS (dpman) = g_hash_table_new (g_str_hash, g_str_equal); - GST_DPMAN_DPARAMS_LIST (dpman) = NULL; - GST_DPMAN_PARENT (dpman) = NULL; - GST_DPMAN_MODE_NAME (dpman) = NULL; - GST_DPMAN_MODE (dpman) = NULL; - GST_DPMAN_RATE (dpman) = 0; -} - -/** - * gst_dpman_new: - * @name: name of the new #GstDParamManager instance to create - * @parent: #GstElement which creates this instance - * - * Creates a new instance of a dynamic parameter manager. - * - * Returns: a new instance of #GstDParamManager. - */ -GstDParamManager * -gst_dpman_new (gchar * name, GstElement * parent) -{ - GstDParamManager *dpman; - - g_return_val_if_fail (name != NULL, NULL); - - dpman = g_object_new (gst_dpman_get_type (), NULL); - gst_object_set_name (GST_OBJECT (dpman), name); - gst_dpman_set_parent (dpman, parent); - - gst_dpman_set_mode (dpman, "disabled"); - - return dpman; -} - - -static void -gst_dpman_dispose (GObject * object) -{ -/* GstDParamManager *dpman = GST_DPMAN(object); */ - - G_OBJECT_CLASS (parent_class)->dispose (object); -} - -/** - * gst_dpman_add_required_dparam_callback: - * @dpman: GstDParamManager instance - * @param_spec: the spacification of the new dparam - * @unit_name: the unit name of the dparam - * @update_func: callback to update the element with the new value - * @update_data: will be included in the call to update_func - * - * Add a mandatory dynamic parameter to the manager, where the value can be - * updated by calling the supplied callback function. - * - * Returns: true if it was successfully added - */ -gboolean -gst_dpman_add_required_dparam_callback (GstDParamManager * dpman, - GParamSpec * param_spec, - gchar * unit_name, GstDPMUpdateFunction update_func, gpointer update_data) -{ - GstDParamWrapper *dpwrap; - - g_return_val_if_fail (dpman != NULL, FALSE); - g_return_val_if_fail (GST_IS_DPMAN (dpman), FALSE); - g_return_val_if_fail (update_func != NULL, FALSE); - - dpwrap = - gst_dpman_new_wrapper (dpman, param_spec, unit_name, GST_DPMAN_CALLBACK); - - if (!dpwrap) { - GST_INFO ("failed to obtain a new dparam wrapper"); - return FALSE; - } - - GST_DEBUG ("adding required callback dparam '%s'", - g_param_spec_get_name (param_spec)); - - dpwrap->update_func = update_func; - dpwrap->update_data = update_data; - - g_signal_emit (G_OBJECT (dpman), gst_dpman_signals[NEW_REQUIRED_DPARAM], 0, - g_param_spec_get_name (param_spec)); - - return TRUE; -} - -/** - * gst_dpman_add_required_dparam_direct: - * @dpman: GstDParamManager instance - * @param_spec: the spacification of the new dparam - * @unit_name: the unit name of the dparam - * @update_data: pointer to the member to be updated - * - * Add a mandatory dynamic parameter to the manager, where the value can be - * updated by directly storing it into the provided memory location. - * - * Returns: true if it was successfully added - */ -gboolean -gst_dpman_add_required_dparam_direct (GstDParamManager * dpman, - GParamSpec * param_spec, gchar * unit_name, gpointer update_data) -{ - GstDParamWrapper *dpwrap; - - g_return_val_if_fail (dpman != NULL, FALSE); - g_return_val_if_fail (GST_IS_DPMAN (dpman), FALSE); - g_return_val_if_fail (update_data != NULL, FALSE); - - dpwrap = - gst_dpman_new_wrapper (dpman, param_spec, unit_name, GST_DPMAN_DIRECT); - - if (!dpwrap) { - GST_INFO ("failed to obtain a new dparam wrapper"); - return FALSE; - } - - GST_DEBUG ("adding required direct dparam '%s'", - g_param_spec_get_name (param_spec)); - - dpwrap->update_data = update_data; - - g_signal_emit (G_OBJECT (dpman), gst_dpman_signals[NEW_REQUIRED_DPARAM], 0, - g_param_spec_get_name (param_spec)); - - return TRUE; -} - -/** - * gst_dpman_add_required_dparam_array: - * @dpman: GstDParamManager instance - * @param_spec: the spacification of the new dparam - * @unit_name: the unit name of the dparam - * @update_data: pointer to where the array will be stored - * - * Add a mandatory dynamic parameter to the manager, where the values can be - * updated by storing them into the provided memory location. - * - * Returns: true if it was successfully added - */ -gboolean -gst_dpman_add_required_dparam_array (GstDParamManager * dpman, - GParamSpec * param_spec, gchar * unit_name, gpointer update_data) -{ - GstDParamWrapper *dpwrap; - - g_return_val_if_fail (dpman != NULL, FALSE); - g_return_val_if_fail (GST_IS_DPMAN (dpman), FALSE); - g_return_val_if_fail (update_data != NULL, FALSE); - - dpwrap = - gst_dpman_new_wrapper (dpman, param_spec, unit_name, GST_DPMAN_ARRAY); - - if (!dpwrap) { - GST_INFO ("failed to obtain a new dparam wrapper"); - return FALSE; - } - - GST_DEBUG ("adding required array dparam '%s'", - g_param_spec_get_name (param_spec)); - - dpwrap->update_data = update_data; - - g_signal_emit (G_OBJECT (dpman), gst_dpman_signals[NEW_REQUIRED_DPARAM], 0, - g_param_spec_get_name (param_spec)); - - return TRUE; -} - -/** - * gst_dpman_remove_required_dparam: - * @dpman: GstDParamManager instance - * @dparam_name: the name of an existing parameter - * - * Removes the named dynamic parameter from the manager. - */ -void -gst_dpman_remove_required_dparam (GstDParamManager * dpman, - const gchar * dparam_name) -{ - GstDParamWrapper *dpwrap; - - g_return_if_fail (dpman != NULL); - g_return_if_fail (GST_IS_DPMAN (dpman)); - g_return_if_fail (dparam_name != NULL); - - dpwrap = gst_dpman_get_wrapper (dpman, dparam_name); - - g_return_if_fail (dpwrap != NULL); - g_return_if_fail (dpwrap->dparam == NULL); - - GST_DEBUG ("removing required dparam: %s", dparam_name); - - g_hash_table_remove (GST_DPMAN_DPARAMS (dpman), dparam_name); - GST_DPMAN_DPARAMS_LIST (dpman) = - g_list_remove (GST_DPMAN_DPARAMS_LIST (dpman), dpwrap); - - g_free (dpwrap->value); - g_free (dpwrap); -} - -/** - * gst_dpman_attach_dparam: - * @dpman: GstDParamManager instance - * @dparam_name: a name previously added with gst_dpman_add_required_dparam - * @dparam: GstDParam instance to attach - * - * Adding a parameter controller to a dynamic parameter. Whenever the controller - * changes, the dynamic parameter of the GstElement will follow. - * - * Returns: true if it was successfully attached - */ -gboolean -gst_dpman_attach_dparam (GstDParamManager * dpman, const gchar * dparam_name, - GstDParam * dparam) -{ - GstDParamWrapper *dpwrap; - - g_return_val_if_fail (dpman != NULL, FALSE); - g_return_val_if_fail (GST_IS_DPMAN (dpman), FALSE); - g_return_val_if_fail (dparam_name != NULL, FALSE); - g_return_val_if_fail (dparam != NULL, FALSE); - g_return_val_if_fail (GST_IS_DPARAM (dparam), FALSE); - g_return_val_if_fail (dparam != NULL, FALSE); - - dpwrap = gst_dpman_get_wrapper (dpman, dparam_name); - - if (!dpwrap) { - GST_INFO ("failed to obtain get the dparam wrapper for parameter '%s'", - dparam_name); - return FALSE; - } - // FIXME: if these are triggered convert them to messages + returns as well - g_return_val_if_fail (dpwrap->value != NULL, FALSE); - g_return_val_if_fail (G_PARAM_SPEC_VALUE_TYPE (dpwrap->param_spec) == - GST_DPARAM_TYPE (dparam), FALSE); - - dpwrap->dparam = dparam; - gst_dparam_attach (dparam, dpman, dpwrap->param_spec, dpwrap->unit_name); - - return TRUE; -} - -/** - * gst_dpman_detach_dparam: - * @dpman: GstDParamManager instance - * @dparam_name: the name of a parameter with a previously attached GstDParam - * - * Removing a parameter controller from a dynamic parameter. - */ -void -gst_dpman_detach_dparam (GstDParamManager * dpman, const gchar * dparam_name) -{ - GstDParamWrapper *dpwrap; - - g_return_if_fail (dpman != NULL); - g_return_if_fail (GST_IS_DPMAN (dpman)); - g_return_if_fail (dparam_name != NULL); - - dpwrap = gst_dpman_get_wrapper (dpman, dparam_name); - g_return_if_fail (dpwrap); - - gst_dparam_detach (dpwrap->dparam); - dpwrap->dparam = NULL; - -} - -/** - * gst_dpman_get_dparam: - * @dpman: GstDParamManager instance - * @dparam_name: the name of an existing dparam instance - * - * Fetches a dparam object that is registered by manager under the given name. - * - * Returns: the dparam with the given name - or NULL otherwise - */ -GstDParam * -gst_dpman_get_dparam (GstDParamManager * dpman, const gchar * dparam_name) -{ - GstDParamWrapper *dpwrap; - - g_return_val_if_fail (dpman != NULL, NULL); - g_return_val_if_fail (GST_IS_DPMAN (dpman), NULL); - g_return_val_if_fail (dparam_name != NULL, NULL); - - dpwrap = gst_dpman_get_wrapper (dpman, dparam_name); - - if (!dpwrap) { - GST_INFO ("failed to obtain get the dparam wrapper for parameter '%s'", - dparam_name); - return NULL; - } - - return dpwrap->dparam; -} - -/** - * gst_dpman_get_dparam_type: - * @dpman: GstDParamManager instance - * @dparam_name: the name of dparam - * - * Fetches the type of the supplied dynamic parameter. - * - * Returns: the type that this dparam requires/uses - */ -GType -gst_dpman_get_dparam_type (GstDParamManager * dpman, const gchar * dparam_name) -{ - GstDParamWrapper *dpwrap; - - g_return_val_if_fail (dpman != NULL, 0); - g_return_val_if_fail (GST_IS_DPMAN (dpman), 0); - g_return_val_if_fail (dparam_name != NULL, 0); - - dpwrap = gst_dpman_get_wrapper (dpman, dparam_name); - - if (!dpwrap) { - GST_INFO ("failed to obtain get the dparam wrapper for parameter '%s'", - dparam_name); - return 0; - } - - return G_VALUE_TYPE (dpwrap->value); -} - -/** - * gst_dpman_list_dparam_specs: - * @dpman: GstDParamManager instance - * - * Fetches the list of parameter specifications, that this manager maintains. - * - * Returns: the the parameter specifications as a NULL terminated array - */ -GParamSpec ** -gst_dpman_list_dparam_specs (GstDParamManager * dpman) -{ - GstDParamWrapper *dpwrap; - GList *dwraps; - GParamSpec **param_specs; - guint x = 0; - - g_return_val_if_fail (dpman != NULL, NULL); - g_return_val_if_fail (GST_IS_DPMAN (dpman), NULL); - - dwraps = GST_DPMAN_DPARAMS_LIST (dpman); - - param_specs = g_new0 (GParamSpec *, g_list_length (dwraps) + 1); - - while (dwraps) { - dpwrap = (GstDParamWrapper *) dwraps->data; - param_specs[x++] = dpwrap->param_spec; - dwraps = g_list_next (dwraps); - } - return param_specs; -} - -/** - * gst_dpman_get_param_spec: - * @dpman: GstDParamManager instance - * @dparam_name: the name of dparam - * - * Fetches a single parameter specification by its dparam name. - * - * Returns: the the parameter specifications for a given name - */ -GParamSpec * -gst_dpman_get_param_spec (GstDParamManager * dpman, const gchar * dparam_name) -{ - GstDParamWrapper *dpwrap; - - g_return_val_if_fail (dpman != NULL, NULL); - g_return_val_if_fail (GST_IS_DPMAN (dpman), NULL); - g_return_val_if_fail (dparam_name != NULL, NULL); - - dpwrap = gst_dpman_get_wrapper (dpman, dparam_name); - return dpwrap->param_spec; -} - -/** - * gst_dpman_set_rate: - * @dpman: GstDParamManager instance - * @rate: the new the frame/sample rate - * - * Sets the frame or sampling rate used by the machine. - * - */ -void -gst_dpman_set_rate (GstDParamManager * dpman, gint rate) -{ - g_return_if_fail (GST_IS_DPMAN (dpman)); - GST_DPMAN_RATE (dpman) = rate; -} - -/** - * gst_dpman_register_mode - * @klass: GstDParamManagerClass class instance - * @modename: the unique name of the new mode - * @preprocessfunc: the function which will be called before each buffer is processed - * @processfunc: the function which may be called throughout the processing of a buffer - * @setupfunc: the function which initialises the mode when activated - * @teardownfunc: the function which frees any resources the mode uses - * - * Registers a run-mode for the dparam manager. Each such mode has a defined - * run-time behaviour - that is, they differ in the way dynamic parameter - * changes are pushed into the underlying GstElements. - * - */ -void -gst_dpman_register_mode (GstDParamManagerClass * klass, - gchar * modename, - GstDPMModePreProcessFunction preprocessfunc, - GstDPMModeProcessFunction processfunc, - GstDPMModeSetupFunction setupfunc, GstDPMModeTeardownFunction teardownfunc) -{ - GstDPMMode *mode; - - g_return_if_fail (klass != NULL); - g_return_if_fail (modename != NULL); - g_return_if_fail (GST_IS_DPMAN_CLASS (klass)); - - mode = g_new0 (GstDPMMode, 1); - - mode->preprocessfunc = preprocessfunc; - mode->processfunc = processfunc; - mode->setupfunc = setupfunc; - mode->teardownfunc = teardownfunc; - - g_hash_table_insert (klass->modes, modename, mode); -} - -/** - * gst_dpman_set_mode - * @dpman: GstDParamManager instance - * @modename: the name of the mode to use - * - * Activate one of the registered modes. - * - * Returns: TRUE if the mode was set, FALSE otherwise - */ -gboolean -gst_dpman_set_mode (GstDParamManager * dpman, gchar * modename) -{ - GstDPMMode *mode = NULL; - GstDParamManagerClass *oclass; - - g_return_val_if_fail (dpman != NULL, FALSE); - g_return_val_if_fail (GST_IS_DPMAN (dpman), FALSE); - g_return_val_if_fail (modename != NULL, FALSE); - - oclass = (GstDParamManagerClass *) (G_OBJECT_GET_CLASS (dpman)); - - mode = g_hash_table_lookup (oclass->modes, modename); - g_return_val_if_fail (mode != NULL, FALSE); - - if (GST_DPMAN_MODE (dpman) == mode) { - GST_DEBUG ("mode %s already set", modename); - return TRUE; - } - - GST_DEBUG ("setting mode to %s", modename); - if (GST_DPMAN_MODE (dpman) && GST_DPMAN_TEARDOWNFUNC (dpman)) { - GST_DPMAN_TEARDOWNFUNC (dpman) (dpman); - } - - GST_DPMAN_MODE (dpman) = mode; - - if (GST_DPMAN_SETUPFUNC (dpman)) { - GST_DPMAN_SETUPFUNC (dpman) (dpman); - } - - return TRUE; -} - -/** - * gst_dpman_set_parent - * @dpman: GstDParamManager instance - * @parent: the element that this GstDParamManager belongs to - * - * Set a GstElement that parameters this manager should handle. - */ -void -gst_dpman_set_parent (GstDParamManager * dpman, GstElement * parent) -{ - g_return_if_fail (dpman != NULL); - g_return_if_fail (GST_IS_DPMAN (dpman)); - g_return_if_fail (parent != NULL); - g_return_if_fail (GST_IS_ELEMENT (parent)); - - g_hash_table_insert (_element_registry, parent, dpman); - gst_object_set_parent (GST_OBJECT (dpman), GST_OBJECT (parent)); - g_signal_connect (G_OBJECT (parent), "state_changed", - G_CALLBACK (gst_dpman_state_changed), dpman); -} - -/** - * gst_dpman_get_manager - * @parent: the element that the desired GstDParamManager belongs to - * - * Fetch the GstElement that parameters are handled by this manager. - * - * Returns: the GstDParamManager which belongs to this element or NULL - * if it doesn't exist. Do not call g_object_unref() on it. - */ -GstDParamManager * -gst_dpman_get_manager (GstElement * parent) -{ - GstDParamManager *dpman; - - g_return_val_if_fail (parent != NULL, NULL); - g_return_val_if_fail (GST_IS_ELEMENT (parent), NULL); - - dpman = (GstDParamManager *) g_hash_table_lookup (_element_registry, parent); - /* FIXME: shouldn't this be g_object_ref(dpman); */ - return dpman; -} - -/** - * gst_dpman_bypass_dparam: - * @dpman: GstDParamManager instance - * @dparam_name: the name of dparam - * - * If a dparam is attached to this dparam_name, it will be detached - * and a warning will be issued. This should be called in the _set_property - * function of an element if the value it changes is also changed by a dparam. - * - */ -void -gst_dpman_bypass_dparam (GstDParamManager * dpman, const gchar * dparam_name) -{ - GstDParamWrapper *dpwrap; - - g_return_if_fail (dpman != NULL); - g_return_if_fail (GST_IS_DPMAN (dpman)); - g_return_if_fail (dparam_name != NULL); - - dpwrap = gst_dpman_get_wrapper (dpman, dparam_name); - g_return_if_fail (dpwrap != NULL); - - if (dpwrap->dparam != NULL) { - GST_WARNING ("Bypassing attached dparam '%s'. It will be detached", - dparam_name); - gst_dpman_detach_dparam (dpman, dparam_name); - } -} - -// internal methods - -static GstDParamWrapper * -gst_dpman_get_wrapper (GstDParamManager * dpman, const gchar * dparam_name) -{ - g_return_val_if_fail (dpman != NULL, NULL); - g_return_val_if_fail (GST_IS_DPMAN (dpman), NULL); - g_return_val_if_fail (dparam_name != NULL, NULL); - - return g_hash_table_lookup (GST_DPMAN_DPARAMS (dpman), dparam_name); -} - -static GstDParamWrapper * -gst_dpman_new_wrapper (GstDParamManager * dpman, - GParamSpec * param_spec, - gchar * unit_name, GstDPMUpdateMethod update_method) -{ - GstDParamWrapper *dpwrap; - gchar *dparam_name; - - g_return_val_if_fail (dpman != NULL, NULL); - g_return_val_if_fail (GST_IS_DPMAN (dpman), NULL); - g_return_val_if_fail (param_spec != NULL, NULL); - g_return_val_if_fail (gst_unitconv_unit_exists (unit_name), NULL); - - dparam_name = g_strdup (g_param_spec_get_name (param_spec)); - g_return_val_if_fail (gst_dpman_get_wrapper (dpman, dparam_name) == NULL, - NULL); - - dpwrap = g_new0 (GstDParamWrapper, 1); - dpwrap->update_method = update_method; - dpwrap->value = g_new0 (GValue, 1); - g_value_init (dpwrap->value, G_PARAM_SPEC_VALUE_TYPE (param_spec)); - dpwrap->param_spec = param_spec; - dpwrap->unit_name = unit_name; - - g_hash_table_insert (GST_DPMAN_DPARAMS (dpman), dparam_name, dpwrap); - GST_DPMAN_DPARAMS_LIST (dpman) = - g_list_append (GST_DPMAN_DPARAMS_LIST (dpman), dpwrap); - - return dpwrap; -} - - -static void -gst_dpman_state_changed (GstElement * element, gint old_state, gint new_state, - GstDParamManager * dpman) -{ - GList *dwraps; - GstDParam *dparam; - GstDParamWrapper *dpwrap; - - g_return_if_fail (dpman != NULL); - g_return_if_fail (GST_IS_DPMAN (dpman)); - - if (new_state == GST_STATE_PLAYING) { - GST_DEBUG ("initialising params"); - - - /* force all params to be updated */ - dwraps = GST_DPMAN_DPARAMS_LIST (dpman); - while (dwraps) { - dpwrap = (GstDParamWrapper *) dwraps->data; - dparam = dpwrap->dparam; - - if (dparam) { - GST_DPARAM_READY_FOR_UPDATE (dparam) = TRUE; - GST_DPARAM_NEXT_UPDATE_TIMESTAMP (dparam) = 0LL; - } - /* some dparams treat the first update after the pipeline starts differently */ - dpwrap->update_info = GST_DPARAM_UPDATE_FIRST; - dwraps = g_list_next (dwraps); - } - } -} - -static inline void -gst_dpman_inline_direct_update (GValue * value, gpointer data) -{ - switch (G_VALUE_TYPE (value)) { - case G_TYPE_INT: - *(gint *) data = g_value_get_int (value); - break; - case G_TYPE_INT64: - *(gint64 *) data = g_value_get_int64 (value); - break; - case G_TYPE_FLOAT: - *(gfloat *) data = g_value_get_float (value); - break; - case G_TYPE_DOUBLE: - *(double *) data = g_value_get_double (value); - break; - default: - break; - } -} - -static gboolean -gst_dpman_preprocess_synchronous (GstDParamManager * dpman, guint frames, - gint64 timestamp) -{ - GList *dwraps; - GstDParamWrapper *dpwrap; - - g_return_val_if_fail (GST_IS_DPMAN (dpman), FALSE); - - /* this basically means don't call GST_DPMAN_PREPROCESS at all */ - dpman->next_update_frame = frames; - dpman->frames_to_process = frames; - - /* now check whether any dparams are ready for an update */ - dwraps = GST_DPMAN_DPARAMS_LIST (dpman); - while (dwraps) { - dpwrap = (GstDParamWrapper *) dwraps->data; - - if (dpwrap->dparam && - GST_DPARAM_READY_FOR_UPDATE (dpwrap->dparam) && - GST_DPARAM_NEXT_UPDATE_TIMESTAMP (dpwrap->dparam) <= timestamp) { - - switch (dpwrap->update_method) { - - /* direct method - set the value directly in the struct of the element */ - case GST_DPMAN_DIRECT: - GST_DPARAM_DO_UPDATE (dpwrap->dparam, timestamp, dpwrap->value, - dpwrap->update_info); - GST_DEBUG ("doing direct update"); - - gst_dpman_inline_direct_update (dpwrap->value, dpwrap->update_data); - break; - - /* callback method - call the element's callback so it can do what it likes */ - case GST_DPMAN_CALLBACK: - GST_DPARAM_DO_UPDATE (dpwrap->dparam, timestamp, dpwrap->value, - dpwrap->update_info); - GST_DEBUG ("doing callback update"); - - GST_DPMAN_CALLBACK_UPDATE (dpwrap, dpwrap->value); - break; - - case GST_DPMAN_ARRAY: - /* FIXME do array method checking here */ - break; - default: - break; - } - - if (dpwrap->update_info == GST_DPARAM_UPDATE_FIRST) { - /* it is not the first update anymore */ - dpwrap->update_info = GST_DPARAM_UPDATE_NORMAL; - } - } - dwraps = g_list_next (dwraps); - } - - - return FALSE; -} - -static gint -gst_dpman_dpwrap_compare (const GstDParamWrapper * a, - const GstDParamWrapper * b) -{ - if (a->next_update_frame > b->next_update_frame) - return 1; - return (a->next_update_frame < b->next_update_frame) ? -1 : 0; -} - -static gboolean -gst_dpman_preprocess_asynchronous (GstDParamManager * dpman, guint frames, - gint64 timestamp) -{ - GList *dwraps; - GstDParamWrapper *dpwrap; - gint64 current_time; - gboolean updates_pending; - - g_return_val_if_fail (GST_IS_DPMAN (dpman), FALSE); - - - if (GST_DPMAN_RATE (dpman) == 0) { - GST_WARNING ("The element hasn't given GstDParamManager a frame rate"); - return FALSE; - } - dpman->rate_ratio = (guint) (1000000000LL / (gint64) GST_DPMAN_RATE (dpman)); - - dpman->time_buffer_starts = timestamp; - dpman->time_buffer_ends = - timestamp + ((gint64) frames * (gint64) dpman->rate_ratio); - dpman->num_frames = frames; - - updates_pending = FALSE; - - /* now check whether any dparams are ready for an update */ - dwraps = GST_DPMAN_DPARAMS_LIST (dpman); - while (dwraps) { - dpwrap = (GstDParamWrapper *) dwraps->data; - - dpwrap->next_update_frame = frames; - - if (dpwrap->dparam && GST_DPARAM_READY_FOR_UPDATE (dpwrap->dparam)) { - - current_time = GST_DPARAM_NEXT_UPDATE_TIMESTAMP (dpwrap->dparam); - if (current_time > dpman->time_buffer_ends) { - /* not due for an update in this buffer */ - dwraps = g_list_next (dwraps); - continue; - } - if (current_time < timestamp) { - current_time = timestamp; - } - - if (current_time == timestamp) { - /* we are overdue for an update. lets do it now */ - - GST_DPARAM_DO_UPDATE (dpwrap->dparam, current_time, dpwrap->value, - dpwrap->update_info); - - if (dpwrap->update_info == GST_DPARAM_UPDATE_FIRST) { - /* it is not the first update anymore */ - dpwrap->update_info = GST_DPARAM_UPDATE_NORMAL; - } - - switch (dpwrap->update_method) { - - /* direct method - set the value directly in the struct of the element */ - case GST_DPMAN_DIRECT: - GST_DEBUG ("doing direct update"); - gst_dpman_inline_direct_update (dpwrap->value, dpwrap->update_data); - break; - - /* callback method - call the element's callback so it can do what it likes */ - case GST_DPMAN_CALLBACK: - GST_DEBUG ("doing callback update"); - GST_DPMAN_CALLBACK_UPDATE (dpwrap, dpwrap->value); - break; - default: - break; - } - - current_time = GST_DPARAM_NEXT_UPDATE_TIMESTAMP (dpwrap->dparam); - - if (!GST_DPARAM_READY_FOR_UPDATE (dpwrap->dparam) || - current_time > dpman->time_buffer_ends) { - /* not due for an update in this buffer */ - dwraps = g_list_next (dwraps); - continue; - } - } - - dpwrap->next_update_frame = - (guint) (current_time - timestamp) / dpman->rate_ratio; - updates_pending = TRUE; - - GST_DEBUG ("timestamp start: %" - G_GINT64_FORMAT " end: %" - G_GINT64_FORMAT " current: %" - G_GINT64_FORMAT, timestamp, dpman->time_buffer_ends, current_time); - - } - dwraps = g_list_next (dwraps); - } - if (updates_pending) { - GST_DPMAN_DPARAMS_LIST (dpman) = - g_list_sort (GST_DPMAN_DPARAMS_LIST (dpman), - (GCompareFunc) gst_dpman_dpwrap_compare); - dwraps = GST_DPMAN_DPARAMS_LIST (dpman); - dpwrap = (GstDParamWrapper *) dwraps->data; - - dpman->next_update_frame = dpwrap->next_update_frame; - dpman->frames_to_process = dpman->next_update_frame; - - GST_DEBUG ("next update frame %u, frames to process %u", - dpman->next_update_frame, dpman->frames_to_process); - return TRUE; - } - - dpman->next_update_frame = frames; - dpman->frames_to_process = frames; - return FALSE; -} - -static gboolean -gst_dpman_process_asynchronous (GstDParamManager * dpman, guint frame_count) -{ - GstDParamWrapper *dpwrap; - GList *dwraps; - gint64 current_time; - gboolean needs_resort = FALSE; - - dwraps = GST_DPMAN_DPARAMS_LIST (dpman); - dpwrap = (GstDParamWrapper *) dwraps->data; - - GST_DEBUG ("in gst_dpman_process_asynchronous"); - - if (frame_count >= dpman->num_frames) { - GST_WARNING ("there is no more buffer to process"); - dpman->next_update_frame = dpman->num_frames; - dpman->frames_to_process = 0; - return FALSE; - } - - if (frame_count != dpwrap->next_update_frame) { - GST_WARNING ("frame count %u does not match update frame %u", - frame_count, dpwrap->next_update_frame); - } - - while (dpwrap) { - - current_time = GST_DPARAM_NEXT_UPDATE_TIMESTAMP (dpwrap->dparam); - GST_DPARAM_DO_UPDATE (dpwrap->dparam, current_time, dpwrap->value, - dpwrap->update_info); - switch (dpwrap->update_method) { - - /* direct method - set the value directly in the struct of the element */ - case GST_DPMAN_DIRECT: - GST_DEBUG ("doing direct update"); - gst_dpman_inline_direct_update (dpwrap->value, dpwrap->update_data); - break; - - /* callback method - call the element's callback so it can do what it likes */ - case GST_DPMAN_CALLBACK: - GST_DEBUG ("doing callback update"); - GST_DPMAN_CALLBACK_UPDATE (dpwrap, dpwrap->value); - break; - default: - break; - } - - dpwrap->next_update_frame = dpman->num_frames; - needs_resort = TRUE; - - if (GST_DPARAM_READY_FOR_UPDATE (dpwrap->dparam)) { - current_time = GST_DPARAM_NEXT_UPDATE_TIMESTAMP (dpwrap->dparam); - if (current_time <= dpman->time_buffer_ends) { - dpwrap->next_update_frame = - (guint) (current_time - - dpman->time_buffer_starts) / dpman->rate_ratio; - } - } - - if ((dwraps = g_list_next (dwraps))) { - dpwrap = (GstDParamWrapper *) dwraps->data; - if (frame_count == dpwrap->next_update_frame) { - continue; - } - } - dpwrap = NULL; - } - - if (needs_resort && g_list_length (GST_DPMAN_DPARAMS_LIST (dpman)) > 1) { - GST_DPMAN_DPARAMS_LIST (dpman) = - g_list_sort (GST_DPMAN_DPARAMS_LIST (dpman), - (GCompareFunc) gst_dpman_dpwrap_compare); - } - - dwraps = GST_DPMAN_DPARAMS_LIST (dpman); - dpwrap = (GstDParamWrapper *) dwraps->data; - - if (dpwrap->next_update_frame == dpman->num_frames) { - dpman->next_update_frame = dpman->num_frames; - dpman->frames_to_process = dpman->num_frames - frame_count; - GST_DEBUG ("no more updates, frames to process %u", - dpman->frames_to_process); - } else { - dpman->next_update_frame = dpwrap->next_update_frame; - dpman->frames_to_process = dpman->next_update_frame - frame_count; - GST_DEBUG ("next update frame %u, frames to process %u", - dpman->next_update_frame, dpman->frames_to_process); - } - - return TRUE; -} - -static gboolean -gst_dpman_preprocess_noop (GstDParamManager * dpman, guint frames, - gint64 timestamp) -{ - dpman->next_update_frame = frames; - dpman->frames_to_process = frames; - return FALSE; -} - -static gboolean -gst_dpman_process_noop (GstDParamManager * dpman, guint frame_count) -{ - GST_WARNING - ("gst_dpman_process_noop should never be called - something might be wrong with your processing loop"); - return FALSE; -} - -static void -gst_dpman_setup_synchronous (GstDParamManager * dpman) -{ - g_return_if_fail (GST_IS_DPMAN (dpman)); - -} - -static void -gst_dpman_setup_asynchronous (GstDParamManager * dpman) -{ - g_return_if_fail (GST_IS_DPMAN (dpman)); - -} - -static void -gst_dpman_setup_disabled (GstDParamManager * dpman) -{ - g_return_if_fail (GST_IS_DPMAN (dpman)); - -} - -static void -gst_dpman_teardown_synchronous (GstDParamManager * dpman) -{ - g_return_if_fail (GST_IS_DPMAN (dpman)); - -} - -static void -gst_dpman_teardown_asynchronous (GstDParamManager * dpman) -{ - g_return_if_fail (GST_IS_DPMAN (dpman)); - -} - -static void -gst_dpman_teardown_disabled (GstDParamManager * dpman) -{ - g_return_if_fail (GST_IS_DPMAN (dpman)); - -} diff --git a/libs/gst/control/dparammanager.h b/libs/gst/control/dparammanager.h deleted file mode 100644 index b12d5f8330..0000000000 --- a/libs/gst/control/dparammanager.h +++ /dev/null @@ -1,186 +0,0 @@ -/* GStreamer - * Copyright (C) 2001 Steve Baker - * - * gstdparammanager.h: Dynamic Parameter group functionality - * - * 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_DPMAN_H__ -#define __GST_DPMAN_H__ - -#include -#include -#include -#include - -G_BEGIN_DECLS - -#define GST_TYPE_DPMAN (gst_dpman_get_type ()) -#define GST_DPMAN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_DPMAN,GstDParamManager)) -#define GST_DPMAN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_DPMAN,GstDParamManager)) -#define GST_IS_DPMAN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_DPMAN)) -#define GST_IS_DPMAN_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_DPMAN)) - -#define GST_DPMAN_NAME(dpman) (GST_OBJECT_NAME(dpman)) -#define GST_DPMAN_PARENT(dpman) (GST_OBJECT_PARENT(dpman)) -#define GST_DPMAN_DPARAMS(dpman) ((dpman)->dparams) -#define GST_DPMAN_DPARAMS_LIST(dpman) ((dpman)->dparams_list) - -#define GST_DPMAN_MODE_NAME(dpman) ((dpman)->mode_name) -#define GST_DPMAN_MODE(dpman) ((dpman)->mode) -#define GST_DPMAN_RATE(dpman) ((dpman)->rate) -#define GST_DPMAN_FRAMES_TO_PROCESS(dpman) ((dpman)->frames_to_process) -#define GST_DPMAN_NEXT_UPDATE_FRAME(dpman) ((dpman)->next_update_frame) - -typedef enum { - GST_DPMAN_CALLBACK, - GST_DPMAN_DIRECT, - GST_DPMAN_ARRAY -} GstDPMUpdateMethod; - -typedef struct _GstDParamManagerClass GstDParamManagerClass; -typedef struct _GstDPMMode GstDPMMode; -typedef struct _GstDParamWrapper GstDParamWrapper; -typedef struct _GstDParamAsyncToUpdate GstDParamAsyncToUpdate; - -typedef gboolean (*GstDPMModePreProcessFunction) (GstDParamManager *dpman, guint frames, gint64 timestamp); -typedef gboolean (*GstDPMModeProcessFunction) (GstDParamManager *dpman, guint frame_count); -typedef void (*GstDPMModeSetupFunction) (GstDParamManager *dpman); -typedef void (*GstDPMModeTeardownFunction) (GstDParamManager *dpman); - -typedef void (*GstDPMUpdateFunction) (const GValue *value, gpointer data); - -struct _GstDParamManager { - GstObject object; - - GHashTable *dparams; - GList *dparams_list; - - /* mode state */ - GstDPMMode* mode; - gchar *mode_name; - - guint frames_to_process; /* number of frames in the current buffer */ - guint next_update_frame; /* frame when the next update is required */ - - /* the following data is only used for async mode */ - guint rate; /* the frame/sample rate - */ - guint rate_ratio; /* used to convert between samples and time */ - guint num_frames; /* number of frames in the current buffer */ - - gint64 time_buffer_ends; - gint64 time_buffer_starts; -}; - -struct _GstDParamManagerClass { - GstObjectClass parent_class; - GHashTable *modes; - /* signal callbacks */ - void (*new_required_dparam) (GstDParamManager *dpman, const gchar* dparam_name); -}; - -struct _GstDPMMode { - GstDPMModePreProcessFunction preprocessfunc; - GstDPMModeProcessFunction processfunc; - GstDPMModeSetupFunction setupfunc; - GstDPMModeTeardownFunction teardownfunc; -}; - -struct _GstDParamWrapper { - GParamSpec* param_spec; - GValue *value; - GstDParam *dparam; - - guint next_update_frame; - - GstDPMUpdateMethod update_method; - gpointer update_data; - GstDPMUpdateFunction update_func; - - gchar *unit_name; - GstDParamUpdateInfo update_info; -}; - -struct _GstDParamAsyncToUpdate { - guint frame; - GValue *value; - GstDParamWrapper *dpwrap; -}; - -#define GST_DPMAN_PREPROCESSFUNC(dpman) (((dpman)->mode)->preprocessfunc) -#define GST_DPMAN_PROCESSFUNC(dpman) (((dpman)->mode)->processfunc) -#define GST_DPMAN_SETUPFUNC(dpman) (((dpman)->mode)->setupfunc) -#define GST_DPMAN_TEARDOWNFUNC(dpman) (((dpman)->mode)->teardownfunc) - -#define GST_DPMAN_PREPROCESS(dpman, buffer_size, timestamp) \ - (GST_DPMAN_PREPROCESSFUNC(dpman)(dpman, buffer_size, timestamp)) - -#define GST_DPMAN_PROCESS(dpman, frame_count) \ - (frame_count < dpman->next_update_frame || \ - (dpman->next_update_frame < dpman->num_frames \ - && (GST_DPMAN_PROCESSFUNC(dpman)(dpman, frame_count)))) - -/* FIXME: this should pass dpwrap->dparam as the first arg - * the first arg in callback is usually object that triggered the callback - */ -#define GST_DPMAN_CALLBACK_UPDATE(dpwrap, value) ((dpwrap->update_func)(value, dpwrap->update_data)) - -void _gst_dpman_initialize(void); -GType gst_dpman_get_type (void); -GstDParamManager* gst_dpman_new (gchar *name, GstElement *parent); -void gst_dpman_set_parent (GstDParamManager *dpman, GstElement *parent); -GstDParamManager* gst_dpman_get_manager (GstElement *parent); - -gboolean gst_dpman_add_required_dparam_callback (GstDParamManager *dpman, - GParamSpec *param_spec, - gchar *unit_name, - GstDPMUpdateFunction update_func, - gpointer update_data); -gboolean gst_dpman_add_required_dparam_direct (GstDParamManager *dpman, - GParamSpec *param_spec, - gchar *unit_name, - gpointer update_data); - -gboolean gst_dpman_add_required_dparam_array (GstDParamManager *dpman, - GParamSpec *param_spec, - gchar *unit_name, - gpointer update_data); - -void gst_dpman_remove_required_dparam (GstDParamManager *dpman, const gchar *dparam_name); -gboolean gst_dpman_attach_dparam (GstDParamManager *dpman, const gchar *dparam_name, GstDParam *dparam); -void gst_dpman_detach_dparam (GstDParamManager *dpman, const gchar *dparam_name); -GstDParam* gst_dpman_get_dparam(GstDParamManager *dpman, const gchar *dparam_name); -GType gst_dpman_get_dparam_type (GstDParamManager *dpman, const gchar *dparam_name); - -GParamSpec** gst_dpman_list_dparam_specs(GstDParamManager *dpman); -GParamSpec* gst_dpman_get_param_spec (GstDParamManager *dpman, const gchar *dparam_name); -void gst_dpman_dparam_spec_has_changed (GstDParamManager *dpman, const gchar *dparam_name); - -void gst_dpman_set_rate(GstDParamManager *dpman, gint rate); -void gst_dpman_bypass_dparam(GstDParamManager *dpman, const gchar *dparam_name); - -gboolean gst_dpman_set_mode(GstDParamManager *dpman, gchar *modename); -void gst_dpman_register_mode (GstDParamManagerClass *klass, - gchar *modename, - GstDPMModePreProcessFunction preprocessfunc, - GstDPMModeProcessFunction processfunc, - GstDPMModeSetupFunction setupfunc, - GstDPMModeTeardownFunction teardownfunc); - -G_END_DECLS - -#endif /* __GST_DPMAN_H__ */ diff --git a/libs/gst/control/dplinearinterp.c b/libs/gst/control/dplinearinterp.c deleted file mode 100644 index 9b8614e766..0000000000 --- a/libs/gst/control/dplinearinterp.c +++ /dev/null @@ -1,87 +0,0 @@ -/* GStreamer - * Copyright (C) 2001 Steve Baker - * - * gstdplinearinterp.c: linear interpolation dynamic parameter - * - * 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 "dplinearinterp.h" - -static void gst_dp_linint_class_init (GstDParamClass * klass); -static void gst_dp_linint_base_class_init (GstDParamClass * klass); -static void gst_dp_linint_init (GstDParam * dp_linint); - -GType -gst_dp_linint_get_type (void) -{ - static GType dp_linint_type = 0; - - if (!dp_linint_type) { - static const GTypeInfo dp_linint_info = { - sizeof (GstDParamClass), - (GBaseInitFunc) gst_dp_linint_base_class_init, - NULL, - (GClassInitFunc) gst_dp_linint_class_init, - NULL, - NULL, - sizeof (GstDParam), - 0, - (GInstanceInitFunc) gst_dp_linint_init, - }; - - dp_linint_type = - g_type_register_static (GST_TYPE_DPARAM, "GstDParamLinInterp", - &dp_linint_info, 0); - } - return dp_linint_type; -} - -static void -gst_dp_linint_base_class_init (GstDParamClass * klass) -{ - -} - -static void -gst_dp_linint_class_init (GstDParamClass * klass) -{ - -} - -static void -gst_dp_linint_init (GstDParam * dp_linint) -{ - g_return_if_fail (dp_linint != NULL); -} - -/** - * gst_dp_linint_new: - * @type: the type that this dp_linint will store - * - * Returns: a new instance of GstDParam - */ -GstDParam * -gst_dp_linint_new (GType type) -{ - GstDParam *dparam; - GstDParamLinInterp *dp_linint; - - dp_linint = g_object_new (gst_dp_linint_get_type (), NULL); - dparam = GST_DPARAM (dp_linint); - - return dparam; -} diff --git a/libs/gst/control/dplinearinterp.h b/libs/gst/control/dplinearinterp.h deleted file mode 100644 index 3228912406..0000000000 --- a/libs/gst/control/dplinearinterp.h +++ /dev/null @@ -1,56 +0,0 @@ -/* GStreamer - * Copyright (C) 2001 Steve Baker - * - * gstdplinearinterp.h: linear interpolation dynamic parameter - * - * 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_DP_LININT_H__ -#define __GST_DP_LININT_H__ - -#include -#include "dparam.h" - -G_BEGIN_DECLS - -#define GST_TYPE_DP_LININT (gst_dp_linint_get_type ()) -#define GST_DP_LININT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_DP_LININT,GstDParamLinInterp)) -#define GST_DP_LININT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_DP_LININT,GstDParamLinInterp)) -#define GST_IS_DP_LININT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_DP_LININT)) -#define GST_IS_DP_LININT_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_DP_LININT)) - -typedef struct _GstDParamLinInterp GstDParamLinInterp; -typedef struct _GstDParamLinInterpClass GstDParamLinInterpClass; - -struct _GstDParamLinInterp { - GstDParam dparam; - -}; - -struct _GstDParamLinInterpClass { - GstDParamClass parent_class; - - /* signal callbacks */ -}; - -GType gst_dp_linint_get_type (void); -GstDParam* gst_dp_linint_new (GType type); - -G_END_DECLS - -#endif /* __GST_DP_LININT_H__ */ diff --git a/libs/gst/control/unitconvert.c b/libs/gst/control/unitconvert.c deleted file mode 100644 index ae66a50468..0000000000 --- a/libs/gst/control/unitconvert.c +++ /dev/null @@ -1,456 +0,0 @@ -/* GStreamer - * Copyright (C) 2001 Steve Baker - * - * unitconvert.c: Conversion between units of measurement - * - * 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 "unitconvert.h" -#include - -static GHashTable *_gst_units; -static GHashTable *_gst_unit_domain_defaults; -static gboolean _gst_unitconv_init_done = FALSE; - -typedef struct _GstUnit GstUnit; - -struct _GstUnit -{ - GParamSpec *unit_spec; - const gchar *domain_name; - gboolean domain_default; - gboolean logarithmic; - GHashTable *convert_to_funcs; - GSList *convert_paramspecs; -}; - -static void gst_unitconv_add_core_converters (void); - -static void gst_unitconv_class_init (GstUnitConvertClass * klass); -static void gst_unitconv_init (GstUnitConvert * unitconv); -static void gst_unitconv_dispose (GObject * object); - -GType -gst_unitconv_get_type (void) -{ - static GType unitconv_type = 0; - - if (!unitconv_type) { - static const GTypeInfo unitconv_info = { - sizeof (GstUnitConvertClass), - NULL, - NULL, - (GClassInitFunc) gst_unitconv_class_init, - NULL, - NULL, - sizeof (GstUnitConvert), - 0, - (GInstanceInitFunc) gst_unitconv_init, - }; - - unitconv_type = - g_type_register_static (GST_TYPE_OBJECT, "GstUnitConvert", - &unitconv_info, 0); - } - return unitconv_type; -} - -static void -gst_unitconv_class_init (GstUnitConvertClass * klass) -{ - GObjectClass *gobject_class; - GstUnitConvertClass *unitconv_class; - GstObjectClass *gstobject_class; - - gobject_class = (GObjectClass *) klass; - unitconv_class = (GstUnitConvertClass *) klass; - gstobject_class = (GstObjectClass *) klass; - - gobject_class->dispose = gst_unitconv_dispose; - -} - -static void -gst_unitconv_init (GstUnitConvert * unitconv) -{ - g_return_if_fail (unitconv != NULL); - - unitconv->convert_func_chain = NULL; - unitconv->convert_params = g_hash_table_new (g_str_hash, g_str_equal); -} - -GstUnitConvert * -gst_unitconv_new () -{ - GstUnitConvert *unitconv; - - unitconv = g_object_new (gst_unitconv_get_type (), NULL); - - return unitconv; -} - -static void -gst_unitconv_init_for_change_state (GstUnitConvert * unitconv) -{ - unitconv->convert_func_chain = NULL; -} - -gboolean -gst_unitconv_set_convert_units (GstUnitConvert * unitconv, - gchar * from_unit_named, gchar * to_unit_named) -{ - GHashTable *convert_funcs; - GstUnit *from_unit, *to_unit; - GstUnitConvertFunc convert_func; - - g_return_val_if_fail (unitconv != NULL, FALSE); - g_return_val_if_fail (from_unit_named != NULL, FALSE); - g_return_val_if_fail (to_unit_named != NULL, FALSE); - g_return_val_if_fail (GST_IS_UNIT_CONVERT (unitconv), FALSE); - - from_unit = g_hash_table_lookup (_gst_units, from_unit_named); - to_unit = g_hash_table_lookup (_gst_units, to_unit_named); - - g_return_val_if_fail (from_unit != NULL, FALSE); - g_return_val_if_fail (to_unit != NULL, FALSE); - - convert_funcs = from_unit->convert_to_funcs; - - convert_func = g_hash_table_lookup (convert_funcs, to_unit); - if (convert_func == NULL) { - g_warning ("cannot convert from %s to %s", from_unit_named, to_unit_named); - } - - gst_unitconv_init_for_change_state (unitconv); - - unitconv->convert_func_chain = - g_slist_append (unitconv->convert_func_chain, convert_func); - - - return TRUE; -} - -gboolean -gst_unitconv_convert_value (GstUnitConvert * unitconv, GValue * from_value, - GValue * to_value) -{ - GstUnitConvertFunc convert_func; - GSList *convert_func_chain; - - g_return_val_if_fail (unitconv->convert_func_chain != NULL, FALSE); - - /* only do this until we can chain convert funcs */ - g_return_val_if_fail (g_slist_length (unitconv->convert_func_chain) == 1, - FALSE); - - convert_func_chain = unitconv->convert_func_chain; - - convert_func = (GstUnitConvertFunc) (convert_func_chain); - convert_func (unitconv, from_value, to_value); - - return TRUE; -} - -gboolean -gst_unitconv_unit_exists (gchar * unit_name) -{ - g_return_val_if_fail (unit_name != NULL, FALSE); - return (g_hash_table_lookup (_gst_units, unit_name) != NULL); -} - -gboolean -gst_unitconv_unit_is_logarithmic (gchar * unit_name) -{ - GstUnit *unit; - - g_return_val_if_fail (unit_name != NULL, FALSE); - - unit = g_hash_table_lookup (_gst_units, unit_name); - g_return_val_if_fail (unit != NULL, FALSE); - - return unit->logarithmic; -} - -GParamSpec * -gst_unitconv_unit_spec (gchar * unit_name) -{ - GstUnit *unit; - - g_return_val_if_fail (unit_name != NULL, FALSE); - - unit = g_hash_table_lookup (_gst_units, unit_name); - g_return_val_if_fail (unit != NULL, FALSE); - - return unit->unit_spec; -} - -static void -gst_unitconv_dispose (GObject * object) -{ - -} - - -void -_gst_unitconv_initialize (void) -{ - if (_gst_unitconv_init_done) - return; - - _gst_unitconv_init_done = TRUE; - - _gst_units = g_hash_table_new (g_str_hash, g_str_equal); - _gst_unit_domain_defaults = g_hash_table_new (g_str_hash, g_str_equal); - - /* frequency based units */ - - gst_unitconv_register_unit ("frequency", TRUE, TRUE, - g_param_spec_float ("hertz", "Hz", "Frequency in hertz", - 0, G_MAXFLOAT, 0, 0)); - - gst_unitconv_register_unit ("frequency", FALSE, TRUE, - g_param_spec_float ("hertz-rate-bound", "Hz", - "Frequency in hertz, bound by the sample rate", 0.0, G_MAXFLOAT, 0.0, - 0)); - - gst_unitconv_register_unit ("frequency", FALSE, FALSE, - g_param_spec_string ("twelve-tone-scale", "note", - "Name of the note from the western twelve tone scale", "C", 0)); - - gst_unitconv_register_unit ("frequency", FALSE, FALSE, - g_param_spec_int ("midi-note", "midi note", - "MIDI note value of the frequency", 1, 127, 1, 0)); - - /* time based units */ - gst_unitconv_register_unit ("time", TRUE, FALSE, - g_param_spec_float ("seconds", "s", "Time in seconds", - -G_MAXFLOAT, G_MAXFLOAT, 0, 0)); - - gst_unitconv_register_unit ("time", FALSE, FALSE, - g_param_spec_int64 ("nanoseconds", "ns", "Time in nanoseconds", - G_MININT64, G_MAXINT64, 0, 0)); - - gst_unitconv_register_unit ("time", FALSE, FALSE, - g_param_spec_int64 ("samples", "samples", "Time in number of samples", - G_MININT64, G_MAXINT64, 0, 0)); - - gst_unitconv_register_convert_property ("samples", - g_param_spec_int ("samplerate", "samplerate", "samplerate", - 0, G_MAXINT, 0, G_PARAM_READWRITE)); - - - /* magnitude based units */ - gst_unitconv_register_unit ("magnitude", TRUE, FALSE, - g_param_spec_float ("scalar", "scalar", "Magnitude as a scalar", - -G_MAXFLOAT, G_MAXFLOAT, 0, 0)); - - gst_unitconv_register_unit ("magnitude", FALSE, FALSE, - g_param_spec_int ("scalar-int", "scalar int", - "Magnitude as an integer scalar", G_MININT, G_MAXINT, 0, 0)); - - gst_unitconv_register_unit ("magnitude", FALSE, TRUE, - g_param_spec_float ("decibel", "dB", "Magnitude in decibels", - -G_MAXFLOAT, G_MAXFLOAT, 0, 0)); - - gst_unitconv_register_unit ("magnitude", FALSE, FALSE, - g_param_spec_float ("percent", "%", "Magnitude in percent", - -G_MAXFLOAT, G_MAXFLOAT, 0, 0)); - - /* generic units */ - gst_unitconv_register_unit ("float_default", TRUE, FALSE, - g_param_spec_float ("float", "float", "Float value", - -G_MAXFLOAT, G_MAXFLOAT, 0, 0)); - - gst_unitconv_register_unit ("int_default", TRUE, FALSE, - g_param_spec_int ("int", "int", "Integer value", - G_MININT, G_MAXINT, 0, 0)); - - gst_unitconv_register_unit ("int64_default", TRUE, FALSE, - g_param_spec_int64 ("int64", "int64", "64 bit integer value", - G_MININT, G_MAXINT, 0, 0)); - - - gst_unitconv_add_core_converters (); - -} - -gboolean -gst_unitconv_register_unit (const gchar * domain_name, - gboolean is_domain_default, gboolean is_logarithmic, GParamSpec * unit_spec) -{ - GstUnit *unit; - gchar *unit_name; - - g_return_val_if_fail (unit_spec != NULL, FALSE); - g_return_val_if_fail (G_IS_PARAM_SPEC (unit_spec), FALSE); - g_return_val_if_fail (domain_name != NULL, FALSE); - - unit_name = g_strdup (g_param_spec_get_name (unit_spec)); - - /* check if this unit name already exists */ - if (g_hash_table_lookup (_gst_units, unit_name) != NULL) { - g_free (unit_name); - return FALSE; - } - if (is_domain_default) { - /* check if an default unit already exists for this domain */ - g_return_val_if_fail (g_hash_table_lookup (_gst_unit_domain_defaults, - domain_name) == NULL, FALSE); - } - - GST_DEBUG ("creating unit: %s", unit_name); - - unit = g_new0 (GstUnit, 1); - - unit->unit_spec = unit_spec; - unit->domain_name = domain_name; - unit->domain_default = is_domain_default; - unit->logarithmic = is_logarithmic; - unit->convert_to_funcs = g_hash_table_new (NULL, NULL); - /* unit->convert_properties = g_hash_table_new(g_str_hash,g_str_equal); */ - - g_hash_table_insert (_gst_units, unit_name, unit); - - if (is_domain_default) { - g_hash_table_insert (_gst_unit_domain_defaults, g_strdup (domain_name), - unit); - } - - return TRUE; -} - -gboolean -gst_unitconv_register_convert_func (gchar * from_unit_named, - gchar * to_unit_named, GstUnitConvertFunc convert_func) -{ - GHashTable *convert_funcs; - GstUnit *from_unit, *to_unit; - - g_return_val_if_fail (from_unit_named != NULL, FALSE); - g_return_val_if_fail (to_unit_named != NULL, FALSE); - - from_unit = g_hash_table_lookup (_gst_units, from_unit_named); - to_unit = g_hash_table_lookup (_gst_units, to_unit_named); - - g_return_val_if_fail (from_unit != NULL, FALSE); - g_return_val_if_fail (to_unit != NULL, FALSE); - - convert_funcs = from_unit->convert_to_funcs; - - g_return_val_if_fail (g_hash_table_lookup (convert_funcs, to_unit) == NULL, - FALSE); - - GST_DEBUG ("adding unit converter from %s to %s", - g_param_spec_get_name (from_unit->unit_spec), - g_param_spec_get_name (to_unit->unit_spec)); - - g_hash_table_insert (convert_funcs, to_unit, convert_func); - - return TRUE; -} - -gboolean -gst_unitconv_register_convert_property (gchar * unit_name, - GParamSpec * convert_prop_spec) -{ - GstUnit *unit; - - g_return_val_if_fail (unit_name != NULL, FALSE); - g_return_val_if_fail (convert_prop_spec != NULL, FALSE); - unit = g_hash_table_lookup (_gst_units, unit_name); - - g_return_val_if_fail (unit != NULL, FALSE); - - unit->convert_paramspecs = - g_slist_append (unit->convert_paramspecs, convert_prop_spec); - - return TRUE; -} - -static void -gst_unitconv_time_seconds_to_nanoseconds (GstUnitConvert * unitconv, - GValue * seconds_val, GValue * nanos_val) -{ - - g_value_set_int64 (nanos_val, - (gint64) (g_value_get_float (seconds_val) * 1000000000.0)); -} - -static void -gst_unitconv_time_nanoseconds_to_seconds (GstUnitConvert * unitconv, - GValue * nanos_val, GValue * seconds_val) -{ - g_value_set_float (seconds_val, - ((gfloat) g_value_get_int64 (nanos_val)) / 1000000000.0); -} - -static void -gst_unitconv_time_seconds_to_samples (GstUnitConvert * unitconv, - GValue * seconds_val, GValue * samples_val) -{ - /* GValue *samplerate; - GValue *samplerate = g_hash_table_lookup(unitconv->currentToUnit->convert_properties, "samplerate"); - g_value_set_int64(samples_val, - (gint64)(g_value_get_float(seconds_val) * (gfloat)g_value_get_int(samplerate))); */ -} - -static void -gst_unitconv_time_samples_to_seconds (GstUnitConvert * unitconv, - GValue * samples_val, GValue * seconds_val) -{ - /* GValue *samplerate; - GValue *samplerate = g_hash_table_lookup(unitconv->currentFromUnit->convert_properties, "samplerate"); - g_value_set_float(seconds_val, - ((gfloat)g_value_get_int64(samples_val)) / (gfloat)g_value_get_int(samplerate)); */ -} - -static void -gst_unitconv_magnitude_scalar_to_percent (GstUnitConvert * unitconv, - GValue * scalar_val, GValue * percent_val) -{ - g_value_set_float (percent_val, g_value_get_float (scalar_val) * 100.0); -} - -static void -gst_unitconv_magnitude_percent_to_scalar (GstUnitConvert * unitconv, - GValue * percent_val, GValue * scalar_val) -{ - g_value_set_float (scalar_val, g_value_get_float (percent_val) / 100.0); -} - -static void -gst_unitconv_add_core_converters (void) -{ - - gst_unitconv_register_convert_func ("nanoseconds", "seconds", - gst_unitconv_time_nanoseconds_to_seconds); - gst_unitconv_register_convert_func ("seconds", "nanoseconds", - gst_unitconv_time_seconds_to_nanoseconds); - gst_unitconv_register_convert_func ("seconds", "samples", - gst_unitconv_time_seconds_to_samples); - gst_unitconv_register_convert_func ("samples", "seconds", - gst_unitconv_time_samples_to_seconds); - - gst_unitconv_register_convert_func ("scalar", "percent", - gst_unitconv_magnitude_scalar_to_percent); - gst_unitconv_register_convert_func ("percent", "scalar", - gst_unitconv_magnitude_percent_to_scalar); -} diff --git a/libs/gst/control/unitconvert.h b/libs/gst/control/unitconvert.h deleted file mode 100644 index 1f23ade3c2..0000000000 --- a/libs/gst/control/unitconvert.h +++ /dev/null @@ -1,79 +0,0 @@ -/* GStreamer - * Copyright (C) 2001 Steve Baker - * - * unitconvert.c: Conversion between units of measurement - * - * 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_UNITCONVERT_H__ -#define __GST_UNITCONVERT_H__ - -#include - -G_BEGIN_DECLS - -#define GST_TYPE_UNIT_CONVERT (gst_unitconv_get_type ()) -#define GST_UNIT_CONVERT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_UNIT_CONVERT,GstUnitConvert)) -#define GST_UNIT_CONVERT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_UNIT_CONVERT,GstUnitConvert)) -#define GST_IS_UNIT_CONVERT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_UNIT_CONVERT)) -#define GST_IS_UNIT_CONVERT_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_UNIT_CONVERT)) - -#define GST_UNIT_CONVERT_NAME(unitconv) (GST_OBJECT_NAME(unitconv)) -#define GST_UNIT_CONVERT_PARENT(unitconv) (GST_OBJECT_PARENT(unitconv)) - -typedef struct _GstUnitConvertClass GstUnitConvertClass; -typedef struct _GstUnitConvert GstUnitConvert; - -typedef void (*GstUnitConvertFunc) (GstUnitConvert *unitconv, GValue *from_val, GValue *to_val); - -struct _GstUnitConvert { - GstObject object; - - GHashTable *convert_params; - GSList *convert_func_chain; - GSList *temp_gvalues; -}; - -struct _GstUnitConvertClass { - GstObjectClass parent_class; - - /* signal callbacks */ -}; - -GType gst_unitconv_get_type (void); - -GstUnitConvert* gst_unitconv_new (void); -void _gst_unitconv_initialize (void); - -gboolean gst_unitconv_set_convert_units(GstUnitConvert *unitconv, gchar *from_unit_named, gchar *to_unit_named); -gboolean gst_unitconv_convert_value(GstUnitConvert *unitconv, GValue *from_value, GValue *to_value); - -GParamSpec* gst_unitconv_unit_spec(gchar *unit_name); -gboolean gst_unitconv_unit_exists(gchar *unit_name); -gboolean gst_unitconv_unit_is_logarithmic(gchar *unit_name); - -gboolean gst_unitconv_register_unit(const gchar *domain_name, - gboolean is_domain_default, - gboolean is_logarithmic, - GParamSpec *unit_spec); - -gboolean gst_unitconv_register_convert_func(gchar *from_unit_named, gchar *to_unit_named, GstUnitConvertFunc convert_func); -gboolean gst_unitconv_register_convert_property(gchar *unit_name, GParamSpec *convert_prop_spec); - -G_END_DECLS - -#endif /* __GST_UNITCONVERT_H__ */ diff --git a/tests/old/testsuite/Makefile.am b/tests/old/testsuite/Makefile.am index e50583c758..b6e96a2c34 100644 --- a/tests/old/testsuite/Makefile.am +++ b/tests/old/testsuite/Makefile.am @@ -16,7 +16,7 @@ endif SUBDIRS = \ bytestream caps cleanup \ $(GST_DEBUG_DIRS) \ - dlopen dynparams \ + dlopen \ elements indexers negotiation pad \ $(GST_PARSE_DIRS) \ plugin refcounting schedulers states threads trigger @@ -24,7 +24,7 @@ SUBDIRS = \ DIST_SUBDIRS = \ bytestream caps cleanup \ debug \ - dlopen dynparams \ + dlopen \ elements indexers negotiation pad \ parse \ plugin refcounting schedulers states threads trigger diff --git a/tests/old/testsuite/dynparams/.gitignore b/tests/old/testsuite/dynparams/.gitignore deleted file mode 100644 index f853c17ab1..0000000000 --- a/tests/old/testsuite/dynparams/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -*.bb -*.bbg -*.da - -dparamstest diff --git a/tests/old/testsuite/dynparams/Makefile.am b/tests/old/testsuite/dynparams/Makefile.am deleted file mode 100644 index 070a51455c..0000000000 --- a/tests/old/testsuite/dynparams/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -include ../Rules - -tests_pass = dparamstest -tests_fail = -tests_ignore = - -dparamstest_LDADD = $(top_builddir)/libs/gst/control/libgstcontrol-@GST_MAJORMINOR@.la diff --git a/tests/old/testsuite/dynparams/dparamstest.c b/tests/old/testsuite/dynparams/dparamstest.c deleted file mode 100644 index 7d07920077..0000000000 --- a/tests/old/testsuite/dynparams/dparamstest.c +++ /dev/null @@ -1,318 +0,0 @@ -/* GStreamer - * Copyright (C) 2001 Steve Baker - * - * dparamstest.c: - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include -#include -#include -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include - -#define GST_TYPE_DPTEST (gst_dptest_get_type()) -#define GST_DPTEST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DPTEST,GstDpTest)) -#define GST_DPTEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DPTEST,GstDpTestClass)) -#define GST_IS_DPTEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DPTEST)) -#define GST_IS_DPTEST_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DPTEST)) - -typedef struct _GstDpTest GstDpTest; -typedef struct _GstDpTestClass GstDpTestClass; - -struct _GstDpTest -{ - GstElement element; - - GstPad *sinkpad; - GstPad *srcpad; - GstDParamManager *dpman; - - gfloat float1; - gfloat float2; - gboolean bool1; - gdouble double1; -}; - -struct _GstDpTestClass -{ - GstElementClass parent_class; -}; - -GType gst_dptest_get_type (void); - -enum -{ - ARG_0, -}; - -GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - -GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - - -static void gst_dptest_base_init (gpointer g_class); -static void gst_dptest_class_init (GstDpTestClass * klass); -static void gst_dptest_init (GstDpTest * dptest); - -static void gst_dptest_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec); - -static GstElementStateReturn gst_dptest_change_state (GstElement * element); -static void gst_dptest_chain (GstPad * pad, GstData * buf); - -static GstElementClass *parent_class = NULL; - -GType -gst_dptest_get_type (void) -{ - static GType dptest_type = 0; - - if (!dptest_type) { - static const GTypeInfo dptest_info = { - sizeof (GstDpTestClass), - gst_dptest_base_init, - NULL, - (GClassInitFunc) gst_dptest_class_init, - NULL, - NULL, - sizeof (GstDpTest), - 0, - (GInstanceInitFunc) gst_dptest_init, - }; - - dptest_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstDpTest", &dptest_info, 0); - } - return dptest_type; -} - -static void -gst_dptest_base_init (gpointer g_class) -{ - static GstElementDetails dptest_details = GST_ELEMENT_DETAILS ("DParamTest", - "Filter", - "Test for the GstDParam code", - "Steve Baker "); - GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_set_details (element_class, &dptest_details); -} - -static void -gst_dptest_class_init (GstDpTestClass * klass) -{ - GObjectClass *gobject_class; - GstElementClass *gstelement_class; - - gobject_class = (GObjectClass *) klass; - gstelement_class = (GstElementClass *) klass; - - parent_class = g_type_class_ref (GST_TYPE_ELEMENT); - - gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_dptest_set_property); - - gstelement_class->change_state = gst_dptest_change_state; - -} - -static void -gst_dptest_init (GstDpTest * dptest) -{ - - dptest->sinkpad = - gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate), - "sink"); - gst_element_add_pad (GST_ELEMENT (dptest), dptest->sinkpad); - gst_pad_set_chain_function (dptest->sinkpad, gst_dptest_chain); - - dptest->srcpad = - gst_pad_new_from_template (gst_static_pad_template_get (&srctemplate), - "src"); - gst_element_add_pad (GST_ELEMENT (dptest), dptest->srcpad); - - dptest->dpman = gst_dpman_new ("dptest_dpman", GST_ELEMENT (dptest)); - - gst_dpman_add_required_dparam_direct (dptest->dpman, - g_param_spec_float ("float1", "float1", "float1", - 0.0, 1.0, 0.5, G_PARAM_READWRITE), "float", &(dptest->float1) - ); - - dptest->float1 = 0.0; -} - -static void -gst_dptest_set_property (GObject * object, guint prop_id, const GValue * value, - GParamSpec * pspec) -{ - GstDpTest *dptest; - - g_return_if_fail (GST_IS_DPTEST (object)); - - dptest = GST_DPTEST (object); - - switch (prop_id) { - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static GstElementStateReturn -gst_dptest_change_state (GstElement * element) -{ - GstDpTest *dptest; - - g_return_val_if_fail (GST_IS_DPTEST (element), GST_STATE_FAILURE); - - dptest = GST_DPTEST (element); - if (GST_ELEMENT_CLASS (parent_class)->change_state) - return GST_ELEMENT_CLASS (parent_class)->change_state (element); - - return GST_STATE_SUCCESS; -} - -static void -gst_dptest_chain (GstPad * pad, GstData * data) -{ - GstDpTest *dptest; - gint frame_count; - - dptest = GST_DPTEST (gst_pad_get_parent (pad)); - g_assert (dptest); - g_print ("dp chain\n"); - - /* we're using a made up buffer size of 64 and a timestamp of zero */ - g_print ("preprocess\n"); - frame_count = 0; - GST_DPMAN_PREPROCESS (dptest->dpman, 64, 0LL); - - while (GST_DPMAN_PROCESS (dptest->dpman, frame_count)) { - ++frame_count; - } - g_print ("dp chain done\n"); -} - -gboolean -gst_dptest_register_elements (GstPlugin * plugin) -{ - return gst_element_register (plugin, "dptest", GST_RANK_NONE, - GST_TYPE_DPTEST); -} - -static GstPluginDesc plugin_desc = { - GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "dptest_elements", - "test elements", - &gst_dptest_register_elements, - NULL, - VERSION, - GST_LICENSE, - GST_PACKAGE, - GST_ORIGIN -}; - -int -main (int argc, char *argv[]) -{ - - GstElement *src; - GstElement *sink; - GstElement *testelement; - GstElement *pipeline; - GstDParamManager *dpman; - GstDParam *dp_float1; - GValue *dp_float1_value; - - gst_init (&argc, &argv); - gst_control_init (&argc, &argv); - - _gst_plugin_register_static (&plugin_desc); - - pipeline = gst_element_factory_make ("pipeline", "pipeline"); - g_assert (pipeline); - - src = gst_element_factory_make ("fakesrc", "src"); - g_assert (src); - - sink = gst_element_factory_make ("fakesink", "sink"); - g_assert (sink); - - testelement = gst_element_factory_make ("dptest", "testelement"); - g_assert (testelement); - - gst_bin_add_many (GST_BIN (pipeline), src, testelement, sink, NULL); - gst_element_link_many (src, testelement, sink, NULL); - - g_object_set (G_OBJECT (src), "num_buffers", 1, NULL); - - g_print ("setting pipeline to play\n"); - gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING); - - /* test that dparam manager is accessable */ - g_print ("getting dparam manager\n"); - dpman = gst_dpman_get_manager (testelement); - gst_dpman_set_mode (dpman, "synchronous"); - - g_assert (dpman); - g_assert (GST_IS_DPMAN (dpman)); - - g_print ("creating dparam for float1\n"); - dp_float1 = gst_dparam_new (G_TYPE_FLOAT);; - g_assert (dp_float1); - g_assert (GST_IS_DPARAM (dp_float1)); - - g_print ("attach dparam to float1\n"); - g_assert (gst_dpman_attach_dparam (dpman, "float1", dp_float1)); - - dp_float1_value = g_new0 (GValue, 1); - g_value_init (dp_float1_value, G_TYPE_FLOAT); - - g_value_set_float (dp_float1_value, 0.1); - g_object_set_property (G_OBJECT (dp_float1), "value_float", dp_float1_value); - - g_print ("iterate once\n"); - gst_bin_iterate (GST_BIN (pipeline)); - - g_print ("check that value changed\n"); - g_assert (GST_DPTEST (testelement)->float1 == 0.1F); - g_assert (!GST_DPARAM_READY_FOR_UPDATE (dp_float1)); - - g_print ("nulling pipeline\n"); - gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL); - - g_print ("playing pipeline\n"); - gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING); - - g_print ("iterate twice\n"); - - g_object_set (G_OBJECT (src), "num_buffers", 2, NULL); - gst_bin_iterate (GST_BIN (pipeline)); - - return 0; -} diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am index e50583c758..b6e96a2c34 100644 --- a/testsuite/Makefile.am +++ b/testsuite/Makefile.am @@ -16,7 +16,7 @@ endif SUBDIRS = \ bytestream caps cleanup \ $(GST_DEBUG_DIRS) \ - dlopen dynparams \ + dlopen \ elements indexers negotiation pad \ $(GST_PARSE_DIRS) \ plugin refcounting schedulers states threads trigger @@ -24,7 +24,7 @@ SUBDIRS = \ DIST_SUBDIRS = \ bytestream caps cleanup \ debug \ - dlopen dynparams \ + dlopen \ elements indexers negotiation pad \ parse \ plugin refcounting schedulers states threads trigger diff --git a/testsuite/dynparams/.gitignore b/testsuite/dynparams/.gitignore deleted file mode 100644 index f853c17ab1..0000000000 --- a/testsuite/dynparams/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -*.bb -*.bbg -*.da - -dparamstest diff --git a/testsuite/dynparams/Makefile.am b/testsuite/dynparams/Makefile.am deleted file mode 100644 index 070a51455c..0000000000 --- a/testsuite/dynparams/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -include ../Rules - -tests_pass = dparamstest -tests_fail = -tests_ignore = - -dparamstest_LDADD = $(top_builddir)/libs/gst/control/libgstcontrol-@GST_MAJORMINOR@.la diff --git a/testsuite/dynparams/dparamstest.c b/testsuite/dynparams/dparamstest.c deleted file mode 100644 index 7d07920077..0000000000 --- a/testsuite/dynparams/dparamstest.c +++ /dev/null @@ -1,318 +0,0 @@ -/* GStreamer - * Copyright (C) 2001 Steve Baker - * - * dparamstest.c: - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include -#include -#include -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include - -#define GST_TYPE_DPTEST (gst_dptest_get_type()) -#define GST_DPTEST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DPTEST,GstDpTest)) -#define GST_DPTEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DPTEST,GstDpTestClass)) -#define GST_IS_DPTEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DPTEST)) -#define GST_IS_DPTEST_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DPTEST)) - -typedef struct _GstDpTest GstDpTest; -typedef struct _GstDpTestClass GstDpTestClass; - -struct _GstDpTest -{ - GstElement element; - - GstPad *sinkpad; - GstPad *srcpad; - GstDParamManager *dpman; - - gfloat float1; - gfloat float2; - gboolean bool1; - gdouble double1; -}; - -struct _GstDpTestClass -{ - GstElementClass parent_class; -}; - -GType gst_dptest_get_type (void); - -enum -{ - ARG_0, -}; - -GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - -GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - - -static void gst_dptest_base_init (gpointer g_class); -static void gst_dptest_class_init (GstDpTestClass * klass); -static void gst_dptest_init (GstDpTest * dptest); - -static void gst_dptest_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec); - -static GstElementStateReturn gst_dptest_change_state (GstElement * element); -static void gst_dptest_chain (GstPad * pad, GstData * buf); - -static GstElementClass *parent_class = NULL; - -GType -gst_dptest_get_type (void) -{ - static GType dptest_type = 0; - - if (!dptest_type) { - static const GTypeInfo dptest_info = { - sizeof (GstDpTestClass), - gst_dptest_base_init, - NULL, - (GClassInitFunc) gst_dptest_class_init, - NULL, - NULL, - sizeof (GstDpTest), - 0, - (GInstanceInitFunc) gst_dptest_init, - }; - - dptest_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstDpTest", &dptest_info, 0); - } - return dptest_type; -} - -static void -gst_dptest_base_init (gpointer g_class) -{ - static GstElementDetails dptest_details = GST_ELEMENT_DETAILS ("DParamTest", - "Filter", - "Test for the GstDParam code", - "Steve Baker "); - GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_set_details (element_class, &dptest_details); -} - -static void -gst_dptest_class_init (GstDpTestClass * klass) -{ - GObjectClass *gobject_class; - GstElementClass *gstelement_class; - - gobject_class = (GObjectClass *) klass; - gstelement_class = (GstElementClass *) klass; - - parent_class = g_type_class_ref (GST_TYPE_ELEMENT); - - gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_dptest_set_property); - - gstelement_class->change_state = gst_dptest_change_state; - -} - -static void -gst_dptest_init (GstDpTest * dptest) -{ - - dptest->sinkpad = - gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate), - "sink"); - gst_element_add_pad (GST_ELEMENT (dptest), dptest->sinkpad); - gst_pad_set_chain_function (dptest->sinkpad, gst_dptest_chain); - - dptest->srcpad = - gst_pad_new_from_template (gst_static_pad_template_get (&srctemplate), - "src"); - gst_element_add_pad (GST_ELEMENT (dptest), dptest->srcpad); - - dptest->dpman = gst_dpman_new ("dptest_dpman", GST_ELEMENT (dptest)); - - gst_dpman_add_required_dparam_direct (dptest->dpman, - g_param_spec_float ("float1", "float1", "float1", - 0.0, 1.0, 0.5, G_PARAM_READWRITE), "float", &(dptest->float1) - ); - - dptest->float1 = 0.0; -} - -static void -gst_dptest_set_property (GObject * object, guint prop_id, const GValue * value, - GParamSpec * pspec) -{ - GstDpTest *dptest; - - g_return_if_fail (GST_IS_DPTEST (object)); - - dptest = GST_DPTEST (object); - - switch (prop_id) { - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static GstElementStateReturn -gst_dptest_change_state (GstElement * element) -{ - GstDpTest *dptest; - - g_return_val_if_fail (GST_IS_DPTEST (element), GST_STATE_FAILURE); - - dptest = GST_DPTEST (element); - if (GST_ELEMENT_CLASS (parent_class)->change_state) - return GST_ELEMENT_CLASS (parent_class)->change_state (element); - - return GST_STATE_SUCCESS; -} - -static void -gst_dptest_chain (GstPad * pad, GstData * data) -{ - GstDpTest *dptest; - gint frame_count; - - dptest = GST_DPTEST (gst_pad_get_parent (pad)); - g_assert (dptest); - g_print ("dp chain\n"); - - /* we're using a made up buffer size of 64 and a timestamp of zero */ - g_print ("preprocess\n"); - frame_count = 0; - GST_DPMAN_PREPROCESS (dptest->dpman, 64, 0LL); - - while (GST_DPMAN_PROCESS (dptest->dpman, frame_count)) { - ++frame_count; - } - g_print ("dp chain done\n"); -} - -gboolean -gst_dptest_register_elements (GstPlugin * plugin) -{ - return gst_element_register (plugin, "dptest", GST_RANK_NONE, - GST_TYPE_DPTEST); -} - -static GstPluginDesc plugin_desc = { - GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "dptest_elements", - "test elements", - &gst_dptest_register_elements, - NULL, - VERSION, - GST_LICENSE, - GST_PACKAGE, - GST_ORIGIN -}; - -int -main (int argc, char *argv[]) -{ - - GstElement *src; - GstElement *sink; - GstElement *testelement; - GstElement *pipeline; - GstDParamManager *dpman; - GstDParam *dp_float1; - GValue *dp_float1_value; - - gst_init (&argc, &argv); - gst_control_init (&argc, &argv); - - _gst_plugin_register_static (&plugin_desc); - - pipeline = gst_element_factory_make ("pipeline", "pipeline"); - g_assert (pipeline); - - src = gst_element_factory_make ("fakesrc", "src"); - g_assert (src); - - sink = gst_element_factory_make ("fakesink", "sink"); - g_assert (sink); - - testelement = gst_element_factory_make ("dptest", "testelement"); - g_assert (testelement); - - gst_bin_add_many (GST_BIN (pipeline), src, testelement, sink, NULL); - gst_element_link_many (src, testelement, sink, NULL); - - g_object_set (G_OBJECT (src), "num_buffers", 1, NULL); - - g_print ("setting pipeline to play\n"); - gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING); - - /* test that dparam manager is accessable */ - g_print ("getting dparam manager\n"); - dpman = gst_dpman_get_manager (testelement); - gst_dpman_set_mode (dpman, "synchronous"); - - g_assert (dpman); - g_assert (GST_IS_DPMAN (dpman)); - - g_print ("creating dparam for float1\n"); - dp_float1 = gst_dparam_new (G_TYPE_FLOAT);; - g_assert (dp_float1); - g_assert (GST_IS_DPARAM (dp_float1)); - - g_print ("attach dparam to float1\n"); - g_assert (gst_dpman_attach_dparam (dpman, "float1", dp_float1)); - - dp_float1_value = g_new0 (GValue, 1); - g_value_init (dp_float1_value, G_TYPE_FLOAT); - - g_value_set_float (dp_float1_value, 0.1); - g_object_set_property (G_OBJECT (dp_float1), "value_float", dp_float1_value); - - g_print ("iterate once\n"); - gst_bin_iterate (GST_BIN (pipeline)); - - g_print ("check that value changed\n"); - g_assert (GST_DPTEST (testelement)->float1 == 0.1F); - g_assert (!GST_DPARAM_READY_FOR_UPDATE (dp_float1)); - - g_print ("nulling pipeline\n"); - gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL); - - g_print ("playing pipeline\n"); - gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING); - - g_print ("iterate twice\n"); - - g_object_set (G_OBJECT (src), "num_buffers", 2, NULL); - gst_bin_iterate (GST_BIN (pipeline)); - - return 0; -} diff --git a/tools/Makefile.am b/tools/Makefile.am index f4f09573cb..7fa04e85d2 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -92,10 +92,6 @@ gst_md5sum_SOURCES = gst-run.c gst_typefind_SOURCES = gst-run.c gst_xmlinspect_SOURCES = gst-run.c -gst_inspect_@GST_MAJORMINOR@_LDADD = ../libs/gst/control/libgstcontrol-@GST_MAJORMINOR@.la - -gst_xmlinspect_@GST_MAJORMINOR@_LDADD = ../libs/gst/control/libgstcontrol-@GST_MAJORMINOR@.la - # CFLAGS and libs for nonversioned frontend binaries AM_CFLAGS = $(GLIB_ONLY_CFLAGS) $(POPT_CFLAGS) LDADD = $(GLIB_ONLY_LIBS) $(POPT_LIBS) diff --git a/tools/gst-inspect.c b/tools/gst-inspect.c index 95a9db0b7f..5741e9297c 100644 --- a/tools/gst-inspect.c +++ b/tools/gst-inspect.c @@ -26,7 +26,6 @@ #endif #include -#include #include "gst/gst-i18n-app.h" @@ -659,61 +658,6 @@ print_pad_info (GstElement * element) } } -static void -print_dynamic_parameters_info (GstElement * element) -{ - GstDParamManager *dpman; - GParamSpec **specs = NULL; - gint x; - - if ((dpman = gst_dpman_get_manager (element))) { - specs = gst_dpman_list_dparam_specs (dpman); - } - - if (specs && specs[0] != NULL) { - n_print ("\n"); - n_print ("Dynamic Parameters:\n"); - - for (x = 0; specs[x] != NULL; x++) { - g_print (" %-20.20s: ", g_param_spec_get_name (specs[x])); - - switch (G_PARAM_SPEC_VALUE_TYPE (specs[x])) { - case G_TYPE_INT64: - g_print ("64 Bit Integer (Default %" G_GINT64_FORMAT ", Range %" - G_GINT64_FORMAT " -> %" G_GINT64_FORMAT ")", - ((GParamSpecInt64 *) specs[x])->default_value, - ((GParamSpecInt64 *) specs[x])->minimum, - ((GParamSpecInt64 *) specs[x])->maximum); - break; - case G_TYPE_INT: - g_print ("Integer (Default %d, Range %d -> %d)", - ((GParamSpecInt *) specs[x])->default_value, - ((GParamSpecInt *) specs[x])->minimum, - ((GParamSpecInt *) specs[x])->maximum); - break; - case G_TYPE_FLOAT: - g_print ("Float. Default: %-8.8s %15.7g\n", "", - ((GParamSpecFloat *) specs[x])->default_value); - g_print ("%-23.23s Range: %15.7g - %15.7g", "", - ((GParamSpecFloat *) specs[x])->minimum, - ((GParamSpecFloat *) specs[x])->maximum); - break; - case G_TYPE_DOUBLE: - g_print ("Double. Default: %-8.8s %15.7g\n", "", - ((GParamSpecDouble *) specs[x])->default_value); - g_print ("%-23.23s Range: %15.7g - %15.7g", "", - ((GParamSpecDouble *) specs[x])->minimum, - ((GParamSpecDouble *) specs[x])->maximum); - break; - default: - g_print ("unknown %ld", G_PARAM_SPEC_VALUE_TYPE (specs[x])); - } - g_print ("\n"); - } - g_free (specs); - } -} - #if 0 static gint compare_signal_names (GSignalQuery * a, GSignalQuery * b) @@ -1046,7 +990,6 @@ print_element_info (GstElementFactory * factory, gboolean print_names) print_index_info (element); print_pad_info (element); print_element_properties_info (element); - print_dynamic_parameters_info (element); print_signal_info (element); print_children_info (element); @@ -1073,7 +1016,6 @@ main (int argc, char *argv[]) #endif gst_init_with_popt_table (&argc, &argv, options); - gst_control_init (&argc, &argv); if (print_all && argc > 2) { g_print ("-a requires no extra arguments\n"); diff --git a/tools/gst-xmlinspect.c b/tools/gst-xmlinspect.c index dde66eb764..16b9c1dee5 100644 --- a/tools/gst-xmlinspect.c +++ b/tools/gst-xmlinspect.c @@ -3,7 +3,6 @@ #endif #include -#include #include #include #include @@ -356,58 +355,6 @@ print_element_properties (GstElement * element, gint pfx) PUT_END_TAG (pfx, "element-properties"); } -static void -print_element_dynparamaters (GstElement * element, gint pfx) -{ - GstDParamManager *dpman; - GParamSpec **specs; - gint x; - - PUT_START_TAG (pfx, "dyn-params"); - - if ((dpman = gst_dpman_get_manager (element))) { - specs = gst_dpman_list_dparam_specs (dpman); - for (x = 0; specs[x] != NULL; x++) { - PUT_START_TAG (pfx + 1, "dyn-param"); - - PUT_ESCAPED (pfx + 2, "name", g_param_spec_get_name (specs[x])); - PUT_ESCAPED (pfx + 2, "type", g_type_name (specs[x]->value_type)); - PUT_ESCAPED (pfx + 2, "nick", g_param_spec_get_nick (specs[x])); - PUT_ESCAPED (pfx + 2, "blurb", g_param_spec_get_blurb (specs[x])); - - switch (G_PARAM_SPEC_VALUE_TYPE (specs[x])) { - case G_TYPE_INT64: - PUT_STRING (pfx + 2, - "", ((GParamSpecInt64 *) specs[x])->minimum, - ((GParamSpecInt64 *) specs[x])->maximum); - PUT_STRING (pfx + 2, "%" G_GINT64_FORMAT "", - ((GParamSpecInt64 *) specs[x])->default_value); - break; - case G_TYPE_INT: - PUT_STRING (pfx + 2, "", - ((GParamSpecInt *) specs[x])->minimum, - ((GParamSpecInt *) specs[x])->maximum); - PUT_STRING (pfx + 2, "%d", - ((GParamSpecInt *) specs[x])->default_value); - break; - case G_TYPE_FLOAT: - PUT_STRING (pfx + 2, "", - ((GParamSpecFloat *) specs[x])->minimum, - ((GParamSpecFloat *) specs[x])->maximum); - PUT_STRING (pfx + 2, "%f", - ((GParamSpecFloat *) specs[x])->default_value); - break; - default: - break; - } - PUT_END_TAG (pfx + 1, "dyn-param"); - } - g_free (specs); - } - PUT_END_TAG (pfx, "dyn-params"); -} - static void print_element_signals (GstElement * element, gint pfx) { @@ -636,7 +583,6 @@ print_element_info (GstElementFactory * factory) PUT_END_TAG (1, "pads"); print_element_properties (element, 1); - print_element_dynparamaters (element, 1); print_element_signals (element, 1); /* for compound elements */ @@ -819,7 +765,6 @@ main (int argc, char *argv[]) setlocale (LC_ALL, ""); gst_init_with_popt_table (&argc, &argv, options); - gst_control_init (&argc, &argv); PUT_STRING (0, "");