MatroskaFileParser Class Reference

#include <MatroskaFileParser.hh>

Inheritance diagram for MatroskaFileParser:

Inheritance graph
[legend]
Collaboration diagram for MatroskaFileParser:

Collaboration graph
[legend]

Public Member Functions

 MatroskaFileParser (MatroskaFile &ourFile, FramedSource *inputSource, FramedSource::onCloseFunc *onEndFunc, void *onEndClientData, MatroskaDemux *ourDemux=NULL)
virtual ~MatroskaFileParser ()
void seekToTime (double &seekNPT)
void continueParsing ()
virtual void flushInput ()

Static Public Member Functions

static void continueParsing (void *clientData, unsigned char *ptr, unsigned size, struct timeval presentationTime)

Protected Types

typedef void( clientContinueFunc )(void *clientData, unsigned char *ptr, unsigned size, struct timeval presentationTime)

Protected Member Functions

void saveParserState ()
u_int32_t get4Bytes ()
u_int32_t test4Bytes ()
u_int16_t get2Bytes ()
u_int8_t get1Byte ()
u_int8_t test1Byte ()
void getBytes (u_int8_t *to, unsigned numBytes)
void testBytes (u_int8_t *to, unsigned numBytes)
void skipBytes (unsigned numBytes)
void skipBits (unsigned numBits)
unsigned getBits (unsigned numBits)
unsigned curOffset () const
unsigned & totNumValidBytes ()
Boolean haveSeenEOF () const
unsigned bankSize () const

Private Member Functions

Boolean parse ()
Boolean parseStartOfFile ()
void lookForNextTrack ()
Boolean parseTrack ()
Boolean parseCues ()
void lookForNextBlock ()
void parseBlock ()
Boolean deliverFrameWithinBlock ()
void deliverFrameBytes ()
void getCommonFrameBytes (MatroskaTrack *track, u_int8_t *to, unsigned numBytesToGet, unsigned numBytesToSkip)
Boolean parseEBMLNumber (EBMLNumber &num)
Boolean parseEBMLIdAndSize (EBMLId &id, EBMLDataSize &size)
Boolean parseEBMLVal_unsigned64 (EBMLDataSize &size, u_int64_t &result)
Boolean parseEBMLVal_unsigned (EBMLDataSize &size, unsigned &result)
Boolean parseEBMLVal_float (EBMLDataSize &size, float &result)
Boolean parseEBMLVal_string (EBMLDataSize &size, char *&result)
Boolean parseEBMLVal_binary (EBMLDataSize &size, u_int8_t *&result)
void skipHeader (EBMLDataSize const &size)
void skipRemainingHeaderBytes (Boolean isContinuation)
void setParseState ()
void seekToFilePosition (u_int64_t offsetInFile)
void seekToEndOfFile ()
void resetStateAfterSeeking ()
virtual void restoreSavedParserState ()

Private Attributes

MatroskaFilefOurFile
FramedSourcefInputSource
FramedSource::onCloseFuncfOnEndFunc
void * fOnEndClientData
MatroskaDemuxfOurDemux
MatroskaParseState fCurrentParseState
u_int64_t fCurOffsetInFile
u_int64_t fSavedCurOffsetInFile
u_int64_t fLimitOffsetInFile
u_int64_t fNumHeaderBytesToSkip
EBMLId fLastSeekId
unsigned fClusterTimecode
unsigned fBlockSize
unsigned fBlockTrackNumber
short fBlockTimecode
unsigned fNumFramesInBlock
unsigned * fFrameSizesWithinBlock
double fPresentationTimeOffset
unsigned fNextFrameNumberToDeliver
unsigned fCurOffsetWithinFrame
unsigned fSavedCurOffsetWithinFrame
u_int8_t * fCurFrameTo
unsigned fCurFrameNumBytesToGet
unsigned fCurFrameNumBytesToSkip

Detailed Description

Definition at line 46 of file MatroskaFileParser.hh.


