00001 // cobfBuf.h : interface of bidirectional bit reading through file buffer 00002 // 00003 // This class provides a set of bit-based and byte-based functions 00004 // to read information from bufferred file in two direction and manage buffer. 00005 // 00006 //***************************************************************************** 00007 // 00008 // MPEG Developing Classes 00009 // 00010 // Copyright (C) 1998, Vision and Neural Networks Laboratory, Computer Science 00011 // Department, Wayne State University, All Rights Reserved; 00012 // 00013 // Disclaimer of Warranty 00014 // 00015 // MPEG Developing Classes, both binary and source (hereafter, Software) 00016 // is copyrighted by Vision and Neural Networks Laboratory, Computer Science 00017 // Department, Wayne State University (WSU), and ownership remains with WSU. 00018 // 00019 // Permission is hereby granted, free of charge, to any person obtaining 00020 // a copy of this software and associated documentation files to use, copy, 00021 // and distribute the software, provided that no charge is associated with 00022 // such copies and that the copyright notice and this statement appears on 00023 // all copies. 00024 // 00025 // THE SOFTWARE IS AVAILABLE TO THE USER ON AN "AS IS" BASIS, WITHOUT WARRANTY 00026 // OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, THE 00027 // IMPLIED WARRANTIES OR MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 00028 // IN NO EVENT SHALL THE COPYRIGHT-HOLDER BE LIABLE FOR ANY CLAIMS, DAMAGES, OR 00029 // OTHER LIABILITIES OF ANY KIND WHATSOEVER ARISING FROM, OUT OF OR IN CONNECTION 00030 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. THIS 00031 // DISCLAIMAER OF WARRANTY EXTENDS TO THE USER OF THIS SOFTWARE. ALSO THE WSU 00032 // DOES NOT REPRESENT OR WARRANT THAT THE SOFTWARE FURNISHED HEREUNDER ARE FREE OF 00033 // INFRINGMENT OF ANY THIRD-PARTY PATENTS. 00034 // 00035 // Many patents of MPEG-1 and MPEG-2 are general enough such that commercial 00036 // implementations, including shareware, are unavoidable subject to royalty fees to 00037 // patent holders, regardless of implementation design. 00038 // 00039 // 00040 // Vision and Neural Networks Laboratory, 00041 // Computer Science Department, 00042 // Wayne State University, 00043 // Detroit, MI 48202. 00044 // Dongge Li(dil@cs.wayne.edu) and Ishwar K. Sethi(sethi@cs.wayne.edu). 00045 // 00047 00048 #if !defined COBITFILEBUF_H 00049 #define COBITFILEBUF_H 00050 00051 #include <stdio.h> 00052 #include "datatype.h" 00053 #include "cobitbuf.h" 00054 00055 class COBitFileBuf : public COBitBuf 00056 { 00057 // constructor and destructor 00058 public: 00059 COBitFileBuf(); 00060 ~COBitFileBuf(); 00061 00062 // attributes 00063 protected: 00064 FILE *pfFile; 00065 long lBufStartFPos, lBufEndFPos; 00066 long lFileLength; 00067 00068 // operation 00069 public: 00070 int InitBuffer(FILE *pfTheFile, DWORD dwBufferSize); 00071 long GetCurFilePos(void); 00072 long FlushBuf(long lFilePos); 00073 00074 // override 00075 public: 00076 void ResetBuffer(void); 00077 00078 protected: 00079 virtual long FwdLoadData(long lLoadStartPos, DWORD dwItemNum); // used by other functions 00080 virtual long BackLoadData(long lLoadEndPos, DWORD dwItemNum); 00081 virtual long FlushBuf(long lOffset, BUFPOS *pBufPos); 00082 }; 00083 00084 #endif // COBITFILEBUF_H