00001 //*************************************************************************************** 00002 // 00003 // File supervisor: Robert Belanger 00004 // 00005 // (c) Copyright 2001 Avid Technology, Inc. . All rights reserved. 00006 // 00007 // 00008 // @doc 00009 // 00010 // @module BufferFilter.h | Main header file for BufferFilter 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 _BUFFERFILTER_H_ 00029 #define _BUFFERFILTER_H_ 00030 00031 #include <SIBCUtil.h> 00032 #include <SIBCString.h> 00033 00034 #include "CXSIFilter.h" 00035 00036 #define BUFFER_FILTER_NAME "Buffer" 00037 #define BUFFER_FILTER_ID "buf" 00038 00039 #ifdef _PSX2 00040 #define BUFFER_SIZE (32 * 1024) 00041 #else 00042 #define BUFFER_SIZE (128 * 1024) 00043 #endif 00045 /* 00046 * This class will gather up to a certain size of data until it calls its subfilter to 00047 * write or it will read up to a certain size in one go and answer to request until it 00048 * has exhausted the data at which point it will ask its subfilter for more data. 00049 */ 00050 class CBufferFilter : public CXSIFilter 00051 { 00052 public: 00056 CBufferFilter(); 00060 virtual ~CBufferFilter(); 00061 00066 int Open ( CSIBCString in_szFilename, _SI_FILE_MODE in_Mode ); 00069 int Close (); 00070 00076 int Read ( SI_Char * out_pBuffer, SI_Long in_lSize ); 00082 int Write( SI_Char * in_pBuffer, SI_Long in_lSize ); 00083 00084 00088 int Eof(); 00092 int Tell(); 00093 00094 00095 00096 private: 00097 void Flush(); 00098 void FillBuffer(); 00099 00100 char *m_pBuffer; 00101 LONG m_lPosition; 00102 SI_Long m_lSizeRead; 00103 bool m_bHeaderSkipped; 00104 }; 00105 00106 #endif