mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
deactivate and remove dparams (libgstcontrol)
Original commit message from CVS: deactivate and remove dparams (libgstcontrol)
This commit is contained in:
parent
536aef2218
commit
20efddd11e
43 changed files with 229 additions and 4413 deletions
42
ChangeLog
42
ChangeLog
|
@ -1,3 +1,45 @@
|
|||
2005-08-01 Stefan Kost <ensonic@users.sf.net>
|
||||
|
||||
* 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 <tim at centricular dot net>
|
||||
|
||||
* gst/elements/gsttypefindelement.c:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -36,6 +36,7 @@ GstBaseSrc
|
|||
@segment_start:
|
||||
@segment_end:
|
||||
@segment_loop:
|
||||
@need_discont:
|
||||
@offset:
|
||||
@size:
|
||||
@num_buffers:
|
||||
|
|
|
@ -91,14 +91,6 @@ and gst_element_set_clock(). You can wait for the clock to reach a given
|
|||
@sinkpads:
|
||||
@pads_cookie:
|
||||
|
||||
<!-- ##### SIGNAL GstElement::new-pad ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@gstelement: the object which received the signal.
|
||||
@arg1:
|
||||
|
||||
<!-- ##### SIGNAL GstElement::no-more-pads ##### -->
|
||||
<para>
|
||||
|
||||
|
@ -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.
|
||||
|
||||
<!-- ##### SIGNAL GstElement::pad-added ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@gstelement: the object which received the signal.
|
||||
@arg1:
|
||||
|
||||
<!-- ##### SIGNAL GstElement::pad-removed ##### -->
|
||||
<para>
|
||||
|
||||
|
@ -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:
|
||||
|
||||
<!-- ##### SIGNAL GstElement::state-change ##### -->
|
||||
<!-- ##### SIGNAL GstElement::state-changed ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
@ -220,33 +220,6 @@ The Element is going from the READY state to the NULL state.
|
|||
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_ELEMENT_QUERY_TYPE_FUNCTION ##### -->
|
||||
<para>
|
||||
Helper macro to create query type functions
|
||||
</para>
|
||||
|
||||
@functionname: The function name
|
||||
@...: list of query types.
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_ELEMENT_FORMATS_FUNCTION ##### -->
|
||||
<para>
|
||||
Halper macro to create element format functions
|
||||
</para>
|
||||
|
||||
@functionname: The function name
|
||||
@...: formats
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_ELEMENT_EVENT_MASK_FUNCTION ##### -->
|
||||
<para>
|
||||
A helper macro to create a mask function
|
||||
</para>
|
||||
|
||||
@functionname: the name of the mask function
|
||||
@...: Masks
|
||||
|
||||
|
||||
<!-- ##### ENUM GstElementFlags ##### -->
|
||||
<para>
|
||||
This enum defines the standard flags that an element may have.
|
||||
|
@ -594,9 +567,17 @@ Sets the parent of an element.
|
|||
</para>
|
||||
|
||||
@element:
|
||||
@rate:
|
||||
@format:
|
||||
@flags:
|
||||
@cur_type:
|
||||
@cur:
|
||||
@stop_type:
|
||||
@stop:
|
||||
@Returns:
|
||||
<!-- # Unused Parameters # -->
|
||||
@seek_type:
|
||||
@offset:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_element_get_query_types ##### -->
|
||||
|
|
|
@ -39,6 +39,7 @@ gst_event_new_flush() creates a new flush event.
|
|||
@type:
|
||||
@timestamp:
|
||||
@src:
|
||||
@structure:
|
||||
|
||||
<!-- ##### ENUM GstEventType ##### -->
|
||||
<para>
|
||||
|
@ -46,22 +47,16 @@ The different major types of events.
|
|||
</para>
|
||||
|
||||
@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:
|
||||
|
||||
<!-- ##### MACRO GST_EVENT_ANY ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
@GST_EVENT_CUSTOM_START:
|
||||
|
||||
<!-- ##### MACRO GST_EVENT_TRACE_NAME ##### -->
|
||||
<para>
|
||||
|
@ -94,74 +89,6 @@ The source object that generated this event
|
|||
@event: The event to query
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_EVENT_IS_INTERRUPT ##### -->
|
||||
<para>
|
||||
Check if the event is an interrupt event
|
||||
</para>
|
||||
|
||||
@event: The event to check
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_SEEK_FORMAT_SHIFT ##### -->
|
||||
<para>
|
||||
Shift for the format in the GstSeekType
|
||||
</para>
|
||||
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_SEEK_METHOD_SHIFT ##### -->
|
||||
<para>
|
||||
Shift for the method in the GstSeekType
|
||||
</para>
|
||||
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_SEEK_FLAGS_SHIFT ##### -->
|
||||
<para>
|
||||
Shift for the flags in the GstSeekType
|
||||
</para>
|
||||
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_SEEK_FORMAT_MASK ##### -->
|
||||
<para>
|
||||
Mask for the format in the GstSeekType
|
||||
</para>
|
||||
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_SEEK_METHOD_MASK ##### -->
|
||||
<para>
|
||||
Mask for the method in the GstSeekType
|
||||
</para>
|
||||
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_SEEK_FLAGS_MASK ##### -->
|
||||
<para>
|
||||
Mask for the flags in the GstSeekType
|
||||
</para>
|
||||
|
||||
|
||||
|
||||
<!-- ##### ENUM GstEventFlag ##### -->
|
||||
<para>
|
||||
Event flags are used when querying for supported events
|
||||
</para>
|
||||
|
||||
@GST_EVENT_FLAG_NONE: no value
|
||||
@GST_RATE_FLAG_NEGATIVE: indicates negative rates are supported
|
||||
|
||||
<!-- ##### MACRO GST_EVENT_MASK_FUNCTION ##### -->
|
||||
<para>
|
||||
A convenience macro to create event mask functions
|
||||
</para>
|
||||
|
||||
@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
|
||||
|
||||
|
||||
<!-- ##### ENUM GstSeekType ##### -->
|
||||
<para>
|
||||
The different types of seek events. When constructing a seek event a format,
|
||||
|
@ -190,129 +117,10 @@ in a pipeline.
|
|||
</example>
|
||||
</para>
|
||||
|
||||
@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
|
||||
|
||||
<!-- ##### ENUM GstSeekAccuracy ##### -->
|
||||
<para>
|
||||
The accuracy about a seek operation gives more information of how the seek was
|
||||
performed, namly if the seek was accurate or fuzzy.
|
||||
</para>
|
||||
|
||||
@GST_SEEK_CERTAIN: The seek was exact
|
||||
@GST_SEEK_FUZZY: The seek was fuzzy, exact position can not be guaranteed
|
||||
|
||||
<!-- ##### MACRO GST_EVENT_SEEK_TYPE ##### -->
|
||||
<para>
|
||||
Get the seektype of the GST_EVENT_SEEK.
|
||||
</para>
|
||||
|
||||
@event: The event to query.
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_EVENT_SEEK_FORMAT ##### -->
|
||||
<para>
|
||||
The format of the seek value
|
||||
</para>
|
||||
|
||||
@event: The event operate on
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_EVENT_SEEK_METHOD ##### -->
|
||||
<para>
|
||||
The seek method to use as one of #GstSeekType
|
||||
</para>
|
||||
|
||||
@event: The event operate on
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_EVENT_SEEK_FLAGS ##### -->
|
||||
<para>
|
||||
The optional seek flags
|
||||
</para>
|
||||
|
||||
@event: The event operate on
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_EVENT_SEEK_OFFSET ##### -->
|
||||
<para>
|
||||
Get the offset of the seek event.
|
||||
</para>
|
||||
|
||||
@event: The event to query.
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_EVENT_SEEK_ENDOFFSET ##### -->
|
||||
<para>
|
||||
The event stop position for a segment seek
|
||||
</para>
|
||||
|
||||
@event: The event to query
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_EVENT_SEEK_ACCURACY ##### -->
|
||||
<para>
|
||||
Indicates how accurate the event was performed.
|
||||
</para>
|
||||
|
||||
@event: The event to query
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_EVENT_DISCONT_OFFSET ##### -->
|
||||
<para>
|
||||
The offset of the discont event. A discont event can hold up to 8 different
|
||||
format/value pairs.
|
||||
</para>
|
||||
|
||||
@event: The event to query
|
||||
@i: The offset/value pair.
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_EVENT_DISCONT_OFFSET_LEN ##### -->
|
||||
<para>
|
||||
Get the number of offset/value pairs this event has.
|
||||
</para>
|
||||
|
||||
@event: The event to query.
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_EVENT_SIZE_FORMAT ##### -->
|
||||
<para>
|
||||
The format of the size event.
|
||||
</para>
|
||||
|
||||
@event: The event to query
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_EVENT_SIZE_VALUE ##### -->
|
||||
<para>
|
||||
The value of the size event
|
||||
</para>
|
||||
|
||||
@event: The event to query
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_EVENT_RATE_VALUE ##### -->
|
||||
<para>
|
||||
Get access to the rate vale field
|
||||
</para>
|
||||
|
||||
@event: The event to query
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_event_new ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@type:
|
||||
@Returns:
|
||||
|
||||
@GST_SEEK_TYPE_NONE:
|
||||
@GST_SEEK_TYPE_CUR:
|
||||
@GST_SEEK_TYPE_SET:
|
||||
@GST_SEEK_TYPE_END:
|
||||
|
||||
<!-- ##### MACRO gst_event_ref ##### -->
|
||||
<para>
|
||||
|
@ -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
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_event_masks_contains ##### -->
|
||||
<!-- ##### FUNCTION gst_event_new_custom ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@masks:
|
||||
@mask:
|
||||
@type:
|
||||
@structure:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_event_get_structure ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@event:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_event_new_flush_start ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_event_new_flush_stop ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_event_new_eos ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_event_new_newsegment ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@rate:
|
||||
@format:
|
||||
@start_value:
|
||||
@stop_value:
|
||||
@base:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_event_parse_newsegment ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@event:
|
||||
@rate:
|
||||
@format:
|
||||
@start_value:
|
||||
@end_value:
|
||||
@base:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_event_new_tag ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@taglist:
|
||||
@Returns:
|
||||
<!-- # Unused Parameters # -->
|
||||
@list:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_event_parse_tag ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@event:
|
||||
@taglist:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_event_new_filler ##### -->
|
||||
<para>
|
||||
Create a new dummy event that should be ignored
|
||||
</para>
|
||||
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_event_new_qos ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@proportion:
|
||||
@diff:
|
||||
@timestamp:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_event_parse_qos ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@event:
|
||||
@proportion:
|
||||
@diff:
|
||||
@timestamp:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_event_new_seek ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@type:
|
||||
@offset:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_event_new_segment_seek ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@type:
|
||||
@start:
|
||||
@rate:
|
||||
@format:
|
||||
@flags:
|
||||
@cur_type:
|
||||
@cur:
|
||||
@stop_type:
|
||||
@stop:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_event_new_size ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@format:
|
||||
@value:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_event_new_discontinuous ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@rate:
|
||||
@format1:
|
||||
@Varargs:
|
||||
@Returns:
|
||||
<!-- # Unused Parameters # -->
|
||||
@new_media:
|
||||
@type:
|
||||
@offset:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_event_new_discontinuous_valist ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@rate:
|
||||
@format1:
|
||||
@var_args:
|
||||
@Returns:
|
||||
<!-- # Unused Parameters # -->
|
||||
@new_media:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_event_discont_get_value ##### -->
|
||||
<!-- ##### FUNCTION gst_event_parse_seek ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@event:
|
||||
@rate:
|
||||
@format:
|
||||
@start_value:
|
||||
@end_value:
|
||||
@Returns:
|
||||
<!-- # Unused Parameters # -->
|
||||
@value:
|
||||
@flags:
|
||||
@cur_type:
|
||||
@cur:
|
||||
@stop_type:
|
||||
@stop:
|
||||
|
||||
|
||||
<!-- ##### MACRO gst_event_new_filler ##### -->
|
||||
<!-- ##### FUNCTION gst_event_new_navigation ##### -->
|
||||
<para>
|
||||
Create a new dummy event that should be ignored
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_event_new_flush ##### -->
|
||||
<para>
|
||||
Create a new flush event.
|
||||
</para>
|
||||
|
||||
@done:
|
||||
@structure:
|
||||
@Returns:
|
||||
|
||||
|
||||
|
|
|
@ -30,6 +30,9 @@ GstFakeSrc
|
|||
|
||||
@gstfakesrc: the object which received the signal.
|
||||
@arg1:
|
||||
@:
|
||||
@:
|
||||
@:
|
||||
|
||||
<!-- ##### ARG GstFakeSrc:data ##### -->
|
||||
<para>
|
||||
|
|
|
@ -54,17 +54,6 @@ A format definition
|
|||
@nick: A short nick of the format
|
||||
@description: A longer description of the format
|
||||
|
||||
<!-- ##### MACRO GST_FORMATS_FUNCTION ##### -->
|
||||
<para>
|
||||
A convenience function to define a function that returns an array
|
||||
of formats.
|
||||
</para>
|
||||
|
||||
@type: The type of the first argument of the function
|
||||
@functionname: The name of the function
|
||||
@...: comma separated list of functions closed with 0
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_format_register ##### -->
|
||||
<para>
|
||||
|
||||
|
|
|
@ -23,11 +23,6 @@ Pseudo link pads
|
|||
</para>
|
||||
|
||||
|
||||
<!-- ##### ARG GstGhostPad:internal ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### FUNCTION gst_ghost_pad_new ##### -->
|
||||
<para>
|
||||
|
||||
|
|
|
@ -300,12 +300,13 @@ The direction of a pad.
|
|||
The result of a pad link.
|
||||
</para>
|
||||
|
||||
@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.
|
||||
|
||||
<!-- ##### ENUM GstPadPresence ##### -->
|
||||
<para>
|
||||
|
|
|
@ -48,16 +48,6 @@ A Query Type definition
|
|||
@nick: a short nick
|
||||
@description: a longer description of the query type
|
||||
|
||||
<!-- ##### MACRO GST_QUERY_TYPE_FUNCTION ##### -->
|
||||
<para>
|
||||
Convenience function to define a function that returns an array of query types.
|
||||
</para>
|
||||
|
||||
@type: Type of first argument for function
|
||||
@functionname: The name of the function
|
||||
@...: query types, 0 to end the list
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_query_type_register ##### -->
|
||||
<para>
|
||||
|
||||
|
|
|
@ -101,6 +101,16 @@ Generic structure containing fields of names and values
|
|||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_structure_has_name ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@structure:
|
||||
@name:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_structure_set_name ##### -->
|
||||
<para>
|
||||
|
||||
|
|
|
@ -606,16 +606,7 @@ List of tags and values used to describe media metadata
|
|||
|
||||
</para>
|
||||
|
||||
@list:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_event_tag_get_list ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tag_event:
|
||||
@taglist:
|
||||
@Returns:
|
||||
|
||||
|
||||
|
|
|
@ -106,14 +106,6 @@ Checks if the give GValue contains a LIST value.
|
|||
@x: the #GValue to check
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_VALUE_HOLDS_FIXED_LIST ##### -->
|
||||
<para>
|
||||
Checks if the give GValue contains a FIXED_LIST value.
|
||||
</para>
|
||||
|
||||
@x: the #GValue to check
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_VALUE_HOLDS_CAPS ##### -->
|
||||
<para>
|
||||
Checks if the give GValue contains a CAPS value.
|
||||
|
@ -235,15 +227,6 @@ GST_VALUE_GREATER_THAN or GST_VALUE_UNORDERED
|
|||
@serialize:
|
||||
@deserialize:
|
||||
|
||||
<!-- ##### FUNCTION gst_type_is_fixed ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@type:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_value_is_fixed ##### -->
|
||||
<para>
|
||||
|
||||
|
|
|
@ -6,14 +6,8 @@
|
|||
<!ENTITY GstBytestream SYSTEM "xml/gstbytestream.xml">
|
||||
<!ENTITY GstGetbits SYSTEM "xml/gstgetbits.xml">
|
||||
<!-- has not yet been written
|
||||
<!ENTITY GstGetbits SYSTEM "xml/gstputbits.xml">
|
||||
<!ENTITY GstPutbits SYSTEM "xml/gstputbits.xml">
|
||||
-->
|
||||
<!ENTITY GstControl SYSTEM "xml/gstcontrol.xml">
|
||||
<!ENTITY GstDParamManager SYSTEM "xml/gstdpman.xml">
|
||||
<!ENTITY GstDParam SYSTEM "xml/gstdparam.xml">
|
||||
<!ENTITY GstDParamSmooth SYSTEM "xml/gstdpsmooth.xml">
|
||||
<!ENTITY GstDParamLinInterp SYSTEM "xml/gstdplinint.xml">
|
||||
<!ENTITY GstUnitConvert SYSTEM "xml/gstunitconvert.xml">
|
||||
<!ENTITY GstDataProtocol SYSTEM "xml/gstdataprotocol.xml">
|
||||
|
||||
<!-- generated by gtkdoc-mkdb, stupid name -->
|
||||
|
@ -43,15 +37,6 @@
|
|||
-->
|
||||
<!--link linkend="GObject">GObject</link-->
|
||||
|
||||
<chapter id="gstreamer-control">
|
||||
<title>gstcontrol</title>
|
||||
&GstControl;
|
||||
&GstDParamManager;
|
||||
&GstDParam;
|
||||
&GstDParamSmooth;
|
||||
&GstDParamLinInterp;
|
||||
&GstUnitConvert;
|
||||
</chapter>
|
||||
</part>
|
||||
|
||||
<part id="gstreamer-libs-hierarchy">
|
||||
|
|
|
@ -111,91 +111,3 @@ gst_dp_validate_packet
|
|||
<SUBSECTION Standard>
|
||||
</SECTION>
|
||||
|
||||
# GstControl library
|
||||
|
||||
<SECTION>
|
||||
<FILE>gstcontrol</FILE>
|
||||
<TITLE>GstControl</TITLE>
|
||||
<INCLUDE>libs/control/control.h</INCLUDE>
|
||||
gst_control_init
|
||||
<SUBSECTION Standard>
|
||||
<SUBSECTION Private>
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gstdpman</FILE>
|
||||
<TITLE>GstDParamManager</TITLE>
|
||||
<INCLUDE>libs/control/control.h</INCLUDE>
|
||||
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
|
||||
<SUBSECTION Standard>
|
||||
<SUBSECTION Private>
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gstdparam</FILE>
|
||||
<TITLE>GstDParam</TITLE>
|
||||
<INCLUDE>libs/control/control.h</INCLUDE>
|
||||
GstDParam
|
||||
gst_dparam_new
|
||||
gst_dparam_attach
|
||||
gst_dparam_detach
|
||||
gst_dparam_do_update_default
|
||||
<SUBSECTION Standard>
|
||||
<SUBSECTION Private>
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gstdpsmooth</FILE>
|
||||
<TITLE>GstDParamSmooth</TITLE>
|
||||
<INCLUDE>libs/control/control.h</INCLUDE>
|
||||
GstDParamSmooth
|
||||
gst_dpsmooth_new
|
||||
<SUBSECTION Standard>
|
||||
<SUBSECTION Private>
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gstdplinint</FILE>
|
||||
<TITLE>GstDParamLinInterp</TITLE>
|
||||
<INCLUDE>libs/control/control.h</INCLUDE>
|
||||
GstDParamLinInterp
|
||||
gst_dp_linint_new
|
||||
<SUBSECTION Standard>
|
||||
<SUBSECTION Private>
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gstunitconvert</FILE>
|
||||
<TITLE>GstUnitConvert</TITLE>
|
||||
<INCLUDE>libs/control/control.h</INCLUDE>
|
||||
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
|
||||
<SUBSECTION Standard>
|
||||
<SUBSECTION Private>
|
||||
</SECTION>
|
||||
|
||||
|
|
|
@ -1,9 +1,3 @@
|
|||
#include <gst/gst.h>
|
||||
#include <gst/control/control.h>
|
||||
|
||||
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
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
SUBDIRS = control dataprotocol getbits
|
||||
SUBDIRS = dataprotocol getbits
|
||||
|
|
5
libs/gst/control/.gitignore
vendored
5
libs/gst/control/.gitignore
vendored
|
@ -1,5 +0,0 @@
|
|||
*.bb
|
||||
*.bbg
|
||||
*.da
|
||||
*.def
|
||||
*.gcno
|
|
@ -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
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 2001 Steve Baker <stevebaker_org@yahoo.co.uk>
|
||||
*
|
||||
* 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 <gst/gst.h>
|
||||
|
||||
#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 ();
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 2001 Steve Baker <stevebaker_org@yahoo.co.uk>
|
||||
*
|
||||
* 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 <gst/control/dparammanager.h>
|
||||
#include <gst/control/dparam.h>
|
||||
#include <gst/control/dparam_smooth.h>
|
||||
#include <gst/control/dplinearinterp.h>
|
||||
#include <gst/control/unitconvert.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void gst_control_init (int *argc, char **argv[]);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_CONTROL_H__ */
|
|
@ -1,386 +0,0 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 2001 Steve Baker <stevebaker_org@yahoo.co.uk>
|
||||
*
|
||||
* 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 <math.h>
|
||||
#include <string.h>
|
||||
#include <gst/gstinfo.h>
|
||||
|
||||
#include "dparam.h"
|
||||
#include "dparammanager.h"
|
||||
#include <gst/gstmarshal.h>
|
||||
|
||||
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;
|
||||
}
|
|
@ -1,108 +0,0 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 2001 Steve Baker <stevebaker_org@yahoo.co.uk>
|
||||
*
|
||||
* 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 <gst/gstobject.h>
|
||||
#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__ */
|
|
@ -1,467 +0,0 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 2001 Steve Baker <stevebaker_org@yahoo.co.uk>
|
||||
*
|
||||
* 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 <math.h>
|
||||
#include <string.h>
|
||||
#include <gst/gstinfo.h>
|
||||
|
||||
#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);
|
||||
}
|
|
@ -1,75 +0,0 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 2001 Steve Baker <stevebaker_org@yahoo.co.uk>
|
||||
*
|
||||
* 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__ */
|
|
@ -1,32 +0,0 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 2001 Steve Baker <stevebaker_org@yahoo.co.uk>
|
||||
*
|
||||
* 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__ */
|
File diff suppressed because it is too large
Load diff
|
@ -1,186 +0,0 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 2001 Steve Baker <stevebaker_org@yahoo.co.uk>
|
||||
*
|
||||
* 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 <gst/gstelement.h>
|
||||
#include <gst/control/dparamcommon.h>
|
||||
#include <gst/control/dparam.h>
|
||||
#include <gst/control/unitconvert.h>
|
||||
|
||||
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__ */
|
|
@ -1,87 +0,0 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 2001 Steve Baker <stevebaker_org@yahoo.co.uk>
|
||||
*
|
||||
* 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;
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 2001 Steve Baker <stevebaker_org@yahoo.co.uk>
|
||||
*
|
||||
* 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 <gst/gstobject.h>
|
||||
#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__ */
|
|
@ -1,456 +0,0 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 2001 Steve Baker <stevebaker_org@yahoo.co.uk>
|
||||
*
|
||||
* 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 <gst/gstinfo.h>
|
||||
|
||||
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);
|
||||
}
|
|
@ -1,79 +0,0 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 2001 Steve Baker <stevebaker_org@yahoo.co.uk>
|
||||
*
|
||||
* 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 <gst/gstobject.h>
|
||||
|
||||
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__ */
|
|
@ -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
|
||||
|
|
5
tests/old/testsuite/dynparams/.gitignore
vendored
5
tests/old/testsuite/dynparams/.gitignore
vendored
|
@ -1,5 +0,0 @@
|
|||
*.bb
|
||||
*.bbg
|
||||
*.da
|
||||
|
||||
dparamstest
|
|
@ -1,7 +0,0 @@
|
|||
include ../Rules
|
||||
|
||||
tests_pass = dparamstest
|
||||
tests_fail =
|
||||
tests_ignore =
|
||||
|
||||
dparamstest_LDADD = $(top_builddir)/libs/gst/control/libgstcontrol-@GST_MAJORMINOR@.la
|
|
@ -1,318 +0,0 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 2001 Steve Baker <stevebaker_org@yahoo.co.uk>
|
||||
*
|
||||
* dparamstest.c:
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/control/control.h>
|
||||
|
||||
#define GST_TYPE_DPTEST (gst_dptest_get_type())
|
||||
#define GST_DPTEST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DPTEST,GstDpTest))
|
||||
#define GST_DPTEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DPTEST,GstDpTestClass))
|
||||
#define GST_IS_DPTEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DPTEST))
|
||||
#define GST_IS_DPTEST_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DPTEST))
|
||||
|
||||
typedef struct _GstDpTest GstDpTest;
|
||||
typedef struct _GstDpTestClass GstDpTestClass;
|
||||
|
||||
struct _GstDpTest
|
||||
{
|
||||
GstElement element;
|
||||
|
||||
GstPad *sinkpad;
|
||||
GstPad *srcpad;
|
||||
GstDParamManager *dpman;
|
||||
|
||||
gfloat float1;
|
||||
gfloat float2;
|
||||
gboolean bool1;
|
||||
gdouble double1;
|
||||
};
|
||||
|
||||
struct _GstDpTestClass
|
||||
{
|
||||
GstElementClass parent_class;
|
||||
};
|
||||
|
||||
GType gst_dptest_get_type (void);
|
||||
|
||||
enum
|
||||
{
|
||||
ARG_0,
|
||||
};
|
||||
|
||||
GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS_ANY);
|
||||
|
||||
GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS_ANY);
|
||||
|
||||
|
||||
static void gst_dptest_base_init (gpointer g_class);
|
||||
static void gst_dptest_class_init (GstDpTestClass * klass);
|
||||
static void gst_dptest_init (GstDpTest * dptest);
|
||||
|
||||
static void gst_dptest_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * pspec);
|
||||
|
||||
static GstElementStateReturn gst_dptest_change_state (GstElement * element);
|
||||
static void gst_dptest_chain (GstPad * pad, GstData * buf);
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
|
||||
GType
|
||||
gst_dptest_get_type (void)
|
||||
{
|
||||
static GType dptest_type = 0;
|
||||
|
||||
if (!dptest_type) {
|
||||
static const GTypeInfo dptest_info = {
|
||||
sizeof (GstDpTestClass),
|
||||
gst_dptest_base_init,
|
||||
NULL,
|
||||
(GClassInitFunc) gst_dptest_class_init,
|
||||
NULL,
|
||||
NULL,
|
||||
sizeof (GstDpTest),
|
||||
0,
|
||||
(GInstanceInitFunc) gst_dptest_init,
|
||||
};
|
||||
|
||||
dptest_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstDpTest", &dptest_info, 0);
|
||||
}
|
||||
return dptest_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_dptest_base_init (gpointer g_class)
|
||||
{
|
||||
static GstElementDetails dptest_details = GST_ELEMENT_DETAILS ("DParamTest",
|
||||
"Filter",
|
||||
"Test for the GstDParam code",
|
||||
"Steve Baker <stevebaker_org@yahoo.co.uk>");
|
||||
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
||||
|
||||
gst_element_class_set_details (element_class, &dptest_details);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_dptest_class_init (GstDpTestClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
GstElementClass *gstelement_class;
|
||||
|
||||
gobject_class = (GObjectClass *) klass;
|
||||
gstelement_class = (GstElementClass *) klass;
|
||||
|
||||
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
|
||||
|
||||
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_dptest_set_property);
|
||||
|
||||
gstelement_class->change_state = gst_dptest_change_state;
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
gst_dptest_init (GstDpTest * dptest)
|
||||
{
|
||||
|
||||
dptest->sinkpad =
|
||||
gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate),
|
||||
"sink");
|
||||
gst_element_add_pad (GST_ELEMENT (dptest), dptest->sinkpad);
|
||||
gst_pad_set_chain_function (dptest->sinkpad, gst_dptest_chain);
|
||||
|
||||
dptest->srcpad =
|
||||
gst_pad_new_from_template (gst_static_pad_template_get (&srctemplate),
|
||||
"src");
|
||||
gst_element_add_pad (GST_ELEMENT (dptest), dptest->srcpad);
|
||||
|
||||
dptest->dpman = gst_dpman_new ("dptest_dpman", GST_ELEMENT (dptest));
|
||||
|
||||
gst_dpman_add_required_dparam_direct (dptest->dpman,
|
||||
g_param_spec_float ("float1", "float1", "float1",
|
||||
0.0, 1.0, 0.5, G_PARAM_READWRITE), "float", &(dptest->float1)
|
||||
);
|
||||
|
||||
dptest->float1 = 0.0;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_dptest_set_property (GObject * object, guint prop_id, const GValue * value,
|
||||
GParamSpec * pspec)
|
||||
{
|
||||
GstDpTest *dptest;
|
||||
|
||||
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;
|
||||
}
|
|
@ -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
|
||||
|
|
5
testsuite/dynparams/.gitignore
vendored
5
testsuite/dynparams/.gitignore
vendored
|
@ -1,5 +0,0 @@
|
|||
*.bb
|
||||
*.bbg
|
||||
*.da
|
||||
|
||||
dparamstest
|
|
@ -1,7 +0,0 @@
|
|||
include ../Rules
|
||||
|
||||
tests_pass = dparamstest
|
||||
tests_fail =
|
||||
tests_ignore =
|
||||
|
||||
dparamstest_LDADD = $(top_builddir)/libs/gst/control/libgstcontrol-@GST_MAJORMINOR@.la
|
|
@ -1,318 +0,0 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 2001 Steve Baker <stevebaker_org@yahoo.co.uk>
|
||||
*
|
||||
* dparamstest.c:
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/control/control.h>
|
||||
|
||||
#define GST_TYPE_DPTEST (gst_dptest_get_type())
|
||||
#define GST_DPTEST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DPTEST,GstDpTest))
|
||||
#define GST_DPTEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DPTEST,GstDpTestClass))
|
||||
#define GST_IS_DPTEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DPTEST))
|
||||
#define GST_IS_DPTEST_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DPTEST))
|
||||
|
||||
typedef struct _GstDpTest GstDpTest;
|
||||
typedef struct _GstDpTestClass GstDpTestClass;
|
||||
|
||||
struct _GstDpTest
|
||||
{
|
||||
GstElement element;
|
||||
|
||||
GstPad *sinkpad;
|
||||
GstPad *srcpad;
|
||||
GstDParamManager *dpman;
|
||||
|
||||
gfloat float1;
|
||||
gfloat float2;
|
||||
gboolean bool1;
|
||||
gdouble double1;
|
||||
};
|
||||
|
||||
struct _GstDpTestClass
|
||||
{
|
||||
GstElementClass parent_class;
|
||||
};
|
||||
|
||||
GType gst_dptest_get_type (void);
|
||||
|
||||
enum
|
||||
{
|
||||
ARG_0,
|
||||
};
|
||||
|
||||
GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS_ANY);
|
||||
|
||||
GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS_ANY);
|
||||
|
||||
|
||||
static void gst_dptest_base_init (gpointer g_class);
|
||||
static void gst_dptest_class_init (GstDpTestClass * klass);
|
||||
static void gst_dptest_init (GstDpTest * dptest);
|
||||
|
||||
static void gst_dptest_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * pspec);
|
||||
|
||||
static GstElementStateReturn gst_dptest_change_state (GstElement * element);
|
||||
static void gst_dptest_chain (GstPad * pad, GstData * buf);
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
|
||||
GType
|
||||
gst_dptest_get_type (void)
|
||||
{
|
||||
static GType dptest_type = 0;
|
||||
|
||||
if (!dptest_type) {
|
||||
static const GTypeInfo dptest_info = {
|
||||
sizeof (GstDpTestClass),
|
||||
gst_dptest_base_init,
|
||||
NULL,
|
||||
(GClassInitFunc) gst_dptest_class_init,
|
||||
NULL,
|
||||
NULL,
|
||||
sizeof (GstDpTest),
|
||||
0,
|
||||
(GInstanceInitFunc) gst_dptest_init,
|
||||
};
|
||||
|
||||
dptest_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstDpTest", &dptest_info, 0);
|
||||
}
|
||||
return dptest_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_dptest_base_init (gpointer g_class)
|
||||
{
|
||||
static GstElementDetails dptest_details = GST_ELEMENT_DETAILS ("DParamTest",
|
||||
"Filter",
|
||||
"Test for the GstDParam code",
|
||||
"Steve Baker <stevebaker_org@yahoo.co.uk>");
|
||||
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
||||
|
||||
gst_element_class_set_details (element_class, &dptest_details);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_dptest_class_init (GstDpTestClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
GstElementClass *gstelement_class;
|
||||
|
||||
gobject_class = (GObjectClass *) klass;
|
||||
gstelement_class = (GstElementClass *) klass;
|
||||
|
||||
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
|
||||
|
||||
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_dptest_set_property);
|
||||
|
||||
gstelement_class->change_state = gst_dptest_change_state;
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
gst_dptest_init (GstDpTest * dptest)
|
||||
{
|
||||
|
||||
dptest->sinkpad =
|
||||
gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate),
|
||||
"sink");
|
||||
gst_element_add_pad (GST_ELEMENT (dptest), dptest->sinkpad);
|
||||
gst_pad_set_chain_function (dptest->sinkpad, gst_dptest_chain);
|
||||
|
||||
dptest->srcpad =
|
||||
gst_pad_new_from_template (gst_static_pad_template_get (&srctemplate),
|
||||
"src");
|
||||
gst_element_add_pad (GST_ELEMENT (dptest), dptest->srcpad);
|
||||
|
||||
dptest->dpman = gst_dpman_new ("dptest_dpman", GST_ELEMENT (dptest));
|
||||
|
||||
gst_dpman_add_required_dparam_direct (dptest->dpman,
|
||||
g_param_spec_float ("float1", "float1", "float1",
|
||||
0.0, 1.0, 0.5, G_PARAM_READWRITE), "float", &(dptest->float1)
|
||||
);
|
||||
|
||||
dptest->float1 = 0.0;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_dptest_set_property (GObject * object, guint prop_id, const GValue * value,
|
||||
GParamSpec * pspec)
|
||||
{
|
||||
GstDpTest *dptest;
|
||||
|
||||
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;
|
||||
}
|
|
@ -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)
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#endif
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/control/control.h>
|
||||
|
||||
#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");
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#endif
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/control/control.h>
|
||||
#include <string.h>
|
||||
#include <locale.h>
|
||||
#include <glib/gprintf.h>
|
||||
|
@ -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,
|
||||
"<range min=\"%" G_GINT64_FORMAT "\" max=\"%" G_GINT64_FORMAT
|
||||
"\"/>", ((GParamSpecInt64 *) specs[x])->minimum,
|
||||
((GParamSpecInt64 *) specs[x])->maximum);
|
||||
PUT_STRING (pfx + 2, "<default>%" G_GINT64_FORMAT "</default>",
|
||||
((GParamSpecInt64 *) specs[x])->default_value);
|
||||
break;
|
||||
case G_TYPE_INT:
|
||||
PUT_STRING (pfx + 2, "<range min=\"%d\" max=\"%d\"/>",
|
||||
((GParamSpecInt *) specs[x])->minimum,
|
||||
((GParamSpecInt *) specs[x])->maximum);
|
||||
PUT_STRING (pfx + 2, "<default>%d</default>",
|
||||
((GParamSpecInt *) specs[x])->default_value);
|
||||
break;
|
||||
case G_TYPE_FLOAT:
|
||||
PUT_STRING (pfx + 2, "<range min=\"%f\" max=\"%f\"/>",
|
||||
((GParamSpecFloat *) specs[x])->minimum,
|
||||
((GParamSpecFloat *) specs[x])->maximum);
|
||||
PUT_STRING (pfx + 2, "<default>%f</default>",
|
||||
((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, "<?xml version=\"1.0\"?>");
|
||||
|
||||
|
|
Loading…
Reference in a new issue