add macros to access the EbmlId internal variables
git-svn-id: https://matroska.svn.sourceforge.net/svnroot/matroska/trunk/libebml@15 a6f86f6d-0131-4f8e-9e7b-e335508773d5
This commit is contained in:
parent
cd378f23ff
commit
de3185abde
@ -217,7 +217,7 @@ class EBML_DLL_API EbmlElement {
|
||||
virtual bool IsMaster() const {return false;}
|
||||
|
||||
uint8 HeadSize() const {
|
||||
return EbmlId(*this).Length + CodedSizeLength(Size, SizeLength, bSizeIsFinite);
|
||||
return EBML_ID_LENGTH(EbmlId(*this)) + CodedSizeLength(Size, SizeLength, bSizeIsFinite);
|
||||
} /// return the size of the head, on reading/writing
|
||||
|
||||
/*!
|
||||
|
@ -40,6 +40,8 @@
|
||||
|
||||
START_LIBEBML_NAMESPACE
|
||||
|
||||
#define EBML_ID_VALUE(id) id.Value
|
||||
#define EBML_ID_LENGTH(id) id.Length
|
||||
/*!
|
||||
\class EbmlId
|
||||
*/
|
||||
|
@ -79,7 +79,7 @@ class EBML_DLL_API EbmlMaster : public EbmlElement {
|
||||
}
|
||||
|
||||
uint64 GetDataStart() const {
|
||||
return GetElementPosition() + EbmlId(*this).Length + CodedSizeLength(GetSize(), GetSizeLength(), IsFiniteSize());
|
||||
return GetElementPosition() + EBML_ID_LENGTH(EbmlId(*this)) + CodedSizeLength(GetSize(), GetSizeLength(), IsFiniteSize());
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -415,8 +415,8 @@ EbmlElement * EbmlElement::FindNextElement(IOCallback & DataStream, const EbmlSe
|
||||
Result->SetSizeInfinite();
|
||||
}
|
||||
|
||||
Result->SizePosition = DataStream.getFilePointer() - SizeIdx + PossibleID.Length;
|
||||
Result->ElementPosition = Result->SizePosition - PossibleID.Length;
|
||||
Result->SizePosition = DataStream.getFilePointer() - SizeIdx + EBML_ID_LENGTH(PossibleID);
|
||||
Result->ElementPosition = Result->SizePosition - EBML_ID_LENGTH(PossibleID);
|
||||
// place the file at the beggining of the data
|
||||
DataStream.setFilePointer(Result->SizePosition + _SizeLength);
|
||||
return Result;
|
||||
@ -579,7 +579,7 @@ uint32 EbmlElement::Render(IOCallback & output, bool bKeepIntact, bool bKeepPosi
|
||||
*/
|
||||
uint32 EbmlElement::RenderHead(IOCallback & output, bool bForceRender, bool bKeepIntact, bool bKeepPosition)
|
||||
{
|
||||
if (EbmlId(*this).Length <= 0 || EbmlId(*this).Length > 4)
|
||||
if (EBML_ID_LENGTH(EbmlId(*this)) <= 0 || EBML_ID_LENGTH(EbmlId(*this)) > 4)
|
||||
return 0;
|
||||
|
||||
UpdateSize(bKeepIntact, bForceRender);
|
||||
@ -592,7 +592,7 @@ uint32 EbmlElement::MakeRenderHead(IOCallback & output, bool bKeepPosition)
|
||||
binary FinalHead[4+8]; // Class D + 64 bits coded size
|
||||
unsigned int FinalHeadSize;
|
||||
|
||||
FinalHeadSize = EbmlId(*this).Length;
|
||||
FinalHeadSize = EBML_ID_LENGTH(EbmlId(*this));
|
||||
EbmlId(*this).Fill(FinalHead);
|
||||
|
||||
int CodedSize = CodedSizeLength(Size, SizeLength, bSizeIsFinite);
|
||||
@ -602,7 +602,7 @@ uint32 EbmlElement::MakeRenderHead(IOCallback & output, bool bKeepPosition)
|
||||
output.writeFully(FinalHead, FinalHeadSize);
|
||||
if (!bKeepPosition) {
|
||||
ElementPosition = output.getFilePointer() - FinalHeadSize;
|
||||
SizePosition = ElementPosition + EbmlId(*this).Length;
|
||||
SizePosition = ElementPosition + EBML_ID_LENGTH(EbmlId(*this));
|
||||
}
|
||||
|
||||
return FinalHeadSize;
|
||||
@ -612,7 +612,7 @@ uint64 EbmlElement::ElementSize(bool bKeepIntact) const
|
||||
{
|
||||
if (!bKeepIntact && IsDefaultValue())
|
||||
return 0; // won't be saved
|
||||
return Size + EbmlId(*this).Length + CodedSizeLength(Size, SizeLength, bSizeIsFinite);
|
||||
return Size + EBML_ID_LENGTH(EbmlId(*this)) + CodedSizeLength(Size, SizeLength, bSizeIsFinite);
|
||||
}
|
||||
|
||||
bool EbmlElement::CompareElements(const EbmlElement *A, const EbmlElement *B)
|
||||
|
Loading…
x
Reference in New Issue
Block a user