Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

libavi.h

00001 /*****************************************************************************
00002  * libavi.h : LibAVI library
00003  ******************************************************************************
00004  * Copyright (C) 2001-2003 the VideoLAN team
00005  * $Id: libavi.h 11664 2005-07-09 06:17:09Z courmisch $
00006  * Authors: Laurent Aimar <[email protected]>
00007  *
00008  * This program is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software
00020  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
00021  *****************************************************************************/
00022 
00023 /* flags for use in <dwFlags> in AVIFileHdr */
00024 #define AVIF_HASINDEX       0x00000010  /* Index at end of file? */
00025 #define AVIF_MUSTUSEINDEX   0x00000020
00026 #define AVIF_ISINTERLEAVED  0x00000100
00027 #define AVIF_TRUSTCKTYPE    0x00000800  /* Use CKType to find key frames? */
00028 #define AVIF_WASCAPTUREFILE 0x00010000
00029 #define AVIF_COPYRIGHTED    0x00020000
00030 
00031 /* Flags for index */
00032 #define AVIIF_LIST          0x00000001L /* chunk is a 'LIST' */
00033 #define AVIIF_KEYFRAME      0x00000010L /* this frame is a key frame.*/
00034 #define AVIIF_NOTIME        0x00000100L /* this frame doesn't take any time */
00035 #define AVIIF_COMPUSE       0x0FFF0000L /* these bits are for compressor use */
00036 
00037 #define AVIIF_FIXKEYFRAME   0x00001000L /* invented; used to say that */
00038                                         /* the keyframe flag isn't a true flag */
00039                                         /* but have to be verified */
00040 
00041 #define AVI_CHUNK_COMMON            \
00042     vlc_fourcc_t i_chunk_fourcc;    \
00043     uint64_t i_chunk_size;          \
00044     uint64_t i_chunk_pos;           \
00045     union  avi_chunk_u *p_next;    \
00046     union  avi_chunk_u *p_father;  \
00047     union  avi_chunk_u *p_first;   \
00048     union  avi_chunk_u *p_last;
00049 
00050 #define AVI_CHUNK( p_chk ) (avi_chunk_t*)(p_chk)
00051 
00052 typedef struct idx1_entry_s
00053 {
00054     vlc_fourcc_t i_fourcc;
00055     uint32_t i_flags;
00056     uint32_t i_pos;
00057     uint32_t i_length;
00058 
00059 } idx1_entry_t;
00060 typedef struct avi_chunk_common_s
00061 {
00062     AVI_CHUNK_COMMON
00063 } avi_chunk_common_t;
00064 
00065 typedef struct avi_chunk_list_s
00066 {
00067     AVI_CHUNK_COMMON
00068     vlc_fourcc_t i_type;
00069 } avi_chunk_list_t;
00070 
00071 typedef struct avi_chunk_idx1_s
00072 {
00073     AVI_CHUNK_COMMON
00074     unsigned int i_entry_count;
00075     unsigned int i_entry_max;
00076     idx1_entry_t *entry;
00077 
00078 } avi_chunk_idx1_t;
00079 
00080 typedef struct avi_chunk_avih_s
00081 {
00082     AVI_CHUNK_COMMON
00083     uint32_t i_microsecperframe;
00084     uint32_t i_maxbytespersec;
00085     uint32_t i_reserved1; /* dwPaddingGranularity;    pad to multiples of this
00086                              size; normally 2K */
00087     uint32_t i_flags;
00088     uint32_t i_totalframes;
00089     uint32_t i_initialframes;
00090     uint32_t i_streams;
00091     uint32_t i_suggestedbuffersize;
00092     uint32_t i_width;
00093     uint32_t i_height;
00094     uint32_t i_scale;
00095     uint32_t i_rate;
00096     uint32_t i_start;
00097     uint32_t i_length;
00098 } avi_chunk_avih_t;
00099 
00100 typedef struct avi_chunk_strh_s
00101 {
00102     AVI_CHUNK_COMMON
00103     vlc_fourcc_t i_type;
00104     uint32_t i_handler;
00105     uint32_t i_flags;
00106     uint32_t i_reserved1;    /* wPriority wLanguage */
00107     uint32_t i_initialframes;
00108     uint32_t i_scale;
00109     uint32_t i_rate;
00110     uint32_t i_start;
00111     uint32_t i_length;       /* In units above... */
00112     uint32_t i_suggestedbuffersize;
00113     uint32_t i_quality;
00114     uint32_t i_samplesize;
00115 } avi_chunk_strh_t;
00116 
00117 typedef struct avi_chunk_strf_auds_s
00118 {
00119     AVI_CHUNK_COMMON
00120     int             i_cat;
00121     WAVEFORMATEX    *p_wf;
00122 } avi_chunk_strf_auds_t;
00123 
00124 typedef struct avi_chunk_strf_vids_s
00125 {
00126     AVI_CHUNK_COMMON
00127     int              i_cat;
00128     BITMAPINFOHEADER *p_bih;
00129 } avi_chunk_strf_vids_t;
00130 
00131 typedef union avi_chunk_strf_u
00132 {
00133     avi_chunk_strf_auds_t   auds;
00134     avi_chunk_strf_vids_t   vids;
00135     struct
00136     {
00137         AVI_CHUNK_COMMON
00138         int i_cat;
00139     }                       common;
00140 } avi_chunk_strf_t;
00141 
00142 typedef struct avi_chunk_strd_s
00143 {
00144     AVI_CHUNK_COMMON
00145     uint8_t  *p_data;
00146 } avi_chunk_strd_t;
00147 
00148 
00149 #define AVI_INDEX_OF_INDEXES    0x00
00150 #define AVI_INDEX_OF_CHUNKS     0x01
00151 #define AVI_INDEX_IS_DATA       0x80
00152 
00153 #define AVI_INDEX_2FIELD        0x01
00154 typedef struct
00155 {
00156     uint32_t i_offset;
00157     uint32_t i_size;
00158 } indx_std_entry_t;
00159 
00160 typedef struct
00161 {
00162     uint32_t i_offset;
00163     uint32_t i_size;
00164     uint32_t i_offsetfield2;
00165 } indx_field_entry_t;
00166 
00167 typedef struct
00168 {
00169     uint64_t i_offset;
00170     uint32_t i_size;
00171     uint32_t i_duration;
00172 } indx_super_entry_t;
00173 
00174 typedef struct avi_chunk_indx_s
00175 {
00176     AVI_CHUNK_COMMON
00177     int16_t i_longsperentry;
00178     int8_t  i_indexsubtype;
00179     int8_t  i_indextype;
00180     int32_t i_entriesinuse;
00181     vlc_fourcc_t i_id;
00182 
00183     int64_t i_baseoffset;
00184 
00185     union
00186     {
00187         indx_std_entry_t    *std;
00188         indx_field_entry_t  *field;
00189         indx_super_entry_t  *super;
00190     } idx;
00191 } avi_chunk_indx_t;
00192 
00193 typedef struct avi_chunk_STRING_s
00194 {
00195     AVI_CHUNK_COMMON
00196     char *p_type;
00197     char *p_str;
00198 } avi_chunk_STRING_t;
00199 
00200 typedef union avi_chunk_u
00201 {
00202     avi_chunk_common_t  common;
00203     avi_chunk_list_t    list;
00204     avi_chunk_idx1_t    idx1;
00205     avi_chunk_avih_t    avih;
00206     avi_chunk_strh_t    strh;
00207     avi_chunk_strf_t    strf;
00208     avi_chunk_strd_t    strd;
00209     avi_chunk_indx_t    indx;
00210     avi_chunk_STRING_t  strz;
00211 } avi_chunk_t;
00212 
00213 /****************************************************************************
00214  * Stream(input) access functions
00215  ****************************************************************************/
00216 int     _AVI_ChunkRead( stream_t *,
00217                         avi_chunk_t *p_chk,
00218                         avi_chunk_t *p_father );
00219 
00220 int     _AVI_ChunkCount( avi_chunk_t *, vlc_fourcc_t );
00221 void   *_AVI_ChunkFind ( avi_chunk_t *, vlc_fourcc_t, int );
00222 
00223 int     AVI_ChunkReadRoot( stream_t *, avi_chunk_t *p_root );
00224 void    AVI_ChunkFreeRoot( stream_t *, avi_chunk_t  *p_chk );
00225 
00226 #define AVI_ChunkRead( s, p_chk, p_father ) \
00227     _AVI_ChunkRead( s, p_chk, (avi_chunk_t*)p_father )
00228 #define AVI_ChunkCount( p_chk, i_fourcc ) \
00229     _AVI_ChunkCount( (avi_chunk_t*)p_chk, i_fourcc )
00230 #define AVI_ChunkFind( p_chk, i_fourcc, i_number ) \
00231     _AVI_ChunkFind( (avi_chunk_t*)p_chk, i_fourcc, i_number )
00232 
00233 
00234     /* *** avi stuff *** */
00235 
00236 #define AVIFOURCC_RIFF         VLC_FOURCC('R','I','F','F')
00237 #define AVIFOURCC_LIST         VLC_FOURCC('L','I','S','T')
00238 #define AVIFOURCC_JUNK         VLC_FOURCC('J','U','N','K')
00239 #define AVIFOURCC_AVI          VLC_FOURCC('A','V','I',' ')
00240 #define AVIFOURCC_AVIX         VLC_FOURCC('A','V','I','X')
00241 #define AVIFOURCC_WAVE         VLC_FOURCC('W','A','V','E')
00242 #define AVIFOURCC_INFO         VLC_FOURCC('I','N','F','O')
00243 
00244 #define AVIFOURCC_avih         VLC_FOURCC('a','v','i','h')
00245 #define AVIFOURCC_hdrl         VLC_FOURCC('h','d','r','l')
00246 #define AVIFOURCC_movi         VLC_FOURCC('m','o','v','i')
00247 #define AVIFOURCC_idx1         VLC_FOURCC('i','d','x','1')
00248 
00249 #define AVIFOURCC_strl         VLC_FOURCC('s','t','r','l')
00250 #define AVIFOURCC_strh         VLC_FOURCC('s','t','r','h')
00251 #define AVIFOURCC_strf         VLC_FOURCC('s','t','r','f')
00252 #define AVIFOURCC_strd         VLC_FOURCC('s','t','r','d')
00253 #define AVIFOURCC_strn         VLC_FOURCC('s','t','r','n')
00254 #define AVIFOURCC_indx         VLC_FOURCC('i','n','d','x')
00255 
00256 #define AVIFOURCC_rec          VLC_FOURCC('r','e','c',' ')
00257 #define AVIFOURCC_auds         VLC_FOURCC('a','u','d','s')
00258 #define AVIFOURCC_vids         VLC_FOURCC('v','i','d','s')
00259 #define AVIFOURCC_txts         VLC_FOURCC('t','x','t','s')
00260 #define AVIFOURCC_mids         VLC_FOURCC('m','i','d','s')
00261 
00262 #define AVIFOURCC_IARL         VLC_FOURCC('I','A','R','L')
00263 #define AVIFOURCC_IART         VLC_FOURCC('I','A','R','T')
00264 #define AVIFOURCC_ICMS         VLC_FOURCC('I','C','M','S')
00265 #define AVIFOURCC_ICMT         VLC_FOURCC('I','C','M','T')
00266 #define AVIFOURCC_ICOP         VLC_FOURCC('I','C','O','P')
00267 #define AVIFOURCC_ICRD         VLC_FOURCC('I','C','R','D')
00268 #define AVIFOURCC_ICRP         VLC_FOURCC('I','C','R','P')
00269 #define AVIFOURCC_IDIM         VLC_FOURCC('I','D','I','M')
00270 #define AVIFOURCC_IDPI         VLC_FOURCC('I','D','P','I')
00271 #define AVIFOURCC_IENG         VLC_FOURCC('I','E','N','G')
00272 #define AVIFOURCC_IGNR         VLC_FOURCC('I','G','N','R')
00273 #define AVIFOURCC_IKEY         VLC_FOURCC('I','K','E','Y')
00274 #define AVIFOURCC_ILGT         VLC_FOURCC('I','L','G','T')
00275 #define AVIFOURCC_IMED         VLC_FOURCC('I','M','E','D')
00276 #define AVIFOURCC_INAM         VLC_FOURCC('I','N','A','M')
00277 #define AVIFOURCC_IPLT         VLC_FOURCC('I','P','L','T')
00278 #define AVIFOURCC_IPRD         VLC_FOURCC('I','P','R','D')
00279 #define AVIFOURCC_ISBJ         VLC_FOURCC('I','S','B','J')
00280 #define AVIFOURCC_ISFT         VLC_FOURCC('I','S','F','T')
00281 #define AVIFOURCC_ISHP         VLC_FOURCC('I','S','H','P')
00282 #define AVIFOURCC_ISRC         VLC_FOURCC('I','S','R','C')
00283 #define AVIFOURCC_ISRF         VLC_FOURCC('I','S','R','F')
00284 #define AVIFOURCC_ITCH         VLC_FOURCC('I','T','C','H')
00285 #define AVIFOURCC_ISMP         VLC_FOURCC('I','S','M','P')
00286 #define AVIFOURCC_IDIT         VLC_FOURCC('I','D','I','T')
00287 
00288     
00289 #define AVITWOCC_wb            VLC_TWOCC('w','b')
00290 #define AVITWOCC_db            VLC_TWOCC('d','b')
00291 #define AVITWOCC_dc            VLC_TWOCC('d','c')
00292 #define AVITWOCC_pc            VLC_TWOCC('p','c')
00293     /* *** codex stuff ***  */
00294 
00295     /* Microsoft RLE video */
00296 #define FOURCC_1            VLC_FOURCC( 1,  0,  0,  0 )
00297 
00298     /* MPEG4 video */
00299 #define FOURCC_DIVX         VLC_FOURCC('D','I','V','X')
00300 #define FOURCC_divx         VLC_FOURCC('d','i','v','x')
00301 #define FOURCC_DIV1         VLC_FOURCC('D','I','V','1')
00302 #define FOURCC_div1         VLC_FOURCC('d','i','v','1')
00303 #define FOURCC_MP4S         VLC_FOURCC('M','P','4','S')
00304 #define FOURCC_mp4s         VLC_FOURCC('m','p','4','s')
00305 #define FOURCC_M4S2         VLC_FOURCC('M','4','S','2')
00306 #define FOURCC_m4s2         VLC_FOURCC('m','4','s','2')
00307 #define FOURCC_xvid         VLC_FOURCC('x','v','i','d')
00308 #define FOURCC_XVID         VLC_FOURCC('X','V','I','D')
00309 #define FOURCC_XviD         VLC_FOURCC('X','v','i','D')
00310 #define FOURCC_DX50         VLC_FOURCC('D','X','5','0')
00311 #define FOURCC_dx50         VLC_FOURCC('d','x','5','0')
00312 #define FOURCC_mp4v         VLC_FOURCC('m','p','4','v')
00313 #define FOURCC_4            VLC_FOURCC( 4,  0,  0,  0 )
00314 
00315     /* MSMPEG4 v2 */
00316 #define FOURCC_MPG4         VLC_FOURCC('M','P','G','4')
00317 #define FOURCC_mpg4         VLC_FOURCC('m','p','g','4')
00318 #define FOURCC_DIV2         VLC_FOURCC('D','I','V','2')
00319 #define FOURCC_div2         VLC_FOURCC('d','i','v','2')
00320 #define FOURCC_MP42         VLC_FOURCC('M','P','4','2')
00321 #define FOURCC_mp42         VLC_FOURCC('m','p','4','2')
00322 
00323     /* MSMPEG4 v3 / M$ mpeg4 v3 */
00324 #define FOURCC_MPG3         VLC_FOURCC('M','P','G','3')
00325 #define FOURCC_mpg3         VLC_FOURCC('m','p','g','3')
00326 #define FOURCC_div3         VLC_FOURCC('d','i','v','3')
00327 #define FOURCC_MP43         VLC_FOURCC('M','P','4','3')
00328 #define FOURCC_mp43         VLC_FOURCC('m','p','4','3')
00329 
00330     /* DivX 3.20 */
00331 #define FOURCC_DIV3         VLC_FOURCC('D','I','V','3')
00332 #define FOURCC_DIV4         VLC_FOURCC('D','I','V','4')
00333 #define FOURCC_div4         VLC_FOURCC('d','i','v','4')
00334 #define FOURCC_DIV5         VLC_FOURCC('D','I','V','5')
00335 #define FOURCC_div5         VLC_FOURCC('d','i','v','5')
00336 #define FOURCC_DIV6         VLC_FOURCC('D','I','V','6')
00337 #define FOURCC_div6         VLC_FOURCC('d','i','v','6')
00338 
00339     /* AngelPotion stuff */
00340 #define FOURCC_AP41         VLC_FOURCC('A','P','4','1')
00341 
00342     /* 3IVX */
00343 #define FOURCC_3IV1         VLC_FOURCC('3','I','V','1')
00344 #define FOURCC_3iv1         VLC_FOURCC('2','i','v','1')
00345 #define FOURCC_3IV2         VLC_FOURCC('3','I','V','2')
00346 #define FOURCC_3iv2         VLC_FOURCC('3','i','v','2')
00347 #define FOURCC_3IVD         VLC_FOURCC('3','I','V','D')
00348 #define FOURCC_3ivd         VLC_FOURCC('3','i','v','d')
00349 #define FOURCC_3VID         VLC_FOURCC('3','V','I','D')
00350 #define FOURCC_3vid         VLC_FOURCC('3','v','i','d')
00351 
00352     /* H263 and H263i */
00353 #define FOURCC_H263         VLC_FOURCC('H','2','6','3')
00354 #define FOURCC_h263         VLC_FOURCC('h','2','6','3')
00355 #define FOURCC_U263         VLC_FOURCC('U','2','6','3')
00356 #define FOURCC_I263         VLC_FOURCC('I','2','6','3')
00357 #define FOURCC_i263         VLC_FOURCC('i','2','6','3')
00358 
00359     /* H264 */
00360 #define FOURCC_H264         VLC_FOURCC('H','2','6','4')
00361 #define FOURCC_h264         VLC_FOURCC('h','2','6','4')
00362 #define FOURCC_VSSH         VLC_FOURCC('V','S','S','H')

Generated on Tue Dec 20 10:14:31 2005 for vlc-0.8.4a by  doxygen 1.4.2