00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #pragma once
00033
00034 #include <libilliCore/iBE_Math.h>
00035 #include <libilliCore/iLE_Math.h>
00036
00037 #include <libOOOgg/libOOOgg.h>
00038 #include <libOOOggSeek/libOOOggSeek.h>
00039
00040 #include <libOOOgg/IOggCallback.h>
00041 #include <libOOOgg/OggDataBuffer.h>
00042 #include <libOOOggSeek/OggSeekTable.h>
00043
00044 #include "math.h"
00045 #include <fstream>
00046
00047 using namespace std;
00048
00049 class LIBOOOGGSEEK_API AutoOggSeekTable
00050 : public OggSeekTable
00051 , public IOggCallback
00052 {
00053 public:
00054
00055
00056
00057
00058
00060 AutoOggSeekTable(string inFileName);
00061 virtual ~AutoOggSeekTable(void);
00062
00063 static const LOOG_INT64 DS_UNITS = 10000000;
00064 static const unsigned long LINT_MAX = 4294967295UL;
00065
00067 virtual bool buildTable();
00068
00069
00070 virtual bool acceptOggPage(OggPage* inOggPage);
00071
00073 LOOG_INT64 fileDuration();
00074
00076 unsigned long serialisedSize();
00077
00079 bool serialiseInto(unsigned char* inBuff, unsigned long inBuffSize);
00080
00082 bool serialiseInto(const string inSeekTableFilename);
00083
00085 virtual bool buildTableFromBuffer(const unsigned char *inBuffer, const unsigned long inBufferSize);
00086
00088 virtual bool buildTableFromFile(const string inCachedSeekTableFilename);
00089
00090 protected:
00091 unsigned long mFilePos;
00092 unsigned long mPacketCount;
00093 unsigned long mSampleRate;
00094 unsigned long mNumHeaders;
00095
00096 unsigned long mSerialNoToTrack;
00097 unsigned long mGranulePosShift;
00098 bool mLastIsSeekable;
00099 bool isTheora;
00100 bool isFLAC;
00101 bool isOggFLAC_1_0;
00102 bool mFoundStreamInfo;
00103 LOOG_INT64 mLastSeekTime;
00104 LOOG_INT64 mFileDuration;
00105 fstream mFile;
00106 string mFileName;
00107
00108 OggDataBuffer* mOggDemux;
00109
00110
00111
00112 private:
00113 AutoOggSeekTable(const AutoOggSeekTable&);
00114 AutoOggSeekTable &operator=(const AutoOggSeekTable&);
00115 };