From 9e32281dca68099d2091055bfdf68ea49d8e63d9 Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Tue, 22 Mar 2011 08:31:00 +0000 Subject: [PATCH] libmatroska: fix some semantic mismatch with the specs git-svn-id: https://matroska.svn.sourceforge.net/svnroot/matroska/trunk/libmatroska@712 a6f86f6d-0131-4f8e-9e7b-e335508773d5 --- matroska/KaxTrackEntryData.h | 278 ++++++++--------- src/KaxAttached.cpp | 144 ++++----- src/KaxBlockData.cpp | 2 +- src/KaxChapters.cpp | 236 +++++++-------- src/KaxContentEncoding.cpp | 166 +++++------ src/KaxCuesData.cpp | 558 +++++++++++++++++------------------ src/KaxSegment.cpp | 218 +++++++------- src/KaxTrackEntryData.cpp | 158 +++++----- src/KaxTracks.cpp | 2 +- 9 files changed, 881 insertions(+), 881 deletions(-) diff --git a/matroska/KaxTrackEntryData.h b/matroska/KaxTrackEntryData.h index 8f7a12c..3ec9ea0 100644 --- a/matroska/KaxTrackEntryData.h +++ b/matroska/KaxTrackEntryData.h @@ -1,139 +1,139 @@ -/**************************************************************************** -** libmatroska : parse Matroska files, see http://www.matroska.org/ -** -** -** -** Copyright (C) 2002-2010 Steve Lhomme. All rights reserved. -** -** This file is part of libmatroska. -** -** 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: KaxTrackEntryData.h,v 1.9 2004/04/14 23:26:17 robux4 Exp $ - \author Steve Lhomme - \author John Cannon -*/ -#ifndef LIBMATROSKA_TRACK_ENTRY_DATA_H -#define LIBMATROSKA_TRACK_ENTRY_DATA_H - -#include "matroska/KaxTypes.h" -#include "ebml/EbmlUInteger.h" -#include "ebml/EbmlFloat.h" -#include "ebml/EbmlString.h" -#include "ebml/EbmlUnicodeString.h" -#include "ebml/EbmlBinary.h" -#include "ebml/EbmlMaster.h" -#include "matroska/KaxDefines.h" - -using namespace LIBEBML_NAMESPACE; - -START_LIBMATROSKA_NAMESPACE - -DECLARE_MKX_UINTEGER(KaxTrackNumber) -}; - -DECLARE_MKX_UINTEGER(KaxTrackUID) -}; - -DECLARE_MKX_UINTEGER(KaxTrackType) -}; - -#if MATROSKA_VERSION >= 2 -DECLARE_MKX_UINTEGER(KaxTrackFlagEnabled) -}; -#endif // MATROSKA_VERSION - -DECLARE_MKX_UINTEGER(KaxTrackFlagDefault) -}; - -DECLARE_MKX_UINTEGER(KaxTrackFlagForced) -}; - -DECLARE_MKX_UINTEGER(KaxTrackFlagLacing) -}; - -DECLARE_MKX_UINTEGER(KaxTrackMinCache) -}; - -DECLARE_MKX_UINTEGER(KaxTrackMaxCache) -}; - -DECLARE_MKX_UINTEGER(KaxTrackDefaultDuration) -}; - -DECLARE_MKX_FLOAT(KaxTrackTimecodeScale) -}; - -DECLARE_MKX_UINTEGER(KaxMaxBlockAdditionID) -}; - -DECLARE_MKX_UNISTRING(KaxTrackName) -}; - -DECLARE_MKX_STRING(KaxTrackLanguage) -}; - -DECLARE_MKX_STRING(KaxCodecID) -}; - -DECLARE_MKX_BINARY(KaxCodecPrivate) -}; - -DECLARE_MKX_UNISTRING(KaxCodecName) -}; - -DECLARE_MKX_BINARY(KaxTrackAttachmentLink) -}; - -DECLARE_MKX_UINTEGER(KaxTrackOverlay) -}; - -DECLARE_MKX_MASTER(KaxTrackTranslate) -}; - -DECLARE_MKX_UINTEGER(KaxTrackTranslateCodec) -}; - -DECLARE_MKX_UINTEGER(KaxTrackTranslateEditionUID) -}; - -DECLARE_MKX_BINARY(KaxTrackTranslateTrackID) -}; - -#if MATROSKA_VERSION >= 2 -DECLARE_MKX_UNISTRING(KaxCodecSettings) -}; - -DECLARE_MKX_STRING(KaxCodecInfoURL) -}; - -DECLARE_MKX_STRING(KaxCodecDownloadURL) -}; - -DECLARE_MKX_UINTEGER(KaxCodecDecodeAll) -}; -#endif // MATROSKA_VERSION - -END_LIBMATROSKA_NAMESPACE - -#endif // LIBMATROSKA_TRACK_ENTRY_DATA_H +/**************************************************************************** +** libmatroska : parse Matroska files, see http://www.matroska.org/ +** +** +** +** Copyright (C) 2002-2010 Steve Lhomme. All rights reserved. +** +** This file is part of libmatroska. +** +** 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: KaxTrackEntryData.h,v 1.9 2004/04/14 23:26:17 robux4 Exp $ + \author Steve Lhomme + \author John Cannon +*/ +#ifndef LIBMATROSKA_TRACK_ENTRY_DATA_H +#define LIBMATROSKA_TRACK_ENTRY_DATA_H + +#include "matroska/KaxTypes.h" +#include "ebml/EbmlUInteger.h" +#include "ebml/EbmlFloat.h" +#include "ebml/EbmlString.h" +#include "ebml/EbmlUnicodeString.h" +#include "ebml/EbmlBinary.h" +#include "ebml/EbmlMaster.h" +#include "matroska/KaxDefines.h" + +using namespace LIBEBML_NAMESPACE; + +START_LIBMATROSKA_NAMESPACE + +DECLARE_MKX_UINTEGER(KaxTrackNumber) +}; + +DECLARE_MKX_UINTEGER(KaxTrackUID) +}; + +DECLARE_MKX_UINTEGER(KaxTrackType) +}; + +#if MATROSKA_VERSION >= 2 +DECLARE_MKX_UINTEGER(KaxTrackFlagEnabled) +}; +#endif // MATROSKA_VERSION + +DECLARE_MKX_UINTEGER(KaxTrackFlagDefault) +}; + +DECLARE_MKX_UINTEGER(KaxTrackFlagForced) +}; + +DECLARE_MKX_UINTEGER(KaxTrackFlagLacing) +}; + +DECLARE_MKX_UINTEGER(KaxTrackMinCache) +}; + +DECLARE_MKX_UINTEGER(KaxTrackMaxCache) +}; + +DECLARE_MKX_UINTEGER(KaxTrackDefaultDuration) +}; + +DECLARE_MKX_FLOAT(KaxTrackTimecodeScale) +}; + +DECLARE_MKX_UINTEGER(KaxMaxBlockAdditionID) +}; + +DECLARE_MKX_UNISTRING(KaxTrackName) +}; + +DECLARE_MKX_STRING(KaxTrackLanguage) +}; + +DECLARE_MKX_STRING(KaxCodecID) +}; + +DECLARE_MKX_BINARY(KaxCodecPrivate) +}; + +DECLARE_MKX_UNISTRING(KaxCodecName) +}; + +DECLARE_MKX_UINTEGER(KaxTrackAttachmentLink) +}; + +DECLARE_MKX_UINTEGER(KaxTrackOverlay) +}; + +DECLARE_MKX_MASTER(KaxTrackTranslate) +}; + +DECLARE_MKX_UINTEGER(KaxTrackTranslateCodec) +}; + +DECLARE_MKX_UINTEGER(KaxTrackTranslateEditionUID) +}; + +DECLARE_MKX_BINARY(KaxTrackTranslateTrackID) +}; + +#if MATROSKA_VERSION >= 2 +DECLARE_MKX_UNISTRING(KaxCodecSettings) +}; + +DECLARE_MKX_STRING(KaxCodecInfoURL) +}; + +DECLARE_MKX_STRING(KaxCodecDownloadURL) +}; + +DECLARE_MKX_UINTEGER(KaxCodecDecodeAll) +}; +#endif // MATROSKA_VERSION + +END_LIBMATROSKA_NAMESPACE + +#endif // LIBMATROSKA_TRACK_ENTRY_DATA_H diff --git a/src/KaxAttached.cpp b/src/KaxAttached.cpp index d426197..7f51434 100644 --- a/src/KaxAttached.cpp +++ b/src/KaxAttached.cpp @@ -1,72 +1,72 @@ -/**************************************************************************** -** libmatroska : parse Matroska files, see http://www.matroska.org/ -** -** -** -** Copyright (C) 2002-2010 Steve Lhomme. All rights reserved. -** -** This file is part of libmatroska. -** -** 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: KaxAttached.cpp 1202 2005-08-30 14:39:01Z robux4 $ - \author Steve Lhomme -*/ -#include "matroska/KaxAttached.h" -#include "matroska/KaxContexts.h" -#include "matroska/KaxDefines.h" - -// sub elements - -using namespace LIBEBML_NAMESPACE; - -START_LIBMATROSKA_NAMESPACE - -DEFINE_START_SEMANTIC(KaxAttached) -DEFINE_SEMANTIC_ITEM(true, true, KaxFileName) -DEFINE_SEMANTIC_ITEM(true, true, KaxMimeType) -DEFINE_SEMANTIC_ITEM(true, true, KaxFileData) -DEFINE_SEMANTIC_ITEM(false, true, KaxFileDescription) -DEFINE_SEMANTIC_ITEM(true, true, KaxFileUID) -#if MATROSKA_VERSION >= 2 -DEFINE_SEMANTIC_ITEM(false, true, KaxFileReferral) -#endif // MATROSKA_VERSION -DEFINE_END_SEMANTIC(KaxAttached) - -DEFINE_MKX_MASTER_CONS(KaxAttached, 0x61A7, 2, KaxAttachments, "AttachedFile"); -DEFINE_MKX_UNISTRING (KaxFileDescription, 0x467E, 2, KaxAttachments, "FileDescription"); -DEFINE_MKX_UNISTRING (KaxFileName, 0x466E, 2, KaxAttachments, "FileName"); -DEFINE_MKX_STRING (KaxMimeType, 0x4660, 2, KaxAttachments, "FileMimeType"); -DEFINE_MKX_BINARY (KaxFileData, 0x465C, 2, KaxAttachments, "FileData"); -DEFINE_MKX_UINTEGER (KaxFileUID, 0x46AE, 2, KaxAttachments, "FileUID"); -#if MATROSKA_VERSION >= 2 -DEFINE_MKX_BINARY (KaxFileReferral, 0x4675, 2, KaxAttachments, "FileReferral"); -#endif - -KaxAttached::KaxAttached(EBML_EXTRA_DEF) - :EbmlMaster(EBML_CLASS_SEMCONTEXT(KaxAttached) EBML_DEF_SEP EBML_EXTRA_CALL) -{ - SetSizeLength(2); // mandatory min size support (for easier updating) (2^(7*2)-2 = 16Ko) -} - -END_LIBMATROSKA_NAMESPACE +/**************************************************************************** +** libmatroska : parse Matroska files, see http://www.matroska.org/ +** +** +** +** Copyright (C) 2002-2010 Steve Lhomme. All rights reserved. +** +** This file is part of libmatroska. +** +** 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: KaxAttached.cpp 1202 2005-08-30 14:39:01Z robux4 $ + \author Steve Lhomme +*/ +#include "matroska/KaxAttached.h" +#include "matroska/KaxContexts.h" +#include "matroska/KaxDefines.h" + +// sub elements + +using namespace LIBEBML_NAMESPACE; + +START_LIBMATROSKA_NAMESPACE + +DEFINE_START_SEMANTIC(KaxAttached) +DEFINE_SEMANTIC_ITEM(true, true, KaxFileName) +DEFINE_SEMANTIC_ITEM(true, true, KaxMimeType) +DEFINE_SEMANTIC_ITEM(true, true, KaxFileData) +DEFINE_SEMANTIC_ITEM(false, true, KaxFileDescription) +DEFINE_SEMANTIC_ITEM(true, true, KaxFileUID) +#if MATROSKA_VERSION >= 2 +DEFINE_SEMANTIC_ITEM(false, true, KaxFileReferral) +#endif // MATROSKA_VERSION +DEFINE_END_SEMANTIC(KaxAttached) + +DEFINE_MKX_MASTER_CONS(KaxAttached, 0x61A7, 2, KaxAttachments, "AttachedFile"); +DEFINE_MKX_UNISTRING (KaxFileDescription, 0x467E, 2, KaxAttached, "FileDescription"); +DEFINE_MKX_UNISTRING (KaxFileName, 0x466E, 2, KaxAttached, "FileName"); +DEFINE_MKX_STRING (KaxMimeType, 0x4660, 2, KaxAttached, "FileMimeType"); +DEFINE_MKX_BINARY (KaxFileData, 0x465C, 2, KaxAttached, "FileData"); +DEFINE_MKX_UINTEGER (KaxFileUID, 0x46AE, 2, KaxAttached, "FileUID"); +#if MATROSKA_VERSION >= 2 +DEFINE_MKX_BINARY (KaxFileReferral, 0x4675, 2, KaxAttached, "FileReferral"); +#endif + +KaxAttached::KaxAttached(EBML_EXTRA_DEF) + :EbmlMaster(EBML_CLASS_SEMCONTEXT(KaxAttached) EBML_DEF_SEP EBML_EXTRA_CALL) +{ + SetSizeLength(2); // mandatory min size support (for easier updating) (2^(7*2)-2 = 16Ko) +} + +END_LIBMATROSKA_NAMESPACE diff --git a/src/KaxBlockData.cpp b/src/KaxBlockData.cpp index 88cf9dc..249f9b0 100644 --- a/src/KaxBlockData.cpp +++ b/src/KaxBlockData.cpp @@ -60,7 +60,7 @@ DEFINE_MKX_MASTER (KaxTimeSlice, 0xE8, 1, KaxSlices, "TimeSlice"); DEFINE_MKX_UINTEGER_DEF (KaxSliceLaceNumber, 0xCC, 1, KaxTimeSlice, "SliceLaceNumber", 0); DEFINE_MKX_UINTEGER_DEF (KaxSliceFrameNumber, 0xCD, 1, KaxTimeSlice, "SliceFrameNumber", 0); DEFINE_MKX_UINTEGER_DEF (KaxSliceBlockAddID, 0xCB, 1, KaxTimeSlice, "SliceBlockAddID", 0); -DEFINE_MKX_UINTEGER (KaxSliceDelay, 0xCE, 1, KaxTimeSlice, "SliceDelay"); +DEFINE_MKX_UINTEGER_DEF (KaxSliceDelay, 0xCE, 1, KaxTimeSlice, "SliceDelay", 0); DEFINE_MKX_UINTEGER_DEF (KaxSliceDuration, 0xCF, 1, KaxTimeSlice, "SliceDuration", 0); #if MATROSKA_VERSION >= 2 DEFINE_MKX_SINTEGER (KaxReferenceVirtual, 0xFD, 1, KaxBlockGroup, "ReferenceVirtual"); diff --git a/src/KaxChapters.cpp b/src/KaxChapters.cpp index e559f78..d42c424 100644 --- a/src/KaxChapters.cpp +++ b/src/KaxChapters.cpp @@ -1,118 +1,118 @@ -/**************************************************************************** -** libmatroska : parse Matroska files, see http://www.matroska.org/ -** -** -** -** Copyright (C) 2002-2010 Steve Lhomme. All rights reserved. -** -** This file is part of libmatroska. -** -** 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: KaxChapters.cpp 1201 2005-08-30 14:28:27Z robux4 $ - \author Steve Lhomme -*/ -#include "matroska/KaxChapters.h" -#include "matroska/KaxContexts.h" -#include "matroska/KaxDefines.h" - -// sub elements -START_LIBMATROSKA_NAMESPACE - -DEFINE_START_SEMANTIC(KaxChapters) -DEFINE_SEMANTIC_ITEM(true, false, KaxEditionEntry) -DEFINE_END_SEMANTIC(KaxChapters) - -DEFINE_START_SEMANTIC(KaxEditionEntry) -DEFINE_SEMANTIC_ITEM(false, true, KaxEditionUID) -DEFINE_SEMANTIC_ITEM(true, true, KaxEditionFlagHidden) -DEFINE_SEMANTIC_ITEM(true, true, KaxEditionFlagDefault) -DEFINE_SEMANTIC_ITEM(false, true, KaxEditionFlagOrdered) -DEFINE_SEMANTIC_ITEM(true, false, KaxChapterAtom) -DEFINE_END_SEMANTIC(KaxEditionEntry) - -DEFINE_START_SEMANTIC(KaxChapterAtom) -DEFINE_SEMANTIC_ITEM(false, false, KaxChapterAtom) -DEFINE_SEMANTIC_ITEM(true, true, KaxChapterUID) -DEFINE_SEMANTIC_ITEM(true, true, KaxChapterTimeStart) -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, KaxChapterSegmentEditionUID) -DEFINE_SEMANTIC_ITEM(false, true, KaxChapterPhysicalEquiv) -DEFINE_SEMANTIC_ITEM(false, true, KaxChapterTrack) -DEFINE_SEMANTIC_ITEM(false, false, KaxChapterDisplay) -DEFINE_SEMANTIC_ITEM(false, false, KaxChapterProcess) -DEFINE_END_SEMANTIC(KaxChapterAtom) - -DEFINE_START_SEMANTIC(KaxChapterTrack) -DEFINE_SEMANTIC_ITEM(true, false, KaxChapterTrackNumber) -DEFINE_END_SEMANTIC(KaxChapterTrack) - -DEFINE_START_SEMANTIC(KaxChapterDisplay) -DEFINE_SEMANTIC_ITEM(true, true, KaxChapterString) -DEFINE_SEMANTIC_ITEM(true, false, KaxChapterLanguage) -DEFINE_SEMANTIC_ITEM(false, false, KaxChapterCountry) -DEFINE_END_SEMANTIC(KaxChapterDisplay) - -DEFINE_START_SEMANTIC(KaxChapterProcess) -DEFINE_SEMANTIC_ITEM(true, true, KaxChapterProcessCodecID) -DEFINE_SEMANTIC_ITEM(false, true, KaxChapterProcessPrivate) -DEFINE_SEMANTIC_ITEM(false, false, KaxChapterProcessCommand) -DEFINE_END_SEMANTIC(KaxChapterProcess) - -DEFINE_START_SEMANTIC(KaxChapterProcessCommand) -DEFINE_SEMANTIC_ITEM(true, true, KaxChapterProcessTime) -DEFINE_SEMANTIC_ITEM(true, true, KaxChapterProcessData) -DEFINE_END_SEMANTIC(KaxChapterProcessCommand) - -DEFINE_MKX_MASTER (KaxChapters, 0x1043A770, 4, KaxSegment, "Chapters"); -DEFINE_MKX_MASTER (KaxEditionEntry, 0x45B9, 2, KaxChapters, "EditionEntry"); -DEFINE_MKX_UINTEGER (KaxEditionUID, 0x45BC, 2, KaxEditionEntry, "EditionUID"); -DEFINE_MKX_UINTEGER_DEF(KaxEditionFlagHidden, 0x45BD, 2, KaxEditionEntry, "EditionFlagHidden", 0); -DEFINE_MKX_UINTEGER_DEF(KaxEditionFlagDefault, 0x45DB, 2, KaxEditionEntry, "EditionFlagDefault", 0); -DEFINE_MKX_UINTEGER_DEF(KaxEditionFlagOrdered, 0x45DD, 2, KaxEditionEntry, "EditionFlagOrdered", 0); -DEFINE_MKX_MASTER (KaxChapterAtom, 0xB6, 1, KaxEditionEntry, "ChapterAtom"); -DEFINE_MKX_UINTEGER (KaxChapterUID, 0x73C4, 2, KaxChapterAtom, "ChapterUID"); -DEFINE_MKX_UINTEGER (KaxChapterTimeStart, 0x91, 1, KaxChapterAtom, "ChapterTimeStart"); -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_BINARY (KaxChapterSegmentEditionUID, 0x6EBC, 2, KaxChapterAtom, "ChapterSegmentEditionUID"); -DEFINE_MKX_UINTEGER (KaxChapterPhysicalEquiv, 0x63C3, 2, KaxChapterAtom, "ChapterPhysicalEquiv"); -DEFINE_MKX_MASTER (KaxChapterTrack, 0x8F, 1, KaxChapterAtom, "ChapterTrack"); -DEFINE_MKX_UINTEGER (KaxChapterTrackNumber, 0x89, 1, KaxChapterTrack, "ChapterTrackNumber"); -DEFINE_MKX_MASTER (KaxChapterDisplay, 0x80, 1, KaxChapterAtom, "ChapterDisplay"); -DEFINE_MKX_UNISTRING (KaxChapterString, 0x85, 1, KaxChapterDisplay, "ChapterString"); -DEFINE_MKX_STRING_DEF (KaxChapterLanguage, 0x437C, 2, KaxChapterLanguage, "ChapterLanguage", "eng"); // parent context ? -DEFINE_MKX_STRING (KaxChapterCountry, 0x437E, 2, KaxChapterCountry, "ChapterCountry"); // parent context ? -DEFINE_MKX_MASTER (KaxChapterProcess, 0x6944, 2, KaxChapterAtom, "ChapterProcess"); -DEFINE_MKX_UINTEGER_DEF(KaxChapterProcessCodecID, 0x6955, 2, KaxChapterProcess, "ChapterProcessCodecID", 0); -DEFINE_MKX_BINARY (KaxChapterProcessPrivate, 0x450D, 2, KaxChapterProcess, "ChapterProcessPrivate"); -DEFINE_MKX_MASTER (KaxChapterProcessCommand, 0x6911, 2, KaxChapterProcess, "ChapterProcessCommand"); -DEFINE_MKX_UINTEGER (KaxChapterProcessTime, 0x6922, 2, KaxChapterProcessCommand, "ChapterProcessTime"); -DEFINE_MKX_BINARY (KaxChapterProcessData, 0x6933, 2, KaxChapterProcessCommand, "ChapterProcessData"); - -END_LIBMATROSKA_NAMESPACE +/**************************************************************************** +** libmatroska : parse Matroska files, see http://www.matroska.org/ +** +** +** +** Copyright (C) 2002-2010 Steve Lhomme. All rights reserved. +** +** This file is part of libmatroska. +** +** 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: KaxChapters.cpp 1201 2005-08-30 14:28:27Z robux4 $ + \author Steve Lhomme +*/ +#include "matroska/KaxChapters.h" +#include "matroska/KaxContexts.h" +#include "matroska/KaxDefines.h" + +// sub elements +START_LIBMATROSKA_NAMESPACE + +DEFINE_START_SEMANTIC(KaxChapters) +DEFINE_SEMANTIC_ITEM(true, false, KaxEditionEntry) +DEFINE_END_SEMANTIC(KaxChapters) + +DEFINE_START_SEMANTIC(KaxEditionEntry) +DEFINE_SEMANTIC_ITEM(false, true, KaxEditionUID) +DEFINE_SEMANTIC_ITEM(true, true, KaxEditionFlagHidden) +DEFINE_SEMANTIC_ITEM(true, true, KaxEditionFlagDefault) +DEFINE_SEMANTIC_ITEM(false, true, KaxEditionFlagOrdered) +DEFINE_SEMANTIC_ITEM(true, false, KaxChapterAtom) +DEFINE_END_SEMANTIC(KaxEditionEntry) + +DEFINE_START_SEMANTIC(KaxChapterAtom) +DEFINE_SEMANTIC_ITEM(false, false, KaxChapterAtom) +DEFINE_SEMANTIC_ITEM(true, true, KaxChapterUID) +DEFINE_SEMANTIC_ITEM(true, true, KaxChapterTimeStart) +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, KaxChapterSegmentEditionUID) +DEFINE_SEMANTIC_ITEM(false, true, KaxChapterPhysicalEquiv) +DEFINE_SEMANTIC_ITEM(false, true, KaxChapterTrack) +DEFINE_SEMANTIC_ITEM(false, false, KaxChapterDisplay) +DEFINE_SEMANTIC_ITEM(false, false, KaxChapterProcess) +DEFINE_END_SEMANTIC(KaxChapterAtom) + +DEFINE_START_SEMANTIC(KaxChapterTrack) +DEFINE_SEMANTIC_ITEM(true, false, KaxChapterTrackNumber) +DEFINE_END_SEMANTIC(KaxChapterTrack) + +DEFINE_START_SEMANTIC(KaxChapterDisplay) +DEFINE_SEMANTIC_ITEM(true, true, KaxChapterString) +DEFINE_SEMANTIC_ITEM(true, false, KaxChapterLanguage) +DEFINE_SEMANTIC_ITEM(false, false, KaxChapterCountry) +DEFINE_END_SEMANTIC(KaxChapterDisplay) + +DEFINE_START_SEMANTIC(KaxChapterProcess) +DEFINE_SEMANTIC_ITEM(true, true, KaxChapterProcessCodecID) +DEFINE_SEMANTIC_ITEM(false, true, KaxChapterProcessPrivate) +DEFINE_SEMANTIC_ITEM(false, false, KaxChapterProcessCommand) +DEFINE_END_SEMANTIC(KaxChapterProcess) + +DEFINE_START_SEMANTIC(KaxChapterProcessCommand) +DEFINE_SEMANTIC_ITEM(true, true, KaxChapterProcessTime) +DEFINE_SEMANTIC_ITEM(true, true, KaxChapterProcessData) +DEFINE_END_SEMANTIC(KaxChapterProcessCommand) + +DEFINE_MKX_MASTER (KaxChapters, 0x1043A770, 4, KaxSegment, "Chapters"); +DEFINE_MKX_MASTER (KaxEditionEntry, 0x45B9, 2, KaxChapters, "EditionEntry"); +DEFINE_MKX_UINTEGER (KaxEditionUID, 0x45BC, 2, KaxEditionEntry, "EditionUID"); +DEFINE_MKX_UINTEGER_DEF(KaxEditionFlagHidden, 0x45BD, 2, KaxEditionEntry, "EditionFlagHidden", 0); +DEFINE_MKX_UINTEGER_DEF(KaxEditionFlagDefault, 0x45DB, 2, KaxEditionEntry, "EditionFlagDefault", 0); +DEFINE_MKX_UINTEGER_DEF(KaxEditionFlagOrdered, 0x45DD, 2, KaxEditionEntry, "EditionFlagOrdered", 0); +DEFINE_MKX_MASTER (KaxChapterAtom, 0xB6, 1, KaxEditionEntry, "ChapterAtom"); +DEFINE_MKX_UINTEGER (KaxChapterUID, 0x73C4, 2, KaxChapterAtom, "ChapterUID"); +DEFINE_MKX_UINTEGER (KaxChapterTimeStart, 0x91, 1, KaxChapterAtom, "ChapterTimeStart"); +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_BINARY (KaxChapterSegmentEditionUID, 0x6EBC, 2, KaxChapterAtom, "ChapterSegmentEditionUID"); +DEFINE_MKX_UINTEGER (KaxChapterPhysicalEquiv, 0x63C3, 2, KaxChapterAtom, "ChapterPhysicalEquiv"); +DEFINE_MKX_MASTER (KaxChapterTrack, 0x8F, 1, KaxChapterAtom, "ChapterTrack"); +DEFINE_MKX_UINTEGER (KaxChapterTrackNumber, 0x89, 1, KaxChapterTrack, "ChapterTrackNumber"); +DEFINE_MKX_MASTER (KaxChapterDisplay, 0x80, 1, KaxChapterAtom, "ChapterDisplay"); +DEFINE_MKX_UNISTRING (KaxChapterString, 0x85, 1, KaxChapterDisplay, "ChapterString"); +DEFINE_MKX_STRING_DEF (KaxChapterLanguage, 0x437C, 2, KaxChapterDisplay, "ChapterLanguage", "eng"); // parent context ? +DEFINE_MKX_STRING (KaxChapterCountry, 0x437E, 2, KaxChapterDisplay, "ChapterCountry"); // parent context ? +DEFINE_MKX_MASTER (KaxChapterProcess, 0x6944, 2, KaxChapterAtom, "ChapterProcess"); +DEFINE_MKX_UINTEGER_DEF(KaxChapterProcessCodecID, 0x6955, 2, KaxChapterProcess, "ChapterProcessCodecID", 0); +DEFINE_MKX_BINARY (KaxChapterProcessPrivate, 0x450D, 2, KaxChapterProcess, "ChapterProcessPrivate"); +DEFINE_MKX_MASTER (KaxChapterProcessCommand, 0x6911, 2, KaxChapterProcess, "ChapterProcessCommand"); +DEFINE_MKX_UINTEGER (KaxChapterProcessTime, 0x6922, 2, KaxChapterProcessCommand, "ChapterProcessTime"); +DEFINE_MKX_BINARY (KaxChapterProcessData, 0x6933, 2, KaxChapterProcessCommand, "ChapterProcessData"); + +END_LIBMATROSKA_NAMESPACE diff --git a/src/KaxContentEncoding.cpp b/src/KaxContentEncoding.cpp index 452fd5c..4eba4be 100644 --- a/src/KaxContentEncoding.cpp +++ b/src/KaxContentEncoding.cpp @@ -1,83 +1,83 @@ -/**************************************************************************** -** libmatroska : parse Matroska files, see http://www.matroska.org/ -** -** -** -** Copyright (C) 2002-2010 Steve Lhomme. All rights reserved. -** -** This file is part of libmatroska. -** -** 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: KaxContentEncoding.cpp 640 2004-07-09 21:05:36Z mosu $ - \author Moritz Bunkus -*/ -#include "matroska/KaxContentEncoding.h" -#include "matroska/KaxContexts.h" -#include "matroska/KaxDefines.h" - -START_LIBMATROSKA_NAMESPACE - -DEFINE_START_SEMANTIC(KaxContentEncodings) -DEFINE_SEMANTIC_ITEM(true, true, KaxContentEncoding) -DEFINE_END_SEMANTIC(KaxContentEncodings) - -DEFINE_START_SEMANTIC(KaxContentEncoding) -DEFINE_SEMANTIC_ITEM(true, true, KaxContentEncodingOrder) -DEFINE_SEMANTIC_ITEM(true, true, KaxContentEncodingScope) -DEFINE_SEMANTIC_ITEM(true, true, KaxContentEncodingType) -DEFINE_SEMANTIC_ITEM(false, true, KaxContentCompression) -DEFINE_SEMANTIC_ITEM(false, true, KaxContentEncryption) -DEFINE_END_SEMANTIC(KaxContentEncoding) - -DEFINE_START_SEMANTIC(KaxContentCompression) -DEFINE_SEMANTIC_ITEM(true, true, KaxContentCompAlgo) -DEFINE_SEMANTIC_ITEM(false, true, KaxContentCompSettings) -DEFINE_END_SEMANTIC(KaxContentCompression) - -DEFINE_START_SEMANTIC(KaxContentEncryption) -DEFINE_SEMANTIC_ITEM(false, true, KaxContentEncAlgo) -DEFINE_SEMANTIC_ITEM(false, true, KaxContentEncKeyID) -DEFINE_SEMANTIC_ITEM(false, true, KaxContentSignature) -DEFINE_SEMANTIC_ITEM(false, true, KaxContentSigKeyID) -DEFINE_SEMANTIC_ITEM(false, true, KaxContentSigAlgo) -DEFINE_SEMANTIC_ITEM(false, true, KaxContentSigHashAlgo) -DEFINE_END_SEMANTIC(KaxContentEncryption) - -DEFINE_MKX_MASTER (KaxContentEncodings, 0x6d80, 2, KaxTrackEntry, "ContentEncodings"); -DEFINE_MKX_MASTER (KaxContentEncoding, 0x6240, 2, KaxContentEncodings, "ContentEncoding"); -DEFINE_MKX_UINTEGER_DEF(KaxContentEncodingOrder, 0x5031, 2, KaxContentEncoding, "ContentEncodingOrder", 0); -DEFINE_MKX_UINTEGER_DEF(KaxContentEncodingScope, 0x5032, 2, KaxContentEncoding, "ContentEncodingScope", 1); -DEFINE_MKX_UINTEGER_DEF(KaxContentEncodingType, 0x5033, 2, KaxContentEncoding, "ContentEncodingType", 0); -DEFINE_MKX_MASTER (KaxContentCompression, 0x5034, 2, KaxContentEncoding, "ContentCompression"); -DEFINE_MKX_UINTEGER_DEF(KaxContentCompAlgo, 0x4254, 2, KaxContentCompression, "ContentCompAlgo", 0); -DEFINE_MKX_BINARY (KaxContentCompSettings, 0x4255, 2, KaxContentCompression, "ContentCompSettings"); -DEFINE_MKX_MASTER (KaxContentEncryption, 0x5035, 2, KaxContentEncoding, "ContentEncryption"); -DEFINE_MKX_UINTEGER_DEF(KaxContentEncAlgo, 0x47e1, 2, KaxContentEncryption, "ContentEncAlgo", 0); -DEFINE_MKX_BINARY (KaxContentEncKeyID, 0x47e2, 2, KaxContentEncryption, "ContentEncKeyID"); -DEFINE_MKX_BINARY (KaxContentSignature, 0x47e3, 2, KaxContentEncryption, "ContentSignature"); -DEFINE_MKX_BINARY (KaxContentSigKeyID, 0x47e4, 2, KaxContentEncryption, "ContentSigKeyID"); -DEFINE_MKX_UINTEGER_DEF(KaxContentSigAlgo, 0x47e5, 2, KaxContentEncryption, "ContentSigAlgo", 0); -DEFINE_MKX_UINTEGER_DEF(KaxContentSigHashAlgo, 0x47e6, 2, KaxContentEncryption, "ContentSigHashAlgo", 0); - -END_LIBMATROSKA_NAMESPACE +/**************************************************************************** +** libmatroska : parse Matroska files, see http://www.matroska.org/ +** +** +** +** Copyright (C) 2002-2010 Steve Lhomme. All rights reserved. +** +** This file is part of libmatroska. +** +** 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: KaxContentEncoding.cpp 640 2004-07-09 21:05:36Z mosu $ + \author Moritz Bunkus +*/ +#include "matroska/KaxContentEncoding.h" +#include "matroska/KaxContexts.h" +#include "matroska/KaxDefines.h" + +START_LIBMATROSKA_NAMESPACE + +DEFINE_START_SEMANTIC(KaxContentEncodings) +DEFINE_SEMANTIC_ITEM(true, false, KaxContentEncoding) +DEFINE_END_SEMANTIC(KaxContentEncodings) + +DEFINE_START_SEMANTIC(KaxContentEncoding) +DEFINE_SEMANTIC_ITEM(true, true, KaxContentEncodingOrder) +DEFINE_SEMANTIC_ITEM(true, true, KaxContentEncodingScope) +DEFINE_SEMANTIC_ITEM(true, true, KaxContentEncodingType) +DEFINE_SEMANTIC_ITEM(false, true, KaxContentCompression) +DEFINE_SEMANTIC_ITEM(false, true, KaxContentEncryption) +DEFINE_END_SEMANTIC(KaxContentEncoding) + +DEFINE_START_SEMANTIC(KaxContentCompression) +DEFINE_SEMANTIC_ITEM(true, true, KaxContentCompAlgo) +DEFINE_SEMANTIC_ITEM(false, true, KaxContentCompSettings) +DEFINE_END_SEMANTIC(KaxContentCompression) + +DEFINE_START_SEMANTIC(KaxContentEncryption) +DEFINE_SEMANTIC_ITEM(false, true, KaxContentEncAlgo) +DEFINE_SEMANTIC_ITEM(false, true, KaxContentEncKeyID) +DEFINE_SEMANTIC_ITEM(false, true, KaxContentSignature) +DEFINE_SEMANTIC_ITEM(false, true, KaxContentSigKeyID) +DEFINE_SEMANTIC_ITEM(false, true, KaxContentSigAlgo) +DEFINE_SEMANTIC_ITEM(false, true, KaxContentSigHashAlgo) +DEFINE_END_SEMANTIC(KaxContentEncryption) + +DEFINE_MKX_MASTER (KaxContentEncodings, 0x6d80, 2, KaxTrackEntry, "ContentEncodings"); +DEFINE_MKX_MASTER (KaxContentEncoding, 0x6240, 2, KaxContentEncodings, "ContentEncoding"); +DEFINE_MKX_UINTEGER_DEF(KaxContentEncodingOrder, 0x5031, 2, KaxContentEncoding, "ContentEncodingOrder", 0); +DEFINE_MKX_UINTEGER_DEF(KaxContentEncodingScope, 0x5032, 2, KaxContentEncoding, "ContentEncodingScope", 1); +DEFINE_MKX_UINTEGER_DEF(KaxContentEncodingType, 0x5033, 2, KaxContentEncoding, "ContentEncodingType", 0); +DEFINE_MKX_MASTER (KaxContentCompression, 0x5034, 2, KaxContentEncoding, "ContentCompression"); +DEFINE_MKX_UINTEGER_DEF(KaxContentCompAlgo, 0x4254, 2, KaxContentCompression, "ContentCompAlgo", 0); +DEFINE_MKX_BINARY (KaxContentCompSettings, 0x4255, 2, KaxContentCompression, "ContentCompSettings"); +DEFINE_MKX_MASTER (KaxContentEncryption, 0x5035, 2, KaxContentEncoding, "ContentEncryption"); +DEFINE_MKX_UINTEGER_DEF(KaxContentEncAlgo, 0x47e1, 2, KaxContentEncryption, "ContentEncAlgo", 0); +DEFINE_MKX_BINARY (KaxContentEncKeyID, 0x47e2, 2, KaxContentEncryption, "ContentEncKeyID"); +DEFINE_MKX_BINARY (KaxContentSignature, 0x47e3, 2, KaxContentEncryption, "ContentSignature"); +DEFINE_MKX_BINARY (KaxContentSigKeyID, 0x47e4, 2, KaxContentEncryption, "ContentSigKeyID"); +DEFINE_MKX_UINTEGER_DEF(KaxContentSigAlgo, 0x47e5, 2, KaxContentEncryption, "ContentSigAlgo", 0); +DEFINE_MKX_UINTEGER_DEF(KaxContentSigHashAlgo, 0x47e6, 2, KaxContentEncryption, "ContentSigHashAlgo", 0); + +END_LIBMATROSKA_NAMESPACE diff --git a/src/KaxCuesData.cpp b/src/KaxCuesData.cpp index a2f1e3d..ad5c493 100644 --- a/src/KaxCuesData.cpp +++ b/src/KaxCuesData.cpp @@ -1,279 +1,279 @@ -/**************************************************************************** -** libmatroska : parse Matroska files, see http://www.matroska.org/ -** -** -** -** Copyright (C) 2002-2010 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: KaxCuesData.cpp 1265 2007-01-14 17:20:35Z mosu $ - \author Steve Lhomme -*/ -#include - -#include "matroska/KaxCuesData.h" -#include "matroska/KaxContexts.h" -#include "matroska/KaxBlock.h" -#include "matroska/KaxBlockData.h" -#include "matroska/KaxCluster.h" -#include "matroska/KaxSegment.h" -#include "matroska/KaxDefines.h" - -START_LIBMATROSKA_NAMESPACE - -DEFINE_START_SEMANTIC(KaxCuePoint) -DEFINE_SEMANTIC_ITEM(true, true, KaxCueTime) -DEFINE_SEMANTIC_ITEM(true, false, KaxCueTrackPositions) -DEFINE_END_SEMANTIC(KaxCuePoint) - -DEFINE_START_SEMANTIC(KaxCueTrackPositions) -DEFINE_SEMANTIC_ITEM(true, true, KaxCueTrack) -DEFINE_SEMANTIC_ITEM(true, true, KaxCueClusterPosition) -DEFINE_SEMANTIC_ITEM(false, true, KaxCueBlockNumber) -#if MATROSKA_VERSION >= 2 -DEFINE_SEMANTIC_ITEM(false, true, KaxCueCodecState) -DEFINE_SEMANTIC_ITEM(false, false, KaxCueReference) -#endif // MATROSKA_VERSION -DEFINE_END_SEMANTIC(KaxCueTrackPositions) - -#if MATROSKA_VERSION >= 2 -DEFINE_START_SEMANTIC(KaxCueReference) -DEFINE_SEMANTIC_ITEM(true, true, KaxCueRefTime) -DEFINE_SEMANTIC_ITEM(true, true, KaxCueRefCluster) -DEFINE_SEMANTIC_ITEM(false, true, KaxCueRefNumber) -DEFINE_SEMANTIC_ITEM(false, true, KaxCueRefCodecState) -DEFINE_END_SEMANTIC(KaxCueReference) -#endif // MATROSKA_VERSION - -DEFINE_MKX_MASTER (KaxCuePoint, 0xBB, 1, KaxCues, "CuePoint"); -DEFINE_MKX_UINTEGER (KaxCueTime, 0xB3, 1, KaxCuePoint, "CueTime"); -DEFINE_MKX_MASTER (KaxCueTrackPositions, 0xB7, 1, KaxCuePoint, "CueTrackPositions"); -DEFINE_MKX_UINTEGER (KaxCueTrack, 0xF7, 1, KaxCueTrackPositions, "CueTrack"); -DEFINE_MKX_UINTEGER (KaxCueClusterPosition, 0xF1, 1, KaxCueTrackPositions, "CueClusterPosition"); -DEFINE_MKX_UINTEGER_DEF(KaxCueBlockNumber, 0x5378, 2, KaxCueTrackPositions, "CueBlockNumber", 1); -#if MATROSKA_VERSION >= 2 -DEFINE_MKX_UINTEGER_DEF(KaxCueCodecState, 0xEA, 1, KaxCueTrackPositions, "CueCodecState", 0); -DEFINE_MKX_MASTER (KaxCueReference, 0xDB, 1, KaxCueTrackPositions, "CueReference"); -DEFINE_MKX_UINTEGER (KaxCueRefTime, 0x96, 1, KaxCueReference, "CueRefTime"); -DEFINE_MKX_UINTEGER (KaxCueRefCluster, 0x97, 1, KaxCueRefTime, "CueRefCluster"); -DEFINE_MKX_UINTEGER_DEF(KaxCueRefNumber, 0x535F, 2, KaxCueRefTime, "CueRefNumber", 1); -DEFINE_MKX_UINTEGER_DEF(KaxCueRefCodecState, 0xEB, 1, KaxCueRefTime, "CueRefCodecState", 0); -#endif - -/*! - \todo handle codec state checking - \todo remove duplicate references (reference to 2 frames that each reference the same frame) -*/ -void KaxCuePoint::PositionSet(const KaxBlockGroup & BlockReference, uint64 GlobalTimecodeScale) -{ - // fill me - KaxCueTime & NewTime = GetChild(*this); - *static_cast(&NewTime) = BlockReference.GlobalTimecode() / GlobalTimecodeScale; - - KaxCueTrackPositions & NewPositions = AddNewChild(*this); - KaxCueTrack & TheTrack = GetChild(NewPositions); - *static_cast(&TheTrack) = BlockReference.TrackNumber(); - - KaxCueClusterPosition & TheClustPos = GetChild(NewPositions); - *static_cast(&TheClustPos) = BlockReference.ClusterPosition(); - -#if MATROSKA_VERSION >= 2 - // handle reference use - if (BlockReference.ReferenceCount() != 0) - { - unsigned int i; - for (i=0; i(NewPositions); - NewRefs.AddReference(BlockReference.Reference(i).RefBlock(), GlobalTimecodeScale); - } - } - - KaxCodecState *CodecState = static_cast(BlockReference.FindFirstElt(EBML_INFO(KaxCodecState))); - if (CodecState != NULL) { - KaxCueCodecState &CueCodecState = AddNewChild(NewPositions); - *static_cast(&CueCodecState) = BlockReference.GetParentCluster()->GetParentSegment()->GetRelativePosition(CodecState->GetElementPosition()); - } -#endif // MATROSKA_VERSION - - SetValueIsSet(); -} - -void KaxCuePoint::PositionSet(const KaxBlockBlob & BlobReference, uint64 GlobalTimecodeScale) -{ - const KaxInternalBlock &BlockReference = BlobReference; - - // fill me - KaxCueTime & NewTime = GetChild(*this); - *static_cast(&NewTime) = BlockReference.GlobalTimecode() / GlobalTimecodeScale; - - KaxCueTrackPositions & NewPositions = AddNewChild(*this); - KaxCueTrack & TheTrack = GetChild(NewPositions); - *static_cast(&TheTrack) = BlockReference.TrackNum(); - - KaxCueClusterPosition & TheClustPos = GetChild(NewPositions); - *static_cast(&TheClustPos) = BlockReference.ClusterPosition(); - -#if 0 // MATROSKA_VERSION >= 2 - // handle reference use - if (BlockReference.ReferenceCount() != 0) - { - unsigned int i; - for (i=0; i(NewPositions); - NewRefs.AddReference(BlockReference.Reference(i).RefBlock(), GlobalTimecodeScale); - } - } -#endif // MATROSKA_VERSION - -#if MATROSKA_VERSION >= 2 - if (!BlobReference.IsSimpleBlock()) { - const KaxBlockGroup &BlockGroup = BlobReference; - const KaxCodecState *CodecState = static_cast(BlockGroup.FindFirstElt(EBML_INFO(KaxCodecState))); - if (CodecState != NULL) { - KaxCueCodecState &CueCodecState = AddNewChild(NewPositions); - *static_cast(&CueCodecState) = BlockGroup.GetParentCluster()->GetParentSegment()->GetRelativePosition(CodecState->GetElementPosition()); - } - } -#endif // MATROSKA_VERSION - - SetValueIsSet(); -} - -#if MATROSKA_VERSION >= 2 -/*! - \todo handle codec state checking -*/ -void KaxCueReference::AddReference(const KaxBlockBlob & BlockReference, uint64 GlobalTimecodeScale) -{ - const KaxInternalBlock & theBlock = BlockReference; - KaxCueRefTime & NewTime = GetChild(*this); - *static_cast(&NewTime) = theBlock.GlobalTimecode() / GlobalTimecodeScale; - - KaxCueRefCluster & TheClustPos = GetChild(*this); - *static_cast(&TheClustPos) = theBlock.ClusterPosition(); - -#ifdef OLD - // handle recursive reference use - if (BlockReference.ReferenceCount() != 0) - { - unsigned int i; - for (i=0; i(EltB); - - // compare timecode - const KaxCueTime * TimeCodeA = static_cast(FindElt(EBML_INFO(KaxCueTime))); - if (TimeCodeA == NULL) - return false; - - const KaxCueTime * TimeCodeB = static_cast(theEltB.FindElt(EBML_INFO(KaxCueTime))); - if (TimeCodeB == NULL) - return false; - - if (TimeCodeA->IsSmallerThan(TimeCodeB)) - return true; - - if (TimeCodeB->IsSmallerThan(TimeCodeA)) - return false; - - // compare tracks (timecodes are equal) - const KaxCueTrack * TrackA = static_cast(FindElt(EBML_INFO(KaxCueTrack))); - if (TrackA == NULL) - return false; - - const KaxCueTrack * TrackB = static_cast(theEltB.FindElt(EBML_INFO(KaxCueTrack))); - if (TrackB == NULL) - return false; - - if (TrackA->IsSmallerThan(TrackB)) - return true; - - if (TrackB->IsSmallerThan(TrackA)) - return false; - - return false; -} - -bool KaxCuePoint::Timecode(uint64 & aTimecode, uint64 GlobalTimecodeScale) const -{ - const KaxCueTime *aTime = static_cast(FindFirstElt(EBML_INFO(KaxCueTime))); - if (aTime == NULL) - return false; - aTimecode = uint64(*aTime) * GlobalTimecodeScale; - return true; -} - -/*! - \brief return the position of the Cluster to load -*/ -const KaxCueTrackPositions * KaxCuePoint::GetSeekPosition() const -{ - const KaxCueTrackPositions * result = NULL; - uint64 aPosition = EBML_PRETTYLONGINT(0xFFFFFFFFFFFFFFF); - // find the position of the "earlier" Cluster - const KaxCueTrackPositions *aPoss = static_cast(FindFirstElt(EBML_INFO(KaxCueTrackPositions))); - while (aPoss != NULL) - { - const KaxCueClusterPosition *aPos = static_cast(aPoss->FindFirstElt(EBML_INFO(KaxCueClusterPosition))); - if (aPos != NULL && uint64(*aPos) < aPosition) { - aPosition = uint64(*aPos); - result = aPoss; - } - - aPoss = static_cast(FindNextElt(*aPoss)); - } - return result; -} - -uint64 KaxCueTrackPositions::ClusterPosition() const -{ - const KaxCueClusterPosition *aPos = static_cast(FindFirstElt(EBML_INFO(KaxCueClusterPosition))); - if (aPos == NULL) - return 0; - - return uint64(*aPos); -} - -uint16 KaxCueTrackPositions::TrackNumber() const -{ - const KaxCueTrack *aTrack = static_cast(FindFirstElt(EBML_INFO(KaxCueTrack))); - if (aTrack == NULL) - return 0; - - return uint16(*aTrack); -} - - -END_LIBMATROSKA_NAMESPACE +/**************************************************************************** +** libmatroska : parse Matroska files, see http://www.matroska.org/ +** +** +** +** Copyright (C) 2002-2010 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: KaxCuesData.cpp 1265 2007-01-14 17:20:35Z mosu $ + \author Steve Lhomme +*/ +#include + +#include "matroska/KaxCuesData.h" +#include "matroska/KaxContexts.h" +#include "matroska/KaxBlock.h" +#include "matroska/KaxBlockData.h" +#include "matroska/KaxCluster.h" +#include "matroska/KaxSegment.h" +#include "matroska/KaxDefines.h" + +START_LIBMATROSKA_NAMESPACE + +DEFINE_START_SEMANTIC(KaxCuePoint) +DEFINE_SEMANTIC_ITEM(true, true, KaxCueTime) +DEFINE_SEMANTIC_ITEM(true, false, KaxCueTrackPositions) +DEFINE_END_SEMANTIC(KaxCuePoint) + +DEFINE_START_SEMANTIC(KaxCueTrackPositions) +DEFINE_SEMANTIC_ITEM(true, true, KaxCueTrack) +DEFINE_SEMANTIC_ITEM(true, true, KaxCueClusterPosition) +DEFINE_SEMANTIC_ITEM(false, true, KaxCueBlockNumber) +#if MATROSKA_VERSION >= 2 +DEFINE_SEMANTIC_ITEM(false, true, KaxCueCodecState) +DEFINE_SEMANTIC_ITEM(false, false, KaxCueReference) +#endif // MATROSKA_VERSION +DEFINE_END_SEMANTIC(KaxCueTrackPositions) + +#if MATROSKA_VERSION >= 2 +DEFINE_START_SEMANTIC(KaxCueReference) +DEFINE_SEMANTIC_ITEM(true, true, KaxCueRefTime) +DEFINE_SEMANTIC_ITEM(true, true, KaxCueRefCluster) +DEFINE_SEMANTIC_ITEM(false, true, KaxCueRefNumber) +DEFINE_SEMANTIC_ITEM(false, true, KaxCueRefCodecState) +DEFINE_END_SEMANTIC(KaxCueReference) +#endif // MATROSKA_VERSION + +DEFINE_MKX_MASTER (KaxCuePoint, 0xBB, 1, KaxCues, "CuePoint"); +DEFINE_MKX_UINTEGER (KaxCueTime, 0xB3, 1, KaxCuePoint, "CueTime"); +DEFINE_MKX_MASTER (KaxCueTrackPositions, 0xB7, 1, KaxCuePoint, "CueTrackPositions"); +DEFINE_MKX_UINTEGER (KaxCueTrack, 0xF7, 1, KaxCueTrackPositions, "CueTrack"); +DEFINE_MKX_UINTEGER (KaxCueClusterPosition, 0xF1, 1, KaxCueTrackPositions, "CueClusterPosition"); +DEFINE_MKX_UINTEGER_DEF(KaxCueBlockNumber, 0x5378, 2, KaxCueTrackPositions, "CueBlockNumber", 1); +#if MATROSKA_VERSION >= 2 +DEFINE_MKX_UINTEGER_DEF(KaxCueCodecState, 0xEA, 1, KaxCueTrackPositions, "CueCodecState", 0); +DEFINE_MKX_MASTER (KaxCueReference, 0xDB, 1, KaxCueTrackPositions, "CueReference"); +DEFINE_MKX_UINTEGER (KaxCueRefTime, 0x96, 1, KaxCueReference, "CueRefTime"); +DEFINE_MKX_UINTEGER (KaxCueRefCluster, 0x97, 1, KaxCueReference, "CueRefCluster"); +DEFINE_MKX_UINTEGER_DEF(KaxCueRefNumber, 0x535F, 2, KaxCueReference, "CueRefNumber", 1); +DEFINE_MKX_UINTEGER_DEF(KaxCueRefCodecState, 0xEB, 1, KaxCueReference, "CueRefCodecState", 0); +#endif + +/*! + \todo handle codec state checking + \todo remove duplicate references (reference to 2 frames that each reference the same frame) +*/ +void KaxCuePoint::PositionSet(const KaxBlockGroup & BlockReference, uint64 GlobalTimecodeScale) +{ + // fill me + KaxCueTime & NewTime = GetChild(*this); + *static_cast(&NewTime) = BlockReference.GlobalTimecode() / GlobalTimecodeScale; + + KaxCueTrackPositions & NewPositions = AddNewChild(*this); + KaxCueTrack & TheTrack = GetChild(NewPositions); + *static_cast(&TheTrack) = BlockReference.TrackNumber(); + + KaxCueClusterPosition & TheClustPos = GetChild(NewPositions); + *static_cast(&TheClustPos) = BlockReference.ClusterPosition(); + +#if MATROSKA_VERSION >= 2 + // handle reference use + if (BlockReference.ReferenceCount() != 0) + { + unsigned int i; + for (i=0; i(NewPositions); + NewRefs.AddReference(BlockReference.Reference(i).RefBlock(), GlobalTimecodeScale); + } + } + + KaxCodecState *CodecState = static_cast(BlockReference.FindFirstElt(EBML_INFO(KaxCodecState))); + if (CodecState != NULL) { + KaxCueCodecState &CueCodecState = AddNewChild(NewPositions); + *static_cast(&CueCodecState) = BlockReference.GetParentCluster()->GetParentSegment()->GetRelativePosition(CodecState->GetElementPosition()); + } +#endif // MATROSKA_VERSION + + SetValueIsSet(); +} + +void KaxCuePoint::PositionSet(const KaxBlockBlob & BlobReference, uint64 GlobalTimecodeScale) +{ + const KaxInternalBlock &BlockReference = BlobReference; + + // fill me + KaxCueTime & NewTime = GetChild(*this); + *static_cast(&NewTime) = BlockReference.GlobalTimecode() / GlobalTimecodeScale; + + KaxCueTrackPositions & NewPositions = AddNewChild(*this); + KaxCueTrack & TheTrack = GetChild(NewPositions); + *static_cast(&TheTrack) = BlockReference.TrackNum(); + + KaxCueClusterPosition & TheClustPos = GetChild(NewPositions); + *static_cast(&TheClustPos) = BlockReference.ClusterPosition(); + +#if 0 // MATROSKA_VERSION >= 2 + // handle reference use + if (BlockReference.ReferenceCount() != 0) + { + unsigned int i; + for (i=0; i(NewPositions); + NewRefs.AddReference(BlockReference.Reference(i).RefBlock(), GlobalTimecodeScale); + } + } +#endif // MATROSKA_VERSION + +#if MATROSKA_VERSION >= 2 + if (!BlobReference.IsSimpleBlock()) { + const KaxBlockGroup &BlockGroup = BlobReference; + const KaxCodecState *CodecState = static_cast(BlockGroup.FindFirstElt(EBML_INFO(KaxCodecState))); + if (CodecState != NULL) { + KaxCueCodecState &CueCodecState = AddNewChild(NewPositions); + *static_cast(&CueCodecState) = BlockGroup.GetParentCluster()->GetParentSegment()->GetRelativePosition(CodecState->GetElementPosition()); + } + } +#endif // MATROSKA_VERSION + + SetValueIsSet(); +} + +#if MATROSKA_VERSION >= 2 +/*! + \todo handle codec state checking +*/ +void KaxCueReference::AddReference(const KaxBlockBlob & BlockReference, uint64 GlobalTimecodeScale) +{ + const KaxInternalBlock & theBlock = BlockReference; + KaxCueRefTime & NewTime = GetChild(*this); + *static_cast(&NewTime) = theBlock.GlobalTimecode() / GlobalTimecodeScale; + + KaxCueRefCluster & TheClustPos = GetChild(*this); + *static_cast(&TheClustPos) = theBlock.ClusterPosition(); + +#ifdef OLD + // handle recursive reference use + if (BlockReference.ReferenceCount() != 0) + { + unsigned int i; + for (i=0; i(EltB); + + // compare timecode + const KaxCueTime * TimeCodeA = static_cast(FindElt(EBML_INFO(KaxCueTime))); + if (TimeCodeA == NULL) + return false; + + const KaxCueTime * TimeCodeB = static_cast(theEltB.FindElt(EBML_INFO(KaxCueTime))); + if (TimeCodeB == NULL) + return false; + + if (TimeCodeA->IsSmallerThan(TimeCodeB)) + return true; + + if (TimeCodeB->IsSmallerThan(TimeCodeA)) + return false; + + // compare tracks (timecodes are equal) + const KaxCueTrack * TrackA = static_cast(FindElt(EBML_INFO(KaxCueTrack))); + if (TrackA == NULL) + return false; + + const KaxCueTrack * TrackB = static_cast(theEltB.FindElt(EBML_INFO(KaxCueTrack))); + if (TrackB == NULL) + return false; + + if (TrackA->IsSmallerThan(TrackB)) + return true; + + if (TrackB->IsSmallerThan(TrackA)) + return false; + + return false; +} + +bool KaxCuePoint::Timecode(uint64 & aTimecode, uint64 GlobalTimecodeScale) const +{ + const KaxCueTime *aTime = static_cast(FindFirstElt(EBML_INFO(KaxCueTime))); + if (aTime == NULL) + return false; + aTimecode = uint64(*aTime) * GlobalTimecodeScale; + return true; +} + +/*! + \brief return the position of the Cluster to load +*/ +const KaxCueTrackPositions * KaxCuePoint::GetSeekPosition() const +{ + const KaxCueTrackPositions * result = NULL; + uint64 aPosition = EBML_PRETTYLONGINT(0xFFFFFFFFFFFFFFF); + // find the position of the "earlier" Cluster + const KaxCueTrackPositions *aPoss = static_cast(FindFirstElt(EBML_INFO(KaxCueTrackPositions))); + while (aPoss != NULL) + { + const KaxCueClusterPosition *aPos = static_cast(aPoss->FindFirstElt(EBML_INFO(KaxCueClusterPosition))); + if (aPos != NULL && uint64(*aPos) < aPosition) { + aPosition = uint64(*aPos); + result = aPoss; + } + + aPoss = static_cast(FindNextElt(*aPoss)); + } + return result; +} + +uint64 KaxCueTrackPositions::ClusterPosition() const +{ + const KaxCueClusterPosition *aPos = static_cast(FindFirstElt(EBML_INFO(KaxCueClusterPosition))); + if (aPos == NULL) + return 0; + + return uint64(*aPos); +} + +uint16 KaxCueTrackPositions::TrackNumber() const +{ + const KaxCueTrack *aTrack = static_cast(FindFirstElt(EBML_INFO(KaxCueTrack))); + if (aTrack == NULL) + return 0; + + return uint16(*aTrack); +} + + +END_LIBMATROSKA_NAMESPACE diff --git a/src/KaxSegment.cpp b/src/KaxSegment.cpp index d108d9c..16355e0 100644 --- a/src/KaxSegment.cpp +++ b/src/KaxSegment.cpp @@ -1,109 +1,109 @@ -/**************************************************************************** -** libmatroska : parse Matroska files, see http://www.matroska.org/ -** -** -** -** Copyright (C) 2002-2010 Steve Lhomme. All rights reserved. -** -** This file is part of libmatroska. -** -** 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: KaxSegment.cpp 1096 2005-03-17 09:14:52Z robux4 $ - \author Steve Lhomme -*/ -#include "matroska/KaxSegment.h" -#include "ebml/EbmlHead.h" - -// sub elements -#include "matroska/KaxCluster.h" -#include "matroska/KaxSeekHead.h" -#include "matroska/KaxCues.h" -#include "matroska/KaxTracks.h" -#include "matroska/KaxInfo.h" -#include "matroska/KaxChapters.h" -#include "matroska/KaxAttachments.h" -#include "matroska/KaxTags.h" -#include "matroska/KaxContexts.h" -#include "matroska/KaxDefines.h" - -START_LIBMATROSKA_NAMESPACE - -DEFINE_START_SEMANTIC(KaxMatroska) -DEFINE_SEMANTIC_ITEM(true, true, EbmlHead) -DEFINE_SEMANTIC_ITEM(true, false, KaxSegment) -DEFINE_END_SEMANTIC(KaxMatroska) - -DEFINE_START_SEMANTIC(KaxSegment) -DEFINE_SEMANTIC_ITEM(false, false, KaxCluster) -DEFINE_SEMANTIC_ITEM(false, false, KaxSeekHead) -DEFINE_SEMANTIC_ITEM(false, true, KaxCues) -DEFINE_SEMANTIC_ITEM(false, false, KaxTracks) -DEFINE_SEMANTIC_ITEM(true, true, KaxInfo) -DEFINE_SEMANTIC_ITEM(false, true, KaxChapters) -DEFINE_SEMANTIC_ITEM(false, true, KaxAttachments) -DEFINE_SEMANTIC_ITEM(false, true, KaxTags) -DEFINE_END_SEMANTIC(KaxSegment) - -DEFINE_MKX_CONTEXT(KaxMatroska); - -DEFINE_MKX_MASTER_ORPHAN(KaxSegment, 0x18538067, 4, "Segment\0rotomopogo"); - -KaxSegment::KaxSegment(EBML_EXTRA_DEF) - :EbmlMaster(EBML_CLASS_SEMCONTEXT(KaxSegment) EBML_DEF_SEP EBML_EXTRA_CALL) -{ - SetSizeLength(5); // mandatory min size support (for easier updating) (2^(7*5)-2 = 32Go) - SetSizeInfinite(); // by default a segment is big and the size is unknown in advance -} - -KaxSegment::KaxSegment(const KaxSegment & ElementToClone) - :EbmlMaster(ElementToClone) -{ - // update the parent of each children - EBML_MASTER_ITERATOR Itr = begin(); - while (Itr != end()) - { - if (EbmlId(**Itr) == EBML_ID(KaxCluster)) { - static_cast(*Itr)->SetParent(*this); - } - ++Itr; - } -} - - -uint64 KaxSegment::GetRelativePosition(uint64 aGlobalPosition) const -{ - return aGlobalPosition - GetElementPosition() - HeadSize(); -} - -uint64 KaxSegment::GetRelativePosition(const EbmlElement & Elt) const -{ - return GetRelativePosition(Elt.GetElementPosition()); -} - -uint64 KaxSegment::GetGlobalPosition(uint64 aRelativePosition) const -{ - return aRelativePosition + GetElementPosition() + HeadSize(); -} - -END_LIBMATROSKA_NAMESPACE +/**************************************************************************** +** libmatroska : parse Matroska files, see http://www.matroska.org/ +** +** +** +** Copyright (C) 2002-2010 Steve Lhomme. All rights reserved. +** +** This file is part of libmatroska. +** +** 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: KaxSegment.cpp 1096 2005-03-17 09:14:52Z robux4 $ + \author Steve Lhomme +*/ +#include "matroska/KaxSegment.h" +#include "ebml/EbmlHead.h" + +// sub elements +#include "matroska/KaxCluster.h" +#include "matroska/KaxSeekHead.h" +#include "matroska/KaxCues.h" +#include "matroska/KaxTracks.h" +#include "matroska/KaxInfo.h" +#include "matroska/KaxChapters.h" +#include "matroska/KaxAttachments.h" +#include "matroska/KaxTags.h" +#include "matroska/KaxContexts.h" +#include "matroska/KaxDefines.h" + +START_LIBMATROSKA_NAMESPACE + +DEFINE_START_SEMANTIC(KaxMatroska) +DEFINE_SEMANTIC_ITEM(true, true, EbmlHead) +DEFINE_SEMANTIC_ITEM(true, false, KaxSegment) +DEFINE_END_SEMANTIC(KaxMatroska) + +DEFINE_START_SEMANTIC(KaxSegment) +DEFINE_SEMANTIC_ITEM(false, false, KaxCluster) +DEFINE_SEMANTIC_ITEM(false, false, KaxSeekHead) +DEFINE_SEMANTIC_ITEM(false, true, KaxCues) +DEFINE_SEMANTIC_ITEM(false, false, KaxTracks) +DEFINE_SEMANTIC_ITEM(true, false, KaxInfo) +DEFINE_SEMANTIC_ITEM(false, true, KaxChapters) +DEFINE_SEMANTIC_ITEM(false, true, KaxAttachments) +DEFINE_SEMANTIC_ITEM(false, false, KaxTags) +DEFINE_END_SEMANTIC(KaxSegment) + +DEFINE_MKX_CONTEXT(KaxMatroska); + +DEFINE_MKX_MASTER_ORPHAN(KaxSegment, 0x18538067, 4, "Segment\0rotomopogo"); + +KaxSegment::KaxSegment(EBML_EXTRA_DEF) + :EbmlMaster(EBML_CLASS_SEMCONTEXT(KaxSegment) EBML_DEF_SEP EBML_EXTRA_CALL) +{ + SetSizeLength(5); // mandatory min size support (for easier updating) (2^(7*5)-2 = 32Go) + SetSizeInfinite(); // by default a segment is big and the size is unknown in advance +} + +KaxSegment::KaxSegment(const KaxSegment & ElementToClone) + :EbmlMaster(ElementToClone) +{ + // update the parent of each children + EBML_MASTER_ITERATOR Itr = begin(); + while (Itr != end()) + { + if (EbmlId(**Itr) == EBML_ID(KaxCluster)) { + static_cast(*Itr)->SetParent(*this); + } + ++Itr; + } +} + + +uint64 KaxSegment::GetRelativePosition(uint64 aGlobalPosition) const +{ + return aGlobalPosition - GetElementPosition() - HeadSize(); +} + +uint64 KaxSegment::GetRelativePosition(const EbmlElement & Elt) const +{ + return GetRelativePosition(Elt.GetElementPosition()); +} + +uint64 KaxSegment::GetGlobalPosition(uint64 aRelativePosition) const +{ + return aRelativePosition + GetElementPosition() + HeadSize(); +} + +END_LIBMATROSKA_NAMESPACE diff --git a/src/KaxTrackEntryData.cpp b/src/KaxTrackEntryData.cpp index eadfe67..ca6aab8 100644 --- a/src/KaxTrackEntryData.cpp +++ b/src/KaxTrackEntryData.cpp @@ -1,79 +1,79 @@ -/**************************************************************************** -** libmatroska : parse Matroska files, see http://www.matroska.org/ -** -** -** -** Copyright (C) 2002-2010 Steve Lhomme. All rights reserved. -** -** This file is part of libmatroska. -** -** 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: KaxTrackEntryData.cpp 1201 2005-08-30 14:28:27Z robux4 $ - \author Steve Lhomme - \author John Cannon -*/ -#include "matroska/KaxTrackEntryData.h" -#include "matroska/KaxContexts.h" -#include "matroska/KaxDefines.h" - -START_LIBMATROSKA_NAMESPACE - -DEFINE_START_SEMANTIC(KaxTrackTranslate) -DEFINE_SEMANTIC_ITEM(false, false, KaxTrackTranslateEditionUID) -DEFINE_SEMANTIC_ITEM(true, true, KaxTrackTranslateCodec) -DEFINE_SEMANTIC_ITEM(true, true, KaxTrackTranslateTrackID) -DEFINE_END_SEMANTIC(KaxTrackTranslate) - -DEFINE_MKX_UINTEGER (KaxTrackNumber, 0xD7, 1, KaxTracks, "TrackNumber"); -DEFINE_MKX_UINTEGER (KaxTrackUID, 0x73C5, 2, KaxTracks, "TrackUID"); -DEFINE_MKX_UINTEGER (KaxTrackType, 0x83, 1, KaxTracks, "TrackType"); -DEFINE_MKX_UINTEGER_DEF(KaxTrackFlagDefault, 0x88, 1, KaxTracks, "TrackFlagEnabled", 1); -DEFINE_MKX_UINTEGER_DEF(KaxTrackFlagForced, 0x55AA, 2, KaxTracks, "TrackFlagForced", 0); -DEFINE_MKX_UINTEGER_DEF(KaxTrackFlagLacing, 0x9C, 1, KaxTracks, "TrackFlagLacing", 1); -DEFINE_MKX_UINTEGER_DEF(KaxTrackMinCache, 0x6DE7, 2, KaxTracks, "TrackMinCache", 0); -DEFINE_MKX_UINTEGER (KaxTrackMaxCache, 0x6DF8, 2, KaxTracks, "TrackMaxCache\0rotomodobopo"); -DEFINE_MKX_UINTEGER (KaxTrackDefaultDuration, 0x23E383, 3, KaxTracks, "TrackDefaultDuration"); -DEFINE_MKX_FLOAT_DEF (KaxTrackTimecodeScale, 0x23314F, 3, KaxTracks, "TrackTimecodeScale", 1.0); -DEFINE_MKX_UINTEGER_DEF(KaxMaxBlockAdditionID, 0x55EE, 2, KaxTracks, "MaxBlockAdditionID", 0); -//DEFINE_MKX_SINTEGER_DEF(KaxTrackOffset, 0x537F, 2, KaxTracks, "TrackOffset", 0); -DEFINE_MKX_UNISTRING (KaxTrackName, 0x536E, 2, KaxTracks, "TrackName"); -DEFINE_MKX_STRING_DEF (KaxTrackLanguage, 0x22B59C, 3, KaxTracks, "TrackLanguage", "eng"); -DEFINE_MKX_STRING (KaxCodecID, 0x86, 1, KaxTracks, "CodecID"); -DEFINE_MKX_BINARY (KaxCodecPrivate, 0x63A2, 2, KaxTracks, "CodecPrivate"); -DEFINE_MKX_UNISTRING (KaxCodecName, 0x258688, 3, KaxTracks, "CodecName"); -DEFINE_MKX_BINARY (KaxTrackAttachmentLink, 0x7446, 2, KaxTracks, "TrackAttachmentLink"); -DEFINE_MKX_UINTEGER (KaxTrackOverlay, 0x6FAB, 2, KaxTracks, "TrackOverlay"); -DEFINE_MKX_MASTER (KaxTrackTranslate, 0x6624, 2, KaxTracks, "TrackTranslate"); -DEFINE_MKX_UINTEGER (KaxTrackTranslateEditionUID, 0x66FC, 2, KaxTrackTranslate, "TrackTranslateEditionUID"); -DEFINE_MKX_UINTEGER (KaxTrackTranslateCodec, 0x66BF, 2, KaxTrackTranslate, "TrackTranslateCodec"); -DEFINE_MKX_BINARY (KaxTrackTranslateTrackID, 0x66A5, 2, KaxTrackTranslate, "TrackTranslateTrackID"); -#if MATROSKA_VERSION >= 2 -DEFINE_MKX_UINTEGER_DEF(KaxTrackFlagEnabled, 0xB9, 1, KaxTracks, "TrackFlagDefault", 1); -DEFINE_MKX_UNISTRING (KaxCodecSettings, 0x3A9697, 3, KaxTracks, "CodecSettings"); -DEFINE_MKX_STRING (KaxCodecInfoURL, 0x3B4040, 3, KaxTracks, "CodecInfoURL"); -DEFINE_MKX_STRING (KaxCodecDownloadURL, 0x26B240, 3, KaxTracks, "CodecDownloadURL"); -DEFINE_MKX_UINTEGER_DEF(KaxCodecDecodeAll, 0xAA, 1, KaxTracks, "CodecDecodeAll", 1); -#endif - -END_LIBMATROSKA_NAMESPACE +/**************************************************************************** +** libmatroska : parse Matroska files, see http://www.matroska.org/ +** +** +** +** Copyright (C) 2002-2010 Steve Lhomme. All rights reserved. +** +** This file is part of libmatroska. +** +** 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: KaxTrackEntryData.cpp 1201 2005-08-30 14:28:27Z robux4 $ + \author Steve Lhomme + \author John Cannon +*/ +#include "matroska/KaxTrackEntryData.h" +#include "matroska/KaxContexts.h" +#include "matroska/KaxDefines.h" + +START_LIBMATROSKA_NAMESPACE + +DEFINE_START_SEMANTIC(KaxTrackTranslate) +DEFINE_SEMANTIC_ITEM(false, false, KaxTrackTranslateEditionUID) +DEFINE_SEMANTIC_ITEM(true, true, KaxTrackTranslateCodec) +DEFINE_SEMANTIC_ITEM(true, true, KaxTrackTranslateTrackID) +DEFINE_END_SEMANTIC(KaxTrackTranslate) + +DEFINE_MKX_UINTEGER (KaxTrackNumber, 0xD7, 1, KaxTrackEntry, "TrackNumber"); +DEFINE_MKX_UINTEGER (KaxTrackUID, 0x73C5, 2, KaxTrackEntry, "TrackUID"); +DEFINE_MKX_UINTEGER (KaxTrackType, 0x83, 1, KaxTrackEntry, "TrackType"); +DEFINE_MKX_UINTEGER_DEF(KaxTrackFlagDefault, 0x88, 1, KaxTrackEntry, "TrackFlagDefault", 1); +DEFINE_MKX_UINTEGER_DEF(KaxTrackFlagForced, 0x55AA, 2, KaxTrackEntry, "TrackFlagForced", 0); +DEFINE_MKX_UINTEGER_DEF(KaxTrackFlagLacing, 0x9C, 1, KaxTrackEntry, "TrackFlagLacing", 1); +DEFINE_MKX_UINTEGER_DEF(KaxTrackMinCache, 0x6DE7, 2, KaxTrackEntry, "TrackMinCache", 0); +DEFINE_MKX_UINTEGER (KaxTrackMaxCache, 0x6DF8, 2, KaxTrackEntry, "TrackMaxCache\0rotomodobopo"); +DEFINE_MKX_UINTEGER (KaxTrackDefaultDuration, 0x23E383, 3, KaxTrackEntry, "TrackDefaultDuration"); +DEFINE_MKX_FLOAT_DEF (KaxTrackTimecodeScale, 0x23314F, 3, KaxTrackEntry, "TrackTimecodeScale", 1.0); +DEFINE_MKX_UINTEGER_DEF(KaxMaxBlockAdditionID, 0x55EE, 2, KaxTrackEntry, "MaxBlockAdditionID", 0); +//DEFINE_MKX_SINTEGER_DEF(KaxTrackOffset, 0x537F, 2, KaxTrackEntry, "TrackOffset", 0); +DEFINE_MKX_UNISTRING (KaxTrackName, 0x536E, 2, KaxTrackEntry, "TrackName"); +DEFINE_MKX_STRING_DEF (KaxTrackLanguage, 0x22B59C, 3, KaxTrackEntry, "TrackLanguage", "eng"); +DEFINE_MKX_STRING (KaxCodecID, 0x86, 1, KaxTrackEntry, "CodecID"); +DEFINE_MKX_BINARY (KaxCodecPrivate, 0x63A2, 2, KaxTrackEntry, "CodecPrivate"); +DEFINE_MKX_UNISTRING (KaxCodecName, 0x258688, 3, KaxTrackEntry, "CodecName"); +DEFINE_MKX_UINTEGER (KaxTrackAttachmentLink, 0x7446, 2, KaxTrackEntry, "TrackAttachmentLink"); +DEFINE_MKX_UINTEGER (KaxTrackOverlay, 0x6FAB, 2, KaxTrackEntry, "TrackOverlay"); +DEFINE_MKX_MASTER (KaxTrackTranslate, 0x6624, 2, KaxTrackEntry, "TrackTranslate"); +DEFINE_MKX_UINTEGER (KaxTrackTranslateEditionUID, 0x66FC, 2, KaxTrackTranslate, "TrackTranslateEditionUID"); +DEFINE_MKX_UINTEGER (KaxTrackTranslateCodec, 0x66BF, 2, KaxTrackTranslate, "TrackTranslateCodec"); +DEFINE_MKX_BINARY (KaxTrackTranslateTrackID, 0x66A5, 2, KaxTrackTranslate, "TrackTranslateTrackID"); +#if MATROSKA_VERSION >= 2 +DEFINE_MKX_UINTEGER_DEF(KaxTrackFlagEnabled, 0xB9, 1, KaxTrackEntry, "TrackFlagEnabled", 1); +DEFINE_MKX_UNISTRING (KaxCodecSettings, 0x3A9697, 3, KaxTrackEntry, "CodecSettings"); +DEFINE_MKX_STRING (KaxCodecInfoURL, 0x3B4040, 3, KaxTrackEntry, "CodecInfoURL"); +DEFINE_MKX_STRING (KaxCodecDownloadURL, 0x26B240, 3, KaxTrackEntry, "CodecDownloadURL"); +DEFINE_MKX_UINTEGER_DEF(KaxCodecDecodeAll, 0xAA, 1, KaxTrackEntry, "CodecDecodeAll", 1); +#endif + +END_LIBMATROSKA_NAMESPACE diff --git a/src/KaxTracks.cpp b/src/KaxTracks.cpp index 7da64e6..7331526 100644 --- a/src/KaxTracks.cpp +++ b/src/KaxTracks.cpp @@ -107,7 +107,7 @@ DEFINE_START_SEMANTIC(KaxTrackJoinBlocks) DEFINE_SEMANTIC_ITEM(true, false, KaxTrackJoinUID) DEFINE_END_SEMANTIC(KaxTrackJoinBlocks) -DEFINE_MKX_MASTER (KaxTrackOperation, 0xE2, 1, KaxTracks, "TrackOperation"); +DEFINE_MKX_MASTER (KaxTrackOperation, 0xE2, 1, KaxTrackEntry, "TrackOperation"); DEFINE_MKX_MASTER (KaxTrackCombinePlanes, 0xE3, 1, KaxTrackOperation, "TrackCombinePlanes"); DEFINE_MKX_MASTER (KaxTrackPlane, 0xE4, 1, KaxTrackCombinePlanes, "TrackPlane"); DEFINE_MKX_UINTEGER(KaxTrackPlaneUID, 0xE5, 1, KaxTrackPlane, "TrackPlaneUID"); -- 2.40.0