EbmlElement Class Reference

Hold basic informations about an EBML element (ID + length). More...

#include <EbmlElement.h>

Inheritance diagram for EbmlElement:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 EbmlElement (uint64 aDefaultSize, bool bValueSet=false)
void SetSizeLength (int NewSizeLength)
 Set the minimum length that will be used to write the element size (-1 = optimal).
int GetSizeLength () const
EbmlElementFindNext (IOCallback &DataStream, uint64 MaxDataSize)
 find the next element with the same ID
EbmlElementSkipData (EbmlStream &DataStream, const EbmlSemanticContext &Context, EbmlElement *TestReadElt=NULL, bool AllowDummyElt=false)
virtual EbmlElementClone () const =0
 Give a copy of the element, all data inside the element is copied.
virtual operator const EbmlId & () const =0
virtual const EbmlCallbacksGeneric () const =0
 return the generic callback to monitor a derived class
virtual EbmlElementCreateElement () const =0
virtual bool SetSizeInfinite (bool bIsInfinite=true)
virtual bool ValidateSize () const =0
uint64 GetElementPosition () const
uint64 ElementSize (bool bWithDefault=false) const
filepos_t Render (IOCallback &output, bool bWithDefault=false, bool bKeepPosition=false, bool bForceRender=false)
 return the size of the header+data, before writing
virtual filepos_t UpdateSize (bool bWithDefault=false, bool bForceRender=false)=0
virtual filepos_t GetSize () const
 update the Size of the Data stored
virtual filepos_t ReadData (IOCallback &input, ScopeMode ReadFully=SCOPE_ALL_DATA)=0
 return the size of the data stored in the element, on reading
virtual void Read (EbmlStream &inDataStream, const EbmlSemanticContext &Context, int &UpperEltFound, EbmlElement *&FoundElt, bool AllowDummyElt=false, ScopeMode ReadFully=SCOPE_ALL_DATA)
bool IsLocked () const
void Lock (bool bLock=true)
virtual bool IsSmallerThan (const EbmlElement *Cmp) const
 default comparison for elements that can't be compared
virtual bool IsDummy () const
virtual bool IsMaster () const
uint8 HeadSize () const
bool ForceSize (uint64 NewSize)
 return the size of the head, on reading/writing
filepos_t OverwriteHead (IOCallback &output, bool bKeepPosition=false)
uint32 VoidMe (IOCallback &output, bool bWithDefault=false)
 void the content of the element (replace by EbmlVoid)
bool DefaultISset () const
virtual bool IsDefaultValue () const =0
bool IsFiniteSize () const
virtual void SetDefaultSize (uint64 aDefaultSize)
 set the default size of an element
bool ValueIsSet () const
uint64 GetEndPosition () const

Static Public Member Functions

static EbmlElementFindNextElement (IOCallback &DataStream, const EbmlSemanticContext &Context, int &UpperLevel, uint64 MaxDataSize, bool AllowDummyElt, unsigned int MaxLowerLevel=1)
static EbmlElementFindNextID (IOCallback &DataStream, const EbmlCallbacks &ClassInfos, uint64 MaxDataSize)
static bool CompareElements (const EbmlElement *A, const EbmlElement *B)

Protected Member Functions

filepos_t RenderHead (IOCallback &output, bool bForceRender, bool bWithDefault=false, bool bKeepPosition=false)
filepos_t MakeRenderHead (IOCallback &output, bool bKeepPosition)
virtual filepos_t RenderData (IOCallback &output, bool bForceRender, bool bWithDefault=false)=0
 prepare the data before writing them (in case it's not already done by default)
 EbmlElement (const EbmlElement &ElementToClone)
 special constructor for cloning
uint64 GetDefaultSize () const
void SetSize_ (uint64 aSize)
void SetValueIsSet (bool Set=true)
void SetDefaultIsSet (bool Set=true)
void SetSizeIsFinite (bool Set=true)
uint64 GetSizePosition () const

Static Protected Member Functions

static EbmlElementCreateElementUsingContext (const EbmlId &aID, const EbmlSemanticContext &Context, int &LowLevel, bool IsGlobalContext, bool bAllowDummy=false, unsigned int MaxLowerLevel=1)
 find any element in the stream

Protected Attributes

uint64 Size
 the size of the data to write
uint64 DefaultSize
 Minimum data size to fill on rendering (0 = optimal).
int SizeLength
bool bSizeIsFinite
 the minimum size on which the size will be written (0 = optimal)
uint64 ElementPosition
uint64 SizePosition
bool bValueIsSet
bool DefaultIsSet
bool bLocked

Detailed Description

Hold basic informations about an EBML element (ID + length).


Member Function Documentation

virtual EbmlElement* EbmlElement::Clone (  )  const [pure virtual]

Give a copy of the element, all data inside the element is copied.

Returns:
NULL if there is not enough memory
EbmlElement * EbmlElement::CreateElementUsingContext ( const EbmlId aID,
const EbmlSemanticContext Context,
int &  LowLevel,
bool  IsGlobalContext,
bool  bAllowDummy = false,
unsigned int  MaxLowerLevel = 1 
) [static, protected]

find any element in the stream

Returns:
a DummyRawElement if the element is unknown or NULL if the element dummy is not allowed
EbmlElement * EbmlElement::FindNextElement ( IOCallback DataStream,
const EbmlSemanticContext Context,
int &  UpperLevel,
uint64  MaxDataSize,
bool  AllowDummyElt,
unsigned int  MaxLowerLevel = 1 
) [static]
Todo:

replace the new RawElement with the appropriate class (when known)

skip data for Dummy elements when they are not allowed

better check of the size checking for upper elements (using a list of size for each level)

Parameters:
LowLevel Will be returned with the level of the element found compared to the context given

<

Todo:
continue is misplaced

EbmlElement * EbmlElement::FindNextID ( IOCallback DataStream,
const EbmlCallbacks ClassInfos,
uint64  MaxDataSize 
) [static]
Todo:

this method is deprecated and should be called FindThisID

replace the new RawElement with the appropriate class (when known)

Todo:
not exactly the one we're looking for
Todo:
find the element in the context
Todo:
the element is not allowed to be infinite

bool EbmlElement::ForceSize ( uint64  NewSize  ) 

return the size of the head, on reading/writing

Force the size of an element

Warning:
only possible if the size is "undefined"
filepos_t EbmlElement::Render ( IOCallback output,
bool  bWithDefault = false,
bool  bKeepPosition = false,
bool  bForceRender = false 
)

return the size of the header+data, before writing

Todo:
verify that the size written is the same as the data written
filepos_t EbmlElement::RenderHead ( IOCallback output,
bool  bForceRender,
bool  bWithDefault = false,
bool  bKeepPosition = false 
) [protected]
Todo:

store the position of the Size writing for elements with unknown size

handle exceptions on errors

handle CodeSize bigger than 5 bytes

EbmlElement * EbmlElement::SkipData ( EbmlStream DataStream,
const EbmlSemanticContext Context,
EbmlElement TestReadElt = NULL,
bool  AllowDummyElt = false 
)
Todo:
what happens if we are in a upper element with a known size ?

Todo:
0xFF... and true should be configurable


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Enumerations Enumerator
Generated on Tue Jun 8 11:06:04 2010 for libebml by  doxygen 1.6.3