libmatroska: add KaxTrackDependency and related elements for combined stereo/3D tracks

git-svn-id: https://matroska.svn.sourceforge.net/svnroot/matroska/trunk/libmatroska@480 a6f86f6d-0131-4f8e-9e7b-e335508773d5
This commit is contained in:
Steve Lhomme 2010-08-07 09:42:47 +00:00
parent 5ebfbd2cda
commit 72abb5578e
3 changed files with 220 additions and 181 deletions

View File

@ -1,10 +1,11 @@
2010-07-xx robux4 2010-08-xx robux4
New 1.1.0 version: New 1.1.0 version:
- give access to the SetParent to KaxSimpleBlock as well - give access to the SetParent to KaxSimpleBlock as well
- change the placement of a MATROSKA_DLL_API so that it actually works - change the placement of a MATROSKA_DLL_API so that it actually works
- remove all references to the old/outdated/previous tag system - remove all references to the old/outdated/previous tag system
- add the possibility for a DataBuffer class to use its own internal memory - add the possibility for a DataBuffer class to use its own internal memory
- KaxCues::AddBlockGroup() was removed as it's broken beyond repair - KaxCues::AddBlockGroup() was removed as it's broken beyond repair
- add KaxTrackDependency and related elements for combined stereo/3D tracks
2010-06-04 robux4/mosu 2010-06-04 robux4/mosu
New 1.0.0 version: New 1.0.0 version:

View File

@ -1,81 +1,98 @@
/**************************************************************************** /****************************************************************************
** libmatroska : parse Matroska files, see http://www.matroska.org/ ** libmatroska : parse Matroska files, see http://www.matroska.org/
** **
** <file/class description> ** <file/class description>
** **
** Copyright (C) 2002-2010 Steve Lhomme. All rights reserved. ** Copyright (C) 2002-2010 Steve Lhomme. All rights reserved.
** **
** This file is part of libmatroska. ** This file is part of libmatroska.
** **
** This library is free software; you can redistribute it and/or ** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** 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, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
** **
** See http://www.matroska.org/license/lgpl/ for LGPL licensing information.** ** See http://www.matroska.org/license/lgpl/ for LGPL licensing information.**
** Contact license@matroska.org if any conditions of this licensing are ** Contact license@matroska.org if any conditions of this licensing are
** not clear to you. ** not clear to you.
** **
**********************************************************************/ **********************************************************************/
/*! /*!
\file \file
\version \$Id: KaxTracks.h,v 1.7 2004/04/14 23:26:17 robux4 Exp $ \version \$Id: KaxTracks.h,v 1.7 2004/04/14 23:26:17 robux4 Exp $
\author Steve Lhomme <robux4 @ users.sf.net> \author Steve Lhomme <robux4 @ users.sf.net>
*/ */
#ifndef LIBMATROSKA_TRACKS_H #ifndef LIBMATROSKA_TRACKS_H
#define LIBMATROSKA_TRACKS_H #define LIBMATROSKA_TRACKS_H
#include "matroska/KaxTypes.h" #include "matroska/KaxTypes.h"
#include "ebml/EbmlMaster.h" #include "ebml/EbmlMaster.h"
#include "ebml/EbmlUInteger.h" #include "ebml/EbmlUInteger.h"
#include "matroska/KaxTrackEntryData.h" #include "matroska/KaxTrackEntryData.h"
#include "matroska/KaxDefines.h" #include "matroska/KaxDefines.h"
using namespace LIBEBML_NAMESPACE; using namespace LIBEBML_NAMESPACE;
START_LIBMATROSKA_NAMESPACE START_LIBMATROSKA_NAMESPACE
DECLARE_MKX_MASTER(KaxTracks) DECLARE_MKX_MASTER(KaxTracks)
}; };
DECLARE_MKX_MASTER(KaxTrackEntry) DECLARE_MKX_MASTER(KaxTrackEntry)
public: public:
EbmlUInteger & TrackNumber() const { return *(static_cast<EbmlUInteger *>(FindElt(EBML_INFO(KaxTrackNumber)))); } EbmlUInteger & TrackNumber() const { return *(static_cast<EbmlUInteger *>(FindElt(EBML_INFO(KaxTrackNumber)))); }
void EnableLacing(bool bEnable = true); void EnableLacing(bool bEnable = true);
/*! /*!
\note lacing set by default \note lacing set by default
*/ */
inline bool LacingEnabled() const { inline bool LacingEnabled() const {
KaxTrackFlagLacing * myLacing = static_cast<KaxTrackFlagLacing *>(FindFirstElt(EBML_INFO(KaxTrackFlagLacing))); KaxTrackFlagLacing * myLacing = static_cast<KaxTrackFlagLacing *>(FindFirstElt(EBML_INFO(KaxTrackFlagLacing)));
return((myLacing == NULL) || (uint8(*myLacing) != 0)); return((myLacing == NULL) || (uint8(*myLacing) != 0));
} }
void SetGlobalTimecodeScale(uint64 aGlobalTimecodeScale) { void SetGlobalTimecodeScale(uint64 aGlobalTimecodeScale) {
mGlobalTimecodeScale = aGlobalTimecodeScale; mGlobalTimecodeScale = aGlobalTimecodeScale;
bGlobalTimecodeScaleIsSet = true; bGlobalTimecodeScaleIsSet = true;
} }
uint64 GlobalTimecodeScale() const { uint64 GlobalTimecodeScale() const {
assert(bGlobalTimecodeScaleIsSet); assert(bGlobalTimecodeScaleIsSet);
return mGlobalTimecodeScale; return mGlobalTimecodeScale;
} }
protected: protected:
bool bGlobalTimecodeScaleIsSet; bool bGlobalTimecodeScaleIsSet;
uint64 mGlobalTimecodeScale; uint64 mGlobalTimecodeScale;
}; };
END_LIBMATROSKA_NAMESPACE #if MATROSKA_VERSION >= 2
DECLARE_MKX_MASTER(KaxTrackDependency)
#endif // LIBMATROSKA_TRACKS_H };
DECLARE_MKX_UINTEGER(KaxTrackDependencyType)
};
DECLARE_MKX_MASTER(KaxTrackDependencyItem)
};
DECLARE_MKX_UINTEGER(KaxTrackDependencyUID)
};
DECLARE_MKX_UINTEGER(KaxTrackDependencyStereoPos)
};
#endif
END_LIBMATROSKA_NAMESPACE
#endif // LIBMATROSKA_TRACKS_H

