]> granicus.if.org Git - libmatroska/commitdiff
v1/v2: Add support for const iterators where necessary
authorSteve Lhomme <slhomme@matroska.org>
Fri, 30 Apr 2010 08:28:24 +0000 (08:28 +0000)
committerSteve Lhomme <slhomme@matroska.org>
Fri, 30 Apr 2010 08:28:24 +0000 (08:28 +0000)
git-svn-id: https://matroska.svn.sourceforge.net/svnroot/matroska/trunk/libmatroska@149 a6f86f6d-0131-4f8e-9e7b-e335508773d5

src/KaxCues.cpp
src/KaxSeekHead.cpp

index dc588b67303b4010a7d23794ba60ffdf40723891..9fd123b2d72673cd6dbd52ac02330bb21a30d5d6 100644 (file)
-/****************************************************************************\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: KaxCues.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/KaxCues.h"\r
-#include "matroska/KaxCuesData.h"\r
-#include "matroska/KaxContexts.h"\r
-#include "ebml/EbmlStream.h"\r
-#include "matroska/KaxDefines.h"\r
-\r
-// sub elements\r
-START_LIBMATROSKA_NAMESPACE\r
-\r
-DEFINE_START_SEMANTIC(KaxCues) \r
-DEFINE_SEMANTIC_ITEM(true, false, KaxCuePoint)\r
-DEFINE_END_SEMANTIC(KaxCues) \r
-\r
-DEFINE_MKX_MASTER(KaxCues, 0x1C53BB6B, 4, KaxSegment, "Cues");\r
-\r
-KaxCues::~KaxCues()\r
-{\r
-       assert(myTempReferences.size() == 0); // otherwise that means you have added references and forgot to set the position\r
-}\r
-\r
-bool KaxCues::AddBlockGroup(const KaxBlockGroup & BlockRef)\r
-{\r
-       // Do not add the element if it's already present.\r
-       std::vector<const KaxBlockBlob *>::iterator ListIdx;\r
-       KaxBlockBlob &BlockReference = *(new KaxBlockBlob(BLOCK_BLOB_NO_SIMPLE));\r
-       BlockReference.SetBlockGroup(*const_cast<KaxBlockGroup*>(&BlockRef));\r
-\r
-       for (ListIdx = myTempReferences.begin(); ListIdx != myTempReferences.end(); ListIdx++)\r
-               if (*ListIdx == &BlockReference)\r
-                       return true;\r
-\r
-       myTempReferences.push_back(&BlockReference);\r
-       return true;\r
-}\r
-\r
-bool KaxCues::AddBlockBlob(const KaxBlockBlob & BlockReference)\r
-{\r
-       // Do not add the element if it's already present.\r
-       std::vector<const KaxBlockBlob *>::iterator ListIdx;\r
-\r
-       for (ListIdx = myTempReferences.begin(); ListIdx != myTempReferences.end(); ListIdx++)\r
-               if (*ListIdx == &BlockReference)\r
-                       return true;\r
-\r
-       myTempReferences.push_back(&BlockReference);\r
-       return true;\r
-}\r
-\r
-void KaxCues::PositionSet(const KaxBlockBlob & BlockReference)\r
-{\r
-       // look for the element in the temporary references\r
-       std::vector<const KaxBlockBlob *>::iterator ListIdx;\r
-\r
-       for (ListIdx = myTempReferences.begin(); ListIdx != myTempReferences.end(); ListIdx++) {\r
-               if (*ListIdx == &BlockReference) {\r
-                       // found, now add the element to the entry list\r
-                       KaxCuePoint & NewPoint = AddNewChild<KaxCuePoint>(*this);\r
-                       NewPoint.PositionSet(BlockReference, GlobalTimecodeScale());\r
-                       myTempReferences.erase(ListIdx);\r
-                       break;\r
-               }\r
-       }\r
-}\r
-\r
-void KaxCues::PositionSet(const KaxBlockGroup & BlockRef)\r
-{\r
-       // look for the element in the temporary references\r
-       std::vector<const KaxBlockBlob *>::iterator ListIdx;\r
-\r
-       for (ListIdx = myTempReferences.begin(); ListIdx != myTempReferences.end(); ListIdx++) {\r
-               const KaxInternalBlock &refTmp = **ListIdx;\r
-               if (refTmp.GlobalTimecode() == BlockRef.GlobalTimecode() &&\r
-                       refTmp.TrackNum() == BlockRef.TrackNumber()) {\r
-                       // found, now add the element to the entry list\r
-                       KaxCuePoint & NewPoint = AddNewChild<KaxCuePoint>(*this);\r
-                       NewPoint.PositionSet(**ListIdx, GlobalTimecodeScale());\r
-                       myTempReferences.erase(ListIdx);\r
-                       break;\r
-               }\r
-       }\r
-}\r
-\r
-/*!\r
-       \warning Assume that the list has been sorted (Sort())\r
-*/\r
-const KaxCuePoint * KaxCues::GetTimecodePoint(uint64 aTimecode) const\r
-{\r
-       uint64 TimecodeToLocate = aTimecode / GlobalTimecodeScale();\r
-       const KaxCuePoint * aPointPrev = NULL;\r
-       uint64 aPrevTime = 0;\r
-       const KaxCuePoint * aPointNext = NULL;\r
-       uint64 aNextTime = EBML_PRETTYLONGINT(0xFFFFFFFFFFFF);\r
-\r
-    EBML_MASTER_ITERATOR Itr;\r
-       for (Itr = begin(); Itr != end(); ++Itr)\r
-    {\r
-               if (EbmlId(*(*Itr)) == EBML_ID(KaxCuePoint)) {\r
-                       const KaxCuePoint *tmp = static_cast<const KaxCuePoint *>(*Itr);\r
-                       // check the tile\r
-                       const KaxCueTime *aTime = static_cast<const KaxCueTime *>(tmp->FindFirstElt(EBML_INFO(KaxCueTime)));\r
-                       if (aTime != NULL)\r
-                       {\r
-                               uint64 _Time = uint64(*aTime);\r
-                               if (_Time > aPrevTime && _Time < TimecodeToLocate) {\r
-                                       aPrevTime = _Time;\r
-                                       aPointPrev = tmp;\r
-                               }\r
-                               if (_Time < aNextTime && _Time > TimecodeToLocate) {\r
-                                       aNextTime= _Time;\r
-                                       aPointNext = tmp;\r
-                               }\r
-                       }\r
-               }\r
-       }\r
-\r
-       return aPointPrev;\r
-}\r
-\r
-uint64 KaxCues::GetTimecodePosition(uint64 aTimecode) const\r
-{\r
-       const KaxCuePoint * aPoint = GetTimecodePoint(aTimecode);\r
-       if (aPoint == NULL)\r
-               return 0;\r
-\r
-       const KaxCueTrackPositions * aTrack = aPoint->GetSeekPosition();\r
-       if (aTrack == NULL)\r
-               return 0;\r
-\r
-       return aTrack->ClusterPosition();\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: KaxCues.cpp 1265 2007-01-14 17:20:35Z mosu $
+       \author Steve Lhomme     <robux4 @ users.sf.net>
+*/
+#include <cassert>
+
+#include "matroska/KaxCues.h"
+#include "matroska/KaxCuesData.h"
+#include "matroska/KaxContexts.h"
+#include "ebml/EbmlStream.h"
+#include "matroska/KaxDefines.h"
+
+// sub elements
+START_LIBMATROSKA_NAMESPACE
+
+DEFINE_START_SEMANTIC(KaxCues) 
+DEFINE_SEMANTIC_ITEM(true, false, KaxCuePoint)
+DEFINE_END_SEMANTIC(KaxCues) 
+
+DEFINE_MKX_MASTER(KaxCues, 0x1C53BB6B, 4, KaxSegment, "Cues");
+
+KaxCues::~KaxCues()
+{
+       assert(myTempReferences.size() == 0); // otherwise that means you have added references and forgot to set the position
+}
+
+bool KaxCues::AddBlockGroup(const KaxBlockGroup & BlockRef)
+{
+       // Do not add the element if it's already present.
+       std::vector<const KaxBlockBlob *>::iterator ListIdx;
+       KaxBlockBlob &BlockReference = *(new KaxBlockBlob(BLOCK_BLOB_NO_SIMPLE));
+       BlockReference.SetBlockGroup(*const_cast<KaxBlockGroup*>(&BlockRef));
+
+       for (ListIdx = myTempReferences.begin(); ListIdx != myTempReferences.end(); ListIdx++)
+               if (*ListIdx == &BlockReference)
+                       return true;
+
+       myTempReferences.push_back(&BlockReference);
+       return true;
+}
+
+bool KaxCues::AddBlockBlob(const KaxBlockBlob & BlockReference)
+{
+       // Do not add the element if it's already present.
+       std::vector<const KaxBlockBlob *>::iterator ListIdx;
+
+       for (ListIdx = myTempReferences.begin(); ListIdx != myTempReferences.end(); ListIdx++)
+               if (*ListIdx == &BlockReference)
+                       return true;
+
+       myTempReferences.push_back(&BlockReference);
+       return true;
+}
+
+void KaxCues::PositionSet(const KaxBlockBlob & BlockReference)
+{
+       // look for the element in the temporary references
+       std::vector<const KaxBlockBlob *>::iterator ListIdx;
+
+       for (ListIdx = myTempReferences.begin(); ListIdx != myTempReferences.end(); ListIdx++) {
+               if (*ListIdx == &BlockReference) {
+                       // found, now add the element to the entry list
+                       KaxCuePoint & NewPoint = AddNewChild<KaxCuePoint>(*this);
+                       NewPoint.PositionSet(BlockReference, GlobalTimecodeScale());
+                       myTempReferences.erase(ListIdx);
+                       break;
+               }
+       }
+}
+
+void KaxCues::PositionSet(const KaxBlockGroup & BlockRef)
+{
+       // look for the element in the temporary references
+       std::vector<const KaxBlockBlob *>::iterator ListIdx;
+
+       for (ListIdx = myTempReferences.begin(); ListIdx != myTempReferences.end(); ListIdx++) {
+               const KaxInternalBlock &refTmp = **ListIdx;
+               if (refTmp.GlobalTimecode() == BlockRef.GlobalTimecode() &&
+                       refTmp.TrackNum() == BlockRef.TrackNumber()) {
+                       // found, now add the element to the entry list
+                       KaxCuePoint & NewPoint = AddNewChild<KaxCuePoint>(*this);
+                       NewPoint.PositionSet(**ListIdx, GlobalTimecodeScale());
+                       myTempReferences.erase(ListIdx);
+                       break;
+               }
+       }
+}
+
+/*!
+       \warning Assume that the list has been sorted (Sort())
+*/
+const KaxCuePoint * KaxCues::GetTimecodePoint(uint64 aTimecode) const
+{
+       uint64 TimecodeToLocate = aTimecode / GlobalTimecodeScale();
+       const KaxCuePoint * aPointPrev = NULL;
+       uint64 aPrevTime = 0;
+       const KaxCuePoint * aPointNext = NULL;
+       uint64 aNextTime = EBML_PRETTYLONGINT(0xFFFFFFFFFFFF);
+
+    EBML_MASTER_CONST_ITERATOR Itr;
+       for (Itr = begin(); Itr != end(); ++Itr)
+    {
+               if (EbmlId(*(*Itr)) == EBML_ID(KaxCuePoint)) {
+                       const KaxCuePoint *tmp = static_cast<const KaxCuePoint *>(*Itr);
+                       // check the tile
+                       const KaxCueTime *aTime = static_cast<const KaxCueTime *>(tmp->FindFirstElt(EBML_INFO(KaxCueTime)));
+                       if (aTime != NULL)
+                       {
+                               uint64 _Time = uint64(*aTime);
+                               if (_Time > aPrevTime && _Time < TimecodeToLocate) {
+                                       aPrevTime = _Time;
+                                       aPointPrev = tmp;
+                               }
+                               if (_Time < aNextTime && _Time > TimecodeToLocate) {
+                                       aNextTime= _Time;
+                                       aPointNext = tmp;
+                               }
+                       }
+               }
+       }
+
+       return aPointPrev;
+}
+
+uint64 KaxCues::GetTimecodePosition(uint64 aTimecode) const
+{
+       const KaxCuePoint * aPoint = GetTimecodePoint(aTimecode);
+       if (aPoint == NULL)
+               return 0;
+
+       const KaxCueTrackPositions * aTrack = aPoint->GetSeekPosition();
+       if (aTrack == NULL)
+               return 0;
+
+       return aTrack->ClusterPosition();
+}
+
+END_LIBMATROSKA_NAMESPACE
index 64cf02a90b4ed655d7491adc26c82ac9552c99de..f653cb155fa3d494197004239fc11f9bbfdb0199 100644 (file)
-/****************************************************************************\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 file is part of libmatroska.\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: KaxSeekHead.cpp 640 2004-07-09 21:05:36Z mosu $\r
-       \author Steve Lhomme     <robux4 @ users.sf.net>\r
-*/\r
-#include "matroska/KaxSeekHead.h"\r
-#include "matroska/KaxContexts.h"\r
-#include "matroska/KaxSegment.h"\r
-#include "matroska/KaxCues.h"\r
-#include "matroska/KaxDefines.h"\r
-\r
-using namespace LIBEBML_NAMESPACE;\r
-\r
-// sub elements\r
-START_LIBMATROSKA_NAMESPACE\r
-\r
-DEFINE_START_SEMANTIC(KaxSeekHead)\r
-DEFINE_SEMANTIC_ITEM(true, false, KaxSeek)\r
-DEFINE_END_SEMANTIC(KaxSeekHead)\r
-\r
-DEFINE_START_SEMANTIC(KaxSeek) \r
-DEFINE_SEMANTIC_ITEM(true, true, KaxSeekID)\r
-DEFINE_SEMANTIC_ITEM(true, true, KaxSeekPosition)\r
-DEFINE_END_SEMANTIC(KaxSeek) \r
-\r
-DEFINE_MKX_MASTER  (KaxSeekHead, 0x114D9B74, 4, KaxSegment, "SeekHeader");\r
-DEFINE_MKX_MASTER  (KaxSeek,         0x4DBB, 2, KaxSeekHead, "SeekPoint");\r
-DEFINE_MKX_BINARY  (KaxSeekID,       0x53AB, 2, KaxSeek, "SeekID");\r
-DEFINE_MKX_UINTEGER(KaxSeekPosition, 0x53AC, 2, KaxSeek, "SeekPosition");\r
-\r
-/*!\r
-       \todo verify that the element is not already in the list\r
-*/\r
-void KaxSeekHead::IndexThis(const EbmlElement & aElt, const KaxSegment & ParentSegment)\r
-{\r
-       // create a new point\r
-       KaxSeek & aNewPoint = AddNewChild<KaxSeek>(*this);\r
-\r
-       // add the informations to this element\r
-       KaxSeekPosition & aNewPos = GetChild<KaxSeekPosition>(aNewPoint);\r
-       *static_cast<EbmlUInteger *>(&aNewPos) = ParentSegment.GetRelativePosition(aElt);\r
-\r
-       KaxSeekID & aNewID = GetChild<KaxSeekID>(aNewPoint);\r
-       binary ID[4];\r
-    ((const EbmlId&)aElt).Fill(ID);\r
-       aNewID.CopyBuffer(ID, EBML_ID_LENGTH((const EbmlId&)aElt));\r
-}\r
-\r
-KaxSeek * KaxSeekHead::FindFirstOf(const EbmlCallbacks & Callbacks) const\r
-{\r
-       // parse all the Entries and find the first to match the type\r
-       KaxSeek * aElt = static_cast<KaxSeek *>(FindFirstElt(EBML_INFO(KaxSeek)));\r
-       while (aElt != NULL)\r
-       {\r
-               KaxSeekID * aId = NULL;\r
-        EBML_MASTER_ITERATOR Itr;\r
-               for (Itr = aElt->begin(); Itr != aElt->end(); ++Itr)\r
-        {\r
-                       if (EbmlId(*(*Itr)) == EBML_ID(KaxSeekID)) {\r
-                               aId = static_cast<KaxSeekID*>(*Itr);\r
-                               EbmlId aEbmlId(aId->GetBuffer(), aId->GetSize());\r
-                               if (aEbmlId == EBML_INFO_ID(Callbacks))\r
-                               {\r
-                                       return aElt;\r
-                               }\r
-                               break;\r
-                       }\r
-               }\r
-               aElt = static_cast<KaxSeek *>(FindNextElt(*aElt));\r
-       }\r
-\r
-       return NULL;\r
-}\r
-\r
-KaxSeek * KaxSeekHead::FindNextOf(const KaxSeek &aPrev) const\r
-{\r
-    EBML_MASTER_ITERATOR Itr;\r
-       KaxSeek *tmp;\r
-       \r
-       // look for the previous in the list\r
-       for (Itr = begin(); Itr != end(); ++Itr)\r
-    {\r
-               if (*Itr == static_cast<const EbmlElement*>(&aPrev))\r
-                       break;\r
-       }\r
-\r
-       if (Itr != end())\r
-    {\r
-               ++Itr;\r
-           for (; Itr != end(); ++Itr)\r
-        {\r
-                       if (EbmlId(*(*Itr)) == EBML_ID(KaxSeek))\r
-                       {\r
-                               tmp = (KaxSeek *)(*Itr);\r
-                               if (tmp->IsEbmlId(aPrev))\r
-                                       return tmp;\r
-                       }\r
-               }\r
-       }\r
-\r
-       return NULL;\r
-}\r
-\r
-int64 KaxSeek::Location() const\r
-{\r
-       KaxSeekPosition *aPos = static_cast<KaxSeekPosition*>(FindFirstElt(EBML_INFO(KaxSeekPosition)));\r
-       if (aPos == NULL)\r
-               return 0;\r
-       return uint64(*aPos);\r
-}\r
-\r
-bool KaxSeek::IsEbmlId(const EbmlId & aId) const\r
-{\r
-       KaxSeekID *_Id = static_cast<KaxSeekID*>(FindFirstElt(EBML_INFO(KaxSeekID)));\r
-       if (_Id == NULL)\r
-               return false;\r
-       EbmlId aEbmlId(_Id->GetBuffer(), _Id->GetSize());\r
-       return (aId == aEbmlId);\r
-}\r
-\r
-bool KaxSeek::IsEbmlId(const KaxSeek & aPoint) const\r
-{\r
-       KaxSeekID *_IdA = static_cast<KaxSeekID*>(FindFirstElt(EBML_INFO(KaxSeekID)));\r
-       if (_IdA == NULL)\r
-               return false;\r
-       KaxSeekID *_IdB = static_cast<KaxSeekID*>(aPoint.FindFirstElt(EBML_INFO(KaxSeekID)));\r
-       if (_IdB == NULL)\r
-               return false;\r
-       EbmlId aEbmlIdA(_IdA->GetBuffer(), _IdA->GetSize());\r
-       EbmlId aEbmlIdB(_IdB->GetBuffer(), _IdB->GetSize());\r
-       return (aEbmlIdA == aEbmlIdB);\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 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: KaxSeekHead.cpp 640 2004-07-09 21:05:36Z mosu $
+       \author Steve Lhomme     <robux4 @ users.sf.net>
+*/
+#include "matroska/KaxSeekHead.h"
+#include "matroska/KaxContexts.h"
+#include "matroska/KaxSegment.h"
+#include "matroska/KaxCues.h"
+#include "matroska/KaxDefines.h"
+
+using namespace LIBEBML_NAMESPACE;
+
+// sub elements
+START_LIBMATROSKA_NAMESPACE
+
+DEFINE_START_SEMANTIC(KaxSeekHead)
+DEFINE_SEMANTIC_ITEM(true, false, KaxSeek)
+DEFINE_END_SEMANTIC(KaxSeekHead)
+
+DEFINE_START_SEMANTIC(KaxSeek) 
+DEFINE_SEMANTIC_ITEM(true, true, KaxSeekID)
+DEFINE_SEMANTIC_ITEM(true, true, KaxSeekPosition)
+DEFINE_END_SEMANTIC(KaxSeek) 
+
+DEFINE_MKX_MASTER  (KaxSeekHead, 0x114D9B74, 4, KaxSegment, "SeekHeader");
+DEFINE_MKX_MASTER  (KaxSeek,         0x4DBB, 2, KaxSeekHead, "SeekPoint");
+DEFINE_MKX_BINARY  (KaxSeekID,       0x53AB, 2, KaxSeek, "SeekID");
+DEFINE_MKX_UINTEGER(KaxSeekPosition, 0x53AC, 2, KaxSeek, "SeekPosition");
+
+/*!
+       \todo verify that the element is not already in the list
+*/
+void KaxSeekHead::IndexThis(const EbmlElement & aElt, const KaxSegment & ParentSegment)
+{
+       // create a new point
+       KaxSeek & aNewPoint = AddNewChild<KaxSeek>(*this);
+
+       // add the informations to this element
+       KaxSeekPosition & aNewPos = GetChild<KaxSeekPosition>(aNewPoint);
+       *static_cast<EbmlUInteger *>(&aNewPos) = ParentSegment.GetRelativePosition(aElt);
+
+       KaxSeekID & aNewID = GetChild<KaxSeekID>(aNewPoint);
+       binary ID[4];
+    ((const EbmlId&)aElt).Fill(ID);
+       aNewID.CopyBuffer(ID, EBML_ID_LENGTH((const EbmlId&)aElt));
+}
+
+KaxSeek * KaxSeekHead::FindFirstOf(const EbmlCallbacks & Callbacks) const
+{
+       // parse all the Entries and find the first to match the type
+       KaxSeek * aElt = static_cast<KaxSeek *>(FindFirstElt(EBML_INFO(KaxSeek)));
+       while (aElt != NULL)
+       {
+               KaxSeekID * aId = NULL;
+        EBML_MASTER_ITERATOR Itr;
+               for (Itr = aElt->begin(); Itr != aElt->end(); ++Itr)
+        {
+                       if (EbmlId(*(*Itr)) == EBML_ID(KaxSeekID)) {
+                               aId = static_cast<KaxSeekID*>(*Itr);
+                               EbmlId aEbmlId(aId->GetBuffer(), aId->GetSize());
+                               if (aEbmlId == EBML_INFO_ID(Callbacks))
+                               {
+                                       return aElt;
+                               }
+                               break;
+                       }
+               }
+               aElt = static_cast<KaxSeek *>(FindNextElt(*aElt));
+       }
+
+       return NULL;
+}
+
+KaxSeek * KaxSeekHead::FindNextOf(const KaxSeek &aPrev) const
+{
+    EBML_MASTER_CONST_ITERATOR Itr;
+       KaxSeek *tmp;
+       
+       // look for the previous in the list
+       for (Itr = begin(); Itr != end(); ++Itr)
+    {
+               if (*Itr == static_cast<const EbmlElement*>(&aPrev))
+                       break;
+       }
+
+       if (Itr != end())
+    {
+               ++Itr;
+           for (; Itr != end(); ++Itr)
+        {
+                       if (EbmlId(*(*Itr)) == EBML_ID(KaxSeek))
+                       {
+                               tmp = (KaxSeek *)(*Itr);
+                               if (tmp->IsEbmlId(aPrev))
+                                       return tmp;
+                       }
+               }
+       }
+
+       return NULL;
+}
+
+int64 KaxSeek::Location() const
+{
+       KaxSeekPosition *aPos = static_cast<KaxSeekPosition*>(FindFirstElt(EBML_INFO(KaxSeekPosition)));
+       if (aPos == NULL)
+               return 0;
+       return uint64(*aPos);
+}
+
+bool KaxSeek::IsEbmlId(const EbmlId & aId) const
+{
+       KaxSeekID *_Id = static_cast<KaxSeekID*>(FindFirstElt(EBML_INFO(KaxSeekID)));
+       if (_Id == NULL)
+               return false;
+       EbmlId aEbmlId(_Id->GetBuffer(), _Id->GetSize());
+       return (aId == aEbmlId);
+}
+
+bool KaxSeek::IsEbmlId(const KaxSeek & aPoint) const
+{
+       KaxSeekID *_IdA = static_cast<KaxSeekID*>(FindFirstElt(EBML_INFO(KaxSeekID)));
+       if (_IdA == NULL)
+               return false;
+       KaxSeekID *_IdB = static_cast<KaxSeekID*>(aPoint.FindFirstElt(EBML_INFO(KaxSeekID)));
+       if (_IdB == NULL)
+               return false;
+       EbmlId aEbmlIdA(_IdA->GetBuffer(), _IdA->GetSize());
+       EbmlId aEbmlIdB(_IdB->GetBuffer(), _IdB->GetSize());
+       return (aEbmlIdA == aEbmlIdB);
+}
+
+END_LIBMATROSKA_NAMESPACE