From cdf99062f57dfc2436bff060ff03387b9a91ccd6 Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Sun, 11 Sep 2022 14:48:26 +0200 Subject: [PATCH] KaxSemantic: add KaxChapterSkipType chapter element Added in https://github.com/ietf-wg-cellar/matroska-specification/pull/318 --- matroska/KaxSemantic.h | 19 +++++++++++++++++++ src/KaxSemantic.cpp | 2 ++ 2 files changed, 21 insertions(+) diff --git a/matroska/KaxSemantic.h b/matroska/KaxSemantic.h index 9d24fc9..db56910 100644 --- a/matroska/KaxSemantic.h +++ b/matroska/KaxSemantic.h @@ -768,6 +768,9 @@ public: virtual bool ValidateSize() const {return IsFiniteSize() && GetSize() == 16;} }; +DECLARE_MKX_UINTEGER(KaxChapterSkipType) +}; + DECLARE_MKX_UINTEGER(KaxChapterSegmentEditionUID) }; @@ -1179,6 +1182,22 @@ typedef enum { MATROSKA_CONTENTSIGHASHALGO_MD5 = 2, } MatroskaContentSigHashAlgo; +/** + *Indicate what type of content the ChapterAtom contains and might be skipped. It can be used to automatically skip content based on the type. +If a `ChapterAtom` is inside a `ChapterAtom` that has a `ChapterSkipType` set, it **MUST NOT** have a `ChapterSkipType` or have a `ChapterSkipType` with the same value as it's parent `ChapterAtom`. +If the `ChapterAtom` doesn't contain a `ChapterTimeEnd`, the value of the `ChapterSkipType` is only valid until the next `ChapterAtom` with a `ChapterSkipType` value or the end of the file. + + */ +typedef enum { + MATROSKA_CHAPTERSKIPTYPE_NO_SKIPPING = 0, // Content which should not be skipped. + MATROSKA_CHAPTERSKIPTYPE_OPENING_CREDITS = 1, // Credits usually found at the beginning of the content. + MATROSKA_CHAPTERSKIPTYPE_END_CREDITS = 2, // Credits usually found at the end of the content. + MATROSKA_CHAPTERSKIPTYPE_RECAP = 3, // Recap of previous episodes of the content, usually found around the beginning. + MATROSKA_CHAPTERSKIPTYPE_NEXT_PREVIEW = 4, // Preview of the next episode of the content, usually found around the end. It may contain spoilers the user wants to avoid. + MATROSKA_CHAPTERSKIPTYPE_PREVIEW = 5, // Preview of the current episode of the content, usually found around the beginning. It may contain spoilers the user want to avoid. + MATROSKA_CHAPTERSKIPTYPE_ADVERTISEMENT = 6, // Advertisement within the content. +} MatroskaChapterSkipType; + /** *Defines when the process command **SHOULD** be handled */ diff --git a/src/KaxSemantic.cpp b/src/KaxSemantic.cpp index 143f9be..f90b5e5 100644 --- a/src/KaxSemantic.cpp +++ b/src/KaxSemantic.cpp @@ -638,6 +638,7 @@ DEFINE_SEMANTIC_ITEM(false, true, KaxChapterTimeEnd) DEFINE_SEMANTIC_ITEM(true, true, KaxChapterFlagHidden) DEFINE_SEMANTIC_ITEM(true, true, KaxChapterFlagEnabled) DEFINE_SEMANTIC_ITEM(false, true, KaxChapterSegmentUID) +DEFINE_SEMANTIC_ITEM(false, true, KaxChapterSkipType) DEFINE_SEMANTIC_ITEM(false, true, KaxChapterSegmentEditionUID) DEFINE_SEMANTIC_ITEM(false, true, KaxChapterPhysicalEquiv) DEFINE_SEMANTIC_ITEM(false, true, KaxChapterTrack) @@ -653,6 +654,7 @@ DEFINE_MKX_UINTEGER(KaxChapterTimeEnd, 0x92, 1, KaxChapterAtom, "ChapterTimeEnd" DEFINE_MKX_UINTEGER_DEF(KaxChapterFlagHidden, 0x98, 1, KaxChapterAtom, "ChapterFlagHidden", 0) DEFINE_MKX_UINTEGER_DEF(KaxChapterFlagEnabled, 0x4598, 2, KaxChapterAtom, "ChapterFlagEnabled", 1) DEFINE_MKX_BINARY (KaxChapterSegmentUID, 0x6E67, 2, KaxChapterAtom, "ChapterSegmentUID") +DEFINE_MKX_UINTEGER(KaxChapterSkipType, 0x4588, 2, KaxChapterAtom, "ChapterSkipType") DEFINE_MKX_UINTEGER(KaxChapterSegmentEditionUID, 0x6EBC, 2, KaxChapterAtom, "ChapterSegmentEditionUID") DEFINE_MKX_UINTEGER(KaxChapterPhysicalEquiv, 0x63C3, 2, KaxChapterAtom, "ChapterPhysicalEquiv") -- 2.40.0