2 * WebRTC Audio Processing Elements
4 * Copyright 2016 Collabora Ltd
5 * @author: Nicolas Dufresne <nicolas.dufresne@collabora.com>
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 #ifndef __GST_WEBRTC_ECHO_PROBE_H__
24 #define __GST_WEBRTC_ECHO_PROBE_H__
27 #include <gst/base/gstadapter.h>
28 #include <gst/base/gstbasetransform.h>
29 #include <gst/audio/audio.h>
31 #ifndef GST_USE_UNSTABLE_API
32 #define GST_USE_UNSTABLE_API
34 #include <gst/audio/gstplanaraudioadapter.h>
38 #define GST_TYPE_WEBRTC_ECHO_PROBE (gst_webrtc_echo_probe_get_type())
39 #define GST_WEBRTC_ECHO_PROBE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_WEBRTC_ECHO_PROBE,GstWebrtcEchoProbe))
40 #define GST_IS_WEBRTC_ECHO_PROBE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_WEBRTC_ECHO_PROBE))
41 #define GST_WEBRTC_ECHO_PROBE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_WEBRTC_ECHO_PROBE,GstWebrtcEchoProbeClass))
42 #define GST_IS_WEBRTC_ECHO_PROBE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_WEBRTC_ECHO_PROBE))
43 #define GST_WEBRTC_ECHO_PROBE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_WEBRTC_ECHO_PROBE,GstWebrtcEchoProbeClass))
45 #define GST_WEBRTC_ECHO_PROBE_LOCK(obj) g_mutex_lock (&GST_WEBRTC_ECHO_PROBE (obj)->lock)
46 #define GST_WEBRTC_ECHO_PROBE_UNLOCK(obj) g_mutex_unlock (&GST_WEBRTC_ECHO_PROBE (obj)->lock)
48 typedef struct _GstWebrtcEchoProbe GstWebrtcEchoProbe;
49 typedef struct _GstWebrtcEchoProbeClass GstWebrtcEchoProbeClass;
54 * The adder object structure.
56 struct _GstWebrtcEchoProbe
58 GstAudioFilter parent;
60 /* This lock is required as the DSP may need to lock itself using it's
61 * object lock and also lock the probe. The natural order for the DSP is
62 * to lock the DSP and then the echo probe. If we where using the probe
63 * object lock, we'd be racing with GstBin which will lock sink to src,
64 * and may accidentally reverse the order. */
67 /* Protected by the lock */
77 GstPlanarAudioAdapter *padapter;
83 struct _GstWebrtcEchoProbeClass
85 GstAudioFilterClass parent_class;
88 GType gst_webrtc_echo_probe_get_type (void);
90 GstWebrtcEchoProbe *gst_webrtc_acquire_echo_probe (const gchar * name);
91 void gst_webrtc_release_echo_probe (GstWebrtcEchoProbe * probe);
92 gint gst_webrtc_echo_probe_read (GstWebrtcEchoProbe * self,
93 GstClockTime rec_time, gpointer frame, GstBuffer ** buf);
96 #endif /* __GST_WEBRTC_ECHO_PROBE_H__ */