1/****************************************************************************
2** libmatroska : parse Matroska files, see http://www.matroska.org/
3**
4** <file/class description>
5**
6** Copyright (C) 2002-2004 Steve Lhomme.  All rights reserved.
7**
8** This file is part of libmatroska.
9**
10** This library is free software; you can redistribute it and/or
11** modify it under the terms of the GNU Lesser General Public
12** License as published by the Free Software Foundation; either
13** version 2.1 of the License, or (at your option) any later version.
14**
15** This library is distributed in the hope that it will be useful,
16** but WITHOUT ANY WARRANTY; without even the implied warranty of
17** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18** Lesser General Public License for more details.
19**
20** You should have received a copy of the GNU Lesser General Public
21** License along with this library; if not, write to the Free Software
22** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23**
24** See http://www.matroska.org/license/lgpl/ for LGPL licensing information.**
25** Contact license@matroska.org if any conditions of this licensing are
26** not clear to you.
27**
28**********************************************************************/
29
30/*!
31	\file
32	\version \$Id: KaxSeekHead.h,v 1.7 2004/04/14 23:26:17 robux4 Exp $
33	\author Steve Lhomme     <robux4 @ users.sf.net>
34*/
35#ifndef LIBMATROSKA_SEEK_HEAD_H
36#define LIBMATROSKA_SEEK_HEAD_H
37
38#include "matroska/KaxTypes.h"
39#include "ebml/EbmlMaster.h"
40#include "ebml/EbmlBinary.h"
41#include "ebml/EbmlUInteger.h"
42
43using namespace LIBEBML_NAMESPACE;
44
45START_LIBMATROSKA_NAMESPACE
46
47class KaxSegment;
48class KaxSeek;
49
50class MATROSKA_DLL_API KaxSeekHead : public EbmlMaster {
51	public:
52		KaxSeekHead();
53		KaxSeekHead(const KaxSeekHead & ElementToClone) :EbmlMaster(ElementToClone) {}
54		static EbmlElement & Create() {return *(new KaxSeekHead);}
55		const EbmlCallbacks & Generic() const {return ClassInfos;}
56		static const EbmlCallbacks ClassInfos;
57		operator const EbmlId &() const {return ClassInfos.GlobalId;}
58		EbmlElement * Clone() const {return new KaxSeekHead(*this);}
59
60		/*!
61			\brief add an element to index in the Meta Seek data
62			\note the element should already be written in the file
63		*/
64		void IndexThis(const EbmlElement & aElt, const KaxSegment & ParentSegment);
65
66		KaxSeek * FindFirstOf(const EbmlCallbacks & Callbacks) const;
67		KaxSeek * FindNextOf(const KaxSeek &aPrev) const;
68};
69
70class MATROSKA_DLL_API KaxSeek : public EbmlMaster {
71	public:
72		KaxSeek();
73		KaxSeek(const KaxSeek & ElementToClone) :EbmlMaster(ElementToClone) {}
74		static EbmlElement & Create() {return *(new KaxSeek);}
75		const EbmlCallbacks & Generic() const {return ClassInfos;}
76		static const EbmlCallbacks ClassInfos;
77		operator const EbmlId &() const {return ClassInfos.GlobalId;}
78		EbmlElement * Clone() const {return new KaxSeek(*this);}
79
80		int64 Location() const;
81		bool IsEbmlId(const EbmlId & aId) const;
82		bool IsEbmlId(const KaxSeek & aPoint) const;
83};
84
85class MATROSKA_DLL_API KaxSeekID : public EbmlBinary {
86	public:
87		KaxSeekID() {}
88		KaxSeekID(const KaxSeekID & ElementToClone) :EbmlBinary(ElementToClone){}
89		static EbmlElement & Create() {return *(new KaxSeekID);}
90		const EbmlCallbacks & Generic() const {return ClassInfos;}
91		static const EbmlCallbacks ClassInfos;
92		operator const EbmlId &() const {return ClassInfos.GlobalId;}
93		bool ValidateSize() const {return Size <= 4;}
94		EbmlElement * Clone() const {return new KaxSeekID(*this);}
95};
96
97class MATROSKA_DLL_API KaxSeekPosition : public EbmlUInteger {
98	public:
99		KaxSeekPosition() {}
100		KaxSeekPosition(const KaxSeekPosition & ElementToClone) :EbmlUInteger(ElementToClone) {}
101		static EbmlElement & Create() {return *(new KaxSeekPosition);}
102		const EbmlCallbacks & Generic() const {return ClassInfos;}
103		static const EbmlCallbacks ClassInfos;
104		operator const EbmlId &() const {return ClassInfos.GlobalId;}
105		EbmlElement * Clone() const {return new KaxSeekPosition(*this);}
106};
107
108END_LIBMATROSKA_NAMESPACE
109
110#endif // LIBMATROSKA_SEEK_HEAD_H
111