mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
libs/gst/controller/: API: Add GstLFOControlSource, a control source that gives values for specific timestamps based ...
Original commit message from CVS: reviewed by: Stefan Kost <ensonic@users.sf.net> * libs/gst/controller/Makefile.am: * libs/gst/controller/gstlfocontrolsource.c: (_calculate_pos), (gst_lfo_waveform_get_type), (gst_lfo_control_source_reset), (gst_lfo_control_source_new), (gst_lfo_control_source_set_waveform), (gst_lfo_control_source_bind), (gst_lfo_control_source_init), (gst_lfo_control_source_finalize), (gst_lfo_control_source_dispose), (gst_lfo_control_source_set_property), (gst_lfo_control_source_get_property), (gst_lfo_control_source_class_init): * libs/gst/controller/gstlfocontrolsource.h: * libs/gst/controller/gstlfocontrolsourceprivate.h: API: Add GstLFOControlSource, a control source that gives values for specific timestamps based on several periodic waveforms. Fixes #459717. * tests/check/libs/controller.c: (GST_START_TEST), (gst_controller_suite): * docs/libs/gstreamer-libs-docs.sgml: * docs/libs/gstreamer-libs-sections.txt: * docs/libs/gstreamer-libs.types: Add documentation and unit tests for GstLFOControlSource.
This commit is contained in:
parent
2ec9403340
commit
b47469722f
9 changed files with 1798 additions and 4 deletions
28
ChangeLog
28
ChangeLog
|
@ -1,3 +1,31 @@
|
||||||
|
2007-08-03 Sebastian Dröge <slomo@circular-chaos.org>
|
||||||
|
|
||||||
|
reviewed by: Stefan Kost <ensonic@users.sf.net>
|
||||||
|
|
||||||
|
* libs/gst/controller/Makefile.am:
|
||||||
|
* libs/gst/controller/gstlfocontrolsource.c: (_calculate_pos),
|
||||||
|
(gst_lfo_waveform_get_type), (gst_lfo_control_source_reset),
|
||||||
|
(gst_lfo_control_source_new),
|
||||||
|
(gst_lfo_control_source_set_waveform),
|
||||||
|
(gst_lfo_control_source_bind), (gst_lfo_control_source_init),
|
||||||
|
(gst_lfo_control_source_finalize),
|
||||||
|
(gst_lfo_control_source_dispose),
|
||||||
|
(gst_lfo_control_source_set_property),
|
||||||
|
(gst_lfo_control_source_get_property),
|
||||||
|
(gst_lfo_control_source_class_init):
|
||||||
|
* libs/gst/controller/gstlfocontrolsource.h:
|
||||||
|
* libs/gst/controller/gstlfocontrolsourceprivate.h:
|
||||||
|
API: Add GstLFOControlSource, a control source that gives values
|
||||||
|
for specific timestamps based on several periodic waveforms.
|
||||||
|
Fixes #459717.
|
||||||
|
|
||||||
|
* tests/check/libs/controller.c: (GST_START_TEST),
|
||||||
|
(gst_controller_suite):
|
||||||
|
* docs/libs/gstreamer-libs-docs.sgml:
|
||||||
|
* docs/libs/gstreamer-libs-sections.txt:
|
||||||
|
* docs/libs/gstreamer-libs.types:
|
||||||
|
Add documentation and unit tests for GstLFOControlSource.
|
||||||
|
|
||||||
2007-08-03 Jan Schmidt <thaytan@mad.scientist.com>
|
2007-08-03 Jan Schmidt <thaytan@mad.scientist.com>
|
||||||
|
|
||||||
* configure.ac:
|
* configure.ac:
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
<!ENTITY GstController SYSTEM "xml/gstcontroller.xml">
|
<!ENTITY GstController SYSTEM "xml/gstcontroller.xml">
|
||||||
<!ENTITY GstControlSource SYSTEM "xml/gstcontrolsource.xml">
|
<!ENTITY GstControlSource SYSTEM "xml/gstcontrolsource.xml">
|
||||||
<!ENTITY GstInterpolationControlSource SYSTEM "xml/gstinterpolationcontrolsource.xml">
|
<!ENTITY GstInterpolationControlSource SYSTEM "xml/gstinterpolationcontrolsource.xml">
|
||||||
|
<!ENTITY GstLFOControlSource SYSTEM "xml/gstlfocontrolsource.xml">
|
||||||
<!ENTITY GstControllerGObject SYSTEM "xml/gstcontrollergobject.xml">
|
<!ENTITY GstControllerGObject SYSTEM "xml/gstcontrollergobject.xml">
|
||||||
<!ENTITY GstDataProtocol SYSTEM "xml/gstdataprotocol.xml">
|
<!ENTITY GstDataProtocol SYSTEM "xml/gstdataprotocol.xml">
|
||||||
|
|
||||||
|
@ -70,6 +71,7 @@
|
||||||
&GstController;
|
&GstController;
|
||||||
&GstControlSource;
|
&GstControlSource;
|
||||||
&GstInterpolationControlSource;
|
&GstInterpolationControlSource;
|
||||||
|
&GstLFOControlSource;
|
||||||
&GstControllerGObject;
|
&GstControllerGObject;
|
||||||
</chapter>
|
</chapter>
|
||||||
|
|
||||||
|
|
|
@ -148,6 +148,28 @@ GST_TYPE_INTERPOLATION_CONTROL_SOURCE
|
||||||
gst_interpolation_control_source_get_type
|
gst_interpolation_control_source_get_type
|
||||||
</SECTION>
|
</SECTION>
|
||||||
|
|
||||||
|
<SECTION>
|
||||||
|
<FILE>gstlfocontrolsource</FILE>
|
||||||
|
<TITLE>GstLFOControlSource</TITLE>
|
||||||
|
<INCLUDE>libs/controller/gstlfocontrolsource.h</INCLUDE>
|
||||||
|
GstLFOControlSource
|
||||||
|
GstLFOWaveform
|
||||||
|
gst_lfo_control_source_new
|
||||||
|
<SUBSECTION Standard>
|
||||||
|
GstLFOControlSourceClass
|
||||||
|
GstLFOControlSourcePrivate
|
||||||
|
GST_IS_LFO_CONTROL_SOURCE
|
||||||
|
GST_IS_LFO_CONTROL_SOURCE_CLASS
|
||||||
|
GST_LFO_CONTROL_SOURCE
|
||||||
|
GST_LFO_CONTROL_SOURCE_CLASS
|
||||||
|
GST_LFO_CONTROL_SOURCE_GET_CLASS
|
||||||
|
GST_TYPE_LFO_CONTROL_SOURCE
|
||||||
|
GST_TYPE_LFO_WAVEFORM
|
||||||
|
<SUBSECTION Private>
|
||||||
|
gst_lfo_control_source_get_type
|
||||||
|
gst_lfo_waveform_get_type
|
||||||
|
</SECTION>
|
||||||
|
|
||||||
<SECTION>
|
<SECTION>
|
||||||
<FILE>gstcontrollergobject</FILE>
|
<FILE>gstcontrollergobject</FILE>
|
||||||
<TITLE>GstControllerGObject</TITLE>
|
<TITLE>GstControllerGObject</TITLE>
|
||||||
|
|
|
@ -6,6 +6,9 @@ gst_controller_get_type
|
||||||
gst_control_source_get_type
|
gst_control_source_get_type
|
||||||
#include <gst/controller/gstinterpolationcontrolsource.h>
|
#include <gst/controller/gstinterpolationcontrolsource.h>
|
||||||
gst_interpolation_control_source_get_type
|
gst_interpolation_control_source_get_type
|
||||||
|
#include <gst/controller/gstlfocontrolsource.h>
|
||||||
|
gst_lfo_control_source_get_type
|
||||||
|
gst_lfo_waveform_get_type
|
||||||
|
|
||||||
#include <gst/base/gstadapter.h>
|
#include <gst/base/gstadapter.h>
|
||||||
gst_adapter_get_type
|
gst_adapter_get_type
|
||||||
|
|
|
@ -4,7 +4,8 @@ libgstcontroller_@GST_MAJORMINOR@_includedir = $(includedir)/gstreamer-@GST_MAJO
|
||||||
libgstcontroller_@GST_MAJORMINOR@_include_HEADERS = \
|
libgstcontroller_@GST_MAJORMINOR@_include_HEADERS = \
|
||||||
gstcontroller.h \
|
gstcontroller.h \
|
||||||
gstcontrolsource.h \
|
gstcontrolsource.h \
|
||||||
gstinterpolationcontrolsource.h
|
gstinterpolationcontrolsource.h \
|
||||||
|
gstlfocontrolsource.h
|
||||||
|
|
||||||
noinst_HEADERS = \
|
noinst_HEADERS = \
|
||||||
gstcontrollerprivate.h \
|
gstcontrollerprivate.h \
|
||||||
|
@ -16,10 +17,11 @@ libgstcontroller_@GST_MAJORMINOR@_la_SOURCES = \
|
||||||
gstinterpolation.c \
|
gstinterpolation.c \
|
||||||
gsthelper.c \
|
gsthelper.c \
|
||||||
gstcontrolsource.c \
|
gstcontrolsource.c \
|
||||||
gstinterpolationcontrolsource.c
|
gstinterpolationcontrolsource.c \
|
||||||
|
gstlfocontrolsource.c
|
||||||
|
|
||||||
libgstcontroller_@GST_MAJORMINOR@_la_CFLAGS = $(GST_OBJ_CFLAGS)
|
libgstcontroller_@GST_MAJORMINOR@_la_CFLAGS = $(GST_OBJ_CFLAGS)
|
||||||
libgstcontroller_@GST_MAJORMINOR@_la_LIBADD = $(GST_OBJ_LIBS)
|
libgstcontroller_@GST_MAJORMINOR@_la_LIBADD = $(GST_OBJ_LIBS) $(LIBM)
|
||||||
libgstcontroller_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
|
libgstcontroller_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
|
||||||
|
|
||||||
CLEANFILES = *.gcno *.gcda *.gcov
|
CLEANFILES = *.gcno *.gcda *.gcov
|
||||||
|
|
1079
libs/gst/controller/gstlfocontrolsource.c
Normal file
1079
libs/gst/controller/gstlfocontrolsource.c
Normal file
File diff suppressed because it is too large
Load diff
102
libs/gst/controller/gstlfocontrolsource.h
Normal file
102
libs/gst/controller/gstlfocontrolsource.h
Normal file
|
@ -0,0 +1,102 @@
|
||||||
|
/* GStreamer
|
||||||
|
*
|
||||||
|
* Copyright (C) 2007 Sebastian Dröge <slomo@circular-chaos.org>
|
||||||
|
*
|
||||||
|
* gstlfocontrolsource.h: Control source that provides some periodic waveforms
|
||||||
|
* as control values.
|
||||||
|
*
|
||||||
|
* 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_LFO_CONTROL_SOURCE_H__
|
||||||
|
#define __GST_LFO_CONTROL_SOURCE_H__
|
||||||
|
|
||||||
|
#include <glib-object.h>
|
||||||
|
#include <gst/gst.h>
|
||||||
|
|
||||||
|
#include "gstcontrolsource.h"
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
#define GST_TYPE_LFO_CONTROL_SOURCE \
|
||||||
|
(gst_lfo_control_source_get_type ())
|
||||||
|
#define GST_LFO_CONTROL_SOURCE(obj) \
|
||||||
|
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_LFO_CONTROL_SOURCE, GstLFOControlSource))
|
||||||
|
#define GST_LFO_CONTROL_SOURCE_CLASS(vtable) \
|
||||||
|
(G_TYPE_CHECK_CLASS_CAST ((vtable), GST_TYPE_LFO_CONTROL_SOURCE, GstLFOControlSourceClass))
|
||||||
|
#define GST_IS_LFO_CONTROL_SOURCE(obj) \
|
||||||
|
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_LFO_CONTROL_SOURCE))
|
||||||
|
#define GST_IS_LFO_CONTROL_SOURCE_CLASS(vtable) \
|
||||||
|
(G_TYPE_CHECK_CLASS_TYPE ((vtable), GST_TYPE_LFO_CONTROL_SOURCE))
|
||||||
|
#define GST_LFO_CONTROL_SOURCE_GET_CLASS(inst) \
|
||||||
|
(G_TYPE_INSTANCE_GET_CLASS ((inst), GST_TYPE_LFO_CONTROL_SOURCE, GstLFOControlSourceClass))
|
||||||
|
|
||||||
|
#define GST_TYPE_LFO_WAVEFORM (gst_lfo_waveform_get_type ())
|
||||||
|
|
||||||
|
typedef struct _GstLFOControlSource GstLFOControlSource;
|
||||||
|
typedef struct _GstLFOControlSourceClass GstLFOControlSourceClass;
|
||||||
|
typedef struct _GstLFOControlSourcePrivate GstLFOControlSourcePrivate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GstLFOWaveForm:
|
||||||
|
* @GST_LFO_WAVEFORM_SINE: sine waveform
|
||||||
|
* @GST_LFO_WAVEFORM_SQUARE: square waveform
|
||||||
|
* @GST_LFO_WAVEFORM_SAW: saw waveform
|
||||||
|
* @GST_LFO_WAVEFORM_REVERSE_SAW: reverse saw waveform
|
||||||
|
* @GST_LFO_WAVEFORM_TRIANGLE: triangle waveform
|
||||||
|
*
|
||||||
|
* The various waveform modes available.
|
||||||
|
*/
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
GST_LFO_WAVEFORM_SINE,
|
||||||
|
GST_LFO_WAVEFORM_SQUARE,
|
||||||
|
GST_LFO_WAVEFORM_SAW,
|
||||||
|
GST_LFO_WAVEFORM_REVERSE_SAW,
|
||||||
|
GST_LFO_WAVEFORM_TRIANGLE
|
||||||
|
} GstLFOWaveform;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GstLFOControlSource:
|
||||||
|
*
|
||||||
|
* The instance structure of #GstControlSource.
|
||||||
|
*/
|
||||||
|
struct _GstLFOControlSource {
|
||||||
|
GstControlSource parent;
|
||||||
|
|
||||||
|
/* <private> */
|
||||||
|
GstLFOControlSourcePrivate *priv;
|
||||||
|
GMutex *lock;
|
||||||
|
gpointer _gst_reserved[GST_PADDING];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _GstLFOControlSourceClass {
|
||||||
|
GstControlSourceClass parent_class;
|
||||||
|
|
||||||
|
/*< private >*/
|
||||||
|
gpointer _gst_reserved[GST_PADDING];
|
||||||
|
};
|
||||||
|
|
||||||
|
GType gst_lfo_control_source_get_type ();
|
||||||
|
GType gst_lfo_waveform_get_type ();
|
||||||
|
|
||||||
|
/* Functions */
|
||||||
|
|
||||||
|
GstLFOControlSource *gst_lfo_control_source_new ();
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif /* __GST_LFO_CONTROL_SOURCE_H__ */
|
64
libs/gst/controller/gstlfocontrolsourceprivate.h
Normal file
64
libs/gst/controller/gstlfocontrolsourceprivate.h
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
/* GStreamer
|
||||||
|
*
|
||||||
|
* Copyright (C) 2007 Sebastian Dröge <slomo@circular-chaos.org>
|
||||||
|
*
|
||||||
|
* gstlfocontrolsourceprivate.h: Private declarations for the
|
||||||
|
* GstLFOControlSource
|
||||||
|
*
|
||||||
|
* 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_LFO_CONTROL_SOURCE_PRIVATE_H__
|
||||||
|
#define __GST_LFO_CONTROL_SOURCE_PRIVATE_H__
|
||||||
|
|
||||||
|
typedef struct _GstWaveformImplementation
|
||||||
|
{
|
||||||
|
GstControlSourceGetValue get_int;
|
||||||
|
GstControlSourceGetValueArray get_int_value_array;
|
||||||
|
GstControlSourceGetValue get_uint;
|
||||||
|
GstControlSourceGetValueArray get_uint_value_array;
|
||||||
|
GstControlSourceGetValue get_long;
|
||||||
|
GstControlSourceGetValueArray get_long_value_array;
|
||||||
|
GstControlSourceGetValue get_ulong;
|
||||||
|
GstControlSourceGetValueArray get_ulong_value_array;
|
||||||
|
GstControlSourceGetValue get_int64;
|
||||||
|
GstControlSourceGetValueArray get_int64_value_array;
|
||||||
|
GstControlSourceGetValue get_uint64;
|
||||||
|
GstControlSourceGetValueArray get_uint64_value_array;
|
||||||
|
GstControlSourceGetValue get_float;
|
||||||
|
GstControlSourceGetValueArray get_float_value_array;
|
||||||
|
GstControlSourceGetValue get_double;
|
||||||
|
GstControlSourceGetValueArray get_double_value_array;
|
||||||
|
} GstWaveformImplementation;
|
||||||
|
|
||||||
|
struct _GstLFOControlSourcePrivate
|
||||||
|
{
|
||||||
|
GType type; /* type of the handled property */
|
||||||
|
GType base; /* base-type of the handled property */
|
||||||
|
|
||||||
|
GValue minimum_value; /* min value for the handled property */
|
||||||
|
GValue maximum_value; /* max value for the handled property */
|
||||||
|
|
||||||
|
GstLFOWaveform waveform;
|
||||||
|
gdouble frequency;
|
||||||
|
GstClockTime period;
|
||||||
|
GstClockTime timeshift;
|
||||||
|
GValue amplitude;
|
||||||
|
GValue offset;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* __GST_LFO_CONTROL_SOURCE_PRIVATE_H__ */
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* unit test for the controller library
|
* unit test for the controller library
|
||||||
*
|
*
|
||||||
* Copyright (C) <2005> Stefan Kost <ensonic at users dot sf dot net>
|
* Copyright (C) <2005> Stefan Kost <ensonic at users dot sf dot net>
|
||||||
* Copyright (C) <2006> Sebastian Dröge <slomo@circular-chaos.org>
|
* Copyright (C) <2006-2007> Sebastian Dröge <slomo@circular-chaos.org>
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Library General Public
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
@ -29,6 +29,7 @@
|
||||||
#include <gst/controller/gstcontroller.h>
|
#include <gst/controller/gstcontroller.h>
|
||||||
#include <gst/controller/gstcontrolsource.h>
|
#include <gst/controller/gstcontrolsource.h>
|
||||||
#include <gst/controller/gstinterpolationcontrolsource.h>
|
#include <gst/controller/gstinterpolationcontrolsource.h>
|
||||||
|
#include <gst/controller/gstlfocontrolsource.h>
|
||||||
|
|
||||||
/* LOCAL TEST ELEMENT */
|
/* LOCAL TEST ELEMENT */
|
||||||
|
|
||||||
|
@ -1419,6 +1420,490 @@ GST_START_TEST (controller_interpolation_set_from_list)
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
|
||||||
|
/* test lfo control source with sine waveform */
|
||||||
|
GST_START_TEST (controller_lfo_sine)
|
||||||
|
{
|
||||||
|
GstController *ctrl;
|
||||||
|
GstLFOControlSource *csource;
|
||||||
|
GstElement *elem;
|
||||||
|
GValue amp = { 0, }
|
||||||
|
, off = {
|
||||||
|
0,};
|
||||||
|
|
||||||
|
gst_controller_init (NULL, NULL);
|
||||||
|
|
||||||
|
elem = gst_element_factory_make ("testmonosource", "test_source");
|
||||||
|
|
||||||
|
/* that property should exist and should be controllable */
|
||||||
|
ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL);
|
||||||
|
fail_unless (ctrl != NULL, NULL);
|
||||||
|
|
||||||
|
/* Get interpolation control source */
|
||||||
|
csource = gst_lfo_control_source_new ();
|
||||||
|
|
||||||
|
fail_unless (csource != NULL);
|
||||||
|
fail_unless (gst_controller_set_control_source (ctrl, "ulong",
|
||||||
|
GST_CONTROL_SOURCE (csource)));
|
||||||
|
|
||||||
|
/* set amplitude and offset values */
|
||||||
|
g_value_init (&, G_TYPE_ULONG);
|
||||||
|
g_value_init (&off, G_TYPE_ULONG);
|
||||||
|
g_value_set_ulong (&, 100);
|
||||||
|
g_value_set_ulong (&off, 100);
|
||||||
|
|
||||||
|
/* set waveform mode */
|
||||||
|
g_object_set (csource, "waveform", GST_LFO_WAVEFORM_SINE,
|
||||||
|
"frequency", 1.0, "timeshift", (GstClockTime) 0,
|
||||||
|
"amplitude", &, "offset", &off, NULL);
|
||||||
|
|
||||||
|
g_object_unref (G_OBJECT (csource));
|
||||||
|
|
||||||
|
/* now pull in values for some timestamps */
|
||||||
|
gst_controller_sync_values (ctrl, 0 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 100, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 250 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 200, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 500 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 100, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 750 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 0, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1000 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 100, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1250 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 200, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1500 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 100, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1750 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 0, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 2000 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 100, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1250 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 200, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1500 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 100, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1750 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 0, NULL);
|
||||||
|
|
||||||
|
GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
|
||||||
|
g_object_unref (ctrl);
|
||||||
|
gst_object_unref (elem);
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_END_TEST;
|
||||||
|
|
||||||
|
/* test lfo control source with sine waveform and timeshift */
|
||||||
|
GST_START_TEST (controller_lfo_sine_timeshift)
|
||||||
|
{
|
||||||
|
GstController *ctrl;
|
||||||
|
GstLFOControlSource *csource;
|
||||||
|
GstElement *elem;
|
||||||
|
GValue amp = { 0, }
|
||||||
|
, off = {
|
||||||
|
0,};
|
||||||
|
|
||||||
|
gst_controller_init (NULL, NULL);
|
||||||
|
|
||||||
|
elem = gst_element_factory_make ("testmonosource", "test_source");
|
||||||
|
|
||||||
|
/* that property should exist and should be controllable */
|
||||||
|
ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL);
|
||||||
|
fail_unless (ctrl != NULL, NULL);
|
||||||
|
|
||||||
|
/* Get interpolation control source */
|
||||||
|
csource = gst_lfo_control_source_new ();
|
||||||
|
|
||||||
|
fail_unless (csource != NULL);
|
||||||
|
fail_unless (gst_controller_set_control_source (ctrl, "ulong",
|
||||||
|
GST_CONTROL_SOURCE (csource)));
|
||||||
|
|
||||||
|
/* set amplitude and offset values */
|
||||||
|
g_value_init (&, G_TYPE_ULONG);
|
||||||
|
g_value_init (&off, G_TYPE_ULONG);
|
||||||
|
g_value_set_ulong (&, 100);
|
||||||
|
g_value_set_ulong (&off, 100);
|
||||||
|
|
||||||
|
/* set waveform mode */
|
||||||
|
g_object_set (csource, "waveform", GST_LFO_WAVEFORM_SINE,
|
||||||
|
"frequency", 1.0, "timeshift", 250 * GST_MSECOND,
|
||||||
|
"amplitude", &, "offset", &off, NULL);
|
||||||
|
|
||||||
|
g_object_unref (G_OBJECT (csource));
|
||||||
|
|
||||||
|
/* now pull in values for some timestamps */
|
||||||
|
gst_controller_sync_values (ctrl, 0 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 0, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 250 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 100, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 500 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 200, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 750 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 100, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1000 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 0, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1250 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 100, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1500 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 200, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1750 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 100, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 2000 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 0, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1250 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 100, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1500 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 200, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1750 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 100, NULL);
|
||||||
|
|
||||||
|
GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
|
||||||
|
g_object_unref (ctrl);
|
||||||
|
gst_object_unref (elem);
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_END_TEST;
|
||||||
|
|
||||||
|
|
||||||
|
/* test lfo control source with square waveform */
|
||||||
|
GST_START_TEST (controller_lfo_square)
|
||||||
|
{
|
||||||
|
GstController *ctrl;
|
||||||
|
GstLFOControlSource *csource;
|
||||||
|
GstElement *elem;
|
||||||
|
GValue amp = { 0, }
|
||||||
|
, off = {
|
||||||
|
0,};
|
||||||
|
|
||||||
|
gst_controller_init (NULL, NULL);
|
||||||
|
|
||||||
|
elem = gst_element_factory_make ("testmonosource", "test_source");
|
||||||
|
|
||||||
|
/* that property should exist and should be controllable */
|
||||||
|
ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL);
|
||||||
|
fail_unless (ctrl != NULL, NULL);
|
||||||
|
|
||||||
|
/* Get interpolation control source */
|
||||||
|
csource = gst_lfo_control_source_new ();
|
||||||
|
|
||||||
|
fail_unless (csource != NULL);
|
||||||
|
fail_unless (gst_controller_set_control_source (ctrl, "ulong",
|
||||||
|
GST_CONTROL_SOURCE (csource)));
|
||||||
|
|
||||||
|
/* set amplitude and offset values */
|
||||||
|
g_value_init (&, G_TYPE_ULONG);
|
||||||
|
g_value_init (&off, G_TYPE_ULONG);
|
||||||
|
g_value_set_ulong (&, 100);
|
||||||
|
g_value_set_ulong (&off, 100);
|
||||||
|
|
||||||
|
/* set waveform mode */
|
||||||
|
g_object_set (csource, "waveform", GST_LFO_WAVEFORM_SQUARE,
|
||||||
|
"frequency", 1.0, "timeshift", (GstClockTime) 0,
|
||||||
|
"amplitude", &, "offset", &off, NULL);
|
||||||
|
|
||||||
|
g_object_unref (G_OBJECT (csource));
|
||||||
|
|
||||||
|
/* now pull in values for some timestamps */
|
||||||
|
gst_controller_sync_values (ctrl, 0 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 0, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 250 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 0, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 500 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 200, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 750 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 200, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1000 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 0, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1250 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 0, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1500 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 200, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1750 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 200, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 2000 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 0, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1250 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 0, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1500 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 200, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1750 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 200, NULL);
|
||||||
|
|
||||||
|
GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
|
||||||
|
g_object_unref (ctrl);
|
||||||
|
gst_object_unref (elem);
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_END_TEST;
|
||||||
|
|
||||||
|
/* test lfo control source with saw waveform */
|
||||||
|
GST_START_TEST (controller_lfo_saw)
|
||||||
|
{
|
||||||
|
GstController *ctrl;
|
||||||
|
GstLFOControlSource *csource;
|
||||||
|
GstElement *elem;
|
||||||
|
GValue amp = { 0, }
|
||||||
|
, off = {
|
||||||
|
0,};
|
||||||
|
|
||||||
|
gst_controller_init (NULL, NULL);
|
||||||
|
|
||||||
|
elem = gst_element_factory_make ("testmonosource", "test_source");
|
||||||
|
|
||||||
|
/* that property should exist and should be controllable */
|
||||||
|
ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL);
|
||||||
|
fail_unless (ctrl != NULL, NULL);
|
||||||
|
|
||||||
|
/* Get interpolation control source */
|
||||||
|
csource = gst_lfo_control_source_new ();
|
||||||
|
|
||||||
|
fail_unless (csource != NULL);
|
||||||
|
fail_unless (gst_controller_set_control_source (ctrl, "ulong",
|
||||||
|
GST_CONTROL_SOURCE (csource)));
|
||||||
|
|
||||||
|
/* set amplitude and offset values */
|
||||||
|
g_value_init (&, G_TYPE_ULONG);
|
||||||
|
g_value_init (&off, G_TYPE_ULONG);
|
||||||
|
g_value_set_ulong (&, 100);
|
||||||
|
g_value_set_ulong (&off, 100);
|
||||||
|
|
||||||
|
/* set waveform mode */
|
||||||
|
g_object_set (csource, "waveform", GST_LFO_WAVEFORM_SAW,
|
||||||
|
"frequency", 1.0, "timeshift", (GstClockTime) 0,
|
||||||
|
"amplitude", &, "offset", &off, NULL);
|
||||||
|
|
||||||
|
g_object_unref (G_OBJECT (csource));
|
||||||
|
|
||||||
|
/* now pull in values for some timestamps */
|
||||||
|
gst_controller_sync_values (ctrl, 0 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 200, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 250 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 150, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 500 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 100, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 750 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 50, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1000 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 200, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1250 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 150, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1500 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 100, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1750 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 50, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 2000 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 200, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1250 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 150, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1500 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 100, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1750 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 50, NULL);
|
||||||
|
|
||||||
|
GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
|
||||||
|
g_object_unref (ctrl);
|
||||||
|
gst_object_unref (elem);
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_END_TEST;
|
||||||
|
|
||||||
|
/* test lfo control source with reverse saw waveform */
|
||||||
|
GST_START_TEST (controller_lfo_rsaw)
|
||||||
|
{
|
||||||
|
GstController *ctrl;
|
||||||
|
GstLFOControlSource *csource;
|
||||||
|
GstElement *elem;
|
||||||
|
GValue amp = { 0, }
|
||||||
|
, off = {
|
||||||
|
0,};
|
||||||
|
|
||||||
|
gst_controller_init (NULL, NULL);
|
||||||
|
|
||||||
|
elem = gst_element_factory_make ("testmonosource", "test_source");
|
||||||
|
|
||||||
|
/* that property should exist and should be controllable */
|
||||||
|
ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL);
|
||||||
|
fail_unless (ctrl != NULL, NULL);
|
||||||
|
|
||||||
|
/* Get interpolation control source */
|
||||||
|
csource = gst_lfo_control_source_new ();
|
||||||
|
|
||||||
|
fail_unless (csource != NULL);
|
||||||
|
fail_unless (gst_controller_set_control_source (ctrl, "ulong",
|
||||||
|
GST_CONTROL_SOURCE (csource)));
|
||||||
|
|
||||||
|
/* set amplitude and offset values */
|
||||||
|
g_value_init (&, G_TYPE_ULONG);
|
||||||
|
g_value_init (&off, G_TYPE_ULONG);
|
||||||
|
g_value_set_ulong (&, 100);
|
||||||
|
g_value_set_ulong (&off, 100);
|
||||||
|
|
||||||
|
/* set waveform mode */
|
||||||
|
g_object_set (csource, "waveform", GST_LFO_WAVEFORM_REVERSE_SAW,
|
||||||
|
"frequency", 1.0, "timeshift", (GstClockTime) 0,
|
||||||
|
"amplitude", &, "offset", &off, NULL);
|
||||||
|
|
||||||
|
g_object_unref (G_OBJECT (csource));
|
||||||
|
|
||||||
|
/* now pull in values for some timestamps */
|
||||||
|
gst_controller_sync_values (ctrl, 0 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 0, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 250 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 50, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 500 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 100, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 750 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 150, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1000 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 0, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1250 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 50, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1500 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 100, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1750 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 150, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 2000 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 0, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1250 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 50, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1500 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 100, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1750 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 150, NULL);
|
||||||
|
|
||||||
|
GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
|
||||||
|
g_object_unref (ctrl);
|
||||||
|
gst_object_unref (elem);
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_END_TEST;
|
||||||
|
|
||||||
|
/* test lfo control source with saw waveform */
|
||||||
|
GST_START_TEST (controller_lfo_triangle)
|
||||||
|
{
|
||||||
|
GstController *ctrl;
|
||||||
|
GstLFOControlSource *csource;
|
||||||
|
GstElement *elem;
|
||||||
|
GValue amp = { 0, }
|
||||||
|
, off = {
|
||||||
|
0,};
|
||||||
|
|
||||||
|
gst_controller_init (NULL, NULL);
|
||||||
|
|
||||||
|
elem = gst_element_factory_make ("testmonosource", "test_source");
|
||||||
|
|
||||||
|
/* that property should exist and should be controllable */
|
||||||
|
ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL);
|
||||||
|
fail_unless (ctrl != NULL, NULL);
|
||||||
|
|
||||||
|
/* Get interpolation control source */
|
||||||
|
csource = gst_lfo_control_source_new ();
|
||||||
|
|
||||||
|
fail_unless (csource != NULL);
|
||||||
|
fail_unless (gst_controller_set_control_source (ctrl, "ulong",
|
||||||
|
GST_CONTROL_SOURCE (csource)));
|
||||||
|
|
||||||
|
/* set amplitude and offset values */
|
||||||
|
g_value_init (&, G_TYPE_ULONG);
|
||||||
|
g_value_init (&off, G_TYPE_ULONG);
|
||||||
|
g_value_set_ulong (&, 100);
|
||||||
|
g_value_set_ulong (&off, 100);
|
||||||
|
|
||||||
|
/* set waveform mode */
|
||||||
|
g_object_set (csource, "waveform", GST_LFO_WAVEFORM_TRIANGLE,
|
||||||
|
"frequency", 1.0, "timeshift", (GstClockTime) 0,
|
||||||
|
"amplitude", &, "offset", &off, NULL);
|
||||||
|
|
||||||
|
g_object_unref (G_OBJECT (csource));
|
||||||
|
|
||||||
|
/* now pull in values for some timestamps */
|
||||||
|
gst_controller_sync_values (ctrl, 0 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 100, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 250 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 200, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 500 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 100, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 750 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 0, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1000 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 100, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1250 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 200, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1500 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 100, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1750 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 0, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 2000 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 100, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1250 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 200, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1500 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 100, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1750 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 0, NULL);
|
||||||
|
|
||||||
|
GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
|
||||||
|
g_object_unref (ctrl);
|
||||||
|
gst_object_unref (elem);
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_END_TEST;
|
||||||
|
|
||||||
|
/* test lfo control source with nothing set */
|
||||||
|
GST_START_TEST (controller_lfo_none)
|
||||||
|
{
|
||||||
|
GstController *ctrl;
|
||||||
|
GstLFOControlSource *csource;
|
||||||
|
GstElement *elem;
|
||||||
|
|
||||||
|
gst_controller_init (NULL, NULL);
|
||||||
|
|
||||||
|
elem = gst_element_factory_make ("testmonosource", "test_source");
|
||||||
|
|
||||||
|
/* that property should exist and should be controllable */
|
||||||
|
ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL);
|
||||||
|
fail_unless (ctrl != NULL, NULL);
|
||||||
|
|
||||||
|
/* Get interpolation control source */
|
||||||
|
csource = gst_lfo_control_source_new ();
|
||||||
|
|
||||||
|
fail_unless (csource != NULL);
|
||||||
|
fail_unless (gst_controller_set_control_source (ctrl, "ulong",
|
||||||
|
GST_CONTROL_SOURCE (csource)));
|
||||||
|
|
||||||
|
g_object_unref (G_OBJECT (csource));
|
||||||
|
|
||||||
|
/* now pull in values for some timestamps */
|
||||||
|
gst_controller_sync_values (ctrl, 0 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 0, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 250 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 0, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 500 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 0, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 750 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 0, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1000 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 0, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1250 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 0, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1500 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 0, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1750 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 0, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 2000 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 0, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1250 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 0, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1500 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 0, NULL);
|
||||||
|
gst_controller_sync_values (ctrl, 1750 * GST_MSECOND);
|
||||||
|
fail_unless (GST_TEST_MONO_SOURCE (elem)->val_ulong == 0, NULL);
|
||||||
|
|
||||||
|
GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
|
||||||
|
g_object_unref (ctrl);
|
||||||
|
gst_object_unref (elem);
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_END_TEST;
|
||||||
|
|
||||||
/* tests if we can run helper methods against any GObject */
|
/* tests if we can run helper methods against any GObject */
|
||||||
GST_START_TEST (controller_helper_any_gobject)
|
GST_START_TEST (controller_helper_any_gobject)
|
||||||
{
|
{
|
||||||
|
@ -1548,6 +2033,13 @@ gst_controller_suite (void)
|
||||||
tcase_add_test (tc, controller_interpolation_linear_default_values);
|
tcase_add_test (tc, controller_interpolation_linear_default_values);
|
||||||
tcase_add_test (tc, controller_interpolate_linear_disabled);
|
tcase_add_test (tc, controller_interpolate_linear_disabled);
|
||||||
tcase_add_test (tc, controller_interpolation_set_from_list);
|
tcase_add_test (tc, controller_interpolation_set_from_list);
|
||||||
|
tcase_add_test (tc, controller_lfo_sine);
|
||||||
|
tcase_add_test (tc, controller_lfo_sine_timeshift);
|
||||||
|
tcase_add_test (tc, controller_lfo_square);
|
||||||
|
tcase_add_test (tc, controller_lfo_saw);
|
||||||
|
tcase_add_test (tc, controller_lfo_rsaw);
|
||||||
|
tcase_add_test (tc, controller_lfo_triangle);
|
||||||
|
tcase_add_test (tc, controller_lfo_none);
|
||||||
tcase_add_test (tc, controller_helper_any_gobject);
|
tcase_add_test (tc, controller_helper_any_gobject);
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
|
|
Loading…
Reference in a new issue