KaxSegmentUID() {}
KaxSegmentUID(const KaxSegmentUID & ElementToClone) :EbmlBinary(ElementToClone){}
static EbmlElement & Create() {return *(new KaxSegmentUID);}
- bool ValidateSize() const { return (Size == 16);}
+ bool ValidateSize() const { return (GetSize() == 16);}
const EbmlCallbacks & Generic() const {return ClassInfos;}
static const EbmlCallbacks ClassInfos;
operator const EbmlId &() const {return ClassInfos.GlobalId;}
KaxPrevUID() {}
KaxPrevUID(const KaxPrevUID & ElementToClone) :KaxSegmentUID(ElementToClone){}
static EbmlElement & Create() {return *(new KaxPrevUID);}
- bool ValidateSize() const { return (Size == 16);}
+ bool ValidateSize() const { return (GetSize() == 16);}
const EbmlCallbacks & Generic() const {return ClassInfos;}
static const EbmlCallbacks ClassInfos;
operator const EbmlId &() const {return ClassInfos.GlobalId;}
KaxNextUID() {}
KaxNextUID(const KaxNextUID & ElementToClone) :KaxSegmentUID(ElementToClone){}
static EbmlElement & Create() {return *(new KaxNextUID);}
- bool ValidateSize() const { return (Size == 16);}
+ bool ValidateSize() const { return (GetSize() == 16);}
const EbmlCallbacks & Generic() const {return ClassInfos;}
static const EbmlCallbacks ClassInfos;
operator const EbmlId &() const {return ClassInfos.GlobalId;}
KaxSegmentFamily() {}
KaxSegmentFamily(const KaxSegmentFamily & ElementToClone) :EbmlBinary(ElementToClone){}
static EbmlElement & Create() {return *(new KaxSegmentFamily);}
- bool ValidateSize() const { return (Size == 16);}
+ bool ValidateSize() const { return (GetSize() == 16);}
const EbmlCallbacks & Generic() const {return ClassInfos;}
static const EbmlCallbacks ClassInfos;
operator const EbmlId &() const {return ClassInfos.GlobalId;}
bool KaxInternalBlock::ValidateSize() const
{
- return (Size >= 4); /// for the moment
+ return (GetSize() >= 4); /// for the moment
}
KaxInternalBlock::~KaxInternalBlock()
*/
bool KaxInternalBlock::AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, LacingType lacing, bool invisible)
{
- bValueIsSet = true;
+ SetValueIsSet();
if (myBuffers.size() == 0) {
// first frame
Timecode = timecode;
SameSize = false;
XiphLacingSize += myBuffers[i]->Size() / 255 + 1;
}
- EbmlLacingSize += CodedSizeLength(myBuffers[0]->Size(), 0, bSizeIsFinite);
+ EbmlLacingSize += CodedSizeLength(myBuffers[0]->Size(), 0, IsFiniteSize());
for (i = 1; i < (int)myBuffers.size() - 1; i++)
EbmlLacingSize += CodedSizeLengthSigned(int64(myBuffers[i]->Size()) - int64(myBuffers[i - 1]->Size()), 0);
if (SameSize)
uint64 KaxInternalBlock::UpdateSize(bool bSaveDefault, bool bForceRender)
{
LacingType LacingHere;
- assert(Data == NULL); // Data is not used for KaxInternalBlock
+ assert(GetData() == NULL); // Data is not used for KaxInternalBlock
assert(TrackNumber < 0x4000); // no more allowed for the moment
unsigned int i;
// compute the final size of the data
switch (myBuffers.size()) {
case 0:
- Size = 0;
+ SetSize_(0);
break;
case 1:
- Size = 4 + myBuffers[0]->Size();
+ SetSize_(4 + myBuffers[0]->Size());
break;
default:
- Size = 4 + 1; // 1 for the lacing head
+ SetSize_(4 + 1); // 1 for the lacing head
if (mLacing == LACING_AUTO)
LacingHere = GetBestLacingType();
else
{
case LACING_XIPH:
for (i=0; i<myBuffers.size()-1; i++) {
- Size += myBuffers[i]->Size() + (myBuffers[i]->Size() / 0xFF + 1);
+ SetSize_(GetSize() + myBuffers[i]->Size() + (myBuffers[i]->Size() / 0xFF + 1));
}
break;
case LACING_EBML:
- Size += myBuffers[0]->Size() + CodedSizeLength(myBuffers[0]->Size(), 0, bSizeIsFinite);
+ SetSize_(GetSize() + myBuffers[0]->Size() + CodedSizeLength(myBuffers[0]->Size(), 0, IsFiniteSize()));
for (i=1; i<myBuffers.size()-1; i++) {
- Size += myBuffers[i]->Size()
- + CodedSizeLengthSigned(int64(myBuffers[i]->Size()) - int64(myBuffers[i-1]->Size()), 0);;
+ SetSize_(GetSize() + myBuffers[i]->Size() + CodedSizeLengthSigned(int64(myBuffers[i]->Size()) - int64(myBuffers[i-1]->Size()), 0));
}
break;
case LACING_FIXED:
for (i=0; i<myBuffers.size()-1; i++) {
- Size += myBuffers[i]->Size();
+ SetSize_(GetSize() + myBuffers[i]->Size());
}
break;
default:
assert(0);
}
// Size of the last frame (not in lace)
- Size += myBuffers[i]->Size();
+ SetSize_(GetSize() + myBuffers[i]->Size());
break;
}
if (TrackNumber >= 0x80)
- Size++; // the size will be coded with one more octet
+ SetSize_(GetSize() + 1); // the size will be coded with one more octet
- return Size;
+ return GetSize();
}
#if MATROSKA_VERSION >= 2
,TrackNumber(ElementToClone.TrackNumber)
,ParentCluster(ElementToClone.ParentCluster) ///< \todo not exactly
{
- Data = DataBlock;
+ SetBuffer(DataBlock,sizeof(DataBlock));
+ SetValueIsSet(false);
}
uint64 KaxBlockVirtual::UpdateSize(bool bSaveDefault, bool bForceRender)
{
assert(TrackNumber < 0x4000);
- binary *cursor = Data;
+ binary *cursor = GetData();
// fill data
if (TrackNumber < 0x80) {
*cursor++ = TrackNumber | 0x80; // set the first bit to 1
*cursor++ = 0; // flags
- return Size;
+ return GetSize();
}
#endif // MATROSKA_VERSION
unsigned int i;
if (myBuffers.size() == 1) {
- Size = 4;
+ SetSize_(4);
mLacing = LACING_NONE;
} else {
if (mLacing == LACING_NONE)
mLacing = LACING_EBML; // supposedly the best of all
- Size = 4 + 1; // 1 for the lacing head (number of laced elements)
+ SetSize_(4 + 1); // 1 for the lacing head (number of laced elements)
}
if (TrackNumber > 0x80)
- Size++;
+ SetSize_(GetSize() + 1);
// write Block Head
if (TrackNumber < 0x80) {
uint16 tmpSize = myBuffers[i]->Size();
while (tmpSize >= 0xFF) {
output.writeFully(&tmpValue, 1);
- Size++;
+ SetSize_(GetSize() + 1);
tmpSize -= 0xFF;
}
tmpValue = binary(tmpSize);
output.writeFully(&tmpValue, 1);
- Size++;
+ SetSize_(GetSize() + 1);
}
break;
case LACING_EBML:
_Size = myBuffers[0]->Size();
- _CodedSize = CodedSizeLength(_Size, 0, bSizeIsFinite);
+ _CodedSize = CodedSizeLength(_Size, 0, IsFiniteSize());
// first size in the lace is not a signed
CodedValueLength(_Size, _CodedSize, _FinalHead);
output.writeFully(_FinalHead, _CodedSize);
- Size += _CodedSize;
+ SetSize_(GetSize() + _CodedSize);
// set the size of each member in the lace
for (i=1; i<myBuffers.size()-1; i++) {
_CodedSize = CodedSizeLengthSigned(_Size, 0);
CodedValueLengthSigned(_Size, _CodedSize, _FinalHead);
output.writeFully(_FinalHead, _CodedSize);
- Size += _CodedSize;
+ SetSize_(GetSize() + _CodedSize);
}
}
break;
// put the data of each frame
for (i=0; i<myBuffers.size(); i++) {
output.writeFully(myBuffers[i]->Buffer(), myBuffers[i]->Size());
- Size += myBuffers[i]->Size();
+ SetSize_(GetSize() + myBuffers[i]->Size());
}
}
- return Size;
+ return GetSize();
}
uint64 KaxInternalBlock::ReadInternalHead(IOCallback & input)
if (ReadFully == SCOPE_ALL_DATA)
{
Result = EbmlBinary::ReadData(input, ReadFully);
- binary *cursor = Data;
+ binary *cursor = GetData();
uint8 BlockHeadSize = 4;
// update internal values
// put all Frames in the list
if (mLacing == LACING_NONE) {
- FirstFrameLocation += cursor - Data;
- DataBuffer * soloFrame = new DataBuffer(cursor, Size - BlockHeadSize);
+ FirstFrameLocation += cursor - GetData();
+ DataBuffer * soloFrame = new DataBuffer(cursor, GetSize() - BlockHeadSize);
myBuffers.push_back(soloFrame);
SizeList.resize(1);
- SizeList[0] = Size - BlockHeadSize;
+ SizeList[0] = GetSize() - BlockHeadSize;
} else {
// read the number of frames in the lace
- uint32 LastBufferSize = Size - BlockHeadSize - 1; // 1 for number of frame
+ uint32 LastBufferSize = GetSize() - BlockHeadSize - 1; // 1 for number of frame
uint8 FrameNum = *cursor++; // number of frames in the lace - 1
// read the list of frame sizes
uint8 Index;
assert(0);
}
- FirstFrameLocation += cursor - Data;
+ FirstFrameLocation += cursor - GetData();
for (Index=0; Index<=FrameNum; Index++) {
DataBuffer * lacedFrame = new DataBuffer(cursor, SizeList[Index]);
cursor += SizeList[Index];
}
}
- bValueIsSet = true;
+ SetValueIsSet();
}
else if (ReadFully == SCOPE_PARTIAL_DATA)
{
// put all Frames in the list
if (mLacing != LACING_NONE) {
// read the number of frames in the lace
- uint32 LastBufferSize = Size - BlockHeadSize - 1; // 1 for number of frame
+ uint32 LastBufferSize = GetSize() - BlockHeadSize - 1; // 1 for number of frame
uint8 FrameNum = _TempHead[0]; // number of frames in the lace - 1
// read the list of frame sizes
uint8 Index;
}
} else {
SizeList.resize(1);
- SizeList[0] = Size - BlockHeadSize;
+ SizeList[0] = GetSize() - BlockHeadSize;
}
- bValueIsSet = false;
- Result = Size;
+ SetValueIsSet(false);
+ Result = GetSize();
} else {
- bValueIsSet = false;
- Result = Size;
+ SetValueIsSet(false);
+ Result = GetSize();
}
return Result;
{
int64 _Result = -1;
- if (bValueIsSet && FrameNumber < SizeList.size())
+ if (ValueIsSet() && FrameNumber < SizeList.size())
{
_Result = FirstFrameLocation;
,bSilentTracksUsed(ElementToClone.bSilentTracksUsed)
{
// update the parent of each children
- std::vector<EbmlElement *>::const_iterator Itr = ElementList.begin();
- while (Itr != ElementList.end())
+ std::vector<EbmlElement *>::const_iterator Itr = begin();
+ while (Itr != end())
{
if (EbmlId(**Itr) == KaxBlockGroup::ClassInfos.GlobalId) {
static_cast<KaxBlockGroup *>(*Itr)->SetParent(*this);
{
KaxTrackEntry & entry = *static_cast<KaxTrackEntry *>(MyTracks[TrkIndex]);
uint32 tracknum = entry.TrackNumber();
- for (Index = 0; Index < ElementList.size(); Index++) {
- if (EbmlId(*ElementList[Index]) == KaxBlockGroup::ClassInfos.GlobalId) {
- KaxBlockGroup & group = *static_cast<KaxBlockGroup *>(ElementList[Index]);
+ for (Index = 0; Index < ListSize(); Index++) {
+ if (EbmlId(*(*this)[Index]) == KaxBlockGroup::ClassInfos.GlobalId) {
+ KaxBlockGroup & group = *static_cast<KaxBlockGroup *>((*this)[Index]);
if (group.TrackNumber() == tracknum)
break; // this track is used
}
}
// the track wasn't found in this cluster
- if (Index == ElementList.size())
+ if (Index == ListSize())
{
KaxClusterSilentTracks * SilentTracks = static_cast<KaxClusterSilentTracks *>(this->FindFirstElt(KaxClusterSilentTracks::ClassInfos));
assert(SilentTracks != NULL); // the flag bSilentTracksUsed should be set when creating the Cluster
Result = EbmlMaster::Render(output, bSaveDefault);
// For all Blocks add their position on the CueEntry
- for (Index = 0; Index < ElementList.size(); Index++) {
- if (EbmlId(*ElementList[Index]) == KaxBlockGroup::ClassInfos.GlobalId) {
- CueToUpdate.PositionSet(*static_cast<const KaxBlockGroup *>(ElementList[Index]));
+ for (Index = 0; Index < ListSize(); Index++) {
+ if (EbmlId(*(*this)[Index]) == KaxBlockGroup::ClassInfos.GlobalId) {
+ CueToUpdate.PositionSet(*static_cast<const KaxBlockGroup *>((*this)[Index]));
}
}
} else {
{
#if MATROSKA_VERSION >= 2
if (Blobs[Index]->IsSimpleBlock())
- ElementList.push_back( &(KaxSimpleBlock&) *Blobs[Index] );
+ PushElement( (KaxSimpleBlock&) *Blobs[Index] );
else
#endif
- ElementList.push_back( &(KaxBlockGroup&) *Blobs[Index] );
+ PushElement( (KaxBlockGroup&) *Blobs[Index] );
}
// SilentTracks handling
break; // this track is used
}
// the track wasn't found in this cluster
- if (Index == ElementList.size())
+ if (Index == ListSize())
{
KaxClusterSilentTracks * SilentTracks = static_cast<KaxClusterSilentTracks *>(this->FindFirstElt(KaxClusterSilentTracks::ClassInfos));
assert(SilentTracks != NULL); // the flag bSilentTracksUsed should be set when creating the Cluster
{
size_t Index;
- for (Index = 0; Index < ElementList.size(); Index++) {
- if (EbmlId(*ElementList[Index]) == KaxBlockGroup::ClassInfos.GlobalId) {
- static_cast<KaxBlockGroup*>(ElementList[Index])->ReleaseFrames();
+ for (Index = 0; Index < ListSize(); Index++) {
+ if (EbmlId(*(*this)[Index]) == KaxBlockGroup::ClassInfos.GlobalId) {
+ static_cast<KaxBlockGroup*>((*this)[Index])->ReleaseFrames();
}
}
}