home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 275 / DPCS0111DVD.ISO / Toolkit / Audio-Visual / VirtualDub / Source / VirtualDub-1.9.10-src.7z / src / Meia / h / MPEGCache.h < prev    next >
Encoding:
C/C++ Source or Header  |  2009-09-14  |  683 b   |  33 lines

  1. #ifndef f_VD2_MEIA_MPEGCACHE_H
  2. #define f_VD2_MEIA_MPEGCACHE_H
  3.  
  4. #include <vector>
  5. #include <vd2/system/vdtypes.h>
  6.  
  7. class VDMPEGCache {
  8. public:
  9.     VDMPEGCache(int nBlocks, int nBlockLen);
  10.     ~VDMPEGCache();
  11.  
  12.     bool Read(void *pData, int64 bytepos, int len, int offset);
  13.     void Write(const void *pData, int64 bytepos, int len);
  14.  
  15. private:
  16.     struct CacheEntry {
  17.         int64            pos;        // The assumption is that zero is never a valid start for a pack's data
  18.         int                len;        // length of this cache block
  19.         int                next;
  20.         int                age;
  21.     };
  22.  
  23.     char *mpCacheMemory;
  24.     unsigned        mNextAgeValue;
  25.     int                mBlockSize;
  26.  
  27.     std::vector<CacheEntry> mCacheBlocks;
  28.  
  29.     int Evict();
  30. };
  31.  
  32. #endif
  33.