audioaggregator: remove GstAudioAggregator->info
[platform/upstream/gstreamer.git] / gst-libs / gst / audio / gstaudioaggregator.h
1 /* GStreamer
2  * Copyright (C) 2014 Collabora
3  *   Author: Olivier Crete <olivier.crete@collabora.com>
4  *
5  * gstaudioaggregator.h:
6  *
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.
11  *
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.
16  *
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.
21  */
22
23 #ifndef __GST_AUDIO_AGGREGATOR_H__
24 #define __GST_AUDIO_AGGREGATOR_H__
25
26 #include <gst/gst.h>
27 #include <gst/base/gstaggregator.h>
28 #include <gst/audio/audio.h>
29
30 G_BEGIN_DECLS
31
32 /*******************************
33  * GstAudioAggregator Structs  *
34  *******************************/
35
36 typedef struct _GstAudioAggregator GstAudioAggregator;
37 typedef struct _GstAudioAggregatorPrivate GstAudioAggregatorPrivate;
38 typedef struct _GstAudioAggregatorClass GstAudioAggregatorClass;
39
40
41 /************************
42  * GstAudioAggregatorPad API *
43  ***********************/
44
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))
51
52 /****************************
53  * GstAudioAggregatorPad Structs *
54  ***************************/
55
56 typedef struct _GstAudioAggregatorPad GstAudioAggregatorPad;
57 typedef struct _GstAudioAggregatorPadClass GstAudioAggregatorPadClass;
58 typedef struct _GstAudioAggregatorPadPrivate GstAudioAggregatorPadPrivate;
59
60 /**
61  * GstAudioAggregatorPad:
62  * @parent: The parent #GstAggregatorPad
63  * @info: The audio info for this pad set from the incoming caps
64  *
65  * The default implementation of GstPad used with #GstAudioAggregator
66  */
67 struct _GstAudioAggregatorPad
68 {
69   GstAggregatorPad                  parent;
70
71   /* read-only, with OBJECT_LOCK */
72   GstAudioInfo                      info;
73
74   /*< private >*/
75   GstAudioAggregatorPadPrivate     *priv;
76
77   gpointer _gst_reserved[GST_PADDING];
78 };
79
80 /**
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.
85  */
86 struct _GstAudioAggregatorPadClass
87   {
88   GstAggregatorPadClass   parent_class;
89
90   GstBuffer * (* convert_buffer) (GstAudioAggregatorPad * pad,
91                                   GstAudioInfo *in_info,
92                                   GstAudioInfo *out_info,
93                                   GstBuffer * buffer);
94
95   void        (* update_conversion_info) (GstAudioAggregatorPad *pad);
96
97   /*< private >*/
98   gpointer      _gst_reserved[GST_PADDING_LARGE];
99 };
100
101 GST_EXPORT
102 GType gst_audio_aggregator_pad_get_type           (void);
103
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))
110
111 /****************************
112  * GstAudioAggregatorPad Structs *
113  ***************************/
114
115 typedef struct _GstAudioAggregatorConvertPad GstAudioAggregatorConvertPad;
116 typedef struct _GstAudioAggregatorConvertPadClass GstAudioAggregatorConvertPadClass;
117 typedef struct _GstAudioAggregatorConvertPadPrivate GstAudioAggregatorConvertPadPrivate;
118
119 /**
120  * GstAudioAggregatorConvertPad:
121  * @parent: The parent #GstAudioAggregatorPad
122  *
123  * An implementation of GstPad that can be used with #GstAudioAggregator.
124  *
125  * See #GstAudioAggregator for more details.
126  */
127 struct _GstAudioAggregatorConvertPad
128 {
129   GstAudioAggregatorPad                  parent;
130
131   /*< private >*/
132   GstAudioAggregatorConvertPadPrivate   *priv;
133
134   gpointer _gst_reserved[GST_PADDING];
135 };
136
137 /**
138  * GstAudioAggregatorConvertPadClass:
139  *
140  */
141 struct _GstAudioAggregatorConvertPadClass
142 {
143   GstAudioAggregatorPadClass   parent_class;
144
145   /*< private >*/
146   gpointer      _gst_reserved[GST_PADDING];
147 };
148
149 GST_EXPORT
150 GType gst_audio_aggregator_convert_pad_get_type           (void);
151
152 /**************************
153  * GstAudioAggregator API *
154  **************************/
155
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))
162
163 /**
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
168  *
169  * GstAudioAggregator object
170  */
171 struct _GstAudioAggregator
172 {
173   GstAggregator              parent;
174
175   GstCaps                   *current_caps;
176
177   /*< private >*/
178   GstAudioAggregatorPrivate *priv;
179
180   gpointer                  _gst_reserved[GST_PADDING];
181 };
182
183 /**
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
190  */
191 struct _GstAudioAggregatorClass {
192   GstAggregatorClass   parent_class;
193
194   GstBuffer * (* create_output_buffer) (GstAudioAggregator * aagg,
195       guint num_frames);
196   gboolean (* aggregate_one_buffer) (GstAudioAggregator * aagg,
197       GstAudioAggregatorPad * pad, GstBuffer * inbuf, guint in_offset,
198       GstBuffer * outbuf, guint out_offset, guint num_frames);
199
200   /*< private >*/
201   gpointer          _gst_reserved[GST_PADDING_LARGE];
202 };
203
204 /*************************
205  * GstAggregator methods *
206  ************************/
207
208 GST_EXPORT
209 GType gst_audio_aggregator_get_type(void);
210
211 GST_EXPORT
212 void  gst_audio_aggregator_set_sink_caps (GstAudioAggregator    * aagg,
213                                           GstAudioAggregatorPad * pad,
214                                           GstCaps               * caps);
215
216 G_END_DECLS
217
218 #endif /* __GST_AUDIO_AGGREGATOR_H__ */