diff options
author | Thomas Vander Stichele <thomas@apestaart.org> | 2005-09-14 20:51:47 +0000 |
---|---|---|
committer | Thomas Vander Stichele <thomas@apestaart.org> | 2005-09-14 20:51:47 +0000 |
commit | bbae2942c24dbc59dcfd577507b518eddfbde828 (patch) | |
tree | fa1ae02a796100a793cb9f34086fb4e90b956ca2 /gst/level/gstlevel.c | |
parent | 1b61a0a311ae5b82b731e95848b856dd867aaeaf (diff) |
common/: a simple py script to generate valid xml from a C example probably also need to strip an MIT license when we...
Original commit message from CVS:
* common/c-to-xml.py:
* common/gtk-doc-plugins.mak:
a simple py script to generate valid xml from a C example
probably also need to strip an MIT license when we decide
* docs/plugins/Makefile.am:
* gst/level/Makefile.am:
* gst/level/gstlevel.c: (gst_level_init):
* gst/level/level-example.c: (message_handler), (main):
add an example to level that will show up in the docs
* gst/rtp/TODO:
add a note for the future
Diffstat (limited to 'gst/level/gstlevel.c')
-rw-r--r-- | gst/level/gstlevel.c | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/gst/level/gstlevel.c b/gst/level/gstlevel.c index e3dabd8a..6feb8b64 100644 --- a/gst/level/gstlevel.c +++ b/gst/level/gstlevel.c @@ -19,6 +19,38 @@ * Boston, MA 02111-1307, USA. */ +/** + * SECTION:element-level + * + * <refsect2> + * <para> + * Level analyses incoming audio buffers and generates an application + * message per given interval of time. + * The message's structure contains four fields: + * <itemizedlist> + * <listitem> + * <para> + * <link linkend="gdouble">gdouble</link> + * <classname>"endtime"</classname>: + * the end time of the buffer that + * triggered the message</para> + * </listitem> + * <listitem> + * <para> + * <link linkend="gdouble">gdouble</link> + * <classname>"endtime"</classname>: + * the end time of the buffer that + * triggered the message</para> + * </listitem> + * </itemizedlist> + * </para> + * <title>Example application</title> + * <para> + * <include xmlns="http://www.w3.org/2003/XInclude" href="element-level-example.xml" /> + * </para> + * </refsect2> + */ + #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -146,6 +178,8 @@ gst_level_init (GstLevel * filter, GstLevelClass * g_class) filter->interval = 0.1; filter->decay_peak_ttl = 0.4; filter->decay_peak_falloff = 10.0; /* dB falloff (/sec) */ + + filter->message = TRUE; } static void @@ -257,6 +291,9 @@ gst_level_set_caps (GstBaseTransform * trans, GstCaps * in, GstCaps * out) * samples for multiple channels are interleaved * input sample data enters in *in_data as 8 or 16 bit data * this filter only accepts signed audio data, so mid level is always 0 + * + * for 16 bit, this code considers the non-existant 32768 value to be + * full-scale; so 32767 will not map to 1.0 */ #define DEFINE_LEVEL_CALCULATOR(TYPE) \ @@ -268,7 +305,7 @@ gst_level_calculate_##TYPE (TYPE * in, guint num, gint channels, \ double squaresum = 0.0; /* square sum of the integer samples */ \ register double square = 0.0; /* Square */ \ register double PSS = 0.0; /* Peak Square Sample */ \ - gdouble normalizer; /* divisor to get a [-1, - 1] range */ \ + gdouble normalizer; /* divisor to get a [-1.0, 1.0] range */ \ \ *CS = 0.0; /* Cumulative Square for this block */ \ \ |