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: KaxTracks.h,v 1.7 2004/04/14 23:26:17 robux4 Exp $
33	\author Steve Lhomme     <robux4 @ users.sf.net>
34*/
35#ifndef LIBMATROSKA_TRACKS_H
36#define LIBMATROSKA_TRACKS_H
37
38#include "matroska/KaxTypes.h"
39#include "ebml/EbmlMaster.h"
40#include "ebml/EbmlUInteger.h"
41#include "matroska/KaxTrackEntryData.h"
42
43using namespace LIBEBML_NAMESPACE;
44
45START_LIBMATROSKA_NAMESPACE
46
47class MATROSKA_DLL_API KaxTracks : public EbmlMaster {
48	public:
49		KaxTracks();
50		KaxTracks(const KaxTracks & ElementToClone) :EbmlMaster(ElementToClone) {}
51		static EbmlElement & Create() {return *(new KaxTracks);}
52		const EbmlCallbacks & Generic() const {return ClassInfos;}
53		static const EbmlCallbacks ClassInfos;
54		operator const EbmlId &() const {return ClassInfos.GlobalId;}
55		EbmlElement * Clone() const {return new KaxTracks(*this);}
56};
57
58class MATROSKA_DLL_API KaxTrackEntry : public EbmlMaster {
59	public:
60		KaxTrackEntry();
61		KaxTrackEntry(const KaxTrackEntry & ElementToClone) :EbmlMaster(ElementToClone) {}
62		static EbmlElement & Create() {return *(new KaxTrackEntry);}
63		const EbmlCallbacks & Generic() const {return ClassInfos;}
64		static const EbmlCallbacks ClassInfos;
65		operator const EbmlId &() const {return ClassInfos.GlobalId;}
66		EbmlElement * Clone() const {return new KaxTrackEntry(*this);}
67
68		EbmlUInteger & TrackNumber() const { return *(static_cast<EbmlUInteger *>(FindElt(KaxTrackNumber::ClassInfos))); }
69
70		void EnableLacing(bool bEnable = true);
71
72		/*!
73			\note lacing set by default
74		*/
75		inline bool LacingEnabled() const {
76			KaxTrackFlagLacing * myLacing = static_cast<KaxTrackFlagLacing *>(FindFirstElt(KaxTrackFlagLacing::ClassInfos));
77			return((myLacing == NULL) || (uint8(*myLacing) != 0));
78		}
79
80		void SetGlobalTimecodeScale(uint64 aGlobalTimecodeScale) {
81			mGlobalTimecodeScale = aGlobalTimecodeScale;
82			bGlobalTimecodeScaleIsSet = true;
83		}
84		uint64 GlobalTimecodeScale() const {
85			assert(bGlobalTimecodeScaleIsSet);
86			return mGlobalTimecodeScale;
87		}
88
89	protected:
90		bool   bGlobalTimecodeScaleIsSet;
91		uint64 mGlobalTimecodeScale;
92};
93
94END_LIBMATROSKA_NAMESPACE
95
96#endif // LIBMATROSKA_TRACKS_H
97