FAVOR_MAX_SPEED .
REDUCE_SIZE .
FASTER_FLOAT .
-
+
SOURCE src/FileKax.cpp
SOURCE src/KaxAttached.cpp
SOURCE src/KaxAttachments.cpp
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = YES
FULL_PATH_NAMES = NO
-STRIP_FROM_PATH =
+STRIP_FROM_PATH =
INTERNAL_DOCS = NO
CASE_SENSE_NAMES = YES
SHORT_NAMES = NO
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
-ALIASES =
-ENABLED_SECTIONS =
+ALIASES =
+ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_JAVA = NO
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_FORMAT = "$file:$line: $text"
-WARN_LOGFILE =
+WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
FILE_PATTERNS = *.cpp \
*.h
RECURSIVE = NO
-EXCLUDE =
+EXCLUDE =
EXCLUDE_SYMLINKS = NO
-EXCLUDE_PATTERNS =
-EXAMPLE_PATH =
-EXAMPLE_PATTERNS =
+EXCLUDE_PATTERNS =
+EXAMPLE_PATH =
+EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = NO
-IMAGE_PATH =
-INPUT_FILTER =
+IMAGE_PATH =
+INPUT_FILTER =
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = NO
COLS_IN_ALPHA_INDEX = 5
-IGNORE_PREFIX =
+IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = html
HTML_FILE_EXTENSION = .html
-HTML_HEADER =
-HTML_FOOTER =
+HTML_HEADER =
+HTML_FOOTER =
HTML_STYLESHEET = libmatroska.css
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
-CHM_FILE =
-HHC_LOCATION =
+CHM_FILE =
+HHC_LOCATION =
GENERATE_CHI = NO
BINARY_TOC = NO
TOC_EXPAND = NO
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = YES
PAPER_TYPE = a4wide
-EXTRA_PACKAGES =
-LATEX_HEADER =
+EXTRA_PACKAGES =
+LATEX_HEADER =
PDF_HYPERLINKS = YES
USE_PDFLATEX = YES
LATEX_BATCHMODE = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = YES
-RTF_STYLESHEET_FILE =
-RTF_EXTENSIONS_FILE =
+RTF_STYLESHEET_FILE =
+RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
-XML_SCHEMA =
-XML_DTD =
+XML_SCHEMA =
+XML_DTD =
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
-PERLMOD_MAKEVAR_PREFIX =
+PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
+# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
-INCLUDE_PATH =
-INCLUDE_FILE_PATTERNS =
-PREDEFINED =
-EXPAND_AS_DEFINED =
+INCLUDE_PATH =
+INCLUDE_FILE_PATTERNS =
+PREDEFINED =
+EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
-# Configuration::addtions related to external references
+# Configuration::addtions related to external references
#---------------------------------------------------------------------------
-TAGFILES =
-GENERATE_TAGFILE =
+TAGFILES =
+GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
+# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = YES
HIDE_UNDOC_RELATIONS = YES
INCLUDED_BY_GRAPH = YES
GRAPHICAL_HIERARCHY = YES
DOT_IMAGE_FORMAT = png
-DOT_PATH =
-DOTFILE_DIRS =
+DOT_PATH =
+DOTFILE_DIRS =
MAX_DOT_GRAPH_WIDTH = 1024
MAX_DOT_GRAPH_HEIGHT = 1024
MAX_DOT_GRAPH_DEPTH = 0
GENERATE_LEGEND = YES
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
-# Configuration::addtions related to the search engine
+# Configuration::addtions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = NO
CGI_NAME = search.cgi
-CGI_URL =
-DOC_URL =
-DOC_ABSPATH =
+CGI_URL =
+DOC_URL =
+DOC_ABSPATH =
BIN_ABSPATH = /usr/local/bin/
-EXT_DOC_PATHS =
+EXT_DOC_PATHS =
test9.o: $(TAG_SRC_DIR)test9.cpp
$(CXX) -c $(COMPILEFLAGS) -o $@ $<
-install: $(targets_$(link):%=install_%) install_headers
+install: $(targets_$(link):%=install_%) install_headers
install_headers:
$(INSTALL) $(INSTALL_DIR_OPTS) -d $(DESTDIR)$(includedir)
INDENT =indent --gnu-style -ut -ts6 -br -npsl -npcs
DELETE =rm -f
-GLOBAL_CFLAGS = -Wall -Wno-unknown-pragmas -Wno-format
+GLOBAL_CFLAGS = -Wall -Wno-unknown-pragmas -Wno-format
DEBUG_CFLAGS = -g -O0 -DDEBUG ${GLOBAL_CFLAGS}
RELEASE_CFLAGS = -O2 ${GLOBAL_CFLAGS}
INCS = /I../.. /I$(EBML_DIR)
LDFLAGS = /NOLOGO /DLL /MAP:libmatroska.map /LIBPATH:$(EBML_DIR)/make/vc7 /VERSION:0.7
OPTMIZ = /G6 /O2 /Oi /GL /Wp64
-CXXFLAGS = $(INCS) /DWIN32 /nologo /DEBML_DLL
+CXXFLAGS = $(INCS) /DWIN32 /nologo /DEBML_DLL
ifeq (yes,$(DEBUG))
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**********************************************************************/
/*!
- \file
- \version \$Id: FileKax.h,v 1.5 2004/04/14 23:26:17 robux4 Exp $
- \author Steve Lhomme <robux4 @ users.sf.net>
+ \file
+ \version \$Id: FileKax.h,v 1.5 2004/04/14 23:26:17 robux4 Exp $
+ \author Steve Lhomme <robux4 @ users.sf.net>
*/
#ifndef LIBMATROSKA_FILE_H
#define LIBMATROSKA_FILE_H
*/
class MATROSKA_DLL_API FileMatroska {
public:
- FileMatroska(IOCallback & output);
- ~FileMatroska();
+ FileMatroska(IOCallback & output);
+ ~FileMatroska();
#ifdef OLD
- filepos_t RenderHead(const std::string & aEncoderApp);
- uint32 ReadHead();
- uint32 ReadTracks();
- uint32 ReadCodec();
- void Close(const uint32 aTimeLength);
-
- inline void type_SetInfo(const std::string & aStr) {myMainHeader.type_SetInfo(aStr);}
- inline void type_SetAds(const std::string & aStr) {myMainHeader.type_SetAds(aStr);}
- inline void type_SetSize(const std::string & aStr) {myMainHeader.type_SetSize(aStr);}
- inline void type_SetSize(uint64 aSize) {myMainHeader.type_SetSize(aSize);}
-
- inline uint8 GetTrackNumber() const { return myTracks.size(); }
-
- void track_SetName(Track * aTrack, const std::string & aName);
- void track_SetLaced(Track * aTrack, bool bLaced = true);
-
- Track * CreateTrack(const track_type aType);
- inline Track * GetTrack(const uint8 aTrackNb) const
- {
- if (aTrackNb > myTracks.size())
- return NULL;
- else
- return myTracks[aTrackNb-1];
- }
-
- void Track_GetInfo(const Track * aTrack, TrackInfo & aTrackInfo) const;
-
- void Track_SetInfo_Audio(Track * aTrack, const TrackInfoAudio & aTrackInfo);
- void Track_GetInfo_Audio(const Track * aTrack, TrackInfoAudio & aTrackInfo) const;
-
- void Track_SetInfo_Video(Track * aTrack, const TrackInfoVideo & aTrackInfo);
- void Track_GetInfo_Video(const Track * aTrack, TrackInfoVideo & aTrackInfo) const;
-
- void SelectReadingTrack(Track * aTrack, bool select = true);
-
- /*!
- \return wether the frame has been added or not
- */
- bool AddFrame(Track * aTrack, const uint32 aTimecode, const binary *aFrame, const uint32 aFrameSize,
- bool aKeyFrame = true, bool aBFrame = false);
-
- /*!
- \return wether the frame has been read or not
- */
- bool ReadFrame(Track * & aTrack, uint32 & aTimecode, const binary * & aFrame, uint32 & aFrameSize,
- bool & aKeyFrame, bool & aBFrame);
-
- /*
- Render the pending cluster to file
- */
- void Flush();
-
- void SetMaxClusterSize(const uint32 value);
- void SetMinClusterSize(const uint32 value) {myMinClusterSize = value;}
+ filepos_t RenderHead(const std::string & aEncoderApp);
+ uint32 ReadHead();
+ uint32 ReadTracks();
+ uint32 ReadCodec();
+ void Close(const uint32 aTimeLength);
+
+ inline void type_SetInfo(const std::string & aStr) {myMainHeader.type_SetInfo(aStr);}
+ inline void type_SetAds(const std::string & aStr) {myMainHeader.type_SetAds(aStr);}
+ inline void type_SetSize(const std::string & aStr) {myMainHeader.type_SetSize(aStr);}
+ inline void type_SetSize(uint64 aSize) {myMainHeader.type_SetSize(aSize);}
+
+ inline uint8 GetTrackNumber() const { return myTracks.size(); }
+
+ void track_SetName(Track * aTrack, const std::string & aName);
+ void track_SetLaced(Track * aTrack, bool bLaced = true);
+
+ Track * CreateTrack(const track_type aType);
+ inline Track * GetTrack(const uint8 aTrackNb) const
+ {
+ if (aTrackNb > myTracks.size())
+ return NULL;
+ else
+ return myTracks[aTrackNb-1];
+ }
+
+ void Track_GetInfo(const Track * aTrack, TrackInfo & aTrackInfo) const;
+
+ void Track_SetInfo_Audio(Track * aTrack, const TrackInfoAudio & aTrackInfo);
+ void Track_GetInfo_Audio(const Track * aTrack, TrackInfoAudio & aTrackInfo) const;
+
+ void Track_SetInfo_Video(Track * aTrack, const TrackInfoVideo & aTrackInfo);
+ void Track_GetInfo_Video(const Track * aTrack, TrackInfoVideo & aTrackInfo) const;
+
+ void SelectReadingTrack(Track * aTrack, bool select = true);
+
+ /*!
+ \return wether the frame has been added or not
+ */
+ bool AddFrame(Track * aTrack, const uint32 aTimecode, const binary *aFrame, const uint32 aFrameSize,
+ bool aKeyFrame = true, bool aBFrame = false);
+
+ /*!
+ \return wether the frame has been read or not
+ */
+ bool ReadFrame(Track * & aTrack, uint32 & aTimecode, const binary * & aFrame, uint32 & aFrameSize,
+ bool & aKeyFrame, bool & aBFrame);
+
+ /*
+ Render the pending cluster to file
+ */
+ void Flush();
+
+ void SetMaxClusterSize(const uint32 value);
+ void SetMinClusterSize(const uint32 value) {myMinClusterSize = value;}
protected:
- MainHeader myMainHeader;
+ MainHeader myMainHeader;
- std::vector<Track *> myTracks;
- std::vector<uint8> mySelectedTracks;
+ std::vector<Track *> myTracks;
+ std::vector<uint8> mySelectedTracks;
-// Track *findTrack(Track * aTrack) const;
+// Track *findTrack(Track * aTrack) const;
- Cluster myCurrWriteCluster; /// \todo merge with the write one ?
- uint32 myReadBlockNumber;
- Cluster myCurrReadCluster;
- binary * myCurrReadBlock; ///< The buffer containing the current read block
- uint32 myCurrReadBlockSize; ///< The size of the buffer containing the current read block
- uint8 myCurrReadBlockTrack; ///< The track number of the current track to read
+ Cluster myCurrWriteCluster; /// \todo merge with the write one ?
+ uint32 myReadBlockNumber;
+ Cluster myCurrReadCluster;
+ binary * myCurrReadBlock; ///< The buffer containing the current read block
+ uint32 myCurrReadBlockSize; ///< The size of the buffer containing the current read block
+ uint8 myCurrReadBlockTrack; ///< The track number of the current track to read
- uint32 myMaxClusterSize;
- uint32 myMinClusterSize;
+ uint32 myMaxClusterSize;
+ uint32 myMinClusterSize;
- StreamInfo myStreamInfo;
+ StreamInfo myStreamInfo;
- CodecHeader myCodecHeader;
+ CodecHeader myCodecHeader;
- inline bool IsMyTrack(const Track * aTrack) const;
- inline bool IsReadingTrack(const uint8 aTrackNum) const;
+ inline bool IsMyTrack(const Track * aTrack) const;
+ inline bool IsReadingTrack(const uint8 aTrackNum) const;
#endif // OLD
- IOCallback & myFile;
+ IOCallback & myFile;
};
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**********************************************************************/
/*!
- \file
- \version \$Id: KaxAttached.h,v 1.8 2004/04/14 23:26:17 robux4 Exp $
- \author Steve Lhomme <robux4 @ users.sf.net>
+ \file
+ \version \$Id: KaxAttached.h,v 1.8 2004/04/14 23:26:17 robux4 Exp $
+ \author Steve Lhomme <robux4 @ users.sf.net>
*/
#ifndef LIBMATROSKA_ATTACHED_H
#define LIBMATROSKA_ATTACHED_H
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**********************************************************************/
/*!
- \file
- \version \$Id: KaxAttachments.h,v 1.8 2004/04/14 23:26:17 robux4 Exp $
- \author Steve Lhomme <robux4 @ users.sf.net>
+ \file
+ \version \$Id: KaxAttachments.h,v 1.8 2004/04/14 23:26:17 robux4 Exp $
+ \author Steve Lhomme <robux4 @ users.sf.net>
*/
#ifndef LIBMATROSKA_ATTACHEMENTS_H
#define LIBMATROSKA_ATTACHEMENTS_H
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**********************************************************************/
/*!
- \file
- \todo add a PureBlock class to group functionalities between Block and BlockVirtual
- \version \$Id: KaxBlock.h,v 1.24 2004/04/14 23:26:17 robux4 Exp $
- \author Steve Lhomme <robux4 @ users.sf.net>
- \author Julien Coloos <suiryc @ users.sf.net>
+ \file
+ \todo add a PureBlock class to group functionalities between Block and BlockVirtual
+ \version \$Id: KaxBlock.h,v 1.24 2004/04/14 23:26:17 robux4 Exp $
+ \author Steve Lhomme <robux4 @ users.sf.net>
+ \author Julien Coloos <suiryc @ users.sf.net>
*/
#ifndef LIBMATROSKA_BLOCK_H
#define LIBMATROSKA_BLOCK_H
class KaxBlockBlob;
class MATROSKA_DLL_API DataBuffer {
- protected:
- binary * myBuffer;
- uint32 mySize;
- bool bValidValue;
- bool (*myFreeBuffer)(const DataBuffer & aBuffer); // method to free the internal buffer
- bool bInternalBuffer;
-
- public:
- DataBuffer(binary * aBuffer, uint32 aSize, bool (*aFreeBuffer)(const DataBuffer & aBuffer) = NULL, bool _bInternalBuffer = false)
- :myBuffer(NULL)
- ,mySize(aSize)
- ,bValidValue(true)
- ,myFreeBuffer(aFreeBuffer)
- ,bInternalBuffer(_bInternalBuffer)
- {
- if (bInternalBuffer)
- {
- myBuffer = new (std::nothrow) binary[mySize];
- if (myBuffer == NULL)
- bValidValue = false;
- else
- memcpy(myBuffer, aBuffer, mySize);
- }
- else
- myBuffer = aBuffer;
- }
-
- virtual ~DataBuffer() {}
- virtual binary * Buffer() {assert(bValidValue); return myBuffer;}
- virtual uint32 & Size() {return mySize;};
- virtual const binary * Buffer() const {assert(bValidValue); return myBuffer;}
- virtual uint32 Size() const {return mySize;};
- bool FreeBuffer(const DataBuffer & aBuffer) {
- bool bResult = true;
- if (myBuffer != NULL && bValidValue) {
- if (myFreeBuffer != NULL)
- bResult = myFreeBuffer(aBuffer);
- if (bInternalBuffer)
- delete [] myBuffer;
- myBuffer = NULL;
- mySize = 0;
- bValidValue = false;
- }
- return bResult;
- }
-
- virtual DataBuffer * Clone();
+ protected:
+ binary * myBuffer;
+ uint32 mySize;
+ bool bValidValue;
+ bool (*myFreeBuffer)(const DataBuffer & aBuffer); // method to free the internal buffer
+ bool bInternalBuffer;
+
+ public:
+ DataBuffer(binary * aBuffer, uint32 aSize, bool (*aFreeBuffer)(const DataBuffer & aBuffer) = NULL, bool _bInternalBuffer = false)
+ :myBuffer(NULL)
+ ,mySize(aSize)
+ ,bValidValue(true)
+ ,myFreeBuffer(aFreeBuffer)
+ ,bInternalBuffer(_bInternalBuffer)
+ {
+ if (bInternalBuffer)
+ {
+ myBuffer = new (std::nothrow) binary[mySize];
+ if (myBuffer == NULL)
+ bValidValue = false;
+ else
+ memcpy(myBuffer, aBuffer, mySize);
+ }
+ else
+ myBuffer = aBuffer;
+ }
+
+ virtual ~DataBuffer() {}
+ virtual binary * Buffer() {assert(bValidValue); return myBuffer;}
+ virtual uint32 & Size() {return mySize;};
+ virtual const binary * Buffer() const {assert(bValidValue); return myBuffer;}
+ virtual uint32 Size() const {return mySize;};
+ bool FreeBuffer(const DataBuffer & aBuffer) {
+ bool bResult = true;
+ if (myBuffer != NULL && bValidValue) {
+ if (myFreeBuffer != NULL)
+ bResult = myFreeBuffer(aBuffer);
+ if (bInternalBuffer)
+ delete [] myBuffer;
+ myBuffer = NULL;
+ mySize = 0;
+ bValidValue = false;
+ }
+ return bResult;
+ }
+
+ virtual DataBuffer * Clone();
};
class MATROSKA_DLL_API SimpleDataBuffer : public DataBuffer {
- public:
- SimpleDataBuffer(binary * aBuffer, uint32 aSize, uint32 aOffset, bool (*aFreeBuffer)(const DataBuffer & aBuffer) = myFreeBuffer)
- :DataBuffer(aBuffer + aOffset, aSize, aFreeBuffer)
- ,Offset(aOffset)
- ,BaseBuffer(aBuffer)
- {}
- virtual ~SimpleDataBuffer() {}
-
- DataBuffer * Clone() {return new SimpleDataBuffer(*this);}
-
- protected:
- uint32 Offset;
- binary * BaseBuffer;
-
- static bool myFreeBuffer(const DataBuffer & aBuffer)
- {
- binary *_Buffer = static_cast<const SimpleDataBuffer*>(&aBuffer)->BaseBuffer;
- if (_Buffer != NULL)
- free(_Buffer);
- return true;
- }
-
- SimpleDataBuffer(const SimpleDataBuffer & ToClone);
+ public:
+ SimpleDataBuffer(binary * aBuffer, uint32 aSize, uint32 aOffset, bool (*aFreeBuffer)(const DataBuffer & aBuffer) = myFreeBuffer)
+ :DataBuffer(aBuffer + aOffset, aSize, aFreeBuffer)
+ ,Offset(aOffset)
+ ,BaseBuffer(aBuffer)
+ {}
+ virtual ~SimpleDataBuffer() {}
+
+ DataBuffer * Clone() {return new SimpleDataBuffer(*this);}
+
+ protected:
+ uint32 Offset;
+ binary * BaseBuffer;
+
+ static bool myFreeBuffer(const DataBuffer & aBuffer)
+ {
+ binary *_Buffer = static_cast<const SimpleDataBuffer*>(&aBuffer)->BaseBuffer;
+ if (_Buffer != NULL)
+ free(_Buffer);
+ return true;
+ }
+
+ SimpleDataBuffer(const SimpleDataBuffer & ToClone);
};
/*!
- \note the data is copied locally, it can be freed right away
+ \note the data is copied locally, it can be freed right away
* /
class MATROSKA_DLL_API NotSoSimpleDataBuffer : public SimpleDataBuffer {
- public:
- NotSoSimpleDataBuffer(binary * aBuffer, uint32 aSize, uint32 aOffset)
- :SimpleDataBuffer(new binary[aSize - aOffset], aSize, 0)
- {
- memcpy(BaseBuffer, aBuffer + aOffset, aSize - aOffset);
- }
+ public:
+ NotSoSimpleDataBuffer(binary * aBuffer, uint32 aSize, uint32 aOffset)
+ :SimpleDataBuffer(new binary[aSize - aOffset], aSize, 0)
+ {
+ memcpy(BaseBuffer, aBuffer + aOffset, aSize - aOffset);
+ }
};
*/
DECLARE_MKX_MASTER(KaxBlockGroup)
- public:
- ~KaxBlockGroup();
-
- /*!
- \brief Addition of a frame without references
- */
- bool AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, LacingType lacing = LACING_AUTO);
- /*!
- \brief Addition of a frame with a backward reference (P frame)
- */
- bool AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, const KaxBlockGroup & PastBlock, LacingType lacing = LACING_AUTO);
-
- /*!
- \brief Addition of a frame with a backward+forward reference (B frame)
- */
- bool AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, const KaxBlockGroup & PastBlock, const KaxBlockGroup & ForwBlock, LacingType lacing = LACING_AUTO);
- bool AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, const KaxBlockBlob * PastBlock, const KaxBlockBlob * ForwBlock, LacingType lacing = LACING_AUTO);
-
- void SetParent(KaxCluster & aParentCluster);
-
- void SetParentTrack(const KaxTrackEntry & aParentTrack) {
- ParentTrack = &aParentTrack;
- }
-
- /*!
- \brief Set the duration of the contained frame(s) (for the total number of frames)
- */
- void SetBlockDuration(uint64 TimeLength);
- bool GetBlockDuration(uint64 &TheTimecode) const;
-
- /*!
- \return the global timecode of this Block (not just the delta to the Cluster)
- */
- uint64 GlobalTimecode() const;
- uint64 GlobalTimecodeScale() const {
- assert(ParentTrack != NULL);
- return ParentTrack->GlobalTimecodeScale();
- }
-
- uint16 TrackNumber() const;
-
- uint64 ClusterPosition() const;
-
- /*!
- \return the number of references to other frames
- */
- unsigned int ReferenceCount() const;
- const KaxReferenceBlock & Reference(unsigned int Index) const;
-
- /*!
- \brief release all the frames of all Blocks
- */
- void ReleaseFrames();
-
- operator KaxInternalBlock &();
-
- const KaxCluster *GetParentCluster() const { return ParentCluster; }
-
- protected:
- KaxCluster * ParentCluster;
- const KaxTrackEntry * ParentTrack;
+ public:
+ ~KaxBlockGroup();
+
+ /*!
+ \brief Addition of a frame without references
+ */
+ bool AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, LacingType lacing = LACING_AUTO);
+ /*!
+ \brief Addition of a frame with a backward reference (P frame)
+ */
+ bool AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, const KaxBlockGroup & PastBlock, LacingType lacing = LACING_AUTO);
+
+ /*!
+ \brief Addition of a frame with a backward+forward reference (B frame)
+ */
+ bool AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, const KaxBlockGroup & PastBlock, const KaxBlockGroup & ForwBlock, LacingType lacing = LACING_AUTO);
+ bool AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, const KaxBlockBlob * PastBlock, const KaxBlockBlob * ForwBlock, LacingType lacing = LACING_AUTO);
+
+ void SetParent(KaxCluster & aParentCluster);
+
+ void SetParentTrack(const KaxTrackEntry & aParentTrack) {
+ ParentTrack = &aParentTrack;
+ }
+
+ /*!
+ \brief Set the duration of the contained frame(s) (for the total number of frames)
+ */
+ void SetBlockDuration(uint64 TimeLength);
+ bool GetBlockDuration(uint64 &TheTimecode) const;
+
+ /*!
+ \return the global timecode of this Block (not just the delta to the Cluster)
+ */
+ uint64 GlobalTimecode() const;
+ uint64 GlobalTimecodeScale() const {
+ assert(ParentTrack != NULL);
+ return ParentTrack->GlobalTimecodeScale();
+ }
+
+ uint16 TrackNumber() const;
+
+ uint64 ClusterPosition() const;
+
+ /*!
+ \return the number of references to other frames
+ */
+ unsigned int ReferenceCount() const;
+ const KaxReferenceBlock & Reference(unsigned int Index) const;
+
+ /*!
+ \brief release all the frames of all Blocks
+ */
+ void ReleaseFrames();
+
+ operator KaxInternalBlock &();
+
+ const KaxCluster *GetParentCluster() const { return ParentCluster; }
+
+ protected:
+ KaxCluster * ParentCluster;
+ const KaxTrackEntry * ParentTrack;
};
class KaxInternalBlock : public EbmlBinary {
- public:
- KaxInternalBlock(EBML_DEF_CONS EBML_DEF_SEP bool bSimple EBML_DEF_SEP EBML_EXTRA_PARAM) :EBML_DEF_BINARY_INIT EBML_DEF_SEP bLocalTimecodeUsed(false), mLacing(LACING_AUTO), mInvisible(false)
- ,ParentCluster(NULL), bIsSimple(bSimple), bIsKeyframe(true), bIsDiscardable(false)
- {}
- KaxInternalBlock(const KaxInternalBlock & ElementToClone);
- ~KaxInternalBlock();
- virtual bool ValidateSize() const;
-
- uint16 TrackNum() const {return TrackNumber;}
- /*!
- \todo !!!! This method needs to be changes !
- */
- uint64 GlobalTimecode() const {return Timecode;}
-
- /*!
- \note override this function to generate the Data/Size on the fly, unlike the usual binary elements
- */
- filepos_t UpdateSize(bool bSaveDefault = false, bool bForceRender = false);
- filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA);
-
- /*!
- \brief Only read the head of the Block (not internal data)
- \note convenient when you are parsing the file quickly
- */
- uint64 ReadInternalHead(IOCallback & input);
-
- unsigned int NumberFrames() const { return SizeList.size();}
- DataBuffer & GetBuffer(unsigned int iIndex) {return *myBuffers[iIndex];}
-
- bool AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, LacingType lacing = LACING_AUTO, bool invisible = false);
-
- /*!
- \brief release all the frames of all Blocks
- */
- void ReleaseFrames();
-
- void SetParent(KaxCluster & aParentCluster);
-
- /*!
- \return Returns the lacing type that produces the smallest footprint.
- */
- LacingType GetBestLacingType() const;
-
- /*!
- \param FrameNumber 0 for the first frame
- \return the position in the stream for a given frame
- \note return -1 if the position doesn't exist
- */
- int64 GetDataPosition(size_t FrameNumber = 0);
-
- /*!
- \param FrameNumber 0 for the first frame
- \return the size of a given frame
- \note return -1 if the position doesn't exist
- */
- int64 GetFrameSize(size_t FrameNumber = 0);
-
- bool IsInvisible() const { return mInvisible; }
-
- uint64 ClusterPosition() const;
-
- protected:
- std::vector<DataBuffer *> myBuffers;
- std::vector<int32> SizeList;
- uint64 Timecode; // temporary timecode of the first frame, non scaled
- int16 LocalTimecode;
- bool bLocalTimecodeUsed;
- uint16 TrackNumber;
- LacingType mLacing;
- bool mInvisible;
- uint64 FirstFrameLocation;
-
- filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault = false);
-
- KaxCluster * ParentCluster;
- bool bIsSimple;
- bool bIsKeyframe;
- bool bIsDiscardable;
+ public:
+ KaxInternalBlock(EBML_DEF_CONS EBML_DEF_SEP bool bSimple EBML_DEF_SEP EBML_EXTRA_PARAM) :EBML_DEF_BINARY_INIT EBML_DEF_SEP bLocalTimecodeUsed(false), mLacing(LACING_AUTO), mInvisible(false)
+ ,ParentCluster(NULL), bIsSimple(bSimple), bIsKeyframe(true), bIsDiscardable(false)
+ {}
+ KaxInternalBlock(const KaxInternalBlock & ElementToClone);
+ ~KaxInternalBlock();
+ virtual bool ValidateSize() const;
+
+ uint16 TrackNum() const {return TrackNumber;}
+ /*!
+ \todo !!!! This method needs to be changes !
+ */
+ uint64 GlobalTimecode() const {return Timecode;}
+
+ /*!
+ \note override this function to generate the Data/Size on the fly, unlike the usual binary elements
+ */
+ filepos_t UpdateSize(bool bSaveDefault = false, bool bForceRender = false);
+ filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA);
+
+ /*!
+ \brief Only read the head of the Block (not internal data)
+ \note convenient when you are parsing the file quickly
+ */
+ uint64 ReadInternalHead(IOCallback & input);
+
+ unsigned int NumberFrames() const { return SizeList.size();}
+ DataBuffer & GetBuffer(unsigned int iIndex) {return *myBuffers[iIndex];}
+
+ bool AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, LacingType lacing = LACING_AUTO, bool invisible = false);
+
+ /*!
+ \brief release all the frames of all Blocks
+ */
+ void ReleaseFrames();
+
+ void SetParent(KaxCluster & aParentCluster);
+
+ /*!
+ \return Returns the lacing type that produces the smallest footprint.
+ */
+ LacingType GetBestLacingType() const;
+
+ /*!
+ \param FrameNumber 0 for the first frame
+ \return the position in the stream for a given frame
+ \note return -1 if the position doesn't exist
+ */
+ int64 GetDataPosition(size_t FrameNumber = 0);
+
+ /*!
+ \param FrameNumber 0 for the first frame
+ \return the size of a given frame
+ \note return -1 if the position doesn't exist
+ */
+ int64 GetFrameSize(size_t FrameNumber = 0);
+
+ bool IsInvisible() const { return mInvisible; }
+
+ uint64 ClusterPosition() const;
+
+ protected:
+ std::vector<DataBuffer *> myBuffers;
+ std::vector<int32> SizeList;
+ uint64 Timecode; // temporary timecode of the first frame, non scaled
+ int16 LocalTimecode;
+ bool bLocalTimecodeUsed;
+ uint16 TrackNumber;
+ LacingType mLacing;
+ bool mInvisible;
+ uint64 FirstFrameLocation;
+
+ filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault = false);
+
+ KaxCluster * ParentCluster;
+ bool bIsSimple;
+ bool bIsKeyframe;
+ bool bIsDiscardable;
};
DECLARE_MKX_CONTEXT(KaxBlock);
class MATROSKA_DLL_API KaxBlock : public KaxInternalBlock {
- public:
- KaxBlock(EBML_EXTRA_PARAM) :KaxInternalBlock(EBML_DEF_BINARY_CTX(KaxBlock)EBML_DEF_SEP false EBML_DEF_SEP EBML_EXTRA_CALL) {}
+ public:
+ KaxBlock(EBML_EXTRA_PARAM) :KaxInternalBlock(EBML_DEF_BINARY_CTX(KaxBlock)EBML_DEF_SEP false EBML_DEF_SEP EBML_EXTRA_CALL) {}
EBML_CONCRETE_CLASS(KaxBlock)
};
#if MATROSKA_VERSION >= 2
DECLARE_MKX_CONTEXT(KaxSimpleBlock);
class MATROSKA_DLL_API KaxSimpleBlock : public KaxInternalBlock {
- public:
- KaxSimpleBlock(EBML_EXTRA_PARAM) :KaxInternalBlock(EBML_DEF_BINARY_CTX(KaxSimpleBlock)EBML_DEF_SEP true EBML_DEF_SEP EBML_EXTRA_CALL) {}
+ public:
+ KaxSimpleBlock(EBML_EXTRA_PARAM) :KaxInternalBlock(EBML_DEF_BINARY_CTX(KaxSimpleBlock)EBML_DEF_SEP true EBML_DEF_SEP EBML_EXTRA_CALL) {}
- void SetKeyframe(bool b_keyframe) { bIsKeyframe = b_keyframe; }
- void SetDiscardable(bool b_discard) { bIsDiscardable = b_discard; }
+ void SetKeyframe(bool b_keyframe) { bIsKeyframe = b_keyframe; }
+ void SetDiscardable(bool b_discard) { bIsDiscardable = b_discard; }
- bool IsKeyframe() const { return bIsKeyframe; }
- bool IsDiscardable() const { return bIsDiscardable; }
+ bool IsKeyframe() const { return bIsKeyframe; }
+ bool IsDiscardable() const { return bIsDiscardable; }
- void SetParent(KaxCluster & aParentCluster);
+ void SetParent(KaxCluster & aParentCluster);
EBML_CONCRETE_CLASS(KaxSimpleBlock)
};
/// Placeholder class for either a BlockGroup or a SimpleBlock
class MATROSKA_DLL_API KaxBlockBlob {
public:
- KaxBlockBlob(BlockBlobType sblock_mode) :ParentCluster(NULL), SimpleBlockMode(sblock_mode) {
- bUseSimpleBlock = (sblock_mode != BLOCK_BLOB_NO_SIMPLE);
- Block.group = NULL;
- }
+ KaxBlockBlob(BlockBlobType sblock_mode) :ParentCluster(NULL), SimpleBlockMode(sblock_mode) {
+ bUseSimpleBlock = (sblock_mode != BLOCK_BLOB_NO_SIMPLE);
+ Block.group = NULL;
+ }
- ~KaxBlockBlob() {
+ ~KaxBlockBlob() {
#if MATROSKA_VERSION >= 2
- if (bUseSimpleBlock)
- delete Block.simpleblock;
- else
+ if (bUseSimpleBlock)
+ delete Block.simpleblock;
+ else
#endif // MATROSKA_VERSION
- delete Block.group;
- }
+ delete Block.group;
+ }
- operator KaxBlockGroup &();
- operator const KaxBlockGroup &() const;
+ operator KaxBlockGroup &();
+ operator const KaxBlockGroup &() const;
#if MATROSKA_VERSION >= 2
- operator KaxSimpleBlock &();
+ operator KaxSimpleBlock &();
#endif
- operator KaxInternalBlock &();
- operator const KaxInternalBlock &() const;
+ operator KaxInternalBlock &();
+ operator const KaxInternalBlock &() const;
- void SetBlockGroup( KaxBlockGroup &BlockRef );
+ void SetBlockGroup( KaxBlockGroup &BlockRef );
- void SetBlockDuration(uint64 TimeLength);
+ void SetBlockDuration(uint64 TimeLength);
- void SetParent(KaxCluster & aParentCluster);
- bool AddFrameAuto(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, LacingType lacing = LACING_AUTO, const KaxBlockBlob * PastBlock = NULL, const KaxBlockBlob * ForwBlock = NULL);
+ void SetParent(KaxCluster & aParentCluster);
+ bool AddFrameAuto(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, LacingType lacing = LACING_AUTO, const KaxBlockBlob * PastBlock = NULL, const KaxBlockBlob * ForwBlock = NULL);
- bool IsSimpleBlock() const {return bUseSimpleBlock;}
+ bool IsSimpleBlock() const {return bUseSimpleBlock;}
- bool ReplaceSimpleByGroup();
+ bool ReplaceSimpleByGroup();
protected:
- KaxCluster * ParentCluster;
- union {
- KaxBlockGroup *group;
+ KaxCluster * ParentCluster;
+ union {
+ KaxBlockGroup *group;
#if MATROSKA_VERSION >= 2
- KaxSimpleBlock *simpleblock;
+ KaxSimpleBlock *simpleblock;
#endif // MATROSKA_VERSION
- } Block;
- bool bUseSimpleBlock;
- BlockBlobType SimpleBlockMode;
+ } Block;
+ bool bUseSimpleBlock;
+ BlockBlobType SimpleBlockMode;
};
#if MATROSKA_VERSION >= 2
DECLARE_MKX_BINARY_CONS(KaxBlockVirtual)
- public:
- ~KaxBlockVirtual();
+ public:
+ ~KaxBlockVirtual();
- /*!
- \note override this function to generate the Data/Size on the fly, unlike the usual binary elements
- */
- filepos_t UpdateSize(bool bSaveDefault = false, bool bForceRender = false);
+ /*!
+ \note override this function to generate the Data/Size on the fly, unlike the usual binary elements
+ */
+ filepos_t UpdateSize(bool bSaveDefault = false, bool bForceRender = false);
- void SetParent(const KaxCluster & aParentCluster) {ParentCluster = &aParentCluster;}
+ void SetParent(const KaxCluster & aParentCluster) {ParentCluster = &aParentCluster;}
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
-
+
filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA);
- protected:
- uint64 Timecode; // temporary timecode of the first frame if there are more than one
- uint16 TrackNumber;
- binary DataBlock[5];
+ protected:
+ uint64 Timecode; // temporary timecode of the first frame if there are more than one
+ uint16 TrackNumber;
+ binary DataBlock[5];
- const KaxCluster * ParentCluster;
+ const KaxCluster * ParentCluster;
};
#endif // MATROSKA_VERSION
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**********************************************************************/
/*!
- \file
- \version \$Id: KaxBlockData.h,v 1.10 2004/04/14 23:26:17 robux4 Exp $
- \author Steve Lhomme <robux4 @ users.sf.net>
+ \file
+ \version \$Id: KaxBlockData.h,v 1.10 2004/04/14 23:26:17 robux4 Exp $
+ \author Steve Lhomme <robux4 @ users.sf.net>
*/
#ifndef LIBMATROSKA_BLOCK_ADDITIONAL_H
#define LIBMATROSKA_BLOCK_ADDITIONAL_H
START_LIBMATROSKA_NAMESPACE
/*!
- \brief element used for B frame-likes
+ \brief element used for B frame-likes
*/
DECLARE_MKX_SINTEGER_CONS(KaxReferenceBlock)
- public:
+ public:
~KaxReferenceBlock();
- /*!
- \brief override this method to compute the timecode value
- */
- virtual filepos_t UpdateSize(bool bSaveDefault = false, bool bForceRender = false);
+ /*!
+ \brief override this method to compute the timecode value
+ */
+ virtual filepos_t UpdateSize(bool bSaveDefault = false, bool bForceRender = false);
+
+ const KaxBlockBlob & RefBlock() const;
+ void SetReferencedBlock(const KaxBlockBlob * aRefdBlock);
+ void SetReferencedBlock(const KaxBlockGroup & aRefdBlock);
+ void SetParentBlock(const KaxBlockGroup & aParentBlock) {ParentBlock = &aParentBlock;}
- const KaxBlockBlob & RefBlock() const;
- void SetReferencedBlock(const KaxBlockBlob * aRefdBlock);
- void SetReferencedBlock(const KaxBlockGroup & aRefdBlock);
- void SetParentBlock(const KaxBlockGroup & aParentBlock) {ParentBlock = &aParentBlock;}
-
- protected:
- const KaxBlockBlob * RefdBlock;
- const KaxBlockGroup * ParentBlock;
- void SetReferencedTimecode(int64 refTimecode) {*static_cast<EbmlSInteger*>(this) = refTimecode; bTimecodeSet = true;};
- bool bTimecodeSet;
+ protected:
+ const KaxBlockBlob * RefdBlock;
+ const KaxBlockGroup * ParentBlock;
+ void SetReferencedTimecode(int64 refTimecode) {*static_cast<EbmlSInteger*>(this) = refTimecode; bTimecodeSet = true;};
+ bool bTimecodeSet;
bool bOurBlob;
void FreeBlob();
};
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**********************************************************************/
/*!
- \file
- \version \$Id$
- \author Steve Lhomme <robux4 @ users.sf.net>
+ \file
+ \version \$Id$
+ \author Steve Lhomme <robux4 @ users.sf.net>
*/
#ifndef LIBMATROSKA_CHAPTERS_H
#define LIBMATROSKA_CHAPTERS_H
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**********************************************************************/
/*!
- \file
- \version \$Id: KaxCluster.h,v 1.10 2004/04/14 23:26:17 robux4 Exp $
- \author Steve Lhomme <robux4 @ users.sf.net>
- \author Julien Coloos <suiryc @ users.sf.net>
+ \file
+ \version \$Id: KaxCluster.h,v 1.10 2004/04/14 23:26:17 robux4 Exp $
+ \author Steve Lhomme <robux4 @ users.sf.net>
+ \author Julien Coloos <suiryc @ users.sf.net>
*/
#ifndef LIBMATROSKA_CLUSTER_H
class KaxSegment;
DECLARE_MKX_MASTER_CONS(KaxCluster)
- public:
- /*!
- \brief Addition of a frame without references
-
- \param the timecode is expressed in nanoseconds, relative to the beggining of the Segment
- */
- bool AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, KaxBlockGroup * & MyNewBlock, LacingType lacing = LACING_AUTO);
- /*!
- \brief Addition of a frame with a backward reference (P frame)
- \param the timecode is expressed in nanoseconds, relative to the beggining of the Segment
-
- */
- bool AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, KaxBlockGroup * & MyNewBlock, const KaxBlockGroup & PastBlock, LacingType lacing = LACING_AUTO);
-
- /*!
- \brief Addition of a frame with a backward+forward reference (B frame)
- \param the timecode is expressed in nanoseconds, relative to the beggining of the Segment
-
- */
- bool AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, KaxBlockGroup * & MyNewBlock, const KaxBlockGroup & PastBlock, const KaxBlockGroup & ForwBlock, LacingType lacing = LACING_AUTO);
-
- /*!
- \brief Render the data to the stream and retrieve the position of BlockGroups for later cue entries
- */
- filepos_t Render(IOCallback & output, KaxCues & CueToUpdate, bool bSaveDefault = false);
-
- /*!
- \return the global timecode of this Cluster
- */
- uint64 GlobalTimecode() const;
-
- KaxBlockGroup & GetNewBlock();
-
- /*!
- \brief release all the frames of all Blocks
- \note this is a convenience to be able to keep Clusters+Blocks in memory (for future reference) withouht being a memory hog
- */
- void ReleaseFrames();
-
- /*!
- \brief return the position offset compared to the beggining of the Segment
- */
- uint64 GetPosition() const;
-
- void SetParent(const KaxSegment & aParentSegment) {ParentSegment = &aParentSegment;}
-
- void SetPreviousTimecode(uint64 aPreviousTimecode, int64 aTimecodeScale) {
- bPreviousTimecodeIsSet = true;
- PreviousTimecode = aPreviousTimecode;
- SetGlobalTimecodeScale(aTimecodeScale);
- }
-
- /*!
- \note dirty hack to get the mandatory data back after reading
- \todo there should be a better way to get mandatory data
- */
- void InitTimecode(uint64 aTimecode, int64 aTimecodeScale) {
- SetGlobalTimecodeScale(aTimecodeScale);
- MinTimecode = MaxTimecode = PreviousTimecode = aTimecode * TimecodeScale;
- bFirstFrameInside = bPreviousTimecodeIsSet = true;
- }
-
- int16 GetBlockLocalTimecode(uint64 GlobalTimecode) const;
-
- uint64 GetBlockGlobalTimecode(int16 LocalTimecode);
-
- void SetGlobalTimecodeScale(uint64 aGlobalTimecodeScale) {
- TimecodeScale = aGlobalTimecodeScale;
- bTimecodeScaleIsSet = true;
- }
- uint64 GlobalTimecodeScale() const {
- assert(bTimecodeScaleIsSet);
- return TimecodeScale;
- }
-
- bool SetSilentTrackUsed()
- {
- bSilentTracksUsed = true;
- return FindFirstElt(EBML_INFO(KaxClusterSilentTracks), true) != NULL;
- }
-
- bool AddBlockBlob(KaxBlockBlob * NewBlob);
-
- const KaxSegment *GetParentSegment() const { return ParentSegment; }
-
- protected:
- KaxBlockBlob * currentNewBlob;
- std::vector<KaxBlockBlob*> Blobs;
- KaxBlockGroup * currentNewBlock;
- const KaxSegment * ParentSegment;
-
- uint64 MinTimecode, MaxTimecode, PreviousTimecode;
- int64 TimecodeScale;
-
- bool bFirstFrameInside; // used to speed research
- bool bPreviousTimecodeIsSet;
- bool bTimecodeScaleIsSet;
- bool bSilentTracksUsed;
-
- /*!
- \note method used internally
- */
- bool AddFrameInternal(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, KaxBlockGroup * & MyNewBlock, const KaxBlockGroup * PastBlock, const KaxBlockGroup * ForwBlock, LacingType lacing);
+ public:
+ /*!
+ \brief Addition of a frame without references
+
+ \param the timecode is expressed in nanoseconds, relative to the beggining of the Segment
+ */
+ bool AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, KaxBlockGroup * & MyNewBlock, LacingType lacing = LACING_AUTO);
+ /*!
+ \brief Addition of a frame with a backward reference (P frame)
+ \param the timecode is expressed in nanoseconds, relative to the beggining of the Segment
+
+ */
+ bool AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, KaxBlockGroup * & MyNewBlock, const KaxBlockGroup & PastBlock, LacingType lacing = LACING_AUTO);
+
+ /*!
+ \brief Addition of a frame with a backward+forward reference (B frame)
+ \param the timecode is expressed in nanoseconds, relative to the beggining of the Segment
+
+ */
+ bool AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, KaxBlockGroup * & MyNewBlock, const KaxBlockGroup & PastBlock, const KaxBlockGroup & ForwBlock, LacingType lacing = LACING_AUTO);
+
+ /*!
+ \brief Render the data to the stream and retrieve the position of BlockGroups for later cue entries
+ */
+ filepos_t Render(IOCallback & output, KaxCues & CueToUpdate, bool bSaveDefault = false);
+
+ /*!
+ \return the global timecode of this Cluster
+ */
+ uint64 GlobalTimecode() const;
+
+ KaxBlockGroup & GetNewBlock();
+
+ /*!
+ \brief release all the frames of all Blocks
+ \note this is a convenience to be able to keep Clusters+Blocks in memory (for future reference) withouht being a memory hog
+ */
+ void ReleaseFrames();
+
+ /*!
+ \brief return the position offset compared to the beggining of the Segment
+ */
+ uint64 GetPosition() const;
+
+ void SetParent(const KaxSegment & aParentSegment) {ParentSegment = &aParentSegment;}
+
+ void SetPreviousTimecode(uint64 aPreviousTimecode, int64 aTimecodeScale) {
+ bPreviousTimecodeIsSet = true;
+ PreviousTimecode = aPreviousTimecode;
+ SetGlobalTimecodeScale(aTimecodeScale);
+ }
+
+ /*!
+ \note dirty hack to get the mandatory data back after reading
+ \todo there should be a better way to get mandatory data
+ */
+ void InitTimecode(uint64 aTimecode, int64 aTimecodeScale) {
+ SetGlobalTimecodeScale(aTimecodeScale);
+ MinTimecode = MaxTimecode = PreviousTimecode = aTimecode * TimecodeScale;
+ bFirstFrameInside = bPreviousTimecodeIsSet = true;
+ }
+
+ int16 GetBlockLocalTimecode(uint64 GlobalTimecode) const;
+
+ uint64 GetBlockGlobalTimecode(int16 LocalTimecode);
+
+ void SetGlobalTimecodeScale(uint64 aGlobalTimecodeScale) {
+ TimecodeScale = aGlobalTimecodeScale;
+ bTimecodeScaleIsSet = true;
+ }
+ uint64 GlobalTimecodeScale() const {
+ assert(bTimecodeScaleIsSet);
+ return TimecodeScale;
+ }
+
+ bool SetSilentTrackUsed()
+ {
+ bSilentTracksUsed = true;
+ return FindFirstElt(EBML_INFO(KaxClusterSilentTracks), true) != NULL;
+ }
+
+ bool AddBlockBlob(KaxBlockBlob * NewBlob);
+
+ const KaxSegment *GetParentSegment() const { return ParentSegment; }
+
+ protected:
+ KaxBlockBlob * currentNewBlob;
+ std::vector<KaxBlockBlob*> Blobs;
+ KaxBlockGroup * currentNewBlock;
+ const KaxSegment * ParentSegment;
+
+ uint64 MinTimecode, MaxTimecode, PreviousTimecode;
+ int64 TimecodeScale;
+
+ bool bFirstFrameInside; // used to speed research
+ bool bPreviousTimecodeIsSet;
+ bool bTimecodeScaleIsSet;
+ bool bSilentTracksUsed;
+
+ /*!
+ \note method used internally
+ */
+ bool AddFrameInternal(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, KaxBlockGroup * & MyNewBlock, const KaxBlockGroup * PastBlock, const KaxBlockGroup * ForwBlock, LacingType lacing);
};
END_LIBMATROSKA_NAMESPACE
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**********************************************************************/
/*!
- \file
- \version \$Id: KaxClusterData.h,v 1.9 2004/04/21 19:50:10 mosu Exp $
- \author Steve Lhomme <robux4 @ users.sf.net>
+ \file
+ \version \$Id: KaxClusterData.h,v 1.9 2004/04/21 19:50:10 mosu Exp $
+ \author Steve Lhomme <robux4 @ users.sf.net>
*/
#ifndef LIBMATROSKA_CLUSTER_DATA_H
#define LIBMATROSKA_CLUSTER_DATA_H
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**********************************************************************/
/*!
- \file
- \version \$Id: KaxConfig.h,v 1.7 2004/04/14 23:26:17 robux4 Exp $
- \author Steve Lhomme <robux4 @ users.sf.net>
- \author Moritz Bunkus <moritz @ bunkus.org>
+ \file
+ \version \$Id: KaxConfig.h,v 1.7 2004/04/14 23:26:17 robux4 Exp $
+ \author Steve Lhomme <robux4 @ users.sf.net>
+ \author Moritz Bunkus <moritz @ bunkus.org>
*/
#ifndef LIBMATROSKA_CONFIG_H
#define LIBMATROSKA_CONFIG_H
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**********************************************************************/
/*!
- \file
- \version \$Id: KaxContentEncoding.h,v 1.7 2004/04/14 23:26:17 robux4 Exp $
- \author Steve Lhomme <robux4 @ users.sf.net>
+ \file
+ \version \$Id: KaxContentEncoding.h,v 1.7 2004/04/14 23:26:17 robux4 Exp $
+ \author Steve Lhomme <robux4 @ users.sf.net>
*/
#ifndef LIBMATROSKA_CONTENT_ENCODING_H
#define LIBMATROSKA_CONTENT_ENCODING_H
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**********************************************************************/
/*!
- \file
- \version \$Id$
- \author Steve Lhomme <robux4 @ users.sf.net>
+ \file
+ \version \$Id$
+ \author Steve Lhomme <robux4 @ users.sf.net>
*/
#ifndef LIBMATROSKA_CONTEXTS_H
#define LIBMATROSKA_CONTEXTS_H
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**********************************************************************/
/*!
- \file
- \version \$Id: KaxCues.h,v 1.7 2004/04/14 23:26:17 robux4 Exp $
- \author Steve Lhomme <robux4 @ users.sf.net>
+ \file
+ \version \$Id: KaxCues.h,v 1.7 2004/04/14 23:26:17 robux4 Exp $
+ \author Steve Lhomme <robux4 @ users.sf.net>
*/
#ifndef LIBMATROSKA_CUES_H
#define LIBMATROSKA_CUES_H
class KaxCuePoint;
DECLARE_MKX_MASTER(KaxCues)
- public:
- ~KaxCues();
+ public:
+ ~KaxCues();
- //bool AddBlockGroup(const KaxBlockGroup & BlockReference); // deprecated
- bool AddBlockBlob(const KaxBlockBlob & BlockReference);
+ //bool AddBlockGroup(const KaxBlockGroup & BlockReference); // deprecated
+ bool AddBlockBlob(const KaxBlockBlob & BlockReference);
- /*!
- \brief Indicate that the position for this Block is set
- */
- void PositionSet(const KaxBlockGroup & BlockReference);
- void PositionSet(const KaxBlockBlob & BlockReference);
+ /*!
+ \brief Indicate that the position for this Block is set
+ */
+ void PositionSet(const KaxBlockGroup & BlockReference);
+ void PositionSet(const KaxBlockBlob & BlockReference);
- /*!
- \brief override to sort by timecode/track
- */
- filepos_t Render(IOCallback & output, bool bSaveDefault = false) {
- Sort();
- return EbmlMaster::Render(output, bSaveDefault);
- }
+ /*!
+ \brief override to sort by timecode/track
+ */
+ filepos_t Render(IOCallback & output, bool bSaveDefault = false) {
+ Sort();
+ return EbmlMaster::Render(output, bSaveDefault);
+ }
- uint64 GetTimecodePosition(uint64 aTimecode) const;
- const KaxCuePoint * GetTimecodePoint(uint64 aTimecode) const;
+ uint64 GetTimecodePosition(uint64 aTimecode) const;
+ const KaxCuePoint * GetTimecodePoint(uint64 aTimecode) const;
- void SetGlobalTimecodeScale(uint64 aGlobalTimecodeScale) {
- mGlobalTimecodeScale = aGlobalTimecodeScale;
- bGlobalTimecodeScaleIsSet = true;
- }
- uint64 GlobalTimecodeScale() const {
- assert(bGlobalTimecodeScaleIsSet);
- return mGlobalTimecodeScale;
- }
+ void SetGlobalTimecodeScale(uint64 aGlobalTimecodeScale) {
+ mGlobalTimecodeScale = aGlobalTimecodeScale;
+ bGlobalTimecodeScaleIsSet = true;
+ }
+ uint64 GlobalTimecodeScale() const {
+ assert(bGlobalTimecodeScaleIsSet);
+ return mGlobalTimecodeScale;
+ }
- protected:
- std::vector<const KaxBlockBlob *> myTempReferences;
- bool bGlobalTimecodeScaleIsSet;
- uint64 mGlobalTimecodeScale;
+ protected:
+ std::vector<const KaxBlockBlob *> myTempReferences;
+ bool bGlobalTimecodeScaleIsSet;
+ uint64 mGlobalTimecodeScale;
};
END_LIBMATROSKA_NAMESPACE
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**********************************************************************/
/*!
- \file
- \version \$Id: KaxCuesData.h,v 1.8 2004/04/14 23:26:17 robux4 Exp $
- \author Steve Lhomme <robux4 @ users.sf.net>
+ \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
class KaxInternalBlock;
DECLARE_MKX_MASTER(KaxCuePoint)
- public:
- void PositionSet(const KaxBlockGroup & BlockReference, uint64 GlobalTimecodeScale);
- void PositionSet(const KaxBlockBlob & BlobReference, uint64 GlobalTimecodeScale);
+ public:
+ void PositionSet(const KaxBlockGroup & BlockReference, uint64 GlobalTimecodeScale);
+ void PositionSet(const KaxBlockBlob & BlobReference, uint64 GlobalTimecodeScale);
- virtual bool IsSmallerThan(const EbmlElement *Cmp) const;
+ virtual bool IsSmallerThan(const EbmlElement *Cmp) const;
- const KaxCueTrackPositions * GetSeekPosition() const;
- bool Timecode(uint64 & aTimecode, uint64 GlobalTimecodeScale) const;
+ const KaxCueTrackPositions * GetSeekPosition() const;
+ bool Timecode(uint64 & aTimecode, uint64 GlobalTimecodeScale) const;
};
DECLARE_MKX_MASTER(KaxCueTrackPositions)
- public:
- uint64 ClusterPosition() const;
- uint16 TrackNumber() const;
+ public:
+ uint64 ClusterPosition() const;
+ uint16 TrackNumber() const;
};
#if MATROSKA_VERSION >= 2
DECLARE_MKX_MASTER(KaxCueReference)
- public:
- void AddReference(const KaxBlockGroup & BlockReferenced, uint64 GlobalTimecodeScale);
- void AddReference(const KaxBlockBlob & BlockReferenced, uint64 GlobalTimecodeScale);
+ public:
+ void AddReference(const KaxBlockGroup & BlockReferenced, uint64 GlobalTimecodeScale);
+ void AddReference(const KaxBlockBlob & BlockReferenced, uint64 GlobalTimecodeScale);
};
#endif // MATROSKA_VERSION
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**********************************************************************/
/*!
- \file
- \version \$Id$
- \author Steve Lhomme <robux4 @ users.sf.net>
+ \file
+ \version \$Id$
+ \author Steve Lhomme <robux4 @ users.sf.net>
*/
#ifndef LIBMATROSKA_DEFINES_H
#define LIBMATROSKA_DEFINES_H
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**********************************************************************/
/*!
- \file
- \version \$Id: KaxInfo.h,v 1.7 2004/04/14 23:26:17 robux4 Exp $
- \author Steve Lhomme <robux4 @ users.sf.net>
+ \file
+ \version \$Id: KaxInfo.h,v 1.7 2004/04/14 23:26:17 robux4 Exp $
+ \author Steve Lhomme <robux4 @ users.sf.net>
*/
#ifndef LIBMATROSKA_INFO_H
#define LIBMATROSKA_INFO_H
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**********************************************************************/
/*!
- \file
- \version \$Id$
- \author Steve Lhomme <robux4 @ users.sf.net>
- \author John Cannon <spyder2555 @ users.sf.net>
- \author Moritz Bunkus <moritz @ bunkus.org>
+ \file
+ \version \$Id$
+ \author Steve Lhomme <robux4 @ users.sf.net>
+ \author John Cannon <spyder2555 @ users.sf.net>
+ \author Moritz Bunkus <moritz @ bunkus.org>
*/
#ifndef LIBMATROSKA_INFO_DATA_H
#define LIBMATROSKA_INFO_DATA_H
DECLARE_MKX_CONTEXT(KaxPrevUID);
class MATROSKA_DLL_API KaxPrevUID : public KaxSegmentUID {
- public:
- KaxPrevUID(EBML_EXTRA_PARAM);
- KaxPrevUID(const KaxPrevUID & ElementToClone) :KaxSegmentUID(ElementToClone){}
- virtual bool ValidateSize() const { return IsFiniteSize() && (GetSize() == 16);}
+ public:
+ KaxPrevUID(EBML_EXTRA_PARAM);
+ KaxPrevUID(const KaxPrevUID & ElementToClone) :KaxSegmentUID(ElementToClone){}
+ virtual bool ValidateSize() const { return IsFiniteSize() && (GetSize() == 16);}
EBML_CONCRETE_CLASS(KaxPrevUID)
};
DECLARE_MKX_CONTEXT(KaxNextUID);
class MATROSKA_DLL_API KaxNextUID : public KaxSegmentUID {
- public:
- KaxNextUID(EBML_EXTRA_PARAM);
- KaxNextUID(const KaxNextUID & ElementToClone) :KaxSegmentUID(ElementToClone){}
- virtual bool ValidateSize() const { return IsFiniteSize() && (GetSize() == 16);}
+ public:
+ KaxNextUID(EBML_EXTRA_PARAM);
+ KaxNextUID(const KaxNextUID & ElementToClone) :KaxSegmentUID(ElementToClone){}
+ virtual bool ValidateSize() const { return IsFiniteSize() && (GetSize() == 16);}
EBML_CONCRETE_CLASS(KaxNextUID)
};
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**********************************************************************/
/*!
- \file
- \version \$Id$
- \author Steve Lhomme <robux4 @ users.sf.net>
+ \file
+ \version \$Id$
+ \author Steve Lhomme <robux4 @ users.sf.net>
*/
#ifndef LIBMATROSKA_SEEK_HEAD_H
#define LIBMATROSKA_SEEK_HEAD_H
class KaxSegment;
DECLARE_MKX_MASTER(KaxSeek)
- public:
- int64 Location() const;
- bool IsEbmlId(const EbmlId & aId) const;
- bool IsEbmlId(const KaxSeek & aPoint) const;
+ public:
+ int64 Location() const;
+ bool IsEbmlId(const EbmlId & aId) const;
+ bool IsEbmlId(const KaxSeek & aPoint) const;
};
DECLARE_MKX_MASTER(KaxSeekHead)
- public:
- /*!
- \brief add an element to index in the Meta Seek data
- \note the element should already be written in the file
- */
- void IndexThis(const EbmlElement & aElt, const KaxSegment & ParentSegment);
+ public:
+ /*!
+ \brief add an element to index in the Meta Seek data
+ \note the element should already be written in the file
+ */
+ void IndexThis(const EbmlElement & aElt, const KaxSegment & ParentSegment);
- KaxSeek * FindFirstOf(const EbmlCallbacks & Callbacks) const;
- KaxSeek * FindNextOf(const KaxSeek &aPrev) const;
+ KaxSeek * FindFirstOf(const EbmlCallbacks & Callbacks) const;
+ KaxSeek * FindNextOf(const KaxSeek &aPrev) const;
};
END_LIBMATROSKA_NAMESPACE
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**********************************************************************/
/*!
- \file
- \version \$Id: KaxSegment.h,v 1.8 2004/04/14 23:26:17 robux4 Exp $
- \author Steve Lhomme <robux4 @ users.sf.net>
+ \file
+ \version \$Id: KaxSegment.h,v 1.8 2004/04/14 23:26:17 robux4 Exp $
+ \author Steve Lhomme <robux4 @ users.sf.net>
*/
#ifndef LIBMATROSKA_SEGMENT_H
#define LIBMATROSKA_SEGMENT_H
START_LIBMATROSKA_NAMESPACE
DECLARE_MKX_MASTER_CONS(KaxSegment)
- public:
- /*!
- \brief give the position of the element in the segment
- */
- uint64 GetRelativePosition(const EbmlElement & Elt) const;
- uint64 GetRelativePosition(uint64 aGlobalPosition) const;
-
- /*!
- \brief give the position of the element in the file
- */
- uint64 GetGlobalPosition(uint64 aRelativePosition) const;
+ public:
+ /*!
+ \brief give the position of the element in the segment
+ */
+ uint64 GetRelativePosition(const EbmlElement & Elt) const;
+ uint64 GetRelativePosition(uint64 aGlobalPosition) const;
+
+ /*!
+ \brief give the position of the element in the file
+ */
+ uint64 GetGlobalPosition(uint64 aRelativePosition) const;
};
END_LIBMATROSKA_NAMESPACE
/**********************************************************************
** DO NOT EDIT, GENERATED WITH DATA2LIB
-**
+**
** libmatroska : parse Matroska files, see http://www.matroska.org/
-**
+**
** Copyright (c) 2002-2010, Matroska (non-profit organisation)
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
DECLARE_MKX_BINARY (KaxSeekID)
public:
- virtual bool ValidateSize() const {return IsFiniteSize() && GetSize() <= 4;}
+ virtual bool ValidateSize() const {return IsFiniteSize() && GetSize() <= 4;}
};
DECLARE_MKX_UINTEGER(KaxSeekPosition)
DECLARE_MKX_BINARY (KaxSegmentUID)
#if defined(HAVE_EBML2) || defined(HAS_EBML2)
public:
- KaxSegmentUID(EBML_DEF_CONS EBML_DEF_SEP EBML_EXTRA_PARAM);
+ KaxSegmentUID(EBML_DEF_CONS EBML_DEF_SEP EBML_EXTRA_PARAM);
#endif
public:
- virtual bool ValidateSize() const {return IsFiniteSize() && GetSize() == 16;}
+ virtual bool ValidateSize() const {return IsFiniteSize() && GetSize() == 16;}
};
DECLARE_MKX_UNISTRING(KaxSegmentFilename)
DECLARE_MKX_BINARY (KaxSegmentFamily)
public:
- virtual bool ValidateSize() const {return IsFiniteSize() && GetSize() == 16;}
+ virtual bool ValidateSize() const {return IsFiniteSize() && GetSize() == 16;}
};
DECLARE_MKX_MASTER(KaxChapterTranslate)
#if MATROSKA_VERSION >= 2
DECLARE_MKX_SINTEGER(KaxReferenceVirtual)
public:
- filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
+ filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
};
DECLARE_MKX_BINARY (KaxCodecState)
#if MATROSKA_VERSION >= 2
DECLARE_MKX_UINTEGER(KaxSliceFrameNumber)
public:
- filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
+ filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
};
DECLARE_MKX_UINTEGER(KaxSliceBlockAddID)
public:
- filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
+ filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
};
DECLARE_MKX_UINTEGER(KaxSliceDelay)
public:
- filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
+ filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
};
DECLARE_MKX_UINTEGER(KaxSliceDuration)
public:
- filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
+ filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
};
DECLARE_MKX_MASTER(KaxReferenceFrame)
DECLARE_MKX_BINARY (KaxEncryptedBlock)
public:
- filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
+ filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
};
#endif
DECLARE_MKX_FLOAT(KaxTrackTimecodeScale)
public:
- filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
+ filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
};
#if MATROSKA_VERSION >= 2
DECLARE_MKX_SINTEGER(KaxTrackOffset)
public:
- filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
+ filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
};
#endif
#if MATROSKA_VERSION >= 2
DECLARE_MKX_UNISTRING(KaxCodecSettings)
public:
- filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
+ filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
};
DECLARE_MKX_STRING(KaxCodecInfoURL)
public:
- filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
+ filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
};
DECLARE_MKX_STRING(KaxCodecDownloadURL)
public:
- filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
+ filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
};
DECLARE_MKX_UINTEGER(KaxCodecDecodeAll)
DECLARE_MKX_UINTEGER(KaxOldStereoMode)
public:
- filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
+ filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
};
#endif
DECLARE_MKX_BINARY (KaxVideoColourSpace)
public:
- virtual bool ValidateSize() const {return IsFiniteSize() && GetSize() == 4;}
+ virtual bool ValidateSize() const {return IsFiniteSize() && GetSize() == 4;}
};
#if MATROSKA_VERSION >= 2
DECLARE_MKX_FLOAT(KaxVideoGamma)
public:
- filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
+ filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
};
DECLARE_MKX_FLOAT(KaxVideoFrameRate)
public:
- filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
+ filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
};
#endif
#if MATROSKA_VERSION >= 2
DECLARE_MKX_BINARY (KaxAudioPosition)
public:
- filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
+ filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
};
#endif
DECLARE_MKX_BINARY (KaxTrickTrackSegmentUID)
public:
- virtual bool ValidateSize() const {return IsFiniteSize() && GetSize() == 16;}
+ virtual bool ValidateSize() const {return IsFiniteSize() && GetSize() == 16;}
};
DECLARE_MKX_UINTEGER(KaxTrickTrackFlag)
DECLARE_MKX_BINARY (KaxTrickMasterTrackSegmentUID)
public:
- virtual bool ValidateSize() const {return IsFiniteSize() && GetSize() == 16;}
+ virtual bool ValidateSize() const {return IsFiniteSize() && GetSize() == 16;}
};
#endif
DECLARE_MKX_UINTEGER(KaxCueRefCluster)
public:
- filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
+ filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
};
DECLARE_MKX_UINTEGER(KaxCueRefNumber)
public:
- filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
+ filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
};
DECLARE_MKX_UINTEGER(KaxCueRefCodecState)
public:
- filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
+ filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
};
#endif
#if MATROSKA_VERSION >= 2
DECLARE_MKX_BINARY (KaxFileReferral)
public:
- filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
+ filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
};
DECLARE_MKX_UINTEGER(KaxFileUsedStartTime)
DECLARE_MKX_BINARY (KaxChapterSegmentUID)
public:
- virtual bool ValidateSize() const {return IsFiniteSize() && GetSize() == 16;}
+ virtual bool ValidateSize() const {return IsFiniteSize() && GetSize() == 16;}
};
DECLARE_MKX_UINTEGER(KaxChapterSegmentEditionUID)
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**********************************************************************/
/*!
- \file
- \version \$Id$
- \author Steve Lhomme <robux4 @ users.sf.net>
+ \file
+ \version \$Id$
+ \author Steve Lhomme <robux4 @ users.sf.net>
*/
#ifndef LIBMATROSKA_TAG_H
#define LIBMATROSKA_TAG_H
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**********************************************************************/
/*!
- \file
- \version \$Id: KaxTags.h,v 1.7 2004/04/14 23:26:17 robux4 Exp $
- \author Steve Lhomme <robux4 @ users.sf.net>
+ \file
+ \version \$Id: KaxTags.h,v 1.7 2004/04/14 23:26:17 robux4 Exp $
+ \author Steve Lhomme <robux4 @ users.sf.net>
*/
#ifndef LIBMATROSKA_TAGS_H
#define LIBMATROSKA_TAGS_H
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**********************************************************************/
/*!
- \file
- \version \$Id: KaxTrackAudio.h,v 1.11 2004/04/14 23:26:17 robux4 Exp $
- \author Steve Lhomme <robux4 @ users.sf.net>
+ \file
+ \version \$Id: KaxTrackAudio.h,v 1.11 2004/04/14 23:26:17 robux4 Exp $
+ \author Steve Lhomme <robux4 @ users.sf.net>
*/
#ifndef LIBMATROSKA_TRACK_AUDIO_H
#define LIBMATROSKA_TRACK_AUDIO_H
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**********************************************************************/
/*!
- \file
- \version \$Id: KaxTrackEntryData.h,v 1.9 2004/04/14 23:26:17 robux4 Exp $
- \author Steve Lhomme <robux4 @ users.sf.net>
+ \file
+ \version \$Id: KaxTrackEntryData.h,v 1.9 2004/04/14 23:26:17 robux4 Exp $
+ \author Steve Lhomme <robux4 @ users.sf.net>
*/
#ifndef LIBMATROSKA_TRACK_ENTRY_DATA_H
#define LIBMATROSKA_TRACK_ENTRY_DATA_H
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**********************************************************************/
/*!
- \file
- \version \$Id$
- \author Steve Lhomme <robux4 @ users.sf.net>
+ \file
+ \version \$Id$
+ \author Steve Lhomme <robux4 @ users.sf.net>
*/
#ifndef LIBMATROSKA_TRACK_VIDEO_H
#define LIBMATROSKA_TRACK_VIDEO_H
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**********************************************************************/
/*!
- \file
- \version \$Id: KaxTracks.h,v 1.7 2004/04/14 23:26:17 robux4 Exp $
- \author Steve Lhomme <robux4 @ users.sf.net>
+ \file
+ \version \$Id: KaxTracks.h,v 1.7 2004/04/14 23:26:17 robux4 Exp $
+ \author Steve Lhomme <robux4 @ users.sf.net>
*/
#ifndef LIBMATROSKA_TRACKS_H
#define LIBMATROSKA_TRACKS_H
START_LIBMATROSKA_NAMESPACE
DECLARE_MKX_MASTER(KaxTrackEntry)
- public:
- EbmlUInteger & TrackNumber() const { return *(static_cast<EbmlUInteger *>(FindElt(EBML_INFO(KaxTrackNumber)))); }
+ public:
+ 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
- */
- inline bool LacingEnabled() const {
- KaxTrackFlagLacing * myLacing = static_cast<KaxTrackFlagLacing *>(FindFirstElt(EBML_INFO(KaxTrackFlagLacing)));
- return((myLacing == NULL) || (uint8(*myLacing) != 0));
- }
+ /*!
+ \note lacing set by default
+ */
+ inline bool LacingEnabled() const {
+ KaxTrackFlagLacing * myLacing = static_cast<KaxTrackFlagLacing *>(FindFirstElt(EBML_INFO(KaxTrackFlagLacing)));
+ return((myLacing == NULL) || (uint8(*myLacing) != 0));
+ }
- void SetGlobalTimecodeScale(uint64 aGlobalTimecodeScale) {
- mGlobalTimecodeScale = aGlobalTimecodeScale;
- bGlobalTimecodeScaleIsSet = true;
- }
- uint64 GlobalTimecodeScale() const {
- assert(bGlobalTimecodeScaleIsSet);
- return mGlobalTimecodeScale;
- }
+ void SetGlobalTimecodeScale(uint64 aGlobalTimecodeScale) {
+ mGlobalTimecodeScale = aGlobalTimecodeScale;
+ bGlobalTimecodeScaleIsSet = true;
+ }
+ uint64 GlobalTimecodeScale() const {
+ assert(bGlobalTimecodeScaleIsSet);
+ return mGlobalTimecodeScale;
+ }
- protected:
- bool bGlobalTimecodeScaleIsSet;
- uint64 mGlobalTimecodeScale;
+ protected:
+ bool bGlobalTimecodeScaleIsSet;
+ uint64 mGlobalTimecodeScale;
};
END_LIBMATROSKA_NAMESPACE
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**********************************************************************/
/*!
- \file
- \version \$Id: KaxTypes.h,v 1.4 2004/04/14 23:26:17 robux4 Exp $
+ \file
+ \version \$Id: KaxTypes.h,v 1.4 2004/04/14 23:26:17 robux4 Exp $
*/
#ifndef LIBMATROSKA_TYPES_H
#define LIBMATROSKA_TYPES_H
START_LIBMATROSKA_NAMESPACE
enum LacingType {
- LACING_NONE = 0,
- LACING_XIPH,
- LACING_FIXED,
- LACING_EBML,
- LACING_AUTO
+ LACING_NONE = 0,
+ LACING_XIPH,
+ LACING_FIXED,
+ LACING_EBML,
+ LACING_AUTO
};
enum BlockBlobType {
- BLOCK_BLOB_NO_SIMPLE = 0,
- BLOCK_BLOB_SIMPLE_AUTO,
- BLOCK_BLOB_ALWAYS_SIMPLE,
+ BLOCK_BLOB_NO_SIMPLE = 0,
+ BLOCK_BLOB_SIMPLE_AUTO,
+ BLOCK_BLOB_ALWAYS_SIMPLE,
};
END_LIBMATROSKA_NAMESPACE
**********************************************************************/
/*!
- \file
- \version \$Id: KaxVersion.h,v 1.13 2004/04/23 16:46:07 mosu Exp $
- \author Steve Lhomme <robux4 @ users.sf.net>
+ \file
+ \version \$Id: KaxVersion.h,v 1.13 2004/04/23 16:46:07 mosu Exp $
+ \author Steve Lhomme <robux4 @ users.sf.net>
*/
#ifndef LIBMATROSKA_VERSION_H
#define LIBMATROSKA_VERSION_H
extern const std::string KaxCodeDate;
/*!
- \todo Improve the CRC/ECC system (backward and forward possible ?) to fit streaming/live writing/simple reading
+ \todo Improve the CRC/ECC system (backward and forward possible ?) to fit streaming/live writing/simple reading
*/
END_LIBMATROSKA_NAMESPACE
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
\note this should be used by the libmatroska internals
*/
typedef enum {
- error_null_pointer ///< NULL pointer where something else is expected
+ error_null_pointer ///< NULL pointer where something else is expected
} matroska_error_t;
typedef void *matroska_stream;
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
{
#ifdef OLD
myStreamInfo.MainHeaderSize = TypeHeader::default_size() +
- ActualHeader::default_size() +
- ExtendedInfo::default_size() +
- ContentInfo::default_size();
+ ActualHeader::default_size() +
+ ExtendedInfo::default_size() +
+ ContentInfo::default_size();
myStreamInfo.TrackEntrySize = Track::default_size();
myStreamInfo.BlockHeadSize = BLOCK_HEADER_SIZE;
myStreamInfo.ClusterHeadSize = CLUSTER_HEADER_SIZE;
FileMatroska::~FileMatroska()
{
// if (myCurrCluster != NULL)
-// throw 0; // there are some data left to write
+// throw 0; // there are some data left to write
// if (myCurrReadCluster != NULL || myCurrReadBlock != NULL)
-// throw 0; // there are some data left to write
+// throw 0; // there are some data left to write
}
#ifdef OLD
uint32 track_entries_size = 0;
for (size_t i=0; i<myTracks.size(); i++)
{
- track_entries_size += myTracks[i]->default_size();
+ track_entries_size += myTracks[i]->default_size();
}
myStreamInfo.TrackEntriesSize = track_entries_size;
for (i=0; i<myTracks.size(); i++)
{
- delete myTracks[i];
+ delete myTracks[i];
}
}
filepos_t FileMatroska::RenderHead(const std::string & aEncoderApp)
{
try {
- uint32 track_entries_size = 0;
- for (size_t i=0; i<myTracks.size(); i++)
- {
- track_entries_size += myTracks[i]->default_size();
- }
-
- std::string aStr = LIB_NAME;
- aStr += " ";
- aStr += VERSION;
- myStreamInfo.EncoderLib = aStr;
-
- myStreamInfo.EncoderApp = aEncoderApp;
-
- myStreamInfo.TrackEntryPosition = 0 + myStreamInfo.MainHeaderSize;
- myStreamInfo.TrackEntriesSize = myTracks.size() * myStreamInfo.TrackEntrySize;
-
- myStreamInfo.CodecEntryPosition = myStreamInfo.MainHeaderSize + myStreamInfo.TrackEntriesSize;
- myStreamInfo.CodecEntrySize = 4;
- for (i=0; i<myTracks.size(); i++)
- {
- myStreamInfo.CodecEntrySize += myTracks[i]->CodecSize();
- }
-
- // Main Header
- filepos_t result = myMainHeader.Render(myFile, myStreamInfo);
-
- // Track Entries
- for (i=0; i<myTracks.size(); i++)
- {
- myTracks[i]->RenderEntry(myFile, i+1);
- }
- myStreamInfo.ClusterPosition = myStreamInfo.CodecEntryPosition + myStreamInfo.CodecEntrySize;
-
- // Codec Header
- result = CodecHeader::Render(myFile, myTracks);
-
- return result;
+ uint32 track_entries_size = 0;
+ for (size_t i=0; i<myTracks.size(); i++)
+ {
+ track_entries_size += myTracks[i]->default_size();
+ }
+
+ std::string aStr = LIB_NAME;
+ aStr += " ";
+ aStr += VERSION;
+ myStreamInfo.EncoderLib = aStr;
+
+ myStreamInfo.EncoderApp = aEncoderApp;
+
+ myStreamInfo.TrackEntryPosition = 0 + myStreamInfo.MainHeaderSize;
+ myStreamInfo.TrackEntriesSize = myTracks.size() * myStreamInfo.TrackEntrySize;
+
+ myStreamInfo.CodecEntryPosition = myStreamInfo.MainHeaderSize + myStreamInfo.TrackEntriesSize;
+ myStreamInfo.CodecEntrySize = 4;
+ for (i=0; i<myTracks.size(); i++)
+ {
+ myStreamInfo.CodecEntrySize += myTracks[i]->CodecSize();
+ }
+
+ // Main Header
+ filepos_t result = myMainHeader.Render(myFile, myStreamInfo);
+
+ // Track Entries
+ for (i=0; i<myTracks.size(); i++)
+ {
+ myTracks[i]->RenderEntry(myFile, i+1);
+ }
+ myStreamInfo.ClusterPosition = myStreamInfo.CodecEntryPosition + myStreamInfo.CodecEntrySize;
+
+ // Codec Header
+ result = CodecHeader::Render(myFile, myTracks);
+
+ return result;
}
catch (exception & Ex)
{
- throw Ex;
+ throw Ex;
}
}
{
for (size_t i=0; i<myTracks.size(); i++)
{
- if (myTracks[i] == aTrack)
- return myTracks[i];
+ if (myTracks[i] == aTrack)
+ return myTracks[i];
}
return NULL;
}
bool FileMatroska::AddFrame(Track * aTrack, const uint32 aTimecode, const binary *aFrame, const uint32 aFrameSize,
- bool aKeyFrame, bool aBFrame)
+ bool aKeyFrame, bool aBFrame)
{
try {
- // make sure we know that track
- if (IsMyTrack(aTrack))
- {
- // pass the cluster to the track
- // handle the creation of a new cluster if needed
- if (aTrack->AddFrame(aTimecode, aFrame, aFrameSize, aKeyFrame, aBFrame))
- {
- while (!aTrack->SerialiseBlock(myCurrWriteCluster))
- {
- /// \todo handle errors
- uint32 aNbBlock;
- myStreamInfo.ClusterSize += myCurrWriteCluster.Render(myFile, aNbBlock);
- myStreamInfo.NumberBlock += aNbBlock;
- myCurrWriteCluster.Flush();
- }
- }
- return true;
- }
- return false;
+ // make sure we know that track
+ if (IsMyTrack(aTrack))
+ {
+ // pass the cluster to the track
+ // handle the creation of a new cluster if needed
+ if (aTrack->AddFrame(aTimecode, aFrame, aFrameSize, aKeyFrame, aBFrame))
+ {
+ while (!aTrack->SerialiseBlock(myCurrWriteCluster))
+ {
+ /// \todo handle errors
+ uint32 aNbBlock;
+ myStreamInfo.ClusterSize += myCurrWriteCluster.Render(myFile, aNbBlock);
+ myStreamInfo.NumberBlock += aNbBlock;
+ myCurrWriteCluster.Flush();
+ }
+ }
+ return true;
+ }
+ return false;
}
catch (exception & Ex)
{
- throw Ex;
+ throw Ex;
}
}
uint32 FileMatroska::ReadHead()
{
try {
- uint32 result = myMainHeader.Read(myFile, myStreamInfo);
+ uint32 result = myMainHeader.Read(myFile, myStreamInfo);
- return result;
+ return result;
}
catch (exception & Ex)
{
- throw Ex;
+ throw Ex;
}
}
uint32 FileMatroska::ReadTracks()
{
try {
- uint32 result = 0;
-
- // seek to the start of the Track Entries
- myFile.setFilePointer(myStreamInfo.TrackEntryPosition);
- // get the number of Track Entries
- uint8 TrackNumber = myStreamInfo.TrackEntriesSize / myStreamInfo.TrackEntrySize;
- // read all the Track Entries
- myTracks.clear();
- for (uint8 TrackIdx = 0; TrackIdx<TrackNumber; TrackIdx ++) {
- Track * tmpTrack = Track::ReadEntry(myFile, TrackIdx+1, myStreamInfo);
- if (tmpTrack == NULL)
- throw 0;
-
- myTracks.push_back(tmpTrack);
- }
-
- return result;
+ uint32 result = 0;
+
+ // seek to the start of the Track Entries
+ myFile.setFilePointer(myStreamInfo.TrackEntryPosition);
+ // get the number of Track Entries
+ uint8 TrackNumber = myStreamInfo.TrackEntriesSize / myStreamInfo.TrackEntrySize;
+ // read all the Track Entries
+ myTracks.clear();
+ for (uint8 TrackIdx = 0; TrackIdx<TrackNumber; TrackIdx ++) {
+ Track * tmpTrack = Track::ReadEntry(myFile, TrackIdx+1, myStreamInfo);
+ if (tmpTrack == NULL)
+ throw 0;
+
+ myTracks.push_back(tmpTrack);
+ }
+
+ return result;
}
catch (exception & Ex)
{
- throw Ex;
+ throw Ex;
}
}
uint32 FileMatroska::ReadCodec()
{
try {
- // seek to the start of the Track Entries
- myFile.setFilePointer(myStreamInfo.CodecEntryPosition);
+ // seek to the start of the Track Entries
+ myFile.setFilePointer(myStreamInfo.CodecEntryPosition);
- uint32 result = CodecHeader::Read(myFile, myTracks);
+ uint32 result = CodecHeader::Read(myFile, myTracks);
- return result;
+ return result;
}
catch (exception & Ex)
{
- throw Ex;
+ throw Ex;
}
}
inline bool FileMatroska::IsMyTrack(const Track * aTrack) const
{
if (aTrack == 0)
- throw 0;
+ throw 0;
for (std::vector<Track*>::const_iterator i = myTracks.begin(); i != myTracks.end(); i ++)
{
- if (*i == aTrack)
- break;
+ if (*i == aTrack)
+ break;
}
if (i != myTracks.end())
- return true;
+ return true;
else
- return false;
+ return false;
}
void FileMatroska::SelectReadingTrack(Track * aTrack, bool select)
{
if (IsMyTrack(aTrack))
{
- // here we have the right track
- // check if it's not already selected
- for (std::vector<uint8>::iterator j = mySelectedTracks.begin();
- j != mySelectedTracks.end(); j ++)
- {
- if (*j == aTrack->TrackNumber())
- break;
- }
-
- if (select && j == mySelectedTracks.end())
- mySelectedTracks.push_back(aTrack->TrackNumber());
- else if (!select && j != mySelectedTracks.end())
- mySelectedTracks.erase(j);
-
- std::sort(mySelectedTracks.begin(), mySelectedTracks.end());
+ // here we have the right track
+ // check if it's not already selected
+ for (std::vector<uint8>::iterator j = mySelectedTracks.begin();
+ j != mySelectedTracks.end(); j ++)
+ {
+ if (*j == aTrack->TrackNumber())
+ break;
+ }
+
+ if (select && j == mySelectedTracks.end())
+ mySelectedTracks.push_back(aTrack->TrackNumber());
+ else if (!select && j != mySelectedTracks.end())
+ mySelectedTracks.erase(j);
+
+ std::sort(mySelectedTracks.begin(), mySelectedTracks.end());
}
}
{
for (std::vector<uint8>::const_iterator trackIdx = mySelectedTracks.begin();
trackIdx != mySelectedTracks.end() && *trackIdx < aTrackNumber;
- trackIdx++)
+ trackIdx++)
{}
if (trackIdx == mySelectedTracks.end())
- return false;
+ return false;
else
- return true;
+ return true;
}
//
{
if (IsMyTrack(aTrack))
{
- aTrack->GetInfo(aTrackInfo);
+ aTrack->GetInfo(aTrackInfo);
}
}
{
if (IsMyTrack(aTrack))
{
- aTrack->GetInfoAudio(aTrackInfo);
+ aTrack->GetInfoAudio(aTrackInfo);
}
}
{
if (IsMyTrack(aTrack))
{
- aTrack->SetInfoAudio(aTrackInfo);
+ aTrack->SetInfoAudio(aTrackInfo);
}
}
{
if (IsMyTrack(aTrack))
{
- aTrack->GetInfoVideo(aTrackInfo);
+ aTrack->GetInfoVideo(aTrackInfo);
}
}
{
if (IsMyTrack(aTrack))
{
- aTrack->SetInfoVideo(aTrackInfo);
+ aTrack->SetInfoVideo(aTrackInfo);
}
}
\todo exit when there is no Block left
*/
bool FileMatroska::ReadFrame(Track * & aTrack, uint32 & aTimecode, const binary * & aFrame, uint32 & aFrameSize,
- bool & aKeyFrame, bool & aBFrame)
+ bool & aKeyFrame, bool & aBFrame)
{
if (myCurrReadBlockTrack == 0)
{
- do {
- if (myReadBlockNumber >= myStreamInfo.NumberBlock)
- {
-// myReadBlockNumber = myStreamInfo.NumberBlock;
- return false;
- }
-
- // get the next frame in the file
- if (!myCurrReadCluster.BlockLeft())
- {
- myCurrReadCluster.Flush();
- try {
- myCurrReadCluster.FindHead(myFile);
- }
- catch (exception & Ex)
- {
- return false;
- }
- }
-
- myCurrReadCluster.GetBlock( myCurrReadBlock, myCurrReadBlockSize, myCurrReadBlockTrack );
- myReadBlockNumber++;
- } while (!IsReadingTrack(myCurrReadBlockTrack));
-
- // get the track associated (normally from myTracks)
- aTrack = myTracks[myCurrReadBlockTrack-1];
- // get the next frame from the current block
- aTrack->HandleBlock(myCurrReadBlock, myCurrReadBlockSize);
+ do {
+ if (myReadBlockNumber >= myStreamInfo.NumberBlock)
+ {
+// myReadBlockNumber = myStreamInfo.NumberBlock;
+ return false;
+ }
+
+ // get the next frame in the file
+ if (!myCurrReadCluster.BlockLeft())
+ {
+ myCurrReadCluster.Flush();
+ try {
+ myCurrReadCluster.FindHead(myFile);
+ }
+ catch (exception & Ex)
+ {
+ return false;
+ }
+ }
+
+ myCurrReadCluster.GetBlock( myCurrReadBlock, myCurrReadBlockSize, myCurrReadBlockTrack );
+ myReadBlockNumber++;
+ } while (!IsReadingTrack(myCurrReadBlockTrack));
+
+ // get the track associated (normally from myTracks)
+ aTrack = myTracks[myCurrReadBlockTrack-1];
+ // get the next frame from the current block
+ aTrack->HandleBlock(myCurrReadBlock, myCurrReadBlockSize);
}
else
{
- // get the track associated (normally from myTracks)
- aTrack = myTracks[myCurrReadBlockTrack-1];
+ // get the track associated (normally from myTracks)
+ aTrack = myTracks[myCurrReadBlockTrack-1];
}
-
+
Frame * myReadFrame;
aTrack->GetNextFrame(aTimecode, myReadFrame, aKeyFrame, aBFrame);
aFrame = myReadFrame->buf();
if (aTrack->NoFrameLeft())
{
- aTrack->FlushBlock();
- myCurrReadBlockTrack = 0;
+ aTrack->FlushBlock();
+ myCurrReadBlockTrack = 0;
}
return true;
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**********************************************************************/
/*!
- \file
- \version \$Id: KaxAttached.cpp 1202 2005-08-30 14:39:01Z robux4 $
- \author Steve Lhomme <robux4 @ users.sf.net>
+ \file
+ \version \$Id: KaxAttached.cpp 1202 2005-08-30 14:39:01Z robux4 $
+ \author Steve Lhomme <robux4 @ users.sf.net>
*/
#include "matroska/KaxContexts.h"
#include "matroska/KaxDefines.h"
KaxAttached::KaxAttached(EBML_EXTRA_DEF)
:EbmlMaster(EBML_CLASS_SEMCONTEXT(KaxAttached) EBML_DEF_SEP EBML_EXTRA_CALL)
{
- SetSizeLength(2); // mandatory min size support (for easier updating) (2^(7*2)-2 = 16Ko)
+ SetSizeLength(2); // mandatory min size support (for easier updating) (2^(7*2)-2 = 16Ko)
}
END_LIBMATROSKA_NAMESPACE
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**********************************************************************/
/*!
- \file
- \version \$Id: KaxAttachments.cpp 640 2004-07-09 21:05:36Z mosu $
- \author Steve Lhomme <robux4 @ users.sf.net>
+ \file
+ \version \$Id: KaxAttachments.cpp 640 2004-07-09 21:05:36Z mosu $
+ \author Steve Lhomme <robux4 @ users.sf.net>
*/
#include "matroska/KaxContexts.h"
#include "matroska/KaxDefines.h"
KaxAttachments::KaxAttachments(EBML_EXTRA_DEF)
:EbmlMaster(EBML_CLASS_SEMCONTEXT(KaxAttachments) EBML_DEF_SEP EBML_EXTRA_CALL)
{
- SetSizeLength(2); // mandatory min size support (for easier updating) (2^(7*2)-2 = 16Ko)
+ SetSizeLength(2); // mandatory min size support (for easier updating) (2^(7*2)-2 = 16Ko)
}
END_LIBMATROSKA_NAMESPACE
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**********************************************************************/
/*!
- \file
- \version \$Id: KaxBlock.cpp 1265 2007-01-14 17:20:35Z mosu $
- \author Steve Lhomme <robux4 @ users.sf.net>
- \author Julien Coloos <suiryc @ users.sf.net>
+ \file
+ \version \$Id: KaxBlock.cpp 1265 2007-01-14 17:20:35Z mosu $
+ \author Steve Lhomme <robux4 @ users.sf.net>
+ \author Julien Coloos <suiryc @ users.sf.net>
*/
#include <cassert>
DataBuffer * DataBuffer::Clone()
{
- binary *ClonedData = (binary *)malloc(mySize * sizeof(binary));
- assert(ClonedData != NULL);
- memcpy(ClonedData, myBuffer ,mySize );
+ binary *ClonedData = (binary *)malloc(mySize * sizeof(binary));
+ assert(ClonedData != NULL);
+ memcpy(ClonedData, myBuffer ,mySize );
- SimpleDataBuffer * result = new SimpleDataBuffer(ClonedData, mySize, 0);
- result->bValidValue = bValidValue;
- return result;
+ SimpleDataBuffer * result = new SimpleDataBuffer(ClonedData, mySize, 0);
+ result->bValidValue = bValidValue;
+ return result;
}
SimpleDataBuffer::SimpleDataBuffer(const SimpleDataBuffer & ToClone)
:DataBuffer((binary *)malloc(ToClone.mySize * sizeof(binary)), ToClone.mySize, myFreeBuffer)
{
- assert(myBuffer != NULL);
- memcpy(myBuffer, ToClone.myBuffer ,mySize );
- bValidValue = ToClone.bValidValue;
+ assert(myBuffer != NULL);
+ memcpy(myBuffer, ToClone.myBuffer ,mySize );
+ bValidValue = ToClone.bValidValue;
}
bool KaxInternalBlock::ValidateSize() const
{
- return (GetSize() >= 4); /// for the moment
+ return (GetSize() >= 4); /// for the moment
}
KaxInternalBlock::~KaxInternalBlock()
{
- ReleaseFrames();
+ ReleaseFrames();
}
KaxInternalBlock::KaxInternalBlock(const KaxInternalBlock & ElementToClone)
,TrackNumber(ElementToClone.TrackNumber)
,ParentCluster(ElementToClone.ParentCluster) ///< \todo not exactly
{
- // add a clone of the list
- std::vector<DataBuffer *>::const_iterator Itr = ElementToClone.myBuffers.begin();
- std::vector<DataBuffer *>::iterator myItr = myBuffers.begin();
- while (Itr != ElementToClone.myBuffers.end())
- {
- *myItr = (*Itr)->Clone();
- Itr++; myItr++;
- }
+ // add a clone of the list
+ std::vector<DataBuffer *>::const_iterator Itr = ElementToClone.myBuffers.begin();
+ std::vector<DataBuffer *>::iterator myItr = myBuffers.begin();
+ while (Itr != ElementToClone.myBuffers.end())
+ {
+ *myItr = (*Itr)->Clone();
+ Itr++; myItr++;
+ }
}
{}
/*!
- \todo handle flags
- \todo hardcoded limit of the number of frames in a lace should be a parameter
- \return true if more frames can be added to this Block
+ \todo handle flags
+ \todo hardcoded limit of the number of frames in a lace should be a parameter
+ \return true if more frames can be added to this Block
*/
bool KaxInternalBlock::AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, LacingType lacing, bool invisible)
{
- SetValueIsSet();
- if (myBuffers.size() == 0) {
- // first frame
- Timecode = timecode;
- TrackNumber = track.TrackNumber();
- mInvisible = invisible;
- mLacing = lacing;
- }
- myBuffers.push_back(&buffer);
-
- // we don't allow more than 8 frames in a Block because the overhead improvement is minimal
- if (myBuffers.size() >= 8 || lacing == LACING_NONE)
- return false;
-
- if (lacing == LACING_XIPH)
- // decide wether a new frame can be added or not
- // a frame in a lace is not efficient when the place necessary to code it in a lace is bigger
- // than the size of a simple Block. That means more than 6 bytes (4 in struct + 2 for EBML) to code the size
- return (buffer.Size() < 6*0xFF);
- else
- return true;
+ SetValueIsSet();
+ if (myBuffers.size() == 0) {
+ // first frame
+ Timecode = timecode;
+ TrackNumber = track.TrackNumber();
+ mInvisible = invisible;
+ mLacing = lacing;
+ }
+ myBuffers.push_back(&buffer);
+
+ // we don't allow more than 8 frames in a Block because the overhead improvement is minimal
+ if (myBuffers.size() >= 8 || lacing == LACING_NONE)
+ return false;
+
+ if (lacing == LACING_XIPH)
+ // decide wether a new frame can be added or not
+ // a frame in a lace is not efficient when the place necessary to code it in a lace is bigger
+ // than the size of a simple Block. That means more than 6 bytes (4 in struct + 2 for EBML) to code the size
+ return (buffer.Size() < 6*0xFF);
+ else
+ return true;
}
/*!
\return Returns the lacing type that produces the smallest footprint.
*/
LacingType KaxInternalBlock::GetBestLacingType() const {
- int XiphLacingSize, EbmlLacingSize, i;
- bool SameSize = true;
-
- if (myBuffers.size() <= 1)
- return LACING_NONE;
-
- XiphLacingSize = 1; // Number of laces is stored in 1 byte.
- EbmlLacingSize = 1;
- for (i = 0; i < (int)myBuffers.size() - 1; i++) {
- if (myBuffers[i]->Size() != myBuffers[i + 1]->Size())
- SameSize = false;
- XiphLacingSize += myBuffers[i]->Size() / 255 + 1;
- }
- EbmlLacingSize += CodedSizeLength(myBuffers[0]->Size(), 0, IsFiniteSize());
- for (i = 1; i < (int)myBuffers.size() - 1; i++)
- EbmlLacingSize += CodedSizeLengthSigned(int64(myBuffers[i]->Size()) - int64(myBuffers[i - 1]->Size()), 0);
- if (SameSize)
- return LACING_FIXED;
- else if (XiphLacingSize < EbmlLacingSize)
- return LACING_XIPH;
- else
- return LACING_EBML;
+ int XiphLacingSize, EbmlLacingSize, i;
+ bool SameSize = true;
+
+ if (myBuffers.size() <= 1)
+ return LACING_NONE;
+
+ XiphLacingSize = 1; // Number of laces is stored in 1 byte.
+ EbmlLacingSize = 1;
+ for (i = 0; i < (int)myBuffers.size() - 1; i++) {
+ if (myBuffers[i]->Size() != myBuffers[i + 1]->Size())
+ SameSize = false;
+ XiphLacingSize += myBuffers[i]->Size() / 255 + 1;
+ }
+ EbmlLacingSize += CodedSizeLength(myBuffers[0]->Size(), 0, IsFiniteSize());
+ for (i = 1; i < (int)myBuffers.size() - 1; i++)
+ EbmlLacingSize += CodedSizeLengthSigned(int64(myBuffers[i]->Size()) - int64(myBuffers[i - 1]->Size()), 0);
+ if (SameSize)
+ return LACING_FIXED;
+ else if (XiphLacingSize < EbmlLacingSize)
+ return LACING_XIPH;
+ else
+ return LACING_EBML;
}
filepos_t KaxInternalBlock::UpdateSize(bool /* bSaveDefault */, bool /* bForceRender */)
{
- LacingType LacingHere;
+ LacingType LacingHere;
assert(EbmlBinary::GetBuffer() == NULL); // Data is not used for KaxInternalBlock
- assert(TrackNumber < 0x4000); // no more allowed for the moment
- unsigned int i;
-
- // compute the final size of the data
- switch (myBuffers.size()) {
- case 0:
- SetSize_(0);
- break;
- case 1:
- SetSize_(4 + myBuffers[0]->Size());
- break;
- default:
- SetSize_(4 + 1); // 1 for the lacing head
- if (mLacing == LACING_AUTO)
- LacingHere = GetBestLacingType();
- else
- LacingHere = mLacing;
- switch (LacingHere)
- {
- case LACING_XIPH:
- for (i=0; i<myBuffers.size()-1; i++) {
- SetSize_(GetSize() + myBuffers[i]->Size() + (myBuffers[i]->Size() / 0xFF + 1));
- }
- break;
- case LACING_EBML:
- SetSize_(GetSize() + myBuffers[0]->Size() + CodedSizeLength(myBuffers[0]->Size(), 0, IsFiniteSize()));
- for (i=1; i<myBuffers.size()-1; i++) {
- SetSize_(GetSize() + myBuffers[i]->Size() + CodedSizeLengthSigned(int64(myBuffers[i]->Size()) - int64(myBuffers[i-1]->Size()), 0));
- }
- break;
- case LACING_FIXED:
- for (i=0; i<myBuffers.size()-1; i++) {
- SetSize_(GetSize() + myBuffers[i]->Size());
- }
- break;
- default:
- i = 0;
- assert(0);
- }
- // Size of the last frame (not in lace)
- SetSize_(GetSize() + myBuffers[i]->Size());
- break;
- }
-
- if (TrackNumber >= 0x80)
- SetSize_(GetSize() + 1); // the size will be coded with one more octet
-
- return GetSize();
+ assert(TrackNumber < 0x4000); // no more allowed for the moment
+ unsigned int i;
+
+ // compute the final size of the data
+ switch (myBuffers.size()) {
+ case 0:
+ SetSize_(0);
+ break;
+ case 1:
+ SetSize_(4 + myBuffers[0]->Size());
+ break;
+ default:
+ SetSize_(4 + 1); // 1 for the lacing head
+ if (mLacing == LACING_AUTO)
+ LacingHere = GetBestLacingType();
+ else
+ LacingHere = mLacing;
+ switch (LacingHere)
+ {
+ case LACING_XIPH:
+ for (i=0; i<myBuffers.size()-1; i++) {
+ SetSize_(GetSize() + myBuffers[i]->Size() + (myBuffers[i]->Size() / 0xFF + 1));
+ }
+ break;
+ case LACING_EBML:
+ SetSize_(GetSize() + myBuffers[0]->Size() + CodedSizeLength(myBuffers[0]->Size(), 0, IsFiniteSize()));
+ for (i=1; i<myBuffers.size()-1; i++) {
+ SetSize_(GetSize() + myBuffers[i]->Size() + CodedSizeLengthSigned(int64(myBuffers[i]->Size()) - int64(myBuffers[i-1]->Size()), 0));
+ }
+ break;
+ case LACING_FIXED:
+ for (i=0; i<myBuffers.size()-1; i++) {
+ SetSize_(GetSize() + myBuffers[i]->Size());
+ }
+ break;
+ default:
+ i = 0;
+ assert(0);
+ }
+ // Size of the last frame (not in lace)
+ SetSize_(GetSize() + myBuffers[i]->Size());
+ break;
+ }
+
+ if (TrackNumber >= 0x80)
+ SetSize_(GetSize() + 1); // the size will be coded with one more octet
+
+ return GetSize();
}
#if MATROSKA_VERSION >= 2
KaxBlockVirtual::~KaxBlockVirtual()
{
if(GetBuffer() == DataBlock)
- SetBuffer( NULL, 0 );
+ SetBuffer( NULL, 0 );
}
filepos_t KaxBlockVirtual::UpdateSize(bool /* bSaveDefault */, bool /* bForceRender */)
{
- assert(TrackNumber < 0x4000);
- binary *cursor = EbmlBinary::GetBuffer();
- // fill data
- if (TrackNumber < 0x80) {
+ assert(TrackNumber < 0x4000);
+ binary *cursor = EbmlBinary::GetBuffer();
+ // fill data
+ if (TrackNumber < 0x80) {
assert(GetSize() >= 4);
- *cursor++ = TrackNumber | 0x80; // set the first bit to 1
- } else {
+ *cursor++ = TrackNumber | 0x80; // set the first bit to 1
+ } else {
assert(GetSize() >= 5);
- *cursor++ = (TrackNumber >> 8) | 0x40; // set the second bit to 1
- *cursor++ = TrackNumber & 0xFF;
- }
+ *cursor++ = (TrackNumber >> 8) | 0x40; // set the second bit to 1
+ *cursor++ = TrackNumber & 0xFF;
+ }
- assert(ParentCluster != NULL);
- int16 ActualTimecode = ParentCluster->GetBlockLocalTimecode(Timecode);
- big_int16 b16(ActualTimecode);
- b16.Fill(cursor);
- cursor += 2;
+ assert(ParentCluster != NULL);
+ int16 ActualTimecode = ParentCluster->GetBlockLocalTimecode(Timecode);
+ big_int16 b16(ActualTimecode);
+ b16.Fill(cursor);
+ cursor += 2;
- *cursor++ = 0; // flags
+ *cursor++ = 0; // flags
- return GetSize();
+ return GetSize();
}
#endif // MATROSKA_VERSION
/*!
- \todo more optimisation is possible (render the Block head and don't copy the buffer in memory, care should be taken with the allocation of Data)
- \todo the actual timecode to write should be retrieved from the Cluster from here
+ \todo more optimisation is possible (render the Block head and don't copy the buffer in memory, care should be taken with the allocation of Data)
+ \todo the actual timecode to write should be retrieved from the Cluster from here
*/
filepos_t KaxInternalBlock::RenderData(IOCallback & output, bool /* bForceRender */, bool /* bSaveDefault */)
{
- if (myBuffers.size() == 0) {
- return 0;
- } else {
- assert(TrackNumber < 0x4000);
- binary BlockHead[5], *cursor = BlockHead;
- unsigned int i;
-
- if (myBuffers.size() == 1) {
- SetSize_(4);
- mLacing = LACING_NONE;
- } else {
- if (mLacing == LACING_NONE)
- mLacing = LACING_EBML; // supposedly the best of all
- SetSize_(4 + 1); // 1 for the lacing head (number of laced elements)
- }
- if (TrackNumber > 0x80)
- SetSize_(GetSize() + 1);
-
- // write Block Head
- if (TrackNumber < 0x80) {
- *cursor++ = TrackNumber | 0x80; // set the first bit to 1
- } else {
- *cursor++ = (TrackNumber >> 8) | 0x40; // set the second bit to 1
- *cursor++ = TrackNumber & 0xFF;
- }
-
- assert(ParentCluster != NULL);
- int16 ActualTimecode = ParentCluster->GetBlockLocalTimecode(Timecode);
- big_int16 b16(ActualTimecode);
- b16.Fill(cursor);
- cursor += 2;
-
- *cursor = 0; // flags
-
- if (mLacing == LACING_AUTO) {
- mLacing = GetBestLacingType();
- }
-
- // invisible flag
- if (mInvisible)
- *cursor = 0x08;
-
- if (bIsSimple) {
- if (bIsKeyframe)
- *cursor |= 0x80;
- if (bIsDiscardable)
- *cursor |= 0x01;
- }
-
- // lacing flag
- switch (mLacing)
- {
- case LACING_XIPH:
- *cursor++ |= 0x02;
- break;
- case LACING_EBML:
- *cursor++ |= 0x06;
- break;
- case LACING_FIXED:
- *cursor++ |= 0x04;
- break;
- case LACING_NONE:
- break;
- default:
- assert(0);
- }
-
- output.writeFully(BlockHead, 4 + ((TrackNumber > 0x80) ? 1 : 0));
-
- binary tmpValue;
- switch (mLacing)
- {
- case LACING_XIPH:
- // number of laces
- tmpValue = myBuffers.size()-1;
- output.writeFully(&tmpValue, 1);
-
- // set the size of each member in the lace
- for (i=0; i<myBuffers.size()-1; i++) {
- tmpValue = 0xFF;
- uint16 tmpSize = myBuffers[i]->Size();
- while (tmpSize >= 0xFF) {
- output.writeFully(&tmpValue, 1);
- SetSize_(GetSize() + 1);
- tmpSize -= 0xFF;
- }
- tmpValue = binary(tmpSize);
- output.writeFully(&tmpValue, 1);
- SetSize_(GetSize() + 1);
- }
- break;
- case LACING_EBML:
- // number of laces
- tmpValue = myBuffers.size()-1;
- output.writeFully(&tmpValue, 1);
-
- {
- int64 _Size;
- int _CodedSize;
- binary _FinalHead[8]; // 64 bits max coded size
-
- _Size = myBuffers[0]->Size();
-
- _CodedSize = CodedSizeLength(_Size, 0, IsFiniteSize());
-
- // first size in the lace is not a signed
- CodedValueLength(_Size, _CodedSize, _FinalHead);
- output.writeFully(_FinalHead, _CodedSize);
- SetSize_(GetSize() + _CodedSize);
-
- // set the size of each member in the lace
- for (i=1; i<myBuffers.size()-1; i++) {
- _Size = int64(myBuffers[i]->Size()) - int64(myBuffers[i-1]->Size());
- _CodedSize = CodedSizeLengthSigned(_Size, 0);
- CodedValueLengthSigned(_Size, _CodedSize, _FinalHead);
- output.writeFully(_FinalHead, _CodedSize);
- SetSize_(GetSize() + _CodedSize);
- }
- }
- break;
- case LACING_FIXED:
- // number of laces
- tmpValue = myBuffers.size()-1;
- output.writeFully(&tmpValue, 1);
- break;
- case LACING_NONE:
- break;
- default:
- assert(0);
- }
-
- // put the data of each frame
- for (i=0; i<myBuffers.size(); i++) {
- output.writeFully(myBuffers[i]->Buffer(), myBuffers[i]->Size());
- SetSize_(GetSize() + myBuffers[i]->Size());
- }
- }
-
- return GetSize();
+ if (myBuffers.size() == 0) {
+ return 0;
+ } else {
+ assert(TrackNumber < 0x4000);
+ binary BlockHead[5], *cursor = BlockHead;
+ unsigned int i;
+
+ if (myBuffers.size() == 1) {
+ SetSize_(4);
+ mLacing = LACING_NONE;
+ } else {
+ if (mLacing == LACING_NONE)
+ mLacing = LACING_EBML; // supposedly the best of all
+ SetSize_(4 + 1); // 1 for the lacing head (number of laced elements)
+ }
+ if (TrackNumber > 0x80)
+ SetSize_(GetSize() + 1);
+
+ // write Block Head
+ if (TrackNumber < 0x80) {
+ *cursor++ = TrackNumber | 0x80; // set the first bit to 1
+ } else {
+ *cursor++ = (TrackNumber >> 8) | 0x40; // set the second bit to 1
+ *cursor++ = TrackNumber & 0xFF;
+ }
+
+ assert(ParentCluster != NULL);
+ int16 ActualTimecode = ParentCluster->GetBlockLocalTimecode(Timecode);
+ big_int16 b16(ActualTimecode);
+ b16.Fill(cursor);
+ cursor += 2;
+
+ *cursor = 0; // flags
+
+ if (mLacing == LACING_AUTO) {
+ mLacing = GetBestLacingType();
+ }
+
+ // invisible flag
+ if (mInvisible)
+ *cursor = 0x08;
+
+ if (bIsSimple) {
+ if (bIsKeyframe)
+ *cursor |= 0x80;
+ if (bIsDiscardable)
+ *cursor |= 0x01;
+ }
+
+ // lacing flag
+ switch (mLacing)
+ {
+ case LACING_XIPH:
+ *cursor++ |= 0x02;
+ break;
+ case LACING_EBML:
+ *cursor++ |= 0x06;
+ break;
+ case LACING_FIXED:
+ *cursor++ |= 0x04;
+ break;
+ case LACING_NONE:
+ break;
+ default:
+ assert(0);
+ }
+
+ output.writeFully(BlockHead, 4 + ((TrackNumber > 0x80) ? 1 : 0));
+
+ binary tmpValue;
+ switch (mLacing)
+ {
+ case LACING_XIPH:
+ // number of laces
+ tmpValue = myBuffers.size()-1;
+ output.writeFully(&tmpValue, 1);
+
+ // set the size of each member in the lace
+ for (i=0; i<myBuffers.size()-1; i++) {
+ tmpValue = 0xFF;
+ uint16 tmpSize = myBuffers[i]->Size();
+ while (tmpSize >= 0xFF) {
+ output.writeFully(&tmpValue, 1);
+ SetSize_(GetSize() + 1);
+ tmpSize -= 0xFF;
+ }
+ tmpValue = binary(tmpSize);
+ output.writeFully(&tmpValue, 1);
+ SetSize_(GetSize() + 1);
+ }
+ break;
+ case LACING_EBML:
+ // number of laces
+ tmpValue = myBuffers.size()-1;
+ output.writeFully(&tmpValue, 1);
+
+ {
+ int64 _Size;
+ int _CodedSize;
+ binary _FinalHead[8]; // 64 bits max coded size
+
+ _Size = myBuffers[0]->Size();
+
+ _CodedSize = CodedSizeLength(_Size, 0, IsFiniteSize());
+
+ // first size in the lace is not a signed
+ CodedValueLength(_Size, _CodedSize, _FinalHead);
+ output.writeFully(_FinalHead, _CodedSize);
+ SetSize_(GetSize() + _CodedSize);
+
+ // set the size of each member in the lace
+ for (i=1; i<myBuffers.size()-1; i++) {
+ _Size = int64(myBuffers[i]->Size()) - int64(myBuffers[i-1]->Size());
+ _CodedSize = CodedSizeLengthSigned(_Size, 0);
+ CodedValueLengthSigned(_Size, _CodedSize, _FinalHead);
+ output.writeFully(_FinalHead, _CodedSize);
+ SetSize_(GetSize() + _CodedSize);
+ }
+ }
+ break;
+ case LACING_FIXED:
+ // number of laces
+ tmpValue = myBuffers.size()-1;
+ output.writeFully(&tmpValue, 1);
+ break;
+ case LACING_NONE:
+ break;
+ default:
+ assert(0);
+ }
+
+ // put the data of each frame
+ for (i=0; i<myBuffers.size(); i++) {
+ output.writeFully(myBuffers[i]->Buffer(), myBuffers[i]->Size());
+ SetSize_(GetSize() + myBuffers[i]->Size());
+ }
+ }
+
+ return GetSize();
}
uint64 KaxInternalBlock::ReadInternalHead(IOCallback & input)
{
- binary Buffer[5], *cursor = Buffer;
- uint64 Result = input.read(cursor, 4);
- if (Result != 4)
- return Result;
-
- // update internal values
- TrackNumber = *cursor++;
- if ((TrackNumber & 0x80) == 0) {
- // there is extra data
- if ((TrackNumber & 0x40) == 0) {
- // We don't support track numbers that large !
- return Result;
- }
- Result += input.read(&Buffer[4], 1);
- TrackNumber = (TrackNumber & 0x3F) << 8;
- TrackNumber += *cursor++;
- } else {
- TrackNumber &= 0x7F;
- }
-
-
- big_int16 b16;
- b16.Eval(cursor);
- assert(ParentCluster != NULL);
- Timecode = ParentCluster->GetBlockGlobalTimecode(int16(b16));
- bLocalTimecodeUsed = false;
- cursor += 2;
-
- return Result;
+ binary Buffer[5], *cursor = Buffer;
+ uint64 Result = input.read(cursor, 4);
+ if (Result != 4)
+ return Result;
+
+ // update internal values
+ TrackNumber = *cursor++;
+ if ((TrackNumber & 0x80) == 0) {
+ // there is extra data
+ if ((TrackNumber & 0x40) == 0) {
+ // We don't support track numbers that large !
+ return Result;
+ }
+ Result += input.read(&Buffer[4], 1);
+ TrackNumber = (TrackNumber & 0x3F) << 8;
+ TrackNumber += *cursor++;
+ } else {
+ TrackNumber &= 0x7F;
+ }
+
+
+ big_int16 b16;
+ b16.Eval(cursor);
+ assert(ParentCluster != NULL);
+ Timecode = ParentCluster->GetBlockGlobalTimecode(int16(b16));
+ bLocalTimecodeUsed = false;
+ cursor += 2;
+
+ return Result;
}
/*!
- \todo better zero copy handling
+ \todo better zero copy handling
*/
filepos_t KaxInternalBlock::ReadData(IOCallback & input, ScopeMode ReadFully)
{
- filepos_t Result;
+ filepos_t Result;
- FirstFrameLocation = input.getFilePointer(); // will be updated accordingly below
+ FirstFrameLocation = input.getFilePointer(); // will be updated accordingly below
- if (ReadFully == SCOPE_ALL_DATA)
- {
- Result = EbmlBinary::ReadData(input, ReadFully);
+ if (ReadFully == SCOPE_ALL_DATA)
+ {
+ Result = EbmlBinary::ReadData(input, ReadFully);
binary *cursor = EbmlBinary::GetBuffer();
- uint8 BlockHeadSize = 4;
-
- // update internal values
- TrackNumber = *cursor++;
- if ((TrackNumber & 0x80) == 0) {
- // there is extra data
- if ((TrackNumber & 0x40) == 0) {
- // We don't support track numbers that large !
- return Result;
- }
- TrackNumber = (TrackNumber & 0x3F) << 8;
- TrackNumber += *cursor++;
- BlockHeadSize++;
- } else {
- TrackNumber &= 0x7F;
- }
-
- big_int16 b16;
- b16.Eval(cursor);
- LocalTimecode = int16(b16);
- bLocalTimecodeUsed = true;
- cursor += 2;
-
- if (EbmlId(*this) == EBML_ID(KaxSimpleBlock)) {
- bIsKeyframe = (*cursor & 0x80) != 0;
- bIsDiscardable = (*cursor & 0x01) != 0;
- }
- mInvisible = (*cursor & 0x08) >> 3;
- mLacing = LacingType((*cursor++ & 0x06) >> 1);
-
- // put all Frames in the list
- if (mLacing == LACING_NONE) {
- FirstFrameLocation += cursor - EbmlBinary::GetBuffer();
- DataBuffer * soloFrame = new DataBuffer(cursor, GetSize() - BlockHeadSize);
- myBuffers.push_back(soloFrame);
- SizeList.resize(1);
- SizeList[0] = GetSize() - BlockHeadSize;
- } else {
- // read the number of frames in the lace
- uint32 LastBufferSize = GetSize() - BlockHeadSize - 1; // 1 for number of frame
- uint8 FrameNum = *cursor++; // number of frames in the lace - 1
- // read the list of frame sizes
- uint8 Index;
- int32 FrameSize;
- uint32 SizeRead;
- uint64 SizeUnknown;
-
- SizeList.resize(FrameNum + 1);
-
- switch (mLacing)
- {
- case LACING_XIPH:
- for (Index=0; Index<FrameNum; Index++) {
- // get the size of the frame
- FrameSize = 0;
- do {
- FrameSize += uint8(*cursor);
- LastBufferSize--;
- } while (*cursor++ == 0xFF);
- SizeList[Index] = FrameSize;
- LastBufferSize -= FrameSize;
- }
- SizeList[Index] = LastBufferSize;
- break;
- case LACING_EBML:
- SizeRead = LastBufferSize;
- FrameSize = ReadCodedSizeValue(cursor, SizeRead, SizeUnknown);
- SizeList[0] = FrameSize;
- cursor += SizeRead;
- LastBufferSize -= FrameSize + SizeRead;
-
- for (Index=1; Index<FrameNum; Index++) {
- // get the size of the frame
- SizeRead = LastBufferSize;
- FrameSize += ReadCodedSizeSignedValue(cursor, SizeRead, SizeUnknown);
- SizeList[Index] = FrameSize;
- cursor += SizeRead;
- LastBufferSize -= FrameSize + SizeRead;
- }
- SizeList[Index] = LastBufferSize;
- break;
- case LACING_FIXED:
- for (Index=0; Index<=FrameNum; Index++) {
- // get the size of the frame
- SizeList[Index] = LastBufferSize / (FrameNum + 1);
- }
- break;
- default: // other lacing not supported
- assert(0);
- }
-
- FirstFrameLocation += cursor - EbmlBinary::GetBuffer();
-
- for (Index=0; Index<=FrameNum; Index++) {
- DataBuffer * lacedFrame = new DataBuffer(cursor, SizeList[Index]);
- myBuffers.push_back(lacedFrame);
- cursor += SizeList[Index];
- }
- }
- SetValueIsSet();
- }
- else if (ReadFully == SCOPE_PARTIAL_DATA)
- {
- binary _TempHead[5];
- Result = input.read(_TempHead, 5);
- binary *cursor = _TempHead;
- binary *_tmpBuf;
- uint8 BlockHeadSize = 4;
-
- // update internal values
- TrackNumber = *cursor++;
- if ((TrackNumber & 0x80) == 0) {
- // there is extra data
- if ((TrackNumber & 0x40) == 0) {
- // We don't support track numbers that large !
- return Result;
- }
- TrackNumber = (TrackNumber & 0x3F) << 8;
- TrackNumber += *cursor++;
- BlockHeadSize++;
- } else {
- TrackNumber &= 0x7F;
- }
-
- big_int16 b16;
- b16.Eval(cursor);
- LocalTimecode = int16(b16);
- bLocalTimecodeUsed = true;
- cursor += 2;
-
- if (EbmlId(*this) == EBML_ID(KaxSimpleBlock)) {
- bIsKeyframe = (*cursor & 0x80) != 0;
- bIsDiscardable = (*cursor & 0x01) != 0;
- }
- mInvisible = (*cursor & 0x08) >> 3;
- mLacing = LacingType((*cursor++ & 0x06) >> 1);
- if (cursor == &_TempHead[4])
- {
- _TempHead[0] = _TempHead[4];
- } else {
- Result += input.read(_TempHead, 1);
- }
-
- FirstFrameLocation += cursor - _TempHead;
-
- // put all Frames in the list
- if (mLacing != LACING_NONE) {
- // read the number of frames in the lace
- uint32 LastBufferSize = GetSize() - BlockHeadSize - 1; // 1 for number of frame
- uint8 FrameNum = _TempHead[0]; // number of frames in the lace - 1
- // read the list of frame sizes
- uint8 Index;
- int32 FrameSize;
- uint32 SizeRead;
- uint64 SizeUnknown;
-
- SizeList.resize(FrameNum + 1);
-
- switch (mLacing)
- {
- case LACING_XIPH:
- for (Index=0; Index<FrameNum; Index++) {
- // get the size of the frame
- FrameSize = 0;
- do {
- Result += input.read(_TempHead, 1);
- FrameSize += uint8(_TempHead[0]);
- LastBufferSize--;
-
- FirstFrameLocation++;
- } while (_TempHead[0] == 0xFF);
-
- FirstFrameLocation++;
- SizeList[Index] = FrameSize;
- LastBufferSize -= FrameSize;
- }
- SizeList[Index] = LastBufferSize;
- break;
- case LACING_EBML:
- SizeRead = LastBufferSize;
- cursor = _tmpBuf = new binary[FrameNum*4]; /// \warning assume the mean size will be coded in less than 4 bytes
- Result += input.read(cursor, FrameNum*4);
- FrameSize = ReadCodedSizeValue(cursor, SizeRead, SizeUnknown);
- SizeList[0] = FrameSize;
- cursor += SizeRead;
- LastBufferSize -= FrameSize + SizeRead;
-
- for (Index=1; Index<FrameNum; Index++) {
- // get the size of the frame
- SizeRead = LastBufferSize;
- FrameSize += ReadCodedSizeSignedValue(cursor, SizeRead, SizeUnknown);
- SizeList[Index] = FrameSize;
- cursor += SizeRead;
- LastBufferSize -= FrameSize + SizeRead;
- }
-
- FirstFrameLocation += cursor - _tmpBuf;
-
- SizeList[Index] = LastBufferSize;
- delete [] _tmpBuf;
- break;
- case LACING_FIXED:
- for (Index=0; Index<=FrameNum; Index++) {
- // get the size of the frame
- SizeList[Index] = LastBufferSize / (FrameNum + 1);
- }
- break;
- default: // other lacing not supported
- assert(0);
- }
- } else {
- SizeList.resize(1);
- SizeList[0] = GetSize() - BlockHeadSize;
- }
- SetValueIsSet(false);
- Result = GetSize();
- } else {
- SetValueIsSet(false);
- Result = GetSize();
- }
-
- return Result;
+ uint8 BlockHeadSize = 4;
+
+ // update internal values
+ TrackNumber = *cursor++;
+ if ((TrackNumber & 0x80) == 0) {
+ // there is extra data
+ if ((TrackNumber & 0x40) == 0) {
+ // We don't support track numbers that large !
+ return Result;
+ }
+ TrackNumber = (TrackNumber & 0x3F) << 8;
+ TrackNumber += *cursor++;
+ BlockHeadSize++;
+ } else {
+ TrackNumber &= 0x7F;
+ }
+
+ big_int16 b16;
+ b16.Eval(cursor);
+ LocalTimecode = int16(b16);
+ bLocalTimecodeUsed = true;
+ cursor += 2;
+
+ if (EbmlId(*this) == EBML_ID(KaxSimpleBlock)) {
+ bIsKeyframe = (*cursor & 0x80) != 0;
+ bIsDiscardable = (*cursor & 0x01) != 0;
+ }
+ mInvisible = (*cursor & 0x08) >> 3;
+ mLacing = LacingType((*cursor++ & 0x06) >> 1);
+
+ // put all Frames in the list
+ if (mLacing == LACING_NONE) {
+ FirstFrameLocation += cursor - EbmlBinary::GetBuffer();
+ DataBuffer * soloFrame = new DataBuffer(cursor, GetSize() - BlockHeadSize);
+ myBuffers.push_back(soloFrame);
+ SizeList.resize(1);
+ SizeList[0] = GetSize() - BlockHeadSize;
+ } else {
+ // read the number of frames in the lace
+ uint32 LastBufferSize = GetSize() - BlockHeadSize - 1; // 1 for number of frame
+ uint8 FrameNum = *cursor++; // number of frames in the lace - 1
+ // read the list of frame sizes
+ uint8 Index;
+ int32 FrameSize;
+ uint32 SizeRead;
+ uint64 SizeUnknown;
+
+ SizeList.resize(FrameNum + 1);
+
+ switch (mLacing)
+ {
+ case LACING_XIPH:
+ for (Index=0; Index<FrameNum; Index++) {
+ // get the size of the frame
+ FrameSize = 0;
+ do {
+ FrameSize += uint8(*cursor);
+ LastBufferSize--;
+ } while (*cursor++ == 0xFF);
+ SizeList[Index] = FrameSize;
+ LastBufferSize -= FrameSize;
+ }
+ SizeList[Index] = LastBufferSize;
+ break;
+ case LACING_EBML:
+ SizeRead = LastBufferSize;
+ FrameSize = ReadCodedSizeValue(cursor, SizeRead, SizeUnknown);
+ SizeList[0] = FrameSize;
+ cursor += SizeRead;
+ LastBufferSize -= FrameSize + SizeRead;
+
+ for (Index=1; Index<FrameNum; Index++) {
+ // get the size of the frame
+ SizeRead = LastBufferSize;
+ FrameSize += ReadCodedSizeSignedValue(cursor, SizeRead, SizeUnknown);
+ SizeList[Index] = FrameSize;
+ cursor += SizeRead;
+ LastBufferSize -= FrameSize + SizeRead;
+ }
+ SizeList[Index] = LastBufferSize;
+ break;
+ case LACING_FIXED:
+ for (Index=0; Index<=FrameNum; Index++) {
+ // get the size of the frame
+ SizeList[Index] = LastBufferSize / (FrameNum + 1);
+ }
+ break;
+ default: // other lacing not supported
+ assert(0);
+ }
+
+ FirstFrameLocation += cursor - EbmlBinary::GetBuffer();
+
+ for (Index=0; Index<=FrameNum; Index++) {
+ DataBuffer * lacedFrame = new DataBuffer(cursor, SizeList[Index]);
+ myBuffers.push_back(lacedFrame);
+ cursor += SizeList[Index];
+ }
+ }
+ SetValueIsSet();
+ }
+ else if (ReadFully == SCOPE_PARTIAL_DATA)
+ {
+ binary _TempHead[5];
+ Result = input.read(_TempHead, 5);
+ binary *cursor = _TempHead;
+ binary *_tmpBuf;
+ uint8 BlockHeadSize = 4;
+
+ // update internal values
+ TrackNumber = *cursor++;
+ if ((TrackNumber & 0x80) == 0) {
+ // there is extra data
+ if ((TrackNumber & 0x40) == 0) {
+ // We don't support track numbers that large !
+ return Result;
+ }
+ TrackNumber = (TrackNumber & 0x3F) << 8;
+ TrackNumber += *cursor++;
+ BlockHeadSize++;
+ } else {
+ TrackNumber &= 0x7F;
+ }
+
+ big_int16 b16;
+ b16.Eval(cursor);
+ LocalTimecode = int16(b16);
+ bLocalTimecodeUsed = true;
+ cursor += 2;
+
+ if (EbmlId(*this) == EBML_ID(KaxSimpleBlock)) {
+ bIsKeyframe = (*cursor & 0x80) != 0;
+ bIsDiscardable = (*cursor & 0x01) != 0;
+ }
+ mInvisible = (*cursor & 0x08) >> 3;
+ mLacing = LacingType((*cursor++ & 0x06) >> 1);
+ if (cursor == &_TempHead[4])
+ {
+ _TempHead[0] = _TempHead[4];
+ } else {
+ Result += input.read(_TempHead, 1);
+ }
+
+ FirstFrameLocation += cursor - _TempHead;
+
+ // put all Frames in the list
+ if (mLacing != LACING_NONE) {
+ // read the number of frames in the lace
+ uint32 LastBufferSize = GetSize() - BlockHeadSize - 1; // 1 for number of frame
+ uint8 FrameNum = _TempHead[0]; // number of frames in the lace - 1
+ // read the list of frame sizes
+ uint8 Index;
+ int32 FrameSize;
+ uint32 SizeRead;
+ uint64 SizeUnknown;
+
+ SizeList.resize(FrameNum + 1);
+
+ switch (mLacing)
+ {
+ case LACING_XIPH:
+ for (Index=0; Index<FrameNum; Index++) {
+ // get the size of the frame
+ FrameSize = 0;
+ do {
+ Result += input.read(_TempHead, 1);
+ FrameSize += uint8(_TempHead[0]);
+ LastBufferSize--;
+
+ FirstFrameLocation++;
+ } while (_TempHead[0] == 0xFF);
+
+ FirstFrameLocation++;
+ SizeList[Index] = FrameSize;
+ LastBufferSize -= FrameSize;
+ }
+ SizeList[Index] = LastBufferSize;
+ break;
+ case LACING_EBML:
+ SizeRead = LastBufferSize;
+ cursor = _tmpBuf = new binary[FrameNum*4]; /// \warning assume the mean size will be coded in less than 4 bytes
+ Result += input.read(cursor, FrameNum*4);
+ FrameSize = ReadCodedSizeValue(cursor, SizeRead, SizeUnknown);
+ SizeList[0] = FrameSize;
+ cursor += SizeRead;
+ LastBufferSize -= FrameSize + SizeRead;
+
+ for (Index=1; Index<FrameNum; Index++) {
+ // get the size of the frame
+ SizeRead = LastBufferSize;
+ FrameSize += ReadCodedSizeSignedValue(cursor, SizeRead, SizeUnknown);
+ SizeList[Index] = FrameSize;
+ cursor += SizeRead;
+ LastBufferSize -= FrameSize + SizeRead;
+ }
+
+ FirstFrameLocation += cursor - _tmpBuf;
+
+ SizeList[Index] = LastBufferSize;
+ delete [] _tmpBuf;
+ break;
+ case LACING_FIXED:
+ for (Index=0; Index<=FrameNum; Index++) {
+ // get the size of the frame
+ SizeList[Index] = LastBufferSize / (FrameNum + 1);
+ }
+ break;
+ default: // other lacing not supported
+ assert(0);
+ }
+ } else {
+ SizeList.resize(1);
+ SizeList[0] = GetSize() - BlockHeadSize;
+ }
+ SetValueIsSet(false);
+ Result = GetSize();
+ } else {
+ SetValueIsSet(false);
+ Result = GetSize();
+ }
+
+ return Result;
}
bool KaxBlockGroup::AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, LacingType lacing)
{
- KaxBlock & theBlock = GetChild<KaxBlock>(*this);
- assert(ParentCluster != NULL);
- theBlock.SetParent(*ParentCluster);
- ParentTrack = &track;
- return theBlock.AddFrame(track, timecode, buffer, lacing);
+ KaxBlock & theBlock = GetChild<KaxBlock>(*this);
+ assert(ParentCluster != NULL);
+ theBlock.SetParent(*ParentCluster);
+ ParentTrack = &track;
+ return theBlock.AddFrame(track, timecode, buffer, lacing);
}
bool KaxBlockGroup::AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, const KaxBlockGroup & PastBlock, LacingType lacing)
{
-// assert(past_timecode < 0);
+// assert(past_timecode < 0);
- KaxBlock & theBlock = GetChild<KaxBlock>(*this);
- assert(ParentCluster != NULL);
- theBlock.SetParent(*ParentCluster);
- ParentTrack = &track;
- bool bRes = theBlock.AddFrame(track, timecode, buffer, lacing);
+ KaxBlock & theBlock = GetChild<KaxBlock>(*this);
+ assert(ParentCluster != NULL);
+ theBlock.SetParent(*ParentCluster);
+ ParentTrack = &track;
+ bool bRes = theBlock.AddFrame(track, timecode, buffer, lacing);
- KaxReferenceBlock & thePastRef = GetChild<KaxReferenceBlock>(*this);
- thePastRef.SetReferencedBlock(PastBlock);
- thePastRef.SetParentBlock(*this);
+ KaxReferenceBlock & thePastRef = GetChild<KaxReferenceBlock>(*this);
+ thePastRef.SetReferencedBlock(PastBlock);
+ thePastRef.SetParentBlock(*this);
- return bRes;
+ return bRes;
}
bool KaxBlockGroup::AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, const KaxBlockGroup & PastBlock, const KaxBlockGroup & ForwBlock, LacingType lacing)
{
-// assert(past_timecode < 0);
+// assert(past_timecode < 0);
-// assert(forw_timecode > 0);
-
- KaxBlock & theBlock = GetChild<KaxBlock>(*this);
- assert(ParentCluster != NULL);
- theBlock.SetParent(*ParentCluster);
- ParentTrack = &track;
- bool bRes = theBlock.AddFrame(track, timecode, buffer, lacing);
+// assert(forw_timecode > 0);
- KaxReferenceBlock & thePastRef = GetChild<KaxReferenceBlock>(*this);
- thePastRef.SetReferencedBlock(PastBlock);
- thePastRef.SetParentBlock(*this);
+ KaxBlock & theBlock = GetChild<KaxBlock>(*this);
+ assert(ParentCluster != NULL);
+ theBlock.SetParent(*ParentCluster);
+ ParentTrack = &track;
+ bool bRes = theBlock.AddFrame(track, timecode, buffer, lacing);
- KaxReferenceBlock & theFutureRef = AddNewChild<KaxReferenceBlock>(*this);
- theFutureRef.SetReferencedBlock(ForwBlock);
- theFutureRef.SetParentBlock(*this);
+ KaxReferenceBlock & thePastRef = GetChild<KaxReferenceBlock>(*this);
+ thePastRef.SetReferencedBlock(PastBlock);
+ thePastRef.SetParentBlock(*this);
- return bRes;
+ KaxReferenceBlock & theFutureRef = AddNewChild<KaxReferenceBlock>(*this);
+ theFutureRef.SetReferencedBlock(ForwBlock);
+ theFutureRef.SetParentBlock(*this);
+
+ return bRes;
}
bool KaxBlockGroup::AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, const KaxBlockBlob * PastBlock, const KaxBlockBlob * ForwBlock, LacingType lacing)
{
- KaxBlock & theBlock = GetChild<KaxBlock>(*this);
- assert(ParentCluster != NULL);
- theBlock.SetParent(*ParentCluster);
- ParentTrack = &track;
- bool bRes = theBlock.AddFrame(track, timecode, buffer, lacing);
-
- if (PastBlock != NULL)
- {
- KaxReferenceBlock & thePastRef = GetChild<KaxReferenceBlock>(*this);
- thePastRef.SetReferencedBlock(PastBlock);
- thePastRef.SetParentBlock(*this);
- }
-
- if (ForwBlock != NULL)
- {
- KaxReferenceBlock & theFutureRef = AddNewChild<KaxReferenceBlock>(*this);
- theFutureRef.SetReferencedBlock(ForwBlock);
- theFutureRef.SetParentBlock(*this);
- }
-
- return bRes;
+ KaxBlock & theBlock = GetChild<KaxBlock>(*this);
+ assert(ParentCluster != NULL);
+ theBlock.SetParent(*ParentCluster);
+ ParentTrack = &track;
+ bool bRes = theBlock.AddFrame(track, timecode, buffer, lacing);
+
+ if (PastBlock != NULL)
+ {
+ KaxReferenceBlock & thePastRef = GetChild<KaxReferenceBlock>(*this);
+ thePastRef.SetReferencedBlock(PastBlock);
+ thePastRef.SetParentBlock(*this);
+ }
+
+ if (ForwBlock != NULL)
+ {
+ KaxReferenceBlock & theFutureRef = AddNewChild<KaxReferenceBlock>(*this);
+ theFutureRef.SetReferencedBlock(ForwBlock);
+ theFutureRef.SetParentBlock(*this);
+ }
+
+ return bRes;
}
/*!
- \todo we may cache the reference to the timecode block
+ \todo we may cache the reference to the timecode block
*/
uint64 KaxBlockGroup::GlobalTimecode() const
{
- assert(ParentCluster != NULL); // impossible otherwise
- KaxInternalBlock & MyBlock = *static_cast<KaxBlock *>(this->FindElt(EBML_INFO(KaxBlock)));
- return MyBlock.GlobalTimecode();
+ assert(ParentCluster != NULL); // impossible otherwise
+ KaxInternalBlock & MyBlock = *static_cast<KaxBlock *>(this->FindElt(EBML_INFO(KaxBlock)));
+ return MyBlock.GlobalTimecode();
}
uint16 KaxBlockGroup::TrackNumber() const
{
- KaxInternalBlock & MyBlock = *static_cast<KaxBlock *>(this->FindElt(EBML_INFO(KaxBlock)));
- return MyBlock.TrackNum();
+ KaxInternalBlock & MyBlock = *static_cast<KaxBlock *>(this->FindElt(EBML_INFO(KaxBlock)));
+ return MyBlock.TrackNum();
}
uint64 KaxBlockGroup::ClusterPosition() const
{
- assert(ParentCluster != NULL); // impossible otherwise
- return ParentCluster->GetPosition();
+ assert(ParentCluster != NULL); // impossible otherwise
+ return ParentCluster->GetPosition();
}
uint64 KaxInternalBlock::ClusterPosition() const
{
- assert(ParentCluster != NULL); // impossible otherwise
- return ParentCluster->GetPosition();
+ assert(ParentCluster != NULL); // impossible otherwise
+ return ParentCluster->GetPosition();
}
unsigned int KaxBlockGroup::ReferenceCount() const
{
- unsigned int Result = 0;
- KaxReferenceBlock * MyBlockAdds = static_cast<KaxReferenceBlock *>(FindFirstElt(EBML_INFO(KaxReferenceBlock)));
- if (MyBlockAdds != NULL) {
- Result++;
- while ((MyBlockAdds = static_cast<KaxReferenceBlock *>(FindNextElt(*MyBlockAdds))) != NULL)
- {
- Result++;
- }
- }
- return Result;
+ unsigned int Result = 0;
+ KaxReferenceBlock * MyBlockAdds = static_cast<KaxReferenceBlock *>(FindFirstElt(EBML_INFO(KaxReferenceBlock)));
+ if (MyBlockAdds != NULL) {
+ Result++;
+ while ((MyBlockAdds = static_cast<KaxReferenceBlock *>(FindNextElt(*MyBlockAdds))) != NULL)
+ {
+ Result++;
+ }
+ }
+ return Result;
}
const KaxReferenceBlock & KaxBlockGroup::Reference(unsigned int Index) const
{
- KaxReferenceBlock * MyBlockAdds = static_cast<KaxReferenceBlock *>(FindFirstElt(EBML_INFO(KaxReferenceBlock)));
- assert(MyBlockAdds != NULL); // call of a non existing reference
-
- while (Index != 0) {
- MyBlockAdds = static_cast<KaxReferenceBlock *>(FindNextElt(*MyBlockAdds));
- assert(MyBlockAdds != NULL);
- Index--;
- }
- return *MyBlockAdds;
+ KaxReferenceBlock * MyBlockAdds = static_cast<KaxReferenceBlock *>(FindFirstElt(EBML_INFO(KaxReferenceBlock)));
+ assert(MyBlockAdds != NULL); // call of a non existing reference
+
+ while (Index != 0) {
+ MyBlockAdds = static_cast<KaxReferenceBlock *>(FindNextElt(*MyBlockAdds));
+ assert(MyBlockAdds != NULL);
+ Index--;
+ }
+ return *MyBlockAdds;
}
void KaxBlockGroup::ReleaseFrames()
{
- KaxInternalBlock & MyBlock = *static_cast<KaxBlock *>(this->FindElt(EBML_INFO(KaxBlock)));
- MyBlock.ReleaseFrames();
+ KaxInternalBlock & MyBlock = *static_cast<KaxBlock *>(this->FindElt(EBML_INFO(KaxBlock)));
+ MyBlock.ReleaseFrames();
}
void KaxInternalBlock::ReleaseFrames()
{
- // free the allocated Frames
- int i;
- for (i=myBuffers.size()-1; i>=0; i--) {
- if (myBuffers[i] != NULL) {
- myBuffers[i]->FreeBuffer(*myBuffers[i]);
- delete myBuffers[i];
- myBuffers[i] = NULL;
- }
- }
+ // free the allocated Frames
+ int i;
+ for (i=myBuffers.size()-1; i>=0; i--) {
+ if (myBuffers[i] != NULL) {
+ myBuffers[i]->FreeBuffer(*myBuffers[i]);
+ delete myBuffers[i];
+ myBuffers[i] = NULL;
+ }
+ }
}
void KaxBlockGroup::SetBlockDuration(uint64 TimeLength)
{
- assert(ParentTrack != NULL);
- int64 scale = ParentTrack->GlobalTimecodeScale();
- KaxBlockDuration & myDuration = *static_cast<KaxBlockDuration *>(FindFirstElt(EBML_INFO(KaxBlockDuration), true));
- *(static_cast<EbmlUInteger *>(&myDuration)) = TimeLength / uint64(scale);
+ assert(ParentTrack != NULL);
+ int64 scale = ParentTrack->GlobalTimecodeScale();
+ KaxBlockDuration & myDuration = *static_cast<KaxBlockDuration *>(FindFirstElt(EBML_INFO(KaxBlockDuration), true));
+ *(static_cast<EbmlUInteger *>(&myDuration)) = TimeLength / uint64(scale);
}
bool KaxBlockGroup::GetBlockDuration(uint64 &TheTimecode) const
{
- KaxBlockDuration * myDuration = static_cast<KaxBlockDuration *>(FindElt(EBML_INFO(KaxBlockDuration)));
- if (myDuration == NULL) {
- return false;
- }
-
- assert(ParentTrack != NULL);
- TheTimecode = uint64(*myDuration) * ParentTrack->GlobalTimecodeScale();
- return true;
+ KaxBlockDuration * myDuration = static_cast<KaxBlockDuration *>(FindElt(EBML_INFO(KaxBlockDuration)));
+ if (myDuration == NULL) {
+ return false;
+ }
+
+ assert(ParentTrack != NULL);
+ TheTimecode = uint64(*myDuration) * ParentTrack->GlobalTimecodeScale();
+ return true;
}
KaxBlockGroup::operator KaxInternalBlock &() {
- KaxBlock & theBlock = GetChild<KaxBlock>(*this);
- return theBlock;
+ KaxBlock & theBlock = GetChild<KaxBlock>(*this);
+ return theBlock;
}
void KaxBlockGroup::SetParent(KaxCluster & aParentCluster) {
- ParentCluster = &aParentCluster;
- KaxBlock & theBlock = GetChild<KaxBlock>(*this);
- theBlock.SetParent( aParentCluster );
+ ParentCluster = &aParentCluster;
+ KaxBlock & theBlock = GetChild<KaxBlock>(*this);
+ theBlock.SetParent( aParentCluster );
}
void KaxSimpleBlock::SetParent(KaxCluster & aParentCluster) {
- KaxInternalBlock::SetParent( aParentCluster );
+ KaxInternalBlock::SetParent( aParentCluster );
}
void KaxInternalBlock::SetParent(KaxCluster & aParentCluster)
{
- ParentCluster = &aParentCluster;
- if (bLocalTimecodeUsed) {
- Timecode = aParentCluster.GetBlockGlobalTimecode(LocalTimecode);
- bLocalTimecodeUsed = false;
- }
+ ParentCluster = &aParentCluster;
+ if (bLocalTimecodeUsed) {
+ Timecode = aParentCluster.GetBlockGlobalTimecode(LocalTimecode);
+ bLocalTimecodeUsed = false;
+ }
}
int64 KaxInternalBlock::GetDataPosition(size_t FrameNumber)
{
- int64 _Result = -1;
-
- if (ValueIsSet() && FrameNumber < SizeList.size())
- {
- _Result = FirstFrameLocation;
-
- size_t _Idx = 0;
- while(FrameNumber--)
- {
- _Result += SizeList[_Idx++];
- }
- }
-
- return _Result;
+ int64 _Result = -1;
+
+ if (ValueIsSet() && FrameNumber < SizeList.size())
+ {
+ _Result = FirstFrameLocation;
+
+ size_t _Idx = 0;
+ while(FrameNumber--)
+ {
+ _Result += SizeList[_Idx++];
+ }
+ }
+
+ return _Result;
}
int64 KaxInternalBlock::GetFrameSize(size_t FrameNumber)
{
- int64 _Result = -1;
+ int64 _Result = -1;
- if (/*bValueIsSet &&*/ FrameNumber < SizeList.size())
- {
- _Result = SizeList[FrameNumber];
- }
+ if (/*bValueIsSet &&*/ FrameNumber < SizeList.size())
+ {
+ _Result = SizeList[FrameNumber];
+ }
- return _Result;
+ return _Result;
}
KaxBlockBlob::operator KaxBlockGroup &()
{
- assert(!bUseSimpleBlock);
- assert(Block.group);
- return *Block.group;
+ assert(!bUseSimpleBlock);
+ assert(Block.group);
+ return *Block.group;
}
KaxBlockBlob::operator const KaxBlockGroup &() const
{
- assert(!bUseSimpleBlock);
- assert(Block.group);
- return *Block.group;
+ assert(!bUseSimpleBlock);
+ assert(Block.group);
+ return *Block.group;
}
KaxBlockBlob::operator KaxInternalBlock &()
{
- assert(Block.group);
+ assert(Block.group);
#if MATROSKA_VERSION >= 2
- if (bUseSimpleBlock)
- return *Block.simpleblock;
- else
+ if (bUseSimpleBlock)
+ return *Block.simpleblock;
+ else
#endif
- return *Block.group;
+ return *Block.group;
}
KaxBlockBlob::operator const KaxInternalBlock &() const
{
- assert(Block.group);
+ assert(Block.group);
#if MATROSKA_VERSION >= 2
- if (bUseSimpleBlock)
- return *Block.simpleblock;
- else
+ if (bUseSimpleBlock)
+ return *Block.simpleblock;
+ else
#endif
- return *Block.group;
+ return *Block.group;
}
#if MATROSKA_VERSION >= 2
KaxBlockBlob::operator KaxSimpleBlock &()
{
- assert(bUseSimpleBlock);
- assert(Block.simpleblock);
- return *Block.simpleblock;
+ assert(bUseSimpleBlock);
+ assert(Block.simpleblock);
+ return *Block.simpleblock;
}
#endif
bool KaxBlockBlob::AddFrameAuto(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, LacingType lacing, const KaxBlockBlob * PastBlock, const KaxBlockBlob * ForwBlock)
{
- bool bResult = false;
+ bool bResult = false;
#if MATROSKA_VERSION >= 2
- if ((SimpleBlockMode == BLOCK_BLOB_ALWAYS_SIMPLE) || (SimpleBlockMode == BLOCK_BLOB_SIMPLE_AUTO && PastBlock == NULL && ForwBlock == NULL)) {
- assert(bUseSimpleBlock == true);
- if (Block.simpleblock == NULL) {
- Block.simpleblock = new KaxSimpleBlock();
- Block.simpleblock->SetParent(*ParentCluster);
- }
-
- bResult = Block.simpleblock->AddFrame(track, timecode, buffer, lacing);
- if (PastBlock == NULL && ForwBlock == NULL) {
- Block.simpleblock->SetKeyframe(true);
- Block.simpleblock->SetDiscardable(false);
- } else {
- Block.simpleblock->SetKeyframe(false);
- if ((ForwBlock == NULL || ((const KaxInternalBlock &)*ForwBlock).GlobalTimecode() <= timecode) &&
- (PastBlock == NULL || ((const KaxInternalBlock &)*PastBlock).GlobalTimecode() <= timecode))
- Block.simpleblock->SetDiscardable(false);
- else
- Block.simpleblock->SetDiscardable(true);
- }
- }
- else
+ if ((SimpleBlockMode == BLOCK_BLOB_ALWAYS_SIMPLE) || (SimpleBlockMode == BLOCK_BLOB_SIMPLE_AUTO && PastBlock == NULL && ForwBlock == NULL)) {
+ assert(bUseSimpleBlock == true);
+ if (Block.simpleblock == NULL) {
+ Block.simpleblock = new KaxSimpleBlock();
+ Block.simpleblock->SetParent(*ParentCluster);
+ }
+
+ bResult = Block.simpleblock->AddFrame(track, timecode, buffer, lacing);
+ if (PastBlock == NULL && ForwBlock == NULL) {
+ Block.simpleblock->SetKeyframe(true);
+ Block.simpleblock->SetDiscardable(false);
+ } else {
+ Block.simpleblock->SetKeyframe(false);
+ if ((ForwBlock == NULL || ((const KaxInternalBlock &)*ForwBlock).GlobalTimecode() <= timecode) &&
+ (PastBlock == NULL || ((const KaxInternalBlock &)*PastBlock).GlobalTimecode() <= timecode))
+ Block.simpleblock->SetDiscardable(false);
+ else
+ Block.simpleblock->SetDiscardable(true);
+ }
+ }
+ else
#endif
- {
- if (ReplaceSimpleByGroup()) {
- bResult = Block.group->AddFrame(track, timecode, buffer, PastBlock, ForwBlock, lacing);
- }
- }
+ {
+ if (ReplaceSimpleByGroup()) {
+ bResult = Block.group->AddFrame(track, timecode, buffer, PastBlock, ForwBlock, lacing);
+ }
+ }
- return bResult;
+ return bResult;
}
void KaxBlockBlob::SetParent(KaxCluster & parent_clust)
{
- ParentCluster = &parent_clust;
+ ParentCluster = &parent_clust;
}
void KaxBlockBlob::SetBlockDuration(uint64 TimeLength)
{
- if (ReplaceSimpleByGroup())
- Block.group->SetBlockDuration(TimeLength);
+ if (ReplaceSimpleByGroup())
+ Block.group->SetBlockDuration(TimeLength);
}
bool KaxBlockBlob::ReplaceSimpleByGroup()
{
- if (SimpleBlockMode== BLOCK_BLOB_ALWAYS_SIMPLE)
- return false;
-
- if (!bUseSimpleBlock) {
- if (Block.group == NULL) {
- Block.group = new KaxBlockGroup();
- }
- }
+ if (SimpleBlockMode== BLOCK_BLOB_ALWAYS_SIMPLE)
+ return false;
+
+ if (!bUseSimpleBlock) {
+ if (Block.group == NULL) {
+ Block.group = new KaxBlockGroup();
+ }
+ }
#if MATROSKA_VERSION >= 2
- else
- {
-
- if (Block.simpleblock != NULL) {
- KaxSimpleBlock *old_simpleblock = Block.simpleblock;
- Block.group = new KaxBlockGroup();
- // _TODO_ : move all the data to the blockgroup
- assert(false);
- // -> while(frame) AddFrame(myBuffer)
- delete old_simpleblock;
- } else {
- Block.group = new KaxBlockGroup();
- }
- }
+ else
+ {
+
+ if (Block.simpleblock != NULL) {
+ KaxSimpleBlock *old_simpleblock = Block.simpleblock;
+ Block.group = new KaxBlockGroup();
+ // _TODO_ : move all the data to the blockgroup
+ assert(false);
+ // -> while(frame) AddFrame(myBuffer)
+ delete old_simpleblock;
+ } else {
+ Block.group = new KaxBlockGroup();
+ }
+ }
#endif
- if (ParentCluster != NULL)
- Block.group->SetParent(*ParentCluster);
+ if (ParentCluster != NULL)
+ Block.group->SetParent(*ParentCluster);
- bUseSimpleBlock = false;
- return true;
+ bUseSimpleBlock = false;
+ return true;
}
void KaxBlockBlob::SetBlockGroup( KaxBlockGroup &BlockRef )
{
- assert(!bUseSimpleBlock);
- Block.group = &BlockRef;
+ assert(!bUseSimpleBlock);
+ Block.group = &BlockRef;
}
filepos_t KaxBlockVirtual::ReadData(IOCallback & input, ScopeMode /* ReadFully */)
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**********************************************************************/
/*!
- \file
- \version \$Id: KaxBlockData.cpp 1226 2005-10-13 21:16:43Z robux4 $
- \author Steve Lhomme <robux4 @ users.sf.net>
+ \file
+ \version \$Id: KaxBlockData.cpp 1226 2005-10-13 21:16:43Z robux4 $
+ \author Steve Lhomme <robux4 @ users.sf.net>
*/
#include <cassert>
const KaxBlockBlob & KaxReferenceBlock::RefBlock() const
{
- assert(RefdBlock != NULL);
- return *RefdBlock;
+ assert(RefdBlock != NULL);
+ return *RefdBlock;
}
KaxReferenceBlock::KaxReferenceBlock(EBML_EXTRA_DEF)
filepos_t KaxReferenceBlock::UpdateSize(bool bSaveDefault, bool bForceRender)
{
- if (!bTimecodeSet) {
- assert(RefdBlock != NULL);
- assert(ParentBlock != NULL);
+ if (!bTimecodeSet) {
+ assert(RefdBlock != NULL);
+ assert(ParentBlock != NULL);
- const KaxInternalBlock &block = *RefdBlock;
- *static_cast<EbmlSInteger*>(this) = (int64(block.GlobalTimecode()) - int64(ParentBlock->GlobalTimecode())) / int64(ParentBlock->GlobalTimecodeScale());
- }
- return EbmlSInteger::UpdateSize(bSaveDefault, bForceRender);
+ const KaxInternalBlock &block = *RefdBlock;
+ *static_cast<EbmlSInteger*>(this) = (int64(block.GlobalTimecode()) - int64(ParentBlock->GlobalTimecode())) / int64(ParentBlock->GlobalTimecodeScale());
+ }
+ return EbmlSInteger::UpdateSize(bSaveDefault, bForceRender);
}
void KaxReferenceBlock::SetReferencedBlock(const KaxBlockBlob * aRefdBlock)
{
- assert(RefdBlock == NULL);
- assert(aRefdBlock != NULL);
+ assert(RefdBlock == NULL);
+ assert(aRefdBlock != NULL);
FreeBlob();
- RefdBlock = aRefdBlock;
+ RefdBlock = aRefdBlock;
bOurBlob = true;
- SetValueIsSet();
+ SetValueIsSet();
}
void KaxReferenceBlock::SetReferencedBlock(const KaxBlockGroup & aRefdBlock)
{
FreeBlob();
- KaxBlockBlob *block_blob = new KaxBlockBlob(BLOCK_BLOB_NO_SIMPLE);
- block_blob->SetBlockGroup(*const_cast<KaxBlockGroup*>(&aRefdBlock));
- RefdBlock = block_blob;
+ KaxBlockBlob *block_blob = new KaxBlockBlob(BLOCK_BLOB_NO_SIMPLE);
+ block_blob->SetBlockGroup(*const_cast<KaxBlockGroup*>(&aRefdBlock));
+ RefdBlock = block_blob;
bOurBlob = true;
- SetValueIsSet();
+ SetValueIsSet();
}
END_LIBMATROSKA_NAMESPACE
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**********************************************************************/
/*!
- \file
- \version \$Id: KaxCluster.cpp 1228 2005-10-14 19:36:51Z robux4 $
- \author Steve Lhomme <robux4 @ users.sf.net>
+ \file
+ \version \$Id: KaxCluster.cpp 1228 2005-10-14 19:36:51Z robux4 $
+ \author Steve Lhomme <robux4 @ users.sf.net>
*/
#include "matroska/KaxCluster.h"
#include "matroska/KaxBlock.h"
START_LIBMATROSKA_NAMESPACE
KaxCluster::KaxCluster(EBML_EXTRA_DEF)
- :EbmlMaster(EBML_CLASS_SEMCONTEXT(KaxCluster) EBML_DEF_SEP EBML_EXTRA_CALL)
- ,currentNewBlock(NULL)
- ,ParentSegment(NULL)
- ,bFirstFrameInside(false)
- ,bPreviousTimecodeIsSet(false)
- ,bTimecodeScaleIsSet(false)
- ,bSilentTracksUsed(false)
+ :EbmlMaster(EBML_CLASS_SEMCONTEXT(KaxCluster) EBML_DEF_SEP EBML_EXTRA_CALL)
+ ,currentNewBlock(NULL)
+ ,ParentSegment(NULL)
+ ,bFirstFrameInside(false)
+ ,bPreviousTimecodeIsSet(false)
+ ,bTimecodeScaleIsSet(false)
+ ,bSilentTracksUsed(false)
{}
-KaxCluster::KaxCluster(const KaxCluster & ElementToClone)
+KaxCluster::KaxCluster(const KaxCluster & ElementToClone)
:EbmlMaster(ElementToClone)
,bSilentTracksUsed(ElementToClone.bSilentTracksUsed)
{
- // update the parent of each children
- EBML_MASTER_ITERATOR Itr = begin();
- while (Itr != end())
- {
- if (EbmlId(**Itr) == EBML_ID(KaxBlockGroup)) {
- static_cast<KaxBlockGroup *>(*Itr)->SetParent(*this);
- } else if (EbmlId(**Itr) == EBML_ID(KaxBlock)) {
- static_cast<KaxBlock *>(*Itr)->SetParent(*this);
+ // update the parent of each children
+ EBML_MASTER_ITERATOR Itr = begin();
+ while (Itr != end())
+ {
+ if (EbmlId(**Itr) == EBML_ID(KaxBlockGroup)) {
+ static_cast<KaxBlockGroup *>(*Itr)->SetParent(*this);
+ } else if (EbmlId(**Itr) == EBML_ID(KaxBlock)) {
+ static_cast<KaxBlock *>(*Itr)->SetParent(*this);
#if MATROSKA_VERSION >= 2
- } else if (EbmlId(**Itr) == EBML_ID(KaxBlockVirtual)) {
- static_cast<KaxBlockVirtual *>(*Itr)->SetParent(*this);
+ } else if (EbmlId(**Itr) == EBML_ID(KaxBlockVirtual)) {
+ static_cast<KaxBlockVirtual *>(*Itr)->SetParent(*this);
#endif // MATROSKA_VERSION
- }
+ }
++Itr;
- }
+ }
}
bool KaxCluster::AddBlockBlob(KaxBlockBlob * NewBlob)
{
- Blobs.push_back(NewBlob);
- return true;
+ Blobs.push_back(NewBlob);
+ return true;
}
bool KaxCluster::AddFrameInternal(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, KaxBlockGroup * & MyNewBlock, const KaxBlockGroup * PastBlock, const KaxBlockGroup * ForwBlock, LacingType lacing)
{
- if (!bFirstFrameInside) {
- bFirstFrameInside = true;
- MinTimecode = MaxTimecode = timecode;
- } else {
- if (timecode < MinTimecode)
- MinTimecode = timecode;
- if (timecode > MaxTimecode)
- MaxTimecode = timecode;
- }
-
- MyNewBlock = NULL;
-
- if (lacing == LACING_NONE || !track.LacingEnabled()) {
- currentNewBlock = NULL;
- }
-
- // force creation of a new block
- if (currentNewBlock == NULL || uint32(track.TrackNumber()) != uint32(currentNewBlock->TrackNumber()) || PastBlock != NULL || ForwBlock != NULL) {
- KaxBlockGroup & aNewBlock = GetNewBlock();
- MyNewBlock = currentNewBlock = &aNewBlock;
- }
-
- if (PastBlock != NULL) {
- if (ForwBlock != NULL) {
- if (currentNewBlock->AddFrame(track, timecode, buffer, *PastBlock, *ForwBlock, lacing)) {
- // more data are allowed in this Block
- return true;
- } else {
- currentNewBlock = NULL;
- return false;
- }
- } else {
- if (currentNewBlock->AddFrame(track, timecode, buffer, *PastBlock, lacing)) {
- // more data are allowed in this Block
- return true;
- } else {
- currentNewBlock = NULL;
- return false;
- }
- }
- } else {
- if (currentNewBlock->AddFrame(track, timecode, buffer, lacing)) {
- // more data are allowed in this Block
- return true;
- } else {
- currentNewBlock = NULL;
- return false;
- }
- }
+ if (!bFirstFrameInside) {
+ bFirstFrameInside = true;
+ MinTimecode = MaxTimecode = timecode;
+ } else {
+ if (timecode < MinTimecode)
+ MinTimecode = timecode;
+ if (timecode > MaxTimecode)
+ MaxTimecode = timecode;
+ }
+
+ MyNewBlock = NULL;
+
+ if (lacing == LACING_NONE || !track.LacingEnabled()) {
+ currentNewBlock = NULL;
+ }
+
+ // force creation of a new block
+ if (currentNewBlock == NULL || uint32(track.TrackNumber()) != uint32(currentNewBlock->TrackNumber()) || PastBlock != NULL || ForwBlock != NULL) {
+ KaxBlockGroup & aNewBlock = GetNewBlock();
+ MyNewBlock = currentNewBlock = &aNewBlock;
+ }
+
+ if (PastBlock != NULL) {
+ if (ForwBlock != NULL) {
+ if (currentNewBlock->AddFrame(track, timecode, buffer, *PastBlock, *ForwBlock, lacing)) {
+ // more data are allowed in this Block
+ return true;
+ } else {
+ currentNewBlock = NULL;
+ return false;
+ }
+ } else {
+ if (currentNewBlock->AddFrame(track, timecode, buffer, *PastBlock, lacing)) {
+ // more data are allowed in this Block
+ return true;
+ } else {
+ currentNewBlock = NULL;
+ return false;
+ }
+ }
+ } else {
+ if (currentNewBlock->AddFrame(track, timecode, buffer, lacing)) {
+ // more data are allowed in this Block
+ return true;
+ } else {
+ currentNewBlock = NULL;
+ return false;
+ }
+ }
}
bool KaxCluster::AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, KaxBlockGroup * & MyNewBlock, LacingType lacing)
{
- assert(Blobs.size() == 0); // mutually exclusive for the moment
- return AddFrameInternal(track, timecode, buffer, MyNewBlock, NULL, NULL, lacing);
+ assert(Blobs.size() == 0); // mutually exclusive for the moment
+ return AddFrameInternal(track, timecode, buffer, MyNewBlock, NULL, NULL, lacing);
}
bool KaxCluster::AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, KaxBlockGroup * & MyNewBlock, const KaxBlockGroup & PastBlock, LacingType lacing)
{
- assert(Blobs.size() == 0); // mutually exclusive for the moment
- return AddFrameInternal(track, timecode, buffer, MyNewBlock, &PastBlock, NULL, lacing);
+ assert(Blobs.size() == 0); // mutually exclusive for the moment
+ return AddFrameInternal(track, timecode, buffer, MyNewBlock, &PastBlock, NULL, lacing);
}
bool KaxCluster::AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, KaxBlockGroup * & MyNewBlock, const KaxBlockGroup & PastBlock, const KaxBlockGroup & ForwBlock, LacingType lacing)
{
- assert(Blobs.size() == 0); // mutually exclusive for the moment
- return AddFrameInternal(track, timecode, buffer, MyNewBlock, &PastBlock, &ForwBlock, lacing);
+ assert(Blobs.size() == 0); // mutually exclusive for the moment
+ return AddFrameInternal(track, timecode, buffer, MyNewBlock, &PastBlock, &ForwBlock, lacing);
}
/*!
- \todo only put the Blocks written in the cue entries
+ \todo only put the Blocks written in the cue entries
*/
filepos_t KaxCluster::Render(IOCallback & output, KaxCues & CueToUpdate, bool bSaveDefault)
{
- filepos_t Result = 0;
+ filepos_t Result = 0;
size_t Index;
EBML_MASTER_ITERATOR TrkItr, Itr;
- // update the Timecode of the Cluster before writing
- KaxClusterTimecode * Timecode = static_cast<KaxClusterTimecode *>(this->FindElt(EBML_INFO(KaxClusterTimecode)));
- *static_cast<EbmlUInteger *>(Timecode) = GlobalTimecode() / GlobalTimecodeScale();
+ // update the Timecode of the Cluster before writing
+ KaxClusterTimecode * Timecode = static_cast<KaxClusterTimecode *>(this->FindElt(EBML_INFO(KaxClusterTimecode)));
+ *static_cast<EbmlUInteger *>(Timecode) = GlobalTimecode() / GlobalTimecodeScale();
- if (Blobs.size() == 0) {
- // old-school direct KaxBlockGroup
+ if (Blobs.size() == 0) {
+ // old-school direct KaxBlockGroup
- // SilentTracks handling
- // check the parent cluster for existing tracks and see if they are contained in this cluster or not
- if (bSilentTracksUsed)
- {
- KaxTracks & MyTracks = *static_cast<KaxTracks *>(ParentSegment->FindElt(EBML_INFO(KaxTracks)));
- for (TrkItr = MyTracks.begin(); TrkItr != MyTracks.end(); ++TrkItr)
+ // SilentTracks handling
+ // check the parent cluster for existing tracks and see if they are contained in this cluster or not
+ if (bSilentTracksUsed)
+ {
+ KaxTracks & MyTracks = *static_cast<KaxTracks *>(ParentSegment->FindElt(EBML_INFO(KaxTracks)));
+ for (TrkItr = MyTracks.begin(); TrkItr != MyTracks.end(); ++TrkItr)
{
- if (EbmlId(*(*TrkItr)) == EBML_ID(KaxTrackEntry))
- {
- KaxTrackEntry & entry = *static_cast<KaxTrackEntry *>(*TrkItr);
- uint32 tracknum = entry.TrackNumber();
- for (Itr = begin(); Itr != end(); ++Itr)
+ if (EbmlId(*(*TrkItr)) == EBML_ID(KaxTrackEntry))
+ {
+ KaxTrackEntry & entry = *static_cast<KaxTrackEntry *>(*TrkItr);
+ uint32 tracknum = entry.TrackNumber();
+ for (Itr = begin(); Itr != end(); ++Itr)
{
- if (EbmlId(*(*Itr)) == EBML_ID(KaxBlockGroup)) {
- KaxBlockGroup & group = *static_cast<KaxBlockGroup *>(*Itr);
- if (group.TrackNumber() == tracknum)
- break; // this track is used
- }
- }
- // the track wasn't found in this cluster
- if (Itr == end())
- {
- KaxClusterSilentTracks * SilentTracks = static_cast<KaxClusterSilentTracks *>(this->FindFirstElt(EBML_INFO(KaxClusterSilentTracks)));
- assert(SilentTracks != NULL); // the flag bSilentTracksUsed should be set when creating the Cluster
- KaxClusterSilentTrackNumber * trackelt = static_cast<KaxClusterSilentTrackNumber *>(SilentTracks->AddNewElt(EBML_INFO(KaxClusterSilentTrackNumber)));
- *static_cast<EbmlUInteger *>(trackelt) = tracknum;
- }
- }
- }
- }
-
- Result = EbmlMaster::Render(output, bSaveDefault);
- // For all Blocks add their position on the CueEntry
-
+ if (EbmlId(*(*Itr)) == EBML_ID(KaxBlockGroup)) {
+ KaxBlockGroup & group = *static_cast<KaxBlockGroup *>(*Itr);
+ if (group.TrackNumber() == tracknum)
+ break; // this track is used
+ }
+ }
+ // the track wasn't found in this cluster
+ if (Itr == end())
+ {
+ KaxClusterSilentTracks * SilentTracks = static_cast<KaxClusterSilentTracks *>(this->FindFirstElt(EBML_INFO(KaxClusterSilentTracks)));
+ assert(SilentTracks != NULL); // the flag bSilentTracksUsed should be set when creating the Cluster
+ KaxClusterSilentTrackNumber * trackelt = static_cast<KaxClusterSilentTrackNumber *>(SilentTracks->AddNewElt(EBML_INFO(KaxClusterSilentTrackNumber)));
+ *static_cast<EbmlUInteger *>(trackelt) = tracknum;
+ }
+ }
+ }
+ }
+
+ Result = EbmlMaster::Render(output, bSaveDefault);
+ // For all Blocks add their position on the CueEntry
+
for (Itr = begin(); Itr != end(); ++Itr)
{
- if (EbmlId(*(*Itr)) == EBML_ID(KaxBlockGroup)) {
- CueToUpdate.PositionSet(*static_cast<const KaxBlockGroup *>(*Itr));
- }
- }
- } else {
- // new school, using KaxBlockBlob
- for (Index = 0; Index<Blobs.size(); Index++)
- {
+ if (EbmlId(*(*Itr)) == EBML_ID(KaxBlockGroup)) {
+ CueToUpdate.PositionSet(*static_cast<const KaxBlockGroup *>(*Itr));
+ }
+ }
+ } else {
+ // new school, using KaxBlockBlob
+ for (Index = 0; Index<Blobs.size(); Index++)
+ {
#if MATROSKA_VERSION >= 2
- if (Blobs[Index]->IsSimpleBlock())
- PushElement( (KaxSimpleBlock&) *Blobs[Index] );
- else
+ if (Blobs[Index]->IsSimpleBlock())
+ PushElement( (KaxSimpleBlock&) *Blobs[Index] );
+ else
#endif
- PushElement( (KaxBlockGroup&) *Blobs[Index] );
- }
-
- // SilentTracks handling
- // check the parent cluster for existing tracks and see if they are contained in this cluster or not
- if (bSilentTracksUsed)
- {
- KaxTracks & MyTracks = *static_cast<KaxTracks *>(ParentSegment->FindElt(EBML_INFO(KaxTracks)));
- for (TrkItr = MyTracks.begin(); TrkItr != MyTracks.end(); ++TrkItr)
+ PushElement( (KaxBlockGroup&) *Blobs[Index] );
+ }
+
+ // SilentTracks handling
+ // check the parent cluster for existing tracks and see if they are contained in this cluster or not
+ if (bSilentTracksUsed)
+ {
+ KaxTracks & MyTracks = *static_cast<KaxTracks *>(ParentSegment->FindElt(EBML_INFO(KaxTracks)));
+ for (TrkItr = MyTracks.begin(); TrkItr != MyTracks.end(); ++TrkItr)
{
- if (EbmlId(*(*TrkItr)) == EBML_ID(KaxTrackEntry))
- {
- KaxTrackEntry & entry = *static_cast<KaxTrackEntry *>(*TrkItr);
- uint32 tracknum = entry.TrackNumber();
- for (Index = 0; Index<Blobs.size(); Index++) {
- if (((KaxInternalBlock&)*Blobs[Index]).TrackNum() == tracknum)
- break; // this track is used
- }
- // the track wasn't found in this cluster
- if (Index == ListSize())
- {
- KaxClusterSilentTracks * SilentTracks = static_cast<KaxClusterSilentTracks *>(this->FindFirstElt(EBML_INFO(KaxClusterSilentTracks)));
- assert(SilentTracks != NULL); // the flag bSilentTracksUsed should be set when creating the Cluster
- KaxClusterSilentTrackNumber * trackelt = static_cast<KaxClusterSilentTrackNumber *>(SilentTracks->AddNewElt(EBML_INFO(KaxClusterSilentTrackNumber)));
- *static_cast<EbmlUInteger *>(trackelt) = tracknum;
- }
- }
- }
- }
-
- Result = EbmlMaster::Render(output, bSaveDefault);
-
- // For all Blocks add their position on the CueEntry
- for (Index = 0; Index<Blobs.size(); Index++) {
- CueToUpdate.PositionSet(*Blobs[Index]);
- }
-
- Blobs.clear();
- }
-
- return Result;
+ if (EbmlId(*(*TrkItr)) == EBML_ID(KaxTrackEntry))
+ {
+ KaxTrackEntry & entry = *static_cast<KaxTrackEntry *>(*TrkItr);
+ uint32 tracknum = entry.TrackNumber();
+ for (Index = 0; Index<Blobs.size(); Index++) {
+ if (((KaxInternalBlock&)*Blobs[Index]).TrackNum() == tracknum)
+ break; // this track is used
+ }
+ // the track wasn't found in this cluster
+ if (Index == ListSize())
+ {
+ KaxClusterSilentTracks * SilentTracks = static_cast<KaxClusterSilentTracks *>(this->FindFirstElt(EBML_INFO(KaxClusterSilentTracks)));
+ assert(SilentTracks != NULL); // the flag bSilentTracksUsed should be set when creating the Cluster
+ KaxClusterSilentTrackNumber * trackelt = static_cast<KaxClusterSilentTrackNumber *>(SilentTracks->AddNewElt(EBML_INFO(KaxClusterSilentTrackNumber)));
+ *static_cast<EbmlUInteger *>(trackelt) = tracknum;
+ }
+ }
+ }
+ }
+
+ Result = EbmlMaster::Render(output, bSaveDefault);
+
+ // For all Blocks add their position on the CueEntry
+ for (Index = 0; Index<Blobs.size(); Index++) {
+ CueToUpdate.PositionSet(*Blobs[Index]);
+ }
+
+ Blobs.clear();
+ }
+
+ return Result;
}
/*!
- \todo automatically choose valid timecode for the Cluster based on the previous cluster timecode (must be incremental)
+ \todo automatically choose valid timecode for the Cluster based on the previous cluster timecode (must be incremental)
*/
uint64 KaxCluster::GlobalTimecode() const
{
- assert(bPreviousTimecodeIsSet);
- uint64 result = MinTimecode;
+ assert(bPreviousTimecodeIsSet);
+ uint64 result = MinTimecode;
+
+ if (result < PreviousTimecode)
+ result = PreviousTimecode + 1;
- if (result < PreviousTimecode)
- result = PreviousTimecode + 1;
-
- return result;
+ return result;
}
/*!
- \brief retrieve the relative
- \todo !!! We need a way to know the TimecodeScale
+ \brief retrieve the relative
+ \todo !!! We need a way to know the TimecodeScale
*/
int16 KaxCluster::GetBlockLocalTimecode(uint64 aGlobalTimecode) const
{
- int64 TimecodeDelay = (int64(aGlobalTimecode) - int64(GlobalTimecode())) / int64(GlobalTimecodeScale());
- assert(TimecodeDelay >= int16(0x8000) && TimecodeDelay <= int16(0x7FFF));
- return int16(TimecodeDelay);
+ int64 TimecodeDelay = (int64(aGlobalTimecode) - int64(GlobalTimecode())) / int64(GlobalTimecodeScale());
+ assert(TimecodeDelay >= int16(0x8000) && TimecodeDelay <= int16(0x7FFF));
+ return int16(TimecodeDelay);
}
uint64 KaxCluster::GetBlockGlobalTimecode(int16 GlobalSavedTimecode)
{
- if (!bFirstFrameInside) {
- KaxClusterTimecode * Timecode = static_cast<KaxClusterTimecode *>(this->FindElt(EBML_INFO(KaxClusterTimecode)));
- assert (bFirstFrameInside); // use the InitTimecode() hack for now
- MinTimecode = MaxTimecode = PreviousTimecode = *static_cast<EbmlUInteger *>(Timecode);
- bFirstFrameInside = true;
- bPreviousTimecodeIsSet = true;
- }
- return int64(GlobalSavedTimecode * GlobalTimecodeScale()) + GlobalTimecode();
+ if (!bFirstFrameInside) {
+ KaxClusterTimecode * Timecode = static_cast<KaxClusterTimecode *>(this->FindElt(EBML_INFO(KaxClusterTimecode)));
+ assert (bFirstFrameInside); // use the InitTimecode() hack for now
+ MinTimecode = MaxTimecode = PreviousTimecode = *static_cast<EbmlUInteger *>(Timecode);
+ bFirstFrameInside = true;
+ bPreviousTimecodeIsSet = true;
+ }
+ return int64(GlobalSavedTimecode * GlobalTimecodeScale()) + GlobalTimecode();
}
KaxBlockGroup & KaxCluster::GetNewBlock()
{
- KaxBlockGroup & MyBlock = AddNewChild<KaxBlockGroup>(*this);
- MyBlock.SetParent(*this);
- return MyBlock;
+ KaxBlockGroup & MyBlock = AddNewChild<KaxBlockGroup>(*this);
+ MyBlock.SetParent(*this);
+ return MyBlock;
}
void KaxCluster::ReleaseFrames()
EBML_MASTER_ITERATOR Itr;
for (Itr = begin(); Itr != end(); ++Itr)
{
- if (EbmlId(*(*Itr)) == EBML_ID(KaxBlockGroup)) {
- static_cast<KaxBlockGroup*>(*Itr)->ReleaseFrames();
- }
- }
+ if (EbmlId(*(*Itr)) == EBML_ID(KaxBlockGroup)) {
+ static_cast<KaxBlockGroup*>(*Itr)->ReleaseFrames();
+ }
+ }
}
uint64 KaxCluster::GetPosition() const
{
- assert(ParentSegment != NULL);
- return ParentSegment->GetRelativePosition(*this);
+ assert(ParentSegment != NULL);
+ return ParentSegment->GetRelativePosition(*this);
}
END_LIBMATROSKA_NAMESPACE
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**********************************************************************/
/*!
- \file
- \version \$Id: KaxContexts.cpp 640 2004-07-09 21:05:36Z mosu $
- \author Steve Lhomme <robux4 @ users.sf.net>
+ \file
+ \version \$Id: KaxContexts.cpp 640 2004-07-09 21:05:36Z mosu $
+ \author Steve Lhomme <robux4 @ users.sf.net>
*/
#include "ebml/EbmlContexts.h"
#include "ebml/EbmlHead.h"
// for the moment
const EbmlSemanticContext & GetKaxGlobal_Context()
{
- return GetEbmlGlobal_Context();
+ return GetEbmlGlobal_Context();
}
END_LIBMATROSKA_NAMESPACE
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**********************************************************************/
/*!
- \file
- \version \$Id: KaxCues.cpp 1265 2007-01-14 17:20:35Z mosu $
- \author Steve Lhomme <robux4 @ users.sf.net>
+ \file
+ \version \$Id: KaxCues.cpp 1265 2007-01-14 17:20:35Z mosu $
+ \author Steve Lhomme <robux4 @ users.sf.net>
*/
#include <cassert>
KaxCues::~KaxCues()
{
- assert(myTempReferences.size() == 0); // otherwise that means you have added references and forgot to set the position
+ assert(myTempReferences.size() == 0); // otherwise that means you have added references and forgot to set the position
}
/* deprecated and wrong
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));
+ // 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 (&(KaxBlockGroup&)*ListIdx == &BlockRef)
+ for (ListIdx = myTempReferences.begin(); ListIdx != myTempReferences.end(); ListIdx++)
+ if (&(KaxBlockGroup&)*ListIdx == &BlockRef)
{
delete BlockReference;
- return true;
+ return true;
}
- myTempReferences.push_back(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;
+ // 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;
+ for (ListIdx = myTempReferences.begin(); ListIdx != myTempReferences.end(); ++ListIdx)
+ if (*ListIdx == &BlockReference)
+ return true;
- myTempReferences.push_back(&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;
- }
- }
+ // 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;
- }
- }
+ // 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())
+ \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;
- uint64 aNextTime = EBML_PRETTYLONGINT(0xFFFFFFFFFFFF);
+ uint64 TimecodeToLocate = aTimecode / GlobalTimecodeScale();
+ const KaxCuePoint * aPointPrev = NULL;
+ uint64 aPrevTime = 0;
+ uint64 aNextTime = EBML_PRETTYLONGINT(0xFFFFFFFFFFFF);
EBML_MASTER_CONST_ITERATOR Itr;
- for (Itr = begin(); Itr != end(); ++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;
- }
- }
- }
- }
-
- return aPointPrev;
+ 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;
+ }
+ }
+ }
+ }
+
+ return aPointPrev;
}
uint64 KaxCues::GetTimecodePosition(uint64 aTimecode) const
{
- const KaxCuePoint * aPoint = GetTimecodePoint(aTimecode);
- if (aPoint == NULL)
- return 0;
+ const KaxCuePoint * aPoint = GetTimecodePoint(aTimecode);
+ if (aPoint == NULL)
+ return 0;
- const KaxCueTrackPositions * aTrack = aPoint->GetSeekPosition();
- if (aTrack == NULL)
- return 0;
+ const KaxCueTrackPositions * aTrack = aPoint->GetSeekPosition();
+ if (aTrack == NULL)
+ return 0;
- return aTrack->ClusterPosition();
+ return aTrack->ClusterPosition();
}
END_LIBMATROSKA_NAMESPACE
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**********************************************************************/
/*!
- \file
- \version \$Id: KaxCuesData.cpp 1265 2007-01-14 17:20:35Z mosu $
- \author Steve Lhomme <robux4 @ users.sf.net>
+ \file
+ \version \$Id: KaxCuesData.cpp 1265 2007-01-14 17:20:35Z mosu $
+ \author Steve Lhomme <robux4 @ users.sf.net>
*/
#include <cassert>
START_LIBMATROSKA_NAMESPACE
/*!
- \todo handle codec state checking
- \todo remove duplicate references (reference to 2 frames that each reference the same frame)
+ \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;
+ // 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();
+ 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());
- }
+ // 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();
+ SetValueIsSet();
}
void KaxCuePoint::PositionSet(const KaxBlockBlob & BlobReference, uint64 GlobalTimecodeScale)
{
- const KaxInternalBlock &BlockReference = BlobReference;
+ const KaxInternalBlock &BlockReference = BlobReference;
+
+ // fill me
+ KaxCueTime & NewTime = GetChild<KaxCueTime>(*this);
+ *static_cast<EbmlUInteger*>(&NewTime) = BlockReference.GlobalTimecode() / 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.TrackNum();
- 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();
+ 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);
- }
- }
+ // 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());
- }
- }
+ 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();
+ SetValueIsSet();
}
#if MATROSKA_VERSION >= 2
/*!
- \todo handle codec state checking
+ \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;
+ 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();
+ 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());
- }
- }
+ // 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) == EBML_ID(KaxCuePoint));
- assert(EbmlId(*EltB) == EBML_ID(KaxCuePoint));
+ assert(EbmlId(*this) == EBML_ID(KaxCuePoint));
+ assert(EbmlId(*EltB) == EBML_ID(KaxCuePoint));
- const KaxCuePoint & theEltB = *static_cast<const KaxCuePoint *>(EltB);
+ 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;
+ // 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;
+ const KaxCueTime * TimeCodeB = static_cast<const KaxCueTime *>(theEltB.FindElt(EBML_INFO(KaxCueTime)));
+ if (TimeCodeB == NULL)
+ return false;
- if (TimeCodeA->IsSmallerThan(TimeCodeB))
- return true;
+ if (TimeCodeA->IsSmallerThan(TimeCodeB))
+ return true;
- if (TimeCodeB->IsSmallerThan(TimeCodeA))
- return false;
+ 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;
+ // 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;
+ const KaxCueTrack * TrackB = static_cast<const KaxCueTrack *>(theEltB.FindElt(EBML_INFO(KaxCueTrack)));
+ if (TrackB == NULL)
+ return false;
- if (TrackA->IsSmallerThan(TrackB))
- return true;
+ if (TrackA->IsSmallerThan(TrackB))
+ return true;
- if (TrackB->IsSmallerThan(TrackA))
- return false;
+ if (TrackB->IsSmallerThan(TrackA))
+ return false;
- 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;
+ 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
+ \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;
+ 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;
+ const KaxCueClusterPosition *aPos = static_cast<const KaxCueClusterPosition *>(FindFirstElt(EBML_INFO(KaxCueClusterPosition)));
+ if (aPos == NULL)
+ return 0;
- return uint64(*aPos);
+ return uint64(*aPos);
}
uint16 KaxCueTrackPositions::TrackNumber() const
{
- const KaxCueTrack *aTrack = static_cast<const KaxCueTrack *>(FindFirstElt(EBML_INFO(KaxCueTrack)));
- if (aTrack == NULL)
- return 0;
+ const KaxCueTrack *aTrack = static_cast<const KaxCueTrack *>(FindFirstElt(EBML_INFO(KaxCueTrack)));
+ if (aTrack == NULL)
+ return 0;
- return uint16(*aTrack);
+ return uint16(*aTrack);
}
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**********************************************************************/
/*!
- \file
- \version \$Id$
- \author Steve Lhomme <robux4 @ users.sf.net>
- \author John Cannon <spyder2555 @ users.sf.net>
+ \file
+ \version \$Id$
+ \author Steve Lhomme <robux4 @ users.sf.net>
+ \author John Cannon <spyder2555 @ users.sf.net>
*/
#include "matroska/KaxInfoData.h"
#include "matroska/KaxContexts.h"
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**********************************************************************/
/*!
- \file
- \version \$Id: KaxSeekHead.cpp 640 2004-07-09 21:05:36Z mosu $
- \author Steve Lhomme <robux4 @ users.sf.net>
+ \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"
START_LIBMATROSKA_NAMESPACE
/*!
- \todo verify that the element is not already in the list
+ \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);
+ // 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);
+ // 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];
+ KaxSeekID & aNewID = GetChild<KaxSeekID>(aNewPoint);
+ binary ID[4];
((const EbmlId&)aElt).Fill(ID);
- aNewID.CopyBuffer(ID, EBML_ID_LENGTH((const EbmlId&)aElt));
+ 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;
+ // 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)
+ 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))
{
- 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;
+ 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)
+ 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 == static_cast<const EbmlElement*>(&aPrev))
+ break;
+ }
- if (Itr != end())
+ if (Itr != end())
{
- ++Itr;
- for (; Itr != end(); ++Itr)
+ ++Itr;
+ for (; Itr != end(); ++Itr)
{
- if (EbmlId(*(*Itr)) == EBML_ID(KaxSeek))
- {
- tmp = (KaxSeek *)(*Itr);
- if (tmp->IsEbmlId(aPrev))
- return tmp;
- }
- }
- }
-
- return NULL;
+ 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);
+ 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);
+ 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);
+ 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
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**********************************************************************/
/*!
- \file
- \version \$Id: KaxSegment.cpp 1096 2005-03-17 09:14:52Z robux4 $
- \author Steve Lhomme <robux4 @ users.sf.net>
+ \file
+ \version \$Id: KaxSegment.cpp 1096 2005-03-17 09:14:52Z robux4 $
+ \author Steve Lhomme <robux4 @ users.sf.net>
*/
#include "matroska/KaxSegment.h"
#include "ebml/EbmlHead.h"
START_LIBMATROSKA_NAMESPACE
KaxSegment::KaxSegment(EBML_EXTRA_DEF)
- :EbmlMaster(EBML_CLASS_SEMCONTEXT(KaxSegment) EBML_DEF_SEP EBML_EXTRA_CALL)
+ :EbmlMaster(EBML_CLASS_SEMCONTEXT(KaxSegment) EBML_DEF_SEP EBML_EXTRA_CALL)
{
- SetSizeLength(5); // mandatory min size support (for easier updating) (2^(7*5)-2 = 32Go)
- SetSizeInfinite(); // by default a segment is big and the size is unknown in advance
+ SetSizeLength(5); // mandatory min size support (for easier updating) (2^(7*5)-2 = 32Go)
+ SetSizeInfinite(); // by default a segment is big and the size is unknown in advance
}
KaxSegment::KaxSegment(const KaxSegment & ElementToClone)
:EbmlMaster(ElementToClone)
{
- // update the parent of each children
- EBML_MASTER_ITERATOR Itr = begin();
- while (Itr != end())
- {
- if (EbmlId(**Itr) == EBML_ID(KaxCluster)) {
- static_cast<KaxCluster *>(*Itr)->SetParent(*this);
- }
+ // update the parent of each children
+ EBML_MASTER_ITERATOR Itr = begin();
+ while (Itr != end())
+ {
+ if (EbmlId(**Itr) == EBML_ID(KaxCluster)) {
+ static_cast<KaxCluster *>(*Itr)->SetParent(*this);
+ }
++Itr;
- }
+ }
}
uint64 KaxSegment::GetRelativePosition(uint64 aGlobalPosition) const
{
- return aGlobalPosition - GetElementPosition() - HeadSize();
+ return aGlobalPosition - GetElementPosition() - HeadSize();
}
uint64 KaxSegment::GetRelativePosition(const EbmlElement & Elt) const
{
- return GetRelativePosition(Elt.GetElementPosition());
+ return GetRelativePosition(Elt.GetElementPosition());
}
uint64 KaxSegment::GetGlobalPosition(uint64 aRelativePosition) const
{
- return aRelativePosition + GetElementPosition() + HeadSize();
+ return aRelativePosition + GetElementPosition() + HeadSize();
}
END_LIBMATROSKA_NAMESPACE
/**********************************************************************
** DO NOT EDIT, GENERATED WITH DATA2LIB
-**
+**
** libmatroska : parse Matroska files, see http://www.matroska.org/
-**
+**
** Copyright (c) 2002-2010, Matroska (non-profit organisation)
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
DEFINE_MKX_BINARY (KaxTagBinary, 0x4485, 2, KaxTagSimple, "TagBinary");
filepos_t KaxBlockVirtual::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) {
- assert(false); // no you are not allowed to use this element !
- return 0;
+ assert(false); // no you are not allowed to use this element !
+ return 0;
}
filepos_t KaxReferenceVirtual::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) {
- assert(false); // no you are not allowed to use this element !
- return 0;
+ assert(false); // no you are not allowed to use this element !
+ return 0;
}
filepos_t KaxSliceFrameNumber::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) {
- assert(false); // no you are not allowed to use this element !
- return 0;
+ assert(false); // no you are not allowed to use this element !
+ return 0;
}
filepos_t KaxSliceBlockAddID::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) {
- assert(false); // no you are not allowed to use this element !
- return 0;
+ assert(false); // no you are not allowed to use this element !
+ return 0;
}
filepos_t KaxSliceDelay::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) {
- assert(false); // no you are not allowed to use this element !
- return 0;
+ assert(false); // no you are not allowed to use this element !
+ return 0;
}
filepos_t KaxSliceDuration::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) {
- assert(false); // no you are not allowed to use this element !
- return 0;
+ assert(false); // no you are not allowed to use this element !
+ return 0;
}
filepos_t KaxEncryptedBlock::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) {
- assert(false); // no you are not allowed to use this element !
- return 0;
+ assert(false); // no you are not allowed to use this element !
+ return 0;
}
filepos_t KaxTrackTimecodeScale::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) {
- assert(false); // no you are not allowed to use this element !
- return 0;
+ assert(false); // no you are not allowed to use this element !
+ return 0;
}
filepos_t KaxTrackOffset::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) {
- assert(false); // no you are not allowed to use this element !
- return 0;
+ assert(false); // no you are not allowed to use this element !
+ return 0;
}
filepos_t KaxCodecSettings::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) {
- assert(false); // no you are not allowed to use this element !
- return 0;
+ assert(false); // no you are not allowed to use this element !
+ return 0;
}
filepos_t KaxCodecInfoURL::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) {
- assert(false); // no you are not allowed to use this element !
- return 0;
+ assert(false); // no you are not allowed to use this element !
+ return 0;
}
filepos_t KaxCodecDownloadURL::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) {
- assert(false); // no you are not allowed to use this element !
- return 0;
+ assert(false); // no you are not allowed to use this element !
+ return 0;
}
filepos_t KaxOldStereoMode::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) {
- assert(false); // no you are not allowed to use this element !
- return 0;
+ assert(false); // no you are not allowed to use this element !
+ return 0;
}
filepos_t KaxVideoGamma::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) {
- assert(false); // no you are not allowed to use this element !
- return 0;
+ assert(false); // no you are not allowed to use this element !
+ return 0;
}
filepos_t KaxVideoFrameRate::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) {
- assert(false); // no you are not allowed to use this element !
- return 0;
+ assert(false); // no you are not allowed to use this element !
+ return 0;
}
filepos_t KaxAudioPosition::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) {
- assert(false); // no you are not allowed to use this element !
- return 0;
+ assert(false); // no you are not allowed to use this element !
+ return 0;
}
filepos_t KaxCueRefCluster::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) {
- assert(false); // no you are not allowed to use this element !
- return 0;
+ assert(false); // no you are not allowed to use this element !
+ return 0;
}
filepos_t KaxCueRefNumber::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) {
- assert(false); // no you are not allowed to use this element !
- return 0;
+ assert(false); // no you are not allowed to use this element !
+ return 0;
}
filepos_t KaxCueRefCodecState::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) {
- assert(false); // no you are not allowed to use this element !
- return 0;
+ assert(false); // no you are not allowed to use this element !
+ return 0;
}
filepos_t KaxFileReferral::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) {
- assert(false); // no you are not allowed to use this element !
- return 0;
+ assert(false); // no you are not allowed to use this element !
+ return 0;
}
END_LIBMATROSKA_NAMESPACE
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**********************************************************************/
/*!
- \file
- \version \$Id: KaxTracks.cpp 1202 2005-08-30 14:39:01Z robux4 $
- \author Steve Lhomme <robux4 @ users.sf.net>
+ \file
+ \version \$Id: KaxTracks.cpp 1202 2005-08-30 14:39:01Z robux4 $
+ \author Steve Lhomme <robux4 @ users.sf.net>
*/
#include "matroska/KaxTracks.h"
START_LIBMATROSKA_NAMESPACE
KaxTrackEntry::KaxTrackEntry(EBML_EXTRA_DEF)
- :EbmlMaster(EBML_CLASS_SEMCONTEXT(KaxTrackEntry) EBML_DEF_SEP EBML_EXTRA_CALL)
- ,bGlobalTimecodeScaleIsSet(false)
+ :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;
+ KaxTrackFlagLacing & myLacing = GetChild<KaxTrackFlagLacing>(*this);
+ *(static_cast<EbmlUInteger *>(&myLacing)) = bEnable ? 1 : 0;
}
END_LIBMATROSKA_NAMESPACE
**********************************************************************/
/*!
- \file
- \version \$Id: KaxVersion.cpp 640 2004-07-09 21:05:36Z mosu $
- \author Steve Lhomme <robux4 @ users.sf.net>
+ \file
+ \version \$Id: KaxVersion.cpp 640 2004-07-09 21:05:36Z mosu $
+ \author Steve Lhomme <robux4 @ users.sf.net>
*/
#include "matroska/KaxVersion.h"
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
\file
\version \$Id$
\author Steve Lhomme <robux4 @ users.sf.net>
- Test the EBML write possibilities
- \see http://www.cl.cam.ac.uk/~mgk25/unicode.html
- \see http://www-106.ibm.com/developerworks/unicode/library/u-encode.html
+ Test the EBML write possibilities
+ \see http://www.cl.cam.ac.uk/~mgk25/unicode.html
+ \see http://www-106.ibm.com/developerworks/unicode/library/u-encode.html
*/
#include <stdio.h>
const char RW_FILENAME[] = "test.kax";
enum SemanticType {
- EBML_U_INTEGER,
- EBML_S_INTEGER,
- EBML_BINARY,
- EBML_STRING,
- EBML_STRING_UNICODE,
- EBML_FLOAT,
- EBML_MASTER,
+ EBML_U_INTEGER,
+ EBML_S_INTEGER,
+ EBML_BINARY,
+ EBML_STRING,
+ EBML_STRING_UNICODE,
+ EBML_FLOAT,
+ EBML_MASTER,
};
typedef binary EBMLID[4];
struct Semantic {
- EBMLID Id;
- int IdLength;
- SemanticType Type;
+ EBMLID Id;
+ int IdLength;
+ SemanticType Type;
};
-struct Semantic SemanticList[] =
+struct Semantic SemanticList[] =
{
- {{0x42, 0x45}, 2, EBML_U_INTEGER},
- {{0x1A, 0x45, 0x33, 0x80}, 4, EBML_S_INTEGER},
- {{0x87}, 1, EBML_BINARY},
- {{0x22, 0x33, 0x44}, 3, EBML_STRING},
- {{0x44, 0x33}, 2, EBML_STRING_UNICODE},
- {{0x50, 0x50}, 2, EBML_FLOAT},
- {{0x36, 0x47, 0x58}, 3, EBML_MASTER},
+ {{0x42, 0x45}, 2, EBML_U_INTEGER},
+ {{0x1A, 0x45, 0x33, 0x80}, 4, EBML_S_INTEGER},
+ {{0x87}, 1, EBML_BINARY},
+ {{0x22, 0x33, 0x44}, 3, EBML_STRING},
+ {{0x44, 0x33}, 2, EBML_STRING_UNICODE},
+ {{0x50, 0x50}, 2, EBML_FLOAT},
+ {{0x36, 0x47, 0x58}, 3, EBML_MASTER},
};
/*!
*/
int main(void)
{
- StdIOCallback Ebml_file(RW_FILENAME, ::MODE_CREATE);
-
- ///// Writing test
-
- ///////////////////////////////
- // Unsigned integer
- ///////////////////////////////
-
- EbmlUInteger testUInt(4); // supposed to hold a 4*8 bits value
-
- testUInt.SetID(SemanticList[0].Id, SemanticList[0].IdLength);
- testUInt = 52;
- testUInt.SetSizeLength(3); // size should be coded on at least 3 octets
- testUInt.Render(Ebml_file);
-
- ///////////////////////////////
- // Signed integer
- ///////////////////////////////
-
- EbmlSInteger testSInt(4); // supposed to hold a 4*8 bits value
-
- testSInt.SetID(SemanticList[1].Id, SemanticList[1].IdLength);
- testSInt = -20;
- testSInt.Render(Ebml_file);
-
- ///////////////////////////////
- // Binary data
- ///////////////////////////////
- const int BINARY_SIZE=3000;
-
- binary *bin = new binary[BINARY_SIZE];
- memset(bin, 0x61, BINARY_SIZE);
- EbmlBinary testBin;
-
- testBin.SetID(SemanticList[2].Id, SemanticList[2].IdLength);
- testBin.SetBuffer(bin, BINARY_SIZE);
- testBin.Render(Ebml_file);
-
- ///////////////////////////////
- // String data
- ///////////////////////////////
- std::string aString = "Hello World !";
- EbmlString testStr(200);
-
- testStr.SetID(SemanticList[3].Id, SemanticList[3].IdLength);
- testStr = aString;
- testStr.Render(Ebml_file);
-
- ///////////////////////////////
- // Master element
- ///////////////////////////////
- EbmlMaster testMaster;
-
- testMaster.SetID(SemanticList[6].Id, SemanticList[6].IdLength);
- testMaster.PushElement(testStr);
- testMaster.PushElement(testUInt);
- testMaster.Render(Ebml_file);
-
- ///////////////////////////////
- // Unicode String data
- ///////////////////////////////
- UTFstring bString = L"Stève Lhomm\80";
- EbmlUnicodeString testUStr(200);
-
- testUStr.SetID(SemanticList[4].Id, SemanticList[4].IdLength);
- testUStr = bString;
- testUStr.Render(Ebml_file);
-
- ///////////////////////////////
- // Float data
- ///////////////////////////////
- EbmlFloat testFloat(EbmlFloat::FLOAT_32);
-
- testFloat.SetID(SemanticList[5].Id, SemanticList[5].IdLength);
- testFloat.SetPrecision(EbmlFloat::FLOAT_32);
- testFloat = 1.01234567890123456;
- testFloat.Render(Ebml_file);
-
- testFloat.SetPrecision(EbmlFloat::FLOAT_64);
- testFloat = -1.01234567890123456L;
- testFloat.Render(Ebml_file);
-
- Ebml_file.close();
-
- ///// Reading test
- StdIOCallback Ebml_Wfile(RW_FILENAME, ::MODE_READ);
-
- // example 1 skip all the elements found
- EbmlStream aStream(Ebml_Wfile);
- EbmlElement * ElementLevel0;
-
- // read the data until a possible element is found (valid ID + size combination)
- ElementLevel0 = aStream.FindNextID(0xFFFFFFFFL, false);
- printf("Read EBML elements & skip data\n");
- while (ElementLevel0 != NULL)
- {
- printf("ID : ");
- for (int i=0; i<ElementLevel0->GetIDLength(); i++)
- {
- printf("[%02X]", ElementLevel0->GetID()[i]);
- }
- printf("\n");
-
- ElementLevel0->SkipData(Ebml_Wfile);
- if (ElementLevel0 != NULL)
- delete ElementLevel0;
-
- ElementLevel0 = aStream.FindNextID(0xFFFFFFFFL, false);
- }
-
- // example 2 evaluation of all elements found
- EbmlStream bStream(Ebml_Wfile);
- EbmlElement * EvaledElementLevel0;
-// EbmlElement * EvaledElementLevel1;
-
- // reset the stream to the beggining
- Ebml_Wfile.setFilePointer(0);
-
- // list of all IDs and their semantic type
-// std::list<struct Semantic> SemanticList;
-// SemanticList.push_back();
-
- ElementLevel0 = aStream.FindNextID(0xFFFFFFFFL, false);
- printf("Read EBML elements & evaluate data\n");
- while (ElementLevel0 != NULL)
- {
- int i;
- printf("ID : ");
- for (i=0; i<ElementLevel0->GetIDLength(); i++)
- {
- printf("[%02X]", ElementLevel0->GetID()[i]);
- }
-
- // check if the element is known
- for (i=0; i<countof(SemanticList); i++) {
- if (ElementLevel0->GetIDLength() != SemanticList[i].IdLength)
- continue;
- if (memcmp(SemanticList[i].Id, ElementLevel0->GetID(), SemanticList[i].IdLength) == 0)
- break;
- }
- /// \todo check if it is known in the context
- // handle the data inside the element
- if (i < countof(SemanticList)) {
- switch (SemanticList[i].Type)
- {
- case EBML_U_INTEGER:
- EvaledElementLevel0 = new EbmlUInteger(*ElementLevel0);
- break;
- case EBML_S_INTEGER:
- EvaledElementLevel0 = new EbmlSInteger(*ElementLevel0);
- break;
- case EBML_BINARY:
- EvaledElementLevel0 = new EbmlBinary(*ElementLevel0);
- break;
- case EBML_STRING:
- EvaledElementLevel0 = new EbmlString(*ElementLevel0);
- break;
- case EBML_STRING_UNICODE:
- EvaledElementLevel0 = new EbmlUnicodeString(*ElementLevel0);
- break;
- case EBML_FLOAT:
- EvaledElementLevel0 = new EbmlFloat(*ElementLevel0);
- break;
- case EBML_MASTER:
- EvaledElementLevel0 = new EbmlMaster(*ElementLevel0);
- break;
- }
-
- EvaledElementLevel0->ReadData(Ebml_Wfile);
-
- switch (SemanticList[i].Type)
- {
- case EBML_U_INTEGER:
- printf(" : %d", uint32(*(EbmlUInteger*)EvaledElementLevel0));
- break;
- case EBML_S_INTEGER:
- printf(" : %d", int32(*(EbmlSInteger*)EvaledElementLevel0));
- break;
- case EBML_BINARY:
- printf(" : binary data, size = %ld", (*(EbmlBinary*)EvaledElementLevel0).GetSize());
- printf(" [%02X]", binary(*(EbmlBinary*)EvaledElementLevel0));
- break;
- case EBML_STRING:
- printf(" : %s", std::string(*(EbmlString*)EvaledElementLevel0).data());
- break;
- case EBML_STRING_UNICODE:
- printf(" : (wide chars) %ls", UTFstring(*(EbmlUnicodeString*)EvaledElementLevel0).data());
- break;
- case EBML_FLOAT:
- printf(" : %f / %.15lf", float(*(EbmlFloat*)EvaledElementLevel0), double(*(EbmlFloat*)EvaledElementLevel0));
- break;
- case EBML_MASTER:
- printf(" : unsupported format 'Master'");
- break;
- }
- delete EvaledElementLevel0;
- } else {
- ElementLevel0->SkipData(Ebml_Wfile);
- }
- if (ElementLevel0 != NULL)
- delete ElementLevel0;
-
- printf("\n");
-
- ElementLevel0 = aStream.FindNextID(0xFFFFFFFFL, false);
- }
-
- Ebml_Wfile.close();
-
- return 0;
+ StdIOCallback Ebml_file(RW_FILENAME, ::MODE_CREATE);
+
+ ///// Writing test
+
+ ///////////////////////////////
+ // Unsigned integer
+ ///////////////////////////////
+
+ EbmlUInteger testUInt(4); // supposed to hold a 4*8 bits value
+
+ testUInt.SetID(SemanticList[0].Id, SemanticList[0].IdLength);
+ testUInt = 52;
+ testUInt.SetSizeLength(3); // size should be coded on at least 3 octets
+ testUInt.Render(Ebml_file);
+
+ ///////////////////////////////
+ // Signed integer
+ ///////////////////////////////
+
+ EbmlSInteger testSInt(4); // supposed to hold a 4*8 bits value
+
+ testSInt.SetID(SemanticList[1].Id, SemanticList[1].IdLength);
+ testSInt = -20;
+ testSInt.Render(Ebml_file);
+
+ ///////////////////////////////
+ // Binary data
+ ///////////////////////////////
+ const int BINARY_SIZE=3000;
+
+ binary *bin = new binary[BINARY_SIZE];
+ memset(bin, 0x61, BINARY_SIZE);
+ EbmlBinary testBin;
+
+ testBin.SetID(SemanticList[2].Id, SemanticList[2].IdLength);
+ testBin.SetBuffer(bin, BINARY_SIZE);
+ testBin.Render(Ebml_file);
+
+ ///////////////////////////////
+ // String data
+ ///////////////////////////////
+ std::string aString = "Hello World !";
+ EbmlString testStr(200);
+
+ testStr.SetID(SemanticList[3].Id, SemanticList[3].IdLength);
+ testStr = aString;
+ testStr.Render(Ebml_file);
+
+ ///////////////////////////////
+ // Master element
+ ///////////////////////////////
+ EbmlMaster testMaster;
+
+ testMaster.SetID(SemanticList[6].Id, SemanticList[6].IdLength);
+ testMaster.PushElement(testStr);
+ testMaster.PushElement(testUInt);
+ testMaster.Render(Ebml_file);
+
+ ///////////////////////////////
+ // Unicode String data
+ ///////////////////////////////
+ UTFstring bString = L"Stève Lhomm\80";
+ EbmlUnicodeString testUStr(200);
+
+ testUStr.SetID(SemanticList[4].Id, SemanticList[4].IdLength);
+ testUStr = bString;
+ testUStr.Render(Ebml_file);
+
+ ///////////////////////////////
+ // Float data
+ ///////////////////////////////
+ EbmlFloat testFloat(EbmlFloat::FLOAT_32);
+
+ testFloat.SetID(SemanticList[5].Id, SemanticList[5].IdLength);
+ testFloat.SetPrecision(EbmlFloat::FLOAT_32);
+ testFloat = 1.01234567890123456;
+ testFloat.Render(Ebml_file);
+
+ testFloat.SetPrecision(EbmlFloat::FLOAT_64);
+ testFloat = -1.01234567890123456L;
+ testFloat.Render(Ebml_file);
+
+ Ebml_file.close();
+
+ ///// Reading test
+ StdIOCallback Ebml_Wfile(RW_FILENAME, ::MODE_READ);
+
+ // example 1 skip all the elements found
+ EbmlStream aStream(Ebml_Wfile);
+ EbmlElement * ElementLevel0;
+
+ // read the data until a possible element is found (valid ID + size combination)
+ ElementLevel0 = aStream.FindNextID(0xFFFFFFFFL, false);
+ printf("Read EBML elements & skip data\n");
+ while (ElementLevel0 != NULL)
+ {
+ printf("ID : ");
+ for (int i=0; i<ElementLevel0->GetIDLength(); i++)
+ {
+ printf("[%02X]", ElementLevel0->GetID()[i]);
+ }
+ printf("\n");
+
+ ElementLevel0->SkipData(Ebml_Wfile);
+ if (ElementLevel0 != NULL)
+ delete ElementLevel0;
+
+ ElementLevel0 = aStream.FindNextID(0xFFFFFFFFL, false);
+ }
+
+ // example 2 evaluation of all elements found
+ EbmlStream bStream(Ebml_Wfile);
+ EbmlElement * EvaledElementLevel0;
+// EbmlElement * EvaledElementLevel1;
+
+ // reset the stream to the beggining
+ Ebml_Wfile.setFilePointer(0);
+
+ // list of all IDs and their semantic type
+// std::list<struct Semantic> SemanticList;
+// SemanticList.push_back();
+
+ ElementLevel0 = aStream.FindNextID(0xFFFFFFFFL, false);
+ printf("Read EBML elements & evaluate data\n");
+ while (ElementLevel0 != NULL)
+ {
+ int i;
+ printf("ID : ");
+ for (i=0; i<ElementLevel0->GetIDLength(); i++)
+ {
+ printf("[%02X]", ElementLevel0->GetID()[i]);
+ }
+
+ // check if the element is known
+ for (i=0; i<countof(SemanticList); i++) {
+ if (ElementLevel0->GetIDLength() != SemanticList[i].IdLength)
+ continue;
+ if (memcmp(SemanticList[i].Id, ElementLevel0->GetID(), SemanticList[i].IdLength) == 0)
+ break;
+ }
+ /// \todo check if it is known in the context
+ // handle the data inside the element
+ if (i < countof(SemanticList)) {
+ switch (SemanticList[i].Type)
+ {
+ case EBML_U_INTEGER:
+ EvaledElementLevel0 = new EbmlUInteger(*ElementLevel0);
+ break;
+ case EBML_S_INTEGER:
+ EvaledElementLevel0 = new EbmlSInteger(*ElementLevel0);
+ break;
+ case EBML_BINARY:
+ EvaledElementLevel0 = new EbmlBinary(*ElementLevel0);
+ break;
+ case EBML_STRING:
+ EvaledElementLevel0 = new EbmlString(*ElementLevel0);
+ break;
+ case EBML_STRING_UNICODE:
+ EvaledElementLevel0 = new EbmlUnicodeString(*ElementLevel0);
+ break;
+ case EBML_FLOAT:
+ EvaledElementLevel0 = new EbmlFloat(*ElementLevel0);
+ break;
+ case EBML_MASTER:
+ EvaledElementLevel0 = new EbmlMaster(*ElementLevel0);
+ break;
+ }
+
+ EvaledElementLevel0->ReadData(Ebml_Wfile);
+
+ switch (SemanticList[i].Type)
+ {
+ case EBML_U_INTEGER:
+ printf(" : %d", uint32(*(EbmlUInteger*)EvaledElementLevel0));
+ break;
+ case EBML_S_INTEGER:
+ printf(" : %d", int32(*(EbmlSInteger*)EvaledElementLevel0));
+ break;
+ case EBML_BINARY:
+ printf(" : binary data, size = %ld", (*(EbmlBinary*)EvaledElementLevel0).GetSize());
+ printf(" [%02X]", binary(*(EbmlBinary*)EvaledElementLevel0));
+ break;
+ case EBML_STRING:
+ printf(" : %s", std::string(*(EbmlString*)EvaledElementLevel0).data());
+ break;
+ case EBML_STRING_UNICODE:
+ printf(" : (wide chars) %ls", UTFstring(*(EbmlUnicodeString*)EvaledElementLevel0).data());
+ break;
+ case EBML_FLOAT:
+ printf(" : %f / %.15lf", float(*(EbmlFloat*)EvaledElementLevel0), double(*(EbmlFloat*)EvaledElementLevel0));
+ break;
+ case EBML_MASTER:
+ printf(" : unsupported format 'Master'");
+ break;
+ }
+ delete EvaledElementLevel0;
+ } else {
+ ElementLevel0->SkipData(Ebml_Wfile);
+ }
+ if (ElementLevel0 != NULL)
+ delete ElementLevel0;
+
+ printf("\n");
+
+ ElementLevel0 = aStream.FindNextID(0xFFFFFFFFL, false);
+ }
+
+ Ebml_Wfile.close();
+
+ return 0;
}
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
\file
\version \$Id$
\author Steve Lhomme <robux4 @ users.sf.net>
- Test the writing a basic EBML file
+ Test the writing a basic EBML file
*/
#include <stdio.h>
/*!
\test Some test on the Cluster use
- \todo each Master element should have a context !
- \todo move the base EBML classes to a template of each type ? (defining the default value and the ID)
- \todo find another way than using all those static_cast (using a template ?)
+ \todo each Master element should have a context !
+ \todo move the base EBML classes to a template of each type ? (defining the default value and the ID)
+ \todo find another way than using all those static_cast (using a template ?)
*/
int main(void)
{
- printf("Test00 :\nEBML %s %s / Matroska %s %s\n", EbmlCodeVersion.c_str(), EbmlCodeDate.c_str(), KaxCodeVersion.c_str(), KaxCodeDate.c_str());
- StdIOCallback Ebml_file(RW_FILENAME, ::MODE_CREATE);
-
- ///// Writing test
- EbmlHead TestHead;
-
- printf("Write EBML + Matroska elements\n");
- EDocType & MyDocType = GetChild<EDocType>(TestHead);
- *static_cast<EbmlString *>(&MyDocType) = "matroska";
-
- EDocTypeVersion & MyDocTypeVer = GetChild<EDocTypeVersion>(TestHead);
- *(static_cast<EbmlUInteger *>(&MyDocTypeVer)) = 1;
-
- EDocTypeReadVersion & MyDocTypeReadVer = GetChild<EDocTypeReadVersion>(TestHead);
- *(static_cast<EbmlUInteger *>(&MyDocTypeReadVer)) = 1;
-
- TestHead.Render(Ebml_file);
-
- KaxSegment FirstSegment;
- // size is unknown and will always be, we can render it right away
- FirstSegment.Render(Ebml_file);
-
- KaxAttachments * pAllAttachments = static_cast<KaxAttachments *>(FirstSegment.FindFirstElt(KaxAttachments::ClassInfos, true));
- if (pAllAttachments == NULL)
- return -1;
- pAllAttachments->SetSizeInfinite();
- // size is unknown and will always be, we can render it right away
- pAllAttachments->Render(Ebml_file);
-
- KaxAttached * pAttachment1 = static_cast<KaxAttached *>(pAllAttachments->FindFirstElt(KaxAttached::ClassInfos, true));
- if (pAttachment1 == NULL)
- return -1;
- KaxFileName * pFileName1 = static_cast<KaxFileName *>(pAttachment1->FindFirstElt(KaxFileName::ClassInfos, true));
- if (pFileName1 == NULL)
- return -1;
- *static_cast<EbmlUnicodeString *>(pFileName1) = "file1.txt";
- KaxFileData * pFileData1 = static_cast<KaxFileData *>(pAttachment1->FindFirstElt(KaxFileData::ClassInfos, true));
- if (pFileData1 == NULL)
- return -1;
- char Buffer1[] = "Ah ah ah !";
- static_cast<EbmlBinary *>(pFileData1)->SetBuffer((const binary*) Buffer1, countof(Buffer1));
- // should produce an error if the size is not infinite and the data has been rendered
- pAttachment1->Render(Ebml_file);
-
- KaxAttached * pAttachment2 = static_cast<KaxAttached *>(pAllAttachments->AddNewElt(KaxAttached::ClassInfos));
- if (pAttachment2 == NULL)
- return -1;
- KaxFileName * pFileName2 = static_cast<KaxFileName *>(pAttachment2->FindFirstElt(KaxFileName::ClassInfos, true));
- if (pFileName2 == NULL)
- return -1;
- *static_cast<EbmlUnicodeString *>(pFileName2) = "file2.txt";
- // Add a void element (data is discarded)
- EbmlVoid * pVoid = static_cast<EbmlVoid *>(pAttachment2->FindFirstElt(EbmlVoid::ClassInfos, true));
- if (pVoid == NULL)
- return -1;
- static_cast<EbmlBinary *>(pVoid)->SetBuffer((const binary*) Buffer1, countof(Buffer1));
- pAttachment2->Render(Ebml_file);
+ printf("Test00 :\nEBML %s %s / Matroska %s %s\n", EbmlCodeVersion.c_str(), EbmlCodeDate.c_str(), KaxCodeVersion.c_str(), KaxCodeDate.c_str());
+ StdIOCallback Ebml_file(RW_FILENAME, ::MODE_CREATE);
+
+ ///// Writing test
+ EbmlHead TestHead;
+
+ printf("Write EBML + Matroska elements\n");
+ EDocType & MyDocType = GetChild<EDocType>(TestHead);
+ *static_cast<EbmlString *>(&MyDocType) = "matroska";
+
+ EDocTypeVersion & MyDocTypeVer = GetChild<EDocTypeVersion>(TestHead);
+ *(static_cast<EbmlUInteger *>(&MyDocTypeVer)) = 1;
+
+ EDocTypeReadVersion & MyDocTypeReadVer = GetChild<EDocTypeReadVersion>(TestHead);
+ *(static_cast<EbmlUInteger *>(&MyDocTypeReadVer)) = 1;
+
+ TestHead.Render(Ebml_file);
+
+ KaxSegment FirstSegment;
+ // size is unknown and will always be, we can render it right away
+ FirstSegment.Render(Ebml_file);
+
+ KaxAttachments * pAllAttachments = static_cast<KaxAttachments *>(FirstSegment.FindFirstElt(KaxAttachments::ClassInfos, true));
+ if (pAllAttachments == NULL)
+ return -1;
+ pAllAttachments->SetSizeInfinite();
+ // size is unknown and will always be, we can render it right away
+ pAllAttachments->Render(Ebml_file);
+
+ KaxAttached * pAttachment1 = static_cast<KaxAttached *>(pAllAttachments->FindFirstElt(KaxAttached::ClassInfos, true));
+ if (pAttachment1 == NULL)
+ return -1;
+ KaxFileName * pFileName1 = static_cast<KaxFileName *>(pAttachment1->FindFirstElt(KaxFileName::ClassInfos, true));
+ if (pFileName1 == NULL)
+ return -1;
+ *static_cast<EbmlUnicodeString *>(pFileName1) = "file1.txt";
+ KaxFileData * pFileData1 = static_cast<KaxFileData *>(pAttachment1->FindFirstElt(KaxFileData::ClassInfos, true));
+ if (pFileData1 == NULL)
+ return -1;
+ char Buffer1[] = "Ah ah ah !";
+ static_cast<EbmlBinary *>(pFileData1)->SetBuffer((const binary*) Buffer1, countof(Buffer1));
+ // should produce an error if the size is not infinite and the data has been rendered
+ pAttachment1->Render(Ebml_file);
+
+ KaxAttached * pAttachment2 = static_cast<KaxAttached *>(pAllAttachments->AddNewElt(KaxAttached::ClassInfos));
+ if (pAttachment2 == NULL)
+ return -1;
+ KaxFileName * pFileName2 = static_cast<KaxFileName *>(pAttachment2->FindFirstElt(KaxFileName::ClassInfos, true));
+ if (pFileName2 == NULL)
+ return -1;
+ *static_cast<EbmlUnicodeString *>(pFileName2) = "file2.txt";
+ // Add a void element (data is discarded)
+ EbmlVoid * pVoid = static_cast<EbmlVoid *>(pAttachment2->FindFirstElt(EbmlVoid::ClassInfos, true));
+ if (pVoid == NULL)
+ return -1;
+ static_cast<EbmlBinary *>(pVoid)->SetBuffer((const binary*) Buffer1, countof(Buffer1));
+ pAttachment2->Render(Ebml_file);
#ifdef SKIP_ATTACHED
- KaxSegment SecondSegment;
- // size is unknown and will always be, we can render it right away
- SecondSegment.Render(Ebml_file);
+ KaxSegment SecondSegment;
+ // size is unknown and will always be, we can render it right away
+ SecondSegment.Render(Ebml_file);
#endif // SKIP_ATTACHED
- Ebml_file.close();
-
- ///// Reading test
- StdIOCallback Ebml_Wfile(RW_FILENAME, ::MODE_READ);
-
- // example 1 skip all the elements found
- EbmlStream aStream(Ebml_Wfile);
- EbmlElement * ElementLevel0;
- EbmlElement * ElementLevel1;
- EbmlElement * ElementLevel2;
- EbmlElement * ElementLevel3;
-
- // read the data until a possible element is found (valid ID + size combination)
- printf("Read EBML elements & skip data\n");
- // find the EBML head in the file
- ElementLevel0 = aStream.FindNextID(EbmlHead::ClassInfos, 0xFFFFFFFFL, false);
- if (ElementLevel0 != NULL)
- {
- printf("ID : ");
- for (unsigned int i=0; i<EbmlId(*ElementLevel0).Length; i++)
- {
- printf("[%02X]", EbmlId(*ElementLevel0).Value[i]);
- }
- printf("\n");
-
- ElementLevel0->SkipData(aStream, EbmlHead_Context);
- if (ElementLevel0 != NULL)
- delete ElementLevel0;
- }
-
- // example to read attachements in the file
- ElementLevel0 = aStream.FindNextID(KaxSegment::ClassInfos, 0xFFFFFFFFL, false);
- while (ElementLevel0 != NULL)
- {
- printf("ID : ");
- for (unsigned int i=0; i<EbmlId(*ElementLevel0).Length; i++)
- {
- printf("[%02X]", EbmlId(*ElementLevel0).Value[i]);
- }
- printf("\n");
-
- int bUpperElement = 0;
-
- ElementLevel1 = aStream.FindNextID(KaxSegment_Context, bUpperElement, 0xFFFFFFFFL, true);
-
- while (ElementLevel1 != NULL) {
- /// \todo switch the type of the element to check if it's one we want to handle, like attachements
- if (EbmlId(*ElementLevel1) == KaxAttachments::ClassInfos.GlobalId) {
- printf("Attachments detected\n");
-
- ElementLevel2 = aStream.FindNextID(KaxAttachments_Context, bUpperElement, 0xFFFFFFFFL, true);
- while (ElementLevel2 != NULL) {
- /// \todo switch the type of the element to check if it's one we want to handle, like attachements
- if (EbmlId(*ElementLevel2) == KaxAttached::ClassInfos.GlobalId) {
- printf("Attached file detected\n");
- }
+ Ebml_file.close();
+
+ ///// Reading test
+ StdIOCallback Ebml_Wfile(RW_FILENAME, ::MODE_READ);
+
+ // example 1 skip all the elements found
+ EbmlStream aStream(Ebml_Wfile);
+ EbmlElement * ElementLevel0;
+ EbmlElement * ElementLevel1;
+ EbmlElement * ElementLevel2;
+ EbmlElement * ElementLevel3;
+
+ // read the data until a possible element is found (valid ID + size combination)
+ printf("Read EBML elements & skip data\n");
+ // find the EBML head in the file
+ ElementLevel0 = aStream.FindNextID(EbmlHead::ClassInfos, 0xFFFFFFFFL, false);
+ if (ElementLevel0 != NULL)
+ {
+ printf("ID : ");
+ for (unsigned int i=0; i<EbmlId(*ElementLevel0).Length; i++)
+ {
+ printf("[%02X]", EbmlId(*ElementLevel0).Value[i]);
+ }
+ printf("\n");
+
+ ElementLevel0->SkipData(aStream, EbmlHead_Context);
+ if (ElementLevel0 != NULL)
+ delete ElementLevel0;
+ }
+
+ // example to read attachements in the file
+ ElementLevel0 = aStream.FindNextID(KaxSegment::ClassInfos, 0xFFFFFFFFL, false);
+ while (ElementLevel0 != NULL)
+ {
+ printf("ID : ");
+ for (unsigned int i=0; i<EbmlId(*ElementLevel0).Length; i++)
+ {
+ printf("[%02X]", EbmlId(*ElementLevel0).Value[i]);
+ }
+ printf("\n");
+
+ int bUpperElement = 0;
+
+ ElementLevel1 = aStream.FindNextID(KaxSegment_Context, bUpperElement, 0xFFFFFFFFL, true);
+
+ while (ElementLevel1 != NULL) {
+ /// \todo switch the type of the element to check if it's one we want to handle, like attachements
+ if (EbmlId(*ElementLevel1) == KaxAttachments::ClassInfos.GlobalId) {
+ printf("Attachments detected\n");
+
+ ElementLevel2 = aStream.FindNextID(KaxAttachments_Context, bUpperElement, 0xFFFFFFFFL, true);
+ while (ElementLevel2 != NULL) {
+ /// \todo switch the type of the element to check if it's one we want to handle, like attachements
+ if (EbmlId(*ElementLevel2) == KaxAttached::ClassInfos.GlobalId) {
+ printf("Attached file detected\n");
+ }
#ifdef SKIP_ATTACHED
- ElementLevel2 = ElementLevel2->SkipData(aStream, KaxAttached_Context);
- if (ElementLevel2 == NULL) {
- ElementLevel2 = aStream.FindNextID(KaxAttachments_Context, bUpperElement, 0xFFFFFFFFL, true);
-
- if (bUpperElement) {
- printf("Upper level1 element found\n");
- delete ElementLevel1;
- ElementLevel1 = ElementLevel2;
- ElementLevel2 = NULL;
- }
- }
+ ElementLevel2 = ElementLevel2->SkipData(aStream, KaxAttached_Context);
+ if (ElementLevel2 == NULL) {
+ ElementLevel2 = aStream.FindNextID(KaxAttachments_Context, bUpperElement, 0xFFFFFFFFL, true);
+
+ if (bUpperElement) {
+ printf("Upper level1 element found\n");
+ delete ElementLevel1;
+ ElementLevel1 = ElementLevel2;
+ ElementLevel2 = NULL;
+ }
+ }
#else // SKIP_ATTACHED
- // Display the filename (if it exists)
- ElementLevel3 = aStream.FindNextID(KaxAttached_Context, bUpperElement, 0xFFFFFFFFL, false);
- while (ElementLevel3 != NULL) {
- /// \todo switch the type of the element to check if it's one we want to handle, like attachements
- if (EbmlId(*ElementLevel3) == KaxFileName::ClassInfos.GlobalId) {
- KaxFileName & tmp = *static_cast<KaxFileName*>(ElementLevel3);
- tmp.ReadData(aStream.I_O());
- printf("File Name = %ls\n", UTFstring(tmp).c_str());
- } else {
- ElementLevel3->SkipData(aStream, KaxAttached_Context);
- }
- delete ElementLevel3;
- ElementLevel3 = aStream.FindNextID(KaxAttached_Context, bUpperElement, 0xFFFFFFFFL, false);
- if (bUpperElement)
- break;
- }
-
- if (bUpperElement) {
- delete ElementLevel2;
- ElementLevel2 = ElementLevel3;
- } else {
- ElementLevel2->SkipData(aStream, KaxAttached_Context);
- delete ElementLevel2;
-
- ElementLevel2 = aStream.FindNextID(KaxAttachments_Context, bUpperElement, 0xFFFFFFFFL, true);
- }
+ // Display the filename (if it exists)
+ ElementLevel3 = aStream.FindNextID(KaxAttached_Context, bUpperElement, 0xFFFFFFFFL, false);
+ while (ElementLevel3 != NULL) {
+ /// \todo switch the type of the element to check if it's one we want to handle, like attachements
+ if (EbmlId(*ElementLevel3) == KaxFileName::ClassInfos.GlobalId) {
+ KaxFileName & tmp = *static_cast<KaxFileName*>(ElementLevel3);
+ tmp.ReadData(aStream.I_O());
+ printf("File Name = %ls\n", UTFstring(tmp).c_str());
+ } else {
+ ElementLevel3->SkipData(aStream, KaxAttached_Context);
+ }
+ delete ElementLevel3;
+ ElementLevel3 = aStream.FindNextID(KaxAttached_Context, bUpperElement, 0xFFFFFFFFL, false);
+ if (bUpperElement)
+ break;
+ }
+
+ if (bUpperElement) {
+ delete ElementLevel2;
+ ElementLevel2 = ElementLevel3;
+ } else {
+ ElementLevel2->SkipData(aStream, KaxAttached_Context);
+ delete ElementLevel2;
+
+ ElementLevel2 = aStream.FindNextID(KaxAttachments_Context, bUpperElement, 0xFFFFFFFFL, true);
+ }
#endif // SKIP_ATTACHED
- }
- }
- ElementLevel1->SkipData(aStream, KaxAttachments_Context);
- delete ElementLevel1;
-
- ElementLevel1 = aStream.FindNextID(KaxSegment_Context, bUpperElement, 0xFFFFFFFFL, true);
- }
-
- ElementLevel0->SkipData(aStream, KaxSegment_Context);
- if (ElementLevel0 != NULL)
- delete ElementLevel0;
-
- ElementLevel0 = aStream.FindNextID(KaxSegment_Context, bUpperElement, 0xFFFFFFFFL, true);
- }
-
- Ebml_Wfile.close();
-
- return 0;
+ }
+ }
+ ElementLevel1->SkipData(aStream, KaxAttachments_Context);
+ delete ElementLevel1;
+
+ ElementLevel1 = aStream.FindNextID(KaxSegment_Context, bUpperElement, 0xFFFFFFFFL, true);
+ }
+
+ ElementLevel0->SkipData(aStream, KaxSegment_Context);
+ if (ElementLevel0 != NULL)
+ delete ElementLevel0;
+
+ ElementLevel0 = aStream.FindNextID(KaxSegment_Context, bUpperElement, 0xFFFFFFFFL, true);
+ }
+
+ Ebml_Wfile.close();
+
+ return 0;
}
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
unsigned int TXT_FILE_SIZE = 3000;
const unsigned int BIN_FRAME_SIZE = 1500;
const unsigned int TXT_FRAME_SIZE = 200;
-const uint64 TIMECODE_SCALE = 1000000;
+const uint64 TIMECODE_SCALE = 1000000;
const bool bWriteDefaultValues = false;
cout << "Creating \"muxed.mkv\"" << endl;
try {
- // write the head of the file (with everything already configured)
- StdIOCallback out_file("muxed.mkv", MODE_CREATE);
+ // write the head of the file (with everything already configured)
+ StdIOCallback out_file("muxed.mkv", MODE_CREATE);
+
+ ///// Writing EBML test
+ EbmlHead FileHead;
- ///// Writing EBML test
- EbmlHead FileHead;
+ EDocType & MyDocType = GetChild<EDocType>(FileHead);
+ *static_cast<EbmlString *>(&MyDocType) = "matroska";
- EDocType & MyDocType = GetChild<EDocType>(FileHead);
- *static_cast<EbmlString *>(&MyDocType) = "matroska";
+ EDocTypeVersion & MyDocTypeVer = GetChild<EDocTypeVersion>(FileHead);
+ *(static_cast<EbmlUInteger *>(&MyDocTypeVer)) = MATROSKA_VERSION;
- EDocTypeVersion & MyDocTypeVer = GetChild<EDocTypeVersion>(FileHead);
- *(static_cast<EbmlUInteger *>(&MyDocTypeVer)) = MATROSKA_VERSION;
+ EDocTypeReadVersion & MyDocTypeReadVer = GetChild<EDocTypeReadVersion>(FileHead);
+ *(static_cast<EbmlUInteger *>(&MyDocTypeReadVer)) = 1;
- EDocTypeReadVersion & MyDocTypeReadVer = GetChild<EDocTypeReadVersion>(FileHead);
- *(static_cast<EbmlUInteger *>(&MyDocTypeReadVer)) = 1;
+ FileHead.Render(out_file, bWriteDefaultValues);
- FileHead.Render(out_file, bWriteDefaultValues);
+ KaxSegment FileSegment;
- KaxSegment FileSegment;
+ // size is unknown and will always be, we can render it right away
+ uint64 SegmentSize = FileSegment.WriteHead(out_file, 5, bWriteDefaultValues);
- // size is unknown and will always be, we can render it right away
- uint64 SegmentSize = FileSegment.WriteHead(out_file, 5, bWriteDefaultValues);
-
- KaxTracks & MyTracks = GetChild<KaxTracks>(FileSegment);
+ KaxTracks & MyTracks = GetChild<KaxTracks>(FileSegment);
- // reserve some space for the Meta Seek writen at the end
- EbmlVoid Dummy;
- Dummy.SetSize(300); // 300 octets
- Dummy.Render(out_file, bWriteDefaultValues);
+ // reserve some space for the Meta Seek writen at the end
+ EbmlVoid Dummy;
+ Dummy.SetSize(300); // 300 octets
+ Dummy.Render(out_file, bWriteDefaultValues);
- KaxSeekHead MetaSeek;
+ KaxSeekHead MetaSeek;
- // fill the mandatory Info section
- KaxInfo & MyInfos = GetChild<KaxInfo>(FileSegment);
- KaxTimecodeScale & TimeScale = GetChild<KaxTimecodeScale>(MyInfos);
- *(static_cast<EbmlUInteger *>(&TimeScale)) = TIMECODE_SCALE;
+ // fill the mandatory Info section
+ KaxInfo & MyInfos = GetChild<KaxInfo>(FileSegment);
+ KaxTimecodeScale & TimeScale = GetChild<KaxTimecodeScale>(MyInfos);
+ *(static_cast<EbmlUInteger *>(&TimeScale)) = TIMECODE_SCALE;
- KaxDuration & SegDuration = GetChild<KaxDuration>(MyInfos);
- *(static_cast<EbmlFloat *>(&SegDuration)) = 0.0;
+ KaxDuration & SegDuration = GetChild<KaxDuration>(MyInfos);
+ *(static_cast<EbmlFloat *>(&SegDuration)) = 0.0;
- *((EbmlUnicodeString *)&GetChild<KaxMuxingApp>(MyInfos)) = L"libmatroska 0.5.0";
- *((EbmlUnicodeString *)&GetChild<KaxWritingApp>(MyInfos)) = L"éà ôï";
- GetChild<KaxWritingApp>(MyInfos).SetDefaultSize(25);
+ *((EbmlUnicodeString *)&GetChild<KaxMuxingApp>(MyInfos)) = L"libmatroska 0.5.0";
+ *((EbmlUnicodeString *)&GetChild<KaxWritingApp>(MyInfos)) = L"éà ôï";
+ GetChild<KaxWritingApp>(MyInfos).SetDefaultSize(25);
- filepos_t InfoSize = MyInfos.Render(out_file);
- MetaSeek.IndexThis(MyInfos, FileSegment);
+ filepos_t InfoSize = MyInfos.Render(out_file);
+ MetaSeek.IndexThis(MyInfos, FileSegment);
- // fill track 1 params
- KaxTrackEntry & MyTrack1 = GetChild<KaxTrackEntry>(MyTracks);
- MyTrack1.SetGlobalTimecodeScale(TIMECODE_SCALE);
+ // fill track 1 params
+ KaxTrackEntry & MyTrack1 = GetChild<KaxTrackEntry>(MyTracks);
+ MyTrack1.SetGlobalTimecodeScale(TIMECODE_SCALE);
- KaxTrackNumber & MyTrack1Number = GetChild<KaxTrackNumber>(MyTrack1);
- *(static_cast<EbmlUInteger *>(&MyTrack1Number)) = 1;
+ KaxTrackNumber & MyTrack1Number = GetChild<KaxTrackNumber>(MyTrack1);
+ *(static_cast<EbmlUInteger *>(&MyTrack1Number)) = 1;
- KaxTrackUID & MyTrack1UID = GetChild<KaxTrackUID>(MyTrack1);
- *(static_cast<EbmlUInteger *>(&MyTrack1UID)) = 7;
+ KaxTrackUID & MyTrack1UID = GetChild<KaxTrackUID>(MyTrack1);
+ *(static_cast<EbmlUInteger *>(&MyTrack1UID)) = 7;
- *(static_cast<EbmlUInteger *>(&GetChild<KaxTrackType>(MyTrack1))) = track_audio;
+ *(static_cast<EbmlUInteger *>(&GetChild<KaxTrackType>(MyTrack1))) = track_audio;
- KaxCodecID & MyTrack1CodecID = GetChild<KaxCodecID>(MyTrack1);
- *static_cast<EbmlString *>(&MyTrack1CodecID) = "Dummy Audio Codec";
+ KaxCodecID & MyTrack1CodecID = GetChild<KaxCodecID>(MyTrack1);
+ *static_cast<EbmlString *>(&MyTrack1CodecID) = "Dummy Audio Codec";
- MyTrack1.EnableLacing(true);
+ MyTrack1.EnableLacing(true);
- // Test the new ContentEncoding elements
- KaxContentEncodings &cencodings = GetChild<KaxContentEncodings>(MyTrack1);
- KaxContentEncoding &cencoding = GetChild<KaxContentEncoding>(cencodings);
- *(static_cast<EbmlUInteger *>(&GetChild<KaxContentEncodingOrder>(cencoding))) = 10;
- *(static_cast<EbmlUInteger *>(&GetChild<KaxContentEncodingScope>(cencoding))) = 11;
- *(static_cast<EbmlUInteger *>(&GetChild<KaxContentEncodingType>(cencoding))) = 12;
+ // Test the new ContentEncoding elements
+ KaxContentEncodings &cencodings = GetChild<KaxContentEncodings>(MyTrack1);
+ KaxContentEncoding &cencoding = GetChild<KaxContentEncoding>(cencodings);
+ *(static_cast<EbmlUInteger *>(&GetChild<KaxContentEncodingOrder>(cencoding))) = 10;
+ *(static_cast<EbmlUInteger *>(&GetChild<KaxContentEncodingScope>(cencoding))) = 11;
+ *(static_cast<EbmlUInteger *>(&GetChild<KaxContentEncodingType>(cencoding))) = 12;
- KaxContentCompression &ccompression = GetChild<KaxContentCompression>(cencoding);
- *(static_cast<EbmlUInteger *>(&GetChild<KaxContentCompAlgo>(ccompression))) = 13;
- GetChild<KaxContentCompSettings>(ccompression).CopyBuffer((const binary *)"hello1", 6);
+ KaxContentCompression &ccompression = GetChild<KaxContentCompression>(cencoding);
+ *(static_cast<EbmlUInteger *>(&GetChild<KaxContentCompAlgo>(ccompression))) = 13;
+ GetChild<KaxContentCompSettings>(ccompression).CopyBuffer((const binary *)"hello1", 6);
- KaxContentEncryption &cencryption = GetChild<KaxContentEncryption>(cencoding);
- *(static_cast<EbmlUInteger *>(&GetChild<KaxContentEncAlgo>(cencryption))) = 14;
- GetChild<KaxContentEncKeyID>(cencryption).CopyBuffer((const binary *)"hello2", 6);
- *(static_cast<EbmlUInteger *>(&GetChild<KaxContentSigAlgo>(cencryption))) = 15;
- *(static_cast<EbmlUInteger *>(&GetChild<KaxContentSigHashAlgo>(cencryption))) = 16;
- GetChild<KaxContentSigKeyID>(cencryption).CopyBuffer((const binary *)"hello3", 6);
- GetChild<KaxContentSignature>(cencryption).CopyBuffer((const binary *)"hello4", 6);
+ KaxContentEncryption &cencryption = GetChild<KaxContentEncryption>(cencoding);
+ *(static_cast<EbmlUInteger *>(&GetChild<KaxContentEncAlgo>(cencryption))) = 14;
+ GetChild<KaxContentEncKeyID>(cencryption).CopyBuffer((const binary *)"hello2", 6);
+ *(static_cast<EbmlUInteger *>(&GetChild<KaxContentSigAlgo>(cencryption))) = 15;
+ *(static_cast<EbmlUInteger *>(&GetChild<KaxContentSigHashAlgo>(cencryption))) = 16;
+ GetChild<KaxContentSigKeyID>(cencryption).CopyBuffer((const binary *)"hello3", 6);
+ GetChild<KaxContentSignature>(cencryption).CopyBuffer((const binary *)"hello4", 6);
- // audio specific params
- KaxTrackAudio & MyTrack1Audio = GetChild<KaxTrackAudio>(MyTrack1);
-
- KaxAudioSamplingFreq & MyTrack1Freq = GetChild<KaxAudioSamplingFreq>(MyTrack1Audio);
- *(static_cast<EbmlFloat *>(&MyTrack1Freq)) = 44100.0;
- MyTrack1Freq.ValidateSize();
+ // audio specific params
+ KaxTrackAudio & MyTrack1Audio = GetChild<KaxTrackAudio>(MyTrack1);
+
+ KaxAudioSamplingFreq & MyTrack1Freq = GetChild<KaxAudioSamplingFreq>(MyTrack1Audio);
+ *(static_cast<EbmlFloat *>(&MyTrack1Freq)) = 44100.0;
+ MyTrack1Freq.ValidateSize();
#if MATROSKA_VERSION >= 2
- KaxAudioPosition & MyTrack1Pos = GetChild<KaxAudioPosition>(MyTrack1Audio);
- binary *_Pos = new binary[5];
- _Pos[0] = '0';
- _Pos[1] = '1';
- _Pos[2] = '2';
- _Pos[3] = '3';
- _Pos[4] = '\0';
- MyTrack1Pos.SetBuffer(_Pos, 5);
+ KaxAudioPosition & MyTrack1Pos = GetChild<KaxAudioPosition>(MyTrack1Audio);
+ binary *_Pos = new binary[5];
+ _Pos[0] = '0';
+ _Pos[1] = '1';
+ _Pos[2] = '2';
+ _Pos[3] = '3';
+ _Pos[4] = '\0';
+ MyTrack1Pos.SetBuffer(_Pos, 5);
#endif // MATROSKA_VERSION
- KaxAudioChannels & MyTrack1Channels = GetChild<KaxAudioChannels>(MyTrack1Audio);
- *(static_cast<EbmlUInteger *>(&MyTrack1Channels)) = 2;
+ KaxAudioChannels & MyTrack1Channels = GetChild<KaxAudioChannels>(MyTrack1Audio);
+ *(static_cast<EbmlUInteger *>(&MyTrack1Channels)) = 2;
- // fill track 2 params
- KaxTrackEntry & MyTrack2 = GetNextChild<KaxTrackEntry>(MyTracks, MyTrack1);
- MyTrack2.SetGlobalTimecodeScale(TIMECODE_SCALE);
+ // fill track 2 params
+ KaxTrackEntry & MyTrack2 = GetNextChild<KaxTrackEntry>(MyTracks, MyTrack1);
+ MyTrack2.SetGlobalTimecodeScale(TIMECODE_SCALE);
- KaxTrackNumber & MyTrack2Number = GetChild<KaxTrackNumber>(MyTrack2);
- *(static_cast<EbmlUInteger *>(&MyTrack2Number)) = 200;
+ KaxTrackNumber & MyTrack2Number = GetChild<KaxTrackNumber>(MyTrack2);
+ *(static_cast<EbmlUInteger *>(&MyTrack2Number)) = 200;
- KaxTrackUID & MyTrack2UID = GetChild<KaxTrackUID>(MyTrack2);
- *(static_cast<EbmlUInteger *>(&MyTrack2UID)) = 13;
+ KaxTrackUID & MyTrack2UID = GetChild<KaxTrackUID>(MyTrack2);
+ *(static_cast<EbmlUInteger *>(&MyTrack2UID)) = 13;
- *(static_cast<EbmlUInteger *>(&GetChild<KaxTrackType>(MyTrack2))) = track_video;
+ *(static_cast<EbmlUInteger *>(&GetChild<KaxTrackType>(MyTrack2))) = track_video;
- KaxCodecID & MyTrack2CodecID = GetChild<KaxCodecID>(MyTrack2);
- *static_cast<EbmlString *>(&MyTrack2CodecID) = "Dummy Video Codec";
+ KaxCodecID & MyTrack2CodecID = GetChild<KaxCodecID>(MyTrack2);
+ *static_cast<EbmlString *>(&MyTrack2CodecID) = "Dummy Video Codec";
- MyTrack2.EnableLacing(false);
+ MyTrack2.EnableLacing(false);
- // video specific params
- KaxTrackVideo & MyTrack2Video = GetChild<KaxTrackVideo>(MyTrack2);
+ // video specific params
+ KaxTrackVideo & MyTrack2Video = GetChild<KaxTrackVideo>(MyTrack2);
- KaxVideoPixelHeight & MyTrack2PHeight = GetChild<KaxVideoPixelHeight>(MyTrack2Video);
- *(static_cast<EbmlUInteger *>(&MyTrack2PHeight)) = 200;
+ KaxVideoPixelHeight & MyTrack2PHeight = GetChild<KaxVideoPixelHeight>(MyTrack2Video);
+ *(static_cast<EbmlUInteger *>(&MyTrack2PHeight)) = 200;
- KaxVideoPixelWidth & MyTrack2PWidth = GetChild<KaxVideoPixelWidth>(MyTrack2Video);
- *(static_cast<EbmlUInteger *>(&MyTrack2PWidth)) = 320;
+ KaxVideoPixelWidth & MyTrack2PWidth = GetChild<KaxVideoPixelWidth>(MyTrack2Video);
+ *(static_cast<EbmlUInteger *>(&MyTrack2PWidth)) = 320;
- uint64 TrackSize = MyTracks.Render(out_file, bWriteDefaultValues);
+ uint64 TrackSize = MyTracks.Render(out_file, bWriteDefaultValues);
- KaxTracks * pMyTracks2 = static_cast<KaxTracks *>(MyTracks.Clone());
-// KaxTracks * pMyTracks2 = new KaxTracks(MyTracks);
+ KaxTracks * pMyTracks2 = static_cast<KaxTracks *>(MyTracks.Clone());
+// KaxTracks * pMyTracks2 = new KaxTracks(MyTracks);
- MetaSeek.IndexThis(MyTracks, FileSegment);
+ MetaSeek.IndexThis(MyTracks, FileSegment);
- // "manual" filling of a cluster"
- /// \todo whenever a BlockGroup is created, we should memorize it's position
- KaxCues AllCues;
- AllCues.SetGlobalTimecodeScale(TIMECODE_SCALE);
+ // "manual" filling of a cluster"
+ /// \todo whenever a BlockGroup is created, we should memorize it's position
+ KaxCues AllCues;
+ AllCues.SetGlobalTimecodeScale(TIMECODE_SCALE);
- KaxCluster Clust1;
- Clust1.SetParent(FileSegment); // mandatory to store references in this Cluster
- Clust1.SetPreviousTimecode(0, TIMECODE_SCALE); // the first timecode here
- Clust1.EnableChecksum();
+ KaxCluster Clust1;
+ Clust1.SetParent(FileSegment); // mandatory to store references in this Cluster
+ Clust1.SetPreviousTimecode(0, TIMECODE_SCALE); // the first timecode here
+ Clust1.EnableChecksum();
- // automatic filling of a Cluster
- // simple frame
- KaxBlockGroup *MyNewBlock, *MyLastBlockTrk1 = NULL, *MyLastBlockTrk2 = NULL, *MyNewBlock2;
- DataBuffer *data7 = new DataBuffer((binary *)"tototototo", countof("tototototo"));
- Clust1.AddFrame(MyTrack1, 250 * TIMECODE_SCALE, *data7, MyNewBlock, LACING_EBML);
- if (MyNewBlock != NULL)
- MyLastBlockTrk1 = MyNewBlock;
- DataBuffer *data0 = new DataBuffer((binary *)"TOTOTOTO", countof("TOTOTOTO"));
- Clust1.AddFrame(MyTrack1, 260 * TIMECODE_SCALE, *data0, MyNewBlock); // to test EBML lacing
- if (MyNewBlock != NULL)
- MyLastBlockTrk1 = MyNewBlock;
- DataBuffer *data6 = new DataBuffer((binary *)"tototototo", countof("tototototo"));
- Clust1.AddFrame(MyTrack1, 270 * TIMECODE_SCALE, *data6, MyNewBlock); // to test lacing
- if (MyNewBlock != NULL) {
- MyLastBlockTrk1 = MyNewBlock;
- } else {
- MyLastBlockTrk1->SetBlockDuration(50 * TIMECODE_SCALE);
- }
+ // automatic filling of a Cluster
+ // simple frame
+ KaxBlockGroup *MyNewBlock, *MyLastBlockTrk1 = NULL, *MyLastBlockTrk2 = NULL, *MyNewBlock2;
+ DataBuffer *data7 = new DataBuffer((binary *)"tototototo", countof("tototototo"));
+ Clust1.AddFrame(MyTrack1, 250 * TIMECODE_SCALE, *data7, MyNewBlock, LACING_EBML);
+ if (MyNewBlock != NULL)
+ MyLastBlockTrk1 = MyNewBlock;
+ DataBuffer *data0 = new DataBuffer((binary *)"TOTOTOTO", countof("TOTOTOTO"));
+ Clust1.AddFrame(MyTrack1, 260 * TIMECODE_SCALE, *data0, MyNewBlock); // to test EBML lacing
+ if (MyNewBlock != NULL)
+ MyLastBlockTrk1 = MyNewBlock;
+ DataBuffer *data6 = new DataBuffer((binary *)"tototototo", countof("tototototo"));
+ Clust1.AddFrame(MyTrack1, 270 * TIMECODE_SCALE, *data6, MyNewBlock); // to test lacing
+ if (MyNewBlock != NULL) {
+ MyLastBlockTrk1 = MyNewBlock;
+ } else {
+ MyLastBlockTrk1->SetBlockDuration(50 * TIMECODE_SCALE);
+ }
- DataBuffer *data5 = new DataBuffer((binary *)"tototototo", countof("tototototo"));
- Clust1.AddFrame(MyTrack2, 23 * TIMECODE_SCALE, *data5, MyNewBlock); // to test with another track
+ DataBuffer *data5 = new DataBuffer((binary *)"tototototo", countof("tototototo"));
+ Clust1.AddFrame(MyTrack2, 23 * TIMECODE_SCALE, *data5, MyNewBlock); // to test with another track
- // add the "real" block to the cue entries
+ // add the "real" block to the cue entries
KaxBlockBlob *Blob1 = new KaxBlockBlob(BLOCK_BLOB_NO_SIMPLE);
Blob1->SetBlockGroup(*MyLastBlockTrk1);
- AllCues.AddBlockBlob(*Blob1);
+ AllCues.AddBlockBlob(*Blob1);
- // frame for Track 2
- DataBuffer *data8 = new DataBuffer((binary *)"tttyyy", countof("tttyyy"));
- Clust1.AddFrame(MyTrack2, 107 * TIMECODE_SCALE, *data8, MyNewBlock, *MyLastBlockTrk2);
+ // frame for Track 2
+ DataBuffer *data8 = new DataBuffer((binary *)"tttyyy", countof("tttyyy"));
+ Clust1.AddFrame(MyTrack2, 107 * TIMECODE_SCALE, *data8, MyNewBlock, *MyLastBlockTrk2);
KaxBlockBlob *Blob2 = new KaxBlockBlob(BLOCK_BLOB_NO_SIMPLE);
Blob2->SetBlockGroup(*MyNewBlock);
- AllCues.AddBlockBlob(*Blob2);
-
- // frame with a past reference
- DataBuffer *data4 = new DataBuffer((binary *)"tttyyy", countof("tttyyy"));
- Clust1.AddFrame(MyTrack1, 300 * TIMECODE_SCALE, *data4, MyNewBlock, *MyLastBlockTrk1);
-
- // frame with a past & future reference
- if (MyNewBlock != NULL) {
- DataBuffer *data3 = new DataBuffer((binary *)"tttyyy", countof("tttyyy"));
- if (Clust1.AddFrame(MyTrack1, 280 * TIMECODE_SCALE, *data3, MyNewBlock2, *MyLastBlockTrk1, *MyNewBlock)) {
- MyNewBlock2->SetBlockDuration(20 * TIMECODE_SCALE);
- MyLastBlockTrk1 = MyNewBlock2;
- } else {
- printf("Error adding a frame !!!");
- }
- }
+ AllCues.AddBlockBlob(*Blob2);
+
+ // frame with a past reference
+ DataBuffer *data4 = new DataBuffer((binary *)"tttyyy", countof("tttyyy"));
+ Clust1.AddFrame(MyTrack1, 300 * TIMECODE_SCALE, *data4, MyNewBlock, *MyLastBlockTrk1);
+
+ // frame with a past & future reference
+ if (MyNewBlock != NULL) {
+ DataBuffer *data3 = new DataBuffer((binary *)"tttyyy", countof("tttyyy"));
+ if (Clust1.AddFrame(MyTrack1, 280 * TIMECODE_SCALE, *data3, MyNewBlock2, *MyLastBlockTrk1, *MyNewBlock)) {
+ MyNewBlock2->SetBlockDuration(20 * TIMECODE_SCALE);
+ MyLastBlockTrk1 = MyNewBlock2;
+ } else {
+ printf("Error adding a frame !!!");
+ }
+ }
KaxBlockBlob *Blob3 = new KaxBlockBlob(BLOCK_BLOB_NO_SIMPLE);
Blob3->SetBlockGroup(*MyLastBlockTrk1);
- AllCues.AddBlockBlob(*Blob3);
- //AllCues.UpdateSize();
-
- // simulate the writing of the stream :
- // - write an empty element with enough size for the cue entry
- // - write the cluster(s)
- // - seek back in the file and write the cue entry over the empty element
-
- uint64 ClusterSize = Clust1.Render(out_file, AllCues, bWriteDefaultValues);
- Clust1.ReleaseFrames();
- MetaSeek.IndexThis(Clust1, FileSegment);
-
- KaxCluster Clust2;
- Clust2.SetParent(FileSegment); // mandatory to store references in this Cluster
- Clust2.SetPreviousTimecode(300 * TIMECODE_SCALE, TIMECODE_SCALE); // the first timecode here
- Clust2.EnableChecksum();
-
- DataBuffer *data2 = new DataBuffer((binary *)"tttyyy", countof("tttyyy"));
- Clust2.AddFrame(MyTrack1, 350 * TIMECODE_SCALE, *data2, MyNewBlock, *MyLastBlockTrk1);
-
+ AllCues.AddBlockBlob(*Blob3);
+ //AllCues.UpdateSize();
+
+ // simulate the writing of the stream :
+ // - write an empty element with enough size for the cue entry
+ // - write the cluster(s)
+ // - seek back in the file and write the cue entry over the empty element
+
+ uint64 ClusterSize = Clust1.Render(out_file, AllCues, bWriteDefaultValues);
+ Clust1.ReleaseFrames();
+ MetaSeek.IndexThis(Clust1, FileSegment);
+
+ KaxCluster Clust2;
+ Clust2.SetParent(FileSegment); // mandatory to store references in this Cluster
+ Clust2.SetPreviousTimecode(300 * TIMECODE_SCALE, TIMECODE_SCALE); // the first timecode here
+ Clust2.EnableChecksum();
+
+ DataBuffer *data2 = new DataBuffer((binary *)"tttyyy", countof("tttyyy"));
+ Clust2.AddFrame(MyTrack1, 350 * TIMECODE_SCALE, *data2, MyNewBlock, *MyLastBlockTrk1);
+
KaxBlockBlob *Blob4 = new KaxBlockBlob(BLOCK_BLOB_NO_SIMPLE);
Blob4->SetBlockGroup(*MyNewBlock);
- AllCues.AddBlockBlob(*Blob4);
+ AllCues.AddBlockBlob(*Blob4);
- ClusterSize += Clust2.Render(out_file, AllCues, bWriteDefaultValues);
- Clust2.ReleaseFrames();
+ ClusterSize += Clust2.Render(out_file, AllCues, bWriteDefaultValues);
+ Clust2.ReleaseFrames();
-// older version, write at the end AllCues.Render(out_file);
- filepos_t CueSize = AllCues.Render(out_file, bWriteDefaultValues);
- MetaSeek.IndexThis(AllCues, FileSegment);
+// older version, write at the end AllCues.Render(out_file);
+ filepos_t CueSize = AllCues.Render(out_file, bWriteDefaultValues);
+ MetaSeek.IndexThis(AllCues, FileSegment);
- // Chapters
- KaxChapters Chapters;
- Chapters.EnableChecksum();
- KaxEditionEntry & aEdition = GetChild<KaxEditionEntry>(Chapters);
- KaxChapterAtom & aAtom = GetChild<KaxChapterAtom>(aEdition);
- KaxChapterUID & aUID = GetChild<KaxChapterUID>(aAtom);
- *static_cast<EbmlUInteger *>(&aUID) = 0x67890;
+ // Chapters
+ KaxChapters Chapters;
+ Chapters.EnableChecksum();
+ KaxEditionEntry & aEdition = GetChild<KaxEditionEntry>(Chapters);
+ KaxChapterAtom & aAtom = GetChild<KaxChapterAtom>(aEdition);
+ KaxChapterUID & aUID = GetChild<KaxChapterUID>(aAtom);
+ *static_cast<EbmlUInteger *>(&aUID) = 0x67890;
- KaxChapterTimeStart & aChapStart = GetChild<KaxChapterTimeStart>(aAtom);
- *static_cast<EbmlUInteger *>(&aChapStart) = 0;
+ KaxChapterTimeStart & aChapStart = GetChild<KaxChapterTimeStart>(aAtom);
+ *static_cast<EbmlUInteger *>(&aChapStart) = 0;
- KaxChapterTimeEnd & aChapEnd = GetChild<KaxChapterTimeEnd>(aAtom);
- *static_cast<EbmlUInteger *>(&aChapEnd) = 300 * TIMECODE_SCALE;
+ KaxChapterTimeEnd & aChapEnd = GetChild<KaxChapterTimeEnd>(aAtom);
+ *static_cast<EbmlUInteger *>(&aChapEnd) = 300 * TIMECODE_SCALE;
- KaxChapterDisplay & aDisplay = GetChild<KaxChapterDisplay>(aAtom);
- KaxChapterString & aChapString = GetChild<KaxChapterString>(aDisplay);
- *static_cast<EbmlUnicodeString *>(&aChapString) = L"Le film réduit à un chapitre";
+ KaxChapterDisplay & aDisplay = GetChild<KaxChapterDisplay>(aAtom);
+ KaxChapterString & aChapString = GetChild<KaxChapterString>(aDisplay);
+ *static_cast<EbmlUnicodeString *>(&aChapString) = L"Le film réduit à un chapitre";
- KaxChapterLanguage & aChapLang = GetChild<KaxChapterLanguage>(aDisplay);
- *static_cast<EbmlString *>(&aChapLang) = "fra";
+ KaxChapterLanguage & aChapLang = GetChild<KaxChapterLanguage>(aDisplay);
+ *static_cast<EbmlString *>(&aChapLang) = "fra";
- KaxChapterDisplay & aDisplay2 = GetNextChild<KaxChapterDisplay>(aAtom, aDisplay);
- KaxChapterString & aChapString2 = GetChild<KaxChapterString>(aDisplay2);
- *static_cast<EbmlUnicodeString *>(&aChapString2) = L"The movie in one chapter";
+ KaxChapterDisplay & aDisplay2 = GetNextChild<KaxChapterDisplay>(aAtom, aDisplay);
+ KaxChapterString & aChapString2 = GetChild<KaxChapterString>(aDisplay2);
+ *static_cast<EbmlUnicodeString *>(&aChapString2) = L"The movie in one chapter";
- KaxChapterLanguage & aChapLang2 = GetChild<KaxChapterLanguage>(aDisplay2);
- *static_cast<EbmlString *>(&aChapLang2) = "eng";
+ KaxChapterLanguage & aChapLang2 = GetChild<KaxChapterLanguage>(aDisplay2);
+ *static_cast<EbmlString *>(&aChapLang2) = "eng";
- filepos_t ChapterSize = Chapters.Render(out_file, bWriteDefaultValues);
- MetaSeek.IndexThis(Chapters, FileSegment);
+ filepos_t ChapterSize = Chapters.Render(out_file, bWriteDefaultValues);
+ MetaSeek.IndexThis(Chapters, FileSegment);
- // Write some tags
- KaxTags AllTags;
- AllTags.EnableChecksum();
- KaxTag & aTag = GetChild<KaxTag>(AllTags);
- KaxTagTargets & Targets = GetChild<KaxTagTargets>(aTag);
- KaxTagSimple & TagSimple = GetChild<KaxTagSimple>(aTag);
+ // Write some tags
+ KaxTags AllTags;
+ AllTags.EnableChecksum();
+ KaxTag & aTag = GetChild<KaxTag>(AllTags);
+ KaxTagTargets & Targets = GetChild<KaxTagTargets>(aTag);
+ KaxTagSimple & TagSimple = GetChild<KaxTagSimple>(aTag);
- KaxTagTrackUID & TrackUID = GetChild<KaxTagTrackUID>(Targets);
- *static_cast<EbmlUInteger *>(&TrackUID) = 0x12345;
+ KaxTagTrackUID & TrackUID = GetChild<KaxTagTrackUID>(Targets);
+ *static_cast<EbmlUInteger *>(&TrackUID) = 0x12345;
- KaxTagChapterUID & ChapterUID = GetChild<KaxTagChapterUID>(Targets);
- *static_cast<EbmlUInteger *>(&ChapterUID) = 0x67890;
+ KaxTagChapterUID & ChapterUID = GetChild<KaxTagChapterUID>(Targets);
+ *static_cast<EbmlUInteger *>(&ChapterUID) = 0x67890;
KaxTagName & aTagName = GetChild<KaxTagName>(TagSimple);
*static_cast<EbmlUnicodeString *>(&aTagName) = L"NAME";
KaxTagString & aTagtring = GetChild<KaxTagString>(TagSimple);
*static_cast<EbmlUnicodeString *>(&aTagtring) = L"Testé123";
- filepos_t TagsSize = AllTags.Render(out_file, bWriteDefaultValues);
- MetaSeek.IndexThis(AllTags, FileSegment);
+ filepos_t TagsSize = AllTags.Render(out_file, bWriteDefaultValues);
+ MetaSeek.IndexThis(AllTags, FileSegment);
- TrackSize += pMyTracks2->Render(out_file, bWriteDefaultValues);
- MetaSeek.IndexThis(*pMyTracks2, FileSegment);
+ TrackSize += pMyTracks2->Render(out_file, bWriteDefaultValues);
+ MetaSeek.IndexThis(*pMyTracks2, FileSegment);
- // \todo put it just before the Cue Entries
- filepos_t MetaSeekSize = Dummy.ReplaceWith(MetaSeek, out_file, bWriteDefaultValues);
+ // \todo put it just before the Cue Entries
+ filepos_t MetaSeekSize = Dummy.ReplaceWith(MetaSeek, out_file, bWriteDefaultValues);
#ifdef VOID_TEST
- MyInfos.VoidMe(out_file);
+ MyInfos.VoidMe(out_file);
#endif // VOID_TEST
- // let's assume we know the size of the Segment element
- // the size of the FileSegment is also computed because mandatory elements we don't write ourself exist
- if (FileSegment.ForceSize(SegmentSize - FileSegment.HeadSize() + MetaSeekSize
- + TrackSize + ClusterSize + CueSize + InfoSize + TagsSize + ChapterSize)) {
- FileSegment.OverwriteHead(out_file);
- }
+ // let's assume we know the size of the Segment element
+ // the size of the FileSegment is also computed because mandatory elements we don't write ourself exist
+ if (FileSegment.ForceSize(SegmentSize - FileSegment.HeadSize() + MetaSeekSize
+ + TrackSize + ClusterSize + CueSize + InfoSize + TagsSize + ChapterSize)) {
+ FileSegment.OverwriteHead(out_file);
+ }
#if 0
- delete[] buf_bin;
- delete[] buf_txt;
+ delete[] buf_bin;
+ delete[] buf_txt;
#endif // 0
#ifdef OLD
- MuxedFile.Close(1000); // 1000 ms
+ MuxedFile.Close(1000); // 1000 ms
#endif // OLD
- out_file.close();
+ out_file.close();
delete Blob1;
delete Blob2;
}
catch (exception & Ex)
{
- cout << Ex.what() << endl;
+ cout << Ex.what() << endl;
}
return 0;
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
/*!
\note you can generate the file used in this example using test6.cpp
- \todo the blocks with "titi" and "tetetete" don't seem to be read !
+ \todo the blocks with "titi" and "tetetete" don't seem to be read !
*/
int main(int argc, char **argv)
{
try {
- StdIOCallback Cluster_file((argc>=2 ? argv[1] : "muxed.mkv"), MODE_READ);
-
- // create the Matroska file
-/// FileKax MuxedFile(Cluster_file);
-// bool bAllowDummy = false; // don't read elements we don't know
- bool bAllowDummy = true; // even read elements we don't know (needed for CRC checking)
-
- // read the EBML head
- EbmlStream aStream(Cluster_file);
- EbmlElement * ElementLevel0;
- EbmlElement * ElementLevel1;
- EbmlElement * ElementLevel2;
- EbmlElement * ElementLevel3 = NULL;
- EbmlElement * ElementLevel4 = NULL;
-
-/// MuxedFile.ReadHead();
- // find the EBML head in the file
- ElementLevel0 = aStream.FindNextID(EbmlHead::ClassInfos, 0xFFFFFFFFL);
- if (ElementLevel0 != NULL)
- {
- printf("EBML : ");
- for (unsigned int i=0; i<EbmlId(*ElementLevel0).Length; i++)
- {
- printf("[%02X]", (EbmlId(*ElementLevel0).Value >> (8*(3-i))) & 0xFF);
- }
- printf("\n");
-
- ElementLevel0->SkipData(aStream, EbmlHead_Context);
- if (ElementLevel0 != NULL)
- delete ElementLevel0;
- }
-
- int UpperElementLevel = 0;
- KaxSegment * Segment;
- KaxInfo * SegmentInfo;
- KaxTrackEntry * TrackAudio;
- KaxTrackEntry * TrackVideo;
- KaxCluster *SegmentCluster;
- KaxCues *CuesEntry;
- KaxSeekHead *MetaSeek;
- KaxChapters *Chapters;
- KaxTags *AllTags;
- uint64 TimecodeScale = 1000000;
-
- // find the segment to read
- ElementLevel0 = aStream.FindNextID(KaxSegment::ClassInfos, 0xFFFFFFFFL);
- if (ElementLevel0 != NULL)
- {
- if (EbmlId(*ElementLevel0) == KaxSegment::ClassInfos.GlobalId) {
- Segment = static_cast<KaxSegment*>(ElementLevel0);
-// MuxedFile.ReadTracks();
-// MuxedFile.ReadCodec();
- // scan the file for a Tracks element (all previous Level1 elements are discarded)
- ElementLevel1 = aStream.FindNextElement(ElementLevel0->Generic().Context, UpperElementLevel, 0, bAllowDummy);
-
- while (ElementLevel1 != NULL) {
- if (UpperElementLevel > 0) {
- break;
- }
- if (UpperElementLevel < 0) {
- UpperElementLevel = 0;
- }
-
- /// \todo switch the type of the element to check if it's one we want to handle, like attachements
- if (EbmlId(*ElementLevel1) == EbmlVoid::ClassInfos.GlobalId) {
- printf("\n- Void found\n");
- } else if (EbmlId(*ElementLevel1) == KaxTracks::ClassInfos.GlobalId) {
- // found the Tracks element
- printf("\n- Segment Tracks found\n");
- // handle the data in Tracks here.
- // poll for new tracks and handle them
- ElementLevel2 = aStream.FindNextElement(ElementLevel1->Generic().Context, UpperElementLevel, 0, bAllowDummy);
-
- while (ElementLevel2 != NULL) {
- if (UpperElementLevel > 0) {
- break;
- }
- if (UpperElementLevel < 0) {
- UpperElementLevel = 0;
- }
- /// \todo switch the type of the element to check if it's one we want to handle, like attachements
- if (EbmlId(*ElementLevel2) == KaxTrackEntry::ClassInfos.GlobalId) {
- printf("* Found a track\n");
-
- ElementLevel3 = aStream.FindNextElement(ElementLevel2->Generic().Context, UpperElementLevel, 0, bAllowDummy);
- while (ElementLevel3 != NULL) {
- if (UpperElementLevel > 0) {
- break;
- }
- if (UpperElementLevel < 0) {
- UpperElementLevel = 0;
- }
- // read the data we care about in a track
- // Track number
- if (EbmlId(*ElementLevel3) == KaxTrackNumber::ClassInfos.GlobalId) {
- KaxTrackNumber & TrackNum = *static_cast<KaxTrackNumber*>(ElementLevel3);
- TrackNum.ReadData(aStream.I_O());
- printf("Track # %d\n", uint8(TrackNum));
- }
-
- // Track type
- else if (EbmlId(*ElementLevel3) == KaxTrackType::ClassInfos.GlobalId) {
- KaxTrackType & TrackType = *static_cast<KaxTrackType*>(ElementLevel3);
- TrackType.ReadData(aStream.I_O());
- printf("Track type : ");
- switch(uint8(TrackType))
- {
- case track_audio:
- printf("Audio");
- TrackAudio = static_cast<KaxTrackEntry *>(ElementLevel2);
- TrackAudio->SetGlobalTimecodeScale(TimecodeScale);
- break;
- case track_video:
- printf("Video");
- TrackVideo = static_cast<KaxTrackEntry *>(ElementLevel2);
- TrackVideo->SetGlobalTimecodeScale(TimecodeScale);
- break;
- default:
- printf("unknown");
- }
- printf("\n");
- }
-
- else if (EbmlId(*ElementLevel3) == KaxTrackFlagLacing::ClassInfos.GlobalId) {
- printf("Flag Lacing\n");
- }
- else if (EbmlId(*ElementLevel3) == KaxCodecID::ClassInfos.GlobalId) {
- KaxCodecID & CodecID = *static_cast<KaxCodecID*>(ElementLevel3);
- CodecID.ReadData(aStream.I_O());
- printf("Codec ID : %s\n", string(CodecID).c_str());
- }
-
- if (UpperElementLevel > 0) {
- assert(0 == 1); // impossible to be here ?
- UpperElementLevel--;
- delete ElementLevel2;
- ElementLevel2 = ElementLevel3;
- if (UpperElementLevel > 0)
- break;
- } else {
- ElementLevel3->SkipData(aStream, ElementLevel3->Generic().Context);
- delete ElementLevel3;
-
- ElementLevel3 = aStream.FindNextElement(ElementLevel2->Generic().Context, UpperElementLevel, 0, bAllowDummy);
- }
- }
- }
- if (UpperElementLevel > 0) {
- UpperElementLevel--;
- delete ElementLevel2;
- ElementLevel2 = ElementLevel3;
- if (UpperElementLevel > 0)
- break;
- } else {
- ElementLevel2->SkipData(aStream, ElementLevel2->Generic().Context);
- delete ElementLevel2;
-
- ElementLevel2 = aStream.FindNextElement(ElementLevel1->Generic().Context, UpperElementLevel, 0, bAllowDummy);
- }
- }
- }
-
- else if (EbmlId(*ElementLevel1) == KaxInfo::ClassInfos.GlobalId) {
- printf("\n- Segment Informations found\n");
- SegmentInfo = static_cast<KaxInfo *>(ElementLevel1);
+ StdIOCallback Cluster_file((argc>=2 ? argv[1] : "muxed.mkv"), MODE_READ);
+
+ // create the Matroska file
+/// FileKax MuxedFile(Cluster_file);
+// bool bAllowDummy = false; // don't read elements we don't know
+ bool bAllowDummy = true; // even read elements we don't know (needed for CRC checking)
+
+ // read the EBML head
+ EbmlStream aStream(Cluster_file);
+ EbmlElement * ElementLevel0;
+ EbmlElement * ElementLevel1;
+ EbmlElement * ElementLevel2;
+ EbmlElement * ElementLevel3 = NULL;
+ EbmlElement * ElementLevel4 = NULL;
+
+/// MuxedFile.ReadHead();
+ // find the EBML head in the file
+ ElementLevel0 = aStream.FindNextID(EbmlHead::ClassInfos, 0xFFFFFFFFL);
+ if (ElementLevel0 != NULL)
+ {
+ printf("EBML : ");
+ for (unsigned int i=0; i<EbmlId(*ElementLevel0).Length; i++)
+ {
+ printf("[%02X]", (EbmlId(*ElementLevel0).Value >> (8*(3-i))) & 0xFF);
+ }
+ printf("\n");
+
+ ElementLevel0->SkipData(aStream, EbmlHead_Context);
+ if (ElementLevel0 != NULL)
+ delete ElementLevel0;
+ }
+
+ int UpperElementLevel = 0;
+ KaxSegment * Segment;
+ KaxInfo * SegmentInfo;
+ KaxTrackEntry * TrackAudio;
+ KaxTrackEntry * TrackVideo;
+ KaxCluster *SegmentCluster;
+ KaxCues *CuesEntry;
+ KaxSeekHead *MetaSeek;
+ KaxChapters *Chapters;
+ KaxTags *AllTags;
+ uint64 TimecodeScale = 1000000;
+
+ // find the segment to read
+ ElementLevel0 = aStream.FindNextID(KaxSegment::ClassInfos, 0xFFFFFFFFL);
+ if (ElementLevel0 != NULL)
+ {
+ if (EbmlId(*ElementLevel0) == KaxSegment::ClassInfos.GlobalId) {
+ Segment = static_cast<KaxSegment*>(ElementLevel0);
+// MuxedFile.ReadTracks();
+// MuxedFile.ReadCodec();
+ // scan the file for a Tracks element (all previous Level1 elements are discarded)
+ ElementLevel1 = aStream.FindNextElement(ElementLevel0->Generic().Context, UpperElementLevel, 0, bAllowDummy);
+
+ while (ElementLevel1 != NULL) {
+ if (UpperElementLevel > 0) {
+ break;
+ }
+ if (UpperElementLevel < 0) {
+ UpperElementLevel = 0;
+ }
+
+ /// \todo switch the type of the element to check if it's one we want to handle, like attachements
+ if (EbmlId(*ElementLevel1) == EbmlVoid::ClassInfos.GlobalId) {
+ printf("\n- Void found\n");
+ } else if (EbmlId(*ElementLevel1) == KaxTracks::ClassInfos.GlobalId) {
+ // found the Tracks element
+ printf("\n- Segment Tracks found\n");
+ // handle the data in Tracks here.
+ // poll for new tracks and handle them
+ ElementLevel2 = aStream.FindNextElement(ElementLevel1->Generic().Context, UpperElementLevel, 0, bAllowDummy);
+
+ while (ElementLevel2 != NULL) {
+ if (UpperElementLevel > 0) {
+ break;
+ }
+ if (UpperElementLevel < 0) {
+ UpperElementLevel = 0;
+ }
+ /// \todo switch the type of the element to check if it's one we want to handle, like attachements
+ if (EbmlId(*ElementLevel2) == KaxTrackEntry::ClassInfos.GlobalId) {
+ printf("* Found a track\n");
+
+ ElementLevel3 = aStream.FindNextElement(ElementLevel2->Generic().Context, UpperElementLevel, 0, bAllowDummy);
+ while (ElementLevel3 != NULL) {
+ if (UpperElementLevel > 0) {
+ break;
+ }
+ if (UpperElementLevel < 0) {
+ UpperElementLevel = 0;
+ }
+ // read the data we care about in a track
+ // Track number
+ if (EbmlId(*ElementLevel3) == KaxTrackNumber::ClassInfos.GlobalId) {
+ KaxTrackNumber & TrackNum = *static_cast<KaxTrackNumber*>(ElementLevel3);
+ TrackNum.ReadData(aStream.I_O());
+ printf("Track # %d\n", uint8(TrackNum));
+ }
+
+ // Track type
+ else if (EbmlId(*ElementLevel3) == KaxTrackType::ClassInfos.GlobalId) {
+ KaxTrackType & TrackType = *static_cast<KaxTrackType*>(ElementLevel3);
+ TrackType.ReadData(aStream.I_O());
+ printf("Track type : ");
+ switch(uint8(TrackType))
+ {
+ case track_audio:
+ printf("Audio");
+ TrackAudio = static_cast<KaxTrackEntry *>(ElementLevel2);
+ TrackAudio->SetGlobalTimecodeScale(TimecodeScale);
+ break;
+ case track_video:
+ printf("Video");
+ TrackVideo = static_cast<KaxTrackEntry *>(ElementLevel2);
+ TrackVideo->SetGlobalTimecodeScale(TimecodeScale);
+ break;
+ default:
+ printf("unknown");
+ }
+ printf("\n");
+ }
+
+ else if (EbmlId(*ElementLevel3) == KaxTrackFlagLacing::ClassInfos.GlobalId) {
+ printf("Flag Lacing\n");
+ }
+ else if (EbmlId(*ElementLevel3) == KaxCodecID::ClassInfos.GlobalId) {
+ KaxCodecID & CodecID = *static_cast<KaxCodecID*>(ElementLevel3);
+ CodecID.ReadData(aStream.I_O());
+ printf("Codec ID : %s\n", string(CodecID).c_str());
+ }
+
+ if (UpperElementLevel > 0) {
+ assert(0 == 1); // impossible to be here ?
+ UpperElementLevel--;
+ delete ElementLevel2;
+ ElementLevel2 = ElementLevel3;
+ if (UpperElementLevel > 0)
+ break;
+ } else {
+ ElementLevel3->SkipData(aStream, ElementLevel3->Generic().Context);
+ delete ElementLevel3;
+
+ ElementLevel3 = aStream.FindNextElement(ElementLevel2->Generic().Context, UpperElementLevel, 0, bAllowDummy);
+ }
+ }
+ }
+ if (UpperElementLevel > 0) {
+ UpperElementLevel--;
+ delete ElementLevel2;
+ ElementLevel2 = ElementLevel3;
+ if (UpperElementLevel > 0)
+ break;
+ } else {
+ ElementLevel2->SkipData(aStream, ElementLevel2->Generic().Context);
+ delete ElementLevel2;
+
+ ElementLevel2 = aStream.FindNextElement(ElementLevel1->Generic().Context, UpperElementLevel, 0, bAllowDummy);
+ }
+ }
+ }
+
+ else if (EbmlId(*ElementLevel1) == KaxInfo::ClassInfos.GlobalId) {
+ printf("\n- Segment Informations found\n");
+ SegmentInfo = static_cast<KaxInfo *>(ElementLevel1);
#ifdef JUMP_TEST
- // test jumping to a random location and find the next Level 0 / Level 1 element
- aStream.I_O().setFilePointer(79, seek_current);
- printf("Seeked at position 0x%X in the file", aStream.I_O().getFilePointer());
- int LowLevel = 1;
- ElementLevel2 = aStream.FindNextElement(KaxSegment::ClassInfos.Context, LowLevel, 0, false); // search up to one level lower
- UpperElementLevel = LowLevel;
+ // test jumping to a random location and find the next Level 0 / Level 1 element
+ aStream.I_O().setFilePointer(79, seek_current);
+ printf("Seeked at position 0x%X in the file", aStream.I_O().getFilePointer());
+ int LowLevel = 1;
+ ElementLevel2 = aStream.FindNextElement(KaxSegment::ClassInfos.Context, LowLevel, 0, false); // search up to one level lower
+ UpperElementLevel = LowLevel;
#else // JUMP_TEST
- // read the data we care about in matroska
- /// \todo There should be a way to get the default values of the elements not defined
- ElementLevel2 = aStream.FindNextElement(ElementLevel1->Generic().Context, UpperElementLevel, 0, bAllowDummy);
- while (ElementLevel2 != NULL) {
- if (UpperElementLevel > 0) {
- break;
- }
- if (UpperElementLevel < 0) {
- UpperElementLevel = 0;
- }
- if (EbmlId(*ElementLevel2) == KaxTimecodeScale::ClassInfos.GlobalId) {
- KaxTimecodeScale *TimeScale = static_cast<KaxTimecodeScale*>(ElementLevel2);
- TimeScale->ReadData(aStream.I_O());
- printf("Timecode Scale %d\n", uint32(*TimeScale));
- TimecodeScale = uint64(*TimeScale);
- } else if (EbmlId(*ElementLevel2) == KaxDuration::ClassInfos.GlobalId) {
- printf("Segment duration\n");
- } else if (EbmlId(*ElementLevel2) == KaxDateUTC::ClassInfos.GlobalId) {
- printf("Date UTC\n");
- } else if (EbmlId(*ElementLevel2) == KaxTitle::ClassInfos.GlobalId) {
- printf("Title\n");
- } else if (EbmlId(*ElementLevel2) == KaxMuxingApp::ClassInfos.GlobalId) {
- KaxMuxingApp *pApp = static_cast<KaxMuxingApp*>(ElementLevel2);
- pApp->ReadData(aStream.I_O());
+ // read the data we care about in matroska
+ /// \todo There should be a way to get the default values of the elements not defined
+ ElementLevel2 = aStream.FindNextElement(ElementLevel1->Generic().Context, UpperElementLevel, 0, bAllowDummy);
+ while (ElementLevel2 != NULL) {
+ if (UpperElementLevel > 0) {
+ break;
+ }
+ if (UpperElementLevel < 0) {
+ UpperElementLevel = 0;
+ }
+ if (EbmlId(*ElementLevel2) == KaxTimecodeScale::ClassInfos.GlobalId) {
+ KaxTimecodeScale *TimeScale = static_cast<KaxTimecodeScale*>(ElementLevel2);
+ TimeScale->ReadData(aStream.I_O());
+ printf("Timecode Scale %d\n", uint32(*TimeScale));
+ TimecodeScale = uint64(*TimeScale);
+ } else if (EbmlId(*ElementLevel2) == KaxDuration::ClassInfos.GlobalId) {
+ printf("Segment duration\n");
+ } else if (EbmlId(*ElementLevel2) == KaxDateUTC::ClassInfos.GlobalId) {
+ printf("Date UTC\n");
+ } else if (EbmlId(*ElementLevel2) == KaxTitle::ClassInfos.GlobalId) {
+ printf("Title\n");
+ } else if (EbmlId(*ElementLevel2) == KaxMuxingApp::ClassInfos.GlobalId) {
+ KaxMuxingApp *pApp = static_cast<KaxMuxingApp*>(ElementLevel2);
+ pApp->ReadData(aStream.I_O());
#if !defined(__CYGWIN__) && !defined(__APPLE__) && !defined(__BEOS__) && !defined(__NetBSD__)
- wprintf(L"Muxing App : %ls\n", UTFstring(*pApp).c_str());
+ wprintf(L"Muxing App : %ls\n", UTFstring(*pApp).c_str());
#else
- printf("Muxing App : %s\n", UTFstring(*pApp).c_str());
+ printf("Muxing App : %s\n", UTFstring(*pApp).c_str());
#endif
- } else if (EbmlId(*ElementLevel2) == KaxWritingApp::ClassInfos.GlobalId) {
- KaxWritingApp *pApp = static_cast<KaxWritingApp*>(ElementLevel2);
- pApp->ReadData(aStream.I_O());
+ } else if (EbmlId(*ElementLevel2) == KaxWritingApp::ClassInfos.GlobalId) {
+ KaxWritingApp *pApp = static_cast<KaxWritingApp*>(ElementLevel2);
+ pApp->ReadData(aStream.I_O());
#if !defined(__CYGWIN__) && !defined(__APPLE__) && !defined(__BEOS__) && !defined(__NetBSD__)
- wprintf(L"Writing App : %ls (éà ôï)\n", UTFstring(*pApp).c_str());
+ wprintf(L"Writing App : %ls (éà ôï)\n", UTFstring(*pApp).c_str());
#else
- printf("Writing App : %s (éà ôï)\n", UTFstring(*pApp).c_str());
+ printf("Writing App : %s (éà ôï)\n", UTFstring(*pApp).c_str());
#endif
- }
-
- if (UpperElementLevel > 0) {
- UpperElementLevel--;
- delete ElementLevel2;
- ElementLevel2 = ElementLevel3;
- if (UpperElementLevel > 0)
- break;
- } else {
- ElementLevel2->SkipData(aStream, ElementLevel2->Generic().Context);
- delete ElementLevel2;
-
- ElementLevel2 = aStream.FindNextElement(ElementLevel1->Generic().Context, UpperElementLevel, 0, bAllowDummy);
- }
- }
+ }
+
+ if (UpperElementLevel > 0) {
+ UpperElementLevel--;
+ delete ElementLevel2;
+ ElementLevel2 = ElementLevel3;
+ if (UpperElementLevel > 0)
+ break;
+ } else {
+ ElementLevel2->SkipData(aStream, ElementLevel2->Generic().Context);
+ delete ElementLevel2;
+
+ ElementLevel2 = aStream.FindNextElement(ElementLevel1->Generic().Context, UpperElementLevel, 0, bAllowDummy);
+ }
+ }
#endif // JUMP_TEST
- }
+ }
- else if (EbmlId(*ElementLevel1) == KaxCluster::ClassInfos.GlobalId) {
- printf("\n- Segment Clusters found\n");
- SegmentCluster = static_cast<KaxCluster *>(ElementLevel1);
-// SegmentCluster->ClearElement();
- uint32 ClusterTimecode;
- EbmlCrc32 *pChecksum = NULL;
- uint32 SizeInCrc;
- uint64 CrcPositionStart = 0;
+ else if (EbmlId(*ElementLevel1) == KaxCluster::ClassInfos.GlobalId) {
+ printf("\n- Segment Clusters found\n");
+ SegmentCluster = static_cast<KaxCluster *>(ElementLevel1);
+// SegmentCluster->ClearElement();
+ uint32 ClusterTimecode;
+ EbmlCrc32 *pChecksum = NULL;
+ uint32 SizeInCrc;
+ uint64 CrcPositionStart = 0;
#ifdef MEMORY_READ // read the Cluster in memory and then extract elements from memory
- SegmentCluster->Read(aStream, KaxCluster::ClassInfos.Context, UpperElementLevel, ElementLevel2, bAllowDummy);
- if (SegmentCluster->CheckMandatory()) {
- printf(" * All mandatory elements found *\n");
- } else {
- printf(" * Some mandatory elements ar missing !!! *\n");
- }
-
- // display the elements read
- unsigned int Index0;
- for (Index0 = 0; Index0<SegmentCluster->ListSize() ;Index0++) {
- printf(" - found %s\n", (*SegmentCluster)[Index0]->Generic().DebugName);
- }
+ SegmentCluster->Read(aStream, KaxCluster::ClassInfos.Context, UpperElementLevel, ElementLevel2, bAllowDummy);
+ if (SegmentCluster->CheckMandatory()) {
+ printf(" * All mandatory elements found *\n");
+ } else {
+ printf(" * Some mandatory elements ar missing !!! *\n");
+ }
+
+ // display the elements read
+ unsigned int Index0;
+ for (Index0 = 0; Index0<SegmentCluster->ListSize() ;Index0++) {
+ printf(" - found %s\n", (*SegmentCluster)[Index0]->Generic().DebugName);
+ }
#else // not MEMORY_READ
- // read blocks and discard the ones we don't care about
- ElementLevel2 = aStream.FindNextElement(ElementLevel1->Generic().Context, UpperElementLevel, 0, bAllowDummy);
- while (ElementLevel2 != NULL) {
- if (UpperElementLevel > 0) {
- break;
- }
- if (UpperElementLevel < 0) {
- UpperElementLevel = 0;
- }
- if (EbmlId(*ElementLevel2) == KaxClusterTimecode::ClassInfos.GlobalId) {
- printf("Cluster timecode found\n");
- KaxClusterTimecode & ClusterTime = *static_cast<KaxClusterTimecode*>(ElementLevel2);
- ClusterTime.ReadData(aStream.I_O());
- ClusterTimecode = uint32(ClusterTime);
- SegmentCluster->InitTimecode(ClusterTimecode, TimecodeScale);
- } else if (EbmlId(*ElementLevel2) == KaxBlockGroup::ClassInfos.GlobalId) {
- printf("Block Group found\n");
+ // read blocks and discard the ones we don't care about
+ ElementLevel2 = aStream.FindNextElement(ElementLevel1->Generic().Context, UpperElementLevel, 0, bAllowDummy);
+ while (ElementLevel2 != NULL) {
+ if (UpperElementLevel > 0) {
+ break;
+ }
+ if (UpperElementLevel < 0) {
+ UpperElementLevel = 0;
+ }
+ if (EbmlId(*ElementLevel2) == KaxClusterTimecode::ClassInfos.GlobalId) {
+ printf("Cluster timecode found\n");
+ KaxClusterTimecode & ClusterTime = *static_cast<KaxClusterTimecode*>(ElementLevel2);
+ ClusterTime.ReadData(aStream.I_O());
+ ClusterTimecode = uint32(ClusterTime);
+ SegmentCluster->InitTimecode(ClusterTimecode, TimecodeScale);
+ } else if (EbmlId(*ElementLevel2) == KaxBlockGroup::ClassInfos.GlobalId) {
+ printf("Block Group found\n");
#ifdef TEST_BLOCKGROUP_READ
- KaxBlockGroup & aBlockGroup = *static_cast<KaxBlockGroup*>(ElementLevel2);
-// aBlockGroup.ClearElement();
- // Extract the valuable data from the Block
-
- aBlockGroup.Read(aStream, KaxBlockGroup::ClassInfos.Context, UpperElementLevel, ElementLevel3, bAllowDummy);
- KaxBlock * DataBlock = static_cast<KaxBlock *>(aBlockGroup.FindElt(KaxBlock::ClassInfos));
- if (DataBlock != NULL) {
-// DataBlock->ReadData(aStream.I_O());
- DataBlock->SetParent(*SegmentCluster);
- printf(" Track # %d / %d frame%s / Timecode %I64d\n",DataBlock->TrackNum(), DataBlock->NumberFrames(), (DataBlock->NumberFrames() > 1)?"s":"", DataBlock->GlobalTimecode());
- } else {
- printf(" A BlockGroup without a Block !!!");
- }
- KaxBlockDuration * BlockDuration = static_cast<KaxBlockDuration *>(aBlockGroup.FindElt(KaxBlockDuration::ClassInfos));
- if (BlockDuration != NULL) {
- printf(" Block Duration %d scaled ticks : %ld ns\n", uint32(*BlockDuration), uint32(*BlockDuration) * TimecodeScale);
- }
- KaxReferenceBlock * RefTime = static_cast<KaxReferenceBlock *>(aBlockGroup.FindElt(KaxReferenceBlock::ClassInfos));
- if (RefTime != NULL) {
- printf(" Reference frame at scaled (%d) timecode %ld\n", int32(*RefTime), int32(int64(*RefTime) * TimecodeScale));
- }
+ KaxBlockGroup & aBlockGroup = *static_cast<KaxBlockGroup*>(ElementLevel2);
+// aBlockGroup.ClearElement();
+ // Extract the valuable data from the Block
+
+ aBlockGroup.Read(aStream, KaxBlockGroup::ClassInfos.Context, UpperElementLevel, ElementLevel3, bAllowDummy);
+ KaxBlock * DataBlock = static_cast<KaxBlock *>(aBlockGroup.FindElt(KaxBlock::ClassInfos));
+ if (DataBlock != NULL) {
+// DataBlock->ReadData(aStream.I_O());
+ DataBlock->SetParent(*SegmentCluster);
+ printf(" Track # %d / %d frame%s / Timecode %I64d\n",DataBlock->TrackNum(), DataBlock->NumberFrames(), (DataBlock->NumberFrames() > 1)?"s":"", DataBlock->GlobalTimecode());
+ } else {
+ printf(" A BlockGroup without a Block !!!");
+ }
+ KaxBlockDuration * BlockDuration = static_cast<KaxBlockDuration *>(aBlockGroup.FindElt(KaxBlockDuration::ClassInfos));
+ if (BlockDuration != NULL) {
+ printf(" Block Duration %d scaled ticks : %ld ns\n", uint32(*BlockDuration), uint32(*BlockDuration) * TimecodeScale);
+ }
+ KaxReferenceBlock * RefTime = static_cast<KaxReferenceBlock *>(aBlockGroup.FindElt(KaxReferenceBlock::ClassInfos));
+ if (RefTime != NULL) {
+ printf(" Reference frame at scaled (%d) timecode %ld\n", int32(*RefTime), int32(int64(*RefTime) * TimecodeScale));
+ }
#else // TEST_BLOCKGROUP_READ
- // read the data we care about in matroska
- /// \todo There should be a way to get the default values of the elements not defined
- ElementLevel3 = aStream.FindNextElement(ElementLevel2->Generic().Context, UpperElementLevel, 0, bAllowDummy);
- while (ElementLevel3 != NULL) {
- if (UpperElementLevel > 0) {
- break;
- }
- if (UpperElementLevel < 0) {
- UpperElementLevel = 0;
- }
- if (EbmlId(*ElementLevel3) == KaxBlock::ClassInfos.GlobalId) {
- printf(" Block Data\n");
- KaxBlock & DataBlock = *static_cast<KaxBlock*>(ElementLevel3);
+ // read the data we care about in matroska
+ /// \todo There should be a way to get the default values of the elements not defined
+ ElementLevel3 = aStream.FindNextElement(ElementLevel2->Generic().Context, UpperElementLevel, 0, bAllowDummy);
+ while (ElementLevel3 != NULL) {
+ if (UpperElementLevel > 0) {
+ break;
+ }
+ if (UpperElementLevel < 0) {
+ UpperElementLevel = 0;
+ }
+ if (EbmlId(*ElementLevel3) == KaxBlock::ClassInfos.GlobalId) {
+ printf(" Block Data\n");
+ KaxBlock & DataBlock = *static_cast<KaxBlock*>(ElementLevel3);
#ifdef NO_DISPLAY_DATA
- DataBlock.ReadData(aStream.I_O(), SCOPE_PARTIAL_DATA);
+ DataBlock.ReadData(aStream.I_O(), SCOPE_PARTIAL_DATA);
#else // NO_DISPLAY_DATA
- DataBlock.ReadData(aStream.I_O(), SCOPE_ALL_DATA);
+ DataBlock.ReadData(aStream.I_O(), SCOPE_ALL_DATA);
#endif // NO_DISPLAY_DATA
- DataBlock.SetParent(*SegmentCluster);
- printf(" Track # %d / %d frame%s / Timecode %I64d\n",DataBlock.TrackNum(), DataBlock.NumberFrames(), (DataBlock.NumberFrames() > 1)?"s":"", DataBlock.GlobalTimecode());
+ DataBlock.SetParent(*SegmentCluster);
+ printf(" Track # %d / %d frame%s / Timecode %I64d\n",DataBlock.TrackNum(), DataBlock.NumberFrames(), (DataBlock.NumberFrames() > 1)?"s":"", DataBlock.GlobalTimecode());
#ifndef NO_DISPLAY_DATA
- for (unsigned int i=0; i< DataBlock.NumberFrames(); i++) {
- printf(" [%s]\n",DataBlock.GetBuffer(i).Buffer()); // STRING ONLY POSSIBLE WITH THIS PARTICULAR EXAMPLE (the binary data is a string)
- }
+ for (unsigned int i=0; i< DataBlock.NumberFrames(); i++) {
+ printf(" [%s]\n",DataBlock.GetBuffer(i).Buffer()); // STRING ONLY POSSIBLE WITH THIS PARTICULAR EXAMPLE (the binary data is a string)
+ }
#endif // NO_DISPLAY_DATA
-// printf("Codec ID : %s\n", &binary(CodecID)); // strings for the moment (example)
+// printf("Codec ID : %s\n", &binary(CodecID)); // strings for the moment (example)
#if MATROSKA_VERSION >= 2
- } else if (EbmlId(*ElementLevel3) == KaxBlockVirtual::ClassInfos.GlobalId) {
- printf(" Virtual Block\n");
- } else if (EbmlId(*ElementLevel3) == KaxReferenceVirtual::ClassInfos.GlobalId) {
- printf(" virtual Reference\n");
+ } else if (EbmlId(*ElementLevel3) == KaxBlockVirtual::ClassInfos.GlobalId) {
+ printf(" Virtual Block\n");
+ } else if (EbmlId(*ElementLevel3) == KaxReferenceVirtual::ClassInfos.GlobalId) {
+ printf(" virtual Reference\n");
#endif // MATROSKA_VERSION
- } else if (EbmlId(*ElementLevel3) == KaxReferencePriority::ClassInfos.GlobalId) {
- printf(" Reference priority\n");
- } else if (EbmlId(*ElementLevel3) == KaxReferenceBlock::ClassInfos.GlobalId) {
- KaxReferenceBlock & RefTime = *static_cast<KaxReferenceBlock*>(ElementLevel3);
- RefTime.ReadData(aStream.I_O());
- printf(" Reference frame at scaled (%d) timecode %ld\n", int32(RefTime), int32(int64(RefTime) * TimecodeScale));
- } else if (EbmlId(*ElementLevel3) == KaxBlockDuration::ClassInfos.GlobalId) {
- KaxBlockDuration & BlockDuration = *static_cast<KaxBlockDuration*>(ElementLevel3);
- BlockDuration.ReadData(aStream.I_O());
- printf(" Block Duration %d scaled ticks : %ld ns\n", uint32(BlockDuration), uint32(BlockDuration) * TimecodeScale);
- }
- if (UpperElementLevel > 0) {
- UpperElementLevel--;
- delete ElementLevel3;
- ElementLevel3 = ElementLevel4;
- if (UpperElementLevel > 0)
- break;
- } else {
- ElementLevel3->SkipData(aStream, ElementLevel3->Generic().Context);
-
- ElementLevel3 = aStream.FindNextElement(ElementLevel2->Generic().Context, UpperElementLevel, 0, bAllowDummy);
- }
- }
+ } else if (EbmlId(*ElementLevel3) == KaxReferencePriority::ClassInfos.GlobalId) {
+ printf(" Reference priority\n");
+ } else if (EbmlId(*ElementLevel3) == KaxReferenceBlock::ClassInfos.GlobalId) {
+ KaxReferenceBlock & RefTime = *static_cast<KaxReferenceBlock*>(ElementLevel3);
+ RefTime.ReadData(aStream.I_O());
+ printf(" Reference frame at scaled (%d) timecode %ld\n", int32(RefTime), int32(int64(RefTime) * TimecodeScale));
+ } else if (EbmlId(*ElementLevel3) == KaxBlockDuration::ClassInfos.GlobalId) {
+ KaxBlockDuration & BlockDuration = *static_cast<KaxBlockDuration*>(ElementLevel3);
+ BlockDuration.ReadData(aStream.I_O());
+ printf(" Block Duration %d scaled ticks : %ld ns\n", uint32(BlockDuration), uint32(BlockDuration) * TimecodeScale);
+ }
+ if (UpperElementLevel > 0) {
+ UpperElementLevel--;
+ delete ElementLevel3;
+ ElementLevel3 = ElementLevel4;
+ if (UpperElementLevel > 0)
+ break;
+ } else {
+ ElementLevel3->SkipData(aStream, ElementLevel3->Generic().Context);
+
+ ElementLevel3 = aStream.FindNextElement(ElementLevel2->Generic().Context, UpperElementLevel, 0, bAllowDummy);
+ }
+ }
#endif // TEST_BLOCKGROUP_READ
- } else if (EbmlId(*ElementLevel2) == EbmlCrc32::ClassInfos.GlobalId) {
- printf("Cluster CheckSum !\n");
- pChecksum = static_cast<EbmlCrc32*>(ElementLevel2);
- pChecksum->ReadData(aStream.I_O());
- SegmentCluster->ForceChecksum( pChecksum->GetCrc32() ); // not use later
- SizeInCrc = 0;
- CrcPositionStart = aStream.I_O().getFilePointer();
- }
-
- if (UpperElementLevel > 0) {
- UpperElementLevel--;
- delete ElementLevel2;
- ElementLevel2 = ElementLevel3;
- if (UpperElementLevel > 0)
- break;
- } else {
- ElementLevel2->SkipData(aStream, ElementLevel2->Generic().Context);
- if (ElementLevel2 != pChecksum)
- delete ElementLevel2;
-
- ElementLevel2 = aStream.FindNextElement(ElementLevel1->Generic().Context, UpperElementLevel, 0, bAllowDummy);
- }
- }
+ } else if (EbmlId(*ElementLevel2) == EbmlCrc32::ClassInfos.GlobalId) {
+ printf("Cluster CheckSum !\n");
+ pChecksum = static_cast<EbmlCrc32*>(ElementLevel2);
+ pChecksum->ReadData(aStream.I_O());
+ SegmentCluster->ForceChecksum( pChecksum->GetCrc32() ); // not use later
+ SizeInCrc = 0;
+ CrcPositionStart = aStream.I_O().getFilePointer();
+ }
+
+ if (UpperElementLevel > 0) {
+ UpperElementLevel--;
+ delete ElementLevel2;
+ ElementLevel2 = ElementLevel3;
+ if (UpperElementLevel > 0)
+ break;
+ } else {
+ ElementLevel2->SkipData(aStream, ElementLevel2->Generic().Context);
+ if (ElementLevel2 != pChecksum)
+ delete ElementLevel2;
+
+ ElementLevel2 = aStream.FindNextElement(ElementLevel1->Generic().Context, UpperElementLevel, 0, bAllowDummy);
+ }
+ }
#endif // not MEMORY_READ
- if (pChecksum != NULL) {
- EbmlCrc32 ComputedChecksum;
- uint64 CurrPosition = aStream.I_O().getFilePointer();
- uint64 CrcPositionEnd = ElementLevel2->GetElementPosition();
- binary *SupposedBufferInCrc = new binary [CrcPositionEnd - CrcPositionStart];
- aStream.I_O().setFilePointer(CrcPositionStart);
- aStream.I_O().readFully(SupposedBufferInCrc, CrcPositionEnd - CrcPositionStart);
- aStream.I_O().setFilePointer(CurrPosition);
- ComputedChecksum.FillCRC32(SupposedBufferInCrc, CrcPositionEnd - CrcPositionStart);
- delete [] SupposedBufferInCrc;
- if (pChecksum->GetCrc32() == ComputedChecksum.GetCrc32()) {
- printf(" ++ CheckSum verification succeeded ++");
- } else {
- printf(" ++ CheckSum verification FAILED !!! ++");
- }
- delete pChecksum;
- pChecksum = NULL;
- }
- }
- else if (EbmlId(*ElementLevel1) == KaxCues::ClassInfos.GlobalId) {
- printf("\n- Cue entries found\n");
- CuesEntry = static_cast<KaxCues *>(ElementLevel1);
- CuesEntry->SetGlobalTimecodeScale(TimecodeScale);
- // read everything in memory
- CuesEntry->Read(aStream, KaxCues::ClassInfos.Context, UpperElementLevel, ElementLevel2, bAllowDummy); // build the entries in memory
- if (CuesEntry->CheckMandatory()) {
- printf(" * All mandatory elements found *\n");
- } else {
- printf(" * Some mandatory elements ar missing !!! *\n");
- }
- CuesEntry->Sort();
- // display the elements read
- unsigned int Index0;
- for (Index0 = 0; Index0<CuesEntry->ListSize() ;Index0++) {
- if ((*CuesEntry)[Index0]->Generic().GlobalId == KaxCuePoint::ClassInfos.GlobalId) {
- printf(" Cue Point\n");
-
- KaxCuePoint & CuePoint = *static_cast<KaxCuePoint *>((*CuesEntry)[Index0]);
- unsigned int Index1;
- for (Index1 = 0; Index1<CuePoint.ListSize() ;Index1++) {
- if (CuePoint[Index1]->Generic().GlobalId == KaxCueTime::ClassInfos.GlobalId) {
- KaxCueTime & CueTime = *static_cast<KaxCueTime *>(CuePoint[Index1]);
- printf(" Time %ld\n", uint64(CueTime) * TimecodeScale);
- } else if (CuePoint[Index1]->Generic().GlobalId == KaxCueTrackPositions::ClassInfos.GlobalId) {
- KaxCueTrackPositions & CuePos = *static_cast<KaxCueTrackPositions *>(CuePoint[Index1]);
- printf(" Positions\n");
-
- unsigned int Index2;
- for (Index2 = 0; Index2<CuePos.ListSize() ;Index2++) {
- if (CuePos[Index2]->Generic().GlobalId == KaxCueTrack::ClassInfos.GlobalId) {
- KaxCueTrack & CueTrack = *static_cast<KaxCueTrack *>(CuePos[Index2]);
- printf(" Track %d\n", uint16(CueTrack));
- } else if (CuePos[Index2]->Generic().GlobalId == KaxCueClusterPosition::ClassInfos.GlobalId) {
- KaxCueClusterPosition & CuePoss = *static_cast<KaxCueClusterPosition *>(CuePos[Index2]);
- printf(" Cluster position %d\n", uint64(CuePoss));
+ if (pChecksum != NULL) {
+ EbmlCrc32 ComputedChecksum;
+ uint64 CurrPosition = aStream.I_O().getFilePointer();
+ uint64 CrcPositionEnd = ElementLevel2->GetElementPosition();
+ binary *SupposedBufferInCrc = new binary [CrcPositionEnd - CrcPositionStart];
+ aStream.I_O().setFilePointer(CrcPositionStart);
+ aStream.I_O().readFully(SupposedBufferInCrc, CrcPositionEnd - CrcPositionStart);
+ aStream.I_O().setFilePointer(CurrPosition);
+ ComputedChecksum.FillCRC32(SupposedBufferInCrc, CrcPositionEnd - CrcPositionStart);
+ delete [] SupposedBufferInCrc;
+ if (pChecksum->GetCrc32() == ComputedChecksum.GetCrc32()) {
+ printf(" ++ CheckSum verification succeeded ++");
+ } else {
+ printf(" ++ CheckSum verification FAILED !!! ++");
+ }
+ delete pChecksum;
+ pChecksum = NULL;
+ }
+ }
+ else if (EbmlId(*ElementLevel1) == KaxCues::ClassInfos.GlobalId) {
+ printf("\n- Cue entries found\n");
+ CuesEntry = static_cast<KaxCues *>(ElementLevel1);
+ CuesEntry->SetGlobalTimecodeScale(TimecodeScale);
+ // read everything in memory
+ CuesEntry->Read(aStream, KaxCues::ClassInfos.Context, UpperElementLevel, ElementLevel2, bAllowDummy); // build the entries in memory
+ if (CuesEntry->CheckMandatory()) {
+ printf(" * All mandatory elements found *\n");
+ } else {
+ printf(" * Some mandatory elements ar missing !!! *\n");
+ }
+ CuesEntry->Sort();
+ // display the elements read
+ unsigned int Index0;
+ for (Index0 = 0; Index0<CuesEntry->ListSize() ;Index0++) {
+ if ((*CuesEntry)[Index0]->Generic().GlobalId == KaxCuePoint::ClassInfos.GlobalId) {
+ printf(" Cue Point\n");
+
+ KaxCuePoint & CuePoint = *static_cast<KaxCuePoint *>((*CuesEntry)[Index0]);
+ unsigned int Index1;
+ for (Index1 = 0; Index1<CuePoint.ListSize() ;Index1++) {
+ if (CuePoint[Index1]->Generic().GlobalId == KaxCueTime::ClassInfos.GlobalId) {
+ KaxCueTime & CueTime = *static_cast<KaxCueTime *>(CuePoint[Index1]);
+ printf(" Time %ld\n", uint64(CueTime) * TimecodeScale);
+ } else if (CuePoint[Index1]->Generic().GlobalId == KaxCueTrackPositions::ClassInfos.GlobalId) {
+ KaxCueTrackPositions & CuePos = *static_cast<KaxCueTrackPositions *>(CuePoint[Index1]);
+ printf(" Positions\n");
+
+ unsigned int Index2;
+ for (Index2 = 0; Index2<CuePos.ListSize() ;Index2++) {
+ if (CuePos[Index2]->Generic().GlobalId == KaxCueTrack::ClassInfos.GlobalId) {
+ KaxCueTrack & CueTrack = *static_cast<KaxCueTrack *>(CuePos[Index2]);
+ printf(" Track %d\n", uint16(CueTrack));
+ } else if (CuePos[Index2]->Generic().GlobalId == KaxCueClusterPosition::ClassInfos.GlobalId) {
+ KaxCueClusterPosition & CuePoss = *static_cast<KaxCueClusterPosition *>(CuePos[Index2]);
+ printf(" Cluster position %d\n", uint64(CuePoss));
#if MATROSKA_VERSION >= 2
- } else if (CuePos[Index2]->Generic().GlobalId == KaxCueReference::ClassInfos.GlobalId) {
- KaxCueReference & CueRefs = *static_cast<KaxCueReference *>(CuePos[Index2]);
- printf(" Reference\n");
-
- unsigned int Index3;
- for (Index3 = 0; Index3<CueRefs.ListSize() ;Index3++) {
- if (CueRefs[Index3]->Generic().GlobalId == KaxCueRefTime::ClassInfos.GlobalId) {
- KaxCueRefTime & CueTime = *static_cast<KaxCueRefTime *>(CueRefs[Index3]);
- printf(" Time %d\n", uint32(CueTime));
- } else if (CueRefs[Index3]->Generic().GlobalId == KaxCueRefCluster::ClassInfos.GlobalId) {
- KaxCueRefCluster & CueClust = *static_cast<KaxCueRefCluster *>(CueRefs[Index3]);
- printf(" Cluster position %d\n", uint64(CueClust));
- } else {
- printf(" - found %s\n", CueRefs[Index3]->Generic().DebugName);
- }
- }
+ } else if (CuePos[Index2]->Generic().GlobalId == KaxCueReference::ClassInfos.GlobalId) {
+ KaxCueReference & CueRefs = *static_cast<KaxCueReference *>(CuePos[Index2]);
+ printf(" Reference\n");
+
+ unsigned int Index3;
+ for (Index3 = 0; Index3<CueRefs.ListSize() ;Index3++) {
+ if (CueRefs[Index3]->Generic().GlobalId == KaxCueRefTime::ClassInfos.GlobalId) {
+ KaxCueRefTime & CueTime = *static_cast<KaxCueRefTime *>(CueRefs[Index3]);
+ printf(" Time %d\n", uint32(CueTime));
+ } else if (CueRefs[Index3]->Generic().GlobalId == KaxCueRefCluster::ClassInfos.GlobalId) {
+ KaxCueRefCluster & CueClust = *static_cast<KaxCueRefCluster *>(CueRefs[Index3]);
+ printf(" Cluster position %d\n", uint64(CueClust));
+ } else {
+ printf(" - found %s\n", CueRefs[Index3]->Generic().DebugName);
+ }
+ }
#endif // MATROSKA_VERSION
- } else {
- printf(" - found %s\n", CuePos[Index2]->Generic().DebugName);
- }
- }
- } else {
- printf(" - found %s\n", CuePoint[Index1]->Generic().DebugName);
- }
- }
- } else {
- printf(" - found %s\n", (*CuesEntry)[Index0]->Generic().DebugName);
- }
- }
- }
- else if (EbmlId(*ElementLevel1) == KaxSeekHead::ClassInfos.GlobalId) {
- printf("\n- Meta Seek found\n");
- MetaSeek = static_cast<KaxSeekHead *>(ElementLevel1);
- // read it in memory
- MetaSeek->Read(aStream, KaxSeekHead::ClassInfos.Context, UpperElementLevel, ElementLevel2, bAllowDummy);
- if (MetaSeek->CheckMandatory()) {
- printf(" * All mandatory elements found *\n");
- } else {
- printf(" * Some mandatory elements ar missing !!! *\n");
- }
- unsigned int Index0;
- for (Index0 = 0; Index0<MetaSeek->ListSize() ;Index0++) {
- if ((*MetaSeek)[Index0]->Generic().GlobalId == KaxSeek::ClassInfos.GlobalId) {
- printf(" Seek Point\n");
- KaxSeek & SeekPoint = *static_cast<KaxSeek *>((*MetaSeek)[Index0]);
- unsigned int Index1;
- for (Index1 = 0; Index1<SeekPoint.ListSize() ;Index1++) {
- if (SeekPoint[Index1]->Generic().GlobalId == KaxSeekID::ClassInfos.GlobalId) {
- KaxSeekID * SeekID = static_cast<KaxSeekID *>(SeekPoint[Index1]);
- printf(" Seek ID ", SeekID->GetBuffer());
- for (unsigned int i=0; i<SeekID->GetSize(); i++) {
- printf("%02X", SeekID->GetBuffer()[i]);
- }
- printf("\n");
- } else if (SeekPoint[Index1]->Generic().GlobalId == KaxSeekPosition::ClassInfos.GlobalId) {
- KaxSeekPosition * SeekPos = static_cast<KaxSeekPosition *>(SeekPoint[Index1]);
- printf(" Seek position %d\n", uint32(*SeekPos));
- }
- }
- }
- }
- } else if (EbmlId(*ElementLevel1) == KaxChapters::ClassInfos.GlobalId) {
- printf("\n- Chapters found\n");
- Chapters = static_cast<KaxChapters *>(ElementLevel1);
- // read it in memory
- Chapters->Read(aStream, KaxChapters::ClassInfos.Context, UpperElementLevel, ElementLevel2, bAllowDummy);
- if (Chapters->CheckMandatory()) {
- printf(" * All mandatory elements found *\n");
- } else {
- printf(" * Some mandatory elements ar missing !!! *\n");
- }
- unsigned int Index0;
- for (Index0 = 0; Index0<Chapters->ListSize() ;Index0++) {
- if ((*Chapters)[Index0]->Generic().GlobalId == KaxEditionEntry::ClassInfos.GlobalId) {
- printf(" Edition\n");
- KaxEditionEntry & Edition = *static_cast<KaxEditionEntry *>((*Chapters)[Index0]);
- unsigned int Index2;
- for (Index2 = 0; Index2<Edition.ListSize() ;Index2++) {
- if (Edition[Index2]->Generic().GlobalId == KaxChapterAtom::ClassInfos.GlobalId) {
- printf(" Chapter Atom\n");
- KaxChapterAtom & aChapterAtom = *static_cast<KaxChapterAtom *>(Edition[Index2]);
- unsigned int Index3;
- for (Index3 = 0; Index3<aChapterAtom.ListSize() ;Index3++) {
- if (aChapterAtom[Index3]->Generic().GlobalId == KaxChapterUID::ClassInfos.GlobalId) {
- printf(" Chapter UID 0x%08x\n", uint32(*static_cast<EbmlUInteger *>(aChapterAtom[Index3])) );
- } else if (aChapterAtom[Index3]->Generic().GlobalId == KaxChapterTimeStart::ClassInfos.GlobalId) {
- printf(" Time Start %d\n", uint32(*static_cast<EbmlUInteger *>(aChapterAtom[Index3])) );
- } else if (aChapterAtom[Index3]->Generic().GlobalId == KaxChapterTimeEnd::ClassInfos.GlobalId) {
- printf(" Time End %d ns\n", uint32(*static_cast<EbmlUInteger *>(aChapterAtom[Index3])) );
- } else if (aChapterAtom[Index3]->Generic().GlobalId == KaxChapterTrack::ClassInfos.GlobalId) {
- printf(" Track list\n");
- } else if (aChapterAtom[Index3]->Generic().GlobalId == KaxChapterDisplay::ClassInfos.GlobalId) {
- printf(" Display info\n");
- KaxChapterDisplay & aDisplay = *static_cast<KaxChapterDisplay *>(aChapterAtom[Index3]);
- unsigned int Index4;
- for (Index4 = 0; Index4<aDisplay.ListSize() ;Index4++) {
- if (aDisplay[Index4]->Generic().GlobalId == KaxChapterString::ClassInfos.GlobalId) {
+ } else {
+ printf(" - found %s\n", CuePos[Index2]->Generic().DebugName);
+ }
+ }
+ } else {
+ printf(" - found %s\n", CuePoint[Index1]->Generic().DebugName);
+ }
+ }
+ } else {
+ printf(" - found %s\n", (*CuesEntry)[Index0]->Generic().DebugName);
+ }
+ }
+ }
+ else if (EbmlId(*ElementLevel1) == KaxSeekHead::ClassInfos.GlobalId) {
+ printf("\n- Meta Seek found\n");
+ MetaSeek = static_cast<KaxSeekHead *>(ElementLevel1);
+ // read it in memory
+ MetaSeek->Read(aStream, KaxSeekHead::ClassInfos.Context, UpperElementLevel, ElementLevel2, bAllowDummy);
+ if (MetaSeek->CheckMandatory()) {
+ printf(" * All mandatory elements found *\n");
+ } else {
+ printf(" * Some mandatory elements ar missing !!! *\n");
+ }
+ unsigned int Index0;
+ for (Index0 = 0; Index0<MetaSeek->ListSize() ;Index0++) {
+ if ((*MetaSeek)[Index0]->Generic().GlobalId == KaxSeek::ClassInfos.GlobalId) {
+ printf(" Seek Point\n");
+ KaxSeek & SeekPoint = *static_cast<KaxSeek *>((*MetaSeek)[Index0]);
+ unsigned int Index1;
+ for (Index1 = 0; Index1<SeekPoint.ListSize() ;Index1++) {
+ if (SeekPoint[Index1]->Generic().GlobalId == KaxSeekID::ClassInfos.GlobalId) {
+ KaxSeekID * SeekID = static_cast<KaxSeekID *>(SeekPoint[Index1]);
+ printf(" Seek ID ", SeekID->GetBuffer());
+ for (unsigned int i=0; i<SeekID->GetSize(); i++) {
+ printf("%02X", SeekID->GetBuffer()[i]);
+ }
+ printf("\n");
+ } else if (SeekPoint[Index1]->Generic().GlobalId == KaxSeekPosition::ClassInfos.GlobalId) {
+ KaxSeekPosition * SeekPos = static_cast<KaxSeekPosition *>(SeekPoint[Index1]);
+ printf(" Seek position %d\n", uint32(*SeekPos));
+ }
+ }
+ }
+ }
+ } else if (EbmlId(*ElementLevel1) == KaxChapters::ClassInfos.GlobalId) {
+ printf("\n- Chapters found\n");
+ Chapters = static_cast<KaxChapters *>(ElementLevel1);
+ // read it in memory
+ Chapters->Read(aStream, KaxChapters::ClassInfos.Context, UpperElementLevel, ElementLevel2, bAllowDummy);
+ if (Chapters->CheckMandatory()) {
+ printf(" * All mandatory elements found *\n");
+ } else {
+ printf(" * Some mandatory elements ar missing !!! *\n");
+ }
+ unsigned int Index0;
+ for (Index0 = 0; Index0<Chapters->ListSize() ;Index0++) {
+ if ((*Chapters)[Index0]->Generic().GlobalId == KaxEditionEntry::ClassInfos.GlobalId) {
+ printf(" Edition\n");
+ KaxEditionEntry & Edition = *static_cast<KaxEditionEntry *>((*Chapters)[Index0]);
+ unsigned int Index2;
+ for (Index2 = 0; Index2<Edition.ListSize() ;Index2++) {
+ if (Edition[Index2]->Generic().GlobalId == KaxChapterAtom::ClassInfos.GlobalId) {
+ printf(" Chapter Atom\n");
+ KaxChapterAtom & aChapterAtom = *static_cast<KaxChapterAtom *>(Edition[Index2]);
+ unsigned int Index3;
+ for (Index3 = 0; Index3<aChapterAtom.ListSize() ;Index3++) {
+ if (aChapterAtom[Index3]->Generic().GlobalId == KaxChapterUID::ClassInfos.GlobalId) {
+ printf(" Chapter UID 0x%08x\n", uint32(*static_cast<EbmlUInteger *>(aChapterAtom[Index3])) );
+ } else if (aChapterAtom[Index3]->Generic().GlobalId == KaxChapterTimeStart::ClassInfos.GlobalId) {
+ printf(" Time Start %d\n", uint32(*static_cast<EbmlUInteger *>(aChapterAtom[Index3])) );
+ } else if (aChapterAtom[Index3]->Generic().GlobalId == KaxChapterTimeEnd::ClassInfos.GlobalId) {
+ printf(" Time End %d ns\n", uint32(*static_cast<EbmlUInteger *>(aChapterAtom[Index3])) );
+ } else if (aChapterAtom[Index3]->Generic().GlobalId == KaxChapterTrack::ClassInfos.GlobalId) {
+ printf(" Track list\n");
+ } else if (aChapterAtom[Index3]->Generic().GlobalId == KaxChapterDisplay::ClassInfos.GlobalId) {
+ printf(" Display info\n");
+ KaxChapterDisplay & aDisplay = *static_cast<KaxChapterDisplay *>(aChapterAtom[Index3]);
+ unsigned int Index4;
+ for (Index4 = 0; Index4<aDisplay.ListSize() ;Index4++) {
+ if (aDisplay[Index4]->Generic().GlobalId == KaxChapterString::ClassInfos.GlobalId) {
#if !defined(__CYGWIN__) && !defined(__APPLE__) && !defined(__BEOS__) && !defined(__NetBSD__)
- wprintf(L" Display \"%s\"\n", UTFstring(*static_cast<EbmlUnicodeString *>(aDisplay[Index4])).c_str() );
+ wprintf(L" Display \"%s\"\n", UTFstring(*static_cast<EbmlUnicodeString *>(aDisplay[Index4])).c_str() );
#else
- printf(" Display \"%s\"\n", UTFstring(*static_cast<EbmlUnicodeString *>(aDisplay[Index4])).c_str() );
+ printf(" Display \"%s\"\n", UTFstring(*static_cast<EbmlUnicodeString *>(aDisplay[Index4])).c_str() );
#endif
- } else if (aDisplay[Index4]->Generic().GlobalId == KaxChapterLanguage::ClassInfos.GlobalId) {
- printf(" For language \"%s\"\n", std::string(*static_cast<EbmlString *>(aDisplay[Index4])).c_str() );
- } else if (aDisplay[Index4]->Generic().GlobalId == KaxChapterCountry::ClassInfos.GlobalId) {
- printf(" For country \"%s\"\n", std::string(*static_cast<EbmlString *>(aDisplay[Index4])).c_str() );
- } else if (aDisplay[Index4]->IsDummy()) {
- printf(" Dummy !!!\n");
- }
- }
- }
- }
- }
- }
- }
- }
- } else if (EbmlId(*ElementLevel1) == KaxTags::ClassInfos.GlobalId) {
- printf("\n- Tags found\n");
- AllTags = static_cast<KaxTags *>(ElementLevel1);
- // read it in memory
- AllTags->Read(aStream, KaxTags::ClassInfos.Context, UpperElementLevel, ElementLevel2, bAllowDummy);
- if (AllTags->CheckMandatory()) {
- printf(" * All mandatory elements found *\n");
- } else {
- printf(" * Some mandatory elements ar missing !!! *\n");
- }
- unsigned int Index0;
- for (Index0 = 0; Index0<AllTags->ListSize() ;Index0++) {
- if ((*AllTags)[Index0]->Generic().GlobalId == KaxTag::ClassInfos.GlobalId) {
- printf(" Tag\n");
- KaxTag & TagElt = *static_cast<KaxTag *>((*AllTags)[Index0]);
- unsigned int Index1;
- for (Index1 = 0; Index1<TagElt.ListSize() ;Index1++) {
-// bool bRemoved = false, bRemovedDone = true;
- if (TagElt[Index1]->Generic().GlobalId == KaxTagTargets::ClassInfos.GlobalId) {
- printf(" Targets\n");
- KaxTagTargets & Targets = *static_cast<KaxTagTargets *>(TagElt[Index1]);
- unsigned int Index2;
- for (Index2 = 0; Index2<Targets.ListSize() ;Index2++) {
- if (Targets[Index2]->Generic().GlobalId == KaxTagTrackUID::ClassInfos.GlobalId) {
+ } else if (aDisplay[Index4]->Generic().GlobalId == KaxChapterLanguage::ClassInfos.GlobalId) {
+ printf(" For language \"%s\"\n", std::string(*static_cast<EbmlString *>(aDisplay[Index4])).c_str() );
+ } else if (aDisplay[Index4]->Generic().GlobalId == KaxChapterCountry::ClassInfos.GlobalId) {
+ printf(" For country \"%s\"\n", std::string(*static_cast<EbmlString *>(aDisplay[Index4])).c_str() );
+ } else if (aDisplay[Index4]->IsDummy()) {
+ printf(" Dummy !!!\n");
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ } else if (EbmlId(*ElementLevel1) == KaxTags::ClassInfos.GlobalId) {
+ printf("\n- Tags found\n");
+ AllTags = static_cast<KaxTags *>(ElementLevel1);
+ // read it in memory
+ AllTags->Read(aStream, KaxTags::ClassInfos.Context, UpperElementLevel, ElementLevel2, bAllowDummy);
+ if (AllTags->CheckMandatory()) {
+ printf(" * All mandatory elements found *\n");
+ } else {
+ printf(" * Some mandatory elements ar missing !!! *\n");
+ }
+ unsigned int Index0;
+ for (Index0 = 0; Index0<AllTags->ListSize() ;Index0++) {
+ if ((*AllTags)[Index0]->Generic().GlobalId == KaxTag::ClassInfos.GlobalId) {
+ printf(" Tag\n");
+ KaxTag & TagElt = *static_cast<KaxTag *>((*AllTags)[Index0]);
+ unsigned int Index1;
+ for (Index1 = 0; Index1<TagElt.ListSize() ;Index1++) {
+// bool bRemoved = false, bRemovedDone = true;
+ if (TagElt[Index1]->Generic().GlobalId == KaxTagTargets::ClassInfos.GlobalId) {
+ printf(" Targets\n");
+ KaxTagTargets & Targets = *static_cast<KaxTagTargets *>(TagElt[Index1]);
+ unsigned int Index2;
+ for (Index2 = 0; Index2<Targets.ListSize() ;Index2++) {
+ if (Targets[Index2]->Generic().GlobalId == KaxTagTrackUID::ClassInfos.GlobalId) {
#ifndef TEST_REMOVE
- printf(" Track UID\n");
+ printf(" Track UID\n");
#else // TEST_REMOVE
- printf(" Track UID (will be removed)\n");
- /*************** Test to remove an element ***************/
- Targets.Remove(Index2);
- bRemoved = true;
- bRemovedDone = false;
- Index2--;
- Index1--;
+ printf(" Track UID (will be removed)\n");
+ /*************** Test to remove an element ***************/
+ Targets.Remove(Index2);
+ bRemoved = true;
+ bRemovedDone = false;
+ Index2--;
+ Index1--;
#endif // TEST_REMOVE
- } else if (Targets[Index2]->Generic().GlobalId == KaxTagChapterUID::ClassInfos.GlobalId) {
- printf(" Chapter UID\n");
+ } else if (Targets[Index2]->Generic().GlobalId == KaxTagChapterUID::ClassInfos.GlobalId) {
+ printf(" Chapter UID\n");
#if 0
- } else if (Targets[Index2]->Generic().GlobalId == KaxTagMultiComment::ClassInfos.GlobalId) {
- printf(" Comment\n");
- KaxTagMultiComment & Comment = *static_cast<KaxTagMultiComment *>(Targets[Index2]);
- unsigned int Index3;
- for (Index3 = 0; Index3<Comment.ListSize() ;Index3++) {
- if (Comment[Index3]->Generic().GlobalId == KaxTagMultiCommentName::ClassInfos.GlobalId) {
- KaxTagMultiCommentName & CommentName = *static_cast<KaxTagMultiCommentName *>(Comment[Index3]);
- printf(" Comment Name \"%s\"\n", std::string(CommentName).c_str());
- }
- }
-// } else if (Targets[Index2]->Generic().GlobalId == DummyRawElement::ClassInfos.GlobalId) {
+ } else if (Targets[Index2]->Generic().GlobalId == KaxTagMultiComment::ClassInfos.GlobalId) {
+ printf(" Comment\n");
+ KaxTagMultiComment & Comment = *static_cast<KaxTagMultiComment *>(Targets[Index2]);
+ unsigned int Index3;
+ for (Index3 = 0; Index3<Comment.ListSize() ;Index3++) {
+ if (Comment[Index3]->Generic().GlobalId == KaxTagMultiCommentName::ClassInfos.GlobalId) {
+ KaxTagMultiCommentName & CommentName = *static_cast<KaxTagMultiCommentName *>(Comment[Index3]);
+ printf(" Comment Name \"%s\"\n", std::string(CommentName).c_str());
+ }
+ }
+// } else if (Targets[Index2]->Generic().GlobalId == DummyRawElement::ClassInfos.GlobalId) {
#endif
- }
- }
+ }
+ }
#ifdef TEST_REMOVE
- if (bRemoved) {
- printf(" -- Again After Deletion --\n");
- bRemoved = false;
- } else if (bRemovedDone) {
- printf(" -- Done --\n");
- }
+ if (bRemoved) {
+ printf(" -- Again After Deletion --\n");
+ bRemoved = false;
+ } else if (bRemovedDone) {
+ printf(" -- Done --\n");
+ }
#endif // TEST_REMOVE
#if 0
- } else if (TagElt[Index1]->Generic().GlobalId == KaxTagGeneral::ClassInfos.GlobalId) {
- printf(" General\n");
- KaxTagGeneral & General = *static_cast<KaxTagGeneral *>(TagElt[Index1]);
- unsigned int Index2;
- for (Index2 = 0; Index2<General.ListSize() ;Index2++) {
- if (General[Index2]->Generic().GlobalId == KaxTagSubject::ClassInfos.GlobalId) {
- printf(" Subject\n");
- } else if (General[Index2]->Generic().GlobalId == KaxTagBibliography::ClassInfos.GlobalId) {
- printf(" Bibliography\n");
- } else if (General[Index2]->Generic().GlobalId == KaxTagLanguage::ClassInfos.GlobalId) {
- printf(" Language\n");
- }
- }
- } else if (TagElt[Index1]->Generic().GlobalId == KaxTagMultiCommercial::ClassInfos.GlobalId) {
- printf(" MultiCommercial\n");
- KaxTagMultiCommercial & Commercials = *static_cast<KaxTagMultiCommercial *>(TagElt[Index1]);
- unsigned int Index2;
- for (Index2 = 0; Index2<Commercials.ListSize() ;Index2++) {
- if (Commercials[Index2]->Generic().GlobalId == KaxTagCommercial::ClassInfos.GlobalId) {
- printf(" Commercial\n");
- KaxTagCommercial & Commercial = *static_cast<KaxTagCommercial *>(Commercials[Index2]);
- unsigned int Index3;
- for (Index3 = 0; Index3<Commercial.ListSize() ;Index3++) {
- if (Commercial[Index3]->Generic().GlobalId == KaxTagMultiCommercialType::ClassInfos.GlobalId) {
- printf(" Type\n");
- } else if (Commercial[Index3]->Generic().GlobalId == KaxTagMultiPrice::ClassInfos.GlobalId) {
- printf(" Prices\n");
- KaxTagMultiPrice & Prices = *static_cast<KaxTagMultiPrice *>(Commercial[Index3]);
- unsigned int Index4;
- for (Index4 = 0; Index4<Prices.ListSize(); Index4++) {
- if (Prices[Index4]->Generic().GlobalId == KaxTagMultiPriceCurrency::ClassInfos.GlobalId) {
- printf(" Currency\n");
- } else if (Prices[Index4]->Generic().GlobalId == KaxTagMultiPriceAmount::ClassInfos.GlobalId) {
- printf(" Amount\n");
- }
- }
- }
- }
- }
- }
- } else if (TagElt[Index1]->Generic().GlobalId == KaxTagMultiDate::ClassInfos.GlobalId) {
- printf(" MultiDate\n");
- } else if (TagElt[Index1]->Generic().GlobalId == KaxTagMultiComment::ClassInfos.GlobalId) {
- printf(" Comment\n");
- KaxTagMultiComment & Comment = *static_cast<KaxTagMultiComment *>(TagElt[Index1]);
- unsigned int Index2;
- for (Index2 = 0; Index2<Comment.ListSize() ;Index2++) {
- if (Comment[Index2]->Generic().GlobalId == KaxTagMultiCommentName::ClassInfos.GlobalId) {
- KaxTagMultiCommentName & CommentName = *static_cast<KaxTagMultiCommentName *>(Comment[Index2]);
- printf(" Comment Name \"%s\"\n", std::string(CommentName).c_str());
- }
- }
+ } else if (TagElt[Index1]->Generic().GlobalId == KaxTagGeneral::ClassInfos.GlobalId) {
+ printf(" General\n");
+ KaxTagGeneral & General = *static_cast<KaxTagGeneral *>(TagElt[Index1]);
+ unsigned int Index2;
+ for (Index2 = 0; Index2<General.ListSize() ;Index2++) {
+ if (General[Index2]->Generic().GlobalId == KaxTagSubject::ClassInfos.GlobalId) {
+ printf(" Subject\n");
+ } else if (General[Index2]->Generic().GlobalId == KaxTagBibliography::ClassInfos.GlobalId) {
+ printf(" Bibliography\n");
+ } else if (General[Index2]->Generic().GlobalId == KaxTagLanguage::ClassInfos.GlobalId) {
+ printf(" Language\n");
+ }
+ }
+ } else if (TagElt[Index1]->Generic().GlobalId == KaxTagMultiCommercial::ClassInfos.GlobalId) {
+ printf(" MultiCommercial\n");
+ KaxTagMultiCommercial & Commercials = *static_cast<KaxTagMultiCommercial *>(TagElt[Index1]);
+ unsigned int Index2;
+ for (Index2 = 0; Index2<Commercials.ListSize() ;Index2++) {
+ if (Commercials[Index2]->Generic().GlobalId == KaxTagCommercial::ClassInfos.GlobalId) {
+ printf(" Commercial\n");
+ KaxTagCommercial & Commercial = *static_cast<KaxTagCommercial *>(Commercials[Index2]);
+ unsigned int Index3;
+ for (Index3 = 0; Index3<Commercial.ListSize() ;Index3++) {
+ if (Commercial[Index3]->Generic().GlobalId == KaxTagMultiCommercialType::ClassInfos.GlobalId) {
+ printf(" Type\n");
+ } else if (Commercial[Index3]->Generic().GlobalId == KaxTagMultiPrice::ClassInfos.GlobalId) {
+ printf(" Prices\n");
+ KaxTagMultiPrice & Prices = *static_cast<KaxTagMultiPrice *>(Commercial[Index3]);
+ unsigned int Index4;
+ for (Index4 = 0; Index4<Prices.ListSize(); Index4++) {
+ if (Prices[Index4]->Generic().GlobalId == KaxTagMultiPriceCurrency::ClassInfos.GlobalId) {
+ printf(" Currency\n");
+ } else if (Prices[Index4]->Generic().GlobalId == KaxTagMultiPriceAmount::ClassInfos.GlobalId) {
+ printf(" Amount\n");
+ }
+ }
+ }
+ }
+ }
+ }
+ } else if (TagElt[Index1]->Generic().GlobalId == KaxTagMultiDate::ClassInfos.GlobalId) {
+ printf(" MultiDate\n");
+ } else if (TagElt[Index1]->Generic().GlobalId == KaxTagMultiComment::ClassInfos.GlobalId) {
+ printf(" Comment\n");
+ KaxTagMultiComment & Comment = *static_cast<KaxTagMultiComment *>(TagElt[Index1]);
+ unsigned int Index2;
+ for (Index2 = 0; Index2<Comment.ListSize() ;Index2++) {
+ if (Comment[Index2]->Generic().GlobalId == KaxTagMultiCommentName::ClassInfos.GlobalId) {
+ KaxTagMultiCommentName & CommentName = *static_cast<KaxTagMultiCommentName *>(Comment[Index2]);
+ printf(" Comment Name \"%s\"\n", std::string(CommentName).c_str());
+ }
+ }
#endif
- }
- }
- }
- }
- if (AllTags->HasChecksum()) {
- if (AllTags->VerifyChecksum()) {
- printf(" ++ CheckSum verification succeeded ++\n");
- } else {
- printf(" ++ CheckSum verification FAILED !!! ++\n");
- }
- }
- }
-
- if (UpperElementLevel > 0) {
- UpperElementLevel--;
- delete ElementLevel1;
- ElementLevel1 = ElementLevel2;
- if (UpperElementLevel > 0)
- break;
- } else {
- ElementLevel1->SkipData(aStream, ElementLevel1->Generic().Context);
- delete ElementLevel1;
-
- ElementLevel1 = aStream.FindNextElement(ElementLevel0->Generic().Context, UpperElementLevel, 0, bAllowDummy);
- }
- }
- }
- }
+ }
+ }
+ }
+ }
+ if (AllTags->HasChecksum()) {
+ if (AllTags->VerifyChecksum()) {
+ printf(" ++ CheckSum verification succeeded ++\n");
+ } else {
+ printf(" ++ CheckSum verification FAILED !!! ++\n");
+ }
+ }
+ }
+
+ if (UpperElementLevel > 0) {
+ UpperElementLevel--;
+ delete ElementLevel1;
+ ElementLevel1 = ElementLevel2;
+ if (UpperElementLevel > 0)
+ break;
+ } else {
+ ElementLevel1->SkipData(aStream, ElementLevel1->Generic().Context);
+ delete ElementLevel1;
+
+ ElementLevel1 = aStream.FindNextElement(ElementLevel0->Generic().Context, UpperElementLevel, 0, bAllowDummy);
+ }
+ }
+ }
+ }
#ifdef OLD
- uint8 TrackNumber = MuxedFile.GetTrackNumber();
-
- TrackInfo *Tracks = new TrackInfo[TrackNumber];
- TrackInfoAudio aAudioTrack;
- TrackInfoVideo aVideoTrack;
-
- Track * track1 = MuxedFile.GetTrack(1);
- Track * track2 = MuxedFile.GetTrack(2);
- Track * track3 = MuxedFile.GetTrack(3); // should be 0
- // get information about the 1st track
-
- MuxedFile.Track_GetInfo(track1, Tracks[0]);
- displayTrackInfo(Tracks[0]);
-
- if (Tracks[0].TrackType == track_audio) {
- MuxedFile.Track_GetInfo_Audio(track1, aAudioTrack);
- displayAudioInfo(aAudioTrack);
- }
- else
- cout << "the expected audio track is not an audio one :(" << endl;
-
- MuxedFile.Track_GetInfo(track3, Tracks[2]);
- displayTrackInfo(Tracks[2]);
-
- if (Tracks[2].TrackType == track_video) {
- MuxedFile.Track_GetInfo_Video(track3, aVideoTrack);
- displayVideoInfo(aVideoTrack);
- }
- else
- cout << "the expected video track is not an video one :(" << endl;
-
- // let's read only track1 (audio)
- MuxedFile.SelectReadingTrack(track1);
- MuxedFile.SelectReadingTrack(track2);
- MuxedFile.SelectReadingTrack(track1,false);
- MuxedFile.SelectReadingTrack(track1);
- MuxedFile.SelectReadingTrack(track2,false);
- MuxedFile.SelectReadingTrack(track2);
- MuxedFile.SelectReadingTrack(track3);
-
- // read the frames from the selected tracks and put them in an output file
- StdIOCallback Output_file1("out-binr.bin", MODE_CREATE);
- StdIOCallback Output_file2("out-text.bin", MODE_CREATE);
- StdIOCallback Output_file3("out-vide.bin", MODE_CREATE);
-
- Track * TrackRead;
- uint32 timecode; // not used yet
- binary *aFrame;
- uint32 aFrameSize;
- while (MuxedFile.ReadFrame(TrackRead, timecode, aFrame, aFrameSize))
- {
- if (TrackRead == track1)
- {
- Output_file1.write(aFrame, aFrameSize);
- }
- else if (TrackRead == track2)
- {
- Output_file2.write(aFrame, aFrameSize);
- }
- else if (TrackRead == track3)
- {
- Output_file3.write(aFrame, aFrameSize);
- }
- else cout << "received a frame from an unwanted track" << endl;
- }
+ uint8 TrackNumber = MuxedFile.GetTrackNumber();
+
+ TrackInfo *Tracks = new TrackInfo[TrackNumber];
+ TrackInfoAudio aAudioTrack;
+ TrackInfoVideo aVideoTrack;
+
+ Track * track1 = MuxedFile.GetTrack(1);
+ Track * track2 = MuxedFile.GetTrack(2);
+ Track * track3 = MuxedFile.GetTrack(3); // should be 0
+ // get information about the 1st track
+
+ MuxedFile.Track_GetInfo(track1, Tracks[0]);
+ displayTrackInfo(Tracks[0]);
+
+ if (Tracks[0].TrackType == track_audio) {
+ MuxedFile.Track_GetInfo_Audio(track1, aAudioTrack);
+ displayAudioInfo(aAudioTrack);
+ }
+ else
+ cout << "the expected audio track is not an audio one :(" << endl;
+
+ MuxedFile.Track_GetInfo(track3, Tracks[2]);
+ displayTrackInfo(Tracks[2]);
+
+ if (Tracks[2].TrackType == track_video) {
+ MuxedFile.Track_GetInfo_Video(track3, aVideoTrack);
+ displayVideoInfo(aVideoTrack);
+ }
+ else
+ cout << "the expected video track is not an video one :(" << endl;
+
+ // let's read only track1 (audio)
+ MuxedFile.SelectReadingTrack(track1);
+ MuxedFile.SelectReadingTrack(track2);
+ MuxedFile.SelectReadingTrack(track1,false);
+ MuxedFile.SelectReadingTrack(track1);
+ MuxedFile.SelectReadingTrack(track2,false);
+ MuxedFile.SelectReadingTrack(track2);
+ MuxedFile.SelectReadingTrack(track3);
+
+ // read the frames from the selected tracks and put them in an output file
+ StdIOCallback Output_file1("out-binr.bin", MODE_CREATE);
+ StdIOCallback Output_file2("out-text.bin", MODE_CREATE);
+ StdIOCallback Output_file3("out-vide.bin", MODE_CREATE);
+
+ Track * TrackRead;
+ uint32 timecode; // not used yet
+ binary *aFrame;
+ uint32 aFrameSize;
+ while (MuxedFile.ReadFrame(TrackRead, timecode, aFrame, aFrameSize))
+ {
+ if (TrackRead == track1)
+ {
+ Output_file1.write(aFrame, aFrameSize);
+ }
+ else if (TrackRead == track2)
+ {
+ Output_file2.write(aFrame, aFrameSize);
+ }
+ else if (TrackRead == track3)
+ {
+ Output_file3.write(aFrame, aFrameSize);
+ }
+ else cout << "received a frame from an unwanted track" << endl;
+ }
#endif // OLD
}
catch (exception & Ex)
{
- cout << Ex.what() << endl;
- return -1;
+ cout << Ex.what() << endl;
+ return -1;
}
return 0;
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
EbmlHead head;
KaxSegment segment;
StdIOCallback out("test.mkv", MODE_CREATE);
-
+
EDocType &doc_type = GetChild<EDocType>(head);
*static_cast<EbmlString *>(&doc_type) = "matroska";
EDocTypeVersion &doc_type_ver = GetChild<EDocTypeVersion>(head);
1234;
#if 0
- // comment of the Targets
+ // comment of the Targets
KaxTagMultiComment &mcomB = GetChild<KaxTagMultiComment>(targets);
*(static_cast<EbmlString *>
(&GetChild<KaxTagMultiCommentName>(mcomB))) =
(&GetChild<KaxTagArchivalLocation>(general))) =
L"ArchivalLocation";
KaxTagKeywords &keywords1 = GetChild<KaxTagKeywords>(general);
- *(static_cast<EbmlUnicodeString *>(&keywords1)) =
+ *(static_cast<EbmlUnicodeString *>(&keywords1)) =
L"Keywords, 1";
*(static_cast<EbmlUnicodeString *>
(&GetNextChild<KaxTagKeywords>(general, keywords1))) =
L"Mood";
KaxTagRecordLocation &recordLocation1 =
GetChild<KaxTagRecordLocation>(general);
- *(static_cast<EbmlString *>(&recordLocation1)) =
+ *(static_cast<EbmlString *>(&recordLocation1)) =
"RecordLocation, 1";
*(static_cast<EbmlString *>
(&GetNextChild<KaxTagRecordLocation>(general, recordLocation1))) =
*(static_cast<EbmlFloat *>
(&GetChild<KaxTagMultiPriceAmount>(mprice))) =
42.0;
- KaxTagMultiPricePriceDate &pdate =
+ KaxTagMultiPricePriceDate &pdate =
GetChild<KaxTagMultiPricePriceDate>(mprice);
pdate.SetEpochDate(time(NULL));
*(static_cast<EbmlUInteger *>
(&GetChild<KaxTagMultiDateType>(date))) =
4;
- KaxTagMultiDateDateBegin &dbeg =
+ KaxTagMultiDateDateBegin &dbeg =
GetChild<KaxTagMultiDateDateBegin>(date);
dbeg.SetEpochDate(time(NULL));
- KaxTagMultiDateDateEnd &dend =
+ KaxTagMultiDateDateEnd &dend =
GetChild<KaxTagMultiDateDateEnd>(date);
dend.SetEpochDate(time(NULL));
L"SIMPLE_TAG_NAME_LEVEL3";
*(static_cast<EbmlUnicodeString *>(&GetChild<KaxTagString>(stag_l3))) =
L"SIMPLE_TAG_STRING_LEVEL3";
-
+
tags.Render(out);
} catch (...) {
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
using namespace std;
/*!
- \see http://www.unicode.org/charts/
- \see http://www-106.ibm.com/developerworks/linux/library/l-linuni.html
- \see http://www.cl.cam.ac.uk/~mgk25/unicode.html#libs
- \see ftp://ftp.ilog.fr/pub/Users/haible/utf8/Unicode-HOWTO-6.html#ss6.1
+ \see http://www.unicode.org/charts/
+ \see http://www-106.ibm.com/developerworks/linux/library/l-linuni.html
+ \see http://www.cl.cam.ac.uk/~mgk25/unicode.html#libs
+ \see ftp://ftp.ilog.fr/pub/Users/haible/utf8/Unicode-HOWTO-6.html#ss6.1
*/
int main(void)
{
testUTF8_1 = test1.c_str();
TruncString8 testUTF8_2(10);
- testUTF8_2 = test2.c_str();
+ testUTF8_2 = test2.c_str();
// in UTF8 0xE8=1110-1000 should become 110.00110-10.001000=0xC6 0x88
FileName test01(64);