Member Typedef Documentation

typedef void( StreamParser::clientContinueFunc)(void *clientData, unsigned char *ptr, unsigned size, struct timeval presentationTime) [protected, inherited]

Definition at line 33 of file StreamParser.hh.


Constructor & Destructor Documentation

MatroskaFileParser::MatroskaFileParser ( MatroskaFile ourFile,
FramedSource inputSource,
FramedSource::onCloseFunc onEndFunc,
void *  onEndClientData,
MatroskaDemux ourDemux = NULL 
)

virtual MatroskaFileParser::~MatroskaFileParser (  )  [virtual]


Member Function Documentation

void MatroskaFileParser::seekToTime ( double &  seekNPT  ) 

static void MatroskaFileParser::continueParsing ( void *  clientData,
unsigned char *  ptr,
unsigned  size,
struct timeval  presentationTime 
) [static]

void MatroskaFileParser::continueParsing (  ) 

Boolean MatroskaFileParser::parse (  )  [private]

Boolean MatroskaFileParser::parseStartOfFile (  )  [private]

void MatroskaFileParser::lookForNextTrack (  )  [private]

Boolean MatroskaFileParser::parseTrack (  )  [private]

Boolean MatroskaFileParser::parseCues (  )  [private]

void MatroskaFileParser::lookForNextBlock (  )  [private]

void MatroskaFileParser::parseBlock (  )  [private]

Boolean MatroskaFileParser::deliverFrameWithinBlock (  )  [private]

void MatroskaFileParser::deliverFrameBytes (  )  [private]

void MatroskaFileParser::getCommonFrameBytes ( MatroskaTrack track,
u_int8_t *  to,
unsigned  numBytesToGet,
unsigned  numBytesToSkip 
) [private]

Boolean MatroskaFileParser::parseEBMLNumber ( EBMLNumber num  )  [private]

Boolean MatroskaFileParser::parseEBMLIdAndSize ( EBMLId id,
EBMLDataSize size 
) [private]

Boolean MatroskaFileParser::parseEBMLVal_unsigned64 ( EBMLDataSize size,
u_int64_t &  result 
) [private]

Boolean MatroskaFileParser::parseEBMLVal_unsigned ( EBMLDataSize size,
unsigned &  result 
) [private]

Boolean MatroskaFileParser::parseEBMLVal_float ( EBMLDataSize size,
float &  result 
) [private]

Boolean MatroskaFileParser::parseEBMLVal_string ( EBMLDataSize size,
char *&  result 
) [private]

Boolean MatroskaFileParser::parseEBMLVal_binary ( EBMLDataSize size,
u_int8_t *&  result 
) [private]

void MatroskaFileParser::skipHeader ( EBMLDataSize const &  size  )  [private]

void MatroskaFileParser::skipRemainingHeaderBytes ( Boolean  isContinuation  )  [private]

void MatroskaFileParser::setParseState (  )  [private]

void MatroskaFileParser::seekToFilePosition ( u_int64_t  offsetInFile  )  [private]

void MatroskaFileParser::seekToEndOfFile (  )  [private]

void MatroskaFileParser::resetStateAfterSeeking (  )  [private]

virtual void MatroskaFileParser::restoreSavedParserState (  )  [private, virtual]

Reimplemented from StreamParser.

virtual void StreamParser::flushInput (  )  [virtual, inherited]

void StreamParser::saveParserState (  )  [protected, inherited]

Referenced by MPEGVideoStreamParser::setParseState().

u_int32_t StreamParser::get4Bytes (  )  [inline, protected, inherited]

Definition at line 46 of file StreamParser.hh.

References StreamParser::fCurParserIndex, StreamParser::fRemainingUnparsedBits, and StreamParser::test4Bytes().

Referenced by MPEGVideoStreamParser::saveToNextCode(), and MPEGVideoStreamParser::skipToNextCode().

