00001 #pragma once
00002
00003 #include <Aviriff.h>
00004 #include "..\BaseSplitter\BaseSplitter.h"
00005
00006 class CAviFile : public CBaseSplitterFile
00007 {
00008 HRESULT Init();
00009 HRESULT Parse(DWORD parentid, __int64 end);
00010
00011 public:
00012 CAviFile(IAsyncReader* pAsyncReader, HRESULT& hr);
00013
00014 using CBaseSplitterFile::Read;
00015 template<typename T> HRESULT Read(T& var, int offset = 0);
00016
00017 AVIMAINHEADER m_avih;
00018 struct ODMLExtendedAVIHeader {DWORD dwTotalFrames;} m_dmlh;
00019
00020 struct strm_t
00021 {
00022 AVISTREAMHEADER strh;
00023 CArray<BYTE> strf;
00024 CStringA strn;
00025 CAutoPtr<AVISUPERINDEX> indx;
00026 struct chunk {UINT64 fKeyFrame:1, fChunkHdr:1, size:62; UINT64 filepos; DWORD orgsize;};
00027 CArray<chunk> cs;
00028 UINT64 totalsize;
00029 REFERENCE_TIME GetRefTime(DWORD frame, UINT64 size);
00030 int GetTime(DWORD frame, UINT64 size);
00031 int GetFrame(REFERENCE_TIME rt);
00032 int GetKeyFrame(REFERENCE_TIME rt);
00033 DWORD GetChunkSize(DWORD size);
00034 bool IsRawSubtitleStream();
00035
00036
00037 struct chunk2 {DWORD t; DWORD n;};
00038 CArray<chunk2> cs2;
00039 };
00040 CAutoPtrArray<strm_t> m_strms;
00041 CMap<DWORD, DWORD, CStringA, CStringA&> m_info;
00042 CAutoPtr<AVIOLDINDEX> m_idx1;
00043
00044 CList<UINT64> m_movis;
00045
00046 REFERENCE_TIME GetTotalTime();
00047 HRESULT BuildIndex();
00048 void EmptyIndex();
00049 bool IsInterleaved(bool fKeepInfo = false);
00050 };
00051
00052 #define TRACKNUM(fcc) (10*((fcc&0xff)-0x30) + (((fcc>>8)&0xff)-0x30))
00053 #define TRACKTYPE(fcc) ((WORD)((((DWORD)fcc>>24)&0xff)|((fcc>>8)&0xff00)))