add HDYC fourcc to rawuyvy
[mplayer/glamo.git] / libaf / reorder_ch.h
blobcd32fa780828a4a0e788797138bf6f2f25c68a57
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
61 #define AF_CHANNEL_LAYOUT_ALSA_5CH_DEFAULT AF_CHANNEL_LAYOUT_5_0_B
62 #define AF_CHANNEL_LAYOUT_ALSA_6CH_DEFAULT AF_CHANNEL_LAYOUT_5_1_B
63 #define AF_CHANNEL_LAYOUT_MPLAYER_5CH_DEFAULT AF_CHANNEL_LAYOUT_ALSA_5CH_DEFAULT
64 #define AF_CHANNEL_LAYOUT_MPLAYER_6CH_DEFAULT AF_CHANNEL_LAYOUT_ALSA_6CH_DEFAULT
65 #define AF_CHANNEL_LAYOUT_AAC_5CH_DEFAULT AF_CHANNEL_LAYOUT_5_0_D
66 #define AF_CHANNEL_LAYOUT_AAC_6CH_DEFAULT AF_CHANNEL_LAYOUT_5_1_D
67 #define AF_CHANNEL_LAYOUT_WAVEEX_5CH_DEFAULT AF_CHANNEL_LAYOUT_5_0_A
68 #define AF_CHANNEL_LAYOUT_WAVEEX_6CH_DEFAULT AF_CHANNEL_LAYOUT_5_1_A
69 #define AF_CHANNEL_LAYOUT_LAVC_5CH_DEFAULT AF_CHANNEL_LAYOUT_5_0_A
70 #define AF_CHANNEL_LAYOUT_LAVC_6CH_DEFAULT AF_CHANNEL_LAYOUT_5_1_A
71 #define AF_CHANNEL_LAYOUT_VORBIS_5CH_DEFAULT AF_CHANNEL_LAYOUT_5_0_C
72 #define AF_CHANNEL_LAYOUT_VORBIS_6CH_DEFAULT AF_CHANNEL_LAYOUT_5_1_C
73 #define AF_CHANNEL_LAYOUT_LAVC_AAC_DEC_5CH_DEFAULT AF_CHANNEL_LAYOUT_5_0_D
74 #define AF_CHANNEL_LAYOUT_LAVC_AAC_DEC_6CH_DEFAULT AF_CHANNEL_LAYOUT_5_1_F
76 #define AF_CHANNEL_MASK 0xFF
77 #define AF_GET_CH_NUM(A) ((A)&0x7F)
78 #define AF_GET_CH_NUM_WITH_LFE(A) ((A)&0xFF)
79 #define AF_IS_SAME_CH_NUM(A,B) (((A)&0xFF)==((B)&0xFF))
80 #define AF_IS_LAYOUT_SPECIFIED(A) ((A)&0xFFFFF800)
81 #define AF_IS_LAYOUT_UNSPECIFIED(A) (!AF_IS_LAYOUT_SPECIFIED(A))
83 /// Optimized channel reorder between channel layouts with same channel number.
84 void reorder_channel_copy(void *src,
85 int src_layout,
86 void *dest,
87 int dest_layout,
88 int samples,
89 int samplesize);
91 /// Same with reorder_channel_copy, but works on single buffer.
92 void reorder_channel(void *buf,
93 int src_layout,
94 int dest_layout,
95 int samples,
96 int samplesize);
98 // Channel layout definitions for different audio sources or targets
99 // When specified channel number, they will be map to the specific layouts.
100 #define AF_CHANNEL_LAYOUT_ALSA_DEFAULT 0
101 #define AF_CHANNEL_LAYOUT_AAC_DEFAULT 1
102 #define AF_CHANNEL_LAYOUT_WAVEEX_DEFAULT 2
103 #define AF_CHANNEL_LAYOUT_LAVC_DEFAULT 3
104 #define AF_CHANNEL_LAYOUT_VORBIS_DEFAULT 4
105 #define AF_CHANNEL_LAYOUT_LAVC_AAC_DEC_DEFAULT 5
106 #define AF_CHANNEL_LAYOUT_SOURCE_NUM 6
107 #define AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT AF_CHANNEL_LAYOUT_ALSA_DEFAULT
109 /// Optimized channel reorder between different audio sources and targets.
110 void reorder_channel_copy_nch(void *src,
111 int src_layout,
112 void *dest,
113 int dest_layout,
114 int chnum,
115 int samples,
116 int samplesize);
118 /// Same with reorder_channel_copy_nch, but works on single buffer.
119 void reorder_channel_nch(void *buf,
120 int src_layout,
121 int dest_layout,
122 int chnum,
123 int samples,
124 int samplesize);
126 #endif /* MPLAYER_REORDER_CH_H */