1 /*****************************************************************************
2 * avi.h : AVI file Stream input module for vlc
3 *****************************************************************************
4 * Copyright (C) 2001 VideoLAN
5 * $Id: avi.h,v 1.10 2002/07/23 00:39:16 sam Exp $
6 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
8 * This program 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 * This program 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
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
21 *****************************************************************************/
23 #define MAX_PACKETS_IN_FIFO 2
25 /* flags for use in <dwFlags> in AVIFileHdr */
26 #define AVIF_HASINDEX 0x00000010 /* Index at end of file? */
27 #define AVIF_MUSTUSEINDEX 0x00000020
28 #define AVIF_ISINTERLEAVED 0x00000100
29 #define AVIF_TRUSTCKTYPE 0x00000800 /* Use CKType to find key frames? */
30 #define AVIF_WASCAPTUREFILE 0x00010000
31 #define AVIF_COPYRIGHTED 0x00020000
34 #define AVIIF_LIST 0x00000001L /* chunk is a 'LIST' */
35 #define AVIIF_KEYFRAME 0x00000010L /* this frame is a key frame.*/
36 #define AVIIF_NOTIME 0x00000100L /* this frame doesn't take any time */
37 #define AVIIF_COMPUSE 0x0FFF0000L /* these bits are for compressor use */
39 #define AVIIF_FIXKEYFRAME 0x00001000L /* invented; used to say that
40 the keyframe flag isn't a true flag
41 but have to be verified */
44 #define FOURCC_RIFF VLC_FOURCC('R','I','F','F')
45 #define FOURCC_LIST VLC_FOURCC('L','I','S','T')
46 #define FOURCC_JUNK VLC_FOURCC('J','U','N','K')
47 #define FOURCC_AVI VLC_FOURCC('A','V','I',' ')
48 #define FOURCC_WAVE VLC_FOURCC('W','A','V','E')
50 #define FOURCC_avih VLC_FOURCC('a','v','i','h')
51 #define FOURCC_hdrl VLC_FOURCC('h','d','r','l')
52 #define FOURCC_movi VLC_FOURCC('m','o','v','i')
53 #define FOURCC_idx1 VLC_FOURCC('i','d','x','1')
55 #define FOURCC_strl VLC_FOURCC('s','t','r','l')
56 #define FOURCC_strh VLC_FOURCC('s','t','r','h')
57 #define FOURCC_strf VLC_FOURCC('s','t','r','f')
58 #define FOURCC_strd VLC_FOURCC('s','t','r','d')
60 #define FOURCC_rec VLC_FOURCC('r','e','c',' ')
61 #define FOURCC_auds VLC_FOURCC('a','u','d','s')
62 #define FOURCC_vids VLC_FOURCC('v','i','d','s')
64 #define TWOCC_wb VLC_TWOCC('w','b')
65 #define TWOCC_db VLC_TWOCC('d','b')
66 #define TWOCC_dc VLC_TWOCC('d','c')
67 #define TWOCC_pc VLC_TWOCC('p','c')
70 #define FOURCC_DIVX VLC_FOURCC('D','I','V','X')
71 #define FOURCC_divx VLC_FOURCC('d','i','v','x')
72 #define FOURCC_DIV1 VLC_FOURCC('D','I','V','1')
73 #define FOURCC_div1 VLC_FOURCC('d','i','v','1')
74 #define FOURCC_MP4S VLC_FOURCC('M','P','4','S')
75 #define FOURCC_mp4s VLC_FOURCC('m','p','4','s')
76 #define FOURCC_M4S2 VLC_FOURCC('M','4','S','2')
77 #define FOURCC_m4s2 VLC_FOURCC('m','4','s','2')
78 #define FOURCC_xvid VLC_FOURCC('x','v','i','d')
79 #define FOURCC_XVID VLC_FOURCC('X','V','I','D')
80 #define FOURCC_XviD VLC_FOURCC('X','v','i','D')
81 #define FOURCC_DX50 VLC_FOURCC('D','X','5','0')
82 #define FOURCC_mp4v VLC_FOURCC('m','p','4','v')
83 #define FOURCC_4 VLC_FOURCC( 4, 0, 0, 0 )
86 #define FOURCC_MPG4 VLC_FOURCC('M','P','G','4')
87 #define FOURCC_mpg4 VLC_FOURCC('m','p','g','4')
88 #define FOURCC_DIV2 VLC_FOURCC('D','I','V','2')
89 #define FOURCC_div2 VLC_FOURCC('d','i','v','2')
90 #define FOURCC_MP42 VLC_FOURCC('M','P','4','2')
91 #define FOURCC_mp42 VLC_FOURCC('m','p','4','2')
93 /* MSMPEG4 v3 / M$ mpeg4 v3 */
94 #define FOURCC_MPG3 VLC_FOURCC('M','P','G','3')
95 #define FOURCC_mpg3 VLC_FOURCC('m','p','g','3')
96 #define FOURCC_div3 VLC_FOURCC('d','i','v','3')
97 #define FOURCC_MP43 VLC_FOURCC('M','P','4','3')
98 #define FOURCC_mp43 VLC_FOURCC('m','p','4','3')
101 #define FOURCC_DIV3 VLC_FOURCC('D','I','V','3')
102 #define FOURCC_DIV4 VLC_FOURCC('D','I','V','4')
103 #define FOURCC_div4 VLC_FOURCC('d','i','v','4')
104 #define FOURCC_DIV5 VLC_FOURCC('D','I','V','5')
105 #define FOURCC_div5 VLC_FOURCC('d','i','v','5')
106 #define FOURCC_DIV6 VLC_FOURCC('D','I','V','6')
107 #define FOURCC_div6 VLC_FOURCC('d','i','v','6')
109 /* AngelPotion stuff */
110 #define FOURCC_AP41 VLC_FOURCC('A','P','4','1')
113 #define FOURCC_3IV1 VLC_FOURCC('3','I','V','1')
115 #define FOURCC_H263 VLC_FOURCC('H','2','6','3')
116 #define FOURCC_h263 VLC_FOURCC('h','2','6','3')
117 #define FOURCC_U263 VLC_FOURCC('U','2','6','3')
118 #define FOURCC_I263 VLC_FOURCC('I','2','6','3')
119 #define FOURCC_i263 VLC_FOURCC('i','2','6','3')
122 #define WAVE_FORMAT_UNKNOWN 0x0000
123 #define WAVE_FORMAT_PCM 0x0001
124 #define WAVE_FORMAT_MPEG 0x0050
125 #define WAVE_FORMAT_MPEGLAYER3 0x0055
126 #define WAVE_FORMAT_AC3 0x2000
128 typedef struct bitmapinfoheader_s
130 u32 i_size; /* size of header */
141 } bitmapinfoheader_t;
143 typedef struct waveformatex_s
148 u32 i_avgbytespersec;
151 u16 i_size; /* the extra size in bytes */
155 typedef struct MainAVIHeader_s
157 u32 i_microsecperframe;
158 u32 i_maxbytespersec;
159 u32 i_reserved1; /* dwPaddingGranularity; pad to multiples of this
165 u32 i_suggestedbuffersize;
175 typedef struct AVIStreamHeader_s
180 u32 i_reserved1; /* wPriority wLanguage */
185 u32 i_length; /* In units above... */
186 u32 i_suggestedbuffersize;
192 typedef struct AVIIndexEntry_s
201 typedef struct AVIESBuffer_s
203 struct AVIESBuffer_s *p_next;
211 typedef struct AVIStreamInfo_s
217 riffchunk_t *p_strd; /* not used */
219 AVIStreamHeader_t header;
221 u8 i_cat; /* AUDIO_ES, VIDEO_ES */
222 bitmapinfoheader_t video_format;
223 waveformatex_t audio_format;
224 es_descriptor_t *p_es;
225 int b_selected; /* newly selected */
226 AVIIndexEntry_t *p_index;
230 int i_idxposc; /* numero of chunk */
231 int i_idxposb; /* byte in the current chunk */
233 /* add some buffering */
234 AVIESBuffer_t *p_pes_first;
235 AVIESBuffer_t *p_pes_last;
240 typedef struct demux_data_avi_file_s
251 /* Info extrated from avih */
252 MainAVIHeader_t avih;
254 /* number of stream and informations*/
256 AVIStreamInfo_t **pp_info;
258 /* current audio and video es */
259 AVIStreamInfo_t *p_info_video;
260 AVIStreamInfo_t *p_info_audio;
262 } demux_data_avi_file_t;