libavi.h
上传用户:kjfoods
上传日期:2020-07-06
资源大小:29949k
文件大小:13k
源码类别:

midi

开发平台:

Unix_Linux

  1. /*****************************************************************************
  2.  * libavi.h : LibAVI library
  3.  ******************************************************************************
  4.  * Copyright (C) 2001-2003 the VideoLAN team
  5.  * $Id: 453602c0754ef8ddc67f85c9bb1ada29727b59c5 $
  6.  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  7.  *
  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.
  12.  *
  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.
  17.  *
  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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  21.  *****************************************************************************/
  22. /* flags for use in <dwFlags> in AVIFileHdr */
  23. #define AVIF_HASINDEX       0x00000010  /* Index at end of file? */
  24. #define AVIF_MUSTUSEINDEX   0x00000020
  25. #define AVIF_ISINTERLEAVED  0x00000100
  26. #define AVIF_TRUSTCKTYPE    0x00000800  /* Use CKType to find key frames? */
  27. #define AVIF_WASCAPTUREFILE 0x00010000
  28. #define AVIF_COPYRIGHTED    0x00020000
  29. /* Flags for index */
  30. #define AVIIF_LIST          0x00000001L /* chunk is a 'LIST' */
  31. #define AVIIF_KEYFRAME      0x00000010L /* this frame is a key frame.*/
  32. #define AVIIF_NOTIME        0x00000100L /* this frame doesn't take any time */
  33. #define AVIIF_COMPUSE       0x0FFF0000L /* these bits are for compressor use */
  34. #define AVIIF_FIXKEYFRAME   0x00001000L /* invented; used to say that */
  35.                                         /* the keyframe flag isn't a true flag */
  36.                                         /* but have to be verified */
  37. #define AVI_CHUNK_COMMON            
  38.     vlc_fourcc_t i_chunk_fourcc;    
  39.     uint64_t i_chunk_size;          
  40.     uint64_t i_chunk_pos;           
  41.     union  avi_chunk_u *p_next;    
  42.     union  avi_chunk_u *p_father;  
  43.     union  avi_chunk_u *p_first;   
  44.     union  avi_chunk_u *p_last;
  45. #define AVI_CHUNK( p_chk ) (avi_chunk_t*)(p_chk)
  46. typedef struct idx1_entry_s
  47. {
  48.     vlc_fourcc_t i_fourcc;
  49.     uint32_t i_flags;
  50.     uint32_t i_pos;
  51.     uint32_t i_length;
  52. } idx1_entry_t;
  53. typedef struct avi_chunk_common_s
  54. {
  55.     AVI_CHUNK_COMMON
  56. } avi_chunk_common_t;
  57. typedef struct avi_chunk_list_s
  58. {
  59.     AVI_CHUNK_COMMON
  60.     vlc_fourcc_t i_type;
  61. } avi_chunk_list_t;
  62. typedef struct avi_chunk_idx1_s
  63. {
  64.     AVI_CHUNK_COMMON
  65.     unsigned int i_entry_count;
  66.     unsigned int i_entry_max;
  67.     idx1_entry_t *entry;
  68. } avi_chunk_idx1_t;
  69. typedef struct avi_chunk_avih_s
  70. {
  71.     AVI_CHUNK_COMMON
  72.     uint32_t i_microsecperframe;
  73.     uint32_t i_maxbytespersec;
  74.     uint32_t i_reserved1; /* dwPaddingGranularity;    pad to multiples of this
  75.                              size; normally 2K */
  76.     uint32_t i_flags;
  77.     uint32_t i_totalframes;
  78.     uint32_t i_initialframes;
  79.     uint32_t i_streams;
  80.     uint32_t i_suggestedbuffersize;
  81.     uint32_t i_width;
  82.     uint32_t i_height;
  83.     uint32_t i_scale;
  84.     uint32_t i_rate;
  85.     uint32_t i_start;
  86.     uint32_t i_length;
  87. } avi_chunk_avih_t;
  88. typedef struct avi_chunk_strh_s
  89. {
  90.     AVI_CHUNK_COMMON
  91.     vlc_fourcc_t i_type;
  92.     uint32_t i_handler;
  93.     uint32_t i_flags;
  94.     uint32_t i_reserved1;    /* wPriority wLanguage */
  95.     uint32_t i_initialframes;
  96.     uint32_t i_scale;
  97.     uint32_t i_rate;
  98.     uint32_t i_start;
  99.     uint32_t i_length;       /* In units above... */
  100.     uint32_t i_suggestedbuffersize;
  101.     uint32_t i_quality;
  102.     uint32_t i_samplesize;
  103. } avi_chunk_strh_t;
  104. typedef struct avi_chunk_strf_auds_s
  105. {
  106.     AVI_CHUNK_COMMON
  107.     int             i_cat;
  108.     WAVEFORMATEX    *p_wf;
  109. } avi_chunk_strf_auds_t;
  110. typedef struct avi_chunk_strf_vids_s
  111. {
  112.     AVI_CHUNK_COMMON
  113.     int              i_cat;
  114.     BITMAPINFOHEADER *p_bih;
  115. } avi_chunk_strf_vids_t;
  116. typedef union avi_chunk_strf_u
  117. {
  118.     avi_chunk_strf_auds_t   auds;
  119.     avi_chunk_strf_vids_t   vids;
  120.     struct
  121.     {
  122.         AVI_CHUNK_COMMON
  123.         int i_cat;
  124.     }                       common;
  125. } avi_chunk_strf_t;
  126. typedef struct avi_chunk_strd_s
  127. {
  128.     AVI_CHUNK_COMMON
  129.     uint8_t  *p_data;
  130. } avi_chunk_strd_t;
  131. #define AVI_INDEX_OF_INDEXES    0x00
  132. #define AVI_INDEX_OF_CHUNKS     0x01
  133. #define AVI_INDEX_IS_DATA       0x80
  134. #define AVI_INDEX_2FIELD        0x01
  135. typedef struct
  136. {
  137.     uint32_t i_offset;
  138.     uint32_t i_size;
  139. } indx_std_entry_t;
  140. typedef struct
  141. {
  142.     uint32_t i_offset;
  143.     uint32_t i_size;
  144.     uint32_t i_offsetfield2;
  145. } indx_field_entry_t;
  146. typedef struct
  147. {
  148.     uint64_t i_offset;
  149.     uint32_t i_size;
  150.     uint32_t i_duration;
  151. } indx_super_entry_t;
  152. typedef struct avi_chunk_indx_s
  153. {
  154.     AVI_CHUNK_COMMON
  155.     int16_t i_longsperentry;
  156.     int8_t  i_indexsubtype;
  157.     int8_t  i_indextype;
  158.     int32_t i_entriesinuse;
  159.     vlc_fourcc_t i_id;
  160.     int64_t i_baseoffset;
  161.     union
  162.     {
  163.         indx_std_entry_t    *std;
  164.         indx_field_entry_t  *field;
  165.         indx_super_entry_t  *super;
  166.     } idx;
  167. } avi_chunk_indx_t;
  168. typedef struct avi_chunk_STRING_s
  169. {
  170.     AVI_CHUNK_COMMON
  171.     char *p_type;
  172.     char *p_str;
  173. } avi_chunk_STRING_t;
  174. typedef union avi_chunk_u
  175. {
  176.     avi_chunk_common_t  common;
  177.     avi_chunk_list_t    list;
  178.     avi_chunk_idx1_t    idx1;
  179.     avi_chunk_avih_t    avih;
  180.     avi_chunk_strh_t    strh;
  181.     avi_chunk_strf_t    strf;
  182.     avi_chunk_strd_t    strd;
  183.     avi_chunk_indx_t    indx;
  184.     avi_chunk_STRING_t  strz;
  185. } avi_chunk_t;
  186. /****************************************************************************
  187.  * Stream(input) access functions
  188.  ****************************************************************************/
  189. int     _AVI_ChunkRead( stream_t *,
  190.                         avi_chunk_t *p_chk,
  191.                         avi_chunk_t *p_father );
  192. int     _AVI_ChunkCount( avi_chunk_t *, vlc_fourcc_t );
  193. void   *_AVI_ChunkFind ( avi_chunk_t *, vlc_fourcc_t, int );
  194. int     AVI_ChunkReadRoot( stream_t *, avi_chunk_t *p_root );
  195. void    AVI_ChunkFreeRoot( stream_t *, avi_chunk_t  *p_chk );
  196. #define AVI_ChunkRead( s, p_chk, p_father ) 
  197.     _AVI_ChunkRead( s, p_chk, (avi_chunk_t*)p_father )
  198. #define AVI_ChunkCount( p_chk, i_fourcc ) 
  199.     _AVI_ChunkCount( (avi_chunk_t*)p_chk, i_fourcc )
  200. #define AVI_ChunkFind( p_chk, i_fourcc, i_number ) 
  201.     _AVI_ChunkFind( (avi_chunk_t*)p_chk, i_fourcc, i_number )
  202.     /* *** avi stuff *** */
  203. #define AVIFOURCC_RIFF         VLC_FOURCC('R','I','F','F')
  204. #define AVIFOURCC_ON2          VLC_FOURCC('O','N','2',' ')
  205. #define AVIFOURCC_LIST         VLC_FOURCC('L','I','S','T')
  206. #define AVIFOURCC_JUNK         VLC_FOURCC('J','U','N','K')
  207. #define AVIFOURCC_AVI          VLC_FOURCC('A','V','I',' ')
  208. #define AVIFOURCC_AVIX         VLC_FOURCC('A','V','I','X')
  209. #define AVIFOURCC_ON2f         VLC_FOURCC('O','N','2','f')
  210. #define AVIFOURCC_WAVE         VLC_FOURCC('W','A','V','E')
  211. #define AVIFOURCC_INFO         VLC_FOURCC('I','N','F','O')
  212. #define AVIFOURCC_avih         VLC_FOURCC('a','v','i','h')
  213. #define AVIFOURCC_ON2h         VLC_FOURCC('O','N','2','h')
  214. #define AVIFOURCC_hdrl         VLC_FOURCC('h','d','r','l')
  215. #define AVIFOURCC_movi         VLC_FOURCC('m','o','v','i')
  216. #define AVIFOURCC_idx1         VLC_FOURCC('i','d','x','1')
  217. #define AVIFOURCC_strl         VLC_FOURCC('s','t','r','l')
  218. #define AVIFOURCC_strh         VLC_FOURCC('s','t','r','h')
  219. #define AVIFOURCC_strf         VLC_FOURCC('s','t','r','f')
  220. #define AVIFOURCC_strd         VLC_FOURCC('s','t','r','d')
  221. #define AVIFOURCC_strn         VLC_FOURCC('s','t','r','n')
  222. #define AVIFOURCC_indx         VLC_FOURCC('i','n','d','x')
  223. #define AVIFOURCC_rec          VLC_FOURCC('r','e','c',' ')
  224. #define AVIFOURCC_auds         VLC_FOURCC('a','u','d','s')
  225. #define AVIFOURCC_vids         VLC_FOURCC('v','i','d','s')
  226. #define AVIFOURCC_txts         VLC_FOURCC('t','x','t','s')
  227. #define AVIFOURCC_mids         VLC_FOURCC('m','i','d','s')
  228. #define AVIFOURCC_iavs         VLC_FOURCC('i','a','v','s')
  229. #define AVIFOURCC_ivas         VLC_FOURCC('i','v','a','s')
  230. #define AVIFOURCC_IARL         VLC_FOURCC('I','A','R','L')
  231. #define AVIFOURCC_IART         VLC_FOURCC('I','A','R','T')
  232. #define AVIFOURCC_ICMS         VLC_FOURCC('I','C','M','S')
  233. #define AVIFOURCC_ICMT         VLC_FOURCC('I','C','M','T')
  234. #define AVIFOURCC_ICOP         VLC_FOURCC('I','C','O','P')
  235. #define AVIFOURCC_ICRD         VLC_FOURCC('I','C','R','D')
  236. #define AVIFOURCC_ICRP         VLC_FOURCC('I','C','R','P')
  237. #define AVIFOURCC_IDIM         VLC_FOURCC('I','D','I','M')
  238. #define AVIFOURCC_IDPI         VLC_FOURCC('I','D','P','I')
  239. #define AVIFOURCC_IENG         VLC_FOURCC('I','E','N','G')
  240. #define AVIFOURCC_IGNR         VLC_FOURCC('I','G','N','R')
  241. #define AVIFOURCC_IKEY         VLC_FOURCC('I','K','E','Y')
  242. #define AVIFOURCC_ILGT         VLC_FOURCC('I','L','G','T')
  243. #define AVIFOURCC_IMED         VLC_FOURCC('I','M','E','D')
  244. #define AVIFOURCC_INAM         VLC_FOURCC('I','N','A','M')
  245. #define AVIFOURCC_IPLT         VLC_FOURCC('I','P','L','T')
  246. #define AVIFOURCC_IPRD         VLC_FOURCC('I','P','R','D')
  247. #define AVIFOURCC_ISBJ         VLC_FOURCC('I','S','B','J')
  248. #define AVIFOURCC_ISFT         VLC_FOURCC('I','S','F','T')
  249. #define AVIFOURCC_ISHP         VLC_FOURCC('I','S','H','P')
  250. #define AVIFOURCC_ISRC         VLC_FOURCC('I','S','R','C')
  251. #define AVIFOURCC_ISRF         VLC_FOURCC('I','S','R','F')
  252. #define AVIFOURCC_ITCH         VLC_FOURCC('I','T','C','H')
  253. #define AVIFOURCC_ISMP         VLC_FOURCC('I','S','M','P')
  254. #define AVIFOURCC_IDIT         VLC_FOURCC('I','D','I','T')
  255.  
  256. #define AVITWOCC_wb            VLC_TWOCC('w','b')
  257. #define AVITWOCC_db            VLC_TWOCC('d','b')
  258. #define AVITWOCC_dc            VLC_TWOCC('d','c')
  259. #define AVITWOCC_pc            VLC_TWOCC('p','c')
  260. #define AVITWOCC_AC            VLC_TWOCC('A','C')
  261.     /* *** codex stuff ***  */
  262.     /* Microsoft RLE video */
  263. #define FOURCC_1            VLC_FOURCC( 1,  0,  0,  0 )
  264.     /* MPEG4 video */
  265. #define FOURCC_DIVX         VLC_FOURCC('D','I','V','X')
  266. #define FOURCC_divx         VLC_FOURCC('d','i','v','x')
  267. #define FOURCC_DIV1         VLC_FOURCC('D','I','V','1')
  268. #define FOURCC_div1         VLC_FOURCC('d','i','v','1')
  269. #define FOURCC_MP4S         VLC_FOURCC('M','P','4','S')
  270. #define FOURCC_mp4s         VLC_FOURCC('m','p','4','s')
  271. #define FOURCC_M4S2         VLC_FOURCC('M','4','S','2')
  272. #define FOURCC_m4s2         VLC_FOURCC('m','4','s','2')
  273. #define FOURCC_xvid         VLC_FOURCC('x','v','i','d')
  274. #define FOURCC_XVID         VLC_FOURCC('X','V','I','D')
  275. #define FOURCC_XviD         VLC_FOURCC('X','v','i','D')
  276. #define FOURCC_DX50         VLC_FOURCC('D','X','5','0')
  277. #define FOURCC_dx50         VLC_FOURCC('d','x','5','0')
  278. #define FOURCC_mp4v         VLC_FOURCC('m','p','4','v')
  279. #define FOURCC_4            VLC_FOURCC( 4,  0,  0,  0 )
  280.     /* MSMPEG4 v2 */
  281. #define FOURCC_MPG4         VLC_FOURCC('M','P','G','4')
  282. #define FOURCC_mpg4         VLC_FOURCC('m','p','g','4')
  283. #define FOURCC_DIV2         VLC_FOURCC('D','I','V','2')
  284. #define FOURCC_div2         VLC_FOURCC('d','i','v','2')
  285. #define FOURCC_MP42         VLC_FOURCC('M','P','4','2')
  286. #define FOURCC_mp42         VLC_FOURCC('m','p','4','2')
  287.     /* MSMPEG4 v3 / M$ mpeg4 v3 */
  288. #define FOURCC_MPG3         VLC_FOURCC('M','P','G','3')
  289. #define FOURCC_mpg3         VLC_FOURCC('m','p','g','3')
  290. #define FOURCC_div3         VLC_FOURCC('d','i','v','3')
  291. #define FOURCC_MP43         VLC_FOURCC('M','P','4','3')
  292. #define FOURCC_mp43         VLC_FOURCC('m','p','4','3')
  293.     /* DivX 3.20 */
  294. #define FOURCC_DIV3         VLC_FOURCC('D','I','V','3')
  295. #define FOURCC_DIV4         VLC_FOURCC('D','I','V','4')
  296. #define FOURCC_div4         VLC_FOURCC('d','i','v','4')
  297. #define FOURCC_DIV5         VLC_FOURCC('D','I','V','5')
  298. #define FOURCC_div5         VLC_FOURCC('d','i','v','5')
  299. #define FOURCC_DIV6         VLC_FOURCC('D','I','V','6')
  300. #define FOURCC_div6         VLC_FOURCC('d','i','v','6')
  301.     /* AngelPotion stuff */
  302. #define FOURCC_AP41         VLC_FOURCC('A','P','4','1')
  303.     /* 3IVX */
  304. #define FOURCC_3IV1         VLC_FOURCC('3','I','V','1')
  305. #define FOURCC_3iv1         VLC_FOURCC('2','i','v','1')
  306. #define FOURCC_3IV2         VLC_FOURCC('3','I','V','2')
  307. #define FOURCC_3iv2         VLC_FOURCC('3','i','v','2')
  308. #define FOURCC_3IVD         VLC_FOURCC('3','I','V','D')
  309. #define FOURCC_3ivd         VLC_FOURCC('3','i','v','d')
  310. #define FOURCC_3VID         VLC_FOURCC('3','V','I','D')
  311. #define FOURCC_3vid         VLC_FOURCC('3','v','i','d')
  312.     /* H263 and H263i */
  313. #define FOURCC_H263         VLC_FOURCC('H','2','6','3')
  314. #define FOURCC_h263         VLC_FOURCC('h','2','6','3')
  315. #define FOURCC_U263         VLC_FOURCC('U','2','6','3')
  316. #define FOURCC_I263         VLC_FOURCC('I','2','6','3')
  317. #define FOURCC_i263         VLC_FOURCC('i','2','6','3')
  318.     /* H264 */
  319. #define FOURCC_H264         VLC_FOURCC('H','2','6','4')
  320. #define FOURCC_h264         VLC_FOURCC('h','2','6','4')
  321. #define FOURCC_VSSH         VLC_FOURCC('V','S','S','H')
  322.     /* DV */
  323. #define FOURCC_dvsd         VLC_FOURCC('d','v','s','d')
  324. #define FOURCC_dvhd         VLC_FOURCC('d','v','h','d')
  325. #define FOURCC_dvsl         VLC_FOURCC('d','v','s','l')
  326. #define FOURCC_dv25         VLC_FOURCC('d','v','2','5')
  327. #define FOURCC_dv50         VLC_FOURCC('d','v','5','0')