gst-indent
[platform/upstream/gst-plugins-good.git] / gst / level / gstlevel.h
1 /* GStreamer
2  * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
3  *
4  * gstlevel.c: signals RMS, peak and decaying peak levels
5  * Copyright (C) 2000,2001,2002,2003
6  *           Thomas Vander Stichele <thomas at apestaart dot org>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the
20  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23
24
25 #ifndef __GST_LEVEL_H__
26 #define __GST_LEVEL_H__
27
28
29 #include <gst/gst.h>
30
31 #include "gstlevel-marshal.h"
32
33 #ifdef __cplusplus
34 extern "C"
35 {
36 #endif                          /* __cplusplus */
37
38
39 #define GST_TYPE_LEVEL \
40   (gst_level_get_type())
41 #define GST_LEVEL(obj) \
42   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_LEVEL,GstLevel))
43 #define GST_LEVEL_CLASS(klass) \
44   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ULAW,GstLevel))
45 #define GST_IS_LEVEL(obj) \
46   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_LEVEL))
47 #define GST_IS_LEVEL_CLASS(obj) \
48   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_LEVEL))
49
50   typedef struct _GstLevel GstLevel;
51   typedef struct _GstLevelClass GstLevelClass;
52
53   struct _GstLevel
54   {
55     GstElement element;
56
57     GstPad *sinkpad, *srcpad;
58     gboolean signal;            /* whether or not to emit signals */
59     gboolean inited;            /* whether or not the element is initialized */
60     gdouble interval;           /* how many seconds between emits */
61
62     gint rate;                  /* caps variables */
63     gint width;
64     gint channels;
65
66     gdouble decay_peak_ttl;     /* time to live for peak in seconds */
67     gdouble decay_peak_falloff; /* falloff in dB/sec */
68     gdouble num_samples;        /* cumulative sample count */
69
70     /* per-channel arrays for intermediate values */
71     gdouble *CS;                /* normalized Cumulative Square */
72     gdouble *peak;              /* normalized Peak value over buffer */
73     gdouble *last_peak;         /* last normalized Peak value over interval */
74     gdouble *decay_peak;        /* running decaying normalized Peak */
75     gdouble *MS;                /* normalized Mean Square of buffer */
76     gdouble *RMS_dB;            /* RMS in dB to emit */
77     gdouble *decay_peak_age;    /* age of last peak */
78   };
79
80   struct _GstLevelClass
81   {
82     GstElementClass parent_class;
83     void (*level) (GstElement * element, gdouble time, gint channel,
84         gdouble RMS_dB, gdouble peak_dB, gdouble decay_peak_dB);
85   };
86
87   GType gst_level_get_type (void);
88
89 #ifdef __cplusplus
90 }
91 #endif                          /* __cplusplus */
92
93
94 #endif                          /* __GST_STEREO_H__ */