gavl
|
00001 /***************************************************************** 00002 * gavl - a general purpose audio/video processing library 00003 * 00004 * Copyright (c) 2001 - 2012 Members of the Gmerlin project 00005 * gmerlin-general@lists.sourceforge.net 00006 * http://gmerlin.sourceforge.net 00007 * 00008 * This program is free software: you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation, either version 2 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * This program is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00020 * *****************************************************************/ 00021 00027 #ifndef GAVL_PEAKDETECTORS_H_INCLUDED 00028 #define GAVL_PEAKDETECTORS_H_INCLUDED 00029 00030 #include <gavl/connectors.h> 00031 00032 #ifdef __cplusplus 00033 extern "C" { 00034 #endif 00035 00051 typedef struct gavl_peak_detector_s gavl_peak_detector_t; 00052 00053 /* Create / destroy */ 00054 00065 typedef void (*gavl_update_peak_callback)(void * priv, 00066 int samples, 00067 double min, double max, double abs); 00068 00079 typedef void (*gavl_update_peaks_callback)(void * priv, 00080 int samples, 00081 const double * min, 00082 const double * max, 00083 const double * abs); 00084 00089 GAVL_PUBLIC 00090 gavl_peak_detector_t * gavl_peak_detector_create(); 00091 00101 GAVL_PUBLIC 00102 void gavl_peak_detector_set_callbacks(gavl_peak_detector_t * pd, 00103 gavl_update_peak_callback peak_callback, 00104 gavl_update_peaks_callback peaks_callback, 00105 void * priv); 00106 00107 00112 GAVL_PUBLIC 00113 void gavl_peak_detector_destroy(gavl_peak_detector_t *pd); 00114 00123 GAVL_PUBLIC 00124 void gavl_peak_detector_set_format(gavl_peak_detector_t *pd, 00125 const gavl_audio_format_t * format); 00126 00134 GAVL_PUBLIC const gavl_audio_format_t * 00135 gavl_peak_detector_get_format(gavl_peak_detector_t * pd); 00136 00137 00143 GAVL_PUBLIC 00144 void gavl_peak_detector_update(gavl_peak_detector_t *pd, 00145 gavl_audio_frame_t * frame); 00146 00157 GAVL_PUBLIC 00158 gavl_audio_sink_t * gavl_peak_detector_get_sink(gavl_peak_detector_t *pd); 00159 00171 GAVL_PUBLIC 00172 void gavl_peak_detector_get_peak(gavl_peak_detector_t * pd, 00173 double * min, double * max, 00174 double * abs); 00175 00187 GAVL_PUBLIC 00188 void gavl_peak_detector_get_peaks(gavl_peak_detector_t * pd, 00189 double * min, double * max, 00190 double * abs); 00191 00196 GAVL_PUBLIC 00197 void gavl_peak_detector_reset(gavl_peak_detector_t * pd); 00198 00205 #ifdef __cplusplus 00206 } 00207 #endif 00208 00209 #endif // GAVL_PEAKDETECTORS_H_INCLUDED