/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- *
- * gstlevel.c: signals RMS, peak and decaying peak levels
- * Copyright (C) 2000,2001,2002,2003
+ * Copyright (C) 1999 Erik Walthinsen <omega@cse.ogi.edu>
+ * Copyright (C) 2000,2001,2002,2003,2005
* Thomas Vander Stichele <thomas at apestaart dot org>
*
* This library is free software; you can redistribute it and/or
#include <gst/gst.h>
+#include <gst/base/gstbasetransform.h>
+#include <gst/audio/audio.h>
-#include "gstlevel-marshal.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+G_BEGIN_DECLS
#define GST_TYPE_LEVEL \
#define GST_LEVEL(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_LEVEL,GstLevel))
#define GST_LEVEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ULAW,GstLevel))
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_LEVEL,GstLevelClass))
+#define GST_LEVEL_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_LEVEL,GstLevelClass))
#define GST_IS_LEVEL(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_LEVEL))
-#define GST_IS_LEVEL_CLASS(obj) \
+#define GST_IS_LEVEL_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_LEVEL))
+
typedef struct _GstLevel GstLevel;
typedef struct _GstLevelClass GstLevelClass;
+/**
+ * GstLevel:
+ *
+ * Opaque data structure.
+ */
struct _GstLevel {
- GstElement element;
+ GstBaseTransform element;
- GstPad *sinkpad, *srcpad;
- gboolean signal; /* whether or not to emit signals */
- gdouble interval; /* how many seconds between emits */
+ gboolean message; /* whether or not to post messages */
+ guint64 interval; /* how many seconds between emits */
- gint rate; /* caps variables */
- gint width;
- gint channels;
+ GstAudioInfo info;
- gdouble decay_peak_ttl; /* time to live for peak in seconds */
- gdouble decay_peak_falloff; /* falloff in dB/sec */
- gdouble num_samples; /* cumulative sample count */
+ gdouble decay_peak_ttl; /* time to live for peak in seconds */
+ gdouble decay_peak_falloff; /* falloff in dB/sec */
+ gint num_frames; /* frame count (1 sample per channel)
+ * since last emit */
+ gint interval_frames; /* after how many frame to sent a message */
+ GstClockTime message_ts; /* starttime for next message */
/* per-channel arrays for intermediate values */
- gdouble *CS; /* normalized Cumulative Square */
- gdouble *peak; /* normalized Peak value over buffer */
- gdouble *last_peak; /* last normalized Peak value over interval */
- gdouble *decay_peak; /* running decaying normalized Peak */
- gdouble *MS; /* normalized Mean Square of buffer */
- gdouble *RMS_dB; /* RMS in dB to emit */
- gdouble *decay_peak_age; /* age of last peak */
+ gdouble *CS; /* normalized Cumulative Square */
+ gdouble *peak; /* normalized Peak value over buffer */
+ gdouble *last_peak; /* last normalized Peak value over interval */
+ gdouble *decay_peak; /* running decaying normalized Peak */
+ gdouble *decay_peak_base; /* value of last peak we are decaying from */
+ gdouble *MS; /* normalized Mean Square of buffer */
+ gdouble *RMS_dB; /* RMS in dB to emit */
+ GstClockTime *decay_peak_age; /* age of last peak */
+
+ void (*process)(gpointer, guint, guint, gdouble*, gdouble*);
};
struct _GstLevelClass {
- GstElementClass parent_class;
- void (*level) (GstElement *element, gdouble time, gint channel,
- gdouble RMS_dB, gdouble peak_dB, gdouble decay_peak_dB);
+ GstBaseTransformClass parent_class;
};
-GType gst_level_get_type(void);
+GType gst_level_get_type (void);
+
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
-#endif /* __GST_STEREO_H__ */
+#endif /* __GST_LEVEL_H__ */