BodyStream Class Reference

Class holding data relating to a stream to be written by BodyWriter. More...

#include <essence.h>

Inheritance diagram for BodyStream:

RefCount IRefCount List of all members.

Public Types

enum  StateType {
  BodyStreamStart = 0, BodyStreamHeadIndex, BodyStreamPreBodyIndex, BodyStreamBodyWithIndex,
  BodyStreamBodyNoIndex, BodyStreamPostBodyIndex, BodyStreamFootIndex, BodyStreamDone
}
 Define the action required next for this stream. More...
enum  IndexType {
  StreamIndexNone = 0, StreamIndexFullFooter = 1, StreamIndexSparseFooter = 2, StreamIndexSprinkled = 4,
  StreamIndexSprinkledIsolated = 8, StreamIndexCBRHeader = 16, StreamIndexCBRHeaderIsolated = 32, StreamIndexCBRFooter = 64,
  StreamIndexCBRBody = 128, StreamIndexCBRIsolated = 256, StreamIndexCBRPreIsolated = 512
}
 The index table type or types of this stream. More...
enum  WrapType { StreamWrapOther = 0, StreamWrapFrame, StreamWrapClip }
 Wrapping types for streams. More...

Public Member Functions

 BodyStream (UInt32 SID, EssenceSourcePtr &EssSource, DataChunkPtr Key=NULL, bool NonGC=false)
 Construct an body stream object with a given essence source.
EssenceSourcePtrGetSource (void)
 Get the essence source for this stream.
size_type SubStreamCount (void)
 Get the number of sub-streams (includes the master stream).
void AddSubStream (EssenceSourcePtr &SubSource, DataChunkPtr Key=NULL, bool NonGC=false)
 Add a new sub-stream.
UInt32 GetBodySID (void)
 Get this stream's BodySID.
void SetIndexSID (UInt32 SID)
 Set this stream's IndexSID.
UInt32 GetIndexSID (void)
 Get this stream's IndexSID.
void SetState (StateType NewState)
 Set the stream's state.
StateType GetState (void)
 Get the current state.
StateType GetNextState (void)
 Get the next state.
void AddIndexType (IndexType NewIndexType)
 Add the specified index type(s).
void SetIndexType (IndexType NewIndexType)
 Set the index type(s) to the desired value.
IndexType GetIndexType (void)
 Get the index type(s).
void SetFooterIndex (IndexType NewIndexType)
 Set the footer index flags to the desired value.
IndexType GetFooterIndex (void)
 Get the footer index flags.
void SetWrapType (WrapType NewWrapType)
 Set the wrapping type for this stream.
void SetWrapType (WrappingOption::WrapType NewWrapType)
 Set the wrapping type for this stream.
WrapType GetWrapType (void)
 Get the wrapping type of this stream.
void SetWriter (GCWriterPtr &Writer)
 Set the current GCWriter.
IndexManagerPtrGetIndexManager (void)
 Get the current index manager.
GCWriterPtrGetWriter (void)
 Get a reference to the current GCWriter.
UInt32 GetTrackNumber (void)
 Get the track number associated with this stream.
Uint32 GetTrackNumber (GCStreamID ID)
 Get the track number associated with a specified stream or sub-stream.
void SetPendingData (bool Value=true)
 Set the pending essence data flag.
bool HasPendingData (void)
 Find out if there is any essence data stored in the GCWriter pending a write.
void SetEndOfStream (bool Value=true)
 Set the EndOfStream flag.
bool GetEndOfStream (void)
 Find out if there is any essence data remaining for this stream.
void SetNextSprinkled (Position Sprinkled)
 Set the first edit unit for the next sprinkled index segment.
Position GetNextSprinkled (void)
 Get the first edit unit for the next sprinkled index segment.
void SetKAG (UInt32 NewKAG)
 Set the KLV Alignment Grid.
UInt32 GetKAG (void)
 Get the KLV Alignment Grid.
void SetForceBER4 (bool Force)
 Set flag if BER lengths should be forced to 4-byte (where possible).
bool GetForceBER4 (void)
 Get flag stating whether BER lengths should be forced to 4-byte (where possible).
void SetEditAlign (bool Align)
 Set edit align forced partitioning flag.
