1 /* 2 * GStreamer 3 * Copyright (C) 2016 Sebastian Dröge <sebastian@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_AUDIO_BUFFER_SPLIT_H__ 22 #define __GST_AUDIO_BUFFER_SPLIT_H__ 23 24 #include <gst/gst.h> 25 #include <gst/base/base.h> 26 #include <gst/audio/audio.h> 27 28 G_BEGIN_DECLS 29 30 #define GST_TYPE_AUDIO_BUFFER_SPLIT (gst_audio_buffer_split_get_type()) 31 #define GST_AUDIO_BUFFER_SPLIT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_BUFFER_SPLIT,GstAudioBufferSplit)) 32 #define GST_IS_AUDIO_BUFFER_SPLIT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_BUFFER_SPLIT)) 33 #define GST_AUDIO_BUFFER_SPLIT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_AUDIO_BUFFER_SPLIT,GstAudioBufferSplitClass)) 34 #define GST_IS_AUDIO_BUFFER_SPLIT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_AUDIO_BUFFER_SPLIT)) 35 #define GST_AUDIO_BUFFER_SPLIT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_AUDIO_BUFFER_SPLIT,GstAudioBufferSplitClass)) 36 37 typedef struct _GstAudioBufferSplit GstAudioBufferSplit; 38 typedef struct _GstAudioBufferSplitClass GstAudioBufferSplitClass; 39 40 struct _GstAudioBufferSplit { 41 GstElement parent; 42 43 GstPad *srcpad, *sinkpad; 44 45 /* Properties */ 46 gint output_buffer_duration_n; 47 gint output_buffer_duration_d; 48 guint output_buffer_size; 49 50 /* State */ 51 GstSegment in_segment, out_segment; 52 guint32 segment_seqnum; 53 gboolean segment_pending; 54 GstAudioInfo info; 55 56 GstAdapter *adapter; 57 58 GstAudioStreamAlign *stream_align; 59 GstClockTime resync_pts, resync_rt; 60 guint64 current_offset; /* offset from start time in samples */ 61 guint64 drop_samples; /* number of samples to drop in gapless mode */ 62 63 guint samples_per_buffer; 64 guint error_per_buffer; 65 guint accumulated_error; 66 67 gboolean strict_buffer_size; 68 gboolean gapless; 69 GstClockTime max_silence_time; 70 }; 71 72 struct _GstAudioBufferSplitClass { 73 GstElementClass parent_class; 74 }; 75 76 GType gst_audio_buffer_split_get_type (void); 77 GST_ELEMENT_REGISTER_DECLARE (audiobuffersplit); 78 79 G_END_DECLS 80 81 #endif /* __GST_AUDIO_BUFFER_SPLIT_H__ */ 82