BodyReader Class Reference

BodyReader class - reads from an MXF file (reads data is "pulled" from the file). More...

#include <essence.h>

Inheritance diagram for BodyReader:

RefCount IRefCount List of all members.

Public Member Functions

 BodyReader (MXFFilePtr File)
 Construct a body reader and associate it with an MXF file.
Position Seek (Position Pos=0)
 Seek to a specific point in the file.
Position Tell (void)
 Tell the current file location.
Position Seek (UInt32 BodySID, Position Pos)
 Seek to a specific byte offset in a given stream.
Position Tell (UInt32 BodySID)
 Report the byte offset in a given stream.
void SetDefaultHandler (GCReadHandlerPtr DefaultHandler=NULL)
 Set the default handler for all new GCReaders.
void SetFillerHandler (GCReadHandlerPtr FillerHandler=NULL)
 Set the filler handler for all new GCReaders.
void SetEncryptionHandler (GCReadHandlerPtr EncryptionHandler=NULL)
 Set the encryption handler for all new GCReaders.
bool MakeGCReader (UInt32 BodySID, GCReadHandlerPtr DefaultHandler=NULL, GCReadHandlerPtr FillerHandler=NULL)
 Make a GCReader for the specified BodySID.
GCReaderPtr GetGCReader (UInt32 BodySID)
 Get a pointer to the GCReader used for the specified BodySID.
bool ReadFromFile (bool SingleKLV=false)
 Read from file.
bool ReSync ()
 Resync after possible loss or corruption of body data.
bool IsAtPartition (void)
 Are we currently at the start of a partition pack?
bool Eof (void)
 Are we currently at the end of the file?
UInt32 GetBodySID (void)
 Get the BodySID of the current location (0 if not known).

Protected Member Functions

bool InitSeek (void)
 Initialize the per SID seek system.

Protected Attributes

MXFFilePtr File
 File from which to read.
Position CurrentPos
 Current position within file.
bool NewPos
 The value of CurrentPos has been updated by a seek - therefore reading must be reinitialized!
bool SeekInited
 True once the per SID seek system has been initialized.
bool AtPartition
 Are we (to our knowledge) at the start of a partition pack?
bool AtEOF
 Are we (to our knowledge) at the end of the file?
UInt32 CurrentBodySID
 The currentBodySID being processed.
GCReadHandlerPtr GCRDefaultHandler
 Default handler to use for new GCReaders.
GCReadHandlerPtr GCRFillerHandler
 Filler handler to use for new GCReaders.
GCReadHandlerPtr GCREncryptionHandler
 Encryption handler to use for new GCReaders.
std::map< UInt32, GCReaderPtrReaders
 Map of GCReaders indexed by BodySID.

Detailed Description

BodyReader class - reads from an MXF file (reads data is "pulled" from the file).


Constructor & Destructor Documentation

BodyReader ( MXFFilePtr  File  ) 

Construct a body reader and associate it with an MXF file.


Member Function Documentation

Position Seek ( Position  Pos = 0  ) 

Seek to a specific point in the file.

Returns:
New location or -1 on seek error

Position Tell ( void   )  [inline]

Tell the current file location.

Position Seek ( UInt32  BodySID,
Position  Pos 
)

Seek to a specific byte offset in a given stream.

Returns:
New file offset or -1 on seek error

Position Tell ( UInt32  BodySID  ) 

Report the byte offset in a given stream.

Returns:
File offset or -1 if not known or stream does not exist

void SetDefaultHandler ( GCReadHandlerPtr  DefaultHandler = NULL  )  [inline]

Set the default handler for all new GCReaders.

Each time a new GCReader is created this default handler will be used if no other is specified

void SetFillerHandler ( GCReadHandlerPtr  FillerHandler = NULL  )  [inline]

Set the filler handler for all new GCReaders.

Each time a new GCReader is created this filler handler will be used if no other is specified

void SetEncryptionHandler ( GCReadHandlerPtr  EncryptionHandler = NULL  )  [inline]

Set the encryption handler for all new GCReaders.

Each time a new GCReader is created this encryption handler will be used

bool MakeGCReader ( UInt32  BodySID,
GCReadHandlerPtr  DefaultHandler = NULL,
GCReadHandlerPtr  FillerHandler = NULL 
)

Make a GCReader for the specified BodySID.

Returns:
true on success, false on error (such as there is already a GCReader for this BodySID)

GCReaderPtr GetGCReader ( UInt32  BodySID  )  [inline]

Get a pointer to the GCReader used for the specified BodySID.

bool ReadFromFile ( bool  SingleKLV = false  ) 

Read from file.

All KLVs are dispatched to handlers Stops reading at the next partition pack unless SingleKLV is true when only one KLV is dispatched

Returns:
true if all went well, false end-of-file, an error occured or StopReading() was called on the current GCReader

bool ReSync (  ) 

Resync after possible loss or corruption of body data.

Searches for the next partition pack and moves file pointer to that point

Returns:
false if an error (or EOF found)

bool IsAtPartition ( void   ) 

Are we currently at the start of a partition pack?

bool Eof ( void   ) 

Are we currently at the end of the file?

UInt32 GetBodySID ( void   )  [inline]

Get the BodySID of the current location (0 if not known).

bool InitSeek ( void   )  [protected]

Initialize the per SID seek system.

To allow us to seek to byte offsets within a file we need to initialize various structures - seeking is not always possible!!

Returns:
False if seeking could not be initialized (perhaps because the file is not seekable)


Member Data Documentation

MXFFilePtr File [protected]

File from which to read.

Position CurrentPos [protected]

Current position within file.

bool NewPos [protected]

The value of CurrentPos has been updated by a seek - therefore reading must be reinitialized!

bool SeekInited [protected]

True once the per SID seek system has been initialized.

bool AtPartition [protected]

Are we (to our knowledge) at the start of a partition pack?

bool AtEOF [protected]

Are we (to our knowledge) at the end of the file?

UInt32 CurrentBodySID [protected]

The currentBodySID being processed.

GCReadHandlerPtr GCRDefaultHandler [protected]

Default handler to use for new GCReaders.

GCReadHandlerPtr GCRFillerHandler [protected]

Filler handler to use for new GCReaders.

GCReadHandlerPtr GCREncryptionHandler [protected]

Encryption handler to use for new GCReaders.

std::map<UInt32, GCReaderPtr> Readers [protected]

Map of GCReaders indexed by BodySID.


The documentation for this class was generated from the following files:
Generated on Mon Apr 2 15:20:59 2007 for MXFLib by  doxygen 1.5.1-p1