From 8cee3bb157ada0c624cd5a7ffe1e40bfb7daa166 Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Fri, 29 Dec 2023 11:43:16 +0100 Subject: [PATCH 1/4] remove commented export line --- matroska/KaxContexts.h | 1 - 1 file changed, 1 deletion(-) diff --git a/matroska/KaxContexts.h b/matroska/KaxContexts.h index 98b9a4c3..b21b39d6 100644 --- a/matroska/KaxContexts.h +++ b/matroska/KaxContexts.h @@ -69,7 +69,6 @@ extern const EbmlSemanticContext MATROSKA_DLL_API KaxTrackOverlay_Context; #define Context_KaxTagCommercial KaxTagCommercial_Context extern MATROSKA_DLL_API const EbmlSemanticContext & GetKaxGlobal_Context(); -//extern MATROSKA_DLL_API const EbmlSemanticContext & GetKaxTagsGlobal_Context(); } // namespace libmatroska From 433630c8f6a671332c52163656486768e73b5054 Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Fri, 29 Dec 2023 12:04:25 +0100 Subject: [PATCH 2/4] use the EBML_CLASS_SEMCONTEXT() macro to access the semantic context --- test/ebml/test00.cpp | 28 ++++++++++++++-------------- test/mux/test8.cpp | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/test/ebml/test00.cpp b/test/ebml/test00.cpp index c6fb4c2e..edc6791d 100644 --- a/test/ebml/test00.cpp +++ b/test/ebml/test00.cpp @@ -127,7 +127,7 @@ int main(void) } printf("\n"); - ElementLevel0->SkipData(aStream, Context_EbmlHead); + ElementLevel0->SkipData(aStream, EBML_CLASS_SEMCONTEXT(EbmlHead)); if (ElementLevel0 != NULL) delete ElementLevel0; } @@ -145,23 +145,23 @@ int main(void) int bUpperElement = 0; - ElementLevel1 = aStream.FindNextElement(KaxSegment_Context, bUpperElement, 0xFFFFFFFFL, true); + ElementLevel1 = aStream.FindNextElement(EBML_CLASS_SEMCONTEXT(KaxSegment), bUpperElement, 0xFFFFFFFFL, true); while (ElementLevel1 != NULL) { /// \todo switch the type of the element to check if it's one we want to handle, like attachements if (EbmlId(*ElementLevel1) == EBML_ID(KaxAttachments)) { printf("Attachments detected\n"); - ElementLevel2 = aStream.FindNextElement(KaxAttachments_Context, bUpperElement, 0xFFFFFFFFL, true); + ElementLevel2 = aStream.FindNextElement(EBML_CLASS_SEMCONTEXT(KaxAttachments), bUpperElement, 0xFFFFFFFFL, true); while (ElementLevel2 != NULL) { /// \todo switch the type of the element to check if it's one we want to handle, like attachements if (EbmlId(*ElementLevel2) == EBML_ID(KaxAttached)) { printf("Attached file detected\n"); } #ifdef SKIP_ATTACHED - ElementLevel2 = ElementLevel2->SkipData(aStream, KaxAttached_Context); + ElementLevel2 = ElementLevel2->SkipData(aStream, EBML_CLASS_SEMCONTEXT(KaxAttached)); if (ElementLevel2 == NULL) { - ElementLevel2 = aStream.FindNextID(KaxAttachments_Context, bUpperElement, 0xFFFFFFFFL, true); + ElementLevel2 = aStream.FindNextID(EBML_CLASS_SEMCONTEXT(KaxAttachments), bUpperElement, 0xFFFFFFFFL, true); if (bUpperElement) { printf("Upper level1 element found\n"); @@ -172,7 +172,7 @@ int main(void) } #else // SKIP_ATTACHED // Display the filename (if it exists) - ElementLevel3 = aStream.FindNextElement(KaxAttached_Context, bUpperElement, 0xFFFFFFFFL, false); + ElementLevel3 = aStream.FindNextElement(EBML_CLASS_SEMCONTEXT(KaxAttached), bUpperElement, 0xFFFFFFFFL, false); while (ElementLevel3 != NULL) { /// \todo switch the type of the element to check if it's one we want to handle, like attachements if (EbmlId(*ElementLevel3) == EBML_ID(KaxFileName)) { @@ -180,10 +180,10 @@ int main(void) tmp.ReadData(aStream.I_O()); printf("File Name = %s\n", UTFstring(tmp).GetUTF8().c_str()); } else { - ElementLevel3->SkipData(aStream, KaxAttached_Context); + ElementLevel3->SkipData(aStream, EBML_CLASS_SEMCONTEXT(KaxAttached)); } delete ElementLevel3; - ElementLevel3 = aStream.FindNextElement(KaxAttached_Context, bUpperElement, 0xFFFFFFFFL, false); + ElementLevel3 = aStream.FindNextElement(EBML_CLASS_SEMCONTEXT(KaxAttached), bUpperElement, 0xFFFFFFFFL, false); if (bUpperElement) break; } @@ -192,25 +192,25 @@ int main(void) delete ElementLevel2; ElementLevel2 = ElementLevel3; } else { - ElementLevel2->SkipData(aStream, KaxAttached_Context); + ElementLevel2->SkipData(aStream, EBML_CLASS_SEMCONTEXT(KaxAttached)); delete ElementLevel2; - ElementLevel2 = aStream.FindNextElement(KaxAttachments_Context, bUpperElement, 0xFFFFFFFFL, true); + ElementLevel2 = aStream.FindNextElement(EBML_CLASS_SEMCONTEXT(KaxAttachments), bUpperElement, 0xFFFFFFFFL, true); } #endif // SKIP_ATTACHED } } - ElementLevel1->SkipData(aStream, KaxAttachments_Context); + ElementLevel1->SkipData(aStream, EBML_CLASS_SEMCONTEXT(KaxAttachments)); delete ElementLevel1; - ElementLevel1 = aStream.FindNextElement(KaxSegment_Context, bUpperElement, 0xFFFFFFFFL, true); + ElementLevel1 = aStream.FindNextElement(EBML_CLASS_SEMCONTEXT(KaxSegment), bUpperElement, 0xFFFFFFFFL, true); } - ElementLevel0->SkipData(aStream, KaxSegment_Context); + ElementLevel0->SkipData(aStream, EBML_CLASS_SEMCONTEXT(KaxSegment)); if (ElementLevel0 != NULL) delete ElementLevel0; - ElementLevel0 = aStream.FindNextElement(KaxSegment_Context, bUpperElement, 0xFFFFFFFFL, true); + ElementLevel0 = aStream.FindNextElement(EBML_CLASS_SEMCONTEXT(KaxSegment), bUpperElement, 0xFFFFFFFFL, true); } Ebml_Wfile.close(); diff --git a/test/mux/test8.cpp b/test/mux/test8.cpp index 2b2931de..6802fdeb 100644 --- a/test/mux/test8.cpp +++ b/test/mux/test8.cpp @@ -67,7 +67,7 @@ int main(int argc, char **argv) } printf("\n"); - ElementLevel0->SkipData(aStream, Context_EbmlHead); + ElementLevel0->SkipData(aStream, EBML_CLASS_SEMCONTEXT(EbmlHead)); if (ElementLevel0 != NULL) delete ElementLevel0; } From 573ae54f2d3dbcf9e23604688625ba84a18f4afe Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Fri, 29 Dec 2023 12:04:53 +0100 Subject: [PATCH 3/4] export the real names for the EbmlSemanticContext --- matroska/KaxContexts.h | 72 +++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/matroska/KaxContexts.h b/matroska/KaxContexts.h index b21b39d6..88e56672 100644 --- a/matroska/KaxContexts.h +++ b/matroska/KaxContexts.h @@ -15,42 +15,42 @@ using namespace libebml; namespace libmatroska { -extern const EbmlSemanticContext MATROSKA_DLL_API KaxMatroska_Context; -extern const EbmlSemanticContext MATROSKA_DLL_API KaxSegment_Context; -extern const EbmlSemanticContext MATROSKA_DLL_API KaxAttachments_Context; -extern const EbmlSemanticContext MATROSKA_DLL_API KaxAttached_Context; -extern const EbmlSemanticContext MATROSKA_DLL_API KaxFileDescription_Context; -extern const EbmlSemanticContext MATROSKA_DLL_API KaxFileName_Context; -extern const EbmlSemanticContext MATROSKA_DLL_API KaxMimeType_Context; -extern const EbmlSemanticContext MATROSKA_DLL_API KaxFileData_Context; -extern const EbmlSemanticContext MATROSKA_DLL_API KaxChapters_Context; -extern const EbmlSemanticContext MATROSKA_DLL_API KaxCluster_Context; -extern const EbmlSemanticContext MATROSKA_DLL_API KaxTags_Context; -extern const EbmlSemanticContext MATROSKA_DLL_API KaxTag_Context; -extern const EbmlSemanticContext MATROSKA_DLL_API KaxBlockGroup_Context; -extern const EbmlSemanticContext MATROSKA_DLL_API KaxReferencePriority_Context; -extern const EbmlSemanticContext MATROSKA_DLL_API KaxReferenceBlock_Context; -extern const EbmlSemanticContext MATROSKA_DLL_API KaxReferenceVirtual_Context; -extern const EbmlSemanticContext MATROSKA_DLL_API KaxCues_Context; -extern const EbmlSemanticContext MATROSKA_DLL_API KaxInfo_Context; -extern const EbmlSemanticContext MATROSKA_DLL_API KaxSeekHead_Context; -extern const EbmlSemanticContext MATROSKA_DLL_API KaxTracks_Context; -extern const EbmlSemanticContext MATROSKA_DLL_API KaxTrackEntry_Context; -extern const EbmlSemanticContext MATROSKA_DLL_API KaxTrackNumber_Context; -extern const EbmlSemanticContext MATROSKA_DLL_API KaxTrackType_Context; -extern const EbmlSemanticContext MATROSKA_DLL_API KaxTrackFlagEnabled_Context; -extern const EbmlSemanticContext MATROSKA_DLL_API KaxTrackFlagDefault_Context; -extern const EbmlSemanticContext MATROSKA_DLL_API KaxTrackFlagLacing_Context; -extern const EbmlSemanticContext MATROSKA_DLL_API KaxTrackName_Context; -extern const EbmlSemanticContext MATROSKA_DLL_API KaxTrackLanguage_Context; -extern const EbmlSemanticContext MATROSKA_DLL_API KaxCodecID_Context; -extern const EbmlSemanticContext MATROSKA_DLL_API KaxCodecPrivate_Context; -extern const EbmlSemanticContext MATROSKA_DLL_API KaxCodecName_Context; -extern const EbmlSemanticContext MATROSKA_DLL_API KaxCodecSettings_Context; -extern const EbmlSemanticContext MATROSKA_DLL_API KaxCodecInfoURL_Context; -extern const EbmlSemanticContext MATROSKA_DLL_API KaxCodecDownloadURL_Context; -extern const EbmlSemanticContext MATROSKA_DLL_API KaxCodecDecodeAll_Context; -extern const EbmlSemanticContext MATROSKA_DLL_API KaxTrackOverlay_Context; +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; #define Context_KaxMatroska KaxMatroska_Context #define Context_KaxSegment KaxSegment_Context From c665d21b3748b6d91372b4aa7a9b536d426a690e Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Fri, 29 Dec 2023 11:45:07 +0100 Subject: [PATCH 4/4] remove outdated defines We are cleaning the API. New code should use the proper externs. --- matroska/KaxContexts.h | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/matroska/KaxContexts.h b/matroska/KaxContexts.h index 88e56672..ff1ca912 100644 --- a/matroska/KaxContexts.h +++ b/matroska/KaxContexts.h @@ -52,22 +52,6 @@ extern const EbmlSemanticContext MATROSKA_DLL_API Context_KaxCodecDownloadURL; extern const EbmlSemanticContext MATROSKA_DLL_API Context_KaxCodecDecodeAll; extern const EbmlSemanticContext MATROSKA_DLL_API Context_KaxTrackOverlay; -#define Context_KaxMatroska KaxMatroska_Context -#define Context_KaxSegment KaxSegment_Context -#define Context_KaxTrackEntry KaxTrackEntry_Context -#define Context_KaxTracks KaxTracks_Context -#define Context_KaxCluster KaxCluster_Context -#define Context_KaxBlockGroup KaxBlockGroup_Context -#define Context_KaxInfo KaxInfo_Context -#define Context_KaxAttached KaxAttached_Context -#define Context_KaxAttachments KaxAttachments_Context -#define Context_KaxChapters KaxChapters_Context -#define Context_KaxCues KaxCues_Context -#define Context_KaxTags KaxTags_Context -#define Context_KaxSeekHead KaxSeekHead_Context -#define Context_KaxTag KaxTag_Context -#define Context_KaxTagCommercial KaxTagCommercial_Context - extern MATROSKA_DLL_API const EbmlSemanticContext & GetKaxGlobal_Context(); } // namespace libmatroska