1 /*****************************************************************************
2 * codecs.h: codec related structures needed by the demuxers and decoders
3 *****************************************************************************
4 * Copyright (C) 1999-2001 VideoLAN
7 * Author: Gildas Bazin <gbazin@videolan.org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
22 *****************************************************************************/
25 #define _VLC_CODECS_H 1
27 /* Structures exported to the demuxers and decoders */
29 #if !(defined _GUID_DEFINED || defined GUID_DEFINED)
37 } GUID, *REFGUID, *LPGUID;
38 #endif /* GUID_DEFINED */
40 #ifndef _WAVEFORMATEX_
41 #define _WAVEFORMATEX_
43 #ifdef HAVE_ATTRIBUTE_PACKED
44 __attribute__((__packed__))
49 uint32_t nSamplesPerSec;
50 uint32_t nAvgBytesPerSec;
52 uint16_t wBitsPerSample;
54 } WAVEFORMATEX, *PWAVEFORMATEX, *NPWAVEFORMATEX, *LPWAVEFORMATEX;
55 #endif /* _WAVEFORMATEX_ */
57 #ifndef _WAVEFORMATEXTENSIBLE_
58 #define _WAVEFORMATEXTENSIBLE_
60 #ifdef HAVE_ATTRIBUTE_PACKED
61 __attribute__((__packed__))
63 _WAVEFORMATEXTENSIBLE {
66 uint16_t wValidBitsPerSample;
67 uint16_t wSamplesPerBlock;
70 uint32_t dwChannelMask;
72 } WAVEFORMATEXTENSIBLE, *PWAVEFORMATEXTENSIBLE;
73 #endif /* _WAVEFORMATEXTENSIBLE_ */
78 #ifdef HAVE_ATTRIBUTE_PACKED
79 __attribute__((__packed__))
86 uint32_t SubChunkLength;
91 uint16_t BytesPerSample;
92 uint16_t BitsPerSample;
96 #endif /* _WAVEHEADER_ */
98 #if !defined(_BITMAPINFOHEADER_) && !defined(WIN32)
99 #define _BITMAPINFOHEADER_
101 #ifdef HAVE_ATTRIBUTE_PACKED
102 __attribute__((__packed__))
110 uint32_t biCompression;
111 uint32_t biSizeImage;
112 uint32_t biXPelsPerMeter;
113 uint32_t biYPelsPerMeter;
115 uint32_t biClrImportant;
116 } BITMAPINFOHEADER, *PBITMAPINFOHEADER, *LPBITMAPINFOHEADER;
118 BITMAPINFOHEADER bmiHeader;
120 } BITMAPINFO, *LPBITMAPINFO;
126 #ifdef HAVE_ATTRIBUTE_PACKED
127 __attribute__((__packed__))
130 int left, top, right, bottom;
134 #ifndef _REFERENCE_TIME_
135 #define _REFERENCE_TIME_
136 typedef int64_t REFERENCE_TIME;
139 #ifndef _VIDEOINFOHEADER_
140 #define _VIDEOINFOHEADER_
142 #ifdef HAVE_ATTRIBUTE_PACKED
143 __attribute__((__packed__))
149 uint32_t dwBitErrorRate;
150 REFERENCE_TIME AvgTimePerFrame;
151 BITMAPINFOHEADER bmiHeader;
156 /* WAVE format wFormatTag IDs */
157 #define WAVE_FORMAT_UNKNOWN 0x0000 /* Microsoft Corporation */
158 #define WAVE_FORMAT_PCM 0x0001 /* Microsoft Corporation */
159 #define WAVE_FORMAT_ADPCM 0x0002 /* Microsoft Corporation */
160 #define WAVE_FORMAT_IEEE_FLOAT 0x0003 /* Microsoft Corporation */
161 #define WAVE_FORMAT_ALAW 0x0006 /* Microsoft Corporation */
162 #define WAVE_FORMAT_MULAW 0x0007 /* Microsoft Corporation */
163 #define WAVE_FORMAT_DTS_MS 0x0008 /* Microsoft Corporation */
164 #define WAVE_FORMAT_IMA_ADPCM 0x0011 /* Intel Corporation */
165 #define WAVE_FORMAT_GSM610 0x0031 /* Microsoft Corporation */
166 #define WAVE_FORMAT_MSNAUDIO 0x0032 /* Microsoft Corporation */
167 #define WAVE_FORMAT_G726 0x0045 /* ITU-T standard */
168 #define WAVE_FORMAT_MPEG 0x0050 /* Microsoft Corporation */
169 #define WAVE_FORMAT_MPEGLAYER3 0x0055 /* ISO/MPEG Layer3 Format Tag */
170 #define WAVE_FORMAT_DOLBY_AC3_SPDIF 0x0092 /* Sonic Foundry */
172 #define WAVE_FORMAT_A52 0x2000
173 #define WAVE_FORMAT_DTS 0x2001
174 #define WAVE_FORMAT_WMA1 0x0160
175 #define WAVE_FORMAT_WMA2 0x0161
176 #define WAVE_FORMAT_WMA3 0x0162
177 #define WAVE_FORMAT_DIVIO_AAC 0x4143
179 /* Need to check these */
180 #define WAVE_FORMAT_DK3 0x0061
181 #define WAVE_FORMAT_DK4 0x0062
183 #if !defined(WAVE_FORMAT_EXTENSIBLE)
184 #define WAVE_FORMAT_EXTENSIBLE 0xFFFE /* Microsoft */
187 /* Microsoft speaker definitions */
188 #define WAVE_SPEAKER_FRONT_LEFT 0x1
189 #define WAVE_SPEAKER_FRONT_RIGHT 0x2
190 #define WAVE_SPEAKER_FRONT_CENTER 0x4
191 #define WAVE_SPEAKER_LOW_FREQUENCY 0x8
192 #define WAVE_SPEAKER_BACK_LEFT 0x10
193 #define WAVE_SPEAKER_BACK_RIGHT 0x20
194 #define WAVE_SPEAKER_FRONT_LEFT_OF_CENTER 0x40
195 #define WAVE_SPEAKER_FRONT_RIGHT_OF_CENTER 0x80
196 #define WAVE_SPEAKER_BACK_CENTER 0x100
197 #define WAVE_SPEAKER_SIDE_LEFT 0x200
198 #define WAVE_SPEAKER_SIDE_RIGHT 0x400
199 #define WAVE_SPEAKER_TOP_CENTER 0x800
200 #define WAVE_SPEAKER_TOP_FRONT_LEFT 0x1000
201 #define WAVE_SPEAKER_TOP_FRONT_CENTER 0x2000
202 #define WAVE_SPEAKER_TOP_FRONT_RIGHT 0x4000
203 #define WAVE_SPEAKER_TOP_BACK_LEFT 0x8000
204 #define WAVE_SPEAKER_TOP_BACK_CENTER 0x10000
205 #define WAVE_SPEAKER_TOP_BACK_RIGHT 0x20000
206 #define WAVE_SPEAKER_RESERVED 0x80000000
211 vlc_fourcc_t i_fourcc;
214 wave_format_tag_to_fourcc[] =
216 { WAVE_FORMAT_PCM, VLC_FOURCC( 'a', 'r', 'a', 'w' ), "Raw audio" },
217 { WAVE_FORMAT_ADPCM, VLC_FOURCC( 'm', 's', 0x00,0x02), "Adpcm" },
218 { WAVE_FORMAT_IEEE_FLOAT, VLC_FOURCC( 'a', 'f', 'l', 't' ), "IEEE Float audio" },
219 { WAVE_FORMAT_ALAW, VLC_FOURCC( 'a', 'l', 'a', 'w' ), "A-Law" },
220 { WAVE_FORMAT_MULAW, VLC_FOURCC( 'm', 'l', 'a', 'w' ), "Mu-Law" },
221 { WAVE_FORMAT_IMA_ADPCM,VLC_FOURCC( 'm', 's', 0x00,0x11), "Ima-Adpcm" },
222 { WAVE_FORMAT_G726, VLC_FOURCC( 'g', '7', '2', '6' ), "G.726 Adpcm" },
223 { WAVE_FORMAT_MPEGLAYER3,VLC_FOURCC('m', 'p', 'g', 'a' ), "Mpeg Audio" },
224 { WAVE_FORMAT_MPEG, VLC_FOURCC( 'm', 'p', 'g', 'a' ), "Mpeg Audio" },
225 { WAVE_FORMAT_A52, VLC_FOURCC( 'a', '5', '2', ' ' ), "A/52" },
226 { WAVE_FORMAT_WMA1, VLC_FOURCC( 'w', 'm', 'a', '1' ), "Window Media Audio 1" },
227 { WAVE_FORMAT_WMA2, VLC_FOURCC( 'w', 'm', 'a', '2' ), "Window Media Audio 2" },
228 { WAVE_FORMAT_WMA3, VLC_FOURCC( 'w', 'm', 'a', '3' ), "Window Media Audio 3" },
229 { WAVE_FORMAT_DK3, VLC_FOURCC( 'm', 's', 0x00,0x61), "Duck DK3" },
230 { WAVE_FORMAT_DK4, VLC_FOURCC( 'm', 's', 0x00,0x62), "Duck DK4" },
231 { WAVE_FORMAT_DTS, VLC_FOURCC( 'd', 't', 's', ' ' ), "DTS Coherent Acoustics" },
232 { WAVE_FORMAT_DTS_MS, VLC_FOURCC( 'd', 't', 's', ' ' ), "DTS Coherent Acoustics" },
233 { WAVE_FORMAT_DIVIO_AAC,VLC_FOURCC( 'm', 'p', '4', 'a' ), "MPEG-4 Audio (Divio)" },
234 { WAVE_FORMAT_UNKNOWN, VLC_FOURCC( 'u', 'n', 'd', 'f' ), "Unknown" }
237 static inline void wf_tag_to_fourcc( uint16_t i_tag, vlc_fourcc_t *fcc,
241 for( i = 0; wave_format_tag_to_fourcc[i].i_tag != 0; i++ )
243 if( wave_format_tag_to_fourcc[i].i_tag == i_tag ) break;
245 if( fcc ) *fcc = wave_format_tag_to_fourcc[i].i_fourcc;
246 if( ppsz_name ) *ppsz_name = wave_format_tag_to_fourcc[i].psz_name;
249 static inline void fourcc_to_wf_tag( vlc_fourcc_t fcc, uint16_t *pi_tag )
252 for( i = 0; wave_format_tag_to_fourcc[i].i_tag != 0; i++ )
254 if( wave_format_tag_to_fourcc[i].i_fourcc == fcc ) break;
256 if( pi_tag ) *pi_tag = wave_format_tag_to_fourcc[i].i_tag;
260 * Structure to hold information concerning subtitles.
261 * Used between demuxers and decoders of subtitles.
263 typedef struct es_sys_t
265 char *psz_header; /* for 'ssa ' and 'subt' */
268 unsigned int i_orig_height;
269 unsigned int i_orig_width;
270 unsigned int i_origin_x;
271 unsigned int i_origin_y;
272 unsigned int i_scale_h;
273 unsigned int i_scale_v;
274 unsigned int i_alpha;
278 unsigned int i_align;
279 mtime_t i_time_offset;
280 vlc_bool_t b_forced_subs;
281 unsigned int palette[16];
282 unsigned int colors[4];
286 #endif /* "codecs.h" */