1 /* GStreamer ReplayGain analysis
2  *
3  * Copyright (C) 2006 Rene Stadler <mail@renestadler.de>
4  * Copyright (C) 2001 David Robinson <David@Robinson.org>
5  *                    Glen Sawyer <glensawyer@hotmail.com>
6  *
7  * rganalysis.h: Analyze raw audio data in accordance with ReplayGain
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public License
11  * as published by the Free Software Foundation; either version 2.1 of
12  * the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful, but
15  * WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22  * 02110-1301 USA
23  */
24 
25 #ifndef __RG_ANALYSIS_H__
26 #define __RG_ANALYSIS_H__
27 
28 #include <glib.h>
29 #include <gst/gst.h>
30 
31 G_BEGIN_DECLS
32 
33 typedef struct _RgAnalysisCtx RgAnalysisCtx;
34 
35 RgAnalysisCtx *rg_analysis_new (void);
36 gboolean rg_analysis_set_sample_rate (RgAnalysisCtx * ctx, gint sample_rate);
37 void rg_analysis_analyze_mono_float (RgAnalysisCtx * ctx, gconstpointer data,
38     gsize size, guint depth);
39 void rg_analysis_analyze_stereo_float (RgAnalysisCtx * ctx, gconstpointer data,
40     gsize size, guint depth);
41 void rg_analysis_analyze_mono_int16 (RgAnalysisCtx * ctx, gconstpointer data,
42     gsize size, guint depth);
43 void rg_analysis_analyze_stereo_int16 (RgAnalysisCtx * ctx, gconstpointer data,
44     gsize size, guint depth);
45 void rg_analysis_analyze (RgAnalysisCtx * ctx, const gfloat * samples_l,
46     const gfloat * samples_r, guint n_samples);
47 gboolean rg_analysis_track_result (RgAnalysisCtx * ctx, gdouble * gain,
48     gdouble * peak);
49 gboolean rg_analysis_album_result (RgAnalysisCtx * ctx, gdouble * gain,
50     gdouble * peak);
51 void rg_analysis_init_silence_detection (
52     RgAnalysisCtx * ctx,
53     void (*post_message) (gpointer analysis, GstClockTime timestamp, GstClockTime duration, gdouble rglevel),
54     gpointer analysis);
55 void rg_analysis_start_buffer (RgAnalysisCtx * ctx,
56                                GstClockTime buffer_timestamp);
57 void rg_analysis_reset_album (RgAnalysisCtx * ctx);
58 void rg_analysis_reset (RgAnalysisCtx * ctx);
59 void rg_analysis_destroy (RgAnalysisCtx * ctx);
60 
61 G_END_DECLS
62 
63 #endif /* __RG_ANALYSIS_H__ */
64