1 /* GStreamer
2  * Copyright (C) 2004 Ronald Bultje <rbultje@ronald.bitfreak.net>
3  *           (C) 2015 Wim Taymans <wim.taymans@gmail.com>
4  *
5  * audio-channel-mixer.h: setup of channel conversion matrices
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_CHANNEL_MIXER_H__
24 #define __GST_AUDIO_CHANNEL_MIXER_H__
25 
26 #include <gst/gst.h>
27 #include <gst/audio/audio.h>
28 
29 typedef struct _GstAudioChannelMixer GstAudioChannelMixer;
30 
31 /**
32  * GstAudioChannelMixerFlags:
33  * @GST_AUDIO_CHANNEL_MIXER_FLAGS_NONE: no flag
34  * @GST_AUDIO_CHANNEL_MIXER_FLAGS_NON_INTERLEAVED_IN: input channels are not interleaved
35  * @GST_AUDIO_CHANNEL_MIXER_FLAGS_NON_INTERLEAVED_OUT: output channels are not interleaved
36  * @GST_AUDIO_CHANNEL_MIXER_FLAGS_UNPOSITIONED_IN: input channels are explicitly unpositioned
37  * @GST_AUDIO_CHANNEL_MIXER_FLAGS_UNPOSITIONED_OUT: output channels are explicitly unpositioned
38  *
39  * Flags passed to gst_audio_channel_mixer_new()
40  */
41 typedef enum {
42   GST_AUDIO_CHANNEL_MIXER_FLAGS_NONE                = 0,
43   GST_AUDIO_CHANNEL_MIXER_FLAGS_NON_INTERLEAVED_IN  = (1 << 0),
44   GST_AUDIO_CHANNEL_MIXER_FLAGS_NON_INTERLEAVED_OUT = (1 << 1),
45   GST_AUDIO_CHANNEL_MIXER_FLAGS_UNPOSITIONED_IN     = (1 << 2),
46   GST_AUDIO_CHANNEL_MIXER_FLAGS_UNPOSITIONED_OUT    = (1 << 3)
47 } GstAudioChannelMixerFlags;
48 
49 GST_AUDIO_API
50 GstAudioChannelMixer * gst_audio_channel_mixer_new   (GstAudioChannelMixerFlags flags,
51                                                       GstAudioFormat format,
52                                                       gint in_channels,
53                                                       GstAudioChannelPosition *in_position,
54                                                       gint out_channels,
55                                                       GstAudioChannelPosition *out_position);
56 
57 GST_AUDIO_API
58 GstAudioChannelMixer * gst_audio_channel_mixer_new_with_matrix (GstAudioChannelMixerFlags flags,
59                                                                 GstAudioFormat format,
60                                                                 gint in_channels,
61                                                                 gint out_channels,
62                                                                 gfloat **matrix);
63 
64 GST_AUDIO_API
65 void                   gst_audio_channel_mixer_free  (GstAudioChannelMixer *mix);
66 
67 /*
68  * Checks for passthrough (= identity matrix).
69  */
70 
71 GST_AUDIO_API
72 gboolean        gst_audio_channel_mixer_is_passthrough  (GstAudioChannelMixer *mix);
73 
74 /*
75  * Do actual mixing.
76  */
77 
78 GST_AUDIO_API
79 void            gst_audio_channel_mixer_samples   (GstAudioChannelMixer * mix,
80                                                    const gpointer         in[],
81                                                    gpointer               out[],
82                                                    gint                   samples);
83 
84 #endif /* __GST_AUDIO_CHANNEL_MIXER_H__ */
85