bool GetEditAlign (void)
 Get edit align forced partitioning flag.
void SetFreeSpaceIndex (bool Flag)
 Set the "FreeSpaceIndex" flag.
bool GetFreeSpaceIndex (void)
 Read the "FreeSpaceIndex" flag.
void SetValueRelativeIndexing (bool Val)
 Set value-relative indexing flag.
bool GetValueRelativeIndexing (void)
 Get value-relative indexing flag.
Length GetPrechargeSize (void) const
 Read the number of edit units of pre-charge remaining.
void DecrementPrecharge (void)
 Reduce the precharge count by one.
void InitIndexManager (void)
 Initialize an index manager if required.

Public Attributes

std::list< PositionSparseList
 List of edit units to include in sparse index tables.

Protected Member Functions

 BodyStream ()
 Prevent NULL construction.
 BodyStream (BodyStream &)
 Prevent copy construction.

Protected Attributes

EssenceSourcePtr Source
 The essence source for this stream.
EssenceSourceList SubStreams
 Sources for each sub-stream.
EssenceSourceList::iterator SubStream_it
 Current sub-stream.
bool SubStreamRestart
 Flag true when the sub-stream iterator needs moving to the top of the list next time.
StateType State
 The state of this stream.
IndexType StreamIndex
 The index type(s) of this stream.
IndexType FooterIndexFlags
 Set of flags for tracking footer index tables.
UInt32 BodySID
 BodySID to use for this stream.
UInt32 IndexSID
 IndexSID to use for indexing this stream.
WrapType StreamWrap
 The wrapping type of this stream.
GCWriterPtr StreamWriter
 The writer for this stream.
bool EssencePendingData
 Is there any essence data pending in the writer?
bool EndOfStream
 No more essence available for this stream.
IndexManagerPtr IndexMan
 The index manager for this stream.
Position NextSprinkled
 The location of the first edit-unit to use for the next sprinkled index segment.
bool FreeSpaceIndex
 True if the free space at the end of the essenc eis to be indexed.
bool ValueRelativeIndexing
 Flag to allow value-relative indexing.
Length PrechargeSize
 The number of edit units of pre-charge remaining to be written.
UInt32 KAG
 KLV Alignment Grid to use for this stream (of zero if default for this body is to be used).
bool ForceBER4
 Flag set if BER lengths for this stream should be forced to 4-byte (where possible).
bool EditAlign
 Flag set if partitioning is to be done only on edit boundaries.

Detailed Description

Class holding data relating to a stream to be written by BodyWriter.

Sub-streams can be added as pointers to their essence sources as this class is derived from EssenceSourceList. Sub-streams will be written in the same generic container as this stream. This stream's essence source will appear as the first "child" when the EssenceSourceList is scanned


Member Enumeration Documentation

enum StateType

Define the action required next for this stream.

Enumerator:
BodyStreamStart  This stream has not yet done anything - state unknown.
BodyStreamHeadIndex  Next action: Write a "header" index table - if required in an isolated partition following the header.
BodyStreamPreBodyIndex  Next action: Write an isolated index table before the next body partition.
BodyStreamBodyWithIndex  Next action: Write a body partition with an index table.
BodyStreamBodyNoIndex  Next action: Write a body partition without index table.
BodyStreamPostBodyIndex  Next action: Write an isolated index table after a body partition.
BodyStreamFootIndex  Next action: Write a "footer" index table - if required in an isolated partition before the footer.
BodyStreamDone  All done - no more actions required.

enum IndexType

The index table type or types of this stream.

