Use Linux-style EOL for non Windows specific files
This commit is contained in:
parent
302c8fb89d
commit
71fbd5a521
1008
LICENSE.LGPL
1008
LICENSE.LGPL
File diff suppressed because it is too large
Load Diff
@ -1,122 +1,122 @@
|
||||
/****************************************************************************
|
||||
** libebml : parse EBML files, see http://embl.sourceforge.net/
|
||||
**
|
||||
** <file/class description>
|
||||
**
|
||||
** Copyright (C) 2002-2010 Steve Lhomme. All rights reserved.
|
||||
**
|
||||
** This file is part of libebml.
|
||||
**
|
||||
** This library is free software; you can redistribute it and/or
|
||||
** modify it under the terms of the GNU Lesser General Public
|
||||
** License as published by the Free Software Foundation; either
|
||||
** version 2.1 of the License, or (at your option) any later version.
|
||||
**
|
||||
** This library is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
** Lesser General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU Lesser General Public
|
||||
** License along with this library; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
**
|
||||
** See http://www.matroska.org/license/lgpl/ for LGPL licensing information.
|
||||
**
|
||||
** Contact license@matroska.org if any conditions of this licensing are
|
||||
** not clear to you.
|
||||
**
|
||||
**********************************************************************/
|
||||
|
||||
/*!
|
||||
\file
|
||||
\version \$Id: EbmlEndian.h 1298 2008-02-21 22:14:18Z mosu $
|
||||
\author Ingo Ralf Blum <ingoralfblum @ users.sf.net>
|
||||
\author Lasse Kärkkäinen <tronic @ users.sf.net>
|
||||
\author Steve Lhomme <robux4 @ users.sf.net>
|
||||
*/
|
||||
#ifndef LIBEBML_ENDIAN_H
|
||||
#define LIBEBML_ENDIAN_H
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
|
||||
#include "EbmlConfig.h" // contains _ENDIANESS_
|
||||
|
||||
START_LIBEBML_NAMESPACE
|
||||
|
||||
enum endianess {
|
||||
big_endian, ///< PowerPC, Alpha, 68000
|
||||
little_endian ///< Intel x86 platforms
|
||||
};
|
||||
|
||||
/*!
|
||||
\class Endian
|
||||
\brief general class to handle endian-specific buffers
|
||||
\note don't forget to define/undefine _ENDIANESS_ to BIG_ENDIAN depending on your machine
|
||||
*/
|
||||
template<class TYPE, endianess ENDIAN> class Endian
|
||||
{
|
||||
public:
|
||||
Endian() {}
|
||||
|
||||
Endian(const TYPE value)
|
||||
{
|
||||
memcpy(&platform_value, &value, sizeof(TYPE));
|
||||
process_endian();
|
||||
}
|
||||
|
||||
inline Endian & Eval(const binary *endian_buffer)
|
||||
{
|
||||
//endian_value = *(TYPE *)(endian_buffer);
|
||||
memcpy(&endian_value, endian_buffer, sizeof(TYPE)); // Some (all?) RISC processors do not allow reading objects bigger than 1 byte from non-aligned addresses, and endian_buffer may point to a non-aligned address.
|
||||
process_platform();
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline void Fill(binary *endian_buffer) const
|
||||
{
|
||||
//*(TYPE*)endian_buffer = endian_value;
|
||||
memcpy(endian_buffer, &endian_value, sizeof(TYPE)); // See above.
|
||||
}
|
||||
|
||||
inline operator const TYPE&() const { return platform_value; }
|
||||
// inline TYPE endian() const { return endian_value; }
|
||||
inline const TYPE &endian() const { return endian_value; }
|
||||
inline size_t size() const { return sizeof(TYPE); }
|
||||
inline bool operator!=(const binary *buffer) const {return *((TYPE*)buffer) == platform_value;}
|
||||
|
||||
#if defined(EBML_STRICT_API)
|
||||
private:
|
||||
#else
|
||||
protected:
|
||||
#endif
|
||||
TYPE platform_value;
|
||||
TYPE endian_value;
|
||||
|
||||
inline void process_endian()
|
||||
{
|
||||
endian_value = platform_value;
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
if (ENDIAN == little_endian)
|
||||
#else // _ENDIANESS_
|
||||
if (ENDIAN == big_endian)
|
||||
#endif // _ENDIANESS_
|
||||
std::reverse(reinterpret_cast<uint8*>(&endian_value),reinterpret_cast<uint8*>(&endian_value+1));
|
||||
}
|
||||
|
||||
inline void process_platform()
|
||||
{
|
||||
platform_value = endian_value;
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
if (ENDIAN == little_endian)
|
||||
#else // _ENDIANESS_
|
||||
if (ENDIAN == big_endian)
|
||||
#endif // _ENDIANESS_
|
||||
std::reverse(reinterpret_cast<uint8*>(&platform_value),reinterpret_cast<uint8*>(&platform_value+1));
|
||||
}
|
||||
};
|
||||
|
||||
END_LIBEBML_NAMESPACE
|
||||
|
||||
#endif // LIBEBML_ENDIAN_H
|
||||
/****************************************************************************
|
||||
** libebml : parse EBML files, see http://embl.sourceforge.net/
|
||||
**
|
||||
** <file/class description>
|
||||
**
|
||||
** Copyright (C) 2002-2010 Steve Lhomme. All rights reserved.
|
||||
**
|
||||
** This file is part of libebml.
|
||||
**
|
||||
** This library is free software; you can redistribute it and/or
|
||||
** modify it under the terms of the GNU Lesser General Public
|
||||
** License as published by the Free Software Foundation; either
|
||||
** version 2.1 of the License, or (at your option) any later version.
|
||||
**
|
||||
** This library is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
** Lesser General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU Lesser General Public
|
||||
** License along with this library; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
**
|
||||
** See http://www.matroska.org/license/lgpl/ for LGPL licensing information.
|
||||
**
|
||||
** Contact license@matroska.org if any conditions of this licensing are
|
||||
** not clear to you.
|
||||
**
|
||||
**********************************************************************/
|
||||
|
||||
/*!
|
||||
\file
|
||||
\version \$Id: EbmlEndian.h 1298 2008-02-21 22:14:18Z mosu $
|
||||
\author Ingo Ralf Blum <ingoralfblum @ users.sf.net>
|
||||
\author Lasse Kärkkäinen <tronic @ users.sf.net>
|
||||
\author Steve Lhomme <robux4 @ users.sf.net>
|
||||
*/
|
||||
#ifndef LIBEBML_ENDIAN_H
|
||||
#define LIBEBML_ENDIAN_H
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
|
||||
#include "EbmlConfig.h" // contains _ENDIANESS_
|
||||
|
||||
START_LIBEBML_NAMESPACE
|
||||
|
||||
enum endianess {
|
||||
big_endian, ///< PowerPC, Alpha, 68000
|
||||
little_endian ///< Intel x86 platforms
|
||||
};
|
||||
|
||||
/*!
|
||||
\class Endian
|
||||
\brief general class to handle endian-specific buffers
|
||||
\note don't forget to define/undefine _ENDIANESS_ to BIG_ENDIAN depending on your machine
|
||||
*/
|
||||
template<class TYPE, endianess ENDIAN> class Endian
|
||||
{
|
||||
public:
|
||||
Endian() {}
|
||||
|
||||
Endian(const TYPE value)
|
||||
{
|
||||
memcpy(&platform_value, &value, sizeof(TYPE));
|
||||
process_endian();
|
||||
}
|
||||
|
||||
inline Endian & Eval(const binary *endian_buffer)
|
||||
{
|
||||
//endian_value = *(TYPE *)(endian_buffer);
|
||||
memcpy(&endian_value, endian_buffer, sizeof(TYPE)); // Some (all?) RISC processors do not allow reading objects bigger than 1 byte from non-aligned addresses, and endian_buffer may point to a non-aligned address.
|
||||
process_platform();
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline void Fill(binary *endian_buffer) const
|
||||
{
|
||||
//*(TYPE*)endian_buffer = endian_value;
|
||||
memcpy(endian_buffer, &endian_value, sizeof(TYPE)); // See above.
|
||||
}
|
||||
|
||||
inline operator const TYPE&() const { return platform_value; }
|
||||
// inline TYPE endian() const { return endian_value; }
|
||||
inline const TYPE &endian() const { return endian_value; }
|
||||
inline size_t size() const { return sizeof(TYPE); }
|
||||
inline bool operator!=(const binary *buffer) const {return *((TYPE*)buffer) == platform_value;}
|
||||
|
||||
#if defined(EBML_STRICT_API)
|
||||
private:
|
||||
#else
|
||||
protected:
|
||||
#endif
|
||||
TYPE platform_value;
|
||||
TYPE endian_value;
|
||||
|
||||
inline void process_endian()
|
||||
{
|
||||
endian_value = platform_value;
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
if (ENDIAN == little_endian)
|
||||
#else // _ENDIANESS_
|
||||
if (ENDIAN == big_endian)
|
||||
#endif // _ENDIANESS_
|
||||
std::reverse(reinterpret_cast<uint8*>(&endian_value),reinterpret_cast<uint8*>(&endian_value+1));
|
||||
}
|
||||
|
||||
inline void process_platform()
|
||||
{
|
||||
platform_value = endian_value;
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
if (ENDIAN == little_endian)
|
||||
#else // _ENDIANESS_
|
||||
if (ENDIAN == big_endian)
|
||||
#endif // _ENDIANESS_
|
||||
std::reverse(reinterpret_cast<uint8*>(&platform_value),reinterpret_cast<uint8*>(&platform_value+1));
|
||||
}
|
||||
};
|
||||
|
||||
END_LIBEBML_NAMESPACE
|
||||
|
||||
#endif // LIBEBML_ENDIAN_H
|
||||
|
198
ebml/EbmlId.h
198
ebml/EbmlId.h
@ -1,99 +1,99 @@
|
||||
/****************************************************************************
|
||||
** libebml : parse EBML files, see http://embl.sourceforge.net/
|
||||
**
|
||||
** <file/class description>
|
||||
**
|
||||
** Copyright (C) 2002-2010 Steve Lhomme. All rights reserved.
|
||||
**
|
||||
** This file is part of libebml.
|
||||
**
|
||||
** This library is free software; you can redistribute it and/or
|
||||
** modify it under the terms of the GNU Lesser General Public
|
||||
** License as published by the Free Software Foundation; either
|
||||
** version 2.1 of the License, or (at your option) any later version.
|
||||
**
|
||||
** This library is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
** Lesser General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU Lesser General Public
|
||||
** License along with this library; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
**
|
||||
** See http://www.matroska.org/license/lgpl/ for LGPL licensing information.
|
||||
**
|
||||
** Contact license@matroska.org if any conditions of this licensing are
|
||||
** not clear to you.
|
||||
**
|
||||
**********************************************************************/
|
||||
|
||||
/*!
|
||||
\file
|
||||
\version \$Id: EbmlId.h 936 2004-11-10 20:46:28Z mosu $
|
||||
\author Steve Lhomme <robux4 @ users.sf.net>
|
||||
*/
|
||||
#ifndef LIBEBML_ID_H
|
||||
#define LIBEBML_ID_H
|
||||
|
||||
#include "EbmlTypes.h"
|
||||
|
||||
START_LIBEBML_NAMESPACE
|
||||
|
||||
|
||||
#if defined(EBML_STRICT_API)
|
||||
#define EBML_ID_VALUE(id) (id).GetValue()
|
||||
#define EBML_ID_LENGTH(id) (id).GetLength()
|
||||
#else
|
||||
#define EBML_ID_VALUE(id) (id).Value
|
||||
#define EBML_ID_LENGTH(id) (id).Length
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\class EbmlId
|
||||
*/
|
||||
class EBML_DLL_API EbmlId {
|
||||
public:
|
||||
EbmlId(const binary aValue[4], const unsigned int aLength)
|
||||
:Length(aLength)
|
||||
{
|
||||
Value = 0;
|
||||
unsigned int i;
|
||||
for (i=0; i<aLength; i++) {
|
||||
Value <<= 8;
|
||||
Value += aValue[i];
|
||||
}
|
||||
}
|
||||
|
||||
EbmlId(const uint32 aValue, const unsigned int aLength)
|
||||
:Value(aValue), Length(aLength) {}
|
||||
|
||||
inline bool operator==(const EbmlId & TestId) const
|
||||
{
|
||||
return ((TestId.Length == Length) && (TestId.Value == Value));
|
||||
}
|
||||
inline bool operator!=(const EbmlId & TestId) const
|
||||
{
|
||||
return !(*this == TestId);
|
||||
}
|
||||
|
||||
inline void Fill(binary * Buffer) const {
|
||||
unsigned int i;
|
||||
for (i = 0; i<Length; i++) {
|
||||
Buffer[i] = (Value >> (8*(Length-i-1))) & 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
inline size_t GetLength() const { return Length; }
|
||||
inline uint32 GetValue() const { return Value; }
|
||||
|
||||
#if defined(EBML_STRICT_API)
|
||||
private:
|
||||
#endif
|
||||
uint32 Value;
|
||||
size_t Length;
|
||||
};
|
||||
|
||||
END_LIBEBML_NAMESPACE
|
||||
|
||||
#endif // LIBEBML_ID_H
|
||||
/****************************************************************************
|
||||
** libebml : parse EBML files, see http://embl.sourceforge.net/
|
||||
**
|
||||
** <file/class description>
|
||||
**
|
||||
** Copyright (C) 2002-2010 Steve Lhomme. All rights reserved.
|
||||
**
|
||||
** This file is part of libebml.
|
||||
**
|
||||
** This library is free software; you can redistribute it and/or
|
||||
** modify it under the terms of the GNU Lesser General Public
|
||||
** License as published by the Free Software Foundation; either
|
||||
** version 2.1 of the License, or (at your option) any later version.
|
||||
**
|
||||
** This library is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
** Lesser General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU Lesser General Public
|
||||
** License along with this library; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
**
|
||||
** See http://www.matroska.org/license/lgpl/ for LGPL licensing information.
|
||||
**
|
||||
** Contact license@matroska.org if any conditions of this licensing are
|
||||
** not clear to you.
|
||||
**
|
||||
**********************************************************************/
|
||||
|
||||
/*!
|
||||
\file
|
||||
\version \$Id: EbmlId.h 936 2004-11-10 20:46:28Z mosu $
|
||||
\author Steve Lhomme <robux4 @ users.sf.net>
|
||||
*/
|
||||
#ifndef LIBEBML_ID_H
|
||||
#define LIBEBML_ID_H
|
||||
|
||||
#include "EbmlTypes.h"
|
||||
|
||||
START_LIBEBML_NAMESPACE
|
||||
|
||||
|
||||
#if defined(EBML_STRICT_API)
|
||||
#define EBML_ID_VALUE(id) (id).GetValue()
|
||||
#define EBML_ID_LENGTH(id) (id).GetLength()
|
||||
#else
|
||||
#define EBML_ID_VALUE(id) (id).Value
|
||||
#define EBML_ID_LENGTH(id) (id).Length
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\class EbmlId
|
||||
*/
|
||||
class EBML_DLL_API EbmlId {
|
||||
public:
|
||||
EbmlId(const binary aValue[4], const unsigned int aLength)
|
||||
:Length(aLength)
|
||||
{
|
||||
Value = 0;
|
||||
unsigned int i;
|
||||
for (i=0; i<aLength; i++) {
|
||||
Value <<= 8;
|
||||
Value += aValue[i];
|
||||
}
|
||||
}
|
||||
|
||||
EbmlId(const uint32 aValue, const unsigned int aLength)
|
||||
:Value(aValue), Length(aLength) {}
|
||||
|
||||
inline bool operator==(const EbmlId & TestId) const
|
||||
{
|
||||
return ((TestId.Length == Length) && (TestId.Value == Value));
|
||||
}
|
||||
inline bool operator!=(const EbmlId & TestId) const
|
||||
{
|
||||
return !(*this == TestId);
|
||||
}
|
||||
|
||||
inline void Fill(binary * Buffer) const {
|
||||
unsigned int i;
|
||||
for (i = 0; i<Length; i++) {
|
||||
Buffer[i] = (Value >> (8*(Length-i-1))) & 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
inline size_t GetLength() const { return Length; }
|
||||
inline uint32 GetValue() const { return Value; }
|
||||
|
||||
#if defined(EBML_STRICT_API)
|
||||
private:
|
||||
#endif
|
||||
uint32 Value;
|
||||
size_t Length;
|
||||
};
|
||||
|
||||
END_LIBEBML_NAMESPACE
|
||||
|
||||
#endif // LIBEBML_ID_H
|
||||
|
@ -1,97 +1,97 @@
|
||||
/****************************************************************************
|
||||
** libebml : parse EBML files, see http://embl.sourceforge.net/
|
||||
**
|
||||
** <file/class description>
|
||||
**
|
||||
** Copyright (C) 2002-2010 Steve Lhomme. All rights reserved.
|
||||
**
|
||||
** This file is part of libebml.
|
||||
**
|
||||
** This library is free software; you can redistribute it and/or
|
||||
** modify it under the terms of the GNU Lesser General Public
|
||||
** License as published by the Free Software Foundation; either
|
||||
** version 2.1 of the License, or (at your option) any later version.
|
||||
**
|
||||
** This library is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
** Lesser General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU Lesser General Public
|
||||
** License along with this library; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
**
|
||||
** See http://www.matroska.org/license/lgpl/ for LGPL licensing information.
|
||||
**
|
||||
** Contact license@matroska.org if any conditions of this licensing are
|
||||
** not clear to you.
|
||||
**
|
||||
**********************************************************************/
|
||||
|
||||
/*!
|
||||
\file
|
||||
\version \$Id: EbmlSubHead.h 639 2004-07-09 20:59:14Z mosu $
|
||||
\author Steve Lhomme <robux4 @ users.sf.net>
|
||||
*/
|
||||
#ifndef LIBEBML_SUBHEAD_H
|
||||
#define LIBEBML_SUBHEAD_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "EbmlUInteger.h"
|
||||
#include "EbmlString.h"
|
||||
|
||||
START_LIBEBML_NAMESPACE
|
||||
|
||||
DECLARE_EBML_UINTEGER(EVersion)
|
||||
public:
|
||||
EVersion(const EVersion & ElementToClone) : EbmlUInteger(ElementToClone) {}
|
||||
|
||||
EBML_CONCRETE_CLASS(EVersion)
|
||||
};
|
||||
|
||||
DECLARE_EBML_UINTEGER(EReadVersion)
|
||||
public:
|
||||
EReadVersion(const EReadVersion & ElementToClone) : EbmlUInteger(ElementToClone) {}
|
||||
|
||||
EBML_CONCRETE_CLASS(EReadVersion)
|
||||
};
|
||||
|
||||
DECLARE_EBML_UINTEGER(EMaxIdLength)
|
||||
public:
|
||||
EMaxIdLength(const EMaxIdLength & ElementToClone) : EbmlUInteger(ElementToClone) {}
|
||||
|
||||
EBML_CONCRETE_CLASS(EMaxIdLength)
|
||||
};
|
||||
|
||||
DECLARE_EBML_UINTEGER(EMaxSizeLength)
|
||||
public:
|
||||
EMaxSizeLength(const EMaxSizeLength & ElementToClone) : EbmlUInteger(ElementToClone) {}
|
||||
|
||||
EBML_CONCRETE_CLASS(EMaxSizeLength)
|
||||
};
|
||||
|
||||
DECLARE_EBML_STRING(EDocType)
|
||||
public:
|
||||
EDocType(const EDocType & ElementToClone) : EbmlString(ElementToClone) {}
|
||||
|
||||
EBML_CONCRETE_CLASS(EDocType)
|
||||
};
|
||||
|
||||
DECLARE_EBML_UINTEGER(EDocTypeVersion)
|
||||
public:
|
||||
EDocTypeVersion(const EDocTypeVersion & ElementToClone) : EbmlUInteger(ElementToClone) {}
|
||||
|
||||
EBML_CONCRETE_CLASS(EDocTypeVersion)
|
||||
};
|
||||
|
||||
DECLARE_EBML_UINTEGER(EDocTypeReadVersion)
|
||||
public:
|
||||
EDocTypeReadVersion(const EDocTypeReadVersion & ElementToClone) : EbmlUInteger(ElementToClone) {}
|
||||
|
||||
EBML_CONCRETE_CLASS(EDocTypeReadVersion)
|
||||
};
|
||||
|
||||
END_LIBEBML_NAMESPACE
|
||||
|
||||
#endif // LIBEBML_SUBHEAD_H
|
||||
/****************************************************************************
|
||||
** libebml : parse EBML files, see http://embl.sourceforge.net/
|
||||
**
|
||||
** <file/class description>
|
||||
**
|
||||
** Copyright (C) 2002-2010 Steve Lhomme. All rights reserved.
|
||||
**
|
||||
** This file is part of libebml.
|
||||
**
|
||||
** This library is free software; you can redistribute it and/or
|
||||
** modify it under the terms of the GNU Lesser General Public
|
||||
** License as published by the Free Software Foundation; either
|
||||
** version 2.1 of the License, or (at your option) any later version.
|
||||
**
|
||||
** This library is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
** Lesser General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU Lesser General Public
|
||||
** License along with this library; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
**
|
||||
** See http://www.matroska.org/license/lgpl/ for LGPL licensing information.
|
||||
**
|
||||
** Contact license@matroska.org if any conditions of this licensing are
|
||||
** not clear to you.
|
||||
**
|
||||
**********************************************************************/
|
||||
|
||||
/*!
|
||||
\file
|
||||
\version \$Id: EbmlSubHead.h 639 2004-07-09 20:59:14Z mosu $
|
||||
\author Steve Lhomme <robux4 @ users.sf.net>
|
||||
*/
|
||||
#ifndef LIBEBML_SUBHEAD_H
|
||||
#define LIBEBML_SUBHEAD_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "EbmlUInteger.h"
|
||||
#include "EbmlString.h"
|
||||
|
||||
START_LIBEBML_NAMESPACE
|
||||
|
||||
DECLARE_EBML_UINTEGER(EVersion)
|
||||
public:
|
||||
EVersion(const EVersion & ElementToClone) : EbmlUInteger(ElementToClone) {}
|
||||
|
||||
EBML_CONCRETE_CLASS(EVersion)
|
||||
};
|
||||
|
||||
DECLARE_EBML_UINTEGER(EReadVersion)
|
||||
public:
|
||||
EReadVersion(const EReadVersion & ElementToClone) : EbmlUInteger(ElementToClone) {}
|
||||
|
||||
EBML_CONCRETE_CLASS(EReadVersion)
|
||||
};
|
||||
|
||||
DECLARE_EBML_UINTEGER(EMaxIdLength)
|
||||
public:
|
||||
EMaxIdLength(const EMaxIdLength & ElementToClone) : EbmlUInteger(ElementToClone) {}
|
||||
|
||||
EBML_CONCRETE_CLASS(EMaxIdLength)
|
||||
};
|
||||
|
||||
DECLARE_EBML_UINTEGER(EMaxSizeLength)
|
||||
public:
|
||||
EMaxSizeLength(const EMaxSizeLength & ElementToClone) : EbmlUInteger(ElementToClone) {}
|
||||
|
||||
EBML_CONCRETE_CLASS(EMaxSizeLength)
|
||||
};
|
||||
|
||||
DECLARE_EBML_STRING(EDocType)
|
||||
public:
|
||||
EDocType(const EDocType & ElementToClone) : EbmlString(ElementToClone) {}
|
||||
|
||||
EBML_CONCRETE_CLASS(EDocType)
|
||||
};
|
||||
|
||||
DECLARE_EBML_UINTEGER(EDocTypeVersion)
|
||||
public:
|
||||
EDocTypeVersion(const EDocTypeVersion & ElementToClone) : EbmlUInteger(ElementToClone) {}
|
||||
|
||||
EBML_CONCRETE_CLASS(EDocTypeVersion)
|
||||
};
|
||||
|
||||
DECLARE_EBML_UINTEGER(EDocTypeReadVersion)
|
||||
public:
|
||||
EDocTypeReadVersion(const EDocTypeReadVersion & ElementToClone) : EbmlUInteger(ElementToClone) {}
|
||||
|
||||
EBML_CONCRETE_CLASS(EDocTypeReadVersion)
|
||||
};
|
||||
|
||||
END_LIBEBML_NAMESPACE
|
||||
|
||||
#endif // LIBEBML_SUBHEAD_H
|
||||
|
144
ebml/EbmlTypes.h
144
ebml/EbmlTypes.h
@ -1,72 +1,72 @@
|
||||
/****************************************************************************
|
||||
** libebml : parse EBML files, see http://embl.sourceforge.net/
|
||||
**
|
||||
** <file/class description>
|
||||
**
|
||||
** Copyright (C) 2002-2004 Steve Lhomme. All rights reserved.
|
||||
**
|
||||
** This library is free software; you can redistribute it and/or
|
||||
** modify it under the terms of the GNU Lesser General Public
|
||||
** License as published by the Free Software Foundation; either
|
||||
** version 2.1 of the License, or (at your option) any later version.
|
||||
**
|
||||
** This library is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
** Lesser General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU Lesser General Public
|
||||
** License along with this library; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
**
|
||||
** See http://www.matroska.org/license/lgpl/ for LGPL licensing information.
|
||||
**
|
||||
** Contact license@matroska.org if any conditions of this licensing are
|
||||
** not clear to you.
|
||||
**
|
||||
**********************************************************************/
|
||||
|
||||
/*!
|
||||
\file
|
||||
\version \$Id: EbmlTypes.h 639 2004-07-09 20:59:14Z mosu $
|
||||
*/
|
||||
#ifndef LIBEBML_TYPES_H
|
||||
#define LIBEBML_TYPES_H
|
||||
|
||||
#include "ebml/c/libebml_t.h"
|
||||
#include "ebml/EbmlConfig.h"
|
||||
#include "EbmlEndian.h" // binary needs to be defined
|
||||
|
||||
START_LIBEBML_NAMESPACE
|
||||
|
||||
typedef wchar_t utf16;
|
||||
typedef uint32 utf32;
|
||||
typedef char utf8;
|
||||
|
||||
typedef binary bits80[10];
|
||||
|
||||
typedef Endian<int16,little_endian> lil_int16;
|
||||
typedef Endian<int32,little_endian> lil_int32;
|
||||
typedef Endian<int64,little_endian> lil_int64;
|
||||
typedef Endian<uint16,little_endian> lil_uint16;
|
||||
typedef Endian<uint32,little_endian> lil_uint32;
|
||||
typedef Endian<uint64,little_endian> lil_uint64;
|
||||
typedef Endian<int16,big_endian> big_int16;
|
||||
typedef Endian<int32,big_endian> big_int32;
|
||||
typedef Endian<int64,big_endian> big_int64;
|
||||
typedef Endian<uint16,big_endian> big_uint16;
|
||||
typedef Endian<uint32,big_endian> big_uint32;
|
||||
typedef Endian<uint64,big_endian> big_uint64;
|
||||
typedef Endian<uint32,big_endian> checksum;
|
||||
typedef Endian<bits80,big_endian> big_80bits;
|
||||
|
||||
|
||||
enum ScopeMode {
|
||||
SCOPE_PARTIAL_DATA = 0,
|
||||
SCOPE_ALL_DATA,
|
||||
SCOPE_NO_DATA
|
||||
};
|
||||
|
||||
END_LIBEBML_NAMESPACE
|
||||
|
||||
#endif
|
||||
/****************************************************************************
|
||||
** libebml : parse EBML files, see http://embl.sourceforge.net/
|
||||
**
|
||||
** <file/class description>
|
||||
**
|
||||
** Copyright (C) 2002-2004 Steve Lhomme. All rights reserved.
|
||||
**
|
||||
** This library is free software; you can redistribute it and/or
|
||||
** modify it under the terms of the GNU Lesser General Public
|
||||
** License as published by the Free Software Foundation; either
|
||||
** version 2.1 of the License, or (at your option) any later version.
|
||||
**
|
||||
** This library is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
** Lesser General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU Lesser General Public
|
||||
** License along with this library; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
**
|
||||
** See http://www.matroska.org/license/lgpl/ for LGPL licensing information.
|
||||
**
|
||||
** Contact license@matroska.org if any conditions of this licensing are
|
||||
** not clear to you.
|
||||
**
|
||||
**********************************************************************/
|
||||
|
||||
/*!
|
||||
\file
|
||||
\version \$Id: EbmlTypes.h 639 2004-07-09 20:59:14Z mosu $
|
||||
*/
|
||||
#ifndef LIBEBML_TYPES_H
|
||||
#define LIBEBML_TYPES_H
|
||||
|
||||
#include "ebml/c/libebml_t.h"
|
||||
#include "ebml/EbmlConfig.h"
|
||||
#include "EbmlEndian.h" // binary needs to be defined
|
||||
|
||||
START_LIBEBML_NAMESPACE
|
||||
|
||||
typedef wchar_t utf16;
|
||||
typedef uint32 utf32;
|
||||
typedef char utf8;
|
||||
|
||||
typedef binary bits80[10];
|
||||
|
||||
typedef Endian<int16,little_endian> lil_int16;
|
||||
typedef Endian<int32,little_endian> lil_int32;
|
||||
typedef Endian<int64,little_endian> lil_int64;
|
||||
typedef Endian<uint16,little_endian> lil_uint16;
|
||||
typedef Endian<uint32,little_endian> lil_uint32;
|
||||
typedef Endian<uint64,little_endian> lil_uint64;
|
||||
typedef Endian<int16,big_endian> big_int16;
|
||||
typedef Endian<int32,big_endian> big_int32;
|
||||
typedef Endian<int64,big_endian> big_int64;
|
||||
typedef Endian<uint16,big_endian> big_uint16;
|
||||
typedef Endian<uint32,big_endian> big_uint32;
|
||||
typedef Endian<uint64,big_endian> big_uint64;
|
||||
typedef Endian<uint32,big_endian> checksum;
|
||||
typedef Endian<bits80,big_endian> big_80bits;
|
||||
|
||||
|
||||
enum ScopeMode {
|
||||
SCOPE_PARTIAL_DATA = 0,
|
||||
SCOPE_ALL_DATA,
|
||||
SCOPE_NO_DATA
|
||||
};
|
||||
|
||||
END_LIBEBML_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
146
ebml/EbmlVoid.h
146
ebml/EbmlVoid.h
@ -1,73 +1,73 @@
|
||||
/****************************************************************************
|
||||
** libebml : parse EBML files, see http://embl.sourceforge.net/
|
||||
**
|
||||
** <file/class description>
|
||||
**
|
||||
** Copyright (C) 2002-2010 Steve Lhomme. All rights reserved.
|
||||
**
|
||||
** This file is part of libebml.
|
||||
**
|
||||
** This library is free software; you can redistribute it and/or
|
||||
** modify it under the terms of the GNU Lesser General Public
|
||||
** License as published by the Free Software Foundation; either
|
||||
** version 2.1 of the License, or (at your option) any later version.
|
||||
**
|
||||
** This library is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
** Lesser General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU Lesser General Public
|
||||
** License along with this library; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
**
|
||||
** See http://www.matroska.org/license/lgpl/ for LGPL licensing information.
|
||||
**
|
||||
** Contact license@matroska.org if any conditions of this licensing are
|
||||
** not clear to you.
|
||||
**
|
||||
**********************************************************************/
|
||||
|
||||
/*!
|
||||
\file
|
||||
\version \$Id: EbmlVoid.h 1079 2005-03-03 13:18:14Z robux4 $
|
||||
\author Steve Lhomme <robux4 @ users.sf.net>
|
||||
*/
|
||||
#ifndef LIBEBML_VOID_H
|
||||
#define LIBEBML_VOID_H
|
||||
|
||||
#include "EbmlTypes.h"
|
||||
#include "EbmlBinary.h"
|
||||
|
||||
START_LIBEBML_NAMESPACE
|
||||
|
||||
DECLARE_EBML_BINARY(EbmlVoid)
|
||||
public:
|
||||
EbmlVoid(const EbmlVoid & ElementToClone) :EbmlBinary(ElementToClone){}
|
||||
|
||||
/*!
|
||||
\brief Set the size of the data (not the complete size of the element)
|
||||
*/
|
||||
void SetSize(uint64 aSize) {SetSize_(aSize);}
|
||||
|
||||
/*!
|
||||
\note overwrite to write fake data
|
||||
*/
|
||||
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bWithDefault = false);
|
||||
|
||||
/*!
|
||||
\brief Replace the void element content (written) with this one
|
||||
*/
|
||||
uint64 ReplaceWith(EbmlElement & EltToReplaceWith, IOCallback & output, bool ComeBackAfterward = true, bool bWithDefault = false);
|
||||
|
||||
/*!
|
||||
\brief Void the content of an element
|
||||
*/
|
||||
uint64 Overwrite(const EbmlElement & EltToVoid, IOCallback & output, bool ComeBackAfterward = true, bool bWithDefault = false);
|
||||
|
||||
EBML_CONCRETE_CLASS(EbmlVoid)
|
||||
};
|
||||
|
||||
END_LIBEBML_NAMESPACE
|
||||
|
||||
#endif // LIBEBML_VOID_H
|
||||
/****************************************************************************
|
||||
** libebml : parse EBML files, see http://embl.sourceforge.net/
|
||||
**
|
||||
** <file/class description>
|
||||
**
|
||||
** Copyright (C) 2002-2010 Steve Lhomme. All rights reserved.
|
||||
**
|
||||
** This file is part of libebml.
|
||||
**
|
||||
** This library is free software; you can redistribute it and/or
|
||||
** modify it under the terms of the GNU Lesser General Public
|
||||
** License as published by the Free Software Foundation; either
|
||||
** version 2.1 of the License, or (at your option) any later version.
|
||||
**
|
||||
** This library is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
** Lesser General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU Lesser General Public
|
||||
** License along with this library; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
**
|
||||
** See http://www.matroska.org/license/lgpl/ for LGPL licensing information.
|
||||
**
|
||||
** Contact license@matroska.org if any conditions of this licensing are
|
||||
** not clear to you.
|
||||
**
|
||||
**********************************************************************/
|
||||
|
||||
/*!
|
||||
\file
|
||||
\version \$Id: EbmlVoid.h 1079 2005-03-03 13:18:14Z robux4 $
|
||||
\author Steve Lhomme <robux4 @ users.sf.net>
|
||||
*/
|
||||
#ifndef LIBEBML_VOID_H
|
||||
#define LIBEBML_VOID_H
|
||||
|
||||
#include "EbmlTypes.h"
|
||||
#include "EbmlBinary.h"
|
||||
|
||||
START_LIBEBML_NAMESPACE
|
||||
|
||||
DECLARE_EBML_BINARY(EbmlVoid)
|
||||
public:
|
||||
EbmlVoid(const EbmlVoid & ElementToClone) :EbmlBinary(ElementToClone){}
|
||||
|
||||
/*!
|
||||
\brief Set the size of the data (not the complete size of the element)
|
||||
*/
|
||||
void SetSize(uint64 aSize) {SetSize_(aSize);}
|
||||
|
||||
/*!
|
||||
\note overwrite to write fake data
|
||||
*/
|
||||
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bWithDefault = false);
|
||||
|
||||
/*!
|
||||
\brief Replace the void element content (written) with this one
|
||||
*/
|
||||
uint64 ReplaceWith(EbmlElement & EltToReplaceWith, IOCallback & output, bool ComeBackAfterward = true, bool bWithDefault = false);
|
||||
|
||||
/*!
|
||||
\brief Void the content of an element
|
||||
*/
|
||||
uint64 Overwrite(const EbmlElement & EltToVoid, IOCallback & output, bool ComeBackAfterward = true, bool bWithDefault = false);
|
||||
|
||||
EBML_CONCRETE_CLASS(EbmlVoid)
|
||||
};
|
||||
|
||||
END_LIBEBML_NAMESPACE
|
||||
|
||||
#endif // LIBEBML_VOID_H
|
||||
|
@ -1,151 +1,151 @@
|
||||
# libebml Makefile
|
||||
# $Id: Makefile,v 1.8 2004/05/11 20:27:38 mosu Exp $
|
||||
# Author: Steve Lhomme <robux4 @ users.sf.net>
|
||||
# Author: Moritz Bunkus <moritz @ bunkus.org>
|
||||
|
||||
#
|
||||
# The library is built without debug information. If you want
|
||||
# debug information to be included then compile with
|
||||
# 'make DEBUG=yes'.
|
||||
#
|
||||
|
||||
# Paths
|
||||
# BeOS wants the libs and headers in /boot/home/config
|
||||
ifeq (BeOS,$(shell uname -s))
|
||||
prefix=/boot/home/config
|
||||
else
|
||||
prefix=/usr/local
|
||||
endif
|
||||
libdir=$(prefix)/lib
|
||||
includedir=$(prefix)/include/ebml
|
||||
|
||||
# Programs
|
||||
CROSS =
|
||||
CXX = $(CROSS)g++
|
||||
LD = $(CXX)
|
||||
AR = $(CROSS)ar
|
||||
RANLIB = $(CROSS)ranlib
|
||||
INSTALL = install
|
||||
INSTALL_OPTS = -m 644
|
||||
INSTALL_OPTS_LIB = -m 644
|
||||
INSTALL_DIR_OPTS = -m 755
|
||||
|
||||
# Options
|
||||
EXTENSION=.cpp
|
||||
|
||||
ifeq (yes,$(DEBUG))
|
||||
DEBUGFLAGS=-g -DDEBUG
|
||||
endif
|
||||
|
||||
ifeq (Darwin,$(shell uname -s))
|
||||
link=static
|
||||
else
|
||||
link=both
|
||||
endif
|
||||
|
||||
targets_both = staticlib sharedlib
|
||||
targets_shared = sharedlib
|
||||
targets_static = staticlib
|
||||
|
||||
CWD=$(shell pwd)
|
||||
|
||||
SRC_DIR=$(CWD)/../../src/
|
||||
INCLUDE_DIR=$(CWD)/../../ebml
|
||||
|
||||
# Libraries
|
||||
INCLUDE=-I$(CWD)/../..
|
||||
LIBS=
|
||||
|
||||
# Names
|
||||
LIBRARY=libebml.a
|
||||
LIBRARY_SO=libebml.so
|
||||
LIBRARY_SO_VER=libebml.so.4
|
||||
|
||||
# source-files
|
||||
sources:=$(wildcard ${SRC_DIR}*$(EXTENSION))
|
||||
|
||||
# header files; replace .cxx extension with .h
|
||||
headers:=$(patsubst %$(EXTENSION),%.h,$(sources))
|
||||
|
||||
# object files; replace .cxx extension with .o
|
||||
objects:=$(patsubst %$(EXTENSION),%.o,$(sources))
|
||||
objects_so:=$(patsubst %$(EXTENSION),%.lo,$(sources))
|
||||
|
||||
WARNINGFLAGS=-Wall -Wextra -Wno-unknown-pragmas -Wshadow
|
||||
COMPILEFLAGS=$(WARNINGFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(DEBUGFLAGS) $(INCLUDE)
|
||||
DEPENDFLAGS = $(CXXFLAGS) $(INCLUDE)
|
||||
|
||||
all: $(targets_$(link))
|
||||
|
||||
staticlib: $(LIBRARY)
|
||||
|
||||
sharedlib: $(LIBRARY_SO)
|
||||
|
||||
lib:
|
||||
@echo "Use the 'staticlib', 'sharedlib' or 'all' targets."
|
||||
@false
|
||||
|
||||
# Build rules
|
||||
%.o: %$(EXTENSION)
|
||||
$(CXX) -c $(COMPILEFLAGS) -o $@ $<
|
||||
|
||||
%.lo: %$(EXTENSION)
|
||||
$(CXX) -c $(COMPILEFLAGS) -fPIC -o $@ $<
|
||||
|
||||
$(LIBRARY): $(objects)
|
||||
$(AR) rcvu $@ $(objects)
|
||||
$(RANLIB) $@
|
||||
|
||||
$(LIBRARY_SO): $(objects_so)
|
||||
$(CXX) -shared -Wl,-soname,$(LIBRARY_SO_VER) -o $(LIBRARY_SO_VER) $(objects_so)
|
||||
rm -f $(LIBRARY_SO)
|
||||
ln -s $(LIBRARY_SO_VER) $(LIBRARY_SO)
|
||||
|
||||
clean:
|
||||
rm -f $(objects) $(objects_so)
|
||||
rm -f $(LIBRARY)
|
||||
rm -f $(LIBRARY_SO)
|
||||
rm -f $(LIBRARY_SO_VER)
|
||||
rm -f CORE
|
||||
|
||||
distclean dist-clean: clean
|
||||
rm -f .depend
|
||||
|
||||
depend:
|
||||
@echo Calculating dependecies:
|
||||
@rm -f .depend
|
||||
@touch .depend
|
||||
@for i in $(sources); do \
|
||||
o="`echo $$i | sed -e 's/\.c$$/.o/' -e 's/\.cpp$$/.o/'`" ; \
|
||||
echo ' ' $$i: $$o ; \
|
||||
$(CXX) $(DEPENDFLAGS) -MM -MT $$o $$i >> .depend ; \
|
||||
done
|
||||
|
||||
install: $(targets_$(link):%=install_%) install_headers
|
||||
|
||||
install_headers:
|
||||
$(INSTALL) $(INSTALL_DIR_OPTS) -d $(DESTDIR)$(includedir)
|
||||
for i in $(INCLUDE_DIR)/*.h; do \
|
||||
$(INSTALL) $(INSTALL_OPTS) $$i $(DESTDIR)$(includedir) ; \
|
||||
done
|
||||
$(INSTALL) $(INSTALL_DIR_OPTS) -d $(DESTDIR)$(includedir)/c
|
||||
for i in $(INCLUDE_DIR)/c/*.h; do \
|
||||
$(INSTALL) $(INSTALL_OPTS) $$i $(DESTDIR)$(includedir)/c ; \
|
||||
done
|
||||
|
||||
install_staticlib: $(LIBRARY)
|
||||
$(INSTALL) $(INSTALL_DIR_OPTS) -d $(DESTDIR)$(libdir)
|
||||
$(INSTALL) $(INSTALL_OPTS_LIB) $(LIBRARY) $(DESTDIR)$(libdir)
|
||||
|
||||
install_sharedlib: $(LIBRARY_SO)
|
||||
$(INSTALL) $(INSTALL_DIR_OPTS) -d $(DESTDIR)$(libdir)
|
||||
$(INSTALL) $(INSTALL_OPTS_LIB) $(LIBRARY_SO_VER) $(DESTDIR)$(libdir)
|
||||
ln -fs $(LIBRARY_SO_VER) $(DESTDIR)$(libdir)/$(LIBRARY_SO)
|
||||
|
||||
|
||||
ifneq ($(wildcard .depend),)
|
||||
include .depend
|
||||
endif
|
||||
|
||||
# DO NOT DELETE
|
||||
|
||||
# libebml Makefile
|
||||
# $Id: Makefile,v 1.8 2004/05/11 20:27:38 mosu Exp $
|
||||
# Author: Steve Lhomme <robux4 @ users.sf.net>
|
||||
# Author: Moritz Bunkus <moritz @ bunkus.org>
|
||||
|
||||
#
|
||||
# The library is built without debug information. If you want
|
||||
# debug information to be included then compile with
|
||||
# 'make DEBUG=yes'.
|
||||
#
|
||||
|
||||
# Paths
|
||||
# BeOS wants the libs and headers in /boot/home/config
|
||||
ifeq (BeOS,$(shell uname -s))
|
||||
prefix=/boot/home/config
|
||||
else
|
||||
prefix=/usr/local
|
||||
endif
|
||||
libdir=$(prefix)/lib
|
||||
includedir=$(prefix)/include/ebml
|
||||
|
||||
# Programs
|
||||
CROSS =
|
||||
CXX = $(CROSS)g++
|
||||
LD = $(CXX)
|
||||
AR = $(CROSS)ar
|
||||
RANLIB = $(CROSS)ranlib
|
||||
INSTALL = install
|
||||
INSTALL_OPTS = -m 644
|
||||
INSTALL_OPTS_LIB = -m 644
|
||||
INSTALL_DIR_OPTS = -m 755
|
||||
|
||||
# Options
|
||||
EXTENSION=.cpp
|
||||
|
||||
ifeq (yes,$(DEBUG))
|
||||
DEBUGFLAGS=-g -DDEBUG
|
||||
endif
|
||||
|
||||
ifeq (Darwin,$(shell uname -s))
|
||||
link=static
|
||||
else
|
||||
link=both
|
||||
endif
|
||||
|
||||
targets_both = staticlib sharedlib
|
||||
targets_shared = sharedlib
|
||||
targets_static = staticlib
|
||||
|
||||
CWD=$(shell pwd)
|
||||
|
||||
SRC_DIR=$(CWD)/../../src/
|
||||
INCLUDE_DIR=$(CWD)/../../ebml
|
||||
|
||||
# Libraries
|
||||
INCLUDE=-I$(CWD)/../..
|
||||
LIBS=
|
||||
|
||||
# Names
|
||||
LIBRARY=libebml.a
|
||||
LIBRARY_SO=libebml.so
|
||||
LIBRARY_SO_VER=libebml.so.4
|
||||
|
||||
# source-files
|
||||
sources:=$(wildcard ${SRC_DIR}*$(EXTENSION))
|
||||
|
||||
# header files; replace .cxx extension with .h
|
||||
headers:=$(patsubst %$(EXTENSION),%.h,$(sources))
|
||||
|
||||
# object files; replace .cxx extension with .o
|
||||
objects:=$(patsubst %$(EXTENSION),%.o,$(sources))
|
||||
objects_so:=$(patsubst %$(EXTENSION),%.lo,$(sources))
|
||||
|
||||
WARNINGFLAGS=-Wall -Wextra -Wno-unknown-pragmas -Wshadow
|
||||
COMPILEFLAGS=$(WARNINGFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(DEBUGFLAGS) $(INCLUDE)
|
||||
DEPENDFLAGS = $(CXXFLAGS) $(INCLUDE)
|
||||
|
||||
all: $(targets_$(link))
|
||||
|
||||
staticlib: $(LIBRARY)
|
||||
|
||||
sharedlib: $(LIBRARY_SO)
|
||||
|
||||
lib:
|
||||
@echo "Use the 'staticlib', 'sharedlib' or 'all' targets."
|
||||
@false
|
||||
|
||||
# Build rules
|
||||
%.o: %$(EXTENSION)
|
||||
$(CXX) -c $(COMPILEFLAGS) -o $@ $<
|
||||
|
||||
%.lo: %$(EXTENSION)
|
||||
$(CXX) -c $(COMPILEFLAGS) -fPIC -o $@ $<
|
||||
|
||||
$(LIBRARY): $(objects)
|
||||
$(AR) rcvu $@ $(objects)
|
||||
$(RANLIB) $@
|
||||
|
||||
$(LIBRARY_SO): $(objects_so)
|
||||
$(CXX) -shared -Wl,-soname,$(LIBRARY_SO_VER) -o $(LIBRARY_SO_VER) $(objects_so)
|
||||
rm -f $(LIBRARY_SO)
|
||||
ln -s $(LIBRARY_SO_VER) $(LIBRARY_SO)
|
||||
|
||||
clean:
|
||||
rm -f $(objects) $(objects_so)
|
||||
rm -f $(LIBRARY)
|
||||
rm -f $(LIBRARY_SO)
|
||||
rm -f $(LIBRARY_SO_VER)
|
||||
rm -f CORE
|
||||
|
||||
distclean dist-clean: clean
|
||||
rm -f .depend
|
||||
|
||||
depend:
|
||||
@echo Calculating dependecies:
|
||||
@rm -f .depend
|
||||
@touch .depend
|
||||
@for i in $(sources); do \
|
||||
o="`echo $$i | sed -e 's/\.c$$/.o/' -e 's/\.cpp$$/.o/'`" ; \
|
||||
echo ' ' $$i: $$o ; \
|
||||
$(CXX) $(DEPENDFLAGS) -MM -MT $$o $$i >> .depend ; \
|
||||
done
|
||||
|
||||
install: $(targets_$(link):%=install_%) install_headers
|
||||
|
||||
install_headers:
|
||||
$(INSTALL) $(INSTALL_DIR_OPTS) -d $(DESTDIR)$(includedir)
|
||||
for i in $(INCLUDE_DIR)/*.h; do \
|
||||
$(INSTALL) $(INSTALL_OPTS) $$i $(DESTDIR)$(includedir) ; \
|
||||
done
|
||||
$(INSTALL) $(INSTALL_DIR_OPTS) -d $(DESTDIR)$(includedir)/c
|
||||
for i in $(INCLUDE_DIR)/c/*.h; do \
|
||||
$(INSTALL) $(INSTALL_OPTS) $$i $(DESTDIR)$(includedir)/c ; \
|
||||
done
|
||||
|
||||
install_staticlib: $(LIBRARY)
|
||||
$(INSTALL) $(INSTALL_DIR_OPTS) -d $(DESTDIR)$(libdir)
|
||||
$(INSTALL) $(INSTALL_OPTS_LIB) $(LIBRARY) $(DESTDIR)$(libdir)
|
||||
|
||||
install_sharedlib: $(LIBRARY_SO)
|
||||
$(INSTALL) $(INSTALL_DIR_OPTS) -d $(DESTDIR)$(libdir)
|
||||
$(INSTALL) $(INSTALL_OPTS_LIB) $(LIBRARY_SO_VER) $(DESTDIR)$(libdir)
|
||||
ln -fs $(LIBRARY_SO_VER) $(DESTDIR)$(libdir)/$(LIBRARY_SO)
|
||||
|
||||
|
||||
ifneq ($(wildcard .depend),)
|
||||
include .depend
|
||||
endif
|
||||
|
||||
# DO NOT DELETE
|
||||
|
||||
|
@ -1,57 +1,57 @@
|
||||
/****************************************************************************
|
||||
** libebml : parse EBML files, see http://embl.sourceforge.net/
|
||||
**
|
||||
** <file/class description>
|
||||
**
|
||||
** Copyright (C) 2002-2010 Steve Lhomme. All rights reserved.
|
||||
**
|
||||
** This file is part of libebml.
|
||||
**
|
||||
** This library is free software; you can redistribute it and/or
|
||||
** modify it under the terms of the GNU Lesser General Public
|
||||
** License as published by the Free Software Foundation; either
|
||||
** version 2.1 of the License, or (at your option) any later version.
|
||||
**
|
||||
** This library is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
** Lesser General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU Lesser General Public
|
||||
** License along with this library; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
**
|
||||
** See http://www.matroska.org/license/lgpl/ for LGPL licensing information.
|
||||
**
|
||||
** Contact license@matroska.org if any conditions of this licensing are
|
||||
** not clear to you.
|
||||
**
|
||||
**********************************************************************/
|
||||
|
||||
/*!
|
||||
\file
|
||||
\version \$Id: EbmlContexts.cpp 639 2004-07-09 20:59:14Z mosu $
|
||||
\author Steve Lhomme <robux4 @ users.sf.net>
|
||||
*/
|
||||
#include "ebml/EbmlContexts.h"
|
||||
#include "ebml/EbmlCrc32.h"
|
||||
#include "ebml/EbmlVoid.h"
|
||||
|
||||
START_LIBEBML_NAMESPACE
|
||||
|
||||
static const EbmlSemantic EbmlGlobal_ContextList[2] =
|
||||
{
|
||||
EbmlSemantic(false, false, EBML_INFO(EbmlCrc32)), ///< EbmlCrc32
|
||||
EbmlSemantic(false, false, EBML_INFO(EbmlVoid)), ///< EbmlVoid
|
||||
};
|
||||
|
||||
const EbmlSemanticContext Context_EbmlGlobal = EbmlSemanticContext(0, NULL, NULL, *GetEbmlGlobal_Context, NULL);
|
||||
|
||||
static const EbmlSemanticContext EbmlGlobal_Context = EbmlSemanticContext(countof(EbmlGlobal_ContextList), EbmlGlobal_ContextList, NULL, *GetEbmlGlobal_Context, NULL);
|
||||
|
||||
const EbmlSemanticContext & GetEbmlGlobal_Context()
|
||||
{
|
||||
return EbmlGlobal_Context;
|
||||
}
|
||||
|
||||
END_LIBEBML_NAMESPACE
|
||||
/****************************************************************************
|
||||
** libebml : parse EBML files, see http://embl.sourceforge.net/
|
||||
**
|
||||
** <file/class description>
|
||||
**
|
||||
** Copyright (C) 2002-2010 Steve Lhomme. All rights reserved.
|
||||
**
|
||||
** This file is part of libebml.
|
||||
**
|
||||
** This library is free software; you can redistribute it and/or
|
||||
** modify it under the terms of the GNU Lesser General Public
|
||||
** License as published by the Free Software Foundation; either
|
||||
** version 2.1 of the License, or (at your option) any later version.
|
||||
**
|
||||
** This library is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
** Lesser General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU Lesser General Public
|
||||
** License along with this library; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
**
|
||||
** See http://www.matroska.org/license/lgpl/ for LGPL licensing information.
|
||||
**
|
||||
** Contact license@matroska.org if any conditions of this licensing are
|
||||
** not clear to you.
|
||||
**
|
||||
**********************************************************************/
|
||||
|
||||
/*!
|
||||
\file
|
||||
\version \$Id: EbmlContexts.cpp 639 2004-07-09 20:59:14Z mosu $
|
||||
\author Steve Lhomme <robux4 @ users.sf.net>
|
||||
*/
|
||||
#include "ebml/EbmlContexts.h"
|
||||
#include "ebml/EbmlCrc32.h"
|
||||
#include "ebml/EbmlVoid.h"
|
||||
|
||||
START_LIBEBML_NAMESPACE
|
||||
|
||||
static const EbmlSemantic EbmlGlobal_ContextList[2] =
|
||||
{
|
||||
EbmlSemantic(false, false, EBML_INFO(EbmlCrc32)), ///< EbmlCrc32
|
||||
EbmlSemantic(false, false, EBML_INFO(EbmlVoid)), ///< EbmlVoid
|
||||
};
|
||||
|
||||
const EbmlSemanticContext Context_EbmlGlobal = EbmlSemanticContext(0, NULL, NULL, *GetEbmlGlobal_Context, NULL);
|
||||
|
||||
static const EbmlSemanticContext EbmlGlobal_Context = EbmlSemanticContext(countof(EbmlGlobal_ContextList), EbmlGlobal_ContextList, NULL, *GetEbmlGlobal_Context, NULL);
|
||||
|
||||
const EbmlSemanticContext & GetEbmlGlobal_Context()
|
||||
{
|
||||
return EbmlGlobal_Context;
|
||||
}
|
||||
|
||||
END_LIBEBML_NAMESPACE
|
||||
|
116
src/EbmlHead.cpp
116
src/EbmlHead.cpp
@ -1,58 +1,58 @@
|
||||
/****************************************************************************
|
||||
** libebml : parse EBML files, see http://embl.sourceforge.net/
|
||||
**
|
||||
** <file/class description>
|
||||
**
|
||||
** Copyright (C) 2002-2010 Steve Lhomme. All rights reserved.
|
||||
**
|
||||
** This file is part of libebml.
|
||||
**
|
||||
** This library is free software; you can redistribute it and/or
|
||||
** modify it under the terms of the GNU Lesser General Public
|
||||
** License as published by the Free Software Foundation; either
|
||||
** version 2.1 of the License, or (at your option) any later version.
|
||||
**
|
||||
** This library is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
** Lesser General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU Lesser General Public
|
||||
** License along with this library; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
**
|
||||
** See http://www.matroska.org/license/lgpl/ for LGPL licensing information.
|
||||
**
|
||||
** Contact license@matroska.org if any conditions of this licensing are
|
||||
** not clear to you.
|
||||
**
|
||||
**********************************************************************/
|
||||
|
||||
/*!
|
||||
\file
|
||||
\version \$Id: EbmlHead.cpp 1096 2005-03-17 09:14:52Z robux4 $
|
||||
\author Steve Lhomme <robux4 @ users.sf.net>
|
||||
*/
|
||||
#include "ebml/EbmlHead.h"
|
||||
#include "ebml/EbmlSubHead.h"
|
||||
#include "ebml/EbmlContexts.h"
|
||||
|
||||
START_LIBEBML_NAMESPACE
|
||||
|
||||
DEFINE_START_SEMANTIC(EbmlHead)
|
||||
DEFINE_SEMANTIC_ITEM(true, true, EVersion) ///< EBMLVersion
|
||||
DEFINE_SEMANTIC_ITEM(true, true, EReadVersion) ///< EBMLReadVersion
|
||||
DEFINE_SEMANTIC_ITEM(true, true, EMaxIdLength) ///< EBMLMaxIdLength
|
||||
DEFINE_SEMANTIC_ITEM(true, true, EMaxSizeLength) ///< EBMLMaxSizeLength
|
||||
DEFINE_SEMANTIC_ITEM(true, true, EDocType) ///< DocType
|
||||
DEFINE_SEMANTIC_ITEM(true, true, EDocTypeVersion) ///< DocTypeVersion
|
||||
DEFINE_SEMANTIC_ITEM(true, true, EDocTypeReadVersion) ///< DocTypeReadVersion
|
||||
DEFINE_END_SEMANTIC(EbmlHead)
|
||||
|
||||
DEFINE_EBML_MASTER_ORPHAN(EbmlHead, 0x1A45DFA3, 4, "EBMLHead\0ratamapaga");
|
||||
|
||||
EbmlHead::EbmlHead()
|
||||
:EbmlMaster(EbmlHead_Context)
|
||||
{}
|
||||
|
||||
END_LIBEBML_NAMESPACE
|
||||
/****************************************************************************
|
||||
** libebml : parse EBML files, see http://embl.sourceforge.net/
|
||||
**
|
||||
** <file/class description>
|
||||
**
|
||||
** Copyright (C) 2002-2010 Steve Lhomme. All rights reserved.
|
||||
**
|
||||
** This file is part of libebml.
|
||||
**
|
||||
** This library is free software; you can redistribute it and/or
|
||||
** modify it under the terms of the GNU Lesser General Public
|
||||
** License as published by the Free Software Foundation; either
|
||||
** version 2.1 of the License, or (at your option) any later version.
|
||||
**
|
||||
** This library is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
** Lesser General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU Lesser General Public
|
||||
** License along with this library; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
**
|
||||
** See http://www.matroska.org/license/lgpl/ for LGPL licensing information.
|
||||
**
|
||||
** Contact license@matroska.org if any conditions of this licensing are
|
||||
** not clear to you.
|
||||
**
|
||||
**********************************************************************/
|
||||
|
||||
/*!
|
||||
\file
|
||||
\version \$Id: EbmlHead.cpp 1096 2005-03-17 09:14:52Z robux4 $
|
||||
\author Steve Lhomme <robux4 @ users.sf.net>
|
||||
*/
|
||||
#include "ebml/EbmlHead.h"
|
||||
#include "ebml/EbmlSubHead.h"
|
||||
#include "ebml/EbmlContexts.h"
|
||||
|
||||
START_LIBEBML_NAMESPACE
|
||||
|
||||
DEFINE_START_SEMANTIC(EbmlHead)
|
||||
DEFINE_SEMANTIC_ITEM(true, true, EVersion) ///< EBMLVersion
|
||||
DEFINE_SEMANTIC_ITEM(true, true, EReadVersion) ///< EBMLReadVersion
|
||||
DEFINE_SEMANTIC_ITEM(true, true, EMaxIdLength) ///< EBMLMaxIdLength
|
||||
DEFINE_SEMANTIC_ITEM(true, true, EMaxSizeLength) ///< EBMLMaxSizeLength
|
||||
DEFINE_SEMANTIC_ITEM(true, true, EDocType) ///< DocType
|
||||
DEFINE_SEMANTIC_ITEM(true, true, EDocTypeVersion) ///< DocTypeVersion
|
||||
DEFINE_SEMANTIC_ITEM(true, true, EDocTypeReadVersion) ///< DocTypeReadVersion
|
||||
DEFINE_END_SEMANTIC(EbmlHead)
|
||||
|
||||
DEFINE_EBML_MASTER_ORPHAN(EbmlHead, 0x1A45DFA3, 4, "EBMLHead\0ratamapaga");
|
||||
|
||||
EbmlHead::EbmlHead()
|
||||
:EbmlMaster(EbmlHead_Context)
|
||||
{}
|
||||
|
||||
END_LIBEBML_NAMESPACE
|
||||
|
@ -1,49 +1,49 @@
|
||||
/****************************************************************************
|
||||
** libebml : parse EBML files, see http://embl.sourceforge.net/
|
||||
**
|
||||
** <file/class description>
|
||||
**
|
||||
** Copyright (C) 2002-2010 Steve Lhomme. All rights reserved.
|
||||
**
|
||||
** This file is part of libebml.
|
||||
**
|
||||
** This library is free software; you can redistribute it and/or
|
||||
** modify it under the terms of the GNU Lesser General Public
|
||||
** License as published by the Free Software Foundation; either
|
||||
** version 2.1 of the License, or (at your option) any later version.
|
||||
**
|
||||
** This library is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
** Lesser General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU Lesser General Public
|
||||
** License along with this library; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
**
|
||||
** See http://www.matroska.org/license/lgpl/ for LGPL licensing information.
|
||||
**
|
||||
** Contact license@matroska.org if any conditions of this licensing are
|
||||
** not clear to you.
|
||||
**
|
||||
**********************************************************************/
|
||||
|
||||
/*!
|
||||
\file
|
||||
\version \$Id: EbmlSubHead.cpp 639 2004-07-09 20:59:14Z mosu $
|
||||
\author Steve Lhomme <robux4 @ users.sf.net>
|
||||
*/
|
||||
#include "ebml/EbmlSubHead.h"
|
||||
#include "ebml/EbmlContexts.h"
|
||||
|
||||
START_LIBEBML_NAMESPACE
|
||||
|
||||
DEFINE_EBML_UINTEGER_DEF(EVersion, 0x4286, 2, EbmlHead, "EBMLVersion", 1);
|
||||
DEFINE_EBML_UINTEGER_DEF(EReadVersion, 0x42F7, 2, EbmlHead, "EBMLReadVersion", 1);
|
||||
DEFINE_EBML_UINTEGER_DEF(EMaxIdLength, 0x42F2, 2, EbmlHead, "EBMLMaxIdLength", 4);
|
||||
DEFINE_EBML_UINTEGER_DEF(EMaxSizeLength, 0x42F3, 2, EbmlHead, "EBMLMaxSizeLength", 8);
|
||||
DEFINE_EBML_STRING_DEF (EDocType, 0x4282, 2, EbmlHead, "EBMLDocType", "matroska");
|
||||
DEFINE_EBML_UINTEGER_DEF(EDocTypeVersion, 0x4287, 2, EbmlHead, "EBMLDocTypeVersion", 1);
|
||||
DEFINE_EBML_UINTEGER_DEF(EDocTypeReadVersion, 0x4285, 2, EbmlHead, "EBMLDocTypeReadVersion", 1);
|
||||
|
||||
END_LIBEBML_NAMESPACE
|
||||
/****************************************************************************
|
||||
** libebml : parse EBML files, see http://embl.sourceforge.net/
|
||||
**
|
||||
** <file/class description>
|
||||
**
|
||||
** Copyright (C) 2002-2010 Steve Lhomme. All rights reserved.
|
||||
**
|
||||
** This file is part of libebml.
|
||||
**
|
||||
** This library is free software; you can redistribute it and/or
|
||||
** modify it under the terms of the GNU Lesser General Public
|
||||
** License as published by the Free Software Foundation; either
|
||||
** version 2.1 of the License, or (at your option) any later version.
|
||||
**
|
||||
** This library is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
** Lesser General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU Lesser General Public
|
||||
** License along with this library; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
**
|
||||
** See http://www.matroska.org/license/lgpl/ for LGPL licensing information.
|
||||
**
|
||||
** Contact license@matroska.org if any conditions of this licensing are
|
||||
** not clear to you.
|
||||
**
|
||||
**********************************************************************/
|
||||
|
||||
/*!
|
||||
\file
|
||||
\version \$Id: EbmlSubHead.cpp 639 2004-07-09 20:59:14Z mosu $
|
||||
\author Steve Lhomme <robux4 @ users.sf.net>
|
||||
*/
|
||||
#include "ebml/EbmlSubHead.h"
|
||||
#include "ebml/EbmlContexts.h"
|
||||
|
||||
START_LIBEBML_NAMESPACE
|
||||
|
||||
DEFINE_EBML_UINTEGER_DEF(EVersion, 0x4286, 2, EbmlHead, "EBMLVersion", 1);
|
||||
DEFINE_EBML_UINTEGER_DEF(EReadVersion, 0x42F7, 2, EbmlHead, "EBMLReadVersion", 1);
|
||||
DEFINE_EBML_UINTEGER_DEF(EMaxIdLength, 0x42F2, 2, EbmlHead, "EBMLMaxIdLength", 4);
|
||||
DEFINE_EBML_UINTEGER_DEF(EMaxSizeLength, 0x42F3, 2, EbmlHead, "EBMLMaxSizeLength", 8);
|
||||
DEFINE_EBML_STRING_DEF (EDocType, 0x4282, 2, EbmlHead, "EBMLDocType", "matroska");
|
||||
DEFINE_EBML_UINTEGER_DEF(EDocTypeVersion, 0x4287, 2, EbmlHead, "EBMLDocTypeVersion", 1);
|
||||
DEFINE_EBML_UINTEGER_DEF(EDocTypeReadVersion, 0x4285, 2, EbmlHead, "EBMLDocTypeReadVersion", 1);
|
||||
|
||||
END_LIBEBML_NAMESPACE
|
||||
|
Loading…
Reference in New Issue
Block a user