00046                         { // byte-aligned; returned in big-endian order
00047     u_int32_t result = test4Bytes();
00048     fCurParserIndex += 4;
00049     fRemainingUnparsedBits = 0;
00050 
00051     return result;
00052   }

u_int32_t StreamParser::test4Bytes (  )  [inline, protected, inherited]

Definition at line 53 of file StreamParser.hh.

References StreamParser::ensureValidBytes(), and StreamParser::nextToParse().

Referenced by StreamParser::get4Bytes().

00053                          { // as above, but doesn't advance ptr
00054     ensureValidBytes(4);
00055 
00056     unsigned char const* ptr = nextToParse();
00057     return (ptr[0]<<24)|(ptr[1]<<16)|(ptr[2]<<8)|ptr[3];
00058   }

u_int16_t StreamParser::get2Bytes (  )  [inline, protected, inherited]

Definition at line 60 of file StreamParser.hh.

References StreamParser::ensureValidBytes(), StreamParser::fCurParserIndex, StreamParser::fRemainingUnparsedBits, and StreamParser::nextToParse().

00060                         {
00061     ensureValidBytes(2);
00062 
00063     unsigned char const* ptr = nextToParse();
00064     u_int16_t result = (ptr[0]<<8)|ptr[1];
00065 
00066     fCurParserIndex += 2;
00067     fRemainingUnparsedBits = 0;
00068 
00069     return result;
00070   }

u_int8_t StreamParser::get1Byte (  )  [inline, protected, inherited]

Definition at line 72 of file StreamParser.hh.

References StreamParser::curBank(), StreamParser::ensureValidBytes(), StreamParser::fCurParserIndex, and StreamParser::fRemainingUnparsedBits.

Referenced by MPEGVideoStreamParser::saveToNextCode(), and MPEGVideoStreamParser::skipToNextCode().

00072                       { // byte-aligned
00073     ensureValidBytes(1);
00074     fRemainingUnparsedBits = 0;
00075     return curBank()[fCurParserIndex++];
00076   }

u_int8_t StreamParser::test1Byte (  )  [inline, protected, inherited]

Definition at line 77 of file StreamParser.hh.

References StreamParser::ensureValidBytes(), and StreamParser::nextToParse().

00077                        { // as above, but doesn't advance ptr
00078     ensureValidBytes(1);
00079     return nextToParse()[0];
00080   }

void StreamParser::getBytes ( u_int8_t *  to,
unsigned  numBytes 
) [inline, protected, inherited]

Definition at line 82 of file StreamParser.hh.

References StreamParser::fCurParserIndex, StreamParser::fRemainingUnparsedBits, and StreamParser::testBytes().

00082                                                  {
00083     testBytes(to, numBytes);
00084     fCurParserIndex += numBytes;
00085     fRemainingUnparsedBits = 0;
00086   }

void StreamParser::testBytes ( u_int8_t *  to,
unsigned  numBytes 
) [inline, protected, inherited]

Definition at line 87 of file StreamParser.hh.

References StreamParser::ensureValidBytes(), and StreamParser::nextToParse().

Referenced by StreamParser::getBytes().

00087                                                   { // as above, but doesn't advance ptr
00088     ensureValidBytes(numBytes);
00089     memmove(to, nextToParse(), numBytes);
00090   }

void StreamParser::skipBytes ( unsigned  numBytes  )  [inline, protected, inherited]

Definition at line 91 of file StreamParser.hh.

References StreamParser::ensureValidBytes(), and StreamParser::fCurParserIndex.

00091                                     {
00092     ensureValidBytes(numBytes);
00093     fCurParserIndex += numBytes;
00094   }

void StreamParser::skipBits ( unsigned  numBits  )  [protected, inherited]

unsigned StreamParser::getBits ( unsigned  numBits  )  [protected, inherited]

unsigned StreamParser::curOffset (  )  const [inline, protected, inherited]

Definition at line 100 of file StreamParser.hh.

References StreamParser::fCurParserIndex.

00100 { return fCurParserIndex; }