Enumerator:
StreamIndexNone  No index table will be written.
StreamIndexFullFooter  A full index table will be written in the footer if possible (or an isolated partition just before the footer if another index is going to use the footer).
StreamIndexSparseFooter  A sparse index table will be written in the footer if possible (or an isolated partition just before the footer if another index is going to use the footer).
StreamIndexSprinkled  A full index table will be sprinkled through the file, one chunk in each of this essence's body partitions, and one in or just before the footer.
StreamIndexSprinkledIsolated  A full index table will be sprinkled through the file, one chunk in an isolated partition following each of this essence's body partitions.
StreamIndexCBRHeader  A CBR index table will be written in the header (or an isolated partition following the header if another index table exists in the header).
StreamIndexCBRHeaderIsolated  A CBR index table will be written in an isolated partition following the header.
StreamIndexCBRFooter  A CBR index table will be written in the footer if possible (or an isolated partition just before the footer if another index is going to use the footer).
StreamIndexCBRBody  A CBR index table will be written in each body partition for this stream.
StreamIndexCBRIsolated  A CBR index table will be written in an isolated body partition following each partition of this stream.
StreamIndexCBRPreIsolated  A CBR index table will be written in an isolated body partition before each partition of this stream.

enum WrapType

Wrapping types for streams.

Enumerator:
StreamWrapOther  Other non-standard wrapping types - the essence source will supply one KLVs worth at a time (??).
StreamWrapFrame  Frame wrapping.
StreamWrapClip  Clip wrapping.


Constructor & Destructor Documentation

BodyStream (  )  [protected]

Prevent NULL construction.

BodyStream ( BodyStream  )  [protected]

Prevent copy construction.

BodyStream ( UInt32  SID,
EssenceSourcePtr EssSource,
DataChunkPtr  Key = NULL,
bool  NonGC = false 
) [inline]

Construct an body stream object with a given essence source.


Member Function Documentation

EssenceSourcePtr& GetSource ( void   )  [inline]

Get the essence source for this stream.

size_type SubStreamCount ( void   )  [inline]

Get the number of sub-streams (includes the master stream).

void AddSubStream ( EssenceSourcePtr SubSource,
DataChunkPtr  Key = NULL,
bool  NonGC = false 
)

Add a new sub-stream.

UInt32 GetBodySID ( void   )  [inline]

Get this stream's BodySID.

void SetIndexSID ( UInt32  SID  )  [inline]

Set this stream's IndexSID.

UInt32 GetIndexSID ( void   )  [inline]

Get this stream's IndexSID.

void SetState ( StateType  NewState  )  [inline]

Set the stream's state.

StateType GetState ( void   )  [inline]

Get the current state.

BodyStream::StateType GetNextState ( void   ) 

Get the next state.

Sets State to the next state

Returns:
The next state (now the current state)

void AddIndexType ( IndexType  NewIndexType  )  [inline]

Add the specified index type(s).

void SetIndexType ( IndexType  NewIndexType  )  [inline]

Set the index type(s) to the desired value.

Note:
This sets the complete value, it doesn't just add an option - to add "X" use AddIndexType()

IndexType GetIndexType ( void   )  [inline]

Get the index type(s).

void SetFooterIndex ( IndexType  NewIndexType  )  [inline]

Set the footer index flags to the desired value.

Note:
This sets the complete value, it doesn't just add an option - to add "X" use SetFooterIndex(GetFooterIndex() | "X");

IndexType GetFooterIndex ( void   )  [inline]

Get the footer index flags.

void SetWrapType ( WrapType  NewWrapType  )  [inline]

Set the wrapping type for this stream.

void SetWrapType ( WrappingOption::WrapType  NewWrapType  )  [inline]

Set the wrapping type for this stream.

WrapType GetWrapType ( void   )  [inline]

Get the wrapping type of this stream.

void SetWriter ( GCWriterPtr Writer  ) 

Set the current GCWriter.

IndexManagerPtr& GetIndexManager ( void   )  [inline]

Get the current index manager.

GCWriterPtr& GetWriter ( void   )  [inline]

Get a reference to the current GCWriter.

UInt32 GetTrackNumber ( void   )  [inline]

Get the track number associated with this stream.

Uint32 GetTrackNumber ( GCStreamID  ID  )  [inline]

Get the track number associated with a specified stream or sub-stream.

void SetPendingData ( bool  Value = true  )  [inline]

Set the pending essence data flag.

bool HasPendingData ( void   )  [inline]

Find out if there is any essence data stored in the GCWriter pending a write.

void SetEndOfStream ( bool  Value = true  )  [inline]

Set the EndOfStream flag.

bool GetEndOfStream ( void   )  [inline]

Find out if there is any essence data remaining for this stream.

void SetNextSprinkled ( Position  Sprinkled  )  [inline]

