Mercurial > mplayer.hg
annotate libaf/reorder_ch.h @ 27111:4899f42d1c94
Make sure we do not use uninitialized data in case of a short read.
Not really relevant but fixes bug #1109
author | reimar |
---|---|
date | Sun, 29 Jun 2008 07:34:44 +0000 |
parents | d3a0f537dbe8 |
children | e65738d7dd3b |
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 * |
26740
b3a38b361fef
Use standard license headers with standard formatting.
diego
parents:
26132
diff
changeset
|
18 * You should have received a copy of the GNU General Public License along |
b3a38b361fef
Use standard license headers with standard formatting.
diego
parents:
26132
diff
changeset
|
19 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
b3a38b361fef
Use standard license headers with standard formatting.
diego
parents:
26132
diff
changeset
|
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
25315
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 |
26029 | 23 #ifndef MPLAYER_REORDER_CH_H |
24 #define MPLAYER_REORDER_CH_H | |
25315
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 |
26987
d3a0f537dbe8
rename AF_CHANNEL_LAYOUT_LAVC_VORBIS* => AF_CHANNEL_LAYOUT_VORBIS*.
ulion
parents:
26740
diff
changeset
|
74 #define AF_CHANNEL_LAYOUT_VORBIS_5CH_DEFAULT AF_CHANNEL_LAYOUT_5_0_C |
d3a0f537dbe8
rename AF_CHANNEL_LAYOUT_LAVC_VORBIS* => AF_CHANNEL_LAYOUT_VORBIS*.
ulion
parents:
26740
diff
changeset
|
75 #define AF_CHANNEL_LAYOUT_VORBIS_6CH_DEFAULT AF_CHANNEL_LAYOUT_5_1_C |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
76 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
77 #define AF_CHANNEL_MASK 0xFF |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
78 #define AF_GET_CH_NUM(A) ((A)&0x7F) |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
79 #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
|
80 #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
|
81 #define AF_IS_LAYOUT_SPECIFIED(A) ((A)&0xFFFFF800) |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
82 #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
|
83 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
84 /// 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
|
85 void reorder_channel_copy(void *src, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
86 int src_layout, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
87 void *dest, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
88 int dest_layout, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
89 int samples, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
90 int samplesize); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
91 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
92 /// 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
|
93 void reorder_channel(void *buf, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
94 int src_layout, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
95 int dest_layout, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
96 int samples, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
97 int samplesize); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
98 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
99 // 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
|
100 // 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
|
101 #define AF_CHANNEL_LAYOUT_ALSA_DEFAULT 0 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
102 #define AF_CHANNEL_LAYOUT_AAC_DEFAULT 1 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
103 #define AF_CHANNEL_LAYOUT_WAVEEX_DEFAULT 2 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
104 #define AF_CHANNEL_LAYOUT_LAVC_AC3_DEFAULT 3 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
105 #define AF_CHANNEL_LAYOUT_LAVC_LIBA52_DEFAULT 4 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
106 #define AF_CHANNEL_LAYOUT_LAVC_DCA_DEFAULT 5 |
26987
d3a0f537dbe8
rename AF_CHANNEL_LAYOUT_LAVC_VORBIS* => AF_CHANNEL_LAYOUT_VORBIS*.
ulion
parents:
26740
diff
changeset
|
107 #define AF_CHANNEL_LAYOUT_VORBIS_DEFAULT 6 |
26132
b6280829f7f8
Fix ffvorbis decoder's output channel order with channel reordering function.
ulion
parents:
26029
diff
changeset
|
108 #define AF_CHANNEL_LAYOUT_SOURCE_NUM 7 |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
109 #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
|
110 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
111 /// 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
|
112 void reorder_channel_copy_nch(void *src, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
113 int src_layout, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
114 void *dest, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
115 int dest_layout, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
116 int chnum, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
117 int samples, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
118 int samplesize); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
119 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
120 /// 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
|
121 void reorder_channel_nch(void *buf, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
122 int src_layout, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
123 int dest_layout, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
124 int chnum, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
125 int samples, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
126 int samplesize); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
127 |
26029 | 128 #endif /* MPLAYER_REORDER_CH_H */ |