AVI_private.h
上传用户:super_houu
上传日期:2008-09-21
资源大小:4099k
文件大小:10k
- /****************************************************************************************
- * Copyright (c) 2003 ZORAN Corporation, All Rights Reserved
- * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF ZORAN CORPORATION
- *
- * File: $Workfile: AVI_private.h $
- *
- * Description:
- * ============
- * Private methods/structures used for AVI clip.
- *
- * Log:
- * ====
- ****************************************************************************************
- * Updates:
- ****************************************************************************************
- * $Log: /I76/I76_Common/I76_Reference/Playcore/Nav_Clips/AVI_private.h $
- *
- * 23 3/24/04 5:32p Robinj
- * Add ADPCM_*_AUDIO_SID and WAV*_AUDIO_SID
- *
- * 22 3/21/04 8:49p Lotan
- * merge 4 with certification DB
- *
- * 21 3/10/04 4:24p Lotan
- * Merge with Divx Certification DB 3
- *
- * 20 3/08/04 4:14p Hamadk
- * Merging with DivX certification DB - Optimized AVI file info memory
- *
- * 19 3/04/04 10:22p Lotan
- * Second merge with Divx Certification DB,
- * including 2x16 SDram
- *
- * 18 3/01/04 6:29p Lotan
- * merge with Divx certification DB
- *
- * From Divx Certification DB
- * - Added support for different I spaces in the IDX for different clips
- * Corrected the max num of entries of idx saved on the scpad
- * Increased time between saved I frames in the Scpad
-
- * 17 2/27/04 7:07p Robinj
- * Add "bIsIndexNotFound" in "AVIFileInfo"
- *
- *
- * 15 2/15/04 11:58p Rond
- * added few audio and subtitle streams
- *
- * 14 2/11/04 12:41a Lotan
- * new Divx DRM handling method.
- *
- * 12 1/29/04 5:34p Hamadk
- * Added VirtualDub software ID
- *
- * 11 1/13/04 12:11 Hamadk
- * Merged with CES DB
- *
- * 10 12/25/03 11:11 Hamadk
- * Added macro
- *
- * 9 12/18/03 19:09 Hamadk
- * Added function declaration
- *
- * 8 12/11/03 10:06 Eyalr
- *
- * 7 11/18/03 9:29 Eyalr
- * added SID for Decoder & UI
- *
- * 6 11/06/03 15:16 Eyalr
- * added new features for Divx
- *
- * 5 10/22/03 19:01 Hamadk
- * Added dependency
- *
- * 4 10/12/03 15:11 Hamadk
- * Added functions declarations
- *
- * 3 10/02/03 10:32 Hamadk
- * Added FF/FB support
- *
- * 2 9/29/03 8:16 Hamadk
- *
- ****************************************************************************************/
- #include "Config.h" // Global Configuration - do not remove!
- #ifndef __AVI_PRIVATE_H_
- #define __AVI_PRIVATE_H_
- #include "IncludeSysDefs.h"
- #include "DecoderDecoder.h"
- #include "PlaycoreNav_ClipsMpeg4ClipsCommon.h"
- /////////////////////////////////////////////////////////////////////////////
- // Constants and Enumerations
- #define RIFF_ID "RIFF"
- #define AVI_FILE_ID "AVI "
- #define AVI_HEADER_START_ID "hdrl"
- #define AVI_CHAR_SET_ID "CSET"
- #define AVI_INFO_LIST_ID "INFO"
- #define AVI_MAIN_HEADER_ID "avih"
- #define AVI_STREAM_HEADER_START_ID "strl"
- #define AVI_STREAM_HEADER_ID "strh"
- #define AVI_STREAM_FORMAT_ID "strf"
- #define AVI_STREAM_HEADER_DATA_ID "strd"
- #define AVI_LIST_FOURCC_ID "LIST"
- #define AVI_MOVIE_LIST_ID "movi"
- #define AVI_IDX_CHUNK_ID "idx1"
- #define AVI_ISET_CHUNK_ID "ISFT"
- #define AVI_NANDUB_ID "Nandub v1.0rc2"
- #define AVI_VIRTUALDUB_ID "VirtualDubMod 1.5.1.1a"
- #define AVI2_ID "AVIX"
- #define AVI2_HEADER_START_ID "odml"
- #define AVI2_HEADER_ID "dmlh"
- #define AVI2_INDEX_ID "indx"
- #define VIDEO_STREAM_TYPE_ID "vids"
- #define AUDIO_STREAM_TYPE_ID "auds"
- #define TEXT_STREAM_TYPE_ID "txts"
- #define AVI_HEADER_OFFSET 12
- #define AVI_ID_OFFSET 8
- #define SIZE_FIELD_LENGTH 4
- #define LIST_TYPE_FIELD_LENGTH 4
- #define NANDUB_ID_LENGTH 15
- #define VIRTUALDUB_ID_LENGTH 22
- #if defined(SDRAM_2X16MBITS) && !defined(NEW_2X16M_MAPPING)
- #define MAX_NUMBER_OF_IDX_ENTRIES 2350
- #else
- #define MAX_NUMBER_OF_IDX_ENTRIES 10000
- #endif
- #define FIFO_WRAPAOURND 0x3F
- #define FIFO_LEN (FIFO_WRAPAOURND+1)
- #ifdef AVI_MALLOC_SIZE_DOWN
- #define NUM_OF_IDX_ENTRIES_CACHE 32
- #else
- #define NUM_OF_IDX_ENTRIES_CACHE 128
- #endif
- #define IDX_TABLE_LONG_TIME_DIFFERANCE 2000 /* In msec */
- #define IDX_TABLE_SHORT_TIME_DIFFERANCE 500 /* In msec */
- #define IDX_LONG_I_DIFF_THRESHOLD 150000UL /* Number of frames */
- typedef enum
- {
- EInvalid,
- EVids,
- EAuds,
- ETxts,
- EStrl,
- EStrh,
- EStrf,
- EStrd
- } EFourCCType;
- typedef enum
- {
- AVI_VIDEO_STREAM,
- AVI_AUDIO_STREAM,
- AVI_TEXT_STREAM,
- AVI_SUBTITLE_STREAM
- } AVI_STREAM_TYPE;
- /////////////////////////////////////////////////////////////////////////////
- // Common Structures
- /*
- typedef struct
- {
- DWORD dwFileLocation;
- DWORD dwClipStartLBA;
- WORD wClipStartOffset;
- WORD wClipEndOffset;
- UINT32 ulTotalBlocksCnt;
- BOOL bIsNandub;
- BOOL bIsIndexProcessed;
- BOOL bHasIndex;
- UINT8 divXVersion;
- // UINT8 uiAudioStreamID[MAX_AUDS_PER_CLIP];
- // UINT8 uiVideoStreamID;
- // <<< Robin_0903_2004
- #ifndef DIVX_SUPPORT_MULTI_SUBTITLE
- UINT8 uiSubtitleStreamID[MAX_SUB_PER_CLIP];
- #endif
- // >>> Robin_0903_2004
- BOOL bDrmOn;
- } AVIFileInfo;
- */
- typedef struct
- {
- DWORD dwMicroSecPerFrame;
- DWORD dwMaxBytesPerSec;
- DWORD dwReserved1;
- DWORD dwFlags;
- DWORD dwTotalFrames;
- DWORD dwInitialFrames;
- DWORD dwStreams;
- DWORD dwSuggestedBufferSize;
- DWORD dwWidth;
- DWORD dwHeight;
- DWORD dwScale;
- DWORD dwRate;
- DWORD dwStart;
- DWORD dwLength;
- } AVIMainHeader;
- typedef struct
- {
- FOURCC fccType;
- FOURCC fccHandler;
- DWORD dwFlags;
- WORD wPriority;
- WORD wLanguage;
- DWORD dwInitialFrames;
- DWORD dwScale;
- DWORD dwRate;
- DWORD dwStart;
- DWORD dwLength;
- DWORD dwSuggestedBufferSize;
- DWORD dwQuality;
- DWORD dwSampleSize;
- struct
- {
- short int top;
- short int bottom;
- short int left;
- short int right;
- } rcFrame;
- } AVIStreamHeader;
- typedef struct
- {
- DWORD dwSize;
- LONG lWidth;
- LONG lHeight;
- WORD wPlanes;
- WORD wBitCount;
- DWORD dwCompression;
- DWORD dwSizeImage;
- LONG lXPelsPerMeter;
- LONG lYPelsPerMeter;
- DWORD dwClrUsed;
- DWORD dwClrImportant;
- } BitMapInfoHeader;
- typedef struct
- {
- WORD wFormatTag;
- WORD wChannels;
- DWORD dwSamplesPerSec;
- DWORD dwAvgBytesPerSec;
- WORD wBlockAlign;
- WORD wBitsPerSample;
- WORD wSize;
- } WaveFormatEX;
- typedef struct
- {
- WaveFormatEX wfx;
- WORD wSamplesPerBlock;
- } ADPCMWAVEFORMAT;
- typedef struct
- {
- WaveFormatEX wfx;
- DWORD dwSamplesPerBlock;
- WORD wEncoderOptions;
- DWORD dwSuperBlockAlign;
- } WMAWAVEFORMAT;
- typedef union
- {
- WaveFormatEX wave;
- #ifdef D_ENABLE_ADPCM_SUPPORT
- ADPCMWAVEFORMAT adpcm;
- #endif
- #ifdef D_ENABLE_DIVX_WMA_SUPPORT
- WMAWAVEFORMAT wma;
- #endif
- } WaveFormat;
- typedef struct
- {
- FOURCC fccType;
- FOURCC fccHandler;
- DWORD dwScale;
- DWORD dwRate;
- DWORD dwLength;
- } StreamHeadInfo;
- /*
- typedef struct
- {
- LONG lWidth;
- LONG lHeight;
- DWORD dwCompression;
- } BitmapInfo;
- typedef struct
- {
- WORD wFormatTag;
- DWORD dwSamplesPerSec;
-
- #ifdef D_ENABLE_ADPCM_SUPPORT
- WORD wSamplesPerBlock;
- WORD wBitsPerSample;
- #endif
- #if (defined(D_ENABLE_DIVX_WMA_SUPPORT) || defined(D_ENABLE_ADPCM_SUPPORT))
- WORD wChannels;
- WORD wBlockAlign;
- #endif
- DWORD dwAvgBytesPerSec;
- #ifdef D_ENABLE_DIVX_WMA_SUPPORT
- WORD wEncoderOptions;
- #endif
- } WaveFormatInfo;
- */
- /*
- typedef struct
- {
- StreamHeadInfo _aviStreamHeader;
- AVI_STREAM_TYPE _aviStreamType;
- union
- {
- BitmapInfo _bitMapInfoHeader;
- WaveFormatInfo _waveFormat;
- } _aviStreamFormat;
- } AVIStreamInfo;
- */
- /*
- typedef struct
- {
- UINT8 _streamID;
- StreamHeadInfo _aviStreamHeader;
- BitmapInfo _bitMapInfoHeader;
- } AVIVideoStreamInfo;
- typedef struct
- {
- UINT8 _streamID;
- StreamHeadInfo _aviStreamHeader;
- WaveFormatInfo _waveFormat;
- } AVIAudioStreamInfo;
- typedef struct
- {
- WORD wVersion;
- //STR sDRMInfo;
- } DRMInfo;
- */
- typedef struct
- {
- BYTE aFOURCCBuff[FOURCC_FIELD_LENGTH];
- UINT32 ulSize;
- BYTE* pData;
- BOOL bIsList;
- } FOURCCInfo;
- typedef struct
- {
- char ucChunkID[4];
- DWORD dwFlags;
- DWORD dwChunkOffset;
- DWORD dwChunkLength;
- } AVIIndexEntry;
- typedef struct
- {
- DWORD dwAudioChunksOffsets;
- DWORD dwAudioChunksLengths;
- DWORD dwAudioChunksFrames;
- } IdxFIFOElement;
- typedef struct
- {
- UINT32 ulVideoFrameNumber;
- UINT32 ulVideoChunkOffset;
- UINT32 ulVideoChunkSize;
- UINT32 ulAudioChunkOffset;
- UINT32 ulAudioChunkDelta;
- // Robin_1003_2004_D
- UINT16 uiSkipVideoChunks;
- UINT16 uiSkipAudioChunks;
- } IndexEntry;
- /////////////////////////////////////////////////////////////////////////////
- // Private Services
- BOOL _getNextFOURCC(DWORD dwClipStartAddr, DWORD dwOffset, FOURCCInfo* forccInfo);
- BOOL _searchForFORCC(DWORD dwClipStartAddr, DWORD* pdwOffset,
- LPSTR fourccName, FOURCCInfo* pFourccInfo, BOOL bReadFOURCCData);
- BOOL _aquireAVIStreamsInfo(DWORD dwClipStartAddr, DWORD dwOffset, DWORD *dwStrdOffset);
- BOOL _acquireAVIInfo(DWORD dwClipStartAddr);
- BOOL _getIdxEntry(DWORD dwClipStartAddr, DWORD dwOffset, DWORD ulIdxSize,
- AVIIndexEntry* pCurrEntry, BOOL bFirstTime, UINT32 ulLeftIdxSize);
- // Robin_1003_2004_D
- BOOL _saveIdxEntry(UINT32 ulVidFrameNumber, DWORD dwVidChunkOffset, DWORD dwVidChunkSize,
- DWORD dwAudioChunkOffset, DWORD dwAudioChunkDelta, UINT16 uiSkipVideoChunks, UINT16 uiSkipAudioChunks);
- BOOL _aquireAndProcessIdx(DWORD dwClipStartAddr, UINT8 uiVideoStreamNum, UINT8 uiAudioStreamNum, DWORD* dwFirstChunkOffset);
- BOOL _aviProcessTimeToAddressInfo(DWORD dwClipStartAddr, WORD wTime);
- BOOL _aviScan(INT8 iIndexIncrement, BOOL bContinue);
- EFourCCType StringToFourCC(char* fourCCstring);
- BOOL _getAdjacentIFrames(DWORD dwClipStartAddr, WORD wCurrTime,
- UINT32* ulFirstIFrame, UINT32* ulSecondIFrame,
- WORD* wFirstITime, WORD* wSecondITime,
- UINT32* ulFirstIIdx, UINT32* ulSecondIIdx);
- BOOL _getNextIFrames(DWORD dwClipStartAddr, UINT32 ulRequestedFrameNumber,
- UINT32* ulNextIIdx, WORD* wNextITime);
- #endif // __AVI_PRIVATE_H_