View File

@ -1,99 +1,120 @@
/**************************************************************************** /****************************************************************************
** libmatroska : parse Matroska files, see http://www.matroska.org/ ** libmatroska : parse Matroska files, see http://www.matroska.org/
** **
** <file/class description> ** <file/class description>
** **
** Copyright (C) 2002-2010 Steve Lhomme. All rights reserved. ** Copyright (C) 2002-2010 Steve Lhomme. All rights reserved.
** **
** This file is part of libmatroska. ** This file is part of libmatroska.
** **
** This library is free software; you can redistribute it and/or ** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** 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, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
** **
** See http://www.matroska.org/license/lgpl/ for LGPL licensing information.** ** See http://www.matroska.org/license/lgpl/ for LGPL licensing information.**
** Contact license@matroska.org if any conditions of this licensing are ** Contact license@matroska.org if any conditions of this licensing are
** not clear to you. ** not clear to you.
** **
**********************************************************************/ **********************************************************************/
/*! /*!
\file \file
\version \$Id: KaxTracks.cpp 1202 2005-08-30 14:39:01Z robux4 $ \version \$Id: KaxTracks.cpp 1202 2005-08-30 14:39:01Z robux4 $
\author Steve Lhomme <robux4 @ users.sf.net> \author Steve Lhomme <robux4 @ users.sf.net>
*/ */
#include "matroska/KaxTracks.h" #include "matroska/KaxTracks.h"
// sub elements // sub elements
#include "matroska/KaxTrackEntryData.h" #include "matroska/KaxTrackEntryData.h"
#include "matroska/KaxTrackAudio.h" #include "matroska/KaxTrackAudio.h"
#include "matroska/KaxTrackVideo.h" #include "matroska/KaxTrackVideo.h"
#include "matroska/KaxContentEncoding.h" #include "matroska/KaxContentEncoding.h"
#include "matroska/KaxContexts.h" #include "matroska/KaxContexts.h"
#include "matroska/KaxDefines.h" #include "matroska/KaxDefines.h"
START_LIBMATROSKA_NAMESPACE START_LIBMATROSKA_NAMESPACE
DEFINE_START_SEMANTIC(KaxTracks) DEFINE_START_SEMANTIC(KaxTracks)
DEFINE_SEMANTIC_ITEM(true, false, KaxTrackEntry) DEFINE_SEMANTIC_ITEM(true, false, KaxTrackEntry)
DEFINE_END_SEMANTIC(KaxTracks) #if MATROSKA_VERSION >= 2
DEFINE_SEMANTIC_ITEM(false, false, KaxTrackDependency)
DEFINE_START_SEMANTIC(KaxTrackEntry) #endif
DEFINE_SEMANTIC_ITEM(true, true, KaxTrackNumber) DEFINE_END_SEMANTIC(KaxTracks)
DEFINE_SEMANTIC_ITEM(true, true, KaxTrackUID)
DEFINE_SEMANTIC_ITEM(true, true, KaxTrackType) DEFINE_START_SEMANTIC(KaxTrackEntry)
#if MATROSKA_VERSION >= 2 DEFINE_SEMANTIC_ITEM(true, true, KaxTrackNumber)
DEFINE_SEMANTIC_ITEM(true, true, KaxTrackFlagEnabled) DEFINE_SEMANTIC_ITEM(true, true, KaxTrackUID)
#endif // MATROSKA_VERSION DEFINE_SEMANTIC_ITEM(true, true, KaxTrackType)
DEFINE_SEMANTIC_ITEM(true, true, KaxTrackFlagDefault) #if MATROSKA_VERSION >= 2
DEFINE_SEMANTIC_ITEM(true, true, KaxTrackFlagForced) DEFINE_SEMANTIC_ITEM(true, true, KaxTrackFlagEnabled)
DEFINE_SEMANTIC_ITEM(true, true, KaxTrackFlagLacing) #endif // MATROSKA_VERSION
DEFINE_SEMANTIC_ITEM(true, true, KaxTrackMinCache) DEFINE_SEMANTIC_ITEM(true, true, KaxTrackFlagDefault)
DEFINE_SEMANTIC_ITEM(false, true, KaxTrackMaxCache) DEFINE_SEMANTIC_ITEM(true, true, KaxTrackFlagForced)
DEFINE_SEMANTIC_ITEM(false, true, KaxTrackDefaultDuration) DEFINE_SEMANTIC_ITEM(true, true, KaxTrackFlagLacing)
DEFINE_SEMANTIC_ITEM(true, true, KaxTrackTimecodeScale) DEFINE_SEMANTIC_ITEM(true, true, KaxTrackMinCache)
DEFINE_SEMANTIC_ITEM(true, true, KaxMaxBlockAdditionID) DEFINE_SEMANTIC_ITEM(false, true, KaxTrackMaxCache)
DEFINE_SEMANTIC_ITEM(false, true, KaxTrackName) DEFINE_SEMANTIC_ITEM(false, true, KaxTrackDefaultDuration)
DEFINE_SEMANTIC_ITEM(false, true, KaxTrackLanguage) DEFINE_SEMANTIC_ITEM(true, true, KaxTrackTimecodeScale)
DEFINE_SEMANTIC_ITEM(true, true, KaxCodecID) DEFINE_SEMANTIC_ITEM(true, true, KaxMaxBlockAdditionID)
DEFINE_SEMANTIC_ITEM(false, true, KaxCodecPrivate) DEFINE_SEMANTIC_ITEM(false, true, KaxTrackName)
DEFINE_SEMANTIC_ITEM(false, true, KaxCodecName) DEFINE_SEMANTIC_ITEM(false, true, KaxTrackLanguage)
DEFINE_SEMANTIC_ITEM(false, true, KaxTrackAttachmentLink) DEFINE_SEMANTIC_ITEM(true, true, KaxCodecID)
#if MATROSKA_VERSION >= 2 DEFINE_SEMANTIC_ITEM(false, true, KaxCodecPrivate)
DEFINE_SEMANTIC_ITEM(false, true, KaxCodecSettings) DEFINE_SEMANTIC_ITEM(false, true, KaxCodecName)
DEFINE_SEMANTIC_ITEM(false, false, KaxCodecInfoURL) DEFINE_SEMANTIC_ITEM(false, true, KaxTrackAttachmentLink)
DEFINE_SEMANTIC_ITEM(false, false, KaxCodecDownloadURL) #if MATROSKA_VERSION >= 2
DEFINE_SEMANTIC_ITEM(true, true, KaxCodecDecodeAll) DEFINE_SEMANTIC_ITEM(false, true, KaxCodecSettings)
#endif // MATROSKA_VERSION DEFINE_SEMANTIC_ITEM(false, false, KaxCodecInfoURL)
DEFINE_SEMANTIC_ITEM(false, false, KaxTrackOverlay) DEFINE_SEMANTIC_ITEM(false, false, KaxCodecDownloadURL)
DEFINE_SEMANTIC_ITEM(false, false, KaxTrackTranslate) DEFINE_SEMANTIC_ITEM(true, true, KaxCodecDecodeAll)
DEFINE_SEMANTIC_ITEM(false, true, KaxTrackAudio) #endif // MATROSKA_VERSION
DEFINE_SEMANTIC_ITEM(false, true, KaxTrackVideo) DEFINE_SEMANTIC_ITEM(false, false, KaxTrackOverlay)
DEFINE_SEMANTIC_ITEM(false, true, KaxContentEncodings) DEFINE_SEMANTIC_ITEM(false, false, KaxTrackTranslate)
DEFINE_END_SEMANTIC(KaxTrackEntry) DEFINE_SEMANTIC_ITEM(false, true, KaxTrackAudio)
DEFINE_SEMANTIC_ITEM(false, true, KaxTrackVideo)
DEFINE_MKX_MASTER (KaxTracks, 0x1654AE6B, 4, KaxSegment, "Tracks"); DEFINE_SEMANTIC_ITEM(false, true, KaxContentEncodings)
DEFINE_MKX_MASTER_CONS(KaxTrackEntry, 0xAE, 1, KaxTracks, "TrackEntry"); DEFINE_END_SEMANTIC(KaxTrackEntry)
KaxTrackEntry::KaxTrackEntry(EBML_EXTRA_DEF) DEFINE_MKX_MASTER (KaxTracks, 0x1654AE6B, 4, KaxSegment, "Tracks");
:EbmlMaster(EBML_CLASS_SEMCONTEXT(KaxTrackEntry) EBML_DEF_SEP EBML_EXTRA_CALL) DEFINE_MKX_MASTER_CONS(KaxTrackEntry, 0xAE, 1, KaxTracks, "TrackEntry");
,bGlobalTimecodeScaleIsSet(false)
{} #if MATROSKA_VERSION >= 2
DEFINE_START_SEMANTIC(KaxTrackDependency)
void KaxTrackEntry::EnableLacing(bool bEnable) DEFINE_SEMANTIC_ITEM(true, true, KaxTrackDependencyType)
{ DEFINE_SEMANTIC_ITEM(true, false, KaxTrackDependencyItem)
KaxTrackFlagLacing & myLacing = GetChild<KaxTrackFlagLacing>(*this); DEFINE_END_SEMANTIC(KaxTrackDependency)
*(static_cast<EbmlUInteger *>(&myLacing)) = bEnable ? 1 : 0;
} DEFINE_START_SEMANTIC(KaxTrackDependencyItem)
DEFINE_SEMANTIC_ITEM(true, true, KaxTrackDependencyUID)
END_LIBMATROSKA_NAMESPACE DEFINE_SEMANTIC_ITEM(false, true, KaxTrackDependencyStereoPos)
DEFINE_END_SEMANTIC(KaxTrackDependencyItem)
DEFINE_MKX_MASTER (KaxTrackDependency, 0xE2, 1, KaxTracks, "TrackDependency");
DEFINE_MKX_UINTEGER(KaxTrackDependencyType, 0xE3, 1, KaxTrackDependency, "TrackDependencyType");
DEFINE_MKX_MASTER (KaxTrackDependencyItem, 0xE4, 1, KaxTrackDependency, "TrackDependencyItem");
DEFINE_MKX_UINTEGER(KaxTrackDependencyUID, 0xE5, 1, KaxTrackDependencyItem, "TrackDependencyUID");
DEFINE_MKX_UINTEGER(KaxTrackDependencyStereoPos, 0xE9, 1, KaxTrackDependencyItem, "TrackDependencyStereoPos");
#endif
KaxTrackEntry::KaxTrackEntry(EBML_EXTRA_DEF)
:EbmlMaster(EBML_CLASS_SEMCONTEXT(KaxTrackEntry) EBML_DEF_SEP EBML_EXTRA_CALL)
,bGlobalTimecodeScaleIsSet(false)
{}
void KaxTrackEntry::EnableLacing(bool bEnable)
{
KaxTrackFlagLacing & myLacing = GetChild<KaxTrackFlagLacing>(*this);
*(static_cast<EbmlUInteger *>(&myLacing)) = bEnable ? 1 : 0;
}
END_LIBMATROSKA_NAMESPACE