introduce filepos_t for all the file position values (depends wether the system can handle 32 bits or 64 bits offsets)
git-svn-id: https://matroska.svn.sourceforge.net/svnroot/matroska/trunk/libebml@44 a6f86f6d-0131-4f8e-9e7b-e335508773d5
This commit is contained in:
@@ -62,9 +62,9 @@ class EBML_DLL_API EbmlBinary : public EbmlElement {
|
|||||||
EbmlBinary(const EbmlBinary & ElementToClone);
|
EbmlBinary(const EbmlBinary & ElementToClone);
|
||||||
virtual ~EbmlBinary(void);
|
virtual ~EbmlBinary(void);
|
||||||
|
|
||||||
uint32 RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact = false);
|
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact = false);
|
||||||
uint64 ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA);
|
filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA);
|
||||||
uint64 UpdateSize(bool bKeepIntact = false, bool bForceRender = false);
|
filepos_t UpdateSize(bool bKeepIntact = false, bool bForceRender = false);
|
||||||
|
|
||||||
void SetBuffer(const binary *Buffer, const uint32 BufferSize) {
|
void SetBuffer(const binary *Buffer, const uint32 BufferSize) {
|
||||||
Data = (binary *) Buffer;
|
Data = (binary *) Buffer;
|
||||||
|
|||||||
@@ -59,9 +59,9 @@ class EBML_DLL_API EbmlCrc32 : public EbmlBinary {
|
|||||||
EbmlCrc32();
|
EbmlCrc32();
|
||||||
EbmlCrc32(const EbmlCrc32 & ElementToClone);
|
EbmlCrc32(const EbmlCrc32 & ElementToClone);
|
||||||
bool ValidateSize() const {return (GetSize() == 4);}
|
bool ValidateSize() const {return (GetSize() == 4);}
|
||||||
uint32 RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact = false);
|
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact = false);
|
||||||
uint64 ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA);
|
filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA);
|
||||||
// uint64 UpdateSize(bool bKeepIntact = false);
|
// filepos_t UpdateSize(bool bKeepIntact = false);
|
||||||
|
|
||||||
bool IsDefaultValue() const {
|
bool IsDefaultValue() const {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ class EBML_DLL_API EbmlDate : public EbmlElement {
|
|||||||
/*!
|
/*!
|
||||||
\note no Default date handled
|
\note no Default date handled
|
||||||
*/
|
*/
|
||||||
uint64 UpdateSize(bool bKeepIntact = false, bool bForceRender = false) {
|
filepos_t UpdateSize(bool bKeepIntact = false, bool bForceRender = false) {
|
||||||
if(!ValueIsSet())
|
if(!ValueIsSet())
|
||||||
SetSize_(0);
|
SetSize_(0);
|
||||||
else
|
else
|
||||||
@@ -75,7 +75,7 @@ class EBML_DLL_API EbmlDate : public EbmlElement {
|
|||||||
|
|
||||||
bool operator<(const EbmlDate & EltCmp) const {return myDate < EltCmp.myDate;}
|
bool operator<(const EbmlDate & EltCmp) const {return myDate < EltCmp.myDate;}
|
||||||
|
|
||||||
uint64 ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA);
|
filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA);
|
||||||
|
|
||||||
bool IsDefaultValue() const {
|
bool IsDefaultValue() const {
|
||||||
return false;
|
return false;
|
||||||
@@ -86,7 +86,7 @@ class EBML_DLL_API EbmlDate : public EbmlElement {
|
|||||||
#else
|
#else
|
||||||
protected:
|
protected:
|
||||||
#endif
|
#endif
|
||||||
uint32 RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact = false);
|
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact = false);
|
||||||
|
|
||||||
int64 myDate; ///< internal format of the date
|
int64 myDate; ///< internal format of the date
|
||||||
|
|
||||||
|
|||||||
@@ -274,12 +274,12 @@ class EBML_DLL_API EbmlElement {
|
|||||||
|
|
||||||
uint64 ElementSize(bool bKeepIntact = false) const; /// return the size of the header+data, before writing
|
uint64 ElementSize(bool bKeepIntact = false) const; /// return the size of the header+data, before writing
|
||||||
|
|
||||||
uint32 Render(IOCallback & output, bool bKeepIntact = false, bool bKeepPosition = false, bool bForceRender = false);
|
filepos_t Render(IOCallback & output, bool bKeepIntact = false, bool bKeepPosition = false, bool bForceRender = false);
|
||||||
|
|
||||||
virtual uint64 UpdateSize(bool bKeepIntact = false, bool bForceRender = false) = 0; /// update the Size of the Data stored
|
virtual filepos_t UpdateSize(bool bKeepIntact = false, bool bForceRender = false) = 0; /// update the Size of the Data stored
|
||||||
virtual uint64 GetSize() const {return Size;} /// return the size of the data stored in the element, on reading
|
virtual filepos_t GetSize() const {return Size;} /// return the size of the data stored in the element, on reading
|
||||||
|
|
||||||
virtual uint64 ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA) = 0;
|
virtual filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA) = 0;
|
||||||
virtual void Read(EbmlStream & inDataStream, const EbmlSemanticContext & Context, int & UpperEltFound, EbmlElement * & FoundElt, bool AllowDummyElt = false, ScopeMode ReadFully = SCOPE_ALL_DATA);
|
virtual void Read(EbmlStream & inDataStream, const EbmlSemanticContext & Context, int & UpperEltFound, EbmlElement * & FoundElt, bool AllowDummyElt = false, ScopeMode ReadFully = SCOPE_ALL_DATA);
|
||||||
|
|
||||||
bool IsLocked() const {return bLocked;}
|
bool IsLocked() const {return bLocked;}
|
||||||
@@ -307,7 +307,7 @@ class EBML_DLL_API EbmlElement {
|
|||||||
*/
|
*/
|
||||||
bool ForceSize(uint64 NewSize);
|
bool ForceSize(uint64 NewSize);
|
||||||
|
|
||||||
uint32 OverwriteHead(IOCallback & output, bool bKeepPosition = false);
|
filepos_t OverwriteHead(IOCallback & output, bool bKeepPosition = false);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief void the content of the element (replace by EbmlVoid)
|
\brief void the content of the element (replace by EbmlVoid)
|
||||||
@@ -336,13 +336,13 @@ class EBML_DLL_API EbmlElement {
|
|||||||
*/
|
*/
|
||||||
static EbmlElement *CreateElementUsingContext(const EbmlId & aID, const EbmlSemanticContext & Context, int & LowLevel, bool IsGlobalContext, bool bAllowDummy = false, unsigned int MaxLowerLevel = 1);
|
static EbmlElement *CreateElementUsingContext(const EbmlId & aID, const EbmlSemanticContext & Context, int & LowLevel, bool IsGlobalContext, bool bAllowDummy = false, unsigned int MaxLowerLevel = 1);
|
||||||
|
|
||||||
uint32 RenderHead(IOCallback & output, bool bForceRender, bool bKeepIntact = false, bool bKeepPosition = false);
|
filepos_t RenderHead(IOCallback & output, bool bForceRender, bool bKeepIntact = false, bool bKeepPosition = false);
|
||||||
uint32 MakeRenderHead(IOCallback & output, bool bKeepPosition);
|
filepos_t MakeRenderHead(IOCallback & output, bool bKeepPosition);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief prepare the data before writing them (in case it's not already done by default)
|
\brief prepare the data before writing them (in case it's not already done by default)
|
||||||
*/
|
*/
|
||||||
virtual uint32 RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact = false) = 0;
|
virtual filepos_t RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact = false) = 0;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief special constructor for cloning
|
\brief special constructor for cloning
|
||||||
|
|||||||
@@ -61,9 +61,9 @@ class EBML_DLL_API EbmlFloat : public EbmlElement {
|
|||||||
return (GetSize() == 4 || GetSize() == 8);
|
return (GetSize() == 4 || GetSize() == 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact = false);
|
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact = false);
|
||||||
uint64 ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA);
|
filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA);
|
||||||
uint64 UpdateSize(bool bKeepIntact = false, bool bForceRender = false);
|
filepos_t UpdateSize(bool bKeepIntact = false, bool bForceRender = false);
|
||||||
|
|
||||||
void SetPrecision(const EbmlFloat::Precision prec = FLOAT_32)
|
void SetPrecision(const EbmlFloat::Precision prec = FLOAT_32)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -63,9 +63,9 @@ class EBML_DLL_API EbmlMaster : public EbmlElement {
|
|||||||
*/
|
*/
|
||||||
virtual ~EbmlMaster();
|
virtual ~EbmlMaster();
|
||||||
|
|
||||||
uint32 RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact = false);
|
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact = false);
|
||||||
uint64 ReadData(IOCallback & input, ScopeMode ReadFully);
|
filepos_t ReadData(IOCallback & input, ScopeMode ReadFully);
|
||||||
uint64 UpdateSize(bool bKeepIntact = false, bool bForceRender = false);
|
filepos_t UpdateSize(bool bKeepIntact = false, bool bForceRender = false);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Set wether the size is finite (size is known in advance when writing, or infinite size is not known on writing)
|
\brief Set wether the size is finite (size is known in advance when writing, or infinite size is not known on writing)
|
||||||
@@ -150,7 +150,7 @@ class EBML_DLL_API EbmlMaster : public EbmlElement {
|
|||||||
\brief facility for Master elements to write only the head and force the size later
|
\brief facility for Master elements to write only the head and force the size later
|
||||||
\warning
|
\warning
|
||||||
*/
|
*/
|
||||||
uint32 WriteHead(IOCallback & output, int SizeLength, bool bKeepIntact = false);
|
filepos_t WriteHead(IOCallback & output, int SizeLength, bool bKeepIntact = false);
|
||||||
|
|
||||||
void EnableChecksum(bool bIsEnabled = true) { bChecksumUsed = bIsEnabled; }
|
void EnableChecksum(bool bIsEnabled = true) { bChecksumUsed = bIsEnabled; }
|
||||||
bool HasChecksum() const {return bChecksumUsed;}
|
bool HasChecksum() const {return bChecksumUsed;}
|
||||||
|
|||||||
@@ -63,9 +63,9 @@ class EBML_DLL_API EbmlSInteger : public EbmlElement {
|
|||||||
void SetDefaultSize(int nDefaultSize = DEFAULT_INT_SIZE) {SetSize_(nDefaultSize);}
|
void SetDefaultSize(int nDefaultSize = DEFAULT_INT_SIZE) {SetSize_(nDefaultSize);}
|
||||||
|
|
||||||
bool ValidateSize() const {return (GetSize() <= 8);}
|
bool ValidateSize() const {return (GetSize() <= 8);}
|
||||||
uint32 RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact = false);
|
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact = false);
|
||||||
uint64 ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA);
|
filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA);
|
||||||
uint64 UpdateSize(bool bKeepIntact = false, bool bForceRender = false);
|
filepos_t UpdateSize(bool bKeepIntact = false, bool bForceRender = false);
|
||||||
|
|
||||||
bool operator<(const EbmlSInteger & EltCmp) const {return Value < EltCmp.Value;}
|
bool operator<(const EbmlSInteger & EltCmp) const {return Value < EltCmp.Value;}
|
||||||
|
|
||||||
|
|||||||
@@ -56,9 +56,9 @@ class EBML_DLL_API EbmlString : public EbmlElement {
|
|||||||
virtual ~EbmlString() {}
|
virtual ~EbmlString() {}
|
||||||
|
|
||||||
bool ValidateSize() const {return true;} // any size is possible
|
bool ValidateSize() const {return true;} // any size is possible
|
||||||
uint32 RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact = false);
|
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact = false);
|
||||||
uint64 ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA);
|
filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA);
|
||||||
uint64 UpdateSize(bool bKeepIntact = false, bool bForceRender = false);
|
filepos_t UpdateSize(bool bKeepIntact = false, bool bForceRender = false);
|
||||||
|
|
||||||
EbmlString & operator=(const std::string &);
|
EbmlString & operator=(const std::string &);
|
||||||
operator const std::string &() const {return Value;}
|
operator const std::string &() const {return Value;}
|
||||||
|
|||||||
@@ -63,9 +63,9 @@ class EBML_DLL_API EbmlUInteger : public EbmlElement {
|
|||||||
void SetDefaultSize(int nDefaultSize = DEFAULT_UINT_SIZE) {SetSize_(nDefaultSize);}
|
void SetDefaultSize(int nDefaultSize = DEFAULT_UINT_SIZE) {SetSize_(nDefaultSize);}
|
||||||
|
|
||||||
bool ValidateSize() const {return (GetSize() <= 8);}
|
bool ValidateSize() const {return (GetSize() <= 8);}
|
||||||
uint32 RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact = false);
|
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact = false);
|
||||||
uint64 ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA);
|
filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA);
|
||||||
uint64 UpdateSize(bool bKeepIntact = false, bool bForceRender = false);
|
filepos_t UpdateSize(bool bKeepIntact = false, bool bForceRender = false);
|
||||||
|
|
||||||
bool operator<(const EbmlUInteger & EltCmp) const {return Value < EltCmp.Value;}
|
bool operator<(const EbmlUInteger & EltCmp) const {return Value < EltCmp.Value;}
|
||||||
|
|
||||||
|
|||||||
@@ -105,9 +105,9 @@ class EBML_DLL_API EbmlUnicodeString : public EbmlElement {
|
|||||||
virtual ~EbmlUnicodeString() {}
|
virtual ~EbmlUnicodeString() {}
|
||||||
|
|
||||||
bool ValidateSize() const {return true;} // any size is possible
|
bool ValidateSize() const {return true;} // any size is possible
|
||||||
uint32 RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact = false);
|
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact = false);
|
||||||
uint64 ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA);
|
filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA);
|
||||||
uint64 UpdateSize(bool bKeepIntact = false, bool bForceRender = false);
|
filepos_t UpdateSize(bool bKeepIntact = false, bool bForceRender = false);
|
||||||
|
|
||||||
EbmlUnicodeString & operator=(const UTFstring &); ///< platform dependant code
|
EbmlUnicodeString & operator=(const UTFstring &); ///< platform dependant code
|
||||||
operator const UTFstring &() const {return Value;}
|
operator const UTFstring &() const {return Value;}
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ class EBML_DLL_API EbmlVoid : public EbmlBinary {
|
|||||||
/*!
|
/*!
|
||||||
\note overwrite to write fake data
|
\note overwrite to write fake data
|
||||||
*/
|
*/
|
||||||
uint32 RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact = false);
|
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact = false);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Replace the void element content (written) with this one
|
\brief Replace the void element content (written) with this one
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ extern "C" {
|
|||||||
#endif /* anything else */
|
#endif /* anything else */
|
||||||
|
|
||||||
typedef uint8 binary;
|
typedef uint8 binary;
|
||||||
|
typedef uint64 filepos_t;
|
||||||
|
|
||||||
typedef enum open_mode {
|
typedef enum open_mode {
|
||||||
MODE_READ,
|
MODE_READ,
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ EbmlBinary::~EbmlBinary(void) {
|
|||||||
free(Data);
|
free(Data);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 EbmlBinary::RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact)
|
filepos_t EbmlBinary::RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact)
|
||||||
{
|
{
|
||||||
output.writeFully(Data,GetSize());
|
output.writeFully(Data,GetSize());
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ uint64 EbmlBinary::UpdateSize(bool bKeepIntact, bool bForceRender)
|
|||||||
return GetSize();
|
return GetSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64 EbmlBinary::ReadData(IOCallback & input, ScopeMode ReadFully)
|
filepos_t EbmlBinary::ReadData(IOCallback & input, ScopeMode ReadFully)
|
||||||
{
|
{
|
||||||
if (Data != NULL)
|
if (Data != NULL)
|
||||||
free(Data);
|
free(Data);
|
||||||
|
|||||||
@@ -188,9 +188,9 @@ bool EbmlCrc32::CheckElementCRC32(EbmlElement &ElementToCRC)
|
|||||||
return CheckCRC(m_crc_final, memoryBuffer.GetDataBuffer(), memoryBuffer.GetDataBufferSize());
|
return CheckCRC(m_crc_final, memoryBuffer.GetDataBuffer(), memoryBuffer.GetDataBufferSize());
|
||||||
};
|
};
|
||||||
|
|
||||||
uint32 EbmlCrc32::RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact)
|
filepos_t EbmlCrc32::RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact)
|
||||||
{
|
{
|
||||||
uint32 Result = DIGESTSIZE;
|
filepos_t Result = DIGESTSIZE;
|
||||||
|
|
||||||
if (Result != 0) {
|
if (Result != 0) {
|
||||||
output.writeFully(&m_crc_final, Result);
|
output.writeFully(&m_crc_final, Result);
|
||||||
@@ -211,7 +211,7 @@ uint32 EbmlCrc32::RenderData(IOCallback & output, bool bForceRender, bool bKeepI
|
|||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64 EbmlCrc32::ReadData(IOCallback & input, ScopeMode ReadFully)
|
filepos_t EbmlCrc32::ReadData(IOCallback & input, ScopeMode ReadFully)
|
||||||
{
|
{
|
||||||
if (ReadFully != SCOPE_NO_DATA)
|
if (ReadFully != SCOPE_NO_DATA)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ EbmlDate::EbmlDate(const EbmlDate & ElementToClone)
|
|||||||
myDate = ElementToClone.myDate;
|
myDate = ElementToClone.myDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64 EbmlDate::ReadData(IOCallback & input, ScopeMode ReadFully)
|
filepos_t EbmlDate::ReadData(IOCallback & input, ScopeMode ReadFully)
|
||||||
{
|
{
|
||||||
if (ReadFully != SCOPE_NO_DATA)
|
if (ReadFully != SCOPE_NO_DATA)
|
||||||
{
|
{
|
||||||
@@ -65,7 +65,7 @@ uint64 EbmlDate::ReadData(IOCallback & input, ScopeMode ReadFully)
|
|||||||
return GetSize();
|
return GetSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 EbmlDate::RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact)
|
filepos_t EbmlDate::RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact)
|
||||||
{
|
{
|
||||||
if (GetSize() != 0) {
|
if (GetSize() != 0) {
|
||||||
assert(GetSize() == 8);
|
assert(GetSize() == 8);
|
||||||
|
|||||||
@@ -564,7 +564,7 @@ EbmlElement *EbmlElement::CreateElementUsingContext(const EbmlId & aID, const Eb
|
|||||||
/*!
|
/*!
|
||||||
\todo verify that the size written is the same as the data written
|
\todo verify that the size written is the same as the data written
|
||||||
*/
|
*/
|
||||||
uint32 EbmlElement::Render(IOCallback & output, bool bKeepIntact, bool bKeepPosition, bool bForceRender)
|
filepos_t EbmlElement::Render(IOCallback & output, bool bKeepIntact, bool bKeepPosition, bool bForceRender)
|
||||||
{
|
{
|
||||||
assert(bValueIsSet || (bKeepIntact && DefaultISset())); // an element is been rendered without a value set !!!
|
assert(bValueIsSet || (bKeepIntact && DefaultISset())); // an element is been rendered without a value set !!!
|
||||||
// it may be a mandatory element without a default value
|
// it may be a mandatory element without a default value
|
||||||
@@ -575,7 +575,7 @@ uint32 EbmlElement::Render(IOCallback & output, bool bKeepIntact, bool bKeepPosi
|
|||||||
#if defined(_DEBUG) || defined(DEBUG)
|
#if defined(_DEBUG) || defined(DEBUG)
|
||||||
uint64 SupposedSize = UpdateSize(bKeepIntact, bForceRender);
|
uint64 SupposedSize = UpdateSize(bKeepIntact, bForceRender);
|
||||||
#endif // _DEBUG
|
#endif // _DEBUG
|
||||||
uint32 result = RenderHead(output, bForceRender, bKeepIntact, bKeepPosition);
|
filepos_t result = RenderHead(output, bForceRender, bKeepIntact, bKeepPosition);
|
||||||
uint64 WrittenSize = RenderData(output, bForceRender, bKeepIntact);
|
uint64 WrittenSize = RenderData(output, bForceRender, bKeepIntact);
|
||||||
#if defined(_DEBUG) || defined(DEBUG)
|
#if defined(_DEBUG) || defined(DEBUG)
|
||||||
if (SupposedSize != (0-1)) assert(WrittenSize == SupposedSize);
|
if (SupposedSize != (0-1)) assert(WrittenSize == SupposedSize);
|
||||||
@@ -594,7 +594,7 @@ uint32 EbmlElement::Render(IOCallback & output, bool bKeepIntact, bool bKeepPosi
|
|||||||
\todo handle exceptions on errors
|
\todo handle exceptions on errors
|
||||||
\todo handle CodeSize bigger than 5 bytes
|
\todo handle CodeSize bigger than 5 bytes
|
||||||
*/
|
*/
|
||||||
uint32 EbmlElement::RenderHead(IOCallback & output, bool bForceRender, bool bKeepIntact, bool bKeepPosition)
|
filepos_t EbmlElement::RenderHead(IOCallback & output, bool bForceRender, bool bKeepIntact, bool bKeepPosition)
|
||||||
{
|
{
|
||||||
if (EBML_ID_LENGTH(EbmlId(*this)) <= 0 || EBML_ID_LENGTH(EbmlId(*this)) > 4)
|
if (EBML_ID_LENGTH(EbmlId(*this)) <= 0 || EBML_ID_LENGTH(EbmlId(*this)) > 4)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -604,7 +604,7 @@ uint32 EbmlElement::RenderHead(IOCallback & output, bool bForceRender, bool bKee
|
|||||||
return MakeRenderHead(output, bKeepPosition);
|
return MakeRenderHead(output, bKeepPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 EbmlElement::MakeRenderHead(IOCallback & output, bool bKeepPosition)
|
filepos_t EbmlElement::MakeRenderHead(IOCallback & output, bool bKeepPosition)
|
||||||
{
|
{
|
||||||
binary FinalHead[4+8]; // Class D + 64 bits coded size
|
binary FinalHead[4+8]; // Class D + 64 bits coded size
|
||||||
unsigned int FinalHeadSize;
|
unsigned int FinalHeadSize;
|
||||||
@@ -665,7 +665,7 @@ bool EbmlElement::ForceSize(uint64 NewSize)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 EbmlElement::OverwriteHead(IOCallback & output, bool bKeepPosition)
|
filepos_t EbmlElement::OverwriteHead(IOCallback & output, bool bKeepPosition)
|
||||||
{
|
{
|
||||||
if (ElementPosition == 0) {
|
if (ElementPosition == 0) {
|
||||||
return 0; // the element has not been written
|
return 0; // the element has not been written
|
||||||
@@ -673,7 +673,7 @@ uint32 EbmlElement::OverwriteHead(IOCallback & output, bool bKeepPosition)
|
|||||||
|
|
||||||
uint64 CurrentPosition = output.getFilePointer();
|
uint64 CurrentPosition = output.getFilePointer();
|
||||||
output.setFilePointer(GetElementPosition());
|
output.setFilePointer(GetElementPosition());
|
||||||
uint32 Result = MakeRenderHead(output, bKeepPosition);
|
filepos_t Result = MakeRenderHead(output, bKeepPosition);
|
||||||
output.setFilePointer(CurrentPosition);
|
output.setFilePointer(CurrentPosition);
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ const double EbmlFloat::DefaultVal() const
|
|||||||
\todo handle exception on errors
|
\todo handle exception on errors
|
||||||
\todo handle 10 bits precision
|
\todo handle 10 bits precision
|
||||||
*/
|
*/
|
||||||
uint32 EbmlFloat::RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact)
|
filepos_t EbmlFloat::RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact)
|
||||||
{
|
{
|
||||||
assert(GetSize() == 4 || GetSize() == 8);
|
assert(GetSize() == 4 || GetSize() == 8);
|
||||||
|
|
||||||
@@ -109,7 +109,7 @@ uint64 EbmlFloat::UpdateSize(bool bKeepIntact, bool bForceRender)
|
|||||||
/*!
|
/*!
|
||||||
\todo remove the hack for possible endianess pb (test on little & big endian)
|
\todo remove the hack for possible endianess pb (test on little & big endian)
|
||||||
*/
|
*/
|
||||||
uint64 EbmlFloat::ReadData(IOCallback & input, ScopeMode ReadFully)
|
filepos_t EbmlFloat::ReadData(IOCallback & input, ScopeMode ReadFully)
|
||||||
{
|
{
|
||||||
if (ReadFully != SCOPE_NO_DATA)
|
if (ReadFully != SCOPE_NO_DATA)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -87,9 +87,9 @@ EbmlMaster::~EbmlMaster()
|
|||||||
\todo handle exception on errors
|
\todo handle exception on errors
|
||||||
\todo write all the Mandatory elements in the Context, otherwise assert
|
\todo write all the Mandatory elements in the Context, otherwise assert
|
||||||
*/
|
*/
|
||||||
uint32 EbmlMaster::RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact)
|
filepos_t EbmlMaster::RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact)
|
||||||
{
|
{
|
||||||
uint32 Result = 0;
|
filepos_t Result = 0;
|
||||||
size_t Index;
|
size_t Index;
|
||||||
|
|
||||||
if (!bForceRender) {
|
if (!bForceRender) {
|
||||||
@@ -158,7 +158,7 @@ uint64 EbmlMaster::UpdateSize(bool bKeepIntact, bool bForceRender)
|
|||||||
return GetSize();
|
return GetSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 EbmlMaster::WriteHead(IOCallback & output, int nSizeLength, bool bKeepIntact)
|
filepos_t EbmlMaster::WriteHead(IOCallback & output, int nSizeLength, bool bKeepIntact)
|
||||||
{
|
{
|
||||||
SetSizeLength(nSizeLength);
|
SetSizeLength(nSizeLength);
|
||||||
return RenderHead(output, false, bKeepIntact);
|
return RenderHead(output, false, bKeepIntact);
|
||||||
@@ -167,7 +167,7 @@ uint32 EbmlMaster::WriteHead(IOCallback & output, int nSizeLength, bool bKeepInt
|
|||||||
/*!
|
/*!
|
||||||
\todo this code is very suspicious !
|
\todo this code is very suspicious !
|
||||||
*/
|
*/
|
||||||
uint64 EbmlMaster::ReadData(IOCallback & input, ScopeMode ReadFully)
|
filepos_t EbmlMaster::ReadData(IOCallback & input, ScopeMode ReadFully)
|
||||||
{
|
{
|
||||||
input.setFilePointer(GetSize(), seek_current);
|
input.setFilePointer(GetSize(), seek_current);
|
||||||
return GetSize();
|
return GetSize();
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ EbmlSInteger::EbmlSInteger(const EbmlSInteger & ElementToClone)
|
|||||||
/*!
|
/*!
|
||||||
\todo handle exception on errors
|
\todo handle exception on errors
|
||||||
*/
|
*/
|
||||||
uint32 EbmlSInteger::RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact)
|
filepos_t EbmlSInteger::RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact)
|
||||||
{
|
{
|
||||||
binary FinalData[8]; // we don't handle more than 64 bits integers
|
binary FinalData[8]; // we don't handle more than 64 bits integers
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
@@ -110,7 +110,7 @@ uint64 EbmlSInteger::UpdateSize(bool bKeepIntact, bool bForceRender)
|
|||||||
return GetSize();
|
return GetSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64 EbmlSInteger::ReadData(IOCallback & input, ScopeMode ReadFully)
|
filepos_t EbmlSInteger::ReadData(IOCallback & input, ScopeMode ReadFully)
|
||||||
{
|
{
|
||||||
if (ReadFully != SCOPE_NO_DATA)
|
if (ReadFully != SCOPE_NO_DATA)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -87,9 +87,9 @@ const std::string & EbmlString::DefaultVal() const
|
|||||||
/*!
|
/*!
|
||||||
\todo handle exception on errors
|
\todo handle exception on errors
|
||||||
*/
|
*/
|
||||||
uint32 EbmlString::RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact)
|
filepos_t EbmlString::RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact)
|
||||||
{
|
{
|
||||||
uint32 Result;
|
filepos_t Result;
|
||||||
output.writeFully(Value.c_str(), Value.length());
|
output.writeFully(Value.c_str(), Value.length());
|
||||||
Result = Value.length();
|
Result = Value.length();
|
||||||
|
|
||||||
@@ -133,7 +133,7 @@ uint64 EbmlString::UpdateSize(bool bKeepIntact, bool bForceRender)
|
|||||||
return GetSize();
|
return GetSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64 EbmlString::ReadData(IOCallback & input, ScopeMode ReadFully)
|
filepos_t EbmlString::ReadData(IOCallback & input, ScopeMode ReadFully)
|
||||||
{
|
{
|
||||||
if (ReadFully != SCOPE_NO_DATA)
|
if (ReadFully != SCOPE_NO_DATA)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ const uint64 EbmlUInteger::DefaultVal() const
|
|||||||
/*!
|
/*!
|
||||||
\todo handle exception on errors
|
\todo handle exception on errors
|
||||||
*/
|
*/
|
||||||
uint32 EbmlUInteger::RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact)
|
filepos_t EbmlUInteger::RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact)
|
||||||
{
|
{
|
||||||
binary FinalData[8]; // we don't handle more than 64 bits integers
|
binary FinalData[8]; // we don't handle more than 64 bits integers
|
||||||
|
|
||||||
@@ -122,7 +122,7 @@ uint64 EbmlUInteger::UpdateSize(bool bKeepIntact, bool bForceRender)
|
|||||||
return GetSize();
|
return GetSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64 EbmlUInteger::ReadData(IOCallback & input, ScopeMode ReadFully)
|
filepos_t EbmlUInteger::ReadData(IOCallback & input, ScopeMode ReadFully)
|
||||||
{
|
{
|
||||||
if (ReadFully != SCOPE_NO_DATA)
|
if (ReadFully != SCOPE_NO_DATA)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -242,7 +242,7 @@ const UTFstring & EbmlUnicodeString::DefaultVal() const
|
|||||||
\note limited to UCS-2
|
\note limited to UCS-2
|
||||||
\todo handle exception on errors
|
\todo handle exception on errors
|
||||||
*/
|
*/
|
||||||
uint32 EbmlUnicodeString::RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact)
|
filepos_t EbmlUnicodeString::RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact)
|
||||||
{
|
{
|
||||||
uint32 Result = Value.GetUTF8().length();
|
uint32 Result = Value.GetUTF8().length();
|
||||||
|
|
||||||
@@ -290,7 +290,7 @@ uint64 EbmlUnicodeString::UpdateSize(bool bKeepIntact, bool bForceRender)
|
|||||||
/*!
|
/*!
|
||||||
\note limited to UCS-2
|
\note limited to UCS-2
|
||||||
*/
|
*/
|
||||||
uint64 EbmlUnicodeString::ReadData(IOCallback & input, ScopeMode ReadFully)
|
filepos_t EbmlUnicodeString::ReadData(IOCallback & input, ScopeMode ReadFully)
|
||||||
{
|
{
|
||||||
if (ReadFully != SCOPE_NO_DATA)
|
if (ReadFully != SCOPE_NO_DATA)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ EbmlVoid::EbmlVoid()
|
|||||||
SetValueIsSet();
|
SetValueIsSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 EbmlVoid::RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact)
|
filepos_t EbmlVoid::RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact)
|
||||||
{
|
{
|
||||||
// write dummy data by 4KB chunks
|
// write dummy data by 4KB chunks
|
||||||
static binary DummyBuf[4*1024];
|
static binary DummyBuf[4*1024];
|
||||||
|
|||||||
Reference in New Issue
Block a user