Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't force libebml namespace in public headers #141

Merged
merged 3 commits into from
Dec 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions matroska/FileKax.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
//#include "Cluster.h"
//#include "CodecHeader.h"

using namespace libebml;

namespace libmatroska {

//class Track;
Expand All @@ -33,9 +31,9 @@ namespace libmatroska {
*/
class MATROSKA_DLL_API FileMatroska {
public:
FileMatroska(IOCallback & output);
FileMatroska(libebml::IOCallback & output);
~FileMatroska() = default;
IOCallback & myFile;
libebml::IOCallback & myFile;

};

Expand Down
42 changes: 20 additions & 22 deletions matroska/KaxBlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
#include "matroska/KaxTracks.h"
#include "matroska/KaxDefines.h"

using namespace libebml;

namespace libmatroska {

class KaxCluster;
Expand All @@ -29,22 +27,22 @@ class KaxBlockBlob;

class MATROSKA_DLL_API DataBuffer {
protected:
binary *myBuffer{nullptr};
libebml::binary *myBuffer{nullptr};
std::uint32_t mySize;
bool bValidValue{true};
bool (*myFreeBuffer)(const DataBuffer & aBuffer); // method to free the internal buffer
bool bInternalBuffer;

public:
DataBuffer(binary * aBuffer, std::uint32_t aSize, bool (*aFreeBuffer)(const DataBuffer & aBuffer) = nullptr, bool _bInternalBuffer = false)
DataBuffer(libebml::binary * aBuffer, std::uint32_t aSize, bool (*aFreeBuffer)(const DataBuffer & aBuffer) = nullptr, bool _bInternalBuffer = false)
:mySize(aSize)
,myFreeBuffer(aFreeBuffer)
,bInternalBuffer(_bInternalBuffer)
{
if (bInternalBuffer)
{
try {
myBuffer = new binary[mySize];
myBuffer = new libebml::binary[mySize];
memcpy(myBuffer, aBuffer, mySize);
} catch (const std::bad_alloc &) {
bValidValue = false;
Expand All @@ -55,9 +53,9 @@ class MATROSKA_DLL_API DataBuffer {
}

virtual ~DataBuffer() = default;
virtual binary * Buffer() {assert(bValidValue); return myBuffer;}
virtual libebml::binary * Buffer() {assert(bValidValue); return myBuffer;}
virtual std::uint32_t & Size() {return mySize;};
virtual const binary * Buffer() const {assert(bValidValue); return myBuffer;}
virtual const libebml::binary * Buffer() const {assert(bValidValue); return myBuffer;}
virtual std::uint32_t Size() const {return mySize;};
bool FreeBuffer(const DataBuffer & aBuffer) {
bool bResult = true;
Expand All @@ -78,7 +76,7 @@ class MATROSKA_DLL_API DataBuffer {

class MATROSKA_DLL_API SimpleDataBuffer : public DataBuffer {
public:
SimpleDataBuffer(binary * aBuffer, std::uint32_t aSize, std::uint32_t aOffset, bool (*aFreeBuffer)(const DataBuffer & aBuffer) = myFreeBuffer)
SimpleDataBuffer(libebml::binary * aBuffer, std::uint32_t aSize, std::uint32_t aOffset, bool (*aFreeBuffer)(const DataBuffer & aBuffer) = myFreeBuffer)
:DataBuffer(aBuffer + aOffset, aSize, aFreeBuffer)
,Offset(aOffset)
,BaseBuffer(aBuffer)
Expand All @@ -89,7 +87,7 @@ class MATROSKA_DLL_API SimpleDataBuffer : public DataBuffer {

protected:
std::uint32_t Offset;
binary * BaseBuffer;
libebml::binary * BaseBuffer;

static bool myFreeBuffer(const DataBuffer & aBuffer)
{
Expand All @@ -107,8 +105,8 @@ class MATROSKA_DLL_API SimpleDataBuffer : public DataBuffer {
* /
class MATROSKA_DLL_API NotSoSimpleDataBuffer : public SimpleDataBuffer {
public:
NotSoSimpleDataBuffer(binary * aBuffer, std::uint32_t aSize, std::uint32_t aOffset)
:SimpleDataBuffer(new binary[aSize - aOffset], aSize, 0)
NotSoSimpleDataBuffer(libebml::binary * aBuffer, std::uint32_t aSize, std::uint32_t aOffset)
:SimpleDataBuffer(new libebml::binary[aSize - aOffset], aSize, 0)
{
memcpy(BaseBuffer, aBuffer + aOffset, aSize - aOffset);
}
Expand Down Expand Up @@ -179,10 +177,10 @@ DECLARE_MKX_MASTER(KaxBlockGroup)
const KaxTrackEntry * ParentTrack{nullptr};
};

class MATROSKA_DLL_API KaxInternalBlock : public EbmlBinary {
class MATROSKA_DLL_API KaxInternalBlock : public libebml::EbmlBinary {
public:
KaxInternalBlock(const EbmlCallbacks & classInfo, bool bSimple)
:EbmlBinary(classInfo),
KaxInternalBlock(const libebml::EbmlCallbacks & classInfo, bool bSimple)
:libebml::EbmlBinary(classInfo),
bIsSimple(bSimple)
{}
KaxInternalBlock(const KaxInternalBlock & ElementToClone);
Expand All @@ -198,14 +196,14 @@ class MATROSKA_DLL_API KaxInternalBlock : public EbmlBinary {
/*!
\note override this function to generate the Data/Size on the fly, unlike the usual binary elements
*/
filepos_t UpdateSize(ShouldWrite writeFilter = WriteSkipDefault, bool bForceRender = false) override;
filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA) override;
libebml::filepos_t UpdateSize(ShouldWrite writeFilter = WriteSkipDefault, bool bForceRender = false) override;
libebml::filepos_t ReadData(libebml::IOCallback & input, libebml::ScopeMode ReadFully = libebml::SCOPE_ALL_DATA) override;

/*!
\brief Only read the head of the Block (not internal data)
\note convenient when you are parsing the file quickly
*/
std::uint64_t ReadInternalHead(IOCallback & input);
std::uint64_t ReadInternalHead(libebml::IOCallback & input);

unsigned int NumberFrames() const { return SizeList.size();}
DataBuffer & GetBuffer(unsigned int iIndex) {return *myBuffers[iIndex];}
Expand Down Expand Up @@ -264,7 +262,7 @@ class MATROSKA_DLL_API KaxInternalBlock : public EbmlBinary {
bool bIsKeyframe{true};
bool bIsDiscardable{false};

filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter = WriteSkipDefault) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter = WriteSkipDefault) override;
};

class MATROSKA_DLL_API KaxBlock : public KaxInternalBlock {
Expand Down Expand Up @@ -334,18 +332,18 @@ DECLARE_MKX_BINARY_CONS(KaxBlockVirtual)
/*!
\note override this function to generate the Data/Size on the fly, unlike the usual binary elements
*/
filepos_t UpdateSize(ShouldWrite writeFilter = WriteSkipDefault, bool bForceRender = false) override;
libebml::filepos_t UpdateSize(ShouldWrite writeFilter = WriteSkipDefault, bool bForceRender = false) override;

void SetParent(const KaxCluster & aParentCluster) {ParentCluster = &aParentCluster;}

filepos_t RenderData(IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;
libebml::filepos_t RenderData(libebml::IOCallback & output, bool bForceRender, ShouldWrite writeFilter) override;

filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA) override;
libebml::filepos_t ReadData(libebml::IOCallback & input, libebml::ScopeMode ReadFully = libebml::SCOPE_ALL_DATA) override;

protected:
std::uint64_t Timecode; // temporary timecode of the first frame if there are more than one
std::uint16_t TrackNumber;
binary DataBlock[5];
libebml::binary DataBlock[5];

const KaxCluster * ParentCluster{nullptr};
};
Expand Down
4 changes: 1 addition & 3 deletions matroska/KaxBlockData.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
#include "matroska/KaxDefines.h"
#include "matroska/KaxBlock.h"

using namespace libebml;

namespace libmatroska {

/*!
Expand All @@ -28,7 +26,7 @@ DECLARE_MKX_SINTEGER_CONS(KaxReferenceBlock)
/*!
\brief override this method to compute the timecode value
*/
filepos_t UpdateSize(ShouldWrite writeFilter = WriteSkipDefault, bool bForceRender = false) override;
libebml::filepos_t UpdateSize(ShouldWrite writeFilter = WriteSkipDefault, bool bForceRender = false) override;

const KaxBlockBlob & RefBlock() const;
void SetReferencedBlock(const KaxBlockBlob * aRefdBlock);
Expand Down
4 changes: 1 addition & 3 deletions matroska/KaxCluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
#include "matroska/KaxCues.h"
#include "matroska/KaxDefines.h"

using namespace libebml;

namespace libmatroska {

class KaxSegment;
Expand Down Expand Up @@ -48,7 +46,7 @@ DECLARE_MKX_MASTER_CONS(KaxCluster)
/*!
\brief Render the data to the stream and retrieve the position of BlockGroups for later cue entries
*/
filepos_t Render(IOCallback & output, KaxCues & CueToUpdate, ShouldWrite writeFilter = WriteSkipDefault);
libebml::filepos_t Render(libebml::IOCallback & output, KaxCues & CueToUpdate, ShouldWrite writeFilter = WriteSkipDefault);

/*!
\return the global timecode of this Cluster
Expand Down
78 changes: 38 additions & 40 deletions matroska/KaxContexts.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,48 +11,46 @@
#include "matroska/KaxTypes.h"
#include <ebml/EbmlElement.h>

using namespace libebml;

namespace libmatroska {

extern const EbmlSemanticContext MATROSKA_DLL_API Context_KaxMatroska;
extern const EbmlSemanticContext MATROSKA_DLL_API Context_KaxSegment;
extern const EbmlSemanticContext MATROSKA_DLL_API Context_KaxAttachments;
extern const EbmlSemanticContext MATROSKA_DLL_API Context_KaxAttached;
extern const EbmlSemanticContext MATROSKA_DLL_API Context_KaxFileDescription;
extern const EbmlSemanticContext MATROSKA_DLL_API Context_KaxFileName;
extern const EbmlSemanticContext MATROSKA_DLL_API Context_KaxMimeType;
extern const EbmlSemanticContext MATROSKA_DLL_API Context_KaxFileData;
extern const EbmlSemanticContext MATROSKA_DLL_API Context_KaxChapters;
extern const EbmlSemanticContext MATROSKA_DLL_API Context_KaxCluster;
extern const EbmlSemanticContext MATROSKA_DLL_API Context_KaxTags;
extern const EbmlSemanticContext MATROSKA_DLL_API Context_KaxTag;
extern const EbmlSemanticContext MATROSKA_DLL_API Context_KaxBlockGroup;
extern const EbmlSemanticContext MATROSKA_DLL_API Context_KaxReferencePriority;
extern const EbmlSemanticContext MATROSKA_DLL_API Context_KaxReferenceBlock;
extern const EbmlSemanticContext MATROSKA_DLL_API Context_KaxReferenceVirtual;
extern const EbmlSemanticContext MATROSKA_DLL_API Context_KaxCues;
extern const EbmlSemanticContext MATROSKA_DLL_API Context_KaxInfo;
extern const EbmlSemanticContext MATROSKA_DLL_API Context_KaxSeekHead;
extern const EbmlSemanticContext MATROSKA_DLL_API Context_KaxTracks;
extern const EbmlSemanticContext MATROSKA_DLL_API Context_KaxTrackEntry;
extern const EbmlSemanticContext MATROSKA_DLL_API Context_KaxTrackNumber;
extern const EbmlSemanticContext MATROSKA_DLL_API Context_KaxTrackType;
extern const EbmlSemanticContext MATROSKA_DLL_API Context_KaxTrackFlagEnabled;
extern const EbmlSemanticContext MATROSKA_DLL_API Context_KaxTrackFlagDefault;
extern const EbmlSemanticContext MATROSKA_DLL_API Context_KaxTrackFlagLacing;
extern const EbmlSemanticContext MATROSKA_DLL_API Context_KaxTrackName;
extern const EbmlSemanticContext MATROSKA_DLL_API Context_KaxTrackLanguage;
extern const EbmlSemanticContext MATROSKA_DLL_API Context_KaxCodecID;
extern const EbmlSemanticContext MATROSKA_DLL_API Context_KaxCodecPrivate;
extern const EbmlSemanticContext MATROSKA_DLL_API Context_KaxCodecName;
extern const EbmlSemanticContext MATROSKA_DLL_API Context_KaxCodecSettings;
extern const EbmlSemanticContext MATROSKA_DLL_API Context_KaxCodecInfoURL;
extern const EbmlSemanticContext MATROSKA_DLL_API Context_KaxCodecDownloadURL;
extern const EbmlSemanticContext MATROSKA_DLL_API Context_KaxCodecDecodeAll;
extern const EbmlSemanticContext MATROSKA_DLL_API Context_KaxTrackOverlay;

extern MATROSKA_DLL_API const EbmlSemanticContext & GetKaxGlobal_Context();
extern const libebml::EbmlSemanticContext MATROSKA_DLL_API Context_KaxMatroska;
extern const libebml::EbmlSemanticContext MATROSKA_DLL_API Context_KaxSegment;
extern const libebml::EbmlSemanticContext MATROSKA_DLL_API Context_KaxAttachments;
extern const libebml::EbmlSemanticContext MATROSKA_DLL_API Context_KaxAttached;
extern const libebml::EbmlSemanticContext MATROSKA_DLL_API Context_KaxFileDescription;
extern const libebml::EbmlSemanticContext MATROSKA_DLL_API Context_KaxFileName;
extern const libebml::EbmlSemanticContext MATROSKA_DLL_API Context_KaxMimeType;
extern const libebml::EbmlSemanticContext MATROSKA_DLL_API Context_KaxFileData;
extern const libebml::EbmlSemanticContext MATROSKA_DLL_API Context_KaxChapters;
extern const libebml::EbmlSemanticContext MATROSKA_DLL_API Context_KaxCluster;
extern const libebml::EbmlSemanticContext MATROSKA_DLL_API Context_KaxTags;
extern const libebml::EbmlSemanticContext MATROSKA_DLL_API Context_KaxTag;
extern const libebml::EbmlSemanticContext MATROSKA_DLL_API Context_KaxBlockGroup;
extern const libebml::EbmlSemanticContext MATROSKA_DLL_API Context_KaxReferencePriority;
extern const libebml::EbmlSemanticContext MATROSKA_DLL_API Context_KaxReferenceBlock;
extern const libebml::EbmlSemanticContext MATROSKA_DLL_API Context_KaxReferenceVirtual;
extern const libebml::EbmlSemanticContext MATROSKA_DLL_API Context_KaxCues;
extern const libebml::EbmlSemanticContext MATROSKA_DLL_API Context_KaxInfo;
extern const libebml::EbmlSemanticContext MATROSKA_DLL_API Context_KaxSeekHead;
extern const libebml::EbmlSemanticContext MATROSKA_DLL_API Context_KaxTracks;
extern const libebml::EbmlSemanticContext MATROSKA_DLL_API Context_KaxTrackEntry;
extern const libebml::EbmlSemanticContext MATROSKA_DLL_API Context_KaxTrackNumber;
extern const libebml::EbmlSemanticContext MATROSKA_DLL_API Context_KaxTrackType;
extern const libebml::EbmlSemanticContext MATROSKA_DLL_API Context_KaxTrackFlagEnabled;
extern const libebml::EbmlSemanticContext MATROSKA_DLL_API Context_KaxTrackFlagDefault;
extern const libebml::EbmlSemanticContext MATROSKA_DLL_API Context_KaxTrackFlagLacing;
extern const libebml::EbmlSemanticContext MATROSKA_DLL_API Context_KaxTrackName;
extern const libebml::EbmlSemanticContext MATROSKA_DLL_API Context_KaxTrackLanguage;
extern const libebml::EbmlSemanticContext MATROSKA_DLL_API Context_KaxCodecID;
extern const libebml::EbmlSemanticContext MATROSKA_DLL_API Context_KaxCodecPrivate;
extern const libebml::EbmlSemanticContext MATROSKA_DLL_API Context_KaxCodecName;
extern const libebml::EbmlSemanticContext MATROSKA_DLL_API Context_KaxCodecSettings;
extern const libebml::EbmlSemanticContext MATROSKA_DLL_API Context_KaxCodecInfoURL;
extern const libebml::EbmlSemanticContext MATROSKA_DLL_API Context_KaxCodecDownloadURL;
extern const libebml::EbmlSemanticContext MATROSKA_DLL_API Context_KaxCodecDecodeAll;
extern const libebml::EbmlSemanticContext MATROSKA_DLL_API Context_KaxTrackOverlay;

extern MATROSKA_DLL_API const libebml::EbmlSemanticContext & GetKaxGlobal_Context();

} // namespace libmatroska

Expand Down
4 changes: 1 addition & 3 deletions matroska/KaxCues.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
#include <ebml/EbmlMaster.h>
#include "matroska/KaxBlock.h"

using namespace libebml;

namespace libmatroska {

class KaxCuePoint;
Expand All @@ -36,7 +34,7 @@ DECLARE_MKX_MASTER(KaxCues)
/*!
\brief override to sort by timecode/track
*/
filepos_t Render(IOCallback & output, ShouldWrite writeFilter = WriteSkipDefault) {
libebml::filepos_t Render(libebml::IOCallback & output, ShouldWrite writeFilter = WriteSkipDefault) {
Sort();
return EbmlMaster::Render(output, writeFilter);
}
Expand Down
2 changes: 0 additions & 2 deletions matroska/KaxCuesData.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
#include <ebml/EbmlMaster.h>
#include "matroska/KaxDefines.h"

using namespace libebml;

namespace libmatroska {

class KaxBlockGroup;
Expand Down
22 changes: 11 additions & 11 deletions matroska/KaxDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,67 +37,67 @@
#define DEFINE_MKX_SINTEGER_CONS(a,b,c,d,e) DEFINE_xxx_CLASS_CONS(a,b,c,d,e,GetKaxGlobal_Context)

#define DECLARE_MKX_MASTER(x) \
class MATROSKA_DLL_API x : public EbmlMaster { \
class MATROSKA_DLL_API x : public libebml::EbmlMaster { \
public: x(); \
x(const x & ElementToClone) :EbmlMaster(ElementToClone) {} \
EBML_CONCRETE_CLASS(x)

#define DECLARE_MKX_MASTER_CONS(x) \
class MATROSKA_DLL_API x : public EbmlMaster { \
class MATROSKA_DLL_API x : public libebml::EbmlMaster { \
public: x(); \
x(const x & ElementToClone); \
EBML_CONCRETE_CLASS(x)

#define DECLARE_MKX_BINARY(x) \
class MATROSKA_DLL_API x : public EbmlBinary { \
class MATROSKA_DLL_API x : public libebml::EbmlBinary { \
public: x(); \
x(const x & ElementToClone) :EbmlBinary(ElementToClone) {} \
EBML_CONCRETE_CLASS(x)

#define DECLARE_MKX_BINARY_CONS(x) \
class MATROSKA_DLL_API x : public EbmlBinary { \
class MATROSKA_DLL_API x : public libebml::EbmlBinary { \
public: x(); \
x(const x & ElementToClone); \
EBML_CONCRETE_CLASS(x)

#define DECLARE_MKX_UNISTRING(x) \
class MATROSKA_DLL_API x : public EbmlUnicodeString { \
class MATROSKA_DLL_API x : public libebml::EbmlUnicodeString { \
public: x(); \
x(const x & ElementToClone) :EbmlUnicodeString(ElementToClone) {} \
EBML_CONCRETE_CLASS(x)

#define DECLARE_MKX_STRING(x) \
class MATROSKA_DLL_API x : public EbmlString { \
class MATROSKA_DLL_API x : public libebml::EbmlString { \
public: x(); \
x(const x & ElementToClone) :EbmlString(ElementToClone) {} \
EBML_CONCRETE_CLASS(x)

#define DECLARE_MKX_UINTEGER(x) \
class MATROSKA_DLL_API x : public EbmlUInteger { \
class MATROSKA_DLL_API x : public libebml::EbmlUInteger { \
public: x(); \
x(const x & ElementToClone) :EbmlUInteger(ElementToClone) {} \
EBML_CONCRETE_CLASS(x)

#define DECLARE_MKX_SINTEGER_CONS(x) \
class MATROSKA_DLL_API x : public EbmlSInteger { \
class MATROSKA_DLL_API x : public libebml::EbmlSInteger { \
public: x(); \
x(const x & ElementToClone); \
EBML_CONCRETE_CLASS(x)

#define DECLARE_MKX_SINTEGER(x) \
class MATROSKA_DLL_API x : public EbmlSInteger { \
class MATROSKA_DLL_API x : public libebml::EbmlSInteger { \
public: x(); \
x(const x & ElementToClone) :EbmlSInteger(ElementToClone) {} \
EBML_CONCRETE_CLASS(x)

#define DECLARE_MKX_DATE(x) \
class MATROSKA_DLL_API x : public EbmlDate { \
class MATROSKA_DLL_API x : public libebml::EbmlDate { \
public: x(); \
x(const x & ElementToClone) :EbmlDate(ElementToClone) {} \
EBML_CONCRETE_CLASS(x)

#define DECLARE_MKX_FLOAT(x) \
class MATROSKA_DLL_API x : public EbmlFloat { \
class MATROSKA_DLL_API x : public libebml::EbmlFloat { \
public: x(); \
x(const x & ElementToClone) :EbmlFloat(ElementToClone) {} \
EBML_CONCRETE_CLASS(x)
Expand Down
Loading