-/****************************************************************************\r
-** libmatroska : parse Matroska files, see http://www.matroska.org/\r
-**\r
-** <file/class description>\r
-**\r
-** Copyright (C) 2002-2010 Steve Lhomme. All rights reserved.\r
-**\r
-** This library is free software; you can redistribute it and/or\r
-** modify it under the terms of the GNU Lesser General Public\r
-** License as published by the Free Software Foundation; either\r
-** version 2.1 of the License, or (at your option) any later version.\r
-** \r
-** This library is distributed in the hope that it will be useful,\r
-** but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
-** Lesser General Public License for more details.\r
-** \r
-** You should have received a copy of the GNU Lesser General Public\r
-** License along with this library; if not, write to the Free Software\r
-** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
-**\r
-** See http://www.matroska.org/license/lgpl/ for LGPL licensing information.**\r
-** Contact license@matroska.org if any conditions of this licensing are\r
-** not clear to you.\r
-**\r
-**********************************************************************/\r
-\r
-/*!\r
- \file\r
- \version \$Id: KaxCuesData.h,v 1.8 2004/04/14 23:26:17 robux4 Exp $\r
- \author Steve Lhomme <robux4 @ users.sf.net>\r
-*/\r
-#ifndef LIBMATROSKA_CUES_DATA_H\r
-#define LIBMATROSKA_CUES_DATA_H\r
-\r
-#include "matroska/KaxTypes.h"\r
-#include "ebml/EbmlUInteger.h"\r
-#include "ebml/EbmlMaster.h"\r
-\r
-using namespace LIBEBML_NAMESPACE;\r
-\r
-START_LIBMATROSKA_NAMESPACE\r
-\r
-class KaxBlockGroup;\r
-class KaxBlockBlob;\r
-class KaxCueTrackPositions;\r
-class KaxInternalBlock;\r
-\r
-class MATROSKA_DLL_API KaxCuePoint : public EbmlMaster {\r
- public:\r
- KaxCuePoint();\r
- KaxCuePoint(const KaxCuePoint & ElementToClone) :EbmlMaster(ElementToClone) {}\r
- void PositionSet(const KaxBlockGroup & BlockReference, uint64 GlobalTimecodeScale);\r
- void PositionSet(const KaxBlockBlob & BlobReference, uint64 GlobalTimecodeScale);\r
-\r
- bool operator<(const EbmlElement & EltB) const;\r
-\r
- const KaxCueTrackPositions * GetSeekPosition() const;\r
- bool Timecode(uint64 & aTimecode, uint64 GlobalTimecodeScale) const;\r
-\r
- EBML_CONCRETE_CLASS(KaxCuePoint)\r
-};\r
-\r
-class MATROSKA_DLL_API KaxCueTime : public EbmlUInteger {\r
- public:\r
- KaxCueTime() {}\r
- KaxCueTime(const KaxCueTime & ElementToClone) :EbmlUInteger(ElementToClone) {}\r
-\r
- EBML_CONCRETE_CLASS(KaxCueTime)\r
-};\r
-\r
-class MATROSKA_DLL_API KaxCueTrackPositions : public EbmlMaster {\r
- public:\r
- KaxCueTrackPositions();\r
- KaxCueTrackPositions(const KaxCueTrackPositions & ElementToClone) :EbmlMaster(ElementToClone) {}\r
-\r
- uint64 ClusterPosition() const;\r
- uint16 TrackNumber() const;\r
-\r
- EBML_CONCRETE_CLASS(KaxCueTrackPositions)\r
-};\r
-\r
-class MATROSKA_DLL_API KaxCueTrack : public EbmlUInteger {\r
- public:\r
- KaxCueTrack() {}\r
- KaxCueTrack(const KaxCueTrack & ElementToClone) :EbmlUInteger(ElementToClone) {}\r
-\r
- EBML_CONCRETE_CLASS(KaxCueTrack)\r
-};\r
-\r
-class MATROSKA_DLL_API KaxCueClusterPosition : public EbmlUInteger {\r
- public:\r
- KaxCueClusterPosition() {}\r
- KaxCueClusterPosition(const KaxCueClusterPosition & ElementToClone) :EbmlUInteger(ElementToClone) {}\r
-\r
- EBML_CONCRETE_CLASS(KaxCueClusterPosition)\r
-};\r
-\r
-class MATROSKA_DLL_API KaxCueBlockNumber : public EbmlUInteger {\r
- public:\r
- KaxCueBlockNumber() :EbmlUInteger(1) {}\r
- KaxCueBlockNumber(const KaxCueBlockNumber & ElementToClone) :EbmlUInteger(ElementToClone) {}\r
-\r
- EBML_CONCRETE_CLASS(KaxCueBlockNumber)\r
-};\r
-\r
-#if MATROSKA_VERSION >= 2\r
-class MATROSKA_DLL_API KaxCueCodecState : public EbmlUInteger {\r
- public:\r
- KaxCueCodecState() :EbmlUInteger(0) {}\r
- KaxCueCodecState(const KaxCueCodecState & ElementToClone) :EbmlUInteger(ElementToClone) {}\r
-\r
- EBML_CONCRETE_CLASS(KaxCueCodecState)\r
-};\r
-\r
-class MATROSKA_DLL_API KaxCueReference : public EbmlMaster {\r
- public:\r
- KaxCueReference();\r
- KaxCueReference(const KaxCueReference & ElementToClone) :EbmlMaster(ElementToClone) {}\r
- \r
- void AddReference(const KaxBlockGroup & BlockReferenced, uint64 GlobalTimecodeScale);\r
- void AddReference(const KaxBlockBlob & BlockReferenced, uint64 GlobalTimecodeScale);\r
-\r
- EBML_CONCRETE_CLASS(KaxCueReference)\r
-};\r
-\r
-class MATROSKA_DLL_API KaxCueRefTime : public EbmlUInteger {\r
- public:\r
- KaxCueRefTime() {}\r
- KaxCueRefTime(const KaxCueRefTime & ElementToClone) :EbmlUInteger(ElementToClone) {}\r
-\r
- EBML_CONCRETE_CLASS(KaxCueRefTime)\r
-};\r
-\r
-class MATROSKA_DLL_API KaxCueRefCluster : public EbmlUInteger {\r
- public:\r
- KaxCueRefCluster() {}\r
- KaxCueRefCluster(const KaxCueRefCluster & ElementToClone) :EbmlUInteger(ElementToClone) {}\r
-\r
- EBML_CONCRETE_CLASS(KaxCueRefCluster)\r
-};\r
-\r
-class MATROSKA_DLL_API KaxCueRefNumber : public EbmlUInteger {\r
- public:\r
- KaxCueRefNumber() :EbmlUInteger(1) {}\r
- KaxCueRefNumber(const KaxCueRefNumber & ElementToClone) :EbmlUInteger(ElementToClone) {}\r
-\r
- EBML_CONCRETE_CLASS(KaxCueRefNumber)\r
-};\r
-\r
-class MATROSKA_DLL_API KaxCueRefCodecState : public EbmlUInteger {\r
- public:\r
- KaxCueRefCodecState() :EbmlUInteger(0) {}\r
- KaxCueRefCodecState(const KaxCueRefCodecState & ElementToClone) :EbmlUInteger(ElementToClone) {}\r
-\r
- EBML_CONCRETE_CLASS(KaxCueRefCodecState)\r
-};\r
-#endif // MATROSKA_VERSION\r
-\r
-END_LIBMATROSKA_NAMESPACE\r
-\r
-#endif // LIBMATROSKA_CUES_DATA_H\r
+/****************************************************************************
+** libmatroska : parse Matroska files, see http://www.matroska.org/
+**
+** <file/class description>
+**
+** 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.h,v 1.8 2004/04/14 23:26:17 robux4 Exp $
+ \author Steve Lhomme <robux4 @ users.sf.net>
+*/
+#ifndef LIBMATROSKA_CUES_DATA_H
+#define LIBMATROSKA_CUES_DATA_H
+
+#include "matroska/KaxTypes.h"
+#include "ebml/EbmlUInteger.h"
+#include "ebml/EbmlMaster.h"
+
+using namespace LIBEBML_NAMESPACE;
+
+START_LIBMATROSKA_NAMESPACE
+
+class KaxBlockGroup;
+class KaxBlockBlob;
+class KaxCueTrackPositions;
+class KaxInternalBlock;
+
+class MATROSKA_DLL_API KaxCuePoint : public EbmlMaster {
+ public:
+ KaxCuePoint();
+ KaxCuePoint(const KaxCuePoint & ElementToClone) :EbmlMaster(ElementToClone) {}
+ void PositionSet(const KaxBlockGroup & BlockReference, uint64 GlobalTimecodeScale);
+ void PositionSet(const KaxBlockBlob & BlobReference, uint64 GlobalTimecodeScale);
+
+ virtual bool IsSmallerThan(const EbmlElement *Cmp) const;
+
+ const KaxCueTrackPositions * GetSeekPosition() const;
+ bool Timecode(uint64 & aTimecode, uint64 GlobalTimecodeScale) const;
+
+ EBML_CONCRETE_CLASS(KaxCuePoint)
+};
+
+class MATROSKA_DLL_API KaxCueTime : public EbmlUInteger {
+ public:
+ KaxCueTime() {}
+ KaxCueTime(const KaxCueTime & ElementToClone) :EbmlUInteger(ElementToClone) {}
+
+ EBML_CONCRETE_CLASS(KaxCueTime)
+};
+
+class MATROSKA_DLL_API KaxCueTrackPositions : public EbmlMaster {
+ public:
+ KaxCueTrackPositions();
+ KaxCueTrackPositions(const KaxCueTrackPositions & ElementToClone) :EbmlMaster(ElementToClone) {}
+
+ uint64 ClusterPosition() const;
+ uint16 TrackNumber() const;
+
+ EBML_CONCRETE_CLASS(KaxCueTrackPositions)
+};
+
+class MATROSKA_DLL_API KaxCueTrack : public EbmlUInteger {
+ public:
+ KaxCueTrack() {}
+ KaxCueTrack(const KaxCueTrack & ElementToClone) :EbmlUInteger(ElementToClone) {}
+
+ EBML_CONCRETE_CLASS(KaxCueTrack)
+};
+
+class MATROSKA_DLL_API KaxCueClusterPosition : public EbmlUInteger {
+ public:
+ KaxCueClusterPosition() {}
+ KaxCueClusterPosition(const KaxCueClusterPosition & ElementToClone) :EbmlUInteger(ElementToClone) {}
+
+ EBML_CONCRETE_CLASS(KaxCueClusterPosition)
+};
+
+class MATROSKA_DLL_API KaxCueBlockNumber : public EbmlUInteger {
+ public:
+ KaxCueBlockNumber() :EbmlUInteger(1) {}
+ KaxCueBlockNumber(const KaxCueBlockNumber & ElementToClone) :EbmlUInteger(ElementToClone) {}
+
+ EBML_CONCRETE_CLASS(KaxCueBlockNumber)
+};
+
+#if MATROSKA_VERSION >= 2
+class MATROSKA_DLL_API KaxCueCodecState : public EbmlUInteger {
+ public:
+ KaxCueCodecState() :EbmlUInteger(0) {}
+ KaxCueCodecState(const KaxCueCodecState & ElementToClone) :EbmlUInteger(ElementToClone) {}
+
+ EBML_CONCRETE_CLASS(KaxCueCodecState)
+};
+
+class MATROSKA_DLL_API KaxCueReference : public EbmlMaster {
+ public:
+ KaxCueReference();
+ KaxCueReference(const KaxCueReference & ElementToClone) :EbmlMaster(ElementToClone) {}
+
+ void AddReference(const KaxBlockGroup & BlockReferenced, uint64 GlobalTimecodeScale);
+ void AddReference(const KaxBlockBlob & BlockReferenced, uint64 GlobalTimecodeScale);
+
+ EBML_CONCRETE_CLASS(KaxCueReference)
+};
+
+class MATROSKA_DLL_API KaxCueRefTime : public EbmlUInteger {
+ public:
+ KaxCueRefTime() {}
+ KaxCueRefTime(const KaxCueRefTime & ElementToClone) :EbmlUInteger(ElementToClone) {}
+
+ EBML_CONCRETE_CLASS(KaxCueRefTime)
+};
+
+class MATROSKA_DLL_API KaxCueRefCluster : public EbmlUInteger {
+ public:
+ KaxCueRefCluster() {}
+ KaxCueRefCluster(const KaxCueRefCluster & ElementToClone) :EbmlUInteger(ElementToClone) {}
+
+ EBML_CONCRETE_CLASS(KaxCueRefCluster)
+};
+
+class MATROSKA_DLL_API KaxCueRefNumber : public EbmlUInteger {
+ public:
+ KaxCueRefNumber() :EbmlUInteger(1) {}
+ KaxCueRefNumber(const KaxCueRefNumber & ElementToClone) :EbmlUInteger(ElementToClone) {}
+
+ EBML_CONCRETE_CLASS(KaxCueRefNumber)
+};
+
+class MATROSKA_DLL_API KaxCueRefCodecState : public EbmlUInteger {
+ public:
+ KaxCueRefCodecState() :EbmlUInteger(0) {}
+ KaxCueRefCodecState(const KaxCueRefCodecState & ElementToClone) :EbmlUInteger(ElementToClone) {}
+
+ EBML_CONCRETE_CLASS(KaxCueRefCodecState)
+};
+#endif // MATROSKA_VERSION
+
+END_LIBMATROSKA_NAMESPACE
+
+#endif // LIBMATROSKA_CUES_DATA_H
-/****************************************************************************\r
-** libmatroska : parse Matroska files, see http://www.matroska.org/\r
-**\r
-** <file/class description>\r
-**\r
-** Copyright (C) 2002-2010 Steve Lhomme. All rights reserved.\r
-**\r
-** This library is free software; you can redistribute it and/or\r
-** modify it under the terms of the GNU Lesser General Public\r
-** License as published by the Free Software Foundation; either\r
-** version 2.1 of the License, or (at your option) any later version.\r
-** \r
-** This library is distributed in the hope that it will be useful,\r
-** but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
-** Lesser General Public License for more details.\r
-** \r
-** You should have received a copy of the GNU Lesser General Public\r
-** License along with this library; if not, write to the Free Software\r
-** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
-**\r
-** See http://www.matroska.org/license/lgpl/ for LGPL licensing information.**\r
-** Contact license@matroska.org if any conditions of this licensing are\r
-** not clear to you.\r
-**\r
-**********************************************************************/\r
-\r
-/*!\r
- \file\r
- \version \$Id: KaxCuesData.cpp 1265 2007-01-14 17:20:35Z mosu $\r
- \author Steve Lhomme <robux4 @ users.sf.net>\r
-*/\r
-#include <cassert>\r
-\r
-#include "matroska/KaxCuesData.h"\r
-#include "matroska/KaxContexts.h"\r
-#include "matroska/KaxBlock.h"\r
-#include "matroska/KaxBlockData.h"\r
-#include "matroska/KaxCluster.h"\r
-#include "matroska/KaxSegment.h"\r
-\r
-START_LIBMATROSKA_NAMESPACE\r
-\r
-EbmlSemantic KaxCuePoint_ContextList[2] =\r
-{\r
- EbmlSemantic(true, true, EBML_INFO(KaxCueTime)),\r
- EbmlSemantic(true, false, EBML_INFO(KaxCueTrackPositions)),\r
-};\r
-\r
-#if MATROSKA_VERSION == 1\r
-EbmlSemantic KaxCueTrackPositions_ContextList[3] =\r
-#else // MATROSKA_VERSION\r
-EbmlSemantic KaxCueTrackPositions_ContextList[5] =\r
-#endif // MATROSKA_VERSION\r
-{\r
- EbmlSemantic(true, true, EBML_INFO(KaxCueTrack)),\r
- EbmlSemantic(true, true, EBML_INFO(KaxCueClusterPosition)),\r
- EbmlSemantic(false, true, EBML_INFO(KaxCueBlockNumber)),\r
-#if MATROSKA_VERSION >= 2\r
- EbmlSemantic(false, true, EBML_INFO(KaxCueCodecState)),\r
- EbmlSemantic(false, false, EBML_INFO(KaxCueReference)),\r
-#endif // MATROSKA_VERSION\r
-};\r
-\r
-#if MATROSKA_VERSION >= 2\r
-EbmlSemantic KaxCueReference_ContextList[4] =\r
-{\r
- EbmlSemantic(true, true, EBML_INFO(KaxCueRefTime)),\r
- EbmlSemantic(true, true, EBML_INFO(KaxCueRefCluster)),\r
- EbmlSemantic(false, true, EBML_INFO(KaxCueRefNumber)),\r
- EbmlSemantic(false, true, EBML_INFO(KaxCueRefCodecState)),\r
-};\r
-#endif // MATROSKA_VERSION\r
-\r
-EbmlId KaxCuePoint_TheId (0xBB, 1);\r
-EbmlId KaxCueTime_TheId (0xB3, 1);\r
-EbmlId KaxCueTrackPositions_TheId (0xB7, 1);\r
-EbmlId KaxCueTrack_TheId (0xF7, 1);\r
-EbmlId KaxCueClusterPosition_TheId(0xF1, 1);\r
-EbmlId KaxCueBlockNumber_TheId (0x5378, 2);\r
-#if MATROSKA_VERSION >= 2\r
-EbmlId KaxCueCodecState_TheId (0xEA, 1);\r
-EbmlId KaxCueReference_TheId (0xDB, 1);\r
-EbmlId KaxCueRefTime_TheId (0x96, 1);\r
-EbmlId KaxCueRefCluster_TheId (0x97, 1);\r
-EbmlId KaxCueRefNumber_TheId (0x535F, 2);\r
-EbmlId KaxCueRefCodecState_TheId (0xEB, 1);\r
-#endif // MATROSKA_VERSION\r
-\r
-const EbmlSemanticContext KaxCuePoint_Context = EbmlSemanticContext(countof(KaxCuePoint_ContextList), KaxCuePoint_ContextList, &KaxCues_Context, *GetKaxGlobal_Context, &EBML_INFO(KaxCuePoint));\r
-const EbmlSemanticContext KaxCueTime_Context = EbmlSemanticContext(0, NULL, &KaxCuePoint_Context, *GetKaxGlobal_Context, &EBML_INFO(KaxCueTime));\r
-const EbmlSemanticContext KaxCueTrackPositions_Context = EbmlSemanticContext(countof(KaxCueTrackPositions_ContextList), KaxCueTrackPositions_ContextList, &KaxCuePoint_Context, *GetKaxGlobal_Context, &EBML_INFO(KaxCueTrackPositions));\r
-const EbmlSemanticContext KaxCueTrack_Context = EbmlSemanticContext(0, NULL, &KaxCueTrackPositions_Context, *GetKaxGlobal_Context, &EBML_INFO(KaxCueTrack));\r
-const EbmlSemanticContext KaxCueClusterPosition_Context = EbmlSemanticContext(0, NULL, &KaxCueTrackPositions_Context, *GetKaxGlobal_Context, &EBML_INFO(KaxCueClusterPosition));\r
-const EbmlSemanticContext KaxCueBlockNumber_Context = EbmlSemanticContext(0, NULL, &KaxCueTrackPositions_Context, *GetKaxGlobal_Context, &EBML_INFO(KaxCueBlockNumber));\r
-#if MATROSKA_VERSION >= 2\r
-const EbmlSemanticContext KaxCueCodecState_Context = EbmlSemanticContext(0, NULL, &KaxCueTrackPositions_Context, *GetKaxGlobal_Context, &EBML_INFO(KaxCueCodecState));\r
-const EbmlSemanticContext KaxCueReference_Context = EbmlSemanticContext(countof(KaxCueReference_ContextList), KaxCueReference_ContextList, &KaxCueTrackPositions_Context, *GetKaxGlobal_Context, &EBML_INFO(KaxCueReference));\r
-const EbmlSemanticContext KaxCueRefTime_Context = EbmlSemanticContext(0, NULL, &KaxCueReference_Context, *GetKaxGlobal_Context, &EBML_INFO(KaxCueRefTime));\r
-const EbmlSemanticContext KaxCueRefCluster_Context = EbmlSemanticContext(0, NULL, &KaxCueRefTime_Context, *GetKaxGlobal_Context, &EBML_INFO(KaxCueRefCluster));\r
-const EbmlSemanticContext KaxCueRefNumber_Context = EbmlSemanticContext(0, NULL, &KaxCueRefTime_Context, *GetKaxGlobal_Context, &EBML_INFO(KaxCueRefNumber));\r
-const EbmlSemanticContext KaxCueRefCodecState_Context = EbmlSemanticContext(0, NULL, &KaxCueRefTime_Context, *GetKaxGlobal_Context, &EBML_INFO(KaxCueRefCodecState));\r
-#endif // MATROSKA_VERSION\r
-\r
-const EbmlCallbacks KaxCuePoint::ClassInfos(KaxCuePoint::Create, KaxCuePoint_TheId, "CuePoint", KaxCuePoint_Context);\r
-const EbmlCallbacks KaxCueTime::ClassInfos(KaxCueTime::Create, KaxCueTime_TheId, "CueTime", KaxCueTime_Context);\r
-const EbmlCallbacks KaxCueTrackPositions::ClassInfos(KaxCueTrackPositions::Create, KaxCueTrackPositions_TheId, "CueTrackPositions", KaxCueTrackPositions_Context);\r
-const EbmlCallbacks KaxCueTrack::ClassInfos(KaxCueTrack::Create, KaxCueTrack_TheId, "CueTrack", KaxCueTrack_Context);\r
-const EbmlCallbacks KaxCueClusterPosition::ClassInfos(KaxCueClusterPosition::Create, KaxCueClusterPosition_TheId, "CueClusterPosition", KaxCueClusterPosition_Context);\r
-const EbmlCallbacks KaxCueBlockNumber::ClassInfos(KaxCueBlockNumber::Create, KaxCueBlockNumber_TheId, "CueBlockNumber", KaxCueBlockNumber_Context);\r
-#if MATROSKA_VERSION >= 2\r
-const EbmlCallbacks KaxCueCodecState::ClassInfos(KaxCueCodecState::Create, KaxCueCodecState_TheId, "CueCodecState", KaxCueCodecState_Context);\r
-const EbmlCallbacks KaxCueReference::ClassInfos(KaxCueReference::Create, KaxCueReference_TheId, "CueReference", KaxCueReference_Context);\r
-const EbmlCallbacks KaxCueRefTime::ClassInfos(KaxCueRefTime::Create, KaxCueRefTime_TheId, "CueRefTime", KaxCueRefTime_Context);\r
-const EbmlCallbacks KaxCueRefCluster::ClassInfos(KaxCueRefCluster::Create, KaxCueRefCluster_TheId, "CueRefCluster", KaxCueRefCluster_Context);\r
-const EbmlCallbacks KaxCueRefNumber::ClassInfos(KaxCueRefNumber::Create, KaxCueRefNumber_TheId, "CueRefNumber", KaxCueRefNumber_Context);\r
-const EbmlCallbacks KaxCueRefCodecState::ClassInfos(KaxCueRefCodecState::Create, KaxCueRefCodecState_TheId, "CueRefCodecState", KaxCueRefCodecState_Context);\r
-#endif // MATROSKA_VERSION\r
-\r
-KaxCuePoint::KaxCuePoint() \r
- :EbmlMaster(KaxCuePoint_Context)\r
-{}\r
-\r
-KaxCueTrackPositions::KaxCueTrackPositions()\r
- :EbmlMaster(KaxCueTrackPositions_Context)\r
-{}\r
-\r
-#if MATROSKA_VERSION >= 2\r
-KaxCueReference::KaxCueReference()\r
- :EbmlMaster(KaxCueReference_Context)\r
-{}\r
-#endif // MATROSKA_VERSION\r
-\r
-/*!\r
- \todo handle codec state checking\r
- \todo remove duplicate references (reference to 2 frames that each reference the same frame)\r
-*/\r
-void KaxCuePoint::PositionSet(const KaxBlockGroup & BlockReference, uint64 GlobalTimecodeScale)\r
-{\r
- // fill me\r
- KaxCueTime & NewTime = GetChild<KaxCueTime>(*this);\r
- *static_cast<EbmlUInteger*>(&NewTime) = BlockReference.GlobalTimecode() / GlobalTimecodeScale;\r
-\r
- KaxCueTrackPositions & NewPositions = AddNewChild<KaxCueTrackPositions>(*this);\r
- KaxCueTrack & TheTrack = GetChild<KaxCueTrack>(NewPositions);\r
- *static_cast<EbmlUInteger*>(&TheTrack) = BlockReference.TrackNumber();\r
- \r
- KaxCueClusterPosition & TheClustPos = GetChild<KaxCueClusterPosition>(NewPositions);\r
- *static_cast<EbmlUInteger*>(&TheClustPos) = BlockReference.ClusterPosition();\r
-\r
-#if MATROSKA_VERSION >= 2\r
- // handle reference use\r
- if (BlockReference.ReferenceCount() != 0)\r
- {\r
- unsigned int i;\r
- for (i=0; i<BlockReference.ReferenceCount(); i++) {\r
- KaxCueReference & NewRefs = AddNewChild<KaxCueReference>(NewPositions);\r
- NewRefs.AddReference(BlockReference.Reference(i).RefBlock(), GlobalTimecodeScale);\r
- }\r
- }\r
-\r
- KaxCodecState *CodecState = static_cast<KaxCodecState *>(BlockReference.FindFirstElt(EBML_INFO(KaxCodecState)));\r
- if (CodecState != NULL) {\r
- KaxCueCodecState &CueCodecState = AddNewChild<KaxCueCodecState>(NewPositions);\r
- *static_cast<EbmlUInteger*>(&CueCodecState) = BlockReference.GetParentCluster()->GetParentSegment()->GetRelativePosition(CodecState->GetElementPosition());\r
- }\r
-#endif // MATROSKA_VERSION\r
-\r
- SetValueIsSet();\r
-}\r
-\r
-void KaxCuePoint::PositionSet(const KaxBlockBlob & BlobReference, uint64 GlobalTimecodeScale)\r
-{\r
- const KaxInternalBlock &BlockReference = BlobReference;\r
-\r
- // fill me\r
- KaxCueTime & NewTime = GetChild<KaxCueTime>(*this);\r
- *static_cast<EbmlUInteger*>(&NewTime) = BlockReference.GlobalTimecode() / GlobalTimecodeScale;\r
-\r
- KaxCueTrackPositions & NewPositions = AddNewChild<KaxCueTrackPositions>(*this);\r
- KaxCueTrack & TheTrack = GetChild<KaxCueTrack>(NewPositions);\r
- *static_cast<EbmlUInteger*>(&TheTrack) = BlockReference.TrackNum();\r
- \r
- KaxCueClusterPosition & TheClustPos = GetChild<KaxCueClusterPosition>(NewPositions);\r
- *static_cast<EbmlUInteger*>(&TheClustPos) = BlockReference.ClusterPosition();\r
-\r
-#if 0 // MATROSKA_VERSION >= 2\r
- // handle reference use\r
- if (BlockReference.ReferenceCount() != 0)\r
- {\r
- unsigned int i;\r
- for (i=0; i<BlockReference.ReferenceCount(); i++) {\r
- KaxCueReference & NewRefs = AddNewChild<KaxCueReference>(NewPositions);\r
- NewRefs.AddReference(BlockReference.Reference(i).RefBlock(), GlobalTimecodeScale);\r
- }\r
- }\r
-#endif // MATROSKA_VERSION\r
-\r
-#if MATROSKA_VERSION >= 2\r
- if (!BlobReference.IsSimpleBlock()) {\r
- const KaxBlockGroup &BlockGroup = BlobReference;\r
- const KaxCodecState *CodecState = static_cast<KaxCodecState *>(BlockGroup.FindFirstElt(EBML_INFO(KaxCodecState)));\r
- if (CodecState != NULL) {\r
- KaxCueCodecState &CueCodecState = AddNewChild<KaxCueCodecState>(NewPositions);\r
- *static_cast<EbmlUInteger*>(&CueCodecState) = BlockGroup.GetParentCluster()->GetParentSegment()->GetRelativePosition(CodecState->GetElementPosition());\r
- }\r
- }\r
-#endif // MATROSKA_VERSION\r
-\r
- SetValueIsSet();\r
-}\r
-\r
-#if MATROSKA_VERSION >= 2\r
-/*!\r
- \todo handle codec state checking\r
-*/\r
-void KaxCueReference::AddReference(const KaxBlockBlob & BlockReference, uint64 GlobalTimecodeScale)\r
-{\r
- const KaxInternalBlock & theBlock = BlockReference;\r
- KaxCueRefTime & NewTime = GetChild<KaxCueRefTime>(*this);\r
- *static_cast<EbmlUInteger*>(&NewTime) = theBlock.GlobalTimecode() / GlobalTimecodeScale;\r
-\r
- KaxCueRefCluster & TheClustPos = GetChild<KaxCueRefCluster>(*this);\r
- *static_cast<EbmlUInteger*>(&TheClustPos) = theBlock.ClusterPosition();\r
-\r
-#ifdef OLD\r
- // handle recursive reference use\r
- if (BlockReference.ReferenceCount() != 0)\r
- {\r
- unsigned int i;\r
- for (i=0; i<BlockReference.ReferenceCount(); i++) {\r
- AddReference(BlockReference.Reference(i).RefBlock());\r
- }\r
- }\r
-#endif /* OLD */\r
-}\r
-#endif\r
-\r
-bool KaxCuePoint::operator<(const EbmlElement & EltB) const\r
-{\r
- assert(EbmlId(*this) == KaxCuePoint_TheId);\r
- assert(EbmlId(EltB) == KaxCuePoint_TheId);\r
-\r
- const KaxCuePoint & theEltB = *static_cast<const KaxCuePoint *>(&EltB);\r
-\r
- // compare timecode\r
- const KaxCueTime * TimeCodeA = static_cast<const KaxCueTime *>(FindElt(EBML_INFO(KaxCueTime)));\r
- if (TimeCodeA == NULL)\r
- return false;\r
-\r
- const KaxCueTime * TimeCodeB = static_cast<const KaxCueTime *>(theEltB.FindElt(EBML_INFO(KaxCueTime)));\r
- if (TimeCodeB == NULL)\r
- return false;\r
-\r
- if (*TimeCodeA < *TimeCodeB)\r
- return true;\r
-\r
- if (*TimeCodeB < *TimeCodeA)\r
- return false;\r
-\r
- // compare tracks (timecodes are equal)\r
- const KaxCueTrack * TrackA = static_cast<const KaxCueTrack *>(FindElt(EBML_INFO(KaxCueTrack)));\r
- if (TrackA == NULL)\r
- return false;\r
-\r
- const KaxCueTrack * TrackB = static_cast<const KaxCueTrack *>(theEltB.FindElt(EBML_INFO(KaxCueTrack)));\r
- if (TrackB == NULL)\r
- return false;\r
-\r
- if (*TrackA < *TrackB)\r
- return true;\r
-\r
- if (*TrackB < *TrackA)\r
- return false;\r
-\r
- return false;\r
-}\r
-\r
-bool KaxCuePoint::Timecode(uint64 & aTimecode, uint64 GlobalTimecodeScale) const\r
-{\r
- const KaxCueTime *aTime = static_cast<const KaxCueTime *>(FindFirstElt(EBML_INFO(KaxCueTime)));\r
- if (aTime == NULL)\r
- return false;\r
- aTimecode = uint64(*aTime) * GlobalTimecodeScale;\r
- return true;\r
-}\r
-\r
-/*!\r
- \brief return the position of the Cluster to load\r
-*/\r
-const KaxCueTrackPositions * KaxCuePoint::GetSeekPosition() const\r
-{\r
- const KaxCueTrackPositions * result = NULL;\r
- uint64 aPosition = EBML_PRETTYLONGINT(0xFFFFFFFFFFFFFFF);\r
- // find the position of the "earlier" Cluster\r
- const KaxCueTrackPositions *aPoss = static_cast<const KaxCueTrackPositions *>(FindFirstElt(EBML_INFO(KaxCueTrackPositions)));\r
- while (aPoss != NULL)\r
- {\r
- const KaxCueClusterPosition *aPos = static_cast<const KaxCueClusterPosition *>(aPoss->FindFirstElt(EBML_INFO(KaxCueClusterPosition)));\r
- if (aPos != NULL && uint64(*aPos) < aPosition) {\r
- aPosition = uint64(*aPos);\r
- result = aPoss;\r
- }\r
- \r
- aPoss = static_cast<const KaxCueTrackPositions *>(FindNextElt(*aPoss));\r
- }\r
- return result;\r
-}\r
-\r
-uint64 KaxCueTrackPositions::ClusterPosition() const\r
-{\r
- const KaxCueClusterPosition *aPos = static_cast<const KaxCueClusterPosition *>(FindFirstElt(EBML_INFO(KaxCueClusterPosition)));\r
- if (aPos == NULL)\r
- return 0;\r
-\r
- return uint64(*aPos);\r
-}\r
-\r
-uint16 KaxCueTrackPositions::TrackNumber() const\r
-{\r
- const KaxCueTrack *aTrack = static_cast<const KaxCueTrack *>(FindFirstElt(EBML_INFO(KaxCueTrack)));\r
- if (aTrack == NULL)\r
- return 0;\r
-\r
- return uint16(*aTrack);\r
-}\r
-\r
-\r
-END_LIBMATROSKA_NAMESPACE\r
+/****************************************************************************
+** libmatroska : parse Matroska files, see http://www.matroska.org/
+**
+** <file/class description>
+**
+** 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 <robux4 @ users.sf.net>
+*/
+#include <cassert>
+
+#include "matroska/KaxCuesData.h"
+#include "matroska/KaxContexts.h"
+#include "matroska/KaxBlock.h"
+#include "matroska/KaxBlockData.h"
+#include "matroska/KaxCluster.h"
+#include "matroska/KaxSegment.h"
+
+START_LIBMATROSKA_NAMESPACE
+
+EbmlSemantic KaxCuePoint_ContextList[2] =
+{
+ EbmlSemantic(true, true, EBML_INFO(KaxCueTime)),
+ EbmlSemantic(true, false, EBML_INFO(KaxCueTrackPositions)),
+};
+
+#if MATROSKA_VERSION == 1
+EbmlSemantic KaxCueTrackPositions_ContextList[3] =
+#else // MATROSKA_VERSION
+EbmlSemantic KaxCueTrackPositions_ContextList[5] =
+#endif // MATROSKA_VERSION
+{
+ EbmlSemantic(true, true, EBML_INFO(KaxCueTrack)),
+ EbmlSemantic(true, true, EBML_INFO(KaxCueClusterPosition)),
+ EbmlSemantic(false, true, EBML_INFO(KaxCueBlockNumber)),
+#if MATROSKA_VERSION >= 2
+ EbmlSemantic(false, true, EBML_INFO(KaxCueCodecState)),
+ EbmlSemantic(false, false, EBML_INFO(KaxCueReference)),
+#endif // MATROSKA_VERSION
+};
+
+#if MATROSKA_VERSION >= 2
+EbmlSemantic KaxCueReference_ContextList[4] =
+{
+ EbmlSemantic(true, true, EBML_INFO(KaxCueRefTime)),
+ EbmlSemantic(true, true, EBML_INFO(KaxCueRefCluster)),
+ EbmlSemantic(false, true, EBML_INFO(KaxCueRefNumber)),
+ EbmlSemantic(false, true, EBML_INFO(KaxCueRefCodecState)),
+};
+#endif // MATROSKA_VERSION
+
+EbmlId KaxCuePoint_TheId (0xBB, 1);
+EbmlId KaxCueTime_TheId (0xB3, 1);
+EbmlId KaxCueTrackPositions_TheId (0xB7, 1);
+EbmlId KaxCueTrack_TheId (0xF7, 1);
+EbmlId KaxCueClusterPosition_TheId(0xF1, 1);
+EbmlId KaxCueBlockNumber_TheId (0x5378, 2);
+#if MATROSKA_VERSION >= 2
+EbmlId KaxCueCodecState_TheId (0xEA, 1);
+EbmlId KaxCueReference_TheId (0xDB, 1);
+EbmlId KaxCueRefTime_TheId (0x96, 1);
+EbmlId KaxCueRefCluster_TheId (0x97, 1);
+EbmlId KaxCueRefNumber_TheId (0x535F, 2);
+EbmlId KaxCueRefCodecState_TheId (0xEB, 1);
+#endif // MATROSKA_VERSION
+
+const EbmlSemanticContext KaxCuePoint_Context = EbmlSemanticContext(countof(KaxCuePoint_ContextList), KaxCuePoint_ContextList, &KaxCues_Context, *GetKaxGlobal_Context, &EBML_INFO(KaxCuePoint));
+const EbmlSemanticContext KaxCueTime_Context = EbmlSemanticContext(0, NULL, &KaxCuePoint_Context, *GetKaxGlobal_Context, &EBML_INFO(KaxCueTime));
+const EbmlSemanticContext KaxCueTrackPositions_Context = EbmlSemanticContext(countof(KaxCueTrackPositions_ContextList), KaxCueTrackPositions_ContextList, &KaxCuePoint_Context, *GetKaxGlobal_Context, &EBML_INFO(KaxCueTrackPositions));
+const EbmlSemanticContext KaxCueTrack_Context = EbmlSemanticContext(0, NULL, &KaxCueTrackPositions_Context, *GetKaxGlobal_Context, &EBML_INFO(KaxCueTrack));
+const EbmlSemanticContext KaxCueClusterPosition_Context = EbmlSemanticContext(0, NULL, &KaxCueTrackPositions_Context, *GetKaxGlobal_Context, &EBML_INFO(KaxCueClusterPosition));
+const EbmlSemanticContext KaxCueBlockNumber_Context = EbmlSemanticContext(0, NULL, &KaxCueTrackPositions_Context, *GetKaxGlobal_Context, &EBML_INFO(KaxCueBlockNumber));
+#if MATROSKA_VERSION >= 2
+const EbmlSemanticContext KaxCueCodecState_Context = EbmlSemanticContext(0, NULL, &KaxCueTrackPositions_Context, *GetKaxGlobal_Context, &EBML_INFO(KaxCueCodecState));
+const EbmlSemanticContext KaxCueReference_Context = EbmlSemanticContext(countof(KaxCueReference_ContextList), KaxCueReference_ContextList, &KaxCueTrackPositions_Context, *GetKaxGlobal_Context, &EBML_INFO(KaxCueReference));
+const EbmlSemanticContext KaxCueRefTime_Context = EbmlSemanticContext(0, NULL, &KaxCueReference_Context, *GetKaxGlobal_Context, &EBML_INFO(KaxCueRefTime));
+const EbmlSemanticContext KaxCueRefCluster_Context = EbmlSemanticContext(0, NULL, &KaxCueRefTime_Context, *GetKaxGlobal_Context, &EBML_INFO(KaxCueRefCluster));
+const EbmlSemanticContext KaxCueRefNumber_Context = EbmlSemanticContext(0, NULL, &KaxCueRefTime_Context, *GetKaxGlobal_Context, &EBML_INFO(KaxCueRefNumber));
+const EbmlSemanticContext KaxCueRefCodecState_Context = EbmlSemanticContext(0, NULL, &KaxCueRefTime_Context, *GetKaxGlobal_Context, &EBML_INFO(KaxCueRefCodecState));
+#endif // MATROSKA_VERSION
+
+const EbmlCallbacks KaxCuePoint::ClassInfos(KaxCuePoint::Create, KaxCuePoint_TheId, "CuePoint", KaxCuePoint_Context);
+const EbmlCallbacks KaxCueTime::ClassInfos(KaxCueTime::Create, KaxCueTime_TheId, "CueTime", KaxCueTime_Context);
+const EbmlCallbacks KaxCueTrackPositions::ClassInfos(KaxCueTrackPositions::Create, KaxCueTrackPositions_TheId, "CueTrackPositions", KaxCueTrackPositions_Context);
+const EbmlCallbacks KaxCueTrack::ClassInfos(KaxCueTrack::Create, KaxCueTrack_TheId, "CueTrack", KaxCueTrack_Context);
+const EbmlCallbacks KaxCueClusterPosition::ClassInfos(KaxCueClusterPosition::Create, KaxCueClusterPosition_TheId, "CueClusterPosition", KaxCueClusterPosition_Context);
+const EbmlCallbacks KaxCueBlockNumber::ClassInfos(KaxCueBlockNumber::Create, KaxCueBlockNumber_TheId, "CueBlockNumber", KaxCueBlockNumber_Context);
+#if MATROSKA_VERSION >= 2
+const EbmlCallbacks KaxCueCodecState::ClassInfos(KaxCueCodecState::Create, KaxCueCodecState_TheId, "CueCodecState", KaxCueCodecState_Context);
+const EbmlCallbacks KaxCueReference::ClassInfos(KaxCueReference::Create, KaxCueReference_TheId, "CueReference", KaxCueReference_Context);
+const EbmlCallbacks KaxCueRefTime::ClassInfos(KaxCueRefTime::Create, KaxCueRefTime_TheId, "CueRefTime", KaxCueRefTime_Context);
+const EbmlCallbacks KaxCueRefCluster::ClassInfos(KaxCueRefCluster::Create, KaxCueRefCluster_TheId, "CueRefCluster", KaxCueRefCluster_Context);
+const EbmlCallbacks KaxCueRefNumber::ClassInfos(KaxCueRefNumber::Create, KaxCueRefNumber_TheId, "CueRefNumber", KaxCueRefNumber_Context);
+const EbmlCallbacks KaxCueRefCodecState::ClassInfos(KaxCueRefCodecState::Create, KaxCueRefCodecState_TheId, "CueRefCodecState", KaxCueRefCodecState_Context);
+#endif // MATROSKA_VERSION
+
+KaxCuePoint::KaxCuePoint()
+ :EbmlMaster(KaxCuePoint_Context)
+{}
+
+KaxCueTrackPositions::KaxCueTrackPositions()
+ :EbmlMaster(KaxCueTrackPositions_Context)
+{}
+
+#if MATROSKA_VERSION >= 2
+KaxCueReference::KaxCueReference()
+ :EbmlMaster(KaxCueReference_Context)
+{}
+#endif // MATROSKA_VERSION
+
+/*!
+ \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<KaxCueTime>(*this);
+ *static_cast<EbmlUInteger*>(&NewTime) = BlockReference.GlobalTimecode() / GlobalTimecodeScale;
+
+ KaxCueTrackPositions & NewPositions = AddNewChild<KaxCueTrackPositions>(*this);
+ KaxCueTrack & TheTrack = GetChild<KaxCueTrack>(NewPositions);
+ *static_cast<EbmlUInteger*>(&TheTrack) = BlockReference.TrackNumber();
+
+ KaxCueClusterPosition & TheClustPos = GetChild<KaxCueClusterPosition>(NewPositions);
+ *static_cast<EbmlUInteger*>(&TheClustPos) = BlockReference.ClusterPosition();
+
+#if MATROSKA_VERSION >= 2
+ // handle reference use
+ if (BlockReference.ReferenceCount() != 0)
+ {
+ unsigned int i;
+ for (i=0; i<BlockReference.ReferenceCount(); i++) {
+ KaxCueReference & NewRefs = AddNewChild<KaxCueReference>(NewPositions);
+ NewRefs.AddReference(BlockReference.Reference(i).RefBlock(), GlobalTimecodeScale);
+ }
+ }
+
+ KaxCodecState *CodecState = static_cast<KaxCodecState *>(BlockReference.FindFirstElt(EBML_INFO(KaxCodecState)));
+ if (CodecState != NULL) {
+ KaxCueCodecState &CueCodecState = AddNewChild<KaxCueCodecState>(NewPositions);
+ *static_cast<EbmlUInteger*>(&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<KaxCueTime>(*this);
+ *static_cast<EbmlUInteger*>(&NewTime) = BlockReference.GlobalTimecode() / GlobalTimecodeScale;
+
+ KaxCueTrackPositions & NewPositions = AddNewChild<KaxCueTrackPositions>(*this);
+ KaxCueTrack & TheTrack = GetChild<KaxCueTrack>(NewPositions);
+ *static_cast<EbmlUInteger*>(&TheTrack) = BlockReference.TrackNum();
+
+ KaxCueClusterPosition & TheClustPos = GetChild<KaxCueClusterPosition>(NewPositions);
+ *static_cast<EbmlUInteger*>(&TheClustPos) = BlockReference.ClusterPosition();
+
+#if 0 // MATROSKA_VERSION >= 2
+ // handle reference use
+ if (BlockReference.ReferenceCount() != 0)
+ {
+ unsigned int i;
+ for (i=0; i<BlockReference.ReferenceCount(); i++) {
+ KaxCueReference & NewRefs = AddNewChild<KaxCueReference>(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<KaxCodecState *>(BlockGroup.FindFirstElt(EBML_INFO(KaxCodecState)));
+ if (CodecState != NULL) {
+ KaxCueCodecState &CueCodecState = AddNewChild<KaxCueCodecState>(NewPositions);
+ *static_cast<EbmlUInteger*>(&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<KaxCueRefTime>(*this);
+ *static_cast<EbmlUInteger*>(&NewTime) = theBlock.GlobalTimecode() / GlobalTimecodeScale;
+
+ KaxCueRefCluster & TheClustPos = GetChild<KaxCueRefCluster>(*this);
+ *static_cast<EbmlUInteger*>(&TheClustPos) = theBlock.ClusterPosition();
+
+#ifdef OLD
+ // handle recursive reference use
+ if (BlockReference.ReferenceCount() != 0)
+ {
+ unsigned int i;
+ for (i=0; i<BlockReference.ReferenceCount(); i++) {
+ AddReference(BlockReference.Reference(i).RefBlock());
+ }
+ }
+#endif /* OLD */
+}
+#endif
+
+bool KaxCuePoint::IsSmallerThan(const EbmlElement * EltB) const
+{
+ assert(EbmlId(*this) == KaxCuePoint_TheId);
+ assert(EbmlId(*EltB) == KaxCuePoint_TheId);
+
+ const KaxCuePoint & theEltB = *static_cast<const KaxCuePoint *>(EltB);
+
+ // compare timecode
+ const KaxCueTime * TimeCodeA = static_cast<const KaxCueTime *>(FindElt(EBML_INFO(KaxCueTime)));
+ if (TimeCodeA == NULL)
+ return false;
+
+ const KaxCueTime * TimeCodeB = static_cast<const KaxCueTime *>(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<const KaxCueTrack *>(FindElt(EBML_INFO(KaxCueTrack)));
+ if (TrackA == NULL)
+ return false;
+
+ const KaxCueTrack * TrackB = static_cast<const KaxCueTrack *>(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<const KaxCueTime *>(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<const KaxCueTrackPositions *>(FindFirstElt(EBML_INFO(KaxCueTrackPositions)));
+ while (aPoss != NULL)
+ {
+ const KaxCueClusterPosition *aPos = static_cast<const KaxCueClusterPosition *>(aPoss->FindFirstElt(EBML_INFO(KaxCueClusterPosition)));
+ if (aPos != NULL && uint64(*aPos) < aPosition) {
+ aPosition = uint64(*aPos);
+ result = aPoss;
+ }
+
+ aPoss = static_cast<const KaxCueTrackPositions *>(FindNextElt(*aPoss));
+ }
+ return result;
+}
+
+uint64 KaxCueTrackPositions::ClusterPosition() const
+{
+ const KaxCueClusterPosition *aPos = static_cast<const KaxCueClusterPosition *>(FindFirstElt(EBML_INFO(KaxCueClusterPosition)));
+ if (aPos == NULL)
+ return 0;
+
+ return uint64(*aPos);
+}
+
+uint16 KaxCueTrackPositions::TrackNumber() const
+{
+ const KaxCueTrack *aTrack = static_cast<const KaxCueTrack *>(FindFirstElt(EBML_INFO(KaxCueTrack)));
+ if (aTrack == NULL)
+ return 0;
+
+ return uint16(*aTrack);
+}
+
+
+END_LIBMATROSKA_NAMESPACE