2 * Copyright (C) 2014 Collabora
3 * Author: Olivier Crete <olivier.crete@collabora.com>
5 * gstaudioaggregator.h:
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 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 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
23 #ifndef __GST_AUDIO_AGGREGATOR_H__
24 #define __GST_AUDIO_AGGREGATOR_H__
27 #include <gst/base/gstaggregator.h>
28 #include <gst/audio/audio.h>
32 /*******************************
33 * GstAudioAggregator Structs *
34 *******************************/
36 typedef struct _GstAudioAggregator GstAudioAggregator;
37 typedef struct _GstAudioAggregatorPrivate GstAudioAggregatorPrivate;
38 typedef struct _GstAudioAggregatorClass GstAudioAggregatorClass;
41 /************************
42 * GstAudioAggregatorPad API *
43 ***********************/
45 #define GST_TYPE_AUDIO_AGGREGATOR_PAD (gst_audio_aggregator_pad_get_type())
46 #define GST_AUDIO_AGGREGATOR_PAD(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_AGGREGATOR_PAD, GstAudioAggregatorPad))
47 #define GST_AUDIO_AGGREGATOR_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_AGGREGATOR_PAD, GstAudioAggregatorPadClass))
48 #define GST_AUDIO_AGGREGATOR_PAD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_AUDIO_AGGREGATOR_PAD, GstAudioAggregatorPadClass))
49 #define GST_IS_AUDIO_AGGREGATOR_PAD(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_AGGREGATOR_PAD))
50 #define GST_IS_AUDIO_AGGREGATOR_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_AGGREGATOR_PAD))
52 /****************************
53 * GstAudioAggregatorPad Structs *
54 ***************************/
56 typedef struct _GstAudioAggregatorPad GstAudioAggregatorPad;
57 typedef struct _GstAudioAggregatorPadClass GstAudioAggregatorPadClass;
58 typedef struct _GstAudioAggregatorPadPrivate GstAudioAggregatorPadPrivate;
61 * GstAudioAggregatorPad:
62 * @parent: The parent #GstAggregatorPad
63 * @info: The audio info for this pad set from the incoming caps
65 * The default implementation of GstPad used with #GstAudioAggregator
67 struct _GstAudioAggregatorPad
69 GstAggregatorPad parent;
71 /* read-only, with OBJECT_LOCK */
75 GstAudioAggregatorPadPrivate *priv;
77 gpointer _gst_reserved[GST_PADDING];
81 * GstAudioAggregatorPadClass:
82 * @convert_buffer: Convert a buffer from one format to another.
83 * @update_conversion_info: Called when either the input or output
84 * formats have changed.
86 struct _GstAudioAggregatorPadClass
88 GstAggregatorPadClass parent_class;
90 GstBuffer * (* convert_buffer) (GstAudioAggregatorPad * pad,
91 GstAudioInfo *in_info,
92 GstAudioInfo *out_info,
95 void (* update_conversion_info) (GstAudioAggregatorPad *pad);
98 gpointer _gst_reserved[GST_PADDING_LARGE];
102 GType gst_audio_aggregator_pad_get_type (void);
104 #define GST_TYPE_AUDIO_AGGREGATOR_CONVERT_PAD (gst_audio_aggregator_convert_pad_get_type())
105 #define GST_AUDIO_AGGREGATOR_CONVERT_PAD(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_AGGREGATOR_CONVERT_PAD, GstAudioAggregatorConvertPad))
106 #define GST_AUDIO_AGGREGATOR_CONVERT_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_AGGREGATOR_CONVERT_PAD, GstAudioAggregatorConvertPadClass))
107 #define GST_AUDIO_AGGREGATOR_CONVERT_PAD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_AUDIO_AGGREGATOR_CONVERT_PAD, GstAudioAggregatorConvertPadClass))
108 #define GST_IS_AUDIO_AGGREGATOR_CONVERT_PAD(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_AGGREGATOR_CONVERT_PAD))
109 #define GST_IS_AUDIO_AGGREGATOR_CONVERT_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_AGGREGATOR_CONVERT_PAD))
111 /****************************
112 * GstAudioAggregatorPad Structs *
113 ***************************/
115 typedef struct _GstAudioAggregatorConvertPad GstAudioAggregatorConvertPad;
116 typedef struct _GstAudioAggregatorConvertPadClass GstAudioAggregatorConvertPadClass;
117 typedef struct _GstAudioAggregatorConvertPadPrivate GstAudioAggregatorConvertPadPrivate;
120 * GstAudioAggregatorConvertPad:
121 * @parent: The parent #GstAudioAggregatorPad
123 * An implementation of GstPad that can be used with #GstAudioAggregator.
125 * See #GstAudioAggregator for more details.
127 struct _GstAudioAggregatorConvertPad
129 GstAudioAggregatorPad parent;
132 GstAudioAggregatorConvertPadPrivate *priv;
134 gpointer _gst_reserved[GST_PADDING];
138 * GstAudioAggregatorConvertPadClass:
141 struct _GstAudioAggregatorConvertPadClass
143 GstAudioAggregatorPadClass parent_class;
146 gpointer _gst_reserved[GST_PADDING];
150 GType gst_audio_aggregator_convert_pad_get_type (void);
152 /**************************
153 * GstAudioAggregator API *
154 **************************/
156 #define GST_TYPE_AUDIO_AGGREGATOR (gst_audio_aggregator_get_type())
157 #define GST_AUDIO_AGGREGATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_AGGREGATOR,GstAudioAggregator))
158 #define GST_AUDIO_AGGREGATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_AGGREGATOR,GstAudioAggregatorClass))
159 #define GST_AUDIO_AGGREGATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_AUDIO_AGGREGATOR,GstAudioAggregatorClass))
160 #define GST_IS_AUDIO_AGGREGATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_AGGREGATOR))
161 #define GST_IS_AUDIO_AGGREGATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_AGGREGATOR))
164 * GstAudioAggregator:
165 * @parent: The parent #GstAggregator
166 * @info: The information parsed from the current caps
167 * @current_caps: The caps set by the subclass
169 * GstAudioAggregator object
171 struct _GstAudioAggregator
173 GstAggregator parent;
175 GstCaps *current_caps;
178 GstAudioAggregatorPrivate *priv;
180 gpointer _gst_reserved[GST_PADDING];
184 * GstAudioAggregatorClass:
185 * @create_output_buffer: Create a new output buffer contains num_frames frames.
186 * @aggregate_one_buffer: Aggregates one input buffer to the output
187 * buffer. The in_offset and out_offset are in "frames", which is
188 * the size of a sample times the number of channels. Returns TRUE if
189 * any non-silence was added to the buffer
191 struct _GstAudioAggregatorClass {
192 GstAggregatorClass parent_class;
194 GstBuffer * (* create_output_buffer) (GstAudioAggregator * aagg,
196 gboolean (* aggregate_one_buffer) (GstAudioAggregator * aagg,
197 GstAudioAggregatorPad * pad, GstBuffer * inbuf, guint in_offset,
198 GstBuffer * outbuf, guint out_offset, guint num_frames);
201 gpointer _gst_reserved[GST_PADDING_LARGE];
204 /*************************
205 * GstAggregator methods *
206 ************************/
209 GType gst_audio_aggregator_get_type(void);
212 void gst_audio_aggregator_set_sink_caps (GstAudioAggregator * aagg,
213 GstAudioAggregatorPad * pad,
218 #endif /* __GST_AUDIO_AGGREGATOR_H__ */