Mercurial > mplayer.hg
annotate libaf/reorder_ch.h @ 25847:fe50eaad932d
Use the standard "static inline" instead of some broken ifdef mess
author | reimar |
---|---|
date | Sun, 27 Jan 2008 11:25:45 +0000 |
parents | dfa8a510c81c |
children | 4129c8cfa742 |
rev | line source |
---|---|
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1 /* |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
2 * common functions for reordering audio channels |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
3 * |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
4 * Copyright (C) 2007 Ulion <ulion A gmail P com> |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
5 * |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
6 * This file is part of MPlayer. |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
7 * |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
8 * MPlayer is free software; you can redistribute it and/or modify |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
10 * the Free Software Foundation; either version 2 of the License, or |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
11 * (at your option) any later version. |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
12 * |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
13 * MPlayer is distributed in the hope that it will be useful, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
16 * GNU General Public License for more details. |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
17 * |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
18 * You should have received a copy of the GNU General Public License |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
19 * along with MPlayer; if not, write to the Free Software |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
21 */ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
22 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
23 #ifndef REORDER_CH_H |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
24 #define REORDER_CH_H |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
25 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
26 // L - Left |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
27 // R - Right |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
28 // C - Center |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
29 // Ls - Left Surround |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
30 // Rs - Right Surround |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
31 // Cs - Center Surround |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
32 // Rls - Rear Left Surround |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
33 // Rrs - Rear Right Surround |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
34 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
35 #define AF_LFE (1<<7) |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
36 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
37 #define AF_CHANNEL_LAYOUT_MONO ((100<<8)|1) |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
38 #define AF_CHANNEL_LAYOUT_STEREO ((101<<8)|2) |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
39 #define AF_CHANNEL_LAYOUT_1_0 AF_CHANNEL_LAYOUT_MONO // C |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
40 #define AF_CHANNEL_LAYOUT_2_0 AF_CHANNEL_LAYOUT_STEREO // L R |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
41 #define AF_CHANNEL_LAYOUT_2_1 ((102<<8)|3) // L R LFE |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
42 #define AF_CHANNEL_LAYOUT_3_0_A ((103<<8)|3) // L R C |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
43 #define AF_CHANNEL_LAYOUT_3_0_B ((104<<8)|3) // C L R |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
44 #define AF_CHANNEL_LAYOUT_4_0_A ((105<<8)|4) // L R C Cs |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
45 #define AF_CHANNEL_LAYOUT_4_0_B ((106<<8)|4) // C L R Cs |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
46 #define AF_CHANNEL_LAYOUT_4_0_C ((107<<8)|4) // L R Ls Rs |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
47 #define AF_CHANNEL_LAYOUT_5_0_A ((108<<8)|5) // L R C Ls Rs |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
48 #define AF_CHANNEL_LAYOUT_5_0_B ((109<<8)|5) // L R Ls Rs C |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
49 #define AF_CHANNEL_LAYOUT_5_0_C ((110<<8)|5) // L C R Ls Rs |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
50 #define AF_CHANNEL_LAYOUT_5_0_D ((111<<8)|5) // C L R Ls Rs |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
51 #define AF_CHANNEL_LAYOUT_5_1_A ((112<<8)|6|AF_LFE) // L R C LFE Ls Rs |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
52 #define AF_CHANNEL_LAYOUT_5_1_B ((113<<8)|6|AF_LFE) // L R Ls Rs C LFE |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
53 #define AF_CHANNEL_LAYOUT_5_1_C ((114<<8)|6|AF_LFE) // L C R Ls Rs LFE |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
54 #define AF_CHANNEL_LAYOUT_5_1_D ((115<<8)|6|AF_LFE) // C L R Ls Rs LFE |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
55 #define AF_CHANNEL_LAYOUT_5_1_E ((116<<8)|6|AF_LFE) // LFE L C R Ls Rs |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
56 #define AF_CHANNEL_LAYOUT_6_1_A ((117<<8)|7|AF_LFE) // L R C LFE Ls Rs Cs |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
57 #define AF_CHANNEL_LAYOUT_7_1_A ((118<<8)|8|AF_LFE) // L R C LFE Ls Rs Rls Rrs |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
58 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
59 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
60 #define AF_CHANNEL_LAYOUT_ALSA_5CH_DEFAULT AF_CHANNEL_LAYOUT_5_0_B |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
61 #define AF_CHANNEL_LAYOUT_ALSA_6CH_DEFAULT AF_CHANNEL_LAYOUT_5_1_B |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
62 #define AF_CHANNEL_LAYOUT_MPLAYER_5CH_DEFAULT AF_CHANNEL_LAYOUT_ALSA_5CH_DEFAULT |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
63 #define AF_CHANNEL_LAYOUT_MPLAYER_6CH_DEFAULT AF_CHANNEL_LAYOUT_ALSA_6CH_DEFAULT |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
64 #define AF_CHANNEL_LAYOUT_AAC_5CH_DEFAULT AF_CHANNEL_LAYOUT_5_0_D |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
65 #define AF_CHANNEL_LAYOUT_AAC_6CH_DEFAULT AF_CHANNEL_LAYOUT_5_1_D |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
66 #define AF_CHANNEL_LAYOUT_WAVEEX_5CH_DEFAULT AF_CHANNEL_LAYOUT_5_0_A |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
67 #define AF_CHANNEL_LAYOUT_WAVEEX_6CH_DEFAULT AF_CHANNEL_LAYOUT_5_1_A |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
68 #define AF_CHANNEL_LAYOUT_LAVC_AC3_5CH_DEFAULT AF_CHANNEL_LAYOUT_5_0_C |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
69 #define AF_CHANNEL_LAYOUT_LAVC_AC3_6CH_DEFAULT AF_CHANNEL_LAYOUT_5_1_C |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
70 #define AF_CHANNEL_LAYOUT_LAVC_LIBA52_5CH_DEFAULT AF_CHANNEL_LAYOUT_5_0_C |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
71 #define AF_CHANNEL_LAYOUT_LAVC_LIBA52_6CH_DEFAULT AF_CHANNEL_LAYOUT_5_1_E |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
72 #define AF_CHANNEL_LAYOUT_LAVC_DCA_5CH_DEFAULT AF_CHANNEL_LAYOUT_5_0_D |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
73 #define AF_CHANNEL_LAYOUT_LAVC_DCA_6CH_DEFAULT AF_CHANNEL_LAYOUT_5_1_D |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
74 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
75 #define AF_CHANNEL_MASK 0xFF |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
76 #define AF_GET_CH_NUM(A) ((A)&0x7F) |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
77 #define AF_GET_CH_NUM_WITH_LFE(A) ((A)&0xFF) |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
78 #define AF_IS_SAME_CH_NUM(A,B) (((A)&0xFF)==((B)&0xFF)) |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
79 #define AF_IS_LAYOUT_SPECIFIED(A) ((A)&0xFFFFF800) |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
80 #define AF_IS_LAYOUT_UNSPECIFIED(A) (!AF_IS_LAYOUT_SPECIFIED(A)) |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
81 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
82 /// Optimized channel reorder between channel layouts with same channel number. |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
83 void reorder_channel_copy(void *src, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
84 int src_layout, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
85 void *dest, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
86 int dest_layout, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
87 int samples, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
88 int samplesize); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
89 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
90 /// Same with reorder_channel_copy, but works on single buffer. |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
91 void reorder_channel(void *buf, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
92 int src_layout, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
93 int dest_layout, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
94 int samples, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
95 int samplesize); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
96 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
97 // Channel layout definitions for different audio sources or targets |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
98 // When specified channel number, they will be map to the specific layouts. |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
99 #define AF_CHANNEL_LAYOUT_ALSA_DEFAULT 0 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
100 #define AF_CHANNEL_LAYOUT_AAC_DEFAULT 1 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
101 #define AF_CHANNEL_LAYOUT_WAVEEX_DEFAULT 2 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
102 #define AF_CHANNEL_LAYOUT_LAVC_AC3_DEFAULT 3 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
103 #define AF_CHANNEL_LAYOUT_LAVC_LIBA52_DEFAULT 4 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
104 #define AF_CHANNEL_LAYOUT_LAVC_DCA_DEFAULT 5 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
105 #define AF_CHANNEL_LAYOUT_SOURCE_NUM 6 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
106 #define AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT AF_CHANNEL_LAYOUT_ALSA_DEFAULT |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
107 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
108 /// Optimized channel reorder between different audio sources and targets. |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
109 void reorder_channel_copy_nch(void *src, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
110 int src_layout, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
111 void *dest, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
112 int dest_layout, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
113 int chnum, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
114 int samples, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
115 int samplesize); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
116 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
117 /// Same with reorder_channel_copy_nch, but works on single buffer. |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
118 void reorder_channel_nch(void *buf, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
119 int src_layout, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
120 int dest_layout, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
121 int chnum, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
122 int samples, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
123 int samplesize); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
124 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
125 #endif /* REORDER_CH_H */ |