Set the first edit unit for the next sprinkled index segment.

Position GetNextSprinkled ( void   )  [inline]

Get the first edit unit for the next sprinkled index segment.

void SetKAG ( UInt32  NewKAG  )  [inline]

Set the KLV Alignment Grid.

UInt32 GetKAG ( void   )  [inline]

Get the KLV Alignment Grid.

void SetForceBER4 ( bool  Force  )  [inline]

Set flag if BER lengths should be forced to 4-byte (where possible).

bool GetForceBER4 ( void   )  [inline]

Get flag stating whether BER lengths should be forced to 4-byte (where possible).

void SetEditAlign ( bool  Align  )  [inline]

Set edit align forced partitioning flag.

bool GetEditAlign ( void   )  [inline]

Get edit align forced partitioning flag.

void SetFreeSpaceIndex ( bool  Flag  )  [inline]

Set the "FreeSpaceIndex" flag.

Note:
DRAGONS: Setting this flag will cause index tables that are not SMPTE 377M complient to be created

bool GetFreeSpaceIndex ( void   )  [inline]

Read the "FreeSpaceIndex" flag.

void SetValueRelativeIndexing ( bool  Val  )  [inline]

Set value-relative indexing flag.

Value-relative indexing will produce index tables that count from the first byte of the KLV of clip-wrapped essence rather than the key. These tables can be used internally but must not be written to a file as they are not 377M complient

bool GetValueRelativeIndexing ( void   )  [inline]

Get value-relative indexing flag.

Value-relative indexing will produce index tables that count from the first byte of the KLV of clip-wrapped essence rather than the key. These tables can be used internally but must not be written to a file as they are not 377M complient

Length GetPrechargeSize ( void   )  const [inline]

Read the number of edit units of pre-charge remaining.

void DecrementPrecharge ( void   )  [inline]

Reduce the precharge count by one.

void InitIndexManager ( void   ) 

Initialize an index manager if required.


Member Data Documentation

EssenceSourcePtr Source [protected]

The essence source for this stream.

EssenceSourceList SubStreams [protected]

Sources for each sub-stream.

EssenceSourceList::iterator SubStream_it [protected]

Current sub-stream.

bool SubStreamRestart [protected]

Flag true when the sub-stream iterator needs moving to the top of the list next time.

StateType State [protected]

The state of this stream.

IndexType StreamIndex [protected]

The index type(s) of this stream.

IndexType FooterIndexFlags [protected]

Set of flags for tracking footer index tables.

UInt32 BodySID [protected]

BodySID to use for this stream.

UInt32 IndexSID [protected]

IndexSID to use for indexing this stream.

WrapType StreamWrap [protected]

The wrapping type of this stream.

GCWriterPtr StreamWriter [protected]

The writer for this stream.

bool EssencePendingData [protected]

Is there any essence data pending in the writer?

bool EndOfStream [protected]

No more essence available for this stream.

IndexManagerPtr IndexMan [protected]

The index manager for this stream.

Position NextSprinkled [protected]

The location of the first edit-unit to use for the next sprinkled index segment.

bool FreeSpaceIndex [protected]

True if the free space at the end of the essenc eis to be indexed.

When an essence stream may be extended during file creation it may be useful to know where the essence currently ends (to allow new essence to be added). /note DRAGONS: This is non-standard and will produce invalid index tables (even if they are later "fixed")

bool ValueRelativeIndexing [protected]

Flag to allow value-relative indexing.

Note:
This is NOT implemented in the IndexManager, but must be handled by the caller

Length PrechargeSize [protected]

The number of edit units of pre-charge remaining to be written.

DRAGONS: This is set when the state moves from "start" because it is important to wait for all sub-streams to be set up first

UInt32 KAG [protected]

KLV Alignment Grid to use for this stream (of zero if default for this body is to be used).

bool ForceBER4 [protected]

Flag set if BER lengths for this stream should be forced to 4-byte (where possible).

bool EditAlign [protected]

Flag set if partitioning is to be done only on edit boundaries.

Note:
Only the master stream is (currently) edit aligned, not all sub-streams

std::list<Position> SparseList

List of edit units to include in sparse index tables.


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