00001 //*************************************************************************************** 00002 // 00003 // File supervisor: Dominic Laflamme 00004 // 00005 // (c) Copyright 2001 Avid Technology, Inc. . All rights reserved. 00006 // 00007 // 00008 // @doc 00009 // 00010 // @module BINFilter.h | Main header file for CBINFilter implementation 00011 //*************************************************************************************** 00012 00013 /**************************************************************************************** 00014 THIS CODE IS PUBLISHED AS A SAMPLE ONLY AND IS PROVIDED "AS IS". 00015 IN NO EVENT SHALL SOFTIMAGE, AVID TECHNOLOGY, INC. AND/OR THEIR RESPECTIVE 00016 SUPPLIERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY 00017 DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 00018 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 00019 CONNECTION WITH THE USE OR PERFORMANCE OF THIS CODE . 00020 00021 COPYRIGHT NOTICE. Copyright © 1999-2002 Avid Technology Inc. . All rights reserved. 00022 00023 SOFTIMAGE is a registered trademark of Avid Technology Inc. or its subsidiaries 00024 or divisions. Windows NT is a registered trademark of Microsoft Corp. All other 00025 trademarks contained herein are the property of their respective owners. 00026 ****************************************************************************************/ 00027 00028 #ifndef _BINFILTER_H_ 00029 #define _BINFILTER_H_ 00030 00031 #include <SIBCUtil.h> 00032 #include <SIBCString.h> 00033 00034 #include "CXSIFilter.h" 00035 00036 #define BIN_FILTER_NAME "Binary" 00037 #define BIN_FILTER_ID "bin" 00038 #define GROW_BUFFER_MULTIPLIER 0.1f 00039 #define GROW_BUFFER_BYTE_AMOUNT 14 00040 00042 /* 00043 * This supports 3.0 compression (entire file at once) and 3.5 and up where we compress 00044 * one chunk at a time therefore reducing the overall memory usage 00045 */ 00046 class CBINFilter : public CXSIFilter 00047 { 00048 public: 00053 CBINFilter( bool in_bLegacy ); 00057 virtual ~CBINFilter(); 00058 00063 int Open ( CSIBCString in_szFilename, _SI_FILE_MODE in_Mode ); 00066 int Close (); 00067 00073 int Read ( SI_Char * out_pBuffer, SI_Long in_lSize ); 00079 int Write( SI_Char * in_pBuffer, SI_Long in_lSize ); 00080 00081 00085 int Eof(); 00089 int Tell(); 00090 00091 00092 private: 00093 void ReadBlock(); 00094 00095 void AdjustBuffer( SI_Long in_lSize ); 00096 00097 SI_UByte * m_pBytes; 00098 SI_UByte * m_pCompressedBuffer; 00099 SI_Long m_lCompressedBufferSize; 00100 SI_Long m_lPosition, m_lSize; 00101 bool m_bLegacy; 00102 bool m_bEof; 00103 }; 00104 00105 #endif