1 /* 2 * Copyright (C) 2018 Centricular Ltd. 3 * Author: Nirbheek Chauhan <nirbheek@centricular.com> 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Library General Public 7 * License as published by the Free Software Foundation; either 8 * version 2 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Library General Public License for more details. 14 * 15 * You should have received a copy of the GNU Library General Public 16 * License along with this library; if not, write to the 17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, 18 * Boston, MA 02110-1301, USA. 19 */ 20 21 #ifndef __GST_AUDIOLATENCY_H__ 22 #define __GST_AUDIOLATENCY_H__ 23 24 #include <gst/gst.h> 25 26 G_BEGIN_DECLS 27 #define GST_TYPE_AUDIOLATENCY \ 28 (gst_audiolatency_get_type ()) 29 #define GST_AUDIOLATENCY(obj) \ 30 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_AUDIOLATENCY, GstAudioLatency)) 31 #define GST_AUDIOLATENCY_CLASS(klass) \ 32 (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_AUDIOLATENCY, GstAudioLatencyClass)) 33 #define GST_IS_AUDIOLATENCY(obj) \ 34 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_AUDIOLATENCY)) 35 #define GST_IS_AUDIOLATENCY_CLASS(klass) \ 36 (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_AUDIOLATENCY)) 37 typedef struct _GstAudioLatency GstAudioLatency; 38 typedef struct _GstAudioLatencyClass GstAudioLatencyClass; 39 40 #define GST_AUDIOLATENCY_NUM_LATENCIES 5 41 42 struct _GstAudioLatency 43 { 44 GstBin parent; 45 46 GstPad *sinkpad; 47 GstPad *srcpad; 48 /* audiotestsrc */ 49 GstElement *audiosrc; 50 51 /* measurements */ 52 gint64 send_pts; 53 gint64 recv_pts; 54 gint next_latency_idx; 55 gint latencies[GST_AUDIOLATENCY_NUM_LATENCIES]; 56 57 /* properties */ 58 gboolean print_latency; 59 gint samples_per_buffer; 60 }; 61 62 struct _GstAudioLatencyClass 63 { 64 GstBinClass parent_class; 65 }; 66 67 GType gst_audiolatency_get_type (void); 68 69 GST_ELEMENT_REGISTER_DECLARE (audiolatency); 70 71 G_END_DECLS 72 #endif /* __GST_AUDIOLATENCY_H__ */ 73