include/df/avi.hpp

00001 struct AVIAudioInfo {
00002   int freq, chs, bits;
00003   uint16 codec;  //1=PCM 0x0055=MP3 0=notused
00004   int stmidx;    //decode only : 0 or 1 usually
00005 };
00006 
00007 #define AVI_PCM 0x0001
00008 #define AVI_MP3 0x0055
00009 
00010 struct AVIVideoInfo {
00011   int x, y;
00012   int fps;
00013   uint32 codec;  //ie: AVI_divx 0=notused
00014   uint32 compression;  //ie: AVI_DX50
00015   uint32 framecnt;  //decode only : # of frames
00016   int stmidx;       //decode only : 0 or 1 usually
00017 };
00018 
00019 #define AVI_MAX_STREAMS 4
00020 
00021 struct AVI_index;
00022 
00023 class AVI : public SystemCode {
00024   private:
00025     File *f;
00026     BOOL create;
00027     BOOL Valid;
00028     BOOL done;
00029     int framecnt;
00030     int rifflen, riffoff; //to patch RIFF 'len' ...
00031     int headeroff;        //to patch AVI_header.TotalFrames
00032     int movilen, movioff; //to patch LIST 'len' movi
00033     int vidlen, vidoff;   //video stream header
00034     int audlen, audoff;   //audio stream header
00035     int dmlheaderoff;     //to patch TotalFrames
00036     BOOL vid, aud;
00037     List<AVI_index *> idxlst;//to generate index @ end
00038     uint32 idxoff;
00039     int audstr, vidstr;   //decode only
00040     int stmoff[AVI_MAX_STREAMS];  //for GetChunk() non-linear
00041   public:
00042     AVI();
00043     ~AVI();
00044 //members
00045     BOOL Open(File *f, AVIAudioInfo *, AVIVideoInfo *);
00046     BOOL Create(File *f, AVIAudioInfo *, AVIVideoInfo *);
00047     BOOL Close();
00048 //stream(s) info
00049     uint32 streams[AVI_MAX_STREAMS];  //FOURCC codes (usually AVI_auds, AVI_vids)
00050     int streamcnt;      //usually 2
00051 //AVI loading (do not mix linear with non-linear calls)
00052     BOOL GetChunk(void **chunk, int *len, int *stmidx, int *flgs);  //linear (no seeking)
00053     BOOL GetChunk(void **chunk, int *len, int stmidx, int *flgs);   //non-linear (seeking)
00054 //AVI creation
00055     BOOL AddChunk(void *chunk, int len, BOOL video, int flgs);  //flgs = AVI_FLG_KEYFRAME
00056 };
00057 
00058 //FOURCC codes
00059 #define AVI_RIFF 0x46464952  //"RIFF"
00060 #define AVI_AVI  0x20495641  //"AVI "
00061 #define AVI_LIST 0x5453494c  //"LIST"
00062 #define AVI_hdrl 0x6c726468  //"hdrl"
00063 #define AVI_avih 0x68697661  //"avih"  //AVI_header
00064 #define AVI_strl 0x6c727473  //"strl"
00065   #define AVI_strh 0x68727473  //"strh"  //AVI_streamheader
00066     #define AVI_vids 0x73646976  //"vids"
00067     #define AVI_auds 0x73647561  //"auds"
00068       #define AVI_divx 0x78766964  //"divx"
00069   #define AVI_strf 0x66727473  //"strf"  //AVI_videoformat | AVI_audioformat
00070     #define AVI_DX50 0x30355844  //"DX50"
00071   #define AVI_odml 0x6c6d646f  //"odml"
00072     #define AVI_dmlh 0x686c6d64  //"dmlh"
00073 #define AVI_movi 0x69766f6d  //"movi"
00074 #define AVI_JUNK 0x4b4e554a  //"JUNK"
00075 #define AVI_idx1 0x31786469  //"idx1"
00076 
00077 #define AVI_VIDC 43444956 //"VIDC" (used by VFW functions only)
00078 
00079 //AVI_header flags
00080 #define AVI_FLG_HASINDEX       0x00010
00081 #define AVI_FLG_MUSTUSEINDEX   0x00020
00082 #define AVI_FLG_ISINTERLEAVED  0x00100
00083 #define AVI_FLG_TRUSTCKTYPE    0x00800
00084 #define AVI_FLG_WASCAPTUREFILE 0x10000
00085 #define AVI_FLG_COPYRIGHTED    0x20000
00086 
00087 //AVI_index flags
00088 #define AVI_FLG_KEYFRAME 0x0010 //always set for audio chunks, 1st video chunk, and keyframe video chunks
00089 
00090 
00091 

Generated on Mon Mar 5 09:49:13 2007 for DigiForce by  doxygen 1.4.7