cleanup: Silence compilation warnings on MinGW-w64
[mplayer.git] / libaf / reorder_ch.h
blob44b533988dfa0171be69567c5def1de5d84f2633
1 /*
2 * common functions for reordering audio channels
4 * Copyright (C) 2007 Ulion <ulion A gmail P com>
6 * This file is part of MPlayer.
8 * MPlayer is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * MPlayer is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #ifndef MPLAYER_REORDER_CH_H
24 #define MPLAYER_REORDER_CH_H
26 // L - Left
27 // R - Right
28 // C - Center
29 // Ls - Left Surround
30 // Rs - Right Surround
31 // Cs - Center Surround
32 // Rls - Rear Left Surround
33 // Rrs - Rear Right Surround
35 #define AF_LFE (1<<7)
37 #define AF_CHANNEL_LAYOUT_MONO ((100<<8)|1)
38 #define AF_CHANNEL_LAYOUT_STEREO ((101<<8)|2)
39 #define AF_CHANNEL_LAYOUT_1_0 AF_CHANNEL_LAYOUT_MONO // C
40 #define AF_CHANNEL_LAYOUT_2_0 AF_CHANNEL_LAYOUT_STEREO // L R
41 #define AF_CHANNEL_LAYOUT_2_1 ((102<<8)|3) // L R LFE
42 #define AF_CHANNEL_LAYOUT_3_0_A ((103<<8)|3) // L R C
43 #define AF_CHANNEL_LAYOUT_3_0_B ((104<<8)|3) // C L R
44 #define AF_CHANNEL_LAYOUT_4_0_A ((105<<8)|4) // L R C Cs
45 #define AF_CHANNEL_LAYOUT_4_0_B ((106<<8)|4) // C L R Cs
46 #define AF_CHANNEL_LAYOUT_4_0_C ((107<<8)|4) // L R Ls Rs
47 #define AF_CHANNEL_LAYOUT_5_0_A ((108<<8)|5) // L R C Ls Rs
48 #define AF_CHANNEL_LAYOUT_5_0_B ((109<<8)|5) // L R Ls Rs C
49 #define AF_CHANNEL_LAYOUT_5_0_C ((110<<8)|5) // L C R Ls Rs
50 #define AF_CHANNEL_LAYOUT_5_0_D ((111<<8)|5) // C L R Ls Rs
51 #define AF_CHANNEL_LAYOUT_5_1_A ((112<<8)|6|AF_LFE) // L R C LFE Ls Rs
52 #define AF_CHANNEL_LAYOUT_5_1_B ((113<<8)|6|AF_LFE) // L R Ls Rs C LFE
53 #define AF_CHANNEL_LAYOUT_5_1_C ((114<<8)|6|AF_LFE) // L C R Ls Rs LFE
54 #define AF_CHANNEL_LAYOUT_5_1_D ((115<<8)|6|AF_LFE) // C L R Ls Rs LFE
55 #define AF_CHANNEL_LAYOUT_5_1_E ((116<<8)|6|AF_LFE) // LFE L C R Ls Rs
56 #define AF_CHANNEL_LAYOUT_5_1_F ((117<<8)|6|AF_LFE) // C L R LFE Ls Rs
57 #define AF_CHANNEL_LAYOUT_6_1_A ((118<<8)|7|AF_LFE) // L R C LFE Ls Rs Cs
58 #define AF_CHANNEL_LAYOUT_7_1_A ((119<<8)|8|AF_LFE) // L R C LFE Ls Rs Rls Rrs
59 #define AF_CHANNEL_LAYOUT_7_1_B ((120<<8)|8|AF_LFE) // L R Ls Rs C LFE Rls Rrs
60 #define AF_CHANNEL_LAYOUT_7_1_C ((121<<8)|8|AF_LFE) // L C R Ls Rs LFE Rls Rrs
61 #define AF_CHANNEL_LAYOUT_7_1_D ((122<<8)|8|AF_LFE) // C L R Ls Rs Rls Rrs LFE
62 #define AF_CHANNEL_LAYOUT_7_1_F ((123<<8)|8|AF_LFE) // C L R LFE Ls Rs Rls Rrs
65 #define AF_CHANNEL_LAYOUT_ALSA_5CH_DEFAULT AF_CHANNEL_LAYOUT_5_0_B
66 #define AF_CHANNEL_LAYOUT_ALSA_6CH_DEFAULT AF_CHANNEL_LAYOUT_5_1_B
67 #define AF_CHANNEL_LAYOUT_ALSA_8CH_DEFAULT AF_CHANNEL_LAYOUT_7_1_B
68 #define AF_CHANNEL_LAYOUT_MPLAYER_5CH_DEFAULT AF_CHANNEL_LAYOUT_ALSA_5CH_DEFAULT
69 #define AF_CHANNEL_LAYOUT_MPLAYER_6CH_DEFAULT AF_CHANNEL_LAYOUT_ALSA_6CH_DEFAULT
70 #define AF_CHANNEL_LAYOUT_MPLAYER_8CH_DEFAULT AF_CHANNEL_LAYOUT_ALSA_8CH_DEFAULT
71 #define AF_CHANNEL_LAYOUT_AAC_5CH_DEFAULT AF_CHANNEL_LAYOUT_5_0_D
72 #define AF_CHANNEL_LAYOUT_AAC_6CH_DEFAULT AF_CHANNEL_LAYOUT_5_1_D
73 #define AF_CHANNEL_LAYOUT_AAC_8CH_DEFAULT AF_CHANNEL_LAYOUT_7_1_D
74 #define AF_CHANNEL_LAYOUT_WAVEEX_5CH_DEFAULT AF_CHANNEL_LAYOUT_5_0_A
75 #define AF_CHANNEL_LAYOUT_WAVEEX_6CH_DEFAULT AF_CHANNEL_LAYOUT_5_1_A
76 #define AF_CHANNEL_LAYOUT_WAVEEX_8CH_DEFAULT AF_CHANNEL_LAYOUT_7_1_A
77 #define AF_CHANNEL_LAYOUT_LAVC_5CH_DEFAULT AF_CHANNEL_LAYOUT_5_0_A
78 #define AF_CHANNEL_LAYOUT_LAVC_6CH_DEFAULT AF_CHANNEL_LAYOUT_5_1_A
79 #define AF_CHANNEL_LAYOUT_LAVC_8CH_DEFAULT AF_CHANNEL_LAYOUT_7_1_A
80 #define AF_CHANNEL_LAYOUT_VORBIS_5CH_DEFAULT AF_CHANNEL_LAYOUT_5_0_C
81 #define AF_CHANNEL_LAYOUT_VORBIS_6CH_DEFAULT AF_CHANNEL_LAYOUT_5_1_C
82 #define AF_CHANNEL_LAYOUT_VORBIS_8CH_DEFAULT AF_CHANNEL_LAYOUT_7_1_C
84 #define AF_CHANNEL_MASK 0xFF
85 #define AF_GET_CH_NUM(A) ((A)&0x7F)
86 #define AF_GET_CH_NUM_WITH_LFE(A) ((A)&0xFF)
87 #define AF_IS_SAME_CH_NUM(A,B) (((A)&0xFF)==((B)&0xFF))
88 #define AF_IS_LAYOUT_SPECIFIED(A) ((A)&0xFFFFF800)
89 #define AF_IS_LAYOUT_UNSPECIFIED(A) (!AF_IS_LAYOUT_SPECIFIED(A))
91 /// Optimized channel reorder between channel layouts with same channel number.
92 void reorder_channel_copy(void *src,
93 int src_layout,
94 void *dest,
95 int dest_layout,
96 int samples,
97 int samplesize);
99 /// Same with reorder_channel_copy, but works on single buffer.
100 void reorder_channel(void *buf,
101 int src_layout,
102 int dest_layout,
103 int samples,
104 int samplesize);
106 // Channel layout definitions for different audio sources or targets
107 // When specified channel number, they will be map to the specific layouts.
108 #define AF_CHANNEL_LAYOUT_ALSA_DEFAULT 0
109 #define AF_CHANNEL_LAYOUT_AAC_DEFAULT 1
110 #define AF_CHANNEL_LAYOUT_WAVEEX_DEFAULT 2
111 #define AF_CHANNEL_LAYOUT_LAVC_DEFAULT 3
112 #define AF_CHANNEL_LAYOUT_VORBIS_DEFAULT 4
113 #define AF_CHANNEL_LAYOUT_SOURCE_NUM 5
114 #define AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT AF_CHANNEL_LAYOUT_ALSA_DEFAULT
116 /// Optimized channel reorder between different audio sources and targets.
117 void reorder_channel_copy_nch(void *src,
118 int src_layout,
119 void *dest,
120 int dest_layout,
121 int chnum,
122 int samples,
123 int samplesize);
125 /// Same with reorder_channel_copy_nch, but works on single buffer.
126 void reorder_channel_nch(void *buf,
127 int src_layout,
128 int dest_layout,
129 int chnum,
130 int samples,
131 int samplesize);
133 #endif /* MPLAYER_REORDER_CH_H */