1 /* GStreamer
2  * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3  *                    2000 Wim Taymans <wtay@chello.be>
4  *                    2005 Wim Taymans <wim@fluendo.com>
5  *                    2007 Andy Wingo <wingo at pobox.com>
6  *                    2008 Sebastian Dröge <slomo@circular-chaos.org>
7  *
8  * interleave.c: interleave samples, mostly based on adder
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Library General Public
12  * License as published by the Free Software Foundation; either
13  * version 2 of the License, or (at your option) any later version.
14  *
15  * This library is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  * Library General Public License for more details.
19  *
20  * You should have received a copy of the GNU Library General Public
21  * License along with this library; if not, write to the
22  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
23  * Boston, MA 02110-1301, USA.
24  */
25 
26 #ifndef __INTERLEAVE_H__
27 #define __INTERLEAVE_H__
28 
29 #include <gst/gst.h>
30 #include <gst/base/gstcollectpads.h>
31 
32 G_BEGIN_DECLS
33 
34 #define GST_TYPE_INTERLEAVE            (gst_interleave_get_type())
35 #define GST_INTERLEAVE(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_INTERLEAVE,GstInterleave))
36 #define GST_INTERLEAVE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_INTERLEAVE,GstInterleaveClass))
37 #define GST_INTERLEAVE_GET_CLASS(obj) \
38         (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_INTERLEAVE,GstInterleaveClass))
39 #define GST_IS_INTERLEAVE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_INTERLEAVE))
40 #define GST_IS_INTERLEAVE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_INTERLEAVE))
41 
42 typedef struct _GstInterleave GstInterleave;
43 typedef struct _GstInterleaveClass GstInterleaveClass;
44 
45 typedef void (*GstInterleaveFunc) (gpointer out, gpointer in, guint stride, guint nframes);
46 
47 struct _GstInterleave
48 {
49   GstElement element;
50 
51   /*< private >*/
52   GstCollectPads *collect;
53 
54   gint channels;
55   gint padcounter;
56   gint rate;
57   gint width;
58 
59   GValueArray *channel_positions;
60   GValueArray *input_channel_positions;
61   gboolean channel_positions_from_input;
62 
63   gint default_channels_ordering_map[64];
64   guint64 channel_mask;
65 
66   GstCaps *sinkcaps;
67   gint configured_sinkpads_counter;
68 
69   GstClockTime timestamp;
70   guint64 offset;
71 
72   GstEvent *pending_segment;
73 
74   GstInterleaveFunc func;
75 
76   GstPad *src;
77 
78   gboolean send_stream_start;
79 };
80 
81 struct _GstInterleaveClass
82 {
83   GstElementClass parent_class;
84 };
85 
86 GType gst_interleave_get_type (void);
87 
88 G_END_DECLS
89 
90 #endif /* __INTERLEAVE_H__ */
91