unsigned& StreamParser::totNumValidBytes (  )  [inline, protected, inherited]

Definition at line 102 of file StreamParser.hh.

References StreamParser::fTotNumValidBytes.

00102 { return fTotNumValidBytes; }

Boolean StreamParser::haveSeenEOF (  )  const [inline, protected, inherited]

Definition at line 104 of file StreamParser.hh.

References StreamParser::fHaveSeenEOF.

00104 { return fHaveSeenEOF; }

unsigned StreamParser::bankSize (  )  const [protected, inherited]


Field Documentation

MatroskaFile& MatroskaFileParser::fOurFile [private]

Definition at line 99 of file MatroskaFileParser.hh.

FramedSource* MatroskaFileParser::fInputSource [private]

Reimplemented from StreamParser.

Definition at line 100 of file MatroskaFileParser.hh.

FramedSource::onCloseFunc* MatroskaFileParser::fOnEndFunc [private]

Definition at line 101 of file MatroskaFileParser.hh.

void* MatroskaFileParser::fOnEndClientData [private]

Definition at line 102 of file MatroskaFileParser.hh.

MatroskaDemux* MatroskaFileParser::fOurDemux [private]

Definition at line 103 of file MatroskaFileParser.hh.

MatroskaParseState MatroskaFileParser::fCurrentParseState [private]

Definition at line 104 of file MatroskaFileParser.hh.

u_int64_t MatroskaFileParser::fCurOffsetInFile [private]

Definition at line 105 of file MatroskaFileParser.hh.

u_int64_t MatroskaFileParser::fSavedCurOffsetInFile [private]

Definition at line 105 of file MatroskaFileParser.hh.

u_int64_t MatroskaFileParser::fLimitOffsetInFile [private]

Definition at line 105 of file MatroskaFileParser.hh.

u_int64_t MatroskaFileParser::fNumHeaderBytesToSkip [private]

Definition at line 108 of file MatroskaFileParser.hh.

EBMLId MatroskaFileParser::fLastSeekId [private]

Definition at line 111 of file MatroskaFileParser.hh.

unsigned MatroskaFileParser::fClusterTimecode [private]

Definition at line 114 of file MatroskaFileParser.hh.

unsigned MatroskaFileParser::fBlockSize [private]

Definition at line 117 of file MatroskaFileParser.hh.

unsigned MatroskaFileParser::fBlockTrackNumber [private]

Definition at line 118 of file MatroskaFileParser.hh.

short MatroskaFileParser::fBlockTimecode [private]

Definition at line 119 of file MatroskaFileParser.hh.

unsigned MatroskaFileParser::fNumFramesInBlock [private]

Definition at line 120 of file MatroskaFileParser.hh.

unsigned* MatroskaFileParser::fFrameSizesWithinBlock [private]

Definition at line 121 of file MatroskaFileParser.hh.

double MatroskaFileParser::fPresentationTimeOffset [private]

Definition at line 124 of file MatroskaFileParser.hh.

unsigned MatroskaFileParser::fNextFrameNumberToDeliver [private]

Definition at line 125 of file MatroskaFileParser.hh.

unsigned MatroskaFileParser::fCurOffsetWithinFrame [private]

Definition at line 126 of file MatroskaFileParser.hh.

unsigned MatroskaFileParser::fSavedCurOffsetWithinFrame [private]

Definition at line 126 of file MatroskaFileParser.hh.

u_int8_t* MatroskaFileParser::fCurFrameTo [private]

Definition at line 129 of file MatroskaFileParser.hh.

unsigned MatroskaFileParser::fCurFrameNumBytesToGet [private]

Definition at line 130 of file MatroskaFileParser.hh.

unsigned MatroskaFileParser::fCurFrameNumBytesToSkip [private]

Definition at line 131 of file MatroskaFileParser.hh.


The documentation for this class was generated from the following file:
Generated on Mon Sep 22 12:07:01 2014 for live by  doxygen 1.5.2