annotate libaf/reorder_ch.h @ 30804:6ea2911ebebf

Reuse fb_tty_fd for setting up the text area. This avoids the fopen call which could end up creating a /dev/tty file if it did not exist.
author reimar
date Fri, 05 Mar 2010 20:15:16 +0000
parents 4eae69f3f4f4
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25315
diff changeset
23 #ifndef MPLAYER_REORDER_CH_H
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25315
diff changeset
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
29491
99eda963d27a Fix incorrect channel ordering for lavc audio codecs (specifically ffac3,
tack
parents: 27700
diff changeset
56 #define AF_CHANNEL_LAYOUT_5_1_F ((117<<8)|6|AF_LFE) // C L R LFE Ls Rs
99eda963d27a Fix incorrect channel ordering for lavc audio codecs (specifically ffac3,
tack
parents: 27700
diff changeset
57 #define AF_CHANNEL_LAYOUT_6_1_A ((118<<8)|7|AF_LFE) // L R C LFE Ls Rs Cs
99eda963d27a Fix incorrect channel ordering for lavc audio codecs (specifically ffac3,
tack
parents: 27700
diff changeset
58 #define AF_CHANNEL_LAYOUT_7_1_A ((119<<8)|8|AF_LFE) // L R C LFE Ls Rs Rls Rrs
29826
4eae69f3f4f4 Add support for 8 channel audio.
tack
parents: 29780
diff changeset
59 #define AF_CHANNEL_LAYOUT_7_1_B ((120<<8)|8|AF_LFE) // L R Ls Rs C LFE Rls Rrs
4eae69f3f4f4 Add support for 8 channel audio.
tack
parents: 29780
diff changeset
60 #define AF_CHANNEL_LAYOUT_7_1_C ((121<<8)|8|AF_LFE) // L C R Ls Rs LFE Rls Rrs
4eae69f3f4f4 Add support for 8 channel audio.
tack
parents: 29780
diff changeset
61 #define AF_CHANNEL_LAYOUT_7_1_D ((122<<8)|8|AF_LFE) // C L R Ls Rs Rls Rrs LFE
4eae69f3f4f4 Add support for 8 channel audio.
tack
parents: 29780
diff changeset
62 #define AF_CHANNEL_LAYOUT_7_1_F ((123<<8)|8|AF_LFE) // C L R LFE Ls Rs Rls Rrs
25315
dfa8a510c81c Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff changeset
63
dfa8a510c81c Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff changeset
64
dfa8a510c81c Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff changeset
65 #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
66 #define AF_CHANNEL_LAYOUT_ALSA_6CH_DEFAULT AF_CHANNEL_LAYOUT_5_1_B
29826
4eae69f3f4f4 Add support for 8 channel audio.
tack
parents: 29780
diff changeset
67 #define AF_CHANNEL_LAYOUT_ALSA_8CH_DEFAULT AF_CHANNEL_LAYOUT_7_1_B
25315
dfa8a510c81c Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff changeset
68 #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
69 #define AF_CHANNEL_LAYOUT_MPLAYER_6CH_DEFAULT AF_CHANNEL_LAYOUT_ALSA_6CH_DEFAULT
29826
4eae69f3f4f4 Add support for 8 channel audio.
tack
parents: 29780
diff changeset
70 #define AF_CHANNEL_LAYOUT_MPLAYER_8CH_DEFAULT AF_CHANNEL_LAYOUT_ALSA_8CH_DEFAULT
25315
dfa8a510c81c Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff changeset
71 #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
72 #define AF_CHANNEL_LAYOUT_AAC_6CH_DEFAULT AF_CHANNEL_LAYOUT_5_1_D
29826
4eae69f3f4f4 Add support for 8 channel audio.
tack
parents: 29780
diff changeset
73 #define AF_CHANNEL_LAYOUT_AAC_8CH_DEFAULT AF_CHANNEL_LAYOUT_7_1_D
25315
dfa8a510c81c Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff changeset
74 #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
75 #define AF_CHANNEL_LAYOUT_WAVEEX_6CH_DEFAULT AF_CHANNEL_LAYOUT_5_1_A
29826
4eae69f3f4f4 Add support for 8 channel audio.
tack
parents: 29780
diff changeset
76 #define AF_CHANNEL_LAYOUT_WAVEEX_8CH_DEFAULT AF_CHANNEL_LAYOUT_7_1_A
29491
99eda963d27a Fix incorrect channel ordering for lavc audio codecs (specifically ffac3,
tack
parents: 27700
diff changeset
77 #define AF_CHANNEL_LAYOUT_LAVC_5CH_DEFAULT AF_CHANNEL_LAYOUT_5_0_A
99eda963d27a Fix incorrect channel ordering for lavc audio codecs (specifically ffac3,
tack
parents: 27700
diff changeset
78 #define AF_CHANNEL_LAYOUT_LAVC_6CH_DEFAULT AF_CHANNEL_LAYOUT_5_1_A
29826
4eae69f3f4f4 Add support for 8 channel audio.
tack
parents: 29780
diff changeset
79 #define AF_CHANNEL_LAYOUT_LAVC_8CH_DEFAULT AF_CHANNEL_LAYOUT_7_1_A
26987
d3a0f537dbe8 rename AF_CHANNEL_LAYOUT_LAVC_VORBIS* => AF_CHANNEL_LAYOUT_VORBIS*.
ulion
parents: 26740
diff changeset
80 #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
81 #define AF_CHANNEL_LAYOUT_VORBIS_6CH_DEFAULT AF_CHANNEL_LAYOUT_5_1_C
29826
4eae69f3f4f4 Add support for 8 channel audio.
tack
parents: 29780
diff changeset
82 #define AF_CHANNEL_LAYOUT_VORBIS_8CH_DEFAULT AF_CHANNEL_LAYOUT_7_1_C
25315
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 #define AF_CHANNEL_MASK 0xFF
dfa8a510c81c Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff changeset
85 #define AF_GET_CH_NUM(A) ((A)&0x7F)
dfa8a510c81c Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff changeset
86 #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
87 #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
88 #define AF_IS_LAYOUT_SPECIFIED(A) ((A)&0xFFFFF800)
dfa8a510c81c Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff changeset
89 #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
90
dfa8a510c81c Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff changeset
91 /// 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
92 void reorder_channel_copy(void *src,
dfa8a510c81c Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff changeset
93 int src_layout,
dfa8a510c81c Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff changeset
94 void *dest,
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 /// 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
100 void reorder_channel(void *buf,
dfa8a510c81c Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff changeset
101 int src_layout,
dfa8a510c81c Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff changeset
102 int dest_layout,
dfa8a510c81c Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff changeset
103 int samples,
dfa8a510c81c Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff changeset
104 int samplesize);
dfa8a510c81c Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff changeset
105
dfa8a510c81c Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff changeset
106 // 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
107 // When specified channel number, they will be map to the specific layouts.
29492
869c68891fde Cosmetics: adjust alignment.
tack
parents: 29491
diff changeset
108 #define AF_CHANNEL_LAYOUT_ALSA_DEFAULT 0
869c68891fde Cosmetics: adjust alignment.
tack
parents: 29491
diff changeset
109 #define AF_CHANNEL_LAYOUT_AAC_DEFAULT 1
869c68891fde Cosmetics: adjust alignment.
tack
parents: 29491
diff changeset
110 #define AF_CHANNEL_LAYOUT_WAVEEX_DEFAULT 2
29491
99eda963d27a Fix incorrect channel ordering for lavc audio codecs (specifically ffac3,
tack
parents: 27700
diff changeset
111 #define AF_CHANNEL_LAYOUT_LAVC_DEFAULT 3
99eda963d27a Fix incorrect channel ordering for lavc audio codecs (specifically ffac3,
tack
parents: 27700
diff changeset
112 #define AF_CHANNEL_LAYOUT_VORBIS_DEFAULT 4
29780
816c1f02ebfe reorder_ch: Remove unneeded AF_CHANNEL_LAYOUT_LAVC_AAC_DEC_*
tack
parents: 29492
diff changeset
113 #define AF_CHANNEL_LAYOUT_SOURCE_NUM 5
25315
dfa8a510c81c Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff changeset
114 #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
115
dfa8a510c81c Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff changeset
116 /// 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
117 void reorder_channel_copy_nch(void *src,
dfa8a510c81c Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff changeset
118 int src_layout,
dfa8a510c81c Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff changeset
119 void *dest,
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 /// 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
126 void reorder_channel_nch(void *buf,
dfa8a510c81c Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff changeset
127 int src_layout,
dfa8a510c81c Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff changeset
128 int dest_layout,
dfa8a510c81c Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff changeset
129 int chnum,
dfa8a510c81c Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff changeset
130 int samples,
dfa8a510c81c Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff changeset
131 int samplesize);
dfa8a510c81c Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff changeset
132
26029
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25315
diff changeset
133 #endif /* MPLAYER_REORDER_CH_H */