AutoOggSeekTable.h

Go to the documentation of this file.
00001 //===========================================================================
00002 //Copyright (C) 2003, 2004 Zentaro Kavanagh
00003 //
00004 //Redistribution and use in source and binary forms, with or without
00005 //modification, are permitted provided that the following conditions
00006 //are met:
00007 //
00008 //- Redistributions of source code must retain the above copyright
00009 //  notice, this list of conditions and the following disclaimer.
00010 //
00011 //- Redistributions in binary form must reproduce the above copyright
00012 //  notice, this list of conditions and the following disclaimer in the
00013 //  documentation and/or other materials provided with the distribution.
00014 //
00015 //- Neither the name of Zentaro Kavanagh nor the names of contributors 
00016 //  may be used to endorse or promote products derived from this software 
00017 //  without specific prior written permission.
00018 //
00019 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00020 //``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00021 //LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
00022 //PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE ORGANISATION OR
00023 //CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00024 //EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00025 //PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00026 //PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00027 //LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00028 //NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00029 //SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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 //#include "FLACMath.h"
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         // TODO: We really should modify AutoOggSeekTable so that passing in a
00056         // filename isn't required, if all we want is a seek table with no
00057         // associated file ...
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         //IOggCallback interface
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         //Changed for debugging to *
00108         OggDataBuffer* mOggDemux;
00109 
00110         //fstream debugLog;
00111 
00112 private:
00113         AutoOggSeekTable(const AutoOggSeekTable&);  // Don't copy me
00114     AutoOggSeekTable &operator=(const AutoOggSeekTable&);  // Don't assign men
00115 };

Generated on Tue Feb 15 14:54:21 2005 for oggdsf by  doxygen 1.3.9