cosmetics: use spaces instead of tab characters; remove trailing whitespace

This commit is contained in:
Moritz Bunkus 2014-12-19 00:06:34 +01:00
parent 4a7222ce81
commit ff6e0db2fe
55 changed files with 3421 additions and 3421 deletions

View File

@ -18,7 +18,7 @@ LIB matroska
FAVOR_MAX_SPEED . FAVOR_MAX_SPEED .
REDUCE_SIZE . REDUCE_SIZE .
FASTER_FLOAT . FASTER_FLOAT .
SOURCE src/FileKax.cpp SOURCE src/FileKax.cpp
SOURCE src/KaxAttached.cpp SOURCE src/KaxAttached.cpp
SOURCE src/KaxAttachments.cpp SOURCE src/KaxAttachments.cpp

View File

@ -21,7 +21,7 @@ REPEAT_BRIEF = YES
ALWAYS_DETAILED_SEC = NO ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = YES INLINE_INHERITED_MEMB = YES
FULL_PATH_NAMES = NO FULL_PATH_NAMES = NO
STRIP_FROM_PATH = STRIP_FROM_PATH =
INTERNAL_DOCS = NO INTERNAL_DOCS = NO
CASE_SENSE_NAMES = YES CASE_SENSE_NAMES = YES
SHORT_NAMES = NO SHORT_NAMES = NO
@ -40,8 +40,8 @@ GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES GENERATE_DEPRECATEDLIST= YES
ALIASES = ALIASES =
ENABLED_SECTIONS = ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30 MAX_INITIALIZER_LINES = 30
OPTIMIZE_OUTPUT_FOR_C = NO OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_JAVA = NO OPTIMIZE_OUTPUT_JAVA = NO
@ -54,7 +54,7 @@ WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES WARN_IF_DOC_ERROR = YES
WARN_FORMAT = "$file:$line: $text" WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE = WARN_LOGFILE =
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# configuration options related to the input files # configuration options related to the input files
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
@ -68,14 +68,14 @@ INPUT = ../../libebml/src \
FILE_PATTERNS = *.cpp \ FILE_PATTERNS = *.cpp \
*.h *.h
RECURSIVE = NO RECURSIVE = NO
EXCLUDE = EXCLUDE =
EXCLUDE_SYMLINKS = NO EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS = EXCLUDE_PATTERNS =
EXAMPLE_PATH = EXAMPLE_PATH =
EXAMPLE_PATTERNS = EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = NO EXAMPLE_RECURSIVE = NO
IMAGE_PATH = IMAGE_PATH =
INPUT_FILTER = INPUT_FILTER =
FILTER_SOURCE_FILES = NO FILTER_SOURCE_FILES = NO
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# configuration options related to source browsing # configuration options related to source browsing
@ -90,20 +90,20 @@ REFERENCES_RELATION = YES
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
ALPHABETICAL_INDEX = NO ALPHABETICAL_INDEX = NO
COLS_IN_ALPHA_INDEX = 5 COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX = IGNORE_PREFIX =
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# configuration options related to the HTML output # configuration options related to the HTML output
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
GENERATE_HTML = YES GENERATE_HTML = YES
HTML_OUTPUT = html HTML_OUTPUT = html
HTML_FILE_EXTENSION = .html HTML_FILE_EXTENSION = .html
HTML_HEADER = HTML_HEADER =
HTML_FOOTER = HTML_FOOTER =
HTML_STYLESHEET = libmatroska.css HTML_STYLESHEET = libmatroska.css
HTML_ALIGN_MEMBERS = YES HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO GENERATE_HTMLHELP = NO
CHM_FILE = CHM_FILE =
HHC_LOCATION = HHC_LOCATION =
GENERATE_CHI = NO GENERATE_CHI = NO
BINARY_TOC = NO BINARY_TOC = NO
TOC_EXPAND = NO TOC_EXPAND = NO
@ -120,8 +120,8 @@ LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = YES COMPACT_LATEX = YES
PAPER_TYPE = a4wide PAPER_TYPE = a4wide
EXTRA_PACKAGES = EXTRA_PACKAGES =
LATEX_HEADER = LATEX_HEADER =
PDF_HYPERLINKS = YES PDF_HYPERLINKS = YES
USE_PDFLATEX = YES USE_PDFLATEX = YES
LATEX_BATCHMODE = NO LATEX_BATCHMODE = NO
@ -133,8 +133,8 @@ GENERATE_RTF = YES
RTF_OUTPUT = rtf RTF_OUTPUT = rtf
COMPACT_RTF = NO COMPACT_RTF = NO
RTF_HYPERLINKS = YES RTF_HYPERLINKS = YES
RTF_STYLESHEET_FILE = RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE = RTF_EXTENSIONS_FILE =
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# configuration options related to the man page output # configuration options related to the man page output
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
@ -146,8 +146,8 @@ MAN_LINKS = YES
# configuration options related to the XML output # configuration options related to the XML output
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
GENERATE_XML = NO GENERATE_XML = NO
XML_SCHEMA = XML_SCHEMA =
XML_DTD = XML_DTD =
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output # configuration options for the AutoGen Definitions output
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
@ -158,29 +158,29 @@ GENERATE_AUTOGEN_DEF = NO
GENERATE_PERLMOD = NO GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX = PERLMOD_MAKEVAR_PREFIX =
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Configuration options related to the preprocessor # Configuration options related to the preprocessor
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES SEARCH_INCLUDES = YES
INCLUDE_PATH = INCLUDE_PATH =
INCLUDE_FILE_PATTERNS = INCLUDE_FILE_PATTERNS =
PREDEFINED = PREDEFINED =
EXPAND_AS_DEFINED = EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES SKIP_FUNCTION_MACROS = YES
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Configuration::addtions related to external references # Configuration::addtions related to external references
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
TAGFILES = TAGFILES =
GENERATE_TAGFILE = GENERATE_TAGFILE =
ALLEXTERNALS = NO ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl PERL_PATH = /usr/bin/perl
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Configuration options related to the dot tool # Configuration options related to the dot tool
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
CLASS_DIAGRAMS = YES CLASS_DIAGRAMS = YES
HIDE_UNDOC_RELATIONS = YES HIDE_UNDOC_RELATIONS = YES
@ -192,20 +192,20 @@ INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES INCLUDED_BY_GRAPH = YES
GRAPHICAL_HIERARCHY = YES GRAPHICAL_HIERARCHY = YES
DOT_IMAGE_FORMAT = png DOT_IMAGE_FORMAT = png
DOT_PATH = DOT_PATH =
DOTFILE_DIRS = DOTFILE_DIRS =
MAX_DOT_GRAPH_WIDTH = 1024 MAX_DOT_GRAPH_WIDTH = 1024
MAX_DOT_GRAPH_HEIGHT = 1024 MAX_DOT_GRAPH_HEIGHT = 1024
MAX_DOT_GRAPH_DEPTH = 0 MAX_DOT_GRAPH_DEPTH = 0
GENERATE_LEGEND = YES GENERATE_LEGEND = YES
DOT_CLEANUP = YES DOT_CLEANUP = YES
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Configuration::addtions related to the search engine # Configuration::addtions related to the search engine
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
SEARCHENGINE = NO SEARCHENGINE = NO
CGI_NAME = search.cgi CGI_NAME = search.cgi
CGI_URL = CGI_URL =
DOC_URL = DOC_URL =
DOC_ABSPATH = DOC_ABSPATH =
BIN_ABSPATH = /usr/local/bin/ BIN_ABSPATH = /usr/local/bin/
EXT_DOC_PATHS = EXT_DOC_PATHS =

View File

@ -151,7 +151,7 @@ test9: test9.o $(LIBRARY) $(LIBRARY_SO)
test9.o: $(TAG_SRC_DIR)test9.cpp test9.o: $(TAG_SRC_DIR)test9.cpp
$(CXX) -c $(COMPILEFLAGS) -o $@ $< $(CXX) -c $(COMPILEFLAGS) -o $@ $<
install: $(targets_$(link):%=install_%) install_headers install: $(targets_$(link):%=install_%) install_headers
install_headers: install_headers:
$(INSTALL) $(INSTALL_DIR_OPTS) -d $(DESTDIR)$(includedir) $(INSTALL) $(INSTALL_DIR_OPTS) -d $(DESTDIR)$(includedir)

View File

@ -21,7 +21,7 @@ DEPEND = makedepend
INDENT =indent --gnu-style -ut -ts6 -br -npsl -npcs INDENT =indent --gnu-style -ut -ts6 -br -npsl -npcs
DELETE =rm -f 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} DEBUG_CFLAGS = -g -O0 -DDEBUG ${GLOBAL_CFLAGS}
RELEASE_CFLAGS = -O2 ${GLOBAL_CFLAGS} RELEASE_CFLAGS = -O2 ${GLOBAL_CFLAGS}

View File

@ -17,7 +17,7 @@ OBJ = $(patsubst %.cpp,%.obj,$(SRC))
INCS = /I../.. /I$(EBML_DIR) INCS = /I../.. /I$(EBML_DIR)
LDFLAGS = /NOLOGO /DLL /MAP:libmatroska.map /LIBPATH:$(EBML_DIR)/make/vc7 /VERSION:0.7 LDFLAGS = /NOLOGO /DLL /MAP:libmatroska.map /LIBPATH:$(EBML_DIR)/make/vc7 /VERSION:0.7
OPTMIZ = /G6 /O2 /Oi /GL /Wp64 OPTMIZ = /G6 /O2 /Oi /GL /Wp64
CXXFLAGS = $(INCS) /DWIN32 /nologo /DEBML_DLL CXXFLAGS = $(INCS) /DWIN32 /nologo /DEBML_DLL
ifeq (yes,$(DEBUG)) ifeq (yes,$(DEBUG))

View File

@ -11,12 +11,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -28,9 +28,9 @@
**********************************************************************/ **********************************************************************/
/*! /*!
\file \file
\version \$Id: FileKax.h,v 1.5 2004/04/14 23:26:17 robux4 Exp $ \version \$Id: FileKax.h,v 1.5 2004/04/14 23:26:17 robux4 Exp $
\author Steve Lhomme <robux4 @ users.sf.net> \author Steve Lhomme <robux4 @ users.sf.net>
*/ */
#ifndef LIBMATROSKA_FILE_H #ifndef LIBMATROSKA_FILE_H
#define LIBMATROSKA_FILE_H #define LIBMATROSKA_FILE_H
@ -60,90 +60,90 @@ START_LIBMATROSKA_NAMESPACE
*/ */
class MATROSKA_DLL_API FileMatroska { class MATROSKA_DLL_API FileMatroska {
public: public:
FileMatroska(IOCallback & output); FileMatroska(IOCallback & output);
~FileMatroska(); ~FileMatroska();
#ifdef OLD #ifdef OLD
filepos_t RenderHead(const std::string & aEncoderApp); filepos_t RenderHead(const std::string & aEncoderApp);
uint32 ReadHead(); uint32 ReadHead();
uint32 ReadTracks(); uint32 ReadTracks();
uint32 ReadCodec(); uint32 ReadCodec();
void Close(const uint32 aTimeLength); void Close(const uint32 aTimeLength);
inline void type_SetInfo(const std::string & aStr) {myMainHeader.type_SetInfo(aStr);} 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_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(const std::string & aStr) {myMainHeader.type_SetSize(aStr);}
inline void type_SetSize(uint64 aSize) {myMainHeader.type_SetSize(aSize);} inline void type_SetSize(uint64 aSize) {myMainHeader.type_SetSize(aSize);}
inline uint8 GetTrackNumber() const { return myTracks.size(); } inline uint8 GetTrackNumber() const { return myTracks.size(); }
void track_SetName(Track * aTrack, const std::string & aName); void track_SetName(Track * aTrack, const std::string & aName);
void track_SetLaced(Track * aTrack, bool bLaced = true); void track_SetLaced(Track * aTrack, bool bLaced = true);
Track * CreateTrack(const track_type aType); Track * CreateTrack(const track_type aType);
inline Track * GetTrack(const uint8 aTrackNb) const inline Track * GetTrack(const uint8 aTrackNb) const
{ {
if (aTrackNb > myTracks.size()) if (aTrackNb > myTracks.size())
return NULL; return NULL;
else else
return myTracks[aTrackNb-1]; return myTracks[aTrackNb-1];
} }
void Track_GetInfo(const Track * aTrack, TrackInfo & aTrackInfo) const; 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_SetInfo_Audio(Track * aTrack, const TrackInfoAudio & aTrackInfo);
void Track_GetInfo_Video(const Track * aTrack, TrackInfoVideo & aTrackInfo) const; void Track_GetInfo_Audio(const Track * aTrack, TrackInfoAudio & aTrackInfo) const;
void SelectReadingTrack(Track * aTrack, bool select = true); 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 \return wether the frame has been added or not
*/ */
bool ReadFrame(Track * & aTrack, uint32 & aTimecode, const binary * & aFrame, uint32 & aFrameSize, bool AddFrame(Track * aTrack, const uint32 aTimecode, const binary *aFrame, const uint32 aFrameSize,
bool & aKeyFrame, bool & aBFrame); bool aKeyFrame = true, bool aBFrame = false);
/* /*!
Render the pending cluster to file \return wether the frame has been read or not
*/ */
void Flush(); bool ReadFrame(Track * & aTrack, uint32 & aTimecode, const binary * & aFrame, uint32 & aFrameSize,
bool & aKeyFrame, bool & aBFrame);
void SetMaxClusterSize(const uint32 value); /*
void SetMinClusterSize(const uint32 value) {myMinClusterSize = value;} Render the pending cluster to file
*/
void Flush();
void SetMaxClusterSize(const uint32 value);
void SetMinClusterSize(const uint32 value) {myMinClusterSize = value;}
protected: protected:
MainHeader myMainHeader; MainHeader myMainHeader;
std::vector<Track *> myTracks; std::vector<Track *> myTracks;
std::vector<uint8> mySelectedTracks; std::vector<uint8> mySelectedTracks;
// Track *findTrack(Track * aTrack) const; // Track *findTrack(Track * aTrack) const;
Cluster myCurrWriteCluster; /// \todo merge with the write one ? Cluster myCurrWriteCluster; /// \todo merge with the write one ?
uint32 myReadBlockNumber; uint32 myReadBlockNumber;
Cluster myCurrReadCluster; Cluster myCurrReadCluster;
binary * myCurrReadBlock; ///< The buffer containing the current read block binary * myCurrReadBlock; ///< The buffer containing the current read block
uint32 myCurrReadBlockSize; ///< The size of 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 uint8 myCurrReadBlockTrack; ///< The track number of the current track to read
uint32 myMaxClusterSize; uint32 myMaxClusterSize;
uint32 myMinClusterSize; uint32 myMinClusterSize;
StreamInfo myStreamInfo; StreamInfo myStreamInfo;
CodecHeader myCodecHeader; CodecHeader myCodecHeader;
inline bool IsMyTrack(const Track * aTrack) const; inline bool IsMyTrack(const Track * aTrack) const;
inline bool IsReadingTrack(const uint8 aTrackNum) const; inline bool IsReadingTrack(const uint8 aTrackNum) const;
#endif // OLD #endif // OLD
IOCallback & myFile; IOCallback & myFile;
}; };

View File

@ -11,12 +11,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -28,9 +28,9 @@
**********************************************************************/ **********************************************************************/
/*! /*!
\file \file
\version \$Id: KaxAttached.h,v 1.8 2004/04/14 23:26:17 robux4 Exp $ \version \$Id: KaxAttached.h,v 1.8 2004/04/14 23:26:17 robux4 Exp $
\author Steve Lhomme <robux4 @ users.sf.net> \author Steve Lhomme <robux4 @ users.sf.net>
*/ */
#ifndef LIBMATROSKA_ATTACHED_H #ifndef LIBMATROSKA_ATTACHED_H
#define LIBMATROSKA_ATTACHED_H #define LIBMATROSKA_ATTACHED_H

View File

@ -11,12 +11,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -28,9 +28,9 @@
**********************************************************************/ **********************************************************************/
/*! /*!
\file \file
\version \$Id: KaxAttachments.h,v 1.8 2004/04/14 23:26:17 robux4 Exp $ \version \$Id: KaxAttachments.h,v 1.8 2004/04/14 23:26:17 robux4 Exp $
\author Steve Lhomme <robux4 @ users.sf.net> \author Steve Lhomme <robux4 @ users.sf.net>
*/ */
#ifndef LIBMATROSKA_ATTACHEMENTS_H #ifndef LIBMATROSKA_ATTACHEMENTS_H
#define LIBMATROSKA_ATTACHEMENTS_H #define LIBMATROSKA_ATTACHEMENTS_H

View File

@ -9,12 +9,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -26,11 +26,11 @@
**********************************************************************/ **********************************************************************/
/*! /*!
\file \file
\todo add a PureBlock class to group functionalities between Block and BlockVirtual \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 $ \version \$Id: KaxBlock.h,v 1.24 2004/04/14 23:26:17 robux4 Exp $
\author Steve Lhomme <robux4 @ users.sf.net> \author Steve Lhomme <robux4 @ users.sf.net>
\author Julien Coloos <suiryc @ users.sf.net> \author Julien Coloos <suiryc @ users.sf.net>
*/ */
#ifndef LIBMATROSKA_BLOCK_H #ifndef LIBMATROSKA_BLOCK_H
#define LIBMATROSKA_BLOCK_H #define LIBMATROSKA_BLOCK_H
@ -53,259 +53,259 @@ class KaxInternalBlock;
class KaxBlockBlob; class KaxBlockBlob;
class MATROSKA_DLL_API DataBuffer { class MATROSKA_DLL_API DataBuffer {
protected: protected:
binary * myBuffer; binary * myBuffer;
uint32 mySize; uint32 mySize;
bool bValidValue; bool bValidValue;
bool (*myFreeBuffer)(const DataBuffer & aBuffer); // method to free the internal buffer bool (*myFreeBuffer)(const DataBuffer & aBuffer); // method to free the internal buffer
bool bInternalBuffer; bool bInternalBuffer;
public: public:
DataBuffer(binary * aBuffer, uint32 aSize, bool (*aFreeBuffer)(const DataBuffer & aBuffer) = NULL, bool _bInternalBuffer = false) DataBuffer(binary * aBuffer, uint32 aSize, bool (*aFreeBuffer)(const DataBuffer & aBuffer) = NULL, bool _bInternalBuffer = false)
:myBuffer(NULL) :myBuffer(NULL)
,mySize(aSize) ,mySize(aSize)
,bValidValue(true) ,bValidValue(true)
,myFreeBuffer(aFreeBuffer) ,myFreeBuffer(aFreeBuffer)
,bInternalBuffer(_bInternalBuffer) ,bInternalBuffer(_bInternalBuffer)
{ {
if (bInternalBuffer) if (bInternalBuffer)
{ {
myBuffer = new (std::nothrow) binary[mySize]; myBuffer = new (std::nothrow) binary[mySize];
if (myBuffer == NULL) if (myBuffer == NULL)
bValidValue = false; bValidValue = false;
else else
memcpy(myBuffer, aBuffer, mySize); memcpy(myBuffer, aBuffer, mySize);
} }
else else
myBuffer = aBuffer; myBuffer = aBuffer;
} }
virtual ~DataBuffer() {} virtual ~DataBuffer() {}
virtual binary * Buffer() {assert(bValidValue); return myBuffer;} virtual binary * Buffer() {assert(bValidValue); return myBuffer;}
virtual uint32 & Size() {return mySize;}; virtual uint32 & Size() {return mySize;};
virtual const binary * Buffer() const {assert(bValidValue); return myBuffer;} virtual const binary * Buffer() const {assert(bValidValue); return myBuffer;}
virtual uint32 Size() const {return mySize;}; virtual uint32 Size() const {return mySize;};
bool FreeBuffer(const DataBuffer & aBuffer) { bool FreeBuffer(const DataBuffer & aBuffer) {
bool bResult = true; bool bResult = true;
if (myBuffer != NULL && bValidValue) { if (myBuffer != NULL && bValidValue) {
if (myFreeBuffer != NULL) if (myFreeBuffer != NULL)
bResult = myFreeBuffer(aBuffer); bResult = myFreeBuffer(aBuffer);
if (bInternalBuffer) if (bInternalBuffer)
delete [] myBuffer; delete [] myBuffer;
myBuffer = NULL; myBuffer = NULL;
mySize = 0; mySize = 0;
bValidValue = false; bValidValue = false;
} }
return bResult; return bResult;
} }
virtual DataBuffer * Clone(); virtual DataBuffer * Clone();
}; };
class MATROSKA_DLL_API SimpleDataBuffer : public DataBuffer { class MATROSKA_DLL_API SimpleDataBuffer : public DataBuffer {
public: public:
SimpleDataBuffer(binary * aBuffer, uint32 aSize, uint32 aOffset, bool (*aFreeBuffer)(const DataBuffer & aBuffer) = myFreeBuffer) SimpleDataBuffer(binary * aBuffer, uint32 aSize, uint32 aOffset, bool (*aFreeBuffer)(const DataBuffer & aBuffer) = myFreeBuffer)
:DataBuffer(aBuffer + aOffset, aSize, aFreeBuffer) :DataBuffer(aBuffer + aOffset, aSize, aFreeBuffer)
,Offset(aOffset) ,Offset(aOffset)
,BaseBuffer(aBuffer) ,BaseBuffer(aBuffer)
{} {}
virtual ~SimpleDataBuffer() {} virtual ~SimpleDataBuffer() {}
DataBuffer * Clone() {return new SimpleDataBuffer(*this);} DataBuffer * Clone() {return new SimpleDataBuffer(*this);}
protected: protected:
uint32 Offset; uint32 Offset;
binary * BaseBuffer; binary * BaseBuffer;
static bool myFreeBuffer(const DataBuffer & aBuffer) static bool myFreeBuffer(const DataBuffer & aBuffer)
{ {
binary *_Buffer = static_cast<const SimpleDataBuffer*>(&aBuffer)->BaseBuffer; binary *_Buffer = static_cast<const SimpleDataBuffer*>(&aBuffer)->BaseBuffer;
if (_Buffer != NULL) if (_Buffer != NULL)
free(_Buffer); free(_Buffer);
return true; return true;
} }
SimpleDataBuffer(const SimpleDataBuffer & ToClone); 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 { class MATROSKA_DLL_API NotSoSimpleDataBuffer : public SimpleDataBuffer {
public: public:
NotSoSimpleDataBuffer(binary * aBuffer, uint32 aSize, uint32 aOffset) NotSoSimpleDataBuffer(binary * aBuffer, uint32 aSize, uint32 aOffset)
:SimpleDataBuffer(new binary[aSize - aOffset], aSize, 0) :SimpleDataBuffer(new binary[aSize - aOffset], aSize, 0)
{ {
memcpy(BaseBuffer, aBuffer + aOffset, aSize - aOffset); memcpy(BaseBuffer, aBuffer + aOffset, aSize - aOffset);
} }
}; };
*/ */
DECLARE_MKX_MASTER(KaxBlockGroup) DECLARE_MKX_MASTER(KaxBlockGroup)
public: public:
~KaxBlockGroup(); ~KaxBlockGroup();
/*! /*!
\brief Addition of a frame without references \brief Addition of a frame without references
*/ */
bool AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, LacingType lacing = LACING_AUTO); bool AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, LacingType lacing = LACING_AUTO);
/*! /*!
\brief Addition of a frame with a backward reference (P frame) \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); 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) \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 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); bool AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, const KaxBlockBlob * PastBlock, const KaxBlockBlob * ForwBlock, LacingType lacing = LACING_AUTO);
void SetParent(KaxCluster & aParentCluster); void SetParent(KaxCluster & aParentCluster);
void SetParentTrack(const KaxTrackEntry & aParentTrack) { void SetParentTrack(const KaxTrackEntry & aParentTrack) {
ParentTrack = &aParentTrack; ParentTrack = &aParentTrack;
} }
/*! /*!
\brief Set the duration of the contained frame(s) (for the total number of frames) \brief Set the duration of the contained frame(s) (for the total number of frames)
*/ */
void SetBlockDuration(uint64 TimeLength); void SetBlockDuration(uint64 TimeLength);
bool GetBlockDuration(uint64 &TheTimecode) const; bool GetBlockDuration(uint64 &TheTimecode) const;
/*! /*!
\return the global timecode of this Block (not just the delta to the Cluster) \return the global timecode of this Block (not just the delta to the Cluster)
*/ */
uint64 GlobalTimecode() const; uint64 GlobalTimecode() const;
uint64 GlobalTimecodeScale() const { uint64 GlobalTimecodeScale() const {
assert(ParentTrack != NULL); assert(ParentTrack != NULL);
return ParentTrack->GlobalTimecodeScale(); return ParentTrack->GlobalTimecodeScale();
} }
uint16 TrackNumber() const; uint16 TrackNumber() const;
uint64 ClusterPosition() 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 \return the number of references to other frames
*/ */
void ReleaseFrames(); unsigned int ReferenceCount() const;
const KaxReferenceBlock & Reference(unsigned int Index) const;
operator KaxInternalBlock &(); /*!
\brief release all the frames of all Blocks
*/
void ReleaseFrames();
const KaxCluster *GetParentCluster() const { return ParentCluster; } operator KaxInternalBlock &();
protected: const KaxCluster *GetParentCluster() const { return ParentCluster; }
KaxCluster * ParentCluster;
const KaxTrackEntry * ParentTrack; protected:
KaxCluster * ParentCluster;
const KaxTrackEntry * ParentTrack;
}; };
class KaxInternalBlock : public EbmlBinary { class KaxInternalBlock : public EbmlBinary {
public: 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) 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) ,ParentCluster(NULL), bIsSimple(bSimple), bIsKeyframe(true), bIsDiscardable(false)
{} {}
KaxInternalBlock(const KaxInternalBlock & ElementToClone); KaxInternalBlock(const KaxInternalBlock & ElementToClone);
~KaxInternalBlock(); ~KaxInternalBlock();
virtual bool ValidateSize() const; virtual bool ValidateSize() const;
uint16 TrackNum() const {return TrackNumber;} uint16 TrackNum() const {return TrackNumber;}
/*! /*!
\todo !!!! This method needs to be changes ! \todo !!!! This method needs to be changes !
*/ */
uint64 GlobalTimecode() const {return Timecode;} uint64 GlobalTimecode() const {return Timecode;}
/*! /*!
\note override this function to generate the Data/Size on the fly, unlike the usual binary elements \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 UpdateSize(bool bSaveDefault = false, bool bForceRender = false);
filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA); 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 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();}
\brief release all the frames of all Blocks DataBuffer & GetBuffer(unsigned int iIndex) {return *myBuffers[iIndex];}
*/
void ReleaseFrames();
void SetParent(KaxCluster & aParentCluster); bool AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, LacingType lacing = LACING_AUTO, bool invisible = false);
/*! /*!
\return Returns the lacing type that produces the smallest footprint. \brief release all the frames of all Blocks
*/ */
LacingType GetBestLacingType() const; void ReleaseFrames();
/*! void SetParent(KaxCluster & aParentCluster);
\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 Returns the lacing type that produces the smallest footprint.
\return the size of a given frame */
\note return -1 if the position doesn't exist LacingType GetBestLacingType() const;
*/
int64 GetFrameSize(size_t FrameNumber = 0);
bool IsInvisible() const { return mInvisible; }
uint64 ClusterPosition() 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);
protected: /*!
std::vector<DataBuffer *> myBuffers; \param FrameNumber 0 for the first frame
std::vector<int32> SizeList; \return the size of a given frame
uint64 Timecode; // temporary timecode of the first frame, non scaled \note return -1 if the position doesn't exist
int16 LocalTimecode; */
bool bLocalTimecodeUsed; int64 GetFrameSize(size_t FrameNumber = 0);
uint16 TrackNumber;
LacingType mLacing;
bool mInvisible;
uint64 FirstFrameLocation;
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault = false); bool IsInvisible() const { return mInvisible; }
KaxCluster * ParentCluster; uint64 ClusterPosition() const;
bool bIsSimple;
bool bIsKeyframe; protected:
bool bIsDiscardable; 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); DECLARE_MKX_CONTEXT(KaxBlock);
class MATROSKA_DLL_API KaxBlock : public KaxInternalBlock { class MATROSKA_DLL_API KaxBlock : public KaxInternalBlock {
public: public:
KaxBlock(EBML_EXTRA_PARAM) :KaxInternalBlock(EBML_DEF_BINARY_CTX(KaxBlock)EBML_DEF_SEP false EBML_DEF_SEP EBML_EXTRA_CALL) {} KaxBlock(EBML_EXTRA_PARAM) :KaxInternalBlock(EBML_DEF_BINARY_CTX(KaxBlock)EBML_DEF_SEP false EBML_DEF_SEP EBML_EXTRA_CALL) {}
EBML_CONCRETE_CLASS(KaxBlock) EBML_CONCRETE_CLASS(KaxBlock)
}; };
#if MATROSKA_VERSION >= 2 #if MATROSKA_VERSION >= 2
DECLARE_MKX_CONTEXT(KaxSimpleBlock); DECLARE_MKX_CONTEXT(KaxSimpleBlock);
class MATROSKA_DLL_API KaxSimpleBlock : public KaxInternalBlock { class MATROSKA_DLL_API KaxSimpleBlock : public KaxInternalBlock {
public: public:
KaxSimpleBlock(EBML_EXTRA_PARAM) :KaxInternalBlock(EBML_DEF_BINARY_CTX(KaxSimpleBlock)EBML_DEF_SEP true EBML_DEF_SEP EBML_EXTRA_CALL) {} 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 SetKeyframe(bool b_keyframe) { bIsKeyframe = b_keyframe; }
void SetDiscardable(bool b_discard) { bIsDiscardable = b_discard; } void SetDiscardable(bool b_discard) { bIsDiscardable = b_discard; }
bool IsKeyframe() const { return bIsKeyframe; } bool IsKeyframe() const { return bIsKeyframe; }
bool IsDiscardable() const { return bIsDiscardable; } bool IsDiscardable() const { return bIsDiscardable; }
void SetParent(KaxCluster & aParentCluster); void SetParent(KaxCluster & aParentCluster);
EBML_CONCRETE_CLASS(KaxSimpleBlock) EBML_CONCRETE_CLASS(KaxSimpleBlock)
}; };
@ -314,72 +314,72 @@ class MATROSKA_DLL_API KaxSimpleBlock : public KaxInternalBlock {
/// Placeholder class for either a BlockGroup or a SimpleBlock /// Placeholder class for either a BlockGroup or a SimpleBlock
class MATROSKA_DLL_API KaxBlockBlob { class MATROSKA_DLL_API KaxBlockBlob {
public: public:
KaxBlockBlob(BlockBlobType sblock_mode) :ParentCluster(NULL), SimpleBlockMode(sblock_mode) { KaxBlockBlob(BlockBlobType sblock_mode) :ParentCluster(NULL), SimpleBlockMode(sblock_mode) {
bUseSimpleBlock = (sblock_mode != BLOCK_BLOB_NO_SIMPLE); bUseSimpleBlock = (sblock_mode != BLOCK_BLOB_NO_SIMPLE);
Block.group = NULL; Block.group = NULL;
} }
~KaxBlockBlob() { ~KaxBlockBlob() {
#if MATROSKA_VERSION >= 2 #if MATROSKA_VERSION >= 2
if (bUseSimpleBlock) if (bUseSimpleBlock)
delete Block.simpleblock; delete Block.simpleblock;
else else
#endif // MATROSKA_VERSION #endif // MATROSKA_VERSION
delete Block.group; delete Block.group;
} }
operator KaxBlockGroup &(); operator KaxBlockGroup &();
operator const KaxBlockGroup &() const; operator const KaxBlockGroup &() const;
#if MATROSKA_VERSION >= 2 #if MATROSKA_VERSION >= 2
operator KaxSimpleBlock &(); operator KaxSimpleBlock &();
#endif #endif
operator KaxInternalBlock &(); operator KaxInternalBlock &();
operator const KaxInternalBlock &() const; operator const KaxInternalBlock &() const;
void SetBlockGroup( KaxBlockGroup &BlockRef ); void SetBlockGroup( KaxBlockGroup &BlockRef );
void SetBlockDuration(uint64 TimeLength); void SetBlockDuration(uint64 TimeLength);
void SetParent(KaxCluster & aParentCluster); 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 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: protected:
KaxCluster * ParentCluster; KaxCluster * ParentCluster;
union { union {
KaxBlockGroup *group; KaxBlockGroup *group;
#if MATROSKA_VERSION >= 2 #if MATROSKA_VERSION >= 2
KaxSimpleBlock *simpleblock; KaxSimpleBlock *simpleblock;
#endif // MATROSKA_VERSION #endif // MATROSKA_VERSION
} Block; } Block;
bool bUseSimpleBlock; bool bUseSimpleBlock;
BlockBlobType SimpleBlockMode; BlockBlobType SimpleBlockMode;
}; };
#if MATROSKA_VERSION >= 2 #if MATROSKA_VERSION >= 2
DECLARE_MKX_BINARY_CONS(KaxBlockVirtual) DECLARE_MKX_BINARY_CONS(KaxBlockVirtual)
public: public:
~KaxBlockVirtual(); ~KaxBlockVirtual();
/*! /*!
\note override this function to generate the Data/Size on the fly, unlike the usual binary elements \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 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 RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA); filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA);
protected: protected:
uint64 Timecode; // temporary timecode of the first frame if there are more than one uint64 Timecode; // temporary timecode of the first frame if there are more than one
uint16 TrackNumber; uint16 TrackNumber;
binary DataBlock[5]; binary DataBlock[5];
const KaxCluster * ParentCluster; const KaxCluster * ParentCluster;
}; };
#endif // MATROSKA_VERSION #endif // MATROSKA_VERSION

View File

@ -9,12 +9,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -26,9 +26,9 @@
**********************************************************************/ **********************************************************************/
/*! /*!
\file \file
\version \$Id: KaxBlockData.h,v 1.10 2004/04/14 23:26:17 robux4 Exp $ \version \$Id: KaxBlockData.h,v 1.10 2004/04/14 23:26:17 robux4 Exp $
\author Steve Lhomme <robux4 @ users.sf.net> \author Steve Lhomme <robux4 @ users.sf.net>
*/ */
#ifndef LIBMATROSKA_BLOCK_ADDITIONAL_H #ifndef LIBMATROSKA_BLOCK_ADDITIONAL_H
#define LIBMATROSKA_BLOCK_ADDITIONAL_H #define LIBMATROSKA_BLOCK_ADDITIONAL_H
@ -45,26 +45,26 @@ using namespace LIBEBML_NAMESPACE;
START_LIBMATROSKA_NAMESPACE START_LIBMATROSKA_NAMESPACE
/*! /*!
\brief element used for B frame-likes \brief element used for B frame-likes
*/ */
DECLARE_MKX_SINTEGER_CONS(KaxReferenceBlock) DECLARE_MKX_SINTEGER_CONS(KaxReferenceBlock)
public: public:
~KaxReferenceBlock(); ~KaxReferenceBlock();
/*! /*!
\brief override this method to compute the timecode value \brief override this method to compute the timecode value
*/ */
virtual filepos_t UpdateSize(bool bSaveDefault = false, bool bForceRender = false); virtual filepos_t UpdateSize(bool bSaveDefault = false, bool bForceRender = false);
const KaxBlockBlob & RefBlock() const; const KaxBlockBlob & RefBlock() const;
void SetReferencedBlock(const KaxBlockBlob * aRefdBlock); void SetReferencedBlock(const KaxBlockBlob * aRefdBlock);
void SetReferencedBlock(const KaxBlockGroup & aRefdBlock); void SetReferencedBlock(const KaxBlockGroup & aRefdBlock);
void SetParentBlock(const KaxBlockGroup & aParentBlock) {ParentBlock = &aParentBlock;} void SetParentBlock(const KaxBlockGroup & aParentBlock) {ParentBlock = &aParentBlock;}
protected: protected:
const KaxBlockBlob * RefdBlock; const KaxBlockBlob * RefdBlock;
const KaxBlockGroup * ParentBlock; const KaxBlockGroup * ParentBlock;
void SetReferencedTimecode(int64 refTimecode) {*static_cast<EbmlSInteger*>(this) = refTimecode; bTimecodeSet = true;}; void SetReferencedTimecode(int64 refTimecode) {*static_cast<EbmlSInteger*>(this) = refTimecode; bTimecodeSet = true;};
bool bTimecodeSet; bool bTimecodeSet;
bool bOurBlob; bool bOurBlob;
void FreeBlob(); void FreeBlob();
}; };

View File

@ -11,12 +11,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -28,9 +28,9 @@
**********************************************************************/ **********************************************************************/
/*! /*!
\file \file
\version \$Id$ \version \$Id$
\author Steve Lhomme <robux4 @ users.sf.net> \author Steve Lhomme <robux4 @ users.sf.net>
*/ */
#ifndef LIBMATROSKA_CHAPTERS_H #ifndef LIBMATROSKA_CHAPTERS_H
#define LIBMATROSKA_CHAPTERS_H #define LIBMATROSKA_CHAPTERS_H

View File

@ -9,12 +9,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -26,10 +26,10 @@
**********************************************************************/ **********************************************************************/
/*! /*!
\file \file
\version \$Id: KaxCluster.h,v 1.10 2004/04/14 23:26:17 robux4 Exp $ \version \$Id: KaxCluster.h,v 1.10 2004/04/14 23:26:17 robux4 Exp $
\author Steve Lhomme <robux4 @ users.sf.net> \author Steve Lhomme <robux4 @ users.sf.net>
\author Julien Coloos <suiryc @ users.sf.net> \author Julien Coloos <suiryc @ users.sf.net>
*/ */
#ifndef LIBMATROSKA_CLUSTER_H #ifndef LIBMATROSKA_CLUSTER_H
@ -49,109 +49,109 @@ START_LIBMATROSKA_NAMESPACE
class KaxSegment; class KaxSegment;
DECLARE_MKX_MASTER_CONS(KaxCluster) DECLARE_MKX_MASTER_CONS(KaxCluster)
public: public:
/*! /*!
\brief Addition of a frame without references \brief Addition of a frame without references
\param the timecode is expressed in nanoseconds, relative to the beggining of the Segment \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); 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) \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 \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); 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) \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 \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); 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 \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); filepos_t Render(IOCallback & output, KaxCues & CueToUpdate, bool bSaveDefault = false);
/*! /*!
\return the global timecode of this Cluster \return the global timecode of this Cluster
*/ */
uint64 GlobalTimecode() const; uint64 GlobalTimecode() const;
KaxBlockGroup & GetNewBlock(); 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 \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
uint64 GetPosition() const; */
void ReleaseFrames();
void SetParent(const KaxSegment & aParentSegment) {ParentSegment = &aParentSegment;} /*!
\brief return the position offset compared to the beggining of the Segment
*/
uint64 GetPosition() const;
void SetPreviousTimecode(uint64 aPreviousTimecode, int64 aTimecodeScale) { void SetParent(const KaxSegment & aParentSegment) {ParentSegment = &aParentSegment;}
bPreviousTimecodeIsSet = true;
PreviousTimecode = aPreviousTimecode;
SetGlobalTimecodeScale(aTimecodeScale);
}
/*! void SetPreviousTimecode(uint64 aPreviousTimecode, int64 aTimecodeScale) {
\note dirty hack to get the mandatory data back after reading bPreviousTimecodeIsSet = true;
\todo there should be a better way to get mandatory data PreviousTimecode = aPreviousTimecode;
*/ SetGlobalTimecodeScale(aTimecodeScale);
void InitTimecode(uint64 aTimecode, int64 aTimecodeScale) { }
SetGlobalTimecodeScale(aTimecodeScale);
MinTimecode = MaxTimecode = PreviousTimecode = aTimecode * TimecodeScale;
bFirstFrameInside = bPreviousTimecodeIsSet = true;
}
int16 GetBlockLocalTimecode(uint64 GlobalTimecode) const; /*!
\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;
}
uint64 GetBlockGlobalTimecode(int16 LocalTimecode); int16 GetBlockLocalTimecode(uint64 GlobalTimecode) const;
void SetGlobalTimecodeScale(uint64 aGlobalTimecodeScale) { uint64 GetBlockGlobalTimecode(int16 LocalTimecode);
TimecodeScale = aGlobalTimecodeScale;
bTimecodeScaleIsSet = true;
}
uint64 GlobalTimecodeScale() const {
assert(bTimecodeScaleIsSet);
return TimecodeScale;
}
bool SetSilentTrackUsed() void SetGlobalTimecodeScale(uint64 aGlobalTimecodeScale) {
{ TimecodeScale = aGlobalTimecodeScale;
bSilentTracksUsed = true; bTimecodeScaleIsSet = true;
return FindFirstElt(EBML_INFO(KaxClusterSilentTracks), true) != NULL; }
} uint64 GlobalTimecodeScale() const {
assert(bTimecodeScaleIsSet);
return TimecodeScale;
}
bool AddBlockBlob(KaxBlockBlob * NewBlob); bool SetSilentTrackUsed()
{
bSilentTracksUsed = true;
return FindFirstElt(EBML_INFO(KaxClusterSilentTracks), true) != NULL;
}
const KaxSegment *GetParentSegment() const { return ParentSegment; } bool AddBlockBlob(KaxBlockBlob * NewBlob);
protected: const KaxSegment *GetParentSegment() const { return ParentSegment; }
KaxBlockBlob * currentNewBlob;
std::vector<KaxBlockBlob*> Blobs;
KaxBlockGroup * currentNewBlock;
const KaxSegment * ParentSegment;
uint64 MinTimecode, MaxTimecode, PreviousTimecode; protected:
int64 TimecodeScale; KaxBlockBlob * currentNewBlob;
std::vector<KaxBlockBlob*> Blobs;
KaxBlockGroup * currentNewBlock;
const KaxSegment * ParentSegment;
bool bFirstFrameInside; // used to speed research uint64 MinTimecode, MaxTimecode, PreviousTimecode;
bool bPreviousTimecodeIsSet; int64 TimecodeScale;
bool bTimecodeScaleIsSet;
bool bSilentTracksUsed;
/*! bool bFirstFrameInside; // used to speed research
\note method used internally bool bPreviousTimecodeIsSet;
*/ bool bTimecodeScaleIsSet;
bool AddFrameInternal(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, KaxBlockGroup * & MyNewBlock, const KaxBlockGroup * PastBlock, const KaxBlockGroup * ForwBlock, LacingType lacing); 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 END_LIBMATROSKA_NAMESPACE

View File

@ -11,12 +11,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -28,9 +28,9 @@
**********************************************************************/ **********************************************************************/
/*! /*!
\file \file
\version \$Id: KaxClusterData.h,v 1.9 2004/04/21 19:50:10 mosu Exp $ \version \$Id: KaxClusterData.h,v 1.9 2004/04/21 19:50:10 mosu Exp $
\author Steve Lhomme <robux4 @ users.sf.net> \author Steve Lhomme <robux4 @ users.sf.net>
*/ */
#ifndef LIBMATROSKA_CLUSTER_DATA_H #ifndef LIBMATROSKA_CLUSTER_DATA_H
#define LIBMATROSKA_CLUSTER_DATA_H #define LIBMATROSKA_CLUSTER_DATA_H

View File

@ -9,12 +9,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -26,10 +26,10 @@
**********************************************************************/ **********************************************************************/
/*! /*!
\file \file
\version \$Id: KaxConfig.h,v 1.7 2004/04/14 23:26:17 robux4 Exp $ \version \$Id: KaxConfig.h,v 1.7 2004/04/14 23:26:17 robux4 Exp $
\author Steve Lhomme <robux4 @ users.sf.net> \author Steve Lhomme <robux4 @ users.sf.net>
\author Moritz Bunkus <moritz @ bunkus.org> \author Moritz Bunkus <moritz @ bunkus.org>
*/ */
#ifndef LIBMATROSKA_CONFIG_H #ifndef LIBMATROSKA_CONFIG_H
#define LIBMATROSKA_CONFIG_H #define LIBMATROSKA_CONFIG_H

View File

@ -11,12 +11,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -28,9 +28,9 @@
**********************************************************************/ **********************************************************************/
/*! /*!
\file \file
\version \$Id: KaxContentEncoding.h,v 1.7 2004/04/14 23:26:17 robux4 Exp $ \version \$Id: KaxContentEncoding.h,v 1.7 2004/04/14 23:26:17 robux4 Exp $
\author Steve Lhomme <robux4 @ users.sf.net> \author Steve Lhomme <robux4 @ users.sf.net>
*/ */
#ifndef LIBMATROSKA_CONTENT_ENCODING_H #ifndef LIBMATROSKA_CONTENT_ENCODING_H
#define LIBMATROSKA_CONTENT_ENCODING_H #define LIBMATROSKA_CONTENT_ENCODING_H

View File

@ -11,12 +11,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -28,9 +28,9 @@
**********************************************************************/ **********************************************************************/
/*! /*!
\file \file
\version \$Id$ \version \$Id$
\author Steve Lhomme <robux4 @ users.sf.net> \author Steve Lhomme <robux4 @ users.sf.net>
*/ */
#ifndef LIBMATROSKA_CONTEXTS_H #ifndef LIBMATROSKA_CONTEXTS_H
#define LIBMATROSKA_CONTEXTS_H #define LIBMATROSKA_CONTEXTS_H

View File

@ -11,12 +11,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -28,9 +28,9 @@
**********************************************************************/ **********************************************************************/
/*! /*!
\file \file
\version \$Id: KaxCues.h,v 1.7 2004/04/14 23:26:17 robux4 Exp $ \version \$Id: KaxCues.h,v 1.7 2004/04/14 23:26:17 robux4 Exp $
\author Steve Lhomme <robux4 @ users.sf.net> \author Steve Lhomme <robux4 @ users.sf.net>
*/ */
#ifndef LIBMATROSKA_CUES_H #ifndef LIBMATROSKA_CUES_H
#define LIBMATROSKA_CUES_H #define LIBMATROSKA_CUES_H
@ -48,42 +48,42 @@ START_LIBMATROSKA_NAMESPACE
class KaxCuePoint; class KaxCuePoint;
DECLARE_MKX_MASTER(KaxCues) DECLARE_MKX_MASTER(KaxCues)
public: public:
~KaxCues(); ~KaxCues();
//bool AddBlockGroup(const KaxBlockGroup & BlockReference); // deprecated //bool AddBlockGroup(const KaxBlockGroup & BlockReference); // deprecated
bool AddBlockBlob(const KaxBlockBlob & BlockReference); bool AddBlockBlob(const KaxBlockBlob & BlockReference);
/*! /*!
\brief Indicate that the position for this Block is set \brief Indicate that the position for this Block is set
*/ */
void PositionSet(const KaxBlockGroup & BlockReference); void PositionSet(const KaxBlockGroup & BlockReference);
void PositionSet(const KaxBlockBlob & BlockReference); void PositionSet(const KaxBlockBlob & BlockReference);
/*! /*!
\brief override to sort by timecode/track \brief override to sort by timecode/track
*/ */
filepos_t Render(IOCallback & output, bool bSaveDefault = false) { filepos_t Render(IOCallback & output, bool bSaveDefault = false) {
Sort(); Sort();
return EbmlMaster::Render(output, bSaveDefault); return EbmlMaster::Render(output, bSaveDefault);
} }
uint64 GetTimecodePosition(uint64 aTimecode) const; uint64 GetTimecodePosition(uint64 aTimecode) const;
const KaxCuePoint * GetTimecodePoint(uint64 aTimecode) const; const KaxCuePoint * GetTimecodePoint(uint64 aTimecode) const;
void SetGlobalTimecodeScale(uint64 aGlobalTimecodeScale) { void SetGlobalTimecodeScale(uint64 aGlobalTimecodeScale) {
mGlobalTimecodeScale = aGlobalTimecodeScale; mGlobalTimecodeScale = aGlobalTimecodeScale;
bGlobalTimecodeScaleIsSet = true; bGlobalTimecodeScaleIsSet = true;
} }
uint64 GlobalTimecodeScale() const { uint64 GlobalTimecodeScale() const {
assert(bGlobalTimecodeScaleIsSet); assert(bGlobalTimecodeScaleIsSet);
return mGlobalTimecodeScale; return mGlobalTimecodeScale;
} }
protected: protected:
std::vector<const KaxBlockBlob *> myTempReferences; std::vector<const KaxBlockBlob *> myTempReferences;
bool bGlobalTimecodeScaleIsSet; bool bGlobalTimecodeScaleIsSet;
uint64 mGlobalTimecodeScale; uint64 mGlobalTimecodeScale;
}; };
END_LIBMATROSKA_NAMESPACE END_LIBMATROSKA_NAMESPACE

View File

@ -9,12 +9,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -26,9 +26,9 @@
**********************************************************************/ **********************************************************************/
/*! /*!
\file \file
\version \$Id: KaxCuesData.h,v 1.8 2004/04/14 23:26:17 robux4 Exp $ \version \$Id: KaxCuesData.h,v 1.8 2004/04/14 23:26:17 robux4 Exp $
\author Steve Lhomme <robux4 @ users.sf.net> \author Steve Lhomme <robux4 @ users.sf.net>
*/ */
#ifndef LIBMATROSKA_CUES_DATA_H #ifndef LIBMATROSKA_CUES_DATA_H
#define LIBMATROSKA_CUES_DATA_H #define LIBMATROSKA_CUES_DATA_H
@ -48,27 +48,27 @@ class KaxCueTrackPositions;
class KaxInternalBlock; class KaxInternalBlock;
DECLARE_MKX_MASTER(KaxCuePoint) DECLARE_MKX_MASTER(KaxCuePoint)
public: public:
void PositionSet(const KaxBlockGroup & BlockReference, uint64 GlobalTimecodeScale); void PositionSet(const KaxBlockGroup & BlockReference, uint64 GlobalTimecodeScale);
void PositionSet(const KaxBlockBlob & BlobReference, 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; const KaxCueTrackPositions * GetSeekPosition() const;
bool Timecode(uint64 & aTimecode, uint64 GlobalTimecodeScale) const; bool Timecode(uint64 & aTimecode, uint64 GlobalTimecodeScale) const;
}; };
DECLARE_MKX_MASTER(KaxCueTrackPositions) DECLARE_MKX_MASTER(KaxCueTrackPositions)
public: public:
uint64 ClusterPosition() const; uint64 ClusterPosition() const;
uint16 TrackNumber() const; uint16 TrackNumber() const;
}; };
#if MATROSKA_VERSION >= 2 #if MATROSKA_VERSION >= 2
DECLARE_MKX_MASTER(KaxCueReference) DECLARE_MKX_MASTER(KaxCueReference)
public: public:
void AddReference(const KaxBlockGroup & BlockReferenced, uint64 GlobalTimecodeScale); void AddReference(const KaxBlockGroup & BlockReferenced, uint64 GlobalTimecodeScale);
void AddReference(const KaxBlockBlob & BlockReferenced, uint64 GlobalTimecodeScale); void AddReference(const KaxBlockBlob & BlockReferenced, uint64 GlobalTimecodeScale);
}; };
#endif // MATROSKA_VERSION #endif // MATROSKA_VERSION

View File

@ -9,12 +9,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -26,9 +26,9 @@
**********************************************************************/ **********************************************************************/
/*! /*!
\file \file
\version \$Id$ \version \$Id$
\author Steve Lhomme <robux4 @ users.sf.net> \author Steve Lhomme <robux4 @ users.sf.net>
*/ */
#ifndef LIBMATROSKA_DEFINES_H #ifndef LIBMATROSKA_DEFINES_H
#define LIBMATROSKA_DEFINES_H #define LIBMATROSKA_DEFINES_H

View File

@ -11,12 +11,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -28,9 +28,9 @@
**********************************************************************/ **********************************************************************/
/*! /*!
\file \file
\version \$Id: KaxInfo.h,v 1.7 2004/04/14 23:26:17 robux4 Exp $ \version \$Id: KaxInfo.h,v 1.7 2004/04/14 23:26:17 robux4 Exp $
\author Steve Lhomme <robux4 @ users.sf.net> \author Steve Lhomme <robux4 @ users.sf.net>
*/ */
#ifndef LIBMATROSKA_INFO_H #ifndef LIBMATROSKA_INFO_H
#define LIBMATROSKA_INFO_H #define LIBMATROSKA_INFO_H

View File

@ -11,12 +11,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -28,11 +28,11 @@
**********************************************************************/ **********************************************************************/
/*! /*!
\file \file
\version \$Id$ \version \$Id$
\author Steve Lhomme <robux4 @ users.sf.net> \author Steve Lhomme <robux4 @ users.sf.net>
\author John Cannon <spyder2555 @ users.sf.net> \author John Cannon <spyder2555 @ users.sf.net>
\author Moritz Bunkus <moritz @ bunkus.org> \author Moritz Bunkus <moritz @ bunkus.org>
*/ */
#ifndef LIBMATROSKA_INFO_DATA_H #ifndef LIBMATROSKA_INFO_DATA_H
#define LIBMATROSKA_INFO_DATA_H #define LIBMATROSKA_INFO_DATA_H
@ -53,20 +53,20 @@ START_LIBMATROSKA_NAMESPACE
DECLARE_MKX_CONTEXT(KaxPrevUID); DECLARE_MKX_CONTEXT(KaxPrevUID);
class MATROSKA_DLL_API KaxPrevUID : public KaxSegmentUID { class MATROSKA_DLL_API KaxPrevUID : public KaxSegmentUID {
public: public:
KaxPrevUID(EBML_EXTRA_PARAM); KaxPrevUID(EBML_EXTRA_PARAM);
KaxPrevUID(const KaxPrevUID & ElementToClone) :KaxSegmentUID(ElementToClone){} KaxPrevUID(const KaxPrevUID & ElementToClone) :KaxSegmentUID(ElementToClone){}
virtual bool ValidateSize() const { return IsFiniteSize() && (GetSize() == 16);} virtual bool ValidateSize() const { return IsFiniteSize() && (GetSize() == 16);}
EBML_CONCRETE_CLASS(KaxPrevUID) EBML_CONCRETE_CLASS(KaxPrevUID)
}; };
DECLARE_MKX_CONTEXT(KaxNextUID); DECLARE_MKX_CONTEXT(KaxNextUID);
class MATROSKA_DLL_API KaxNextUID : public KaxSegmentUID { class MATROSKA_DLL_API KaxNextUID : public KaxSegmentUID {
public: public:
KaxNextUID(EBML_EXTRA_PARAM); KaxNextUID(EBML_EXTRA_PARAM);
KaxNextUID(const KaxNextUID & ElementToClone) :KaxSegmentUID(ElementToClone){} KaxNextUID(const KaxNextUID & ElementToClone) :KaxSegmentUID(ElementToClone){}
virtual bool ValidateSize() const { return IsFiniteSize() && (GetSize() == 16);} virtual bool ValidateSize() const { return IsFiniteSize() && (GetSize() == 16);}
EBML_CONCRETE_CLASS(KaxNextUID) EBML_CONCRETE_CLASS(KaxNextUID)
}; };

View File

@ -11,12 +11,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -28,9 +28,9 @@
**********************************************************************/ **********************************************************************/
/*! /*!
\file \file
\version \$Id$ \version \$Id$
\author Steve Lhomme <robux4 @ users.sf.net> \author Steve Lhomme <robux4 @ users.sf.net>
*/ */
#ifndef LIBMATROSKA_SEEK_HEAD_H #ifndef LIBMATROSKA_SEEK_HEAD_H
#define LIBMATROSKA_SEEK_HEAD_H #define LIBMATROSKA_SEEK_HEAD_H
@ -48,22 +48,22 @@ START_LIBMATROSKA_NAMESPACE
class KaxSegment; class KaxSegment;
DECLARE_MKX_MASTER(KaxSeek) DECLARE_MKX_MASTER(KaxSeek)
public: public:
int64 Location() const; int64 Location() const;
bool IsEbmlId(const EbmlId & aId) const; bool IsEbmlId(const EbmlId & aId) const;
bool IsEbmlId(const KaxSeek & aPoint) const; bool IsEbmlId(const KaxSeek & aPoint) const;
}; };
DECLARE_MKX_MASTER(KaxSeekHead) DECLARE_MKX_MASTER(KaxSeekHead)
public: public:
/*! /*!
\brief add an element to index in the Meta Seek data \brief add an element to index in the Meta Seek data
\note the element should already be written in the file \note the element should already be written in the file
*/ */
void IndexThis(const EbmlElement & aElt, const KaxSegment & ParentSegment); void IndexThis(const EbmlElement & aElt, const KaxSegment & ParentSegment);
KaxSeek * FindFirstOf(const EbmlCallbacks & Callbacks) const; KaxSeek * FindFirstOf(const EbmlCallbacks & Callbacks) const;
KaxSeek * FindNextOf(const KaxSeek &aPrev) const; KaxSeek * FindNextOf(const KaxSeek &aPrev) const;
}; };
END_LIBMATROSKA_NAMESPACE END_LIBMATROSKA_NAMESPACE

View File

@ -11,12 +11,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -28,9 +28,9 @@
**********************************************************************/ **********************************************************************/
/*! /*!
\file \file
\version \$Id: KaxSegment.h,v 1.8 2004/04/14 23:26:17 robux4 Exp $ \version \$Id: KaxSegment.h,v 1.8 2004/04/14 23:26:17 robux4 Exp $
\author Steve Lhomme <robux4 @ users.sf.net> \author Steve Lhomme <robux4 @ users.sf.net>
*/ */
#ifndef LIBMATROSKA_SEGMENT_H #ifndef LIBMATROSKA_SEGMENT_H
#define LIBMATROSKA_SEGMENT_H #define LIBMATROSKA_SEGMENT_H
@ -44,17 +44,17 @@ using namespace LIBEBML_NAMESPACE;
START_LIBMATROSKA_NAMESPACE START_LIBMATROSKA_NAMESPACE
DECLARE_MKX_MASTER_CONS(KaxSegment) DECLARE_MKX_MASTER_CONS(KaxSegment)
public: public:
/*! /*!
\brief give the position of the element in the segment \brief give the position of the element in the segment
*/ */
uint64 GetRelativePosition(const EbmlElement & Elt) const; uint64 GetRelativePosition(const EbmlElement & Elt) const;
uint64 GetRelativePosition(uint64 aGlobalPosition) const; uint64 GetRelativePosition(uint64 aGlobalPosition) const;
/*! /*!
\brief give the position of the element in the file \brief give the position of the element in the file
*/ */
uint64 GetGlobalPosition(uint64 aRelativePosition) const; uint64 GetGlobalPosition(uint64 aRelativePosition) const;
}; };
END_LIBMATROSKA_NAMESPACE END_LIBMATROSKA_NAMESPACE

View File

@ -1,23 +1,23 @@
/********************************************************************** /**********************************************************************
** DO NOT EDIT, GENERATED WITH DATA2LIB ** DO NOT EDIT, GENERATED WITH DATA2LIB
** **
** libmatroska : parse Matroska files, see http://www.matroska.org/ ** libmatroska : parse Matroska files, see http://www.matroska.org/
** **
** Copyright (c) 2002-2010, Matroska (non-profit organisation) ** Copyright (c) 2002-2010, Matroska (non-profit organisation)
** All rights reserved. ** All rights reserved.
** **
** This file is part of libmatroska. ** This file is part of libmatroska.
** **
** This library is free software; you can redistribute it and/or ** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -49,7 +49,7 @@ START_LIBMATROSKA_NAMESPACE
DECLARE_MKX_BINARY (KaxSeekID) DECLARE_MKX_BINARY (KaxSeekID)
public: public:
virtual bool ValidateSize() const {return IsFiniteSize() && GetSize() <= 4;} virtual bool ValidateSize() const {return IsFiniteSize() && GetSize() <= 4;}
}; };
DECLARE_MKX_UINTEGER(KaxSeekPosition) DECLARE_MKX_UINTEGER(KaxSeekPosition)
@ -62,10 +62,10 @@ DECLARE_MKX_MASTER(KaxInfo)
DECLARE_MKX_BINARY (KaxSegmentUID) DECLARE_MKX_BINARY (KaxSegmentUID)
#if defined(HAVE_EBML2) || defined(HAS_EBML2) #if defined(HAVE_EBML2) || defined(HAS_EBML2)
public: public:
KaxSegmentUID(EBML_DEF_CONS EBML_DEF_SEP EBML_EXTRA_PARAM); KaxSegmentUID(EBML_DEF_CONS EBML_DEF_SEP EBML_EXTRA_PARAM);
#endif #endif
public: public:
virtual bool ValidateSize() const {return IsFiniteSize() && GetSize() == 16;} virtual bool ValidateSize() const {return IsFiniteSize() && GetSize() == 16;}
}; };
DECLARE_MKX_UNISTRING(KaxSegmentFilename) DECLARE_MKX_UNISTRING(KaxSegmentFilename)
@ -79,7 +79,7 @@ DECLARE_MKX_UNISTRING(KaxNextFilename)
DECLARE_MKX_BINARY (KaxSegmentFamily) DECLARE_MKX_BINARY (KaxSegmentFamily)
public: public:
virtual bool ValidateSize() const {return IsFiniteSize() && GetSize() == 16;} virtual bool ValidateSize() const {return IsFiniteSize() && GetSize() == 16;}
}; };
DECLARE_MKX_MASTER(KaxChapterTranslate) DECLARE_MKX_MASTER(KaxChapterTranslate)
@ -152,7 +152,7 @@ DECLARE_MKX_UINTEGER(KaxReferencePriority)
#if MATROSKA_VERSION >= 2 #if MATROSKA_VERSION >= 2
DECLARE_MKX_SINTEGER(KaxReferenceVirtual) DECLARE_MKX_SINTEGER(KaxReferenceVirtual)
public: public:
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault); filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
}; };
DECLARE_MKX_BINARY (KaxCodecState) DECLARE_MKX_BINARY (KaxCodecState)
@ -176,22 +176,22 @@ DECLARE_MKX_UINTEGER(KaxSliceLaceNumber)
#if MATROSKA_VERSION >= 2 #if MATROSKA_VERSION >= 2
DECLARE_MKX_UINTEGER(KaxSliceFrameNumber) DECLARE_MKX_UINTEGER(KaxSliceFrameNumber)
public: public:
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault); filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
}; };
DECLARE_MKX_UINTEGER(KaxSliceBlockAddID) DECLARE_MKX_UINTEGER(KaxSliceBlockAddID)
public: public:
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault); filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
}; };
DECLARE_MKX_UINTEGER(KaxSliceDelay) DECLARE_MKX_UINTEGER(KaxSliceDelay)
public: public:
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault); filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
}; };
DECLARE_MKX_UINTEGER(KaxSliceDuration) DECLARE_MKX_UINTEGER(KaxSliceDuration)
public: 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_MASTER(KaxReferenceFrame)
@ -206,7 +206,7 @@ DECLARE_MKX_UINTEGER(KaxReferenceTimeCode)
DECLARE_MKX_BINARY (KaxEncryptedBlock) DECLARE_MKX_BINARY (KaxEncryptedBlock)
public: public:
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault); filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
}; };
#endif #endif
@ -253,13 +253,13 @@ DECLARE_MKX_UINTEGER(KaxTrackDefaultDecodedFieldDuration)
DECLARE_MKX_FLOAT(KaxTrackTimecodeScale) DECLARE_MKX_FLOAT(KaxTrackTimecodeScale)
public: public:
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault); filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
}; };
#if MATROSKA_VERSION >= 2 #if MATROSKA_VERSION >= 2
DECLARE_MKX_SINTEGER(KaxTrackOffset) DECLARE_MKX_SINTEGER(KaxTrackOffset)
public: public:
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault); filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
}; };
#endif #endif
@ -287,17 +287,17 @@ DECLARE_MKX_UINTEGER(KaxTrackAttachmentLink)
#if MATROSKA_VERSION >= 2 #if MATROSKA_VERSION >= 2
DECLARE_MKX_UNISTRING(KaxCodecSettings) DECLARE_MKX_UNISTRING(KaxCodecSettings)
public: public:
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault); filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
}; };
DECLARE_MKX_STRING(KaxCodecInfoURL) DECLARE_MKX_STRING(KaxCodecInfoURL)
public: public:
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault); filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
}; };
DECLARE_MKX_STRING(KaxCodecDownloadURL) DECLARE_MKX_STRING(KaxCodecDownloadURL)
public: 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(KaxCodecDecodeAll)
@ -344,7 +344,7 @@ DECLARE_MKX_UINTEGER(KaxVideoAlphaMode)
DECLARE_MKX_UINTEGER(KaxOldStereoMode) DECLARE_MKX_UINTEGER(KaxOldStereoMode)
public: public:
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault); filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
}; };
#endif #endif
@ -380,18 +380,18 @@ DECLARE_MKX_UINTEGER(KaxVideoAspectRatio)
DECLARE_MKX_BINARY (KaxVideoColourSpace) DECLARE_MKX_BINARY (KaxVideoColourSpace)
public: public:
virtual bool ValidateSize() const {return IsFiniteSize() && GetSize() == 4;} virtual bool ValidateSize() const {return IsFiniteSize() && GetSize() == 4;}
}; };
#if MATROSKA_VERSION >= 2 #if MATROSKA_VERSION >= 2
DECLARE_MKX_FLOAT(KaxVideoGamma) DECLARE_MKX_FLOAT(KaxVideoGamma)
public: public:
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault); filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
}; };
DECLARE_MKX_FLOAT(KaxVideoFrameRate) DECLARE_MKX_FLOAT(KaxVideoFrameRate)
public: public:
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault); filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
}; };
#endif #endif
@ -411,7 +411,7 @@ DECLARE_MKX_UINTEGER(KaxAudioChannels)
#if MATROSKA_VERSION >= 2 #if MATROSKA_VERSION >= 2
DECLARE_MKX_BINARY (KaxAudioPosition) DECLARE_MKX_BINARY (KaxAudioPosition)
public: public:
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault); filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
}; };
#endif #endif
@ -449,7 +449,7 @@ DECLARE_MKX_UINTEGER(KaxTrickTrackUID)
DECLARE_MKX_BINARY (KaxTrickTrackSegmentUID) DECLARE_MKX_BINARY (KaxTrickTrackSegmentUID)
public: public:
virtual bool ValidateSize() const {return IsFiniteSize() && GetSize() == 16;} virtual bool ValidateSize() const {return IsFiniteSize() && GetSize() == 16;}
}; };
DECLARE_MKX_UINTEGER(KaxTrickTrackFlag) DECLARE_MKX_UINTEGER(KaxTrickTrackFlag)
@ -460,7 +460,7 @@ DECLARE_MKX_UINTEGER(KaxTrickMasterTrackUID)
DECLARE_MKX_BINARY (KaxTrickMasterTrackSegmentUID) DECLARE_MKX_BINARY (KaxTrickMasterTrackSegmentUID)
public: public:
virtual bool ValidateSize() const {return IsFiniteSize() && GetSize() == 16;} virtual bool ValidateSize() const {return IsFiniteSize() && GetSize() == 16;}
}; };
#endif #endif
@ -542,17 +542,17 @@ DECLARE_MKX_UINTEGER(KaxCueRefTime)
DECLARE_MKX_UINTEGER(KaxCueRefCluster) DECLARE_MKX_UINTEGER(KaxCueRefCluster)
public: public:
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault); filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
}; };
DECLARE_MKX_UINTEGER(KaxCueRefNumber) DECLARE_MKX_UINTEGER(KaxCueRefNumber)
public: public:
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault); filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
}; };
DECLARE_MKX_UINTEGER(KaxCueRefCodecState) DECLARE_MKX_UINTEGER(KaxCueRefCodecState)
public: public:
filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault); filepos_t RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault);
}; };
#endif #endif
@ -582,7 +582,7 @@ DECLARE_MKX_UINTEGER(KaxFileUID)
#if MATROSKA_VERSION >= 2 #if MATROSKA_VERSION >= 2
DECLARE_MKX_BINARY (KaxFileReferral) DECLARE_MKX_BINARY (KaxFileReferral)
public: 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_UINTEGER(KaxFileUsedStartTime)
@ -638,7 +638,7 @@ DECLARE_MKX_UINTEGER(KaxChapterFlagEnabled)
DECLARE_MKX_BINARY (KaxChapterSegmentUID) DECLARE_MKX_BINARY (KaxChapterSegmentUID)
public: public:
virtual bool ValidateSize() const {return IsFiniteSize() && GetSize() == 16;} virtual bool ValidateSize() const {return IsFiniteSize() && GetSize() == 16;}
}; };
DECLARE_MKX_UINTEGER(KaxChapterSegmentEditionUID) DECLARE_MKX_UINTEGER(KaxChapterSegmentEditionUID)

View File

@ -11,12 +11,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -28,9 +28,9 @@
**********************************************************************/ **********************************************************************/
/*! /*!
\file \file
\version \$Id$ \version \$Id$
\author Steve Lhomme <robux4 @ users.sf.net> \author Steve Lhomme <robux4 @ users.sf.net>
*/ */
#ifndef LIBMATROSKA_TAG_H #ifndef LIBMATROSKA_TAG_H
#define LIBMATROSKA_TAG_H #define LIBMATROSKA_TAG_H

View File

@ -11,12 +11,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -28,9 +28,9 @@
**********************************************************************/ **********************************************************************/
/*! /*!
\file \file
\version \$Id: KaxTags.h,v 1.7 2004/04/14 23:26:17 robux4 Exp $ \version \$Id: KaxTags.h,v 1.7 2004/04/14 23:26:17 robux4 Exp $
\author Steve Lhomme <robux4 @ users.sf.net> \author Steve Lhomme <robux4 @ users.sf.net>
*/ */
#ifndef LIBMATROSKA_TAGS_H #ifndef LIBMATROSKA_TAGS_H
#define LIBMATROSKA_TAGS_H #define LIBMATROSKA_TAGS_H

View File

@ -11,12 +11,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -28,9 +28,9 @@
**********************************************************************/ **********************************************************************/
/*! /*!
\file \file
\version \$Id: KaxTrackAudio.h,v 1.11 2004/04/14 23:26:17 robux4 Exp $ \version \$Id: KaxTrackAudio.h,v 1.11 2004/04/14 23:26:17 robux4 Exp $
\author Steve Lhomme <robux4 @ users.sf.net> \author Steve Lhomme <robux4 @ users.sf.net>
*/ */
#ifndef LIBMATROSKA_TRACK_AUDIO_H #ifndef LIBMATROSKA_TRACK_AUDIO_H
#define LIBMATROSKA_TRACK_AUDIO_H #define LIBMATROSKA_TRACK_AUDIO_H

View File

@ -11,12 +11,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -28,9 +28,9 @@
**********************************************************************/ **********************************************************************/
/*! /*!
\file \file
\version \$Id: KaxTrackEntryData.h,v 1.9 2004/04/14 23:26:17 robux4 Exp $ \version \$Id: KaxTrackEntryData.h,v 1.9 2004/04/14 23:26:17 robux4 Exp $
\author Steve Lhomme <robux4 @ users.sf.net> \author Steve Lhomme <robux4 @ users.sf.net>
*/ */
#ifndef LIBMATROSKA_TRACK_ENTRY_DATA_H #ifndef LIBMATROSKA_TRACK_ENTRY_DATA_H
#define LIBMATROSKA_TRACK_ENTRY_DATA_H #define LIBMATROSKA_TRACK_ENTRY_DATA_H

View File

@ -11,12 +11,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -28,9 +28,9 @@
**********************************************************************/ **********************************************************************/
/*! /*!
\file \file
\version \$Id$ \version \$Id$
\author Steve Lhomme <robux4 @ users.sf.net> \author Steve Lhomme <robux4 @ users.sf.net>
*/ */
#ifndef LIBMATROSKA_TRACK_VIDEO_H #ifndef LIBMATROSKA_TRACK_VIDEO_H
#define LIBMATROSKA_TRACK_VIDEO_H #define LIBMATROSKA_TRACK_VIDEO_H

View File

@ -11,12 +11,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -28,9 +28,9 @@
**********************************************************************/ **********************************************************************/
/*! /*!
\file \file
\version \$Id: KaxTracks.h,v 1.7 2004/04/14 23:26:17 robux4 Exp $ \version \$Id: KaxTracks.h,v 1.7 2004/04/14 23:26:17 robux4 Exp $
\author Steve Lhomme <robux4 @ users.sf.net> \author Steve Lhomme <robux4 @ users.sf.net>
*/ */
#ifndef LIBMATROSKA_TRACKS_H #ifndef LIBMATROSKA_TRACKS_H
#define LIBMATROSKA_TRACKS_H #define LIBMATROSKA_TRACKS_H
@ -46,31 +46,31 @@ using namespace LIBEBML_NAMESPACE;
START_LIBMATROSKA_NAMESPACE START_LIBMATROSKA_NAMESPACE
DECLARE_MKX_MASTER(KaxTrackEntry) DECLARE_MKX_MASTER(KaxTrackEntry)
public: public:
EbmlUInteger & TrackNumber() const { return *(static_cast<EbmlUInteger *>(FindElt(EBML_INFO(KaxTrackNumber)))); } EbmlUInteger & TrackNumber() const { return *(static_cast<EbmlUInteger *>(FindElt(EBML_INFO(KaxTrackNumber)))); }
void EnableLacing(bool bEnable = true); void EnableLacing(bool bEnable = true);
/*! /*!
\note lacing set by default \note lacing set by default
*/ */
inline bool LacingEnabled() const { inline bool LacingEnabled() const {
KaxTrackFlagLacing * myLacing = static_cast<KaxTrackFlagLacing *>(FindFirstElt(EBML_INFO(KaxTrackFlagLacing))); KaxTrackFlagLacing * myLacing = static_cast<KaxTrackFlagLacing *>(FindFirstElt(EBML_INFO(KaxTrackFlagLacing)));
return((myLacing == NULL) || (uint8(*myLacing) != 0)); return((myLacing == NULL) || (uint8(*myLacing) != 0));
} }
void SetGlobalTimecodeScale(uint64 aGlobalTimecodeScale) { void SetGlobalTimecodeScale(uint64 aGlobalTimecodeScale) {
mGlobalTimecodeScale = aGlobalTimecodeScale; mGlobalTimecodeScale = aGlobalTimecodeScale;
bGlobalTimecodeScaleIsSet = true; bGlobalTimecodeScaleIsSet = true;
} }
uint64 GlobalTimecodeScale() const { uint64 GlobalTimecodeScale() const {
assert(bGlobalTimecodeScaleIsSet); assert(bGlobalTimecodeScaleIsSet);
return mGlobalTimecodeScale; return mGlobalTimecodeScale;
} }
protected: protected:
bool bGlobalTimecodeScaleIsSet; bool bGlobalTimecodeScaleIsSet;
uint64 mGlobalTimecodeScale; uint64 mGlobalTimecodeScale;
}; };
END_LIBMATROSKA_NAMESPACE END_LIBMATROSKA_NAMESPACE

View File

@ -11,12 +11,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -28,8 +28,8 @@
**********************************************************************/ **********************************************************************/
/*! /*!
\file \file
\version \$Id: KaxTypes.h,v 1.4 2004/04/14 23:26:17 robux4 Exp $ \version \$Id: KaxTypes.h,v 1.4 2004/04/14 23:26:17 robux4 Exp $
*/ */
#ifndef LIBMATROSKA_TYPES_H #ifndef LIBMATROSKA_TYPES_H
#define LIBMATROSKA_TYPES_H #define LIBMATROSKA_TYPES_H
@ -41,17 +41,17 @@
START_LIBMATROSKA_NAMESPACE START_LIBMATROSKA_NAMESPACE
enum LacingType { enum LacingType {
LACING_NONE = 0, LACING_NONE = 0,
LACING_XIPH, LACING_XIPH,
LACING_FIXED, LACING_FIXED,
LACING_EBML, LACING_EBML,
LACING_AUTO LACING_AUTO
}; };
enum BlockBlobType { enum BlockBlobType {
BLOCK_BLOB_NO_SIMPLE = 0, BLOCK_BLOB_NO_SIMPLE = 0,
BLOCK_BLOB_SIMPLE_AUTO, BLOCK_BLOB_SIMPLE_AUTO,
BLOCK_BLOB_ALWAYS_SIMPLE, BLOCK_BLOB_ALWAYS_SIMPLE,
}; };
END_LIBMATROSKA_NAMESPACE END_LIBMATROSKA_NAMESPACE

View File

@ -26,9 +26,9 @@
**********************************************************************/ **********************************************************************/
/*! /*!
\file \file
\version \$Id: KaxVersion.h,v 1.13 2004/04/23 16:46:07 mosu Exp $ \version \$Id: KaxVersion.h,v 1.13 2004/04/23 16:46:07 mosu Exp $
\author Steve Lhomme <robux4 @ users.sf.net> \author Steve Lhomme <robux4 @ users.sf.net>
*/ */
#ifndef LIBMATROSKA_VERSION_H #ifndef LIBMATROSKA_VERSION_H
#define LIBMATROSKA_VERSION_H #define LIBMATROSKA_VERSION_H
@ -46,7 +46,7 @@ extern const std::string KaxCodeVersion;
extern const std::string KaxCodeDate; 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 END_LIBMATROSKA_NAMESPACE

View File

@ -11,12 +11,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

View File

@ -11,12 +11,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -69,7 +69,7 @@ typedef enum track_type {
\note this should be used by the libmatroska internals \note this should be used by the libmatroska internals
*/ */
typedef enum { 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; } matroska_error_t;
typedef void *matroska_stream; typedef void *matroska_stream;

View File

@ -11,12 +11,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -60,9 +60,9 @@ FileMatroska::FileMatroska(IOCallback & output)
{ {
#ifdef OLD #ifdef OLD
myStreamInfo.MainHeaderSize = TypeHeader::default_size() + myStreamInfo.MainHeaderSize = TypeHeader::default_size() +
ActualHeader::default_size() + ActualHeader::default_size() +
ExtendedInfo::default_size() + ExtendedInfo::default_size() +
ContentInfo::default_size(); ContentInfo::default_size();
myStreamInfo.TrackEntrySize = Track::default_size(); myStreamInfo.TrackEntrySize = Track::default_size();
myStreamInfo.BlockHeadSize = BLOCK_HEADER_SIZE; myStreamInfo.BlockHeadSize = BLOCK_HEADER_SIZE;
myStreamInfo.ClusterHeadSize = CLUSTER_HEADER_SIZE; myStreamInfo.ClusterHeadSize = CLUSTER_HEADER_SIZE;
@ -73,9 +73,9 @@ FileMatroska::FileMatroska(IOCallback & output)
FileMatroska::~FileMatroska() FileMatroska::~FileMatroska()
{ {
// if (myCurrCluster != NULL) // 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) // 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 #ifdef OLD
@ -100,7 +100,7 @@ void FileMatroska::Close(const uint32 aTimeLength)
uint32 track_entries_size = 0; uint32 track_entries_size = 0;
for (size_t i=0; i<myTracks.size(); i++) 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; myStreamInfo.TrackEntriesSize = track_entries_size;
@ -109,7 +109,7 @@ void FileMatroska::Close(const uint32 aTimeLength)
for (i=0; i<myTracks.size(); i++) for (i=0; i<myTracks.size(); i++)
{ {
delete myTracks[i]; delete myTracks[i];
} }
} }
@ -119,47 +119,47 @@ void FileMatroska::Close(const uint32 aTimeLength)
filepos_t FileMatroska::RenderHead(const std::string & aEncoderApp) filepos_t FileMatroska::RenderHead(const std::string & aEncoderApp)
{ {
try { try {
uint32 track_entries_size = 0; uint32 track_entries_size = 0;
for (size_t i=0; i<myTracks.size(); i++) for (size_t i=0; i<myTracks.size(); i++)
{ {
track_entries_size += myTracks[i]->default_size(); track_entries_size += myTracks[i]->default_size();
} }
std::string aStr = LIB_NAME; std::string aStr = LIB_NAME;
aStr += " "; aStr += " ";
aStr += VERSION; aStr += VERSION;
myStreamInfo.EncoderLib = aStr; myStreamInfo.EncoderLib = aStr;
myStreamInfo.EncoderApp = aEncoderApp; myStreamInfo.EncoderApp = aEncoderApp;
myStreamInfo.TrackEntryPosition = 0 + myStreamInfo.MainHeaderSize; myStreamInfo.TrackEntryPosition = 0 + myStreamInfo.MainHeaderSize;
myStreamInfo.TrackEntriesSize = myTracks.size() * myStreamInfo.TrackEntrySize; myStreamInfo.TrackEntriesSize = myTracks.size() * myStreamInfo.TrackEntrySize;
myStreamInfo.CodecEntryPosition = myStreamInfo.MainHeaderSize + myStreamInfo.TrackEntriesSize; myStreamInfo.CodecEntryPosition = myStreamInfo.MainHeaderSize + myStreamInfo.TrackEntriesSize;
myStreamInfo.CodecEntrySize = 4; myStreamInfo.CodecEntrySize = 4;
for (i=0; i<myTracks.size(); i++) for (i=0; i<myTracks.size(); i++)
{ {
myStreamInfo.CodecEntrySize += myTracks[i]->CodecSize(); myStreamInfo.CodecEntrySize += myTracks[i]->CodecSize();
} }
// Main Header // Main Header
filepos_t result = myMainHeader.Render(myFile, myStreamInfo); filepos_t result = myMainHeader.Render(myFile, myStreamInfo);
// Track Entries // Track Entries
for (i=0; i<myTracks.size(); i++) for (i=0; i<myTracks.size(); i++)
{ {
myTracks[i]->RenderEntry(myFile, i+1); myTracks[i]->RenderEntry(myFile, i+1);
} }
myStreamInfo.ClusterPosition = myStreamInfo.CodecEntryPosition + myStreamInfo.CodecEntrySize; myStreamInfo.ClusterPosition = myStreamInfo.CodecEntryPosition + myStreamInfo.CodecEntrySize;
// Codec Header // Codec Header
result = CodecHeader::Render(myFile, myTracks); result = CodecHeader::Render(myFile, myTracks);
return result; return result;
} }
catch (exception & Ex) catch (exception & Ex)
{ {
throw Ex; throw Ex;
} }
} }
@ -176,8 +176,8 @@ Track * FileMatroska::CreateTrack(const track_type aType)
{ {
for (size_t i=0; i<myTracks.size(); i++) for (size_t i=0; i<myTracks.size(); i++)
{ {
if (myTracks[i] == aTrack) if (myTracks[i] == aTrack)
return myTracks[i]; return myTracks[i];
} }
return NULL; return NULL;
@ -200,32 +200,32 @@ void FileMatroska::track_SetLaced(Track * aTrack, bool bLaced)
} }
bool FileMatroska::AddFrame(Track * aTrack, const uint32 aTimecode, const binary *aFrame, const uint32 aFrameSize, bool FileMatroska::AddFrame(Track * aTrack, const uint32 aTimecode, const binary *aFrame, const uint32 aFrameSize,
bool aKeyFrame, bool aBFrame) bool aKeyFrame, bool aBFrame)
{ {
try { try {
// make sure we know that track // make sure we know that track
if (IsMyTrack(aTrack)) if (IsMyTrack(aTrack))
{ {
// pass the cluster to the track // pass the cluster to the track
// handle the creation of a new cluster if needed // handle the creation of a new cluster if needed
if (aTrack->AddFrame(aTimecode, aFrame, aFrameSize, aKeyFrame, aBFrame)) if (aTrack->AddFrame(aTimecode, aFrame, aFrameSize, aKeyFrame, aBFrame))
{ {
while (!aTrack->SerialiseBlock(myCurrWriteCluster)) while (!aTrack->SerialiseBlock(myCurrWriteCluster))
{ {
/// \todo handle errors /// \todo handle errors
uint32 aNbBlock; uint32 aNbBlock;
myStreamInfo.ClusterSize += myCurrWriteCluster.Render(myFile, aNbBlock); myStreamInfo.ClusterSize += myCurrWriteCluster.Render(myFile, aNbBlock);
myStreamInfo.NumberBlock += aNbBlock; myStreamInfo.NumberBlock += aNbBlock;
myCurrWriteCluster.Flush(); myCurrWriteCluster.Flush();
} }
} }
return true; return true;
} }
return false; return false;
} }
catch (exception & Ex) catch (exception & Ex)
{ {
throw Ex; throw Ex;
} }
} }
@ -239,95 +239,95 @@ void FileMatroska::Flush()
uint32 FileMatroska::ReadHead() uint32 FileMatroska::ReadHead()
{ {
try { try {
uint32 result = myMainHeader.Read(myFile, myStreamInfo); uint32 result = myMainHeader.Read(myFile, myStreamInfo);
return result; return result;
} }
catch (exception & Ex) catch (exception & Ex)
{ {
throw Ex; throw Ex;
} }
} }
uint32 FileMatroska::ReadTracks() uint32 FileMatroska::ReadTracks()
{ {
try { try {
uint32 result = 0; uint32 result = 0;
// seek to the start of the Track Entries // seek to the start of the Track Entries
myFile.setFilePointer(myStreamInfo.TrackEntryPosition); myFile.setFilePointer(myStreamInfo.TrackEntryPosition);
// get the number of Track Entries // get the number of Track Entries
uint8 TrackNumber = myStreamInfo.TrackEntriesSize / myStreamInfo.TrackEntrySize; uint8 TrackNumber = myStreamInfo.TrackEntriesSize / myStreamInfo.TrackEntrySize;
// read all the Track Entries // read all the Track Entries
myTracks.clear(); myTracks.clear();
for (uint8 TrackIdx = 0; TrackIdx<TrackNumber; TrackIdx ++) { for (uint8 TrackIdx = 0; TrackIdx<TrackNumber; TrackIdx ++) {
Track * tmpTrack = Track::ReadEntry(myFile, TrackIdx+1, myStreamInfo); Track * tmpTrack = Track::ReadEntry(myFile, TrackIdx+1, myStreamInfo);
if (tmpTrack == NULL) if (tmpTrack == NULL)
throw 0; throw 0;
myTracks.push_back(tmpTrack);
}
return result; myTracks.push_back(tmpTrack);
}
return result;
} }
catch (exception & Ex) catch (exception & Ex)
{ {
throw Ex; throw Ex;
} }
} }
uint32 FileMatroska::ReadCodec() uint32 FileMatroska::ReadCodec()
{ {
try { try {
// seek to the start of the Track Entries // seek to the start of the Track Entries
myFile.setFilePointer(myStreamInfo.CodecEntryPosition); myFile.setFilePointer(myStreamInfo.CodecEntryPosition);
uint32 result = CodecHeader::Read(myFile, myTracks); uint32 result = CodecHeader::Read(myFile, myTracks);
return result; return result;
} }
catch (exception & Ex) catch (exception & Ex)
{ {
throw Ex; throw Ex;
} }
} }
inline bool FileMatroska::IsMyTrack(const Track * aTrack) const inline bool FileMatroska::IsMyTrack(const Track * aTrack) const
{ {
if (aTrack == 0) if (aTrack == 0)
throw 0; throw 0;
for (std::vector<Track*>::const_iterator i = myTracks.begin(); i != myTracks.end(); i ++) for (std::vector<Track*>::const_iterator i = myTracks.begin(); i != myTracks.end(); i ++)
{ {
if (*i == aTrack) if (*i == aTrack)
break; break;
} }
if (i != myTracks.end()) if (i != myTracks.end())
return true; return true;
else else
return false; return false;
} }
void FileMatroska::SelectReadingTrack(Track * aTrack, bool select) void FileMatroska::SelectReadingTrack(Track * aTrack, bool select)
{ {
if (IsMyTrack(aTrack)) if (IsMyTrack(aTrack))
{ {
// here we have the right track // here we have the right track
// check if it's not already selected // check if it's not already selected
for (std::vector<uint8>::iterator j = mySelectedTracks.begin(); for (std::vector<uint8>::iterator j = mySelectedTracks.begin();
j != mySelectedTracks.end(); j ++) j != mySelectedTracks.end(); j ++)
{ {
if (*j == aTrack->TrackNumber()) if (*j == aTrack->TrackNumber())
break; break;
} }
if (select && j == mySelectedTracks.end()) if (select && j == mySelectedTracks.end())
mySelectedTracks.push_back(aTrack->TrackNumber()); mySelectedTracks.push_back(aTrack->TrackNumber());
else if (!select && j != mySelectedTracks.end()) else if (!select && j != mySelectedTracks.end())
mySelectedTracks.erase(j); mySelectedTracks.erase(j);
std::sort(mySelectedTracks.begin(), mySelectedTracks.end()); std::sort(mySelectedTracks.begin(), mySelectedTracks.end());
} }
} }
@ -335,13 +335,13 @@ inline bool FileMatroska::IsReadingTrack(const uint8 aTrackNumber) const
{ {
for (std::vector<uint8>::const_iterator trackIdx = mySelectedTracks.begin(); for (std::vector<uint8>::const_iterator trackIdx = mySelectedTracks.begin();
trackIdx != mySelectedTracks.end() && *trackIdx < aTrackNumber; trackIdx != mySelectedTracks.end() && *trackIdx < aTrackNumber;
trackIdx++) trackIdx++)
{} {}
if (trackIdx == mySelectedTracks.end()) if (trackIdx == mySelectedTracks.end())
return false; return false;
else else
return true; return true;
} }
// //
@ -350,7 +350,7 @@ void FileMatroska::Track_GetInfo(const Track * aTrack, TrackInfo & aTrackInfo) c
{ {
if (IsMyTrack(aTrack)) if (IsMyTrack(aTrack))
{ {
aTrack->GetInfo(aTrackInfo); aTrack->GetInfo(aTrackInfo);
} }
} }
@ -360,7 +360,7 @@ void FileMatroska::Track_GetInfo_Audio(const Track * aTrack, TrackInfoAudio & aT
{ {
if (IsMyTrack(aTrack)) if (IsMyTrack(aTrack))
{ {
aTrack->GetInfoAudio(aTrackInfo); aTrack->GetInfoAudio(aTrackInfo);
} }
} }
@ -368,7 +368,7 @@ void FileMatroska::Track_SetInfo_Audio(Track * aTrack, const TrackInfoAudio & aT
{ {
if (IsMyTrack(aTrack)) if (IsMyTrack(aTrack))
{ {
aTrack->SetInfoAudio(aTrackInfo); aTrack->SetInfoAudio(aTrackInfo);
} }
} }
@ -378,7 +378,7 @@ void FileMatroska::Track_GetInfo_Video(const Track * aTrack, TrackInfoVideo & aT
{ {
if (IsMyTrack(aTrack)) if (IsMyTrack(aTrack))
{ {
aTrack->GetInfoVideo(aTrackInfo); aTrack->GetInfoVideo(aTrackInfo);
} }
} }
@ -386,7 +386,7 @@ void FileMatroska::Track_SetInfo_Video(Track * aTrack, const TrackInfoVideo & aT
{ {
if (IsMyTrack(aTrack)) if (IsMyTrack(aTrack))
{ {
aTrack->SetInfoVideo(aTrackInfo); aTrack->SetInfoVideo(aTrackInfo);
} }
} }
@ -394,45 +394,45 @@ void FileMatroska::Track_SetInfo_Video(Track * aTrack, const TrackInfoVideo & aT
\todo exit when there is no Block left \todo exit when there is no Block left
*/ */
bool FileMatroska::ReadFrame(Track * & aTrack, uint32 & aTimecode, const binary * & aFrame, uint32 & aFrameSize, bool FileMatroska::ReadFrame(Track * & aTrack, uint32 & aTimecode, const binary * & aFrame, uint32 & aFrameSize,
bool & aKeyFrame, bool & aBFrame) bool & aKeyFrame, bool & aBFrame)
{ {
if (myCurrReadBlockTrack == 0) if (myCurrReadBlockTrack == 0)
{ {
do { do {
if (myReadBlockNumber >= myStreamInfo.NumberBlock) if (myReadBlockNumber >= myStreamInfo.NumberBlock)
{ {
// myReadBlockNumber = myStreamInfo.NumberBlock; // myReadBlockNumber = myStreamInfo.NumberBlock;
return false; return false;
} }
// get the next frame in the file // get the next frame in the file
if (!myCurrReadCluster.BlockLeft()) if (!myCurrReadCluster.BlockLeft())
{ {
myCurrReadCluster.Flush(); myCurrReadCluster.Flush();
try { try {
myCurrReadCluster.FindHead(myFile); myCurrReadCluster.FindHead(myFile);
} }
catch (exception & Ex) catch (exception & Ex)
{ {
return false; return false;
} }
} }
myCurrReadCluster.GetBlock( myCurrReadBlock, myCurrReadBlockSize, myCurrReadBlockTrack ); myCurrReadCluster.GetBlock( myCurrReadBlock, myCurrReadBlockSize, myCurrReadBlockTrack );
myReadBlockNumber++; myReadBlockNumber++;
} while (!IsReadingTrack(myCurrReadBlockTrack)); } while (!IsReadingTrack(myCurrReadBlockTrack));
// get the track associated (normally from myTracks) // get the track associated (normally from myTracks)
aTrack = myTracks[myCurrReadBlockTrack-1]; aTrack = myTracks[myCurrReadBlockTrack-1];
// get the next frame from the current block // get the next frame from the current block
aTrack->HandleBlock(myCurrReadBlock, myCurrReadBlockSize); aTrack->HandleBlock(myCurrReadBlock, myCurrReadBlockSize);
} }
else else
{ {
// get the track associated (normally from myTracks) // get the track associated (normally from myTracks)
aTrack = myTracks[myCurrReadBlockTrack-1]; aTrack = myTracks[myCurrReadBlockTrack-1];
} }
Frame * myReadFrame; Frame * myReadFrame;
aTrack->GetNextFrame(aTimecode, myReadFrame, aKeyFrame, aBFrame); aTrack->GetNextFrame(aTimecode, myReadFrame, aKeyFrame, aBFrame);
aFrame = myReadFrame->buf(); aFrame = myReadFrame->buf();
@ -440,8 +440,8 @@ bool FileMatroska::ReadFrame(Track * & aTrack, uint32 & aTimecode, const binary
if (aTrack->NoFrameLeft()) if (aTrack->NoFrameLeft())
{ {
aTrack->FlushBlock(); aTrack->FlushBlock();
myCurrReadBlockTrack = 0; myCurrReadBlockTrack = 0;
} }
return true; return true;

View File

@ -11,12 +11,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -28,9 +28,9 @@
**********************************************************************/ **********************************************************************/
/*! /*!
\file \file
\version \$Id: KaxAttached.cpp 1202 2005-08-30 14:39:01Z robux4 $ \version \$Id: KaxAttached.cpp 1202 2005-08-30 14:39:01Z robux4 $
\author Steve Lhomme <robux4 @ users.sf.net> \author Steve Lhomme <robux4 @ users.sf.net>
*/ */
#include "matroska/KaxContexts.h" #include "matroska/KaxContexts.h"
#include "matroska/KaxDefines.h" #include "matroska/KaxDefines.h"
@ -45,7 +45,7 @@ START_LIBMATROSKA_NAMESPACE
KaxAttached::KaxAttached(EBML_EXTRA_DEF) KaxAttached::KaxAttached(EBML_EXTRA_DEF)
:EbmlMaster(EBML_CLASS_SEMCONTEXT(KaxAttached) EBML_DEF_SEP EBML_EXTRA_CALL) :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 END_LIBMATROSKA_NAMESPACE

View File

@ -11,12 +11,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -28,9 +28,9 @@
**********************************************************************/ **********************************************************************/
/*! /*!
\file \file
\version \$Id: KaxAttachments.cpp 640 2004-07-09 21:05:36Z mosu $ \version \$Id: KaxAttachments.cpp 640 2004-07-09 21:05:36Z mosu $
\author Steve Lhomme <robux4 @ users.sf.net> \author Steve Lhomme <robux4 @ users.sf.net>
*/ */
#include "matroska/KaxContexts.h" #include "matroska/KaxContexts.h"
#include "matroska/KaxDefines.h" #include "matroska/KaxDefines.h"
@ -44,7 +44,7 @@ START_LIBMATROSKA_NAMESPACE
KaxAttachments::KaxAttachments(EBML_EXTRA_DEF) KaxAttachments::KaxAttachments(EBML_EXTRA_DEF)
:EbmlMaster(EBML_CLASS_SEMCONTEXT(KaxAttachments) EBML_DEF_SEP EBML_EXTRA_CALL) :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 END_LIBMATROSKA_NAMESPACE

File diff suppressed because it is too large Load Diff

View File

@ -9,12 +9,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -26,9 +26,9 @@
**********************************************************************/ **********************************************************************/
/*! /*!
\file \file
\version \$Id: KaxBlockData.cpp 1226 2005-10-13 21:16:43Z robux4 $ \version \$Id: KaxBlockData.cpp 1226 2005-10-13 21:16:43Z robux4 $
\author Steve Lhomme <robux4 @ users.sf.net> \author Steve Lhomme <robux4 @ users.sf.net>
*/ */
#include <cassert> #include <cassert>
@ -44,8 +44,8 @@ START_LIBMATROSKA_NAMESPACE
const KaxBlockBlob & KaxReferenceBlock::RefBlock() const const KaxBlockBlob & KaxReferenceBlock::RefBlock() const
{ {
assert(RefdBlock != NULL); assert(RefdBlock != NULL);
return *RefdBlock; return *RefdBlock;
} }
KaxReferenceBlock::KaxReferenceBlock(EBML_EXTRA_DEF) KaxReferenceBlock::KaxReferenceBlock(EBML_EXTRA_DEF)
@ -81,34 +81,34 @@ void KaxReferenceBlock::FreeBlob()
filepos_t KaxReferenceBlock::UpdateSize(bool bSaveDefault, bool bForceRender) filepos_t KaxReferenceBlock::UpdateSize(bool bSaveDefault, bool bForceRender)
{ {
if (!bTimecodeSet) { if (!bTimecodeSet) {
assert(RefdBlock != NULL); assert(RefdBlock != NULL);
assert(ParentBlock != NULL); assert(ParentBlock != NULL);
const KaxInternalBlock &block = *RefdBlock; const KaxInternalBlock &block = *RefdBlock;
*static_cast<EbmlSInteger*>(this) = (int64(block.GlobalTimecode()) - int64(ParentBlock->GlobalTimecode())) / int64(ParentBlock->GlobalTimecodeScale()); *static_cast<EbmlSInteger*>(this) = (int64(block.GlobalTimecode()) - int64(ParentBlock->GlobalTimecode())) / int64(ParentBlock->GlobalTimecodeScale());
} }
return EbmlSInteger::UpdateSize(bSaveDefault, bForceRender); return EbmlSInteger::UpdateSize(bSaveDefault, bForceRender);
} }
void KaxReferenceBlock::SetReferencedBlock(const KaxBlockBlob * aRefdBlock) void KaxReferenceBlock::SetReferencedBlock(const KaxBlockBlob * aRefdBlock)
{ {
assert(RefdBlock == NULL); assert(RefdBlock == NULL);
assert(aRefdBlock != NULL); assert(aRefdBlock != NULL);
FreeBlob(); FreeBlob();
RefdBlock = aRefdBlock; RefdBlock = aRefdBlock;
bOurBlob = true; bOurBlob = true;
SetValueIsSet(); SetValueIsSet();
} }
void KaxReferenceBlock::SetReferencedBlock(const KaxBlockGroup & aRefdBlock) void KaxReferenceBlock::SetReferencedBlock(const KaxBlockGroup & aRefdBlock)
{ {
FreeBlob(); FreeBlob();
KaxBlockBlob *block_blob = new KaxBlockBlob(BLOCK_BLOB_NO_SIMPLE); KaxBlockBlob *block_blob = new KaxBlockBlob(BLOCK_BLOB_NO_SIMPLE);
block_blob->SetBlockGroup(*const_cast<KaxBlockGroup*>(&aRefdBlock)); block_blob->SetBlockGroup(*const_cast<KaxBlockGroup*>(&aRefdBlock));
RefdBlock = block_blob; RefdBlock = block_blob;
bOurBlob = true; bOurBlob = true;
SetValueIsSet(); SetValueIsSet();
} }
END_LIBMATROSKA_NAMESPACE END_LIBMATROSKA_NAMESPACE

View File

@ -9,12 +9,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -26,9 +26,9 @@
**********************************************************************/ **********************************************************************/
/*! /*!
\file \file
\version \$Id: KaxCluster.cpp 1228 2005-10-14 19:36:51Z robux4 $ \version \$Id: KaxCluster.cpp 1228 2005-10-14 19:36:51Z robux4 $
\author Steve Lhomme <robux4 @ users.sf.net> \author Steve Lhomme <robux4 @ users.sf.net>
*/ */
#include "matroska/KaxCluster.h" #include "matroska/KaxCluster.h"
#include "matroska/KaxBlock.h" #include "matroska/KaxBlock.h"
@ -40,263 +40,263 @@
START_LIBMATROSKA_NAMESPACE START_LIBMATROSKA_NAMESPACE
KaxCluster::KaxCluster(EBML_EXTRA_DEF) KaxCluster::KaxCluster(EBML_EXTRA_DEF)
:EbmlMaster(EBML_CLASS_SEMCONTEXT(KaxCluster) EBML_DEF_SEP EBML_EXTRA_CALL) :EbmlMaster(EBML_CLASS_SEMCONTEXT(KaxCluster) EBML_DEF_SEP EBML_EXTRA_CALL)
,currentNewBlock(NULL) ,currentNewBlock(NULL)
,ParentSegment(NULL) ,ParentSegment(NULL)
,bFirstFrameInside(false) ,bFirstFrameInside(false)
,bPreviousTimecodeIsSet(false) ,bPreviousTimecodeIsSet(false)
,bTimecodeScaleIsSet(false) ,bTimecodeScaleIsSet(false)
,bSilentTracksUsed(false) ,bSilentTracksUsed(false)
{} {}
KaxCluster::KaxCluster(const KaxCluster & ElementToClone) KaxCluster::KaxCluster(const KaxCluster & ElementToClone)
:EbmlMaster(ElementToClone) :EbmlMaster(ElementToClone)
,bSilentTracksUsed(ElementToClone.bSilentTracksUsed) ,bSilentTracksUsed(ElementToClone.bSilentTracksUsed)
{ {
// update the parent of each children // update the parent of each children
EBML_MASTER_ITERATOR Itr = begin(); EBML_MASTER_ITERATOR Itr = begin();
while (Itr != end()) while (Itr != end())
{ {
if (EbmlId(**Itr) == EBML_ID(KaxBlockGroup)) { if (EbmlId(**Itr) == EBML_ID(KaxBlockGroup)) {
static_cast<KaxBlockGroup *>(*Itr)->SetParent(*this); static_cast<KaxBlockGroup *>(*Itr)->SetParent(*this);
} else if (EbmlId(**Itr) == EBML_ID(KaxBlock)) { } else if (EbmlId(**Itr) == EBML_ID(KaxBlock)) {
static_cast<KaxBlock *>(*Itr)->SetParent(*this); static_cast<KaxBlock *>(*Itr)->SetParent(*this);
#if MATROSKA_VERSION >= 2 #if MATROSKA_VERSION >= 2
} else if (EbmlId(**Itr) == EBML_ID(KaxBlockVirtual)) { } else if (EbmlId(**Itr) == EBML_ID(KaxBlockVirtual)) {
static_cast<KaxBlockVirtual *>(*Itr)->SetParent(*this); static_cast<KaxBlockVirtual *>(*Itr)->SetParent(*this);
#endif // MATROSKA_VERSION #endif // MATROSKA_VERSION
} }
++Itr; ++Itr;
} }
} }
bool KaxCluster::AddBlockBlob(KaxBlockBlob * NewBlob) bool KaxCluster::AddBlockBlob(KaxBlockBlob * NewBlob)
{ {
Blobs.push_back(NewBlob); Blobs.push_back(NewBlob);
return true; return true;
} }
bool KaxCluster::AddFrameInternal(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, KaxBlockGroup * & MyNewBlock, const KaxBlockGroup * PastBlock, const KaxBlockGroup * ForwBlock, LacingType lacing) bool KaxCluster::AddFrameInternal(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, KaxBlockGroup * & MyNewBlock, const KaxBlockGroup * PastBlock, const KaxBlockGroup * ForwBlock, LacingType lacing)
{ {
if (!bFirstFrameInside) { if (!bFirstFrameInside) {
bFirstFrameInside = true; bFirstFrameInside = true;
MinTimecode = MaxTimecode = timecode; MinTimecode = MaxTimecode = timecode;
} else { } else {
if (timecode < MinTimecode) if (timecode < MinTimecode)
MinTimecode = timecode; MinTimecode = timecode;
if (timecode > MaxTimecode) if (timecode > MaxTimecode)
MaxTimecode = timecode; MaxTimecode = timecode;
} }
MyNewBlock = NULL; MyNewBlock = NULL;
if (lacing == LACING_NONE || !track.LacingEnabled()) { if (lacing == LACING_NONE || !track.LacingEnabled()) {
currentNewBlock = NULL; currentNewBlock = NULL;
} }
// force creation of a new block // force creation of a new block
if (currentNewBlock == NULL || uint32(track.TrackNumber()) != uint32(currentNewBlock->TrackNumber()) || PastBlock != NULL || ForwBlock != NULL) { if (currentNewBlock == NULL || uint32(track.TrackNumber()) != uint32(currentNewBlock->TrackNumber()) || PastBlock != NULL || ForwBlock != NULL) {
KaxBlockGroup & aNewBlock = GetNewBlock(); KaxBlockGroup & aNewBlock = GetNewBlock();
MyNewBlock = currentNewBlock = &aNewBlock; MyNewBlock = currentNewBlock = &aNewBlock;
} }
if (PastBlock != NULL) { if (PastBlock != NULL) {
if (ForwBlock != NULL) { if (ForwBlock != NULL) {
if (currentNewBlock->AddFrame(track, timecode, buffer, *PastBlock, *ForwBlock, lacing)) { if (currentNewBlock->AddFrame(track, timecode, buffer, *PastBlock, *ForwBlock, lacing)) {
// more data are allowed in this Block // more data are allowed in this Block
return true; return true;
} else { } else {
currentNewBlock = NULL; currentNewBlock = NULL;
return false; return false;
} }
} else { } else {
if (currentNewBlock->AddFrame(track, timecode, buffer, *PastBlock, lacing)) { if (currentNewBlock->AddFrame(track, timecode, buffer, *PastBlock, lacing)) {
// more data are allowed in this Block // more data are allowed in this Block
return true; return true;
} else { } else {
currentNewBlock = NULL; currentNewBlock = NULL;
return false; return false;
} }
} }
} else { } else {
if (currentNewBlock->AddFrame(track, timecode, buffer, lacing)) { if (currentNewBlock->AddFrame(track, timecode, buffer, lacing)) {
// more data are allowed in this Block // more data are allowed in this Block
return true; return true;
} else { } else {
currentNewBlock = NULL; currentNewBlock = NULL;
return false; return false;
} }
} }
} }
bool KaxCluster::AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, KaxBlockGroup * & MyNewBlock, LacingType lacing) bool KaxCluster::AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, KaxBlockGroup * & MyNewBlock, LacingType lacing)
{ {
assert(Blobs.size() == 0); // mutually exclusive for the moment assert(Blobs.size() == 0); // mutually exclusive for the moment
return AddFrameInternal(track, timecode, buffer, MyNewBlock, NULL, NULL, lacing); 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) 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 assert(Blobs.size() == 0); // mutually exclusive for the moment
return AddFrameInternal(track, timecode, buffer, MyNewBlock, &PastBlock, NULL, lacing); 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) 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 assert(Blobs.size() == 0); // mutually exclusive for the moment
return AddFrameInternal(track, timecode, buffer, MyNewBlock, &PastBlock, &ForwBlock, lacing); 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 KaxCluster::Render(IOCallback & output, KaxCues & CueToUpdate, bool bSaveDefault)
{ {
filepos_t Result = 0; filepos_t Result = 0;
size_t Index; size_t Index;
EBML_MASTER_ITERATOR TrkItr, Itr; EBML_MASTER_ITERATOR TrkItr, Itr;
// update the Timecode of the Cluster before writing // update the Timecode of the Cluster before writing
KaxClusterTimecode * Timecode = static_cast<KaxClusterTimecode *>(this->FindElt(EBML_INFO(KaxClusterTimecode))); KaxClusterTimecode * Timecode = static_cast<KaxClusterTimecode *>(this->FindElt(EBML_INFO(KaxClusterTimecode)));
*static_cast<EbmlUInteger *>(Timecode) = GlobalTimecode() / GlobalTimecodeScale(); *static_cast<EbmlUInteger *>(Timecode) = GlobalTimecode() / GlobalTimecodeScale();
if (Blobs.size() == 0) { if (Blobs.size() == 0) {
// old-school direct KaxBlockGroup // old-school direct KaxBlockGroup
// SilentTracks handling // SilentTracks handling
// check the parent cluster for existing tracks and see if they are contained in this cluster or not // check the parent cluster for existing tracks and see if they are contained in this cluster or not
if (bSilentTracksUsed) if (bSilentTracksUsed)
{ {
KaxTracks & MyTracks = *static_cast<KaxTracks *>(ParentSegment->FindElt(EBML_INFO(KaxTracks))); KaxTracks & MyTracks = *static_cast<KaxTracks *>(ParentSegment->FindElt(EBML_INFO(KaxTracks)));
for (TrkItr = MyTracks.begin(); TrkItr != MyTracks.end(); ++TrkItr) for (TrkItr = MyTracks.begin(); TrkItr != MyTracks.end(); ++TrkItr)
{ {
if (EbmlId(*(*TrkItr)) == EBML_ID(KaxTrackEntry)) if (EbmlId(*(*TrkItr)) == EBML_ID(KaxTrackEntry))
{ {
KaxTrackEntry & entry = *static_cast<KaxTrackEntry *>(*TrkItr); KaxTrackEntry & entry = *static_cast<KaxTrackEntry *>(*TrkItr);
uint32 tracknum = entry.TrackNumber(); uint32 tracknum = entry.TrackNumber();
for (Itr = begin(); Itr != end(); ++Itr) for (Itr = begin(); Itr != end(); ++Itr)
{ {
if (EbmlId(*(*Itr)) == EBML_ID(KaxBlockGroup)) { if (EbmlId(*(*Itr)) == EBML_ID(KaxBlockGroup)) {
KaxBlockGroup & group = *static_cast<KaxBlockGroup *>(*Itr); KaxBlockGroup & group = *static_cast<KaxBlockGroup *>(*Itr);
if (group.TrackNumber() == tracknum) if (group.TrackNumber() == tracknum)
break; // this track is used break; // this track is used
} }
} }
// the track wasn't found in this cluster // the track wasn't found in this cluster
if (Itr == end()) if (Itr == end())
{ {
KaxClusterSilentTracks * SilentTracks = static_cast<KaxClusterSilentTracks *>(this->FindFirstElt(EBML_INFO(KaxClusterSilentTracks))); KaxClusterSilentTracks * SilentTracks = static_cast<KaxClusterSilentTracks *>(this->FindFirstElt(EBML_INFO(KaxClusterSilentTracks)));
assert(SilentTracks != NULL); // the flag bSilentTracksUsed should be set when creating the Cluster assert(SilentTracks != NULL); // the flag bSilentTracksUsed should be set when creating the Cluster
KaxClusterSilentTrackNumber * trackelt = static_cast<KaxClusterSilentTrackNumber *>(SilentTracks->AddNewElt(EBML_INFO(KaxClusterSilentTrackNumber))); KaxClusterSilentTrackNumber * trackelt = static_cast<KaxClusterSilentTrackNumber *>(SilentTracks->AddNewElt(EBML_INFO(KaxClusterSilentTrackNumber)));
*static_cast<EbmlUInteger *>(trackelt) = tracknum; *static_cast<EbmlUInteger *>(trackelt) = tracknum;
} }
} }
} }
} }
Result = EbmlMaster::Render(output, bSaveDefault);
// For all Blocks add their position on the CueEntry
Result = EbmlMaster::Render(output, bSaveDefault);
// For all Blocks add their position on the CueEntry
for (Itr = begin(); Itr != end(); ++Itr) for (Itr = begin(); Itr != end(); ++Itr)
{ {
if (EbmlId(*(*Itr)) == EBML_ID(KaxBlockGroup)) { if (EbmlId(*(*Itr)) == EBML_ID(KaxBlockGroup)) {
CueToUpdate.PositionSet(*static_cast<const KaxBlockGroup *>(*Itr)); CueToUpdate.PositionSet(*static_cast<const KaxBlockGroup *>(*Itr));
} }
} }
} else { } else {
// new school, using KaxBlockBlob // new school, using KaxBlockBlob
for (Index = 0; Index<Blobs.size(); Index++) for (Index = 0; Index<Blobs.size(); Index++)
{ {
#if MATROSKA_VERSION >= 2 #if MATROSKA_VERSION >= 2
if (Blobs[Index]->IsSimpleBlock()) if (Blobs[Index]->IsSimpleBlock())
PushElement( (KaxSimpleBlock&) *Blobs[Index] ); PushElement( (KaxSimpleBlock&) *Blobs[Index] );
else else
#endif #endif
PushElement( (KaxBlockGroup&) *Blobs[Index] ); PushElement( (KaxBlockGroup&) *Blobs[Index] );
} }
// SilentTracks handling // SilentTracks handling
// check the parent cluster for existing tracks and see if they are contained in this cluster or not // check the parent cluster for existing tracks and see if they are contained in this cluster or not
if (bSilentTracksUsed) if (bSilentTracksUsed)
{ {
KaxTracks & MyTracks = *static_cast<KaxTracks *>(ParentSegment->FindElt(EBML_INFO(KaxTracks))); KaxTracks & MyTracks = *static_cast<KaxTracks *>(ParentSegment->FindElt(EBML_INFO(KaxTracks)));
for (TrkItr = MyTracks.begin(); TrkItr != MyTracks.end(); ++TrkItr) for (TrkItr = MyTracks.begin(); TrkItr != MyTracks.end(); ++TrkItr)
{ {
if (EbmlId(*(*TrkItr)) == EBML_ID(KaxTrackEntry)) if (EbmlId(*(*TrkItr)) == EBML_ID(KaxTrackEntry))
{ {
KaxTrackEntry & entry = *static_cast<KaxTrackEntry *>(*TrkItr); KaxTrackEntry & entry = *static_cast<KaxTrackEntry *>(*TrkItr);
uint32 tracknum = entry.TrackNumber(); uint32 tracknum = entry.TrackNumber();
for (Index = 0; Index<Blobs.size(); Index++) { for (Index = 0; Index<Blobs.size(); Index++) {
if (((KaxInternalBlock&)*Blobs[Index]).TrackNum() == tracknum) if (((KaxInternalBlock&)*Blobs[Index]).TrackNum() == tracknum)
break; // this track is used break; // this track is used
} }
// the track wasn't found in this cluster // the track wasn't found in this cluster
if (Index == ListSize()) if (Index == ListSize())
{ {
KaxClusterSilentTracks * SilentTracks = static_cast<KaxClusterSilentTracks *>(this->FindFirstElt(EBML_INFO(KaxClusterSilentTracks))); KaxClusterSilentTracks * SilentTracks = static_cast<KaxClusterSilentTracks *>(this->FindFirstElt(EBML_INFO(KaxClusterSilentTracks)));
assert(SilentTracks != NULL); // the flag bSilentTracksUsed should be set when creating the Cluster assert(SilentTracks != NULL); // the flag bSilentTracksUsed should be set when creating the Cluster
KaxClusterSilentTrackNumber * trackelt = static_cast<KaxClusterSilentTrackNumber *>(SilentTracks->AddNewElt(EBML_INFO(KaxClusterSilentTrackNumber))); KaxClusterSilentTrackNumber * trackelt = static_cast<KaxClusterSilentTrackNumber *>(SilentTracks->AddNewElt(EBML_INFO(KaxClusterSilentTrackNumber)));
*static_cast<EbmlUInteger *>(trackelt) = tracknum; *static_cast<EbmlUInteger *>(trackelt) = tracknum;
} }
} }
} }
} }
Result = EbmlMaster::Render(output, bSaveDefault); Result = EbmlMaster::Render(output, bSaveDefault);
// For all Blocks add their position on the CueEntry // For all Blocks add their position on the CueEntry
for (Index = 0; Index<Blobs.size(); Index++) { for (Index = 0; Index<Blobs.size(); Index++) {
CueToUpdate.PositionSet(*Blobs[Index]); CueToUpdate.PositionSet(*Blobs[Index]);
} }
Blobs.clear(); Blobs.clear();
} }
return Result; 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 uint64 KaxCluster::GlobalTimecode() const
{ {
assert(bPreviousTimecodeIsSet); assert(bPreviousTimecodeIsSet);
uint64 result = MinTimecode; uint64 result = MinTimecode;
if (result < PreviousTimecode) if (result < PreviousTimecode)
result = PreviousTimecode + 1; result = PreviousTimecode + 1;
return result; return result;
} }
/*! /*!
\brief retrieve the relative \brief retrieve the relative
\todo !!! We need a way to know the TimecodeScale \todo !!! We need a way to know the TimecodeScale
*/ */
int16 KaxCluster::GetBlockLocalTimecode(uint64 aGlobalTimecode) const int16 KaxCluster::GetBlockLocalTimecode(uint64 aGlobalTimecode) const
{ {
int64 TimecodeDelay = (int64(aGlobalTimecode) - int64(GlobalTimecode())) / int64(GlobalTimecodeScale()); int64 TimecodeDelay = (int64(aGlobalTimecode) - int64(GlobalTimecode())) / int64(GlobalTimecodeScale());
assert(TimecodeDelay >= int16(0x8000) && TimecodeDelay <= int16(0x7FFF)); assert(TimecodeDelay >= int16(0x8000) && TimecodeDelay <= int16(0x7FFF));
return int16(TimecodeDelay); return int16(TimecodeDelay);
} }
uint64 KaxCluster::GetBlockGlobalTimecode(int16 GlobalSavedTimecode) uint64 KaxCluster::GetBlockGlobalTimecode(int16 GlobalSavedTimecode)
{ {
if (!bFirstFrameInside) { if (!bFirstFrameInside) {
KaxClusterTimecode * Timecode = static_cast<KaxClusterTimecode *>(this->FindElt(EBML_INFO(KaxClusterTimecode))); KaxClusterTimecode * Timecode = static_cast<KaxClusterTimecode *>(this->FindElt(EBML_INFO(KaxClusterTimecode)));
assert (bFirstFrameInside); // use the InitTimecode() hack for now assert (bFirstFrameInside); // use the InitTimecode() hack for now
MinTimecode = MaxTimecode = PreviousTimecode = *static_cast<EbmlUInteger *>(Timecode); MinTimecode = MaxTimecode = PreviousTimecode = *static_cast<EbmlUInteger *>(Timecode);
bFirstFrameInside = true; bFirstFrameInside = true;
bPreviousTimecodeIsSet = true; bPreviousTimecodeIsSet = true;
} }
return int64(GlobalSavedTimecode * GlobalTimecodeScale()) + GlobalTimecode(); return int64(GlobalSavedTimecode * GlobalTimecodeScale()) + GlobalTimecode();
} }
KaxBlockGroup & KaxCluster::GetNewBlock() KaxBlockGroup & KaxCluster::GetNewBlock()
{ {
KaxBlockGroup & MyBlock = AddNewChild<KaxBlockGroup>(*this); KaxBlockGroup & MyBlock = AddNewChild<KaxBlockGroup>(*this);
MyBlock.SetParent(*this); MyBlock.SetParent(*this);
return MyBlock; return MyBlock;
} }
void KaxCluster::ReleaseFrames() void KaxCluster::ReleaseFrames()
@ -304,16 +304,16 @@ void KaxCluster::ReleaseFrames()
EBML_MASTER_ITERATOR Itr; EBML_MASTER_ITERATOR Itr;
for (Itr = begin(); Itr != end(); ++Itr) for (Itr = begin(); Itr != end(); ++Itr)
{ {
if (EbmlId(*(*Itr)) == EBML_ID(KaxBlockGroup)) { if (EbmlId(*(*Itr)) == EBML_ID(KaxBlockGroup)) {
static_cast<KaxBlockGroup*>(*Itr)->ReleaseFrames(); static_cast<KaxBlockGroup*>(*Itr)->ReleaseFrames();
} }
} }
} }
uint64 KaxCluster::GetPosition() const uint64 KaxCluster::GetPosition() const
{ {
assert(ParentSegment != NULL); assert(ParentSegment != NULL);
return ParentSegment->GetRelativePosition(*this); return ParentSegment->GetRelativePosition(*this);
} }
END_LIBMATROSKA_NAMESPACE END_LIBMATROSKA_NAMESPACE

View File

@ -11,12 +11,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -28,9 +28,9 @@
**********************************************************************/ **********************************************************************/
/*! /*!
\file \file
\version \$Id: KaxContexts.cpp 640 2004-07-09 21:05:36Z mosu $ \version \$Id: KaxContexts.cpp 640 2004-07-09 21:05:36Z mosu $
\author Steve Lhomme <robux4 @ users.sf.net> \author Steve Lhomme <robux4 @ users.sf.net>
*/ */
#include "ebml/EbmlContexts.h" #include "ebml/EbmlContexts.h"
#include "ebml/EbmlHead.h" #include "ebml/EbmlHead.h"
@ -61,7 +61,7 @@ DEFINE_SEMANTIC_CONTEXT(KaxTrackEntry)
// for the moment // for the moment
const EbmlSemanticContext & GetKaxGlobal_Context() const EbmlSemanticContext & GetKaxGlobal_Context()
{ {
return GetEbmlGlobal_Context(); return GetEbmlGlobal_Context();
} }
END_LIBMATROSKA_NAMESPACE END_LIBMATROSKA_NAMESPACE

View File

@ -9,12 +9,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -26,9 +26,9 @@
**********************************************************************/ **********************************************************************/
/*! /*!
\file \file
\version \$Id: KaxCues.cpp 1265 2007-01-14 17:20:35Z mosu $ \version \$Id: KaxCues.cpp 1265 2007-01-14 17:20:35Z mosu $
\author Steve Lhomme <robux4 @ users.sf.net> \author Steve Lhomme <robux4 @ users.sf.net>
*/ */
#include <cassert> #include <cassert>
@ -44,119 +44,119 @@ START_LIBMATROSKA_NAMESPACE
KaxCues::~KaxCues() 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 /* deprecated and wrong
bool KaxCues::AddBlockGroup(const KaxBlockGroup & BlockRef) bool KaxCues::AddBlockGroup(const KaxBlockGroup & BlockRef)
{ {
// Do not add the element if it's already present. // Do not add the element if it's already present.
std::vector<const KaxBlockBlob *>::iterator ListIdx; std::vector<const KaxBlockBlob *>::iterator ListIdx;
KaxBlockBlob *BlockReference = new KaxBlockBlob(BLOCK_BLOB_NO_SIMPLE); KaxBlockBlob *BlockReference = new KaxBlockBlob(BLOCK_BLOB_NO_SIMPLE);
BlockReference->SetBlockGroup(*const_cast<KaxBlockGroup*>(&BlockRef)); BlockReference->SetBlockGroup(*const_cast<KaxBlockGroup*>(&BlockRef));
for (ListIdx = myTempReferences.begin(); ListIdx != myTempReferences.end(); ListIdx++) for (ListIdx = myTempReferences.begin(); ListIdx != myTempReferences.end(); ListIdx++)
if (&(KaxBlockGroup&)*ListIdx == &BlockRef) if (&(KaxBlockGroup&)*ListIdx == &BlockRef)
{ {
delete BlockReference; delete BlockReference;
return true; return true;
} }
myTempReferences.push_back(BlockReference); myTempReferences.push_back(BlockReference);
return true; return true;
} }
*/ */
bool KaxCues::AddBlockBlob(const KaxBlockBlob & BlockReference) bool KaxCues::AddBlockBlob(const KaxBlockBlob & BlockReference)
{ {
// Do not add the element if it's already present. // Do not add the element if it's already present.
std::vector<const KaxBlockBlob *>::iterator ListIdx; std::vector<const KaxBlockBlob *>::iterator ListIdx;
for (ListIdx = myTempReferences.begin(); ListIdx != myTempReferences.end(); ++ListIdx) for (ListIdx = myTempReferences.begin(); ListIdx != myTempReferences.end(); ++ListIdx)
if (*ListIdx == &BlockReference) if (*ListIdx == &BlockReference)
return true; return true;
myTempReferences.push_back(&BlockReference); myTempReferences.push_back(&BlockReference);
return true; return true;
} }
void KaxCues::PositionSet(const KaxBlockBlob & BlockReference) void KaxCues::PositionSet(const KaxBlockBlob & BlockReference)
{ {
// look for the element in the temporary references // look for the element in the temporary references
std::vector<const KaxBlockBlob *>::iterator ListIdx; std::vector<const KaxBlockBlob *>::iterator ListIdx;
for (ListIdx = myTempReferences.begin(); ListIdx != myTempReferences.end(); ++ListIdx) { for (ListIdx = myTempReferences.begin(); ListIdx != myTempReferences.end(); ++ListIdx) {
if (*ListIdx == &BlockReference) { if (*ListIdx == &BlockReference) {
// found, now add the element to the entry list // found, now add the element to the entry list
KaxCuePoint & NewPoint = AddNewChild<KaxCuePoint>(*this); KaxCuePoint & NewPoint = AddNewChild<KaxCuePoint>(*this);
NewPoint.PositionSet(BlockReference, GlobalTimecodeScale()); NewPoint.PositionSet(BlockReference, GlobalTimecodeScale());
myTempReferences.erase(ListIdx); myTempReferences.erase(ListIdx);
break; break;
} }
} }
} }
void KaxCues::PositionSet(const KaxBlockGroup & BlockRef) void KaxCues::PositionSet(const KaxBlockGroup & BlockRef)
{ {
// look for the element in the temporary references // look for the element in the temporary references
std::vector<const KaxBlockBlob *>::iterator ListIdx; std::vector<const KaxBlockBlob *>::iterator ListIdx;
for (ListIdx = myTempReferences.begin(); ListIdx != myTempReferences.end(); ++ListIdx) { for (ListIdx = myTempReferences.begin(); ListIdx != myTempReferences.end(); ++ListIdx) {
const KaxInternalBlock &refTmp = **ListIdx; const KaxInternalBlock &refTmp = **ListIdx;
if (refTmp.GlobalTimecode() == BlockRef.GlobalTimecode() && if (refTmp.GlobalTimecode() == BlockRef.GlobalTimecode() &&
refTmp.TrackNum() == BlockRef.TrackNumber()) { refTmp.TrackNum() == BlockRef.TrackNumber()) {
// found, now add the element to the entry list // found, now add the element to the entry list
KaxCuePoint & NewPoint = AddNewChild<KaxCuePoint>(*this); KaxCuePoint & NewPoint = AddNewChild<KaxCuePoint>(*this);
NewPoint.PositionSet(**ListIdx, GlobalTimecodeScale()); NewPoint.PositionSet(**ListIdx, GlobalTimecodeScale());
myTempReferences.erase(ListIdx); myTempReferences.erase(ListIdx);
break; 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 const KaxCuePoint * KaxCues::GetTimecodePoint(uint64 aTimecode) const
{ {
uint64 TimecodeToLocate = aTimecode / GlobalTimecodeScale(); uint64 TimecodeToLocate = aTimecode / GlobalTimecodeScale();
const KaxCuePoint * aPointPrev = NULL; const KaxCuePoint * aPointPrev = NULL;
uint64 aPrevTime = 0; uint64 aPrevTime = 0;
uint64 aNextTime = EBML_PRETTYLONGINT(0xFFFFFFFFFFFF); uint64 aNextTime = EBML_PRETTYLONGINT(0xFFFFFFFFFFFF);
EBML_MASTER_CONST_ITERATOR Itr; EBML_MASTER_CONST_ITERATOR Itr;
for (Itr = begin(); Itr != end(); ++Itr) for (Itr = begin(); Itr != end(); ++Itr)
{ {
if (EbmlId(*(*Itr)) == EBML_ID(KaxCuePoint)) { if (EbmlId(*(*Itr)) == EBML_ID(KaxCuePoint)) {
const KaxCuePoint *tmp = static_cast<const KaxCuePoint *>(*Itr); const KaxCuePoint *tmp = static_cast<const KaxCuePoint *>(*Itr);
// check the tile // check the tile
const KaxCueTime *aTime = static_cast<const KaxCueTime *>(tmp->FindFirstElt(EBML_INFO(KaxCueTime))); const KaxCueTime *aTime = static_cast<const KaxCueTime *>(tmp->FindFirstElt(EBML_INFO(KaxCueTime)));
if (aTime != NULL) if (aTime != NULL)
{ {
uint64 _Time = uint64(*aTime); uint64 _Time = uint64(*aTime);
if (_Time > aPrevTime && _Time < TimecodeToLocate) { if (_Time > aPrevTime && _Time < TimecodeToLocate) {
aPrevTime = _Time; aPrevTime = _Time;
aPointPrev = tmp; aPointPrev = tmp;
} }
if (_Time < aNextTime && _Time > TimecodeToLocate) { if (_Time < aNextTime && _Time > TimecodeToLocate) {
aNextTime= _Time; aNextTime= _Time;
} }
} }
} }
} }
return aPointPrev; return aPointPrev;
} }
uint64 KaxCues::GetTimecodePosition(uint64 aTimecode) const uint64 KaxCues::GetTimecodePosition(uint64 aTimecode) const
{ {
const KaxCuePoint * aPoint = GetTimecodePoint(aTimecode); const KaxCuePoint * aPoint = GetTimecodePoint(aTimecode);
if (aPoint == NULL) if (aPoint == NULL)
return 0; return 0;
const KaxCueTrackPositions * aTrack = aPoint->GetSeekPosition(); const KaxCueTrackPositions * aTrack = aPoint->GetSeekPosition();
if (aTrack == NULL) if (aTrack == NULL)
return 0; return 0;
return aTrack->ClusterPosition(); return aTrack->ClusterPosition();
} }
END_LIBMATROSKA_NAMESPACE END_LIBMATROSKA_NAMESPACE

View File

@ -9,12 +9,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -26,9 +26,9 @@
**********************************************************************/ **********************************************************************/
/*! /*!
\file \file
\version \$Id: KaxCuesData.cpp 1265 2007-01-14 17:20:35Z mosu $ \version \$Id: KaxCuesData.cpp 1265 2007-01-14 17:20:35Z mosu $
\author Steve Lhomme <robux4 @ users.sf.net> \author Steve Lhomme <robux4 @ users.sf.net>
*/ */
#include <cassert> #include <cassert>
@ -44,197 +44,197 @@
START_LIBMATROSKA_NAMESPACE START_LIBMATROSKA_NAMESPACE
/*! /*!
\todo handle codec state checking \todo handle codec state checking
\todo remove duplicate references (reference to 2 frames that each reference the same frame) \todo remove duplicate references (reference to 2 frames that each reference the same frame)
*/ */
void KaxCuePoint::PositionSet(const KaxBlockGroup & BlockReference, uint64 GlobalTimecodeScale) void KaxCuePoint::PositionSet(const KaxBlockGroup & BlockReference, uint64 GlobalTimecodeScale)
{ {
// fill me // fill me
KaxCueTime & NewTime = GetChild<KaxCueTime>(*this); KaxCueTime & NewTime = GetChild<KaxCueTime>(*this);
*static_cast<EbmlUInteger*>(&NewTime) = BlockReference.GlobalTimecode() / GlobalTimecodeScale; *static_cast<EbmlUInteger*>(&NewTime) = BlockReference.GlobalTimecode() / GlobalTimecodeScale;
KaxCueTrackPositions & NewPositions = AddNewChild<KaxCueTrackPositions>(*this); KaxCueTrackPositions & NewPositions = AddNewChild<KaxCueTrackPositions>(*this);
KaxCueTrack & TheTrack = GetChild<KaxCueTrack>(NewPositions); KaxCueTrack & TheTrack = GetChild<KaxCueTrack>(NewPositions);
*static_cast<EbmlUInteger*>(&TheTrack) = BlockReference.TrackNumber(); *static_cast<EbmlUInteger*>(&TheTrack) = BlockReference.TrackNumber();
KaxCueClusterPosition & TheClustPos = GetChild<KaxCueClusterPosition>(NewPositions); KaxCueClusterPosition & TheClustPos = GetChild<KaxCueClusterPosition>(NewPositions);
*static_cast<EbmlUInteger*>(&TheClustPos) = BlockReference.ClusterPosition(); *static_cast<EbmlUInteger*>(&TheClustPos) = BlockReference.ClusterPosition();
#if MATROSKA_VERSION >= 2 #if MATROSKA_VERSION >= 2
// handle reference use // handle reference use
if (BlockReference.ReferenceCount() != 0) if (BlockReference.ReferenceCount() != 0)
{ {
unsigned int i; unsigned int i;
for (i=0; i<BlockReference.ReferenceCount(); i++) { for (i=0; i<BlockReference.ReferenceCount(); i++) {
KaxCueReference & NewRefs = AddNewChild<KaxCueReference>(NewPositions); KaxCueReference & NewRefs = AddNewChild<KaxCueReference>(NewPositions);
NewRefs.AddReference(BlockReference.Reference(i).RefBlock(), GlobalTimecodeScale); NewRefs.AddReference(BlockReference.Reference(i).RefBlock(), GlobalTimecodeScale);
} }
} }
KaxCodecState *CodecState = static_cast<KaxCodecState *>(BlockReference.FindFirstElt(EBML_INFO(KaxCodecState))); KaxCodecState *CodecState = static_cast<KaxCodecState *>(BlockReference.FindFirstElt(EBML_INFO(KaxCodecState)));
if (CodecState != NULL) { if (CodecState != NULL) {
KaxCueCodecState &CueCodecState = AddNewChild<KaxCueCodecState>(NewPositions); KaxCueCodecState &CueCodecState = AddNewChild<KaxCueCodecState>(NewPositions);
*static_cast<EbmlUInteger*>(&CueCodecState) = BlockReference.GetParentCluster()->GetParentSegment()->GetRelativePosition(CodecState->GetElementPosition()); *static_cast<EbmlUInteger*>(&CueCodecState) = BlockReference.GetParentCluster()->GetParentSegment()->GetRelativePosition(CodecState->GetElementPosition());
} }
#endif // MATROSKA_VERSION #endif // MATROSKA_VERSION
SetValueIsSet(); SetValueIsSet();
} }
void KaxCuePoint::PositionSet(const KaxBlockBlob & BlobReference, uint64 GlobalTimecodeScale) void KaxCuePoint::PositionSet(const KaxBlockBlob & BlobReference, uint64 GlobalTimecodeScale)
{ {
const KaxInternalBlock &BlockReference = BlobReference; const KaxInternalBlock &BlockReference = BlobReference;
// fill me // fill me
KaxCueTime & NewTime = GetChild<KaxCueTime>(*this); KaxCueTime & NewTime = GetChild<KaxCueTime>(*this);
*static_cast<EbmlUInteger*>(&NewTime) = BlockReference.GlobalTimecode() / GlobalTimecodeScale; *static_cast<EbmlUInteger*>(&NewTime) = BlockReference.GlobalTimecode() / GlobalTimecodeScale;
KaxCueTrackPositions & NewPositions = AddNewChild<KaxCueTrackPositions>(*this); KaxCueTrackPositions & NewPositions = AddNewChild<KaxCueTrackPositions>(*this);
KaxCueTrack & TheTrack = GetChild<KaxCueTrack>(NewPositions); KaxCueTrack & TheTrack = GetChild<KaxCueTrack>(NewPositions);
*static_cast<EbmlUInteger*>(&TheTrack) = BlockReference.TrackNum(); *static_cast<EbmlUInteger*>(&TheTrack) = BlockReference.TrackNum();
KaxCueClusterPosition & TheClustPos = GetChild<KaxCueClusterPosition>(NewPositions); KaxCueClusterPosition & TheClustPos = GetChild<KaxCueClusterPosition>(NewPositions);
*static_cast<EbmlUInteger*>(&TheClustPos) = BlockReference.ClusterPosition(); *static_cast<EbmlUInteger*>(&TheClustPos) = BlockReference.ClusterPosition();
#if 0 // MATROSKA_VERSION >= 2 #if 0 // MATROSKA_VERSION >= 2
// handle reference use // handle reference use
if (BlockReference.ReferenceCount() != 0) if (BlockReference.ReferenceCount() != 0)
{ {
unsigned int i; unsigned int i;
for (i=0; i<BlockReference.ReferenceCount(); i++) { for (i=0; i<BlockReference.ReferenceCount(); i++) {
KaxCueReference & NewRefs = AddNewChild<KaxCueReference>(NewPositions); KaxCueReference & NewRefs = AddNewChild<KaxCueReference>(NewPositions);
NewRefs.AddReference(BlockReference.Reference(i).RefBlock(), GlobalTimecodeScale); NewRefs.AddReference(BlockReference.Reference(i).RefBlock(), GlobalTimecodeScale);
} }
} }
#endif // MATROSKA_VERSION #endif // MATROSKA_VERSION
#if MATROSKA_VERSION >= 2 #if MATROSKA_VERSION >= 2
if (!BlobReference.IsSimpleBlock()) { if (!BlobReference.IsSimpleBlock()) {
const KaxBlockGroup &BlockGroup = BlobReference; const KaxBlockGroup &BlockGroup = BlobReference;
const KaxCodecState *CodecState = static_cast<KaxCodecState *>(BlockGroup.FindFirstElt(EBML_INFO(KaxCodecState))); const KaxCodecState *CodecState = static_cast<KaxCodecState *>(BlockGroup.FindFirstElt(EBML_INFO(KaxCodecState)));
if (CodecState != NULL) { if (CodecState != NULL) {
KaxCueCodecState &CueCodecState = AddNewChild<KaxCueCodecState>(NewPositions); KaxCueCodecState &CueCodecState = AddNewChild<KaxCueCodecState>(NewPositions);
*static_cast<EbmlUInteger*>(&CueCodecState) = BlockGroup.GetParentCluster()->GetParentSegment()->GetRelativePosition(CodecState->GetElementPosition()); *static_cast<EbmlUInteger*>(&CueCodecState) = BlockGroup.GetParentCluster()->GetParentSegment()->GetRelativePosition(CodecState->GetElementPosition());
} }
} }
#endif // MATROSKA_VERSION #endif // MATROSKA_VERSION
SetValueIsSet(); SetValueIsSet();
} }
#if MATROSKA_VERSION >= 2 #if MATROSKA_VERSION >= 2
/*! /*!
\todo handle codec state checking \todo handle codec state checking
*/ */
void KaxCueReference::AddReference(const KaxBlockBlob & BlockReference, uint64 GlobalTimecodeScale) void KaxCueReference::AddReference(const KaxBlockBlob & BlockReference, uint64 GlobalTimecodeScale)
{ {
const KaxInternalBlock & theBlock = BlockReference; const KaxInternalBlock & theBlock = BlockReference;
KaxCueRefTime & NewTime = GetChild<KaxCueRefTime>(*this); KaxCueRefTime & NewTime = GetChild<KaxCueRefTime>(*this);
*static_cast<EbmlUInteger*>(&NewTime) = theBlock.GlobalTimecode() / GlobalTimecodeScale; *static_cast<EbmlUInteger*>(&NewTime) = theBlock.GlobalTimecode() / GlobalTimecodeScale;
KaxCueRefCluster & TheClustPos = GetChild<KaxCueRefCluster>(*this); KaxCueRefCluster & TheClustPos = GetChild<KaxCueRefCluster>(*this);
*static_cast<EbmlUInteger*>(&TheClustPos) = theBlock.ClusterPosition(); *static_cast<EbmlUInteger*>(&TheClustPos) = theBlock.ClusterPosition();
#ifdef OLD #ifdef OLD
// handle recursive reference use // handle recursive reference use
if (BlockReference.ReferenceCount() != 0) if (BlockReference.ReferenceCount() != 0)
{ {
unsigned int i; unsigned int i;
for (i=0; i<BlockReference.ReferenceCount(); i++) { for (i=0; i<BlockReference.ReferenceCount(); i++) {
AddReference(BlockReference.Reference(i).RefBlock()); AddReference(BlockReference.Reference(i).RefBlock());
} }
} }
#endif /* OLD */ #endif /* OLD */
} }
#endif #endif
bool KaxCuePoint::IsSmallerThan(const EbmlElement * EltB) const bool KaxCuePoint::IsSmallerThan(const EbmlElement * EltB) const
{ {
assert(EbmlId(*this) == EBML_ID(KaxCuePoint)); assert(EbmlId(*this) == EBML_ID(KaxCuePoint));
assert(EbmlId(*EltB) == 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 // compare timecode
const KaxCueTime * TimeCodeA = static_cast<const KaxCueTime *>(FindElt(EBML_INFO(KaxCueTime))); const KaxCueTime * TimeCodeA = static_cast<const KaxCueTime *>(FindElt(EBML_INFO(KaxCueTime)));
if (TimeCodeA == NULL) if (TimeCodeA == NULL)
return false; return false;
const KaxCueTime * TimeCodeB = static_cast<const KaxCueTime *>(theEltB.FindElt(EBML_INFO(KaxCueTime))); const KaxCueTime * TimeCodeB = static_cast<const KaxCueTime *>(theEltB.FindElt(EBML_INFO(KaxCueTime)));
if (TimeCodeB == NULL) if (TimeCodeB == NULL)
return false; return false;
if (TimeCodeA->IsSmallerThan(TimeCodeB)) if (TimeCodeA->IsSmallerThan(TimeCodeB))
return true; return true;
if (TimeCodeB->IsSmallerThan(TimeCodeA)) if (TimeCodeB->IsSmallerThan(TimeCodeA))
return false; return false;
// compare tracks (timecodes are equal) // compare tracks (timecodes are equal)
const KaxCueTrack * TrackA = static_cast<const KaxCueTrack *>(FindElt(EBML_INFO(KaxCueTrack))); const KaxCueTrack * TrackA = static_cast<const KaxCueTrack *>(FindElt(EBML_INFO(KaxCueTrack)));
if (TrackA == NULL) if (TrackA == NULL)
return false; return false;
const KaxCueTrack * TrackB = static_cast<const KaxCueTrack *>(theEltB.FindElt(EBML_INFO(KaxCueTrack))); const KaxCueTrack * TrackB = static_cast<const KaxCueTrack *>(theEltB.FindElt(EBML_INFO(KaxCueTrack)));
if (TrackB == NULL) if (TrackB == NULL)
return false; return false;
if (TrackA->IsSmallerThan(TrackB)) if (TrackA->IsSmallerThan(TrackB))
return true; return true;
if (TrackB->IsSmallerThan(TrackA)) if (TrackB->IsSmallerThan(TrackA))
return false; return false;
return false; return false;
} }
bool KaxCuePoint::Timecode(uint64 & aTimecode, uint64 GlobalTimecodeScale) const bool KaxCuePoint::Timecode(uint64 & aTimecode, uint64 GlobalTimecodeScale) const
{ {
const KaxCueTime *aTime = static_cast<const KaxCueTime *>(FindFirstElt(EBML_INFO(KaxCueTime))); const KaxCueTime *aTime = static_cast<const KaxCueTime *>(FindFirstElt(EBML_INFO(KaxCueTime)));
if (aTime == NULL) if (aTime == NULL)
return false; return false;
aTimecode = uint64(*aTime) * GlobalTimecodeScale; aTimecode = uint64(*aTime) * GlobalTimecodeScale;
return true; 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 * KaxCuePoint::GetSeekPosition() const
{ {
const KaxCueTrackPositions * result = NULL; const KaxCueTrackPositions * result = NULL;
uint64 aPosition = EBML_PRETTYLONGINT(0xFFFFFFFFFFFFFFF); uint64 aPosition = EBML_PRETTYLONGINT(0xFFFFFFFFFFFFFFF);
// find the position of the "earlier" Cluster // find the position of the "earlier" Cluster
const KaxCueTrackPositions *aPoss = static_cast<const KaxCueTrackPositions *>(FindFirstElt(EBML_INFO(KaxCueTrackPositions))); const KaxCueTrackPositions *aPoss = static_cast<const KaxCueTrackPositions *>(FindFirstElt(EBML_INFO(KaxCueTrackPositions)));
while (aPoss != NULL) while (aPoss != NULL)
{ {
const KaxCueClusterPosition *aPos = static_cast<const KaxCueClusterPosition *>(aPoss->FindFirstElt(EBML_INFO(KaxCueClusterPosition))); const KaxCueClusterPosition *aPos = static_cast<const KaxCueClusterPosition *>(aPoss->FindFirstElt(EBML_INFO(KaxCueClusterPosition)));
if (aPos != NULL && uint64(*aPos) < aPosition) { if (aPos != NULL && uint64(*aPos) < aPosition) {
aPosition = uint64(*aPos); aPosition = uint64(*aPos);
result = aPoss; result = aPoss;
} }
aPoss = static_cast<const KaxCueTrackPositions *>(FindNextElt(*aPoss)); aPoss = static_cast<const KaxCueTrackPositions *>(FindNextElt(*aPoss));
} }
return result; return result;
} }
uint64 KaxCueTrackPositions::ClusterPosition() const uint64 KaxCueTrackPositions::ClusterPosition() const
{ {
const KaxCueClusterPosition *aPos = static_cast<const KaxCueClusterPosition *>(FindFirstElt(EBML_INFO(KaxCueClusterPosition))); const KaxCueClusterPosition *aPos = static_cast<const KaxCueClusterPosition *>(FindFirstElt(EBML_INFO(KaxCueClusterPosition)));
if (aPos == NULL) if (aPos == NULL)
return 0; return 0;
return uint64(*aPos); return uint64(*aPos);
} }
uint16 KaxCueTrackPositions::TrackNumber() const uint16 KaxCueTrackPositions::TrackNumber() const
{ {
const KaxCueTrack *aTrack = static_cast<const KaxCueTrack *>(FindFirstElt(EBML_INFO(KaxCueTrack))); const KaxCueTrack *aTrack = static_cast<const KaxCueTrack *>(FindFirstElt(EBML_INFO(KaxCueTrack)));
if (aTrack == NULL) if (aTrack == NULL)
return 0; return 0;
return uint16(*aTrack); return uint16(*aTrack);
} }

View File

@ -11,12 +11,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -28,10 +28,10 @@
**********************************************************************/ **********************************************************************/
/*! /*!
\file \file
\version \$Id$ \version \$Id$
\author Steve Lhomme <robux4 @ users.sf.net> \author Steve Lhomme <robux4 @ users.sf.net>
\author John Cannon <spyder2555 @ users.sf.net> \author John Cannon <spyder2555 @ users.sf.net>
*/ */
#include "matroska/KaxInfoData.h" #include "matroska/KaxInfoData.h"
#include "matroska/KaxContexts.h" #include "matroska/KaxContexts.h"

View File

@ -11,12 +11,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -28,9 +28,9 @@
**********************************************************************/ **********************************************************************/
/*! /*!
\file \file
\version \$Id: KaxSeekHead.cpp 640 2004-07-09 21:05:36Z mosu $ \version \$Id: KaxSeekHead.cpp 640 2004-07-09 21:05:36Z mosu $
\author Steve Lhomme <robux4 @ users.sf.net> \author Steve Lhomme <robux4 @ users.sf.net>
*/ */
#include "matroska/KaxSeekHead.h" #include "matroska/KaxSeekHead.h"
#include "matroska/KaxContexts.h" #include "matroska/KaxContexts.h"
@ -44,106 +44,106 @@ using namespace LIBEBML_NAMESPACE;
START_LIBMATROSKA_NAMESPACE 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) void KaxSeekHead::IndexThis(const EbmlElement & aElt, const KaxSegment & ParentSegment)
{ {
// create a new point // create a new point
KaxSeek & aNewPoint = AddNewChild<KaxSeek>(*this); KaxSeek & aNewPoint = AddNewChild<KaxSeek>(*this);
// add the informations to this element // add the informations to this element
KaxSeekPosition & aNewPos = GetChild<KaxSeekPosition>(aNewPoint); KaxSeekPosition & aNewPos = GetChild<KaxSeekPosition>(aNewPoint);
*static_cast<EbmlUInteger *>(&aNewPos) = ParentSegment.GetRelativePosition(aElt); *static_cast<EbmlUInteger *>(&aNewPos) = ParentSegment.GetRelativePosition(aElt);
KaxSeekID & aNewID = GetChild<KaxSeekID>(aNewPoint); KaxSeekID & aNewID = GetChild<KaxSeekID>(aNewPoint);
binary ID[4]; binary ID[4];
((const EbmlId&)aElt).Fill(ID); ((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 KaxSeek * KaxSeekHead::FindFirstOf(const EbmlCallbacks & Callbacks) const
{ {
// parse all the Entries and find the first to match the type // parse all the Entries and find the first to match the type
KaxSeek * aElt = static_cast<KaxSeek *>(FindFirstElt(EBML_INFO(KaxSeek))); KaxSeek * aElt = static_cast<KaxSeek *>(FindFirstElt(EBML_INFO(KaxSeek)));
while (aElt != NULL) while (aElt != NULL)
{ {
KaxSeekID * aId = NULL; KaxSeekID * aId = NULL;
EBML_MASTER_ITERATOR Itr; 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)) { if (EbmlId(*(*Itr)) == EBML_ID(KaxSeekID)) {
aId = static_cast<KaxSeekID*>(*Itr); aId = static_cast<KaxSeekID*>(*Itr);
EbmlId aEbmlId(aId->GetBuffer(), aId->GetSize()); EbmlId aEbmlId(aId->GetBuffer(), aId->GetSize());
if (aEbmlId == EBML_INFO_ID(Callbacks)) if (aEbmlId == EBML_INFO_ID(Callbacks))
{ {
return aElt; return aElt;
} }
break; break;
} }
} }
aElt = static_cast<KaxSeek *>(FindNextElt(*aElt)); aElt = static_cast<KaxSeek *>(FindNextElt(*aElt));
} }
return NULL; return NULL;
} }
KaxSeek * KaxSeekHead::FindNextOf(const KaxSeek &aPrev) const KaxSeek * KaxSeekHead::FindNextOf(const KaxSeek &aPrev) const
{ {
EBML_MASTER_CONST_ITERATOR Itr; EBML_MASTER_CONST_ITERATOR Itr;
KaxSeek *tmp; KaxSeek *tmp;
// look for the previous in the list
for (Itr = begin(); Itr != end(); ++Itr)
{
if (*Itr == static_cast<const EbmlElement*>(&aPrev))
break;
}
if (Itr != end()) // look for the previous in the list
for (Itr = begin(); Itr != end(); ++Itr)
{ {
++Itr; if (*Itr == static_cast<const EbmlElement*>(&aPrev))
for (; Itr != end(); ++Itr) break;
}
if (Itr != end())
{
++Itr;
for (; Itr != end(); ++Itr)
{ {
if (EbmlId(*(*Itr)) == EBML_ID(KaxSeek)) if (EbmlId(*(*Itr)) == EBML_ID(KaxSeek))
{ {
tmp = (KaxSeek *)(*Itr); tmp = (KaxSeek *)(*Itr);
if (tmp->IsEbmlId(aPrev)) if (tmp->IsEbmlId(aPrev))
return tmp; return tmp;
} }
} }
} }
return NULL; return NULL;
} }
int64 KaxSeek::Location() const int64 KaxSeek::Location() const
{ {
KaxSeekPosition *aPos = static_cast<KaxSeekPosition*>(FindFirstElt(EBML_INFO(KaxSeekPosition))); KaxSeekPosition *aPos = static_cast<KaxSeekPosition*>(FindFirstElt(EBML_INFO(KaxSeekPosition)));
if (aPos == NULL) if (aPos == NULL)
return 0; return 0;
return uint64(*aPos); return uint64(*aPos);
} }
bool KaxSeek::IsEbmlId(const EbmlId & aId) const bool KaxSeek::IsEbmlId(const EbmlId & aId) const
{ {
KaxSeekID *_Id = static_cast<KaxSeekID*>(FindFirstElt(EBML_INFO(KaxSeekID))); KaxSeekID *_Id = static_cast<KaxSeekID*>(FindFirstElt(EBML_INFO(KaxSeekID)));
if (_Id == NULL) if (_Id == NULL)
return false; return false;
EbmlId aEbmlId(_Id->GetBuffer(), _Id->GetSize()); EbmlId aEbmlId(_Id->GetBuffer(), _Id->GetSize());
return (aId == aEbmlId); return (aId == aEbmlId);
} }
bool KaxSeek::IsEbmlId(const KaxSeek & aPoint) const bool KaxSeek::IsEbmlId(const KaxSeek & aPoint) const
{ {
KaxSeekID *_IdA = static_cast<KaxSeekID*>(FindFirstElt(EBML_INFO(KaxSeekID))); KaxSeekID *_IdA = static_cast<KaxSeekID*>(FindFirstElt(EBML_INFO(KaxSeekID)));
if (_IdA == NULL) if (_IdA == NULL)
return false; return false;
KaxSeekID *_IdB = static_cast<KaxSeekID*>(aPoint.FindFirstElt(EBML_INFO(KaxSeekID))); KaxSeekID *_IdB = static_cast<KaxSeekID*>(aPoint.FindFirstElt(EBML_INFO(KaxSeekID)));
if (_IdB == NULL) if (_IdB == NULL)
return false; return false;
EbmlId aEbmlIdA(_IdA->GetBuffer(), _IdA->GetSize()); EbmlId aEbmlIdA(_IdA->GetBuffer(), _IdA->GetSize());
EbmlId aEbmlIdB(_IdB->GetBuffer(), _IdB->GetSize()); EbmlId aEbmlIdB(_IdB->GetBuffer(), _IdB->GetSize());
return (aEbmlIdA == aEbmlIdB); return (aEbmlIdA == aEbmlIdB);
} }
END_LIBMATROSKA_NAMESPACE END_LIBMATROSKA_NAMESPACE

View File

@ -11,12 +11,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -28,9 +28,9 @@
**********************************************************************/ **********************************************************************/
/*! /*!
\file \file
\version \$Id: KaxSegment.cpp 1096 2005-03-17 09:14:52Z robux4 $ \version \$Id: KaxSegment.cpp 1096 2005-03-17 09:14:52Z robux4 $
\author Steve Lhomme <robux4 @ users.sf.net> \author Steve Lhomme <robux4 @ users.sf.net>
*/ */
#include "matroska/KaxSegment.h" #include "matroska/KaxSegment.h"
#include "ebml/EbmlHead.h" #include "ebml/EbmlHead.h"
@ -46,40 +46,40 @@
START_LIBMATROSKA_NAMESPACE START_LIBMATROSKA_NAMESPACE
KaxSegment::KaxSegment(EBML_EXTRA_DEF) 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) 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 SetSizeInfinite(); // by default a segment is big and the size is unknown in advance
} }
KaxSegment::KaxSegment(const KaxSegment & ElementToClone) KaxSegment::KaxSegment(const KaxSegment & ElementToClone)
:EbmlMaster(ElementToClone) :EbmlMaster(ElementToClone)
{ {
// update the parent of each children // update the parent of each children
EBML_MASTER_ITERATOR Itr = begin(); EBML_MASTER_ITERATOR Itr = begin();
while (Itr != end()) while (Itr != end())
{ {
if (EbmlId(**Itr) == EBML_ID(KaxCluster)) { if (EbmlId(**Itr) == EBML_ID(KaxCluster)) {
static_cast<KaxCluster *>(*Itr)->SetParent(*this); static_cast<KaxCluster *>(*Itr)->SetParent(*this);
} }
++Itr; ++Itr;
} }
} }
uint64 KaxSegment::GetRelativePosition(uint64 aGlobalPosition) const uint64 KaxSegment::GetRelativePosition(uint64 aGlobalPosition) const
{ {
return aGlobalPosition - GetElementPosition() - HeadSize(); return aGlobalPosition - GetElementPosition() - HeadSize();
} }
uint64 KaxSegment::GetRelativePosition(const EbmlElement & Elt) const uint64 KaxSegment::GetRelativePosition(const EbmlElement & Elt) const
{ {
return GetRelativePosition(Elt.GetElementPosition()); return GetRelativePosition(Elt.GetElementPosition());
} }
uint64 KaxSegment::GetGlobalPosition(uint64 aRelativePosition) const uint64 KaxSegment::GetGlobalPosition(uint64 aRelativePosition) const
{ {
return aRelativePosition + GetElementPosition() + HeadSize(); return aRelativePosition + GetElementPosition() + HeadSize();
} }
END_LIBMATROSKA_NAMESPACE END_LIBMATROSKA_NAMESPACE

View File

@ -1,23 +1,23 @@
/********************************************************************** /**********************************************************************
** DO NOT EDIT, GENERATED WITH DATA2LIB ** DO NOT EDIT, GENERATED WITH DATA2LIB
** **
** libmatroska : parse Matroska files, see http://www.matroska.org/ ** libmatroska : parse Matroska files, see http://www.matroska.org/
** **
** Copyright (c) 2002-2010, Matroska (non-profit organisation) ** Copyright (c) 2002-2010, Matroska (non-profit organisation)
** All rights reserved. ** All rights reserved.
** **
** This file is part of libmatroska. ** This file is part of libmatroska.
** **
** This library is free software; you can redistribute it and/or ** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -699,103 +699,103 @@ DEFINE_MKX_UNISTRING(KaxTagString, 0x4487, 2, KaxTagSimple, "TagString");
DEFINE_MKX_BINARY (KaxTagBinary, 0x4485, 2, KaxTagSimple, "TagBinary"); DEFINE_MKX_BINARY (KaxTagBinary, 0x4485, 2, KaxTagSimple, "TagBinary");
filepos_t KaxBlockVirtual::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { filepos_t KaxBlockVirtual::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) {
assert(false); // no you are not allowed to use this element ! assert(false); // no you are not allowed to use this element !
return 0; return 0;
} }
filepos_t KaxReferenceVirtual::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { filepos_t KaxReferenceVirtual::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) {
assert(false); // no you are not allowed to use this element ! assert(false); // no you are not allowed to use this element !
return 0; return 0;
} }
filepos_t KaxSliceFrameNumber::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { filepos_t KaxSliceFrameNumber::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) {
assert(false); // no you are not allowed to use this element ! assert(false); // no you are not allowed to use this element !
return 0; return 0;
} }
filepos_t KaxSliceBlockAddID::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { filepos_t KaxSliceBlockAddID::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) {
assert(false); // no you are not allowed to use this element ! assert(false); // no you are not allowed to use this element !
return 0; return 0;
} }
filepos_t KaxSliceDelay::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { filepos_t KaxSliceDelay::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) {
assert(false); // no you are not allowed to use this element ! assert(false); // no you are not allowed to use this element !
return 0; return 0;
} }
filepos_t KaxSliceDuration::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { filepos_t KaxSliceDuration::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) {
assert(false); // no you are not allowed to use this element ! assert(false); // no you are not allowed to use this element !
return 0; return 0;
} }
filepos_t KaxEncryptedBlock::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { filepos_t KaxEncryptedBlock::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) {
assert(false); // no you are not allowed to use this element ! assert(false); // no you are not allowed to use this element !
return 0; return 0;
} }
filepos_t KaxTrackTimecodeScale::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { filepos_t KaxTrackTimecodeScale::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) {
assert(false); // no you are not allowed to use this element ! assert(false); // no you are not allowed to use this element !
return 0; return 0;
} }
filepos_t KaxTrackOffset::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { filepos_t KaxTrackOffset::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) {
assert(false); // no you are not allowed to use this element ! assert(false); // no you are not allowed to use this element !
return 0; return 0;
} }
filepos_t KaxCodecSettings::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { filepos_t KaxCodecSettings::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) {
assert(false); // no you are not allowed to use this element ! assert(false); // no you are not allowed to use this element !
return 0; return 0;
} }
filepos_t KaxCodecInfoURL::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { filepos_t KaxCodecInfoURL::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) {
assert(false); // no you are not allowed to use this element ! assert(false); // no you are not allowed to use this element !
return 0; return 0;
} }
filepos_t KaxCodecDownloadURL::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { filepos_t KaxCodecDownloadURL::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) {
assert(false); // no you are not allowed to use this element ! assert(false); // no you are not allowed to use this element !
return 0; return 0;
} }
filepos_t KaxOldStereoMode::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { filepos_t KaxOldStereoMode::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) {
assert(false); // no you are not allowed to use this element ! assert(false); // no you are not allowed to use this element !
return 0; return 0;
} }
filepos_t KaxVideoGamma::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { filepos_t KaxVideoGamma::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) {
assert(false); // no you are not allowed to use this element ! assert(false); // no you are not allowed to use this element !
return 0; return 0;
} }
filepos_t KaxVideoFrameRate::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { filepos_t KaxVideoFrameRate::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) {
assert(false); // no you are not allowed to use this element ! assert(false); // no you are not allowed to use this element !
return 0; return 0;
} }
filepos_t KaxAudioPosition::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { filepos_t KaxAudioPosition::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) {
assert(false); // no you are not allowed to use this element ! assert(false); // no you are not allowed to use this element !
return 0; return 0;
} }
filepos_t KaxCueRefCluster::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { filepos_t KaxCueRefCluster::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) {
assert(false); // no you are not allowed to use this element ! assert(false); // no you are not allowed to use this element !
return 0; return 0;
} }
filepos_t KaxCueRefNumber::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { filepos_t KaxCueRefNumber::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) {
assert(false); // no you are not allowed to use this element ! assert(false); // no you are not allowed to use this element !
return 0; return 0;
} }
filepos_t KaxCueRefCodecState::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { filepos_t KaxCueRefCodecState::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) {
assert(false); // no you are not allowed to use this element ! assert(false); // no you are not allowed to use this element !
return 0; return 0;
} }
filepos_t KaxFileReferral::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) { filepos_t KaxFileReferral::RenderData(IOCallback & /* output */, bool /* bForceRender */, bool /* bSaveDefault */) {
assert(false); // no you are not allowed to use this element ! assert(false); // no you are not allowed to use this element !
return 0; return 0;
} }
END_LIBMATROSKA_NAMESPACE END_LIBMATROSKA_NAMESPACE

View File

@ -11,12 +11,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -28,9 +28,9 @@
**********************************************************************/ **********************************************************************/
/*! /*!
\file \file
\version \$Id: KaxTracks.cpp 1202 2005-08-30 14:39:01Z robux4 $ \version \$Id: KaxTracks.cpp 1202 2005-08-30 14:39:01Z robux4 $
\author Steve Lhomme <robux4 @ users.sf.net> \author Steve Lhomme <robux4 @ users.sf.net>
*/ */
#include "matroska/KaxTracks.h" #include "matroska/KaxTracks.h"
@ -41,14 +41,14 @@
START_LIBMATROSKA_NAMESPACE START_LIBMATROSKA_NAMESPACE
KaxTrackEntry::KaxTrackEntry(EBML_EXTRA_DEF) KaxTrackEntry::KaxTrackEntry(EBML_EXTRA_DEF)
:EbmlMaster(EBML_CLASS_SEMCONTEXT(KaxTrackEntry) EBML_DEF_SEP EBML_EXTRA_CALL) :EbmlMaster(EBML_CLASS_SEMCONTEXT(KaxTrackEntry) EBML_DEF_SEP EBML_EXTRA_CALL)
,bGlobalTimecodeScaleIsSet(false) ,bGlobalTimecodeScaleIsSet(false)
{} {}
void KaxTrackEntry::EnableLacing(bool bEnable) void KaxTrackEntry::EnableLacing(bool bEnable)
{ {
KaxTrackFlagLacing & myLacing = GetChild<KaxTrackFlagLacing>(*this); KaxTrackFlagLacing & myLacing = GetChild<KaxTrackFlagLacing>(*this);
*(static_cast<EbmlUInteger *>(&myLacing)) = bEnable ? 1 : 0; *(static_cast<EbmlUInteger *>(&myLacing)) = bEnable ? 1 : 0;
} }
END_LIBMATROSKA_NAMESPACE END_LIBMATROSKA_NAMESPACE

View File

@ -28,9 +28,9 @@
**********************************************************************/ **********************************************************************/
/*! /*!
\file \file
\version \$Id: KaxVersion.cpp 640 2004-07-09 21:05:36Z mosu $ \version \$Id: KaxVersion.cpp 640 2004-07-09 21:05:36Z mosu $
\author Steve Lhomme <robux4 @ users.sf.net> \author Steve Lhomme <robux4 @ users.sf.net>
*/ */
#include "matroska/KaxVersion.h" #include "matroska/KaxVersion.h"

View File

@ -11,12 +11,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -31,9 +31,9 @@
\file \file
\version \$Id$ \version \$Id$
\author Steve Lhomme <robux4 @ users.sf.net> \author Steve Lhomme <robux4 @ users.sf.net>
Test the EBML write possibilities Test the EBML write possibilities
\see http://www.cl.cam.ac.uk/~mgk25/unicode.html \see http://www.cl.cam.ac.uk/~mgk25/unicode.html
\see http://www-106.ibm.com/developerworks/unicode/library/u-encode.html \see http://www-106.ibm.com/developerworks/unicode/library/u-encode.html
*/ */
#include <stdio.h> #include <stdio.h>
@ -55,31 +55,31 @@ using namespace LIBEBML_NAMESPACE;
const char RW_FILENAME[] = "test.kax"; const char RW_FILENAME[] = "test.kax";
enum SemanticType { enum SemanticType {
EBML_U_INTEGER, EBML_U_INTEGER,
EBML_S_INTEGER, EBML_S_INTEGER,
EBML_BINARY, EBML_BINARY,
EBML_STRING, EBML_STRING,
EBML_STRING_UNICODE, EBML_STRING_UNICODE,
EBML_FLOAT, EBML_FLOAT,
EBML_MASTER, EBML_MASTER,
}; };
typedef binary EBMLID[4]; typedef binary EBMLID[4];
struct Semantic { struct Semantic {
EBMLID Id; EBMLID Id;
int IdLength; int IdLength;
SemanticType Type; SemanticType Type;
}; };
struct Semantic SemanticList[] = struct Semantic SemanticList[] =
{ {
{{0x42, 0x45}, 2, EBML_U_INTEGER}, {{0x42, 0x45}, 2, EBML_U_INTEGER},
{{0x1A, 0x45, 0x33, 0x80}, 4, EBML_S_INTEGER}, {{0x1A, 0x45, 0x33, 0x80}, 4, EBML_S_INTEGER},
{{0x87}, 1, EBML_BINARY}, {{0x87}, 1, EBML_BINARY},
{{0x22, 0x33, 0x44}, 3, EBML_STRING}, {{0x22, 0x33, 0x44}, 3, EBML_STRING},
{{0x44, 0x33}, 2, EBML_STRING_UNICODE}, {{0x44, 0x33}, 2, EBML_STRING_UNICODE},
{{0x50, 0x50}, 2, EBML_FLOAT}, {{0x50, 0x50}, 2, EBML_FLOAT},
{{0x36, 0x47, 0x58}, 3, EBML_MASTER}, {{0x36, 0x47, 0x58}, 3, EBML_MASTER},
}; };
/*! /*!
@ -88,214 +88,214 @@ struct Semantic SemanticList[] =
*/ */
int main(void) int main(void)
{ {
StdIOCallback Ebml_file(RW_FILENAME, ::MODE_CREATE); StdIOCallback Ebml_file(RW_FILENAME, ::MODE_CREATE);
///// Writing test
/////////////////////////////// ///// 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 // Unsigned integer
/////////////////////////////// ///////////////////////////////
EbmlSInteger testSInt(4); // supposed to hold a 4*8 bits value
testSInt.SetID(SemanticList[1].Id, SemanticList[1].IdLength); EbmlUInteger testUInt(4); // supposed to hold a 4*8 bits value
testSInt = -20;
testSInt.Render(Ebml_file);
/////////////////////////////// testUInt.SetID(SemanticList[0].Id, SemanticList[0].IdLength);
// Binary data testUInt = 52;
/////////////////////////////// testUInt.SetSizeLength(3); // size should be coded on at least 3 octets
const int BINARY_SIZE=3000; testUInt.Render(Ebml_file);
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); // Signed integer
testBin.Render(Ebml_file); ///////////////////////////////
/////////////////////////////// EbmlSInteger testSInt(4); // supposed to hold a 4*8 bits value
// String data
///////////////////////////////
std::string aString = "Hello World !";
EbmlString testStr(200);
testStr.SetID(SemanticList[3].Id, SemanticList[3].IdLength); testSInt.SetID(SemanticList[1].Id, SemanticList[1].IdLength);
testStr = aString; testSInt = -20;
testStr.Render(Ebml_file); testSInt.Render(Ebml_file);
/////////////////////////////// ///////////////////////////////
// Master element // Binary data
/////////////////////////////// ///////////////////////////////
EbmlMaster testMaster; const int BINARY_SIZE=3000;
testMaster.SetID(SemanticList[6].Id, SemanticList[6].IdLength); binary *bin = new binary[BINARY_SIZE];
testMaster.PushElement(testStr); memset(bin, 0x61, BINARY_SIZE);
testMaster.PushElement(testUInt); EbmlBinary testBin;
testMaster.Render(Ebml_file);
/////////////////////////////// testBin.SetID(SemanticList[2].Id, SemanticList[2].IdLength);
// Unicode String data testBin.SetBuffer(bin, BINARY_SIZE);
/////////////////////////////// testBin.Render(Ebml_file);
UTFstring bString = L"Stève Lhomm€";
EbmlUnicodeString testUStr(200);
testUStr.SetID(SemanticList[4].Id, SemanticList[4].IdLength); ///////////////////////////////
testUStr = bString; // String data
testUStr.Render(Ebml_file); ///////////////////////////////
std::string aString = "Hello World !";
EbmlString testStr(200);
/////////////////////////////// testStr.SetID(SemanticList[3].Id, SemanticList[3].IdLength);
// Float data testStr = aString;
/////////////////////////////// testStr.Render(Ebml_file);
EbmlFloat testFloat(EbmlFloat::FLOAT_32);
testFloat.SetID(SemanticList[5].Id, SemanticList[5].IdLength); ///////////////////////////////
testFloat.SetPrecision(EbmlFloat::FLOAT_32); // Master element
testFloat = 1.01234567890123456; ///////////////////////////////
testFloat.Render(Ebml_file); EbmlMaster testMaster;
testFloat.SetPrecision(EbmlFloat::FLOAT_64);
testFloat = -1.01234567890123456L;
testFloat.Render(Ebml_file);
Ebml_file.close();
///// Reading test testMaster.SetID(SemanticList[6].Id, SemanticList[6].IdLength);
StdIOCallback Ebml_Wfile(RW_FILENAME, ::MODE_READ); testMaster.PushElement(testStr);
testMaster.PushElement(testUInt);
// example 1 skip all the elements found testMaster.Render(Ebml_file);
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) // Unicode String data
delete ElementLevel0; ///////////////////////////////
UTFstring bString = L"Stève Lhomm€";
ElementLevel0 = aStream.FindNextID(0xFFFFFFFFL, false); EbmlUnicodeString testUStr(200);
}
// 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 testUStr.SetID(SemanticList[4].Id, SemanticList[4].IdLength);
for (i=0; i<countof(SemanticList); i++) { testUStr = bString;
if (ElementLevel0->GetIDLength() != SemanticList[i].IdLength) testUStr.Render(Ebml_file);
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); ///////////////////////////////
// Float data
///////////////////////////////
EbmlFloat testFloat(EbmlFloat::FLOAT_32);
switch (SemanticList[i].Type) testFloat.SetID(SemanticList[5].Id, SemanticList[5].IdLength);
{ testFloat.SetPrecision(EbmlFloat::FLOAT_32);
case EBML_U_INTEGER: testFloat = 1.01234567890123456;
printf(" : %d", uint32(*(EbmlUInteger*)EvaledElementLevel0)); testFloat.Render(Ebml_file);
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"); testFloat.SetPrecision(EbmlFloat::FLOAT_64);
testFloat = -1.01234567890123456L;
ElementLevel0 = aStream.FindNextID(0xFFFFFFFFL, false); testFloat.Render(Ebml_file);
}
Ebml_Wfile.close();
return 0; 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;
} }

View File

@ -11,12 +11,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -31,7 +31,7 @@
\file \file
\version \$Id$ \version \$Id$
\author Steve Lhomme <robux4 @ users.sf.net> \author Steve Lhomme <robux4 @ users.sf.net>
Test the writing a basic EBML file Test the writing a basic EBML file
*/ */
#include <stdio.h> #include <stdio.h>
@ -59,188 +59,188 @@ const char RW_FILENAME[] = "test.kax";
/*! /*!
\test Some test on the Cluster use \test Some test on the Cluster use
\todo each Master element should have a context ! \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 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 find another way than using all those static_cast (using a template ?)
*/ */
int main(void) int main(void)
{ {
printf("Test00 :\nEBML %s %s / Matroska %s %s\n", EbmlCodeVersion.c_str(), EbmlCodeDate.c_str(), KaxCodeVersion.c_str(), KaxCodeDate.c_str()); 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); StdIOCallback Ebml_file(RW_FILENAME, ::MODE_CREATE);
///// Writing test
EbmlHead TestHead;
printf("Write EBML + Matroska elements\n"); ///// Writing test
EDocType & MyDocType = GetChild<EDocType>(TestHead); EbmlHead TestHead;
*static_cast<EbmlString *>(&MyDocType) = "matroska";
EDocTypeVersion & MyDocTypeVer = GetChild<EDocTypeVersion>(TestHead); printf("Write EBML + Matroska elements\n");
*(static_cast<EbmlUInteger *>(&MyDocTypeVer)) = 1; EDocType & MyDocType = GetChild<EDocType>(TestHead);
*static_cast<EbmlString *>(&MyDocType) = "matroska";
EDocTypeReadVersion & MyDocTypeReadVer = GetChild<EDocTypeReadVersion>(TestHead); EDocTypeVersion & MyDocTypeVer = GetChild<EDocTypeVersion>(TestHead);
*(static_cast<EbmlUInteger *>(&MyDocTypeReadVer)) = 1; *(static_cast<EbmlUInteger *>(&MyDocTypeVer)) = 1;
TestHead.Render(Ebml_file); EDocTypeReadVersion & MyDocTypeReadVer = GetChild<EDocTypeReadVersion>(TestHead);
*(static_cast<EbmlUInteger *>(&MyDocTypeReadVer)) = 1;
KaxSegment FirstSegment; TestHead.Render(Ebml_file);
// 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)); KaxSegment FirstSegment;
if (pAllAttachments == NULL) // size is unknown and will always be, we can render it right away
return -1; FirstSegment.Render(Ebml_file);
pAllAttachments->SetSizeInfinite();
// size is unknown and will always be, we can render it right away KaxAttachments * pAllAttachments = static_cast<KaxAttachments *>(FirstSegment.FindFirstElt(KaxAttachments::ClassInfos, true));
pAllAttachments->Render(Ebml_file); if (pAllAttachments == NULL)
return -1;
KaxAttached * pAttachment1 = static_cast<KaxAttached *>(pAllAttachments->FindFirstElt(KaxAttached::ClassInfos, true)); pAllAttachments->SetSizeInfinite();
if (pAttachment1 == NULL) // size is unknown and will always be, we can render it right away
return -1; pAllAttachments->Render(Ebml_file);
KaxFileName * pFileName1 = static_cast<KaxFileName *>(pAttachment1->FindFirstElt(KaxFileName::ClassInfos, true));
if (pFileName1 == NULL) KaxAttached * pAttachment1 = static_cast<KaxAttached *>(pAllAttachments->FindFirstElt(KaxAttached::ClassInfos, true));
return -1; if (pAttachment1 == NULL)
*static_cast<EbmlUnicodeString *>(pFileName1) = "file1.txt"; return -1;
KaxFileData * pFileData1 = static_cast<KaxFileData *>(pAttachment1->FindFirstElt(KaxFileData::ClassInfos, true)); KaxFileName * pFileName1 = static_cast<KaxFileName *>(pAttachment1->FindFirstElt(KaxFileName::ClassInfos, true));
if (pFileData1 == NULL) if (pFileName1 == NULL)
return -1; return -1;
char Buffer1[] = "Ah ah ah !"; *static_cast<EbmlUnicodeString *>(pFileName1) = "file1.txt";
static_cast<EbmlBinary *>(pFileData1)->SetBuffer((const binary*) Buffer1, countof(Buffer1)); KaxFileData * pFileData1 = static_cast<KaxFileData *>(pAttachment1->FindFirstElt(KaxFileData::ClassInfos, true));
// should produce an error if the size is not infinite and the data has been rendered if (pFileData1 == NULL)
pAttachment1->Render(Ebml_file); return -1;
char Buffer1[] = "Ah ah ah !";
KaxAttached * pAttachment2 = static_cast<KaxAttached *>(pAllAttachments->AddNewElt(KaxAttached::ClassInfos)); static_cast<EbmlBinary *>(pFileData1)->SetBuffer((const binary*) Buffer1, countof(Buffer1));
if (pAttachment2 == NULL) // should produce an error if the size is not infinite and the data has been rendered
return -1; pAttachment1->Render(Ebml_file);
KaxFileName * pFileName2 = static_cast<KaxFileName *>(pAttachment2->FindFirstElt(KaxFileName::ClassInfos, true));
if (pFileName2 == NULL) KaxAttached * pAttachment2 = static_cast<KaxAttached *>(pAllAttachments->AddNewElt(KaxAttached::ClassInfos));
return -1; if (pAttachment2 == NULL)
*static_cast<EbmlUnicodeString *>(pFileName2) = "file2.txt"; return -1;
// Add a void element (data is discarded) KaxFileName * pFileName2 = static_cast<KaxFileName *>(pAttachment2->FindFirstElt(KaxFileName::ClassInfos, true));
EbmlVoid * pVoid = static_cast<EbmlVoid *>(pAttachment2->FindFirstElt(EbmlVoid::ClassInfos, true)); if (pFileName2 == NULL)
if (pVoid == NULL) return -1;
return -1; *static_cast<EbmlUnicodeString *>(pFileName2) = "file2.txt";
static_cast<EbmlBinary *>(pVoid)->SetBuffer((const binary*) Buffer1, countof(Buffer1)); // Add a void element (data is discarded)
pAttachment2->Render(Ebml_file); 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 #ifdef SKIP_ATTACHED
KaxSegment SecondSegment; KaxSegment SecondSegment;
// size is unknown and will always be, we can render it right away // size is unknown and will always be, we can render it right away
SecondSegment.Render(Ebml_file); SecondSegment.Render(Ebml_file);
#endif // SKIP_ATTACHED #endif // SKIP_ATTACHED
Ebml_file.close(); Ebml_file.close();
///// Reading test ///// Reading test
StdIOCallback Ebml_Wfile(RW_FILENAME, ::MODE_READ); 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); // example 1 skip all the elements found
if (ElementLevel0 != NULL) EbmlStream aStream(Ebml_Wfile);
delete ElementLevel0; EbmlElement * ElementLevel0;
} EbmlElement * ElementLevel1;
EbmlElement * ElementLevel2;
EbmlElement * ElementLevel3;
// example to read attachements in the file // read the data until a possible element is found (valid ID + size combination)
ElementLevel0 = aStream.FindNextID(KaxSegment::ClassInfos, 0xFFFFFFFFL, false); printf("Read EBML elements & skip data\n");
while (ElementLevel0 != NULL) // find the EBML head in the file
{ ElementLevel0 = aStream.FindNextID(EbmlHead::ClassInfos, 0xFFFFFFFFL, false);
printf("ID : "); if (ElementLevel0 != NULL)
for (unsigned int i=0; i<EbmlId(*ElementLevel0).Length; i++) {
{ printf("ID : ");
printf("[%02X]", EbmlId(*ElementLevel0).Value[i]); for (unsigned int i=0; i<EbmlId(*ElementLevel0).Length; i++)
} {
printf("\n"); printf("[%02X]", EbmlId(*ElementLevel0).Value[i]);
}
printf("\n");
int bUpperElement = 0; ElementLevel0->SkipData(aStream, EbmlHead_Context);
if (ElementLevel0 != NULL)
delete ElementLevel0;
}
ElementLevel1 = aStream.FindNextID(KaxSegment_Context, bUpperElement, 0xFFFFFFFFL, true); // 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");
while (ElementLevel1 != NULL) { int bUpperElement = 0;
/// \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); ElementLevel1 = aStream.FindNextID(KaxSegment_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 while (ElementLevel1 != NULL) {
if (EbmlId(*ElementLevel2) == KaxAttached::ClassInfos.GlobalId) { /// \todo switch the type of the element to check if it's one we want to handle, like attachements
printf("Attached file detected\n"); 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 #ifdef SKIP_ATTACHED
ElementLevel2 = ElementLevel2->SkipData(aStream, KaxAttached_Context); ElementLevel2 = ElementLevel2->SkipData(aStream, KaxAttached_Context);
if (ElementLevel2 == NULL) { if (ElementLevel2 == NULL) {
ElementLevel2 = aStream.FindNextID(KaxAttachments_Context, bUpperElement, 0xFFFFFFFFL, true); ElementLevel2 = aStream.FindNextID(KaxAttachments_Context, bUpperElement, 0xFFFFFFFFL, true);
if (bUpperElement) { if (bUpperElement) {
printf("Upper level1 element found\n"); printf("Upper level1 element found\n");
delete ElementLevel1; delete ElementLevel1;
ElementLevel1 = ElementLevel2; ElementLevel1 = ElementLevel2;
ElementLevel2 = NULL; ElementLevel2 = NULL;
} }
} }
#else // SKIP_ATTACHED #else // SKIP_ATTACHED
// Display the filename (if it exists) // Display the filename (if it exists)
ElementLevel3 = aStream.FindNextID(KaxAttached_Context, bUpperElement, 0xFFFFFFFFL, false); ElementLevel3 = aStream.FindNextID(KaxAttached_Context, bUpperElement, 0xFFFFFFFFL, false);
while (ElementLevel3 != NULL) { while (ElementLevel3 != NULL) {
/// \todo switch the type of the element to check if it's one we want to handle, like attachements /// \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) { if (EbmlId(*ElementLevel3) == KaxFileName::ClassInfos.GlobalId) {
KaxFileName & tmp = *static_cast<KaxFileName*>(ElementLevel3); KaxFileName & tmp = *static_cast<KaxFileName*>(ElementLevel3);
tmp.ReadData(aStream.I_O()); tmp.ReadData(aStream.I_O());
printf("File Name = %ls\n", UTFstring(tmp).c_str()); printf("File Name = %ls\n", UTFstring(tmp).c_str());
} else { } else {
ElementLevel3->SkipData(aStream, KaxAttached_Context); ElementLevel3->SkipData(aStream, KaxAttached_Context);
} }
delete ElementLevel3; delete ElementLevel3;
ElementLevel3 = aStream.FindNextID(KaxAttached_Context, bUpperElement, 0xFFFFFFFFL, false); ElementLevel3 = aStream.FindNextID(KaxAttached_Context, bUpperElement, 0xFFFFFFFFL, false);
if (bUpperElement) if (bUpperElement)
break; break;
} }
if (bUpperElement) { if (bUpperElement) {
delete ElementLevel2; delete ElementLevel2;
ElementLevel2 = ElementLevel3; ElementLevel2 = ElementLevel3;
} else { } else {
ElementLevel2->SkipData(aStream, KaxAttached_Context); ElementLevel2->SkipData(aStream, KaxAttached_Context);
delete ElementLevel2; delete ElementLevel2;
ElementLevel2 = aStream.FindNextID(KaxAttachments_Context, bUpperElement, 0xFFFFFFFFL, true); ElementLevel2 = aStream.FindNextID(KaxAttachments_Context, bUpperElement, 0xFFFFFFFFL, true);
} }
#endif // SKIP_ATTACHED #endif // SKIP_ATTACHED
} }
} }
ElementLevel1->SkipData(aStream, KaxAttachments_Context); ElementLevel1->SkipData(aStream, KaxAttachments_Context);
delete ElementLevel1; delete ElementLevel1;
ElementLevel1 = aStream.FindNextID(KaxSegment_Context, bUpperElement, 0xFFFFFFFFL, true);
}
ElementLevel0->SkipData(aStream, KaxSegment_Context); ElementLevel1 = aStream.FindNextID(KaxSegment_Context, bUpperElement, 0xFFFFFFFFL, true);
if (ElementLevel0 != NULL) }
delete ElementLevel0;
ElementLevel0 = aStream.FindNextID(KaxSegment_Context, bUpperElement, 0xFFFFFFFFL, true);
}
Ebml_Wfile.close(); ElementLevel0->SkipData(aStream, KaxSegment_Context);
if (ElementLevel0 != NULL)
delete ElementLevel0;
return 0; ElementLevel0 = aStream.FindNextID(KaxSegment_Context, bUpperElement, 0xFFFFFFFFL, true);
}
Ebml_Wfile.close();
return 0;
} }

View File

@ -11,12 +11,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -60,7 +60,7 @@ unsigned int BIN_FILE_SIZE = 15000;
unsigned int TXT_FILE_SIZE = 3000; unsigned int TXT_FILE_SIZE = 3000;
const unsigned int BIN_FRAME_SIZE = 1500; const unsigned int BIN_FRAME_SIZE = 1500;
const unsigned int TXT_FRAME_SIZE = 200; const unsigned int TXT_FRAME_SIZE = 200;
const uint64 TIMECODE_SCALE = 1000000; const uint64 TIMECODE_SCALE = 1000000;
const bool bWriteDefaultValues = false; const bool bWriteDefaultValues = false;
@ -73,279 +73,279 @@ int main(int argc, char **argv)
cout << "Creating \"muxed.mkv\"" << endl; cout << "Creating \"muxed.mkv\"" << endl;
try { try {
// write the head of the file (with everything already configured) // write the head of the file (with everything already configured)
StdIOCallback out_file("muxed.mkv", MODE_CREATE); StdIOCallback out_file("muxed.mkv", MODE_CREATE);
///// Writing EBML test ///// Writing EBML test
EbmlHead FileHead; EbmlHead FileHead;
EDocType & MyDocType = GetChild<EDocType>(FileHead); EDocType & MyDocType = GetChild<EDocType>(FileHead);
*static_cast<EbmlString *>(&MyDocType) = "matroska"; *static_cast<EbmlString *>(&MyDocType) = "matroska";
EDocTypeVersion & MyDocTypeVer = GetChild<EDocTypeVersion>(FileHead); EDocTypeVersion & MyDocTypeVer = GetChild<EDocTypeVersion>(FileHead);
*(static_cast<EbmlUInteger *>(&MyDocTypeVer)) = MATROSKA_VERSION; *(static_cast<EbmlUInteger *>(&MyDocTypeVer)) = MATROSKA_VERSION;
EDocTypeReadVersion & MyDocTypeReadVer = GetChild<EDocTypeReadVersion>(FileHead); EDocTypeReadVersion & MyDocTypeReadVer = GetChild<EDocTypeReadVersion>(FileHead);
*(static_cast<EbmlUInteger *>(&MyDocTypeReadVer)) = 1; *(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 // size is unknown and will always be, we can render it right away
uint64 SegmentSize = FileSegment.WriteHead(out_file, 5, bWriteDefaultValues); uint64 SegmentSize = FileSegment.WriteHead(out_file, 5, bWriteDefaultValues);
KaxTracks & MyTracks = GetChild<KaxTracks>(FileSegment);
// reserve some space for the Meta Seek writen at the end KaxTracks & MyTracks = GetChild<KaxTracks>(FileSegment);
EbmlVoid Dummy;
Dummy.SetSize(300); // 300 octets
Dummy.Render(out_file, bWriteDefaultValues);
KaxSeekHead MetaSeek; // reserve some space for the Meta Seek writen at the end
EbmlVoid Dummy;
Dummy.SetSize(300); // 300 octets
Dummy.Render(out_file, bWriteDefaultValues);
// fill the mandatory Info section KaxSeekHead MetaSeek;
KaxInfo & MyInfos = GetChild<KaxInfo>(FileSegment);
KaxTimecodeScale & TimeScale = GetChild<KaxTimecodeScale>(MyInfos);
*(static_cast<EbmlUInteger *>(&TimeScale)) = TIMECODE_SCALE;
KaxDuration & SegDuration = GetChild<KaxDuration>(MyInfos); // fill the mandatory Info section
*(static_cast<EbmlFloat *>(&SegDuration)) = 0.0; KaxInfo & MyInfos = GetChild<KaxInfo>(FileSegment);
KaxTimecodeScale & TimeScale = GetChild<KaxTimecodeScale>(MyInfos);
*(static_cast<EbmlUInteger *>(&TimeScale)) = TIMECODE_SCALE;
*((EbmlUnicodeString *)&GetChild<KaxMuxingApp>(MyInfos)) = L"libmatroska 0.5.0"; KaxDuration & SegDuration = GetChild<KaxDuration>(MyInfos);
*((EbmlUnicodeString *)&GetChild<KaxWritingApp>(MyInfos)) = L"éàôï"; *(static_cast<EbmlFloat *>(&SegDuration)) = 0.0;
GetChild<KaxWritingApp>(MyInfos).SetDefaultSize(25);
filepos_t InfoSize = MyInfos.Render(out_file); *((EbmlUnicodeString *)&GetChild<KaxMuxingApp>(MyInfos)) = L"libmatroska 0.5.0";
MetaSeek.IndexThis(MyInfos, FileSegment); *((EbmlUnicodeString *)&GetChild<KaxWritingApp>(MyInfos)) = L"éàôï";
GetChild<KaxWritingApp>(MyInfos).SetDefaultSize(25);
// fill track 1 params filepos_t InfoSize = MyInfos.Render(out_file);
KaxTrackEntry & MyTrack1 = GetChild<KaxTrackEntry>(MyTracks); MetaSeek.IndexThis(MyInfos, FileSegment);
MyTrack1.SetGlobalTimecodeScale(TIMECODE_SCALE);
KaxTrackNumber & MyTrack1Number = GetChild<KaxTrackNumber>(MyTrack1); // fill track 1 params
*(static_cast<EbmlUInteger *>(&MyTrack1Number)) = 1; KaxTrackEntry & MyTrack1 = GetChild<KaxTrackEntry>(MyTracks);
MyTrack1.SetGlobalTimecodeScale(TIMECODE_SCALE);
KaxTrackUID & MyTrack1UID = GetChild<KaxTrackUID>(MyTrack1); KaxTrackNumber & MyTrack1Number = GetChild<KaxTrackNumber>(MyTrack1);
*(static_cast<EbmlUInteger *>(&MyTrack1UID)) = 7; *(static_cast<EbmlUInteger *>(&MyTrack1Number)) = 1;
*(static_cast<EbmlUInteger *>(&GetChild<KaxTrackType>(MyTrack1))) = track_audio; KaxTrackUID & MyTrack1UID = GetChild<KaxTrackUID>(MyTrack1);
*(static_cast<EbmlUInteger *>(&MyTrack1UID)) = 7;
KaxCodecID & MyTrack1CodecID = GetChild<KaxCodecID>(MyTrack1); *(static_cast<EbmlUInteger *>(&GetChild<KaxTrackType>(MyTrack1))) = track_audio;
*static_cast<EbmlString *>(&MyTrack1CodecID) = "Dummy Audio Codec";
MyTrack1.EnableLacing(true); KaxCodecID & MyTrack1CodecID = GetChild<KaxCodecID>(MyTrack1);
*static_cast<EbmlString *>(&MyTrack1CodecID) = "Dummy Audio Codec";
// Test the new ContentEncoding elements MyTrack1.EnableLacing(true);
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); // Test the new ContentEncoding elements
*(static_cast<EbmlUInteger *>(&GetChild<KaxContentCompAlgo>(ccompression))) = 13; KaxContentEncodings &cencodings = GetChild<KaxContentEncodings>(MyTrack1);
GetChild<KaxContentCompSettings>(ccompression).CopyBuffer((const binary *)"hello1", 6); 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;
KaxContentEncryption &cencryption = GetChild<KaxContentEncryption>(cencoding); KaxContentCompression &ccompression = GetChild<KaxContentCompression>(cencoding);
*(static_cast<EbmlUInteger *>(&GetChild<KaxContentEncAlgo>(cencryption))) = 14; *(static_cast<EbmlUInteger *>(&GetChild<KaxContentCompAlgo>(ccompression))) = 13;
GetChild<KaxContentEncKeyID>(cencryption).CopyBuffer((const binary *)"hello2", 6); GetChild<KaxContentCompSettings>(ccompression).CopyBuffer((const binary *)"hello1", 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 KaxContentEncryption &cencryption = GetChild<KaxContentEncryption>(cencoding);
KaxTrackAudio & MyTrack1Audio = GetChild<KaxTrackAudio>(MyTrack1); *(static_cast<EbmlUInteger *>(&GetChild<KaxContentEncAlgo>(cencryption))) = 14;
GetChild<KaxContentEncKeyID>(cencryption).CopyBuffer((const binary *)"hello2", 6);
KaxAudioSamplingFreq & MyTrack1Freq = GetChild<KaxAudioSamplingFreq>(MyTrack1Audio); *(static_cast<EbmlUInteger *>(&GetChild<KaxContentSigAlgo>(cencryption))) = 15;
*(static_cast<EbmlFloat *>(&MyTrack1Freq)) = 44100.0; *(static_cast<EbmlUInteger *>(&GetChild<KaxContentSigHashAlgo>(cencryption))) = 16;
MyTrack1Freq.ValidateSize(); 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();
#if MATROSKA_VERSION >= 2 #if MATROSKA_VERSION >= 2
KaxAudioPosition & MyTrack1Pos = GetChild<KaxAudioPosition>(MyTrack1Audio); KaxAudioPosition & MyTrack1Pos = GetChild<KaxAudioPosition>(MyTrack1Audio);
binary *_Pos = new binary[5]; binary *_Pos = new binary[5];
_Pos[0] = '0'; _Pos[0] = '0';
_Pos[1] = '1'; _Pos[1] = '1';
_Pos[2] = '2'; _Pos[2] = '2';
_Pos[3] = '3'; _Pos[3] = '3';
_Pos[4] = '\0'; _Pos[4] = '\0';
MyTrack1Pos.SetBuffer(_Pos, 5); MyTrack1Pos.SetBuffer(_Pos, 5);
#endif // MATROSKA_VERSION #endif // MATROSKA_VERSION
KaxAudioChannels & MyTrack1Channels = GetChild<KaxAudioChannels>(MyTrack1Audio); KaxAudioChannels & MyTrack1Channels = GetChild<KaxAudioChannels>(MyTrack1Audio);
*(static_cast<EbmlUInteger *>(&MyTrack1Channels)) = 2; *(static_cast<EbmlUInteger *>(&MyTrack1Channels)) = 2;
// fill track 2 params // fill track 2 params
KaxTrackEntry & MyTrack2 = GetNextChild<KaxTrackEntry>(MyTracks, MyTrack1); KaxTrackEntry & MyTrack2 = GetNextChild<KaxTrackEntry>(MyTracks, MyTrack1);
MyTrack2.SetGlobalTimecodeScale(TIMECODE_SCALE); MyTrack2.SetGlobalTimecodeScale(TIMECODE_SCALE);
KaxTrackNumber & MyTrack2Number = GetChild<KaxTrackNumber>(MyTrack2); KaxTrackNumber & MyTrack2Number = GetChild<KaxTrackNumber>(MyTrack2);
*(static_cast<EbmlUInteger *>(&MyTrack2Number)) = 200; *(static_cast<EbmlUInteger *>(&MyTrack2Number)) = 200;
KaxTrackUID & MyTrack2UID = GetChild<KaxTrackUID>(MyTrack2); KaxTrackUID & MyTrack2UID = GetChild<KaxTrackUID>(MyTrack2);
*(static_cast<EbmlUInteger *>(&MyTrack2UID)) = 13; *(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); KaxCodecID & MyTrack2CodecID = GetChild<KaxCodecID>(MyTrack2);
*static_cast<EbmlString *>(&MyTrack2CodecID) = "Dummy Video Codec"; *static_cast<EbmlString *>(&MyTrack2CodecID) = "Dummy Video Codec";
MyTrack2.EnableLacing(false); MyTrack2.EnableLacing(false);
// video specific params // video specific params
KaxTrackVideo & MyTrack2Video = GetChild<KaxTrackVideo>(MyTrack2); KaxTrackVideo & MyTrack2Video = GetChild<KaxTrackVideo>(MyTrack2);
KaxVideoPixelHeight & MyTrack2PHeight = GetChild<KaxVideoPixelHeight>(MyTrack2Video); KaxVideoPixelHeight & MyTrack2PHeight = GetChild<KaxVideoPixelHeight>(MyTrack2Video);
*(static_cast<EbmlUInteger *>(&MyTrack2PHeight)) = 200; *(static_cast<EbmlUInteger *>(&MyTrack2PHeight)) = 200;
KaxVideoPixelWidth & MyTrack2PWidth = GetChild<KaxVideoPixelWidth>(MyTrack2Video); KaxVideoPixelWidth & MyTrack2PWidth = GetChild<KaxVideoPixelWidth>(MyTrack2Video);
*(static_cast<EbmlUInteger *>(&MyTrack2PWidth)) = 320; *(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 = static_cast<KaxTracks *>(MyTracks.Clone());
// KaxTracks * pMyTracks2 = new KaxTracks(MyTracks); // KaxTracks * pMyTracks2 = new KaxTracks(MyTracks);
MetaSeek.IndexThis(MyTracks, FileSegment); MetaSeek.IndexThis(MyTracks, FileSegment);
// "manual" filling of a cluster" // "manual" filling of a cluster"
/// \todo whenever a BlockGroup is created, we should memorize it's position /// \todo whenever a BlockGroup is created, we should memorize it's position
KaxCues AllCues; KaxCues AllCues;
AllCues.SetGlobalTimecodeScale(TIMECODE_SCALE); AllCues.SetGlobalTimecodeScale(TIMECODE_SCALE);
KaxCluster Clust1; KaxCluster Clust1;
Clust1.SetParent(FileSegment); // mandatory to store references in this Cluster Clust1.SetParent(FileSegment); // mandatory to store references in this Cluster
Clust1.SetPreviousTimecode(0, TIMECODE_SCALE); // the first timecode here Clust1.SetPreviousTimecode(0, TIMECODE_SCALE); // the first timecode here
Clust1.EnableChecksum(); Clust1.EnableChecksum();
// automatic filling of a Cluster // automatic filling of a Cluster
// simple frame // simple frame
KaxBlockGroup *MyNewBlock, *MyLastBlockTrk1 = NULL, *MyLastBlockTrk2 = NULL, *MyNewBlock2; KaxBlockGroup *MyNewBlock, *MyLastBlockTrk1 = NULL, *MyLastBlockTrk2 = NULL, *MyNewBlock2;
DataBuffer *data7 = new DataBuffer((binary *)"tototototo", countof("tototototo")); DataBuffer *data7 = new DataBuffer((binary *)"tototototo", countof("tototototo"));
Clust1.AddFrame(MyTrack1, 250 * TIMECODE_SCALE, *data7, MyNewBlock, LACING_EBML); Clust1.AddFrame(MyTrack1, 250 * TIMECODE_SCALE, *data7, MyNewBlock, LACING_EBML);
if (MyNewBlock != NULL) if (MyNewBlock != NULL)
MyLastBlockTrk1 = MyNewBlock; MyLastBlockTrk1 = MyNewBlock;
DataBuffer *data0 = new DataBuffer((binary *)"TOTOTOTO", countof("TOTOTOTO")); DataBuffer *data0 = new DataBuffer((binary *)"TOTOTOTO", countof("TOTOTOTO"));
Clust1.AddFrame(MyTrack1, 260 * TIMECODE_SCALE, *data0, MyNewBlock); // to test EBML lacing Clust1.AddFrame(MyTrack1, 260 * TIMECODE_SCALE, *data0, MyNewBlock); // to test EBML lacing
if (MyNewBlock != NULL) if (MyNewBlock != NULL)
MyLastBlockTrk1 = MyNewBlock; MyLastBlockTrk1 = MyNewBlock;
DataBuffer *data6 = new DataBuffer((binary *)"tototototo", countof("tototototo")); DataBuffer *data6 = new DataBuffer((binary *)"tototototo", countof("tototototo"));
Clust1.AddFrame(MyTrack1, 270 * TIMECODE_SCALE, *data6, MyNewBlock); // to test lacing Clust1.AddFrame(MyTrack1, 270 * TIMECODE_SCALE, *data6, MyNewBlock); // to test lacing
if (MyNewBlock != NULL) { if (MyNewBlock != NULL) {
MyLastBlockTrk1 = MyNewBlock; MyLastBlockTrk1 = MyNewBlock;
} else { } else {
MyLastBlockTrk1->SetBlockDuration(50 * TIMECODE_SCALE); MyLastBlockTrk1->SetBlockDuration(50 * TIMECODE_SCALE);
} }
DataBuffer *data5 = new DataBuffer((binary *)"tototototo", countof("tototototo")); DataBuffer *data5 = new DataBuffer((binary *)"tototototo", countof("tototototo"));
Clust1.AddFrame(MyTrack2, 23 * TIMECODE_SCALE, *data5, MyNewBlock); // to test with another track 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); KaxBlockBlob *Blob1 = new KaxBlockBlob(BLOCK_BLOB_NO_SIMPLE);
Blob1->SetBlockGroup(*MyLastBlockTrk1); Blob1->SetBlockGroup(*MyLastBlockTrk1);
AllCues.AddBlockBlob(*Blob1); AllCues.AddBlockBlob(*Blob1);
// frame for Track 2 // frame for Track 2
DataBuffer *data8 = new DataBuffer((binary *)"tttyyy", countof("tttyyy")); DataBuffer *data8 = new DataBuffer((binary *)"tttyyy", countof("tttyyy"));
Clust1.AddFrame(MyTrack2, 107 * TIMECODE_SCALE, *data8, MyNewBlock, *MyLastBlockTrk2); Clust1.AddFrame(MyTrack2, 107 * TIMECODE_SCALE, *data8, MyNewBlock, *MyLastBlockTrk2);
KaxBlockBlob *Blob2 = new KaxBlockBlob(BLOCK_BLOB_NO_SIMPLE); KaxBlockBlob *Blob2 = new KaxBlockBlob(BLOCK_BLOB_NO_SIMPLE);
Blob2->SetBlockGroup(*MyNewBlock); Blob2->SetBlockGroup(*MyNewBlock);
AllCues.AddBlockBlob(*Blob2); AllCues.AddBlockBlob(*Blob2);
// frame with a past reference // frame with a past reference
DataBuffer *data4 = new DataBuffer((binary *)"tttyyy", countof("tttyyy")); DataBuffer *data4 = new DataBuffer((binary *)"tttyyy", countof("tttyyy"));
Clust1.AddFrame(MyTrack1, 300 * TIMECODE_SCALE, *data4, MyNewBlock, *MyLastBlockTrk1); Clust1.AddFrame(MyTrack1, 300 * TIMECODE_SCALE, *data4, MyNewBlock, *MyLastBlockTrk1);
// frame with a past & future reference // frame with a past & future reference
if (MyNewBlock != NULL) { if (MyNewBlock != NULL) {
DataBuffer *data3 = new DataBuffer((binary *)"tttyyy", countof("tttyyy")); DataBuffer *data3 = new DataBuffer((binary *)"tttyyy", countof("tttyyy"));
if (Clust1.AddFrame(MyTrack1, 280 * TIMECODE_SCALE, *data3, MyNewBlock2, *MyLastBlockTrk1, *MyNewBlock)) { if (Clust1.AddFrame(MyTrack1, 280 * TIMECODE_SCALE, *data3, MyNewBlock2, *MyLastBlockTrk1, *MyNewBlock)) {
MyNewBlock2->SetBlockDuration(20 * TIMECODE_SCALE); MyNewBlock2->SetBlockDuration(20 * TIMECODE_SCALE);
MyLastBlockTrk1 = MyNewBlock2; MyLastBlockTrk1 = MyNewBlock2;
} else { } else {
printf("Error adding a frame !!!"); printf("Error adding a frame !!!");
} }
} }
KaxBlockBlob *Blob3 = new KaxBlockBlob(BLOCK_BLOB_NO_SIMPLE); KaxBlockBlob *Blob3 = new KaxBlockBlob(BLOCK_BLOB_NO_SIMPLE);
Blob3->SetBlockGroup(*MyLastBlockTrk1); Blob3->SetBlockGroup(*MyLastBlockTrk1);
AllCues.AddBlockBlob(*Blob3); AllCues.AddBlockBlob(*Blob3);
//AllCues.UpdateSize(); //AllCues.UpdateSize();
// simulate the writing of the stream : // simulate the writing of the stream :
// - write an empty element with enough size for the cue entry // - write an empty element with enough size for the cue entry
// - write the cluster(s) // - write the cluster(s)
// - seek back in the file and write the cue entry over the empty element // - seek back in the file and write the cue entry over the empty element
uint64 ClusterSize = Clust1.Render(out_file, AllCues, bWriteDefaultValues); uint64 ClusterSize = Clust1.Render(out_file, AllCues, bWriteDefaultValues);
Clust1.ReleaseFrames(); Clust1.ReleaseFrames();
MetaSeek.IndexThis(Clust1, FileSegment); MetaSeek.IndexThis(Clust1, FileSegment);
KaxCluster Clust2; KaxCluster Clust2;
Clust2.SetParent(FileSegment); // mandatory to store references in this Cluster Clust2.SetParent(FileSegment); // mandatory to store references in this Cluster
Clust2.SetPreviousTimecode(300 * TIMECODE_SCALE, TIMECODE_SCALE); // the first timecode here Clust2.SetPreviousTimecode(300 * TIMECODE_SCALE, TIMECODE_SCALE); // the first timecode here
Clust2.EnableChecksum(); Clust2.EnableChecksum();
DataBuffer *data2 = new DataBuffer((binary *)"tttyyy", countof("tttyyy"));
Clust2.AddFrame(MyTrack1, 350 * TIMECODE_SCALE, *data2, MyNewBlock, *MyLastBlockTrk1);
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); KaxBlockBlob *Blob4 = new KaxBlockBlob(BLOCK_BLOB_NO_SIMPLE);
Blob4->SetBlockGroup(*MyNewBlock); Blob4->SetBlockGroup(*MyNewBlock);
AllCues.AddBlockBlob(*Blob4); AllCues.AddBlockBlob(*Blob4);
ClusterSize += Clust2.Render(out_file, AllCues, bWriteDefaultValues); ClusterSize += Clust2.Render(out_file, AllCues, bWriteDefaultValues);
Clust2.ReleaseFrames(); Clust2.ReleaseFrames();
// older version, write at the end AllCues.Render(out_file); // older version, write at the end AllCues.Render(out_file);
filepos_t CueSize = AllCues.Render(out_file, bWriteDefaultValues); filepos_t CueSize = AllCues.Render(out_file, bWriteDefaultValues);
MetaSeek.IndexThis(AllCues, FileSegment); MetaSeek.IndexThis(AllCues, FileSegment);
// Chapters // Chapters
KaxChapters Chapters; KaxChapters Chapters;
Chapters.EnableChecksum(); Chapters.EnableChecksum();
KaxEditionEntry & aEdition = GetChild<KaxEditionEntry>(Chapters); KaxEditionEntry & aEdition = GetChild<KaxEditionEntry>(Chapters);
KaxChapterAtom & aAtom = GetChild<KaxChapterAtom>(aEdition); KaxChapterAtom & aAtom = GetChild<KaxChapterAtom>(aEdition);
KaxChapterUID & aUID = GetChild<KaxChapterUID>(aAtom); KaxChapterUID & aUID = GetChild<KaxChapterUID>(aAtom);
*static_cast<EbmlUInteger *>(&aUID) = 0x67890; *static_cast<EbmlUInteger *>(&aUID) = 0x67890;
KaxChapterTimeStart & aChapStart = GetChild<KaxChapterTimeStart>(aAtom); KaxChapterTimeStart & aChapStart = GetChild<KaxChapterTimeStart>(aAtom);
*static_cast<EbmlUInteger *>(&aChapStart) = 0; *static_cast<EbmlUInteger *>(&aChapStart) = 0;
KaxChapterTimeEnd & aChapEnd = GetChild<KaxChapterTimeEnd>(aAtom); KaxChapterTimeEnd & aChapEnd = GetChild<KaxChapterTimeEnd>(aAtom);
*static_cast<EbmlUInteger *>(&aChapEnd) = 300 * TIMECODE_SCALE; *static_cast<EbmlUInteger *>(&aChapEnd) = 300 * TIMECODE_SCALE;
KaxChapterDisplay & aDisplay = GetChild<KaxChapterDisplay>(aAtom); KaxChapterDisplay & aDisplay = GetChild<KaxChapterDisplay>(aAtom);
KaxChapterString & aChapString = GetChild<KaxChapterString>(aDisplay); KaxChapterString & aChapString = GetChild<KaxChapterString>(aDisplay);
*static_cast<EbmlUnicodeString *>(&aChapString) = L"Le film réduit à un chapitre"; *static_cast<EbmlUnicodeString *>(&aChapString) = L"Le film réduit à un chapitre";
KaxChapterLanguage & aChapLang = GetChild<KaxChapterLanguage>(aDisplay); KaxChapterLanguage & aChapLang = GetChild<KaxChapterLanguage>(aDisplay);
*static_cast<EbmlString *>(&aChapLang) = "fra"; *static_cast<EbmlString *>(&aChapLang) = "fra";
KaxChapterDisplay & aDisplay2 = GetNextChild<KaxChapterDisplay>(aAtom, aDisplay); KaxChapterDisplay & aDisplay2 = GetNextChild<KaxChapterDisplay>(aAtom, aDisplay);
KaxChapterString & aChapString2 = GetChild<KaxChapterString>(aDisplay2); KaxChapterString & aChapString2 = GetChild<KaxChapterString>(aDisplay2);
*static_cast<EbmlUnicodeString *>(&aChapString2) = L"The movie in one chapter"; *static_cast<EbmlUnicodeString *>(&aChapString2) = L"The movie in one chapter";
KaxChapterLanguage & aChapLang2 = GetChild<KaxChapterLanguage>(aDisplay2); KaxChapterLanguage & aChapLang2 = GetChild<KaxChapterLanguage>(aDisplay2);
*static_cast<EbmlString *>(&aChapLang2) = "eng"; *static_cast<EbmlString *>(&aChapLang2) = "eng";
filepos_t ChapterSize = Chapters.Render(out_file, bWriteDefaultValues); filepos_t ChapterSize = Chapters.Render(out_file, bWriteDefaultValues);
MetaSeek.IndexThis(Chapters, FileSegment); MetaSeek.IndexThis(Chapters, FileSegment);
// Write some tags // Write some tags
KaxTags AllTags; KaxTags AllTags;
AllTags.EnableChecksum(); AllTags.EnableChecksum();
KaxTag & aTag = GetChild<KaxTag>(AllTags); KaxTag & aTag = GetChild<KaxTag>(AllTags);
KaxTagTargets & Targets = GetChild<KaxTagTargets>(aTag); KaxTagTargets & Targets = GetChild<KaxTagTargets>(aTag);
KaxTagSimple & TagSimple = GetChild<KaxTagSimple>(aTag); KaxTagSimple & TagSimple = GetChild<KaxTagSimple>(aTag);
KaxTagTrackUID & TrackUID = GetChild<KaxTagTrackUID>(Targets); KaxTagTrackUID & TrackUID = GetChild<KaxTagTrackUID>(Targets);
*static_cast<EbmlUInteger *>(&TrackUID) = 0x12345; *static_cast<EbmlUInteger *>(&TrackUID) = 0x12345;
KaxTagChapterUID & ChapterUID = GetChild<KaxTagChapterUID>(Targets); KaxTagChapterUID & ChapterUID = GetChild<KaxTagChapterUID>(Targets);
*static_cast<EbmlUInteger *>(&ChapterUID) = 0x67890; *static_cast<EbmlUInteger *>(&ChapterUID) = 0x67890;
KaxTagName & aTagName = GetChild<KaxTagName>(TagSimple); KaxTagName & aTagName = GetChild<KaxTagName>(TagSimple);
*static_cast<EbmlUnicodeString *>(&aTagName) = L"NAME"; *static_cast<EbmlUnicodeString *>(&aTagName) = L"NAME";
@ -353,35 +353,35 @@ int main(int argc, char **argv)
KaxTagString & aTagtring = GetChild<KaxTagString>(TagSimple); KaxTagString & aTagtring = GetChild<KaxTagString>(TagSimple);
*static_cast<EbmlUnicodeString *>(&aTagtring) = L"Testé123"; *static_cast<EbmlUnicodeString *>(&aTagtring) = L"Testé123";
filepos_t TagsSize = AllTags.Render(out_file, bWriteDefaultValues); filepos_t TagsSize = AllTags.Render(out_file, bWriteDefaultValues);
MetaSeek.IndexThis(AllTags, FileSegment); MetaSeek.IndexThis(AllTags, FileSegment);
TrackSize += pMyTracks2->Render(out_file, bWriteDefaultValues); TrackSize += pMyTracks2->Render(out_file, bWriteDefaultValues);
MetaSeek.IndexThis(*pMyTracks2, FileSegment); MetaSeek.IndexThis(*pMyTracks2, FileSegment);
// \todo put it just before the Cue Entries // \todo put it just before the Cue Entries
filepos_t MetaSeekSize = Dummy.ReplaceWith(MetaSeek, out_file, bWriteDefaultValues); filepos_t MetaSeekSize = Dummy.ReplaceWith(MetaSeek, out_file, bWriteDefaultValues);
#ifdef VOID_TEST #ifdef VOID_TEST
MyInfos.VoidMe(out_file); MyInfos.VoidMe(out_file);
#endif // VOID_TEST #endif // VOID_TEST
// let's assume we know the size of the Segment element // 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 // the size of the FileSegment is also computed because mandatory elements we don't write ourself exist
if (FileSegment.ForceSize(SegmentSize - FileSegment.HeadSize() + MetaSeekSize if (FileSegment.ForceSize(SegmentSize - FileSegment.HeadSize() + MetaSeekSize
+ TrackSize + ClusterSize + CueSize + InfoSize + TagsSize + ChapterSize)) { + TrackSize + ClusterSize + CueSize + InfoSize + TagsSize + ChapterSize)) {
FileSegment.OverwriteHead(out_file); FileSegment.OverwriteHead(out_file);
} }
#if 0 #if 0
delete[] buf_bin; delete[] buf_bin;
delete[] buf_txt; delete[] buf_txt;
#endif // 0 #endif // 0
#ifdef OLD #ifdef OLD
MuxedFile.Close(1000); // 1000 ms MuxedFile.Close(1000); // 1000 ms
#endif // OLD #endif // OLD
out_file.close(); out_file.close();
delete Blob1; delete Blob1;
delete Blob2; delete Blob2;
@ -390,7 +390,7 @@ int main(int argc, char **argv)
} }
catch (exception & Ex) catch (exception & Ex)
{ {
cout << Ex.what() << endl; cout << Ex.what() << endl;
} }
return 0; return 0;

File diff suppressed because it is too large Load Diff

View File

@ -11,12 +11,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -71,7 +71,7 @@ int main() {
EbmlHead head; EbmlHead head;
KaxSegment segment; KaxSegment segment;
StdIOCallback out("test.mkv", MODE_CREATE); StdIOCallback out("test.mkv", MODE_CREATE);
EDocType &doc_type = GetChild<EDocType>(head); EDocType &doc_type = GetChild<EDocType>(head);
*static_cast<EbmlString *>(&doc_type) = "matroska"; *static_cast<EbmlString *>(&doc_type) = "matroska";
EDocTypeVersion &doc_type_ver = GetChild<EDocTypeVersion>(head); EDocTypeVersion &doc_type_ver = GetChild<EDocTypeVersion>(head);
@ -98,7 +98,7 @@ int main() {
1234; 1234;
#if 0 #if 0
// comment of the Targets // comment of the Targets
KaxTagMultiComment &mcomB = GetChild<KaxTagMultiComment>(targets); KaxTagMultiComment &mcomB = GetChild<KaxTagMultiComment>(targets);
*(static_cast<EbmlString *> *(static_cast<EbmlString *>
(&GetChild<KaxTagMultiCommentName>(mcomB))) = (&GetChild<KaxTagMultiCommentName>(mcomB))) =
@ -134,7 +134,7 @@ int main() {
(&GetChild<KaxTagArchivalLocation>(general))) = (&GetChild<KaxTagArchivalLocation>(general))) =
L"ArchivalLocation"; L"ArchivalLocation";
KaxTagKeywords &keywords1 = GetChild<KaxTagKeywords>(general); KaxTagKeywords &keywords1 = GetChild<KaxTagKeywords>(general);
*(static_cast<EbmlUnicodeString *>(&keywords1)) = *(static_cast<EbmlUnicodeString *>(&keywords1)) =
L"Keywords, 1"; L"Keywords, 1";
*(static_cast<EbmlUnicodeString *> *(static_cast<EbmlUnicodeString *>
(&GetNextChild<KaxTagKeywords>(general, keywords1))) = (&GetNextChild<KaxTagKeywords>(general, keywords1))) =
@ -144,7 +144,7 @@ int main() {
L"Mood"; L"Mood";
KaxTagRecordLocation &recordLocation1 = KaxTagRecordLocation &recordLocation1 =
GetChild<KaxTagRecordLocation>(general); GetChild<KaxTagRecordLocation>(general);
*(static_cast<EbmlString *>(&recordLocation1)) = *(static_cast<EbmlString *>(&recordLocation1)) =
"RecordLocation, 1"; "RecordLocation, 1";
*(static_cast<EbmlString *> *(static_cast<EbmlString *>
(&GetNextChild<KaxTagRecordLocation>(general, recordLocation1))) = (&GetNextChild<KaxTagRecordLocation>(general, recordLocation1))) =
@ -248,7 +248,7 @@ int main() {
*(static_cast<EbmlFloat *> *(static_cast<EbmlFloat *>
(&GetChild<KaxTagMultiPriceAmount>(mprice))) = (&GetChild<KaxTagMultiPriceAmount>(mprice))) =
42.0; 42.0;
KaxTagMultiPricePriceDate &pdate = KaxTagMultiPricePriceDate &pdate =
GetChild<KaxTagMultiPricePriceDate>(mprice); GetChild<KaxTagMultiPricePriceDate>(mprice);
pdate.SetEpochDate(time(NULL)); pdate.SetEpochDate(time(NULL));
@ -257,10 +257,10 @@ int main() {
*(static_cast<EbmlUInteger *> *(static_cast<EbmlUInteger *>
(&GetChild<KaxTagMultiDateType>(date))) = (&GetChild<KaxTagMultiDateType>(date))) =
4; 4;
KaxTagMultiDateDateBegin &dbeg = KaxTagMultiDateDateBegin &dbeg =
GetChild<KaxTagMultiDateDateBegin>(date); GetChild<KaxTagMultiDateDateBegin>(date);
dbeg.SetEpochDate(time(NULL)); dbeg.SetEpochDate(time(NULL));
KaxTagMultiDateDateEnd &dend = KaxTagMultiDateDateEnd &dend =
GetChild<KaxTagMultiDateDateEnd>(date); GetChild<KaxTagMultiDateDateEnd>(date);
dend.SetEpochDate(time(NULL)); dend.SetEpochDate(time(NULL));
@ -355,7 +355,7 @@ int main() {
L"SIMPLE_TAG_NAME_LEVEL3"; L"SIMPLE_TAG_NAME_LEVEL3";
*(static_cast<EbmlUnicodeString *>(&GetChild<KaxTagString>(stag_l3))) = *(static_cast<EbmlUnicodeString *>(&GetChild<KaxTagString>(stag_l3))) =
L"SIMPLE_TAG_STRING_LEVEL3"; L"SIMPLE_TAG_STRING_LEVEL3";
tags.Render(out); tags.Render(out);
} catch (...) { } catch (...) {

View File

@ -11,12 +11,12 @@
** modify it under the terms of the GNU Lesser General Public ** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either ** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version. ** version 2.1 of the License, or (at your option) any later version.
** **
** This library is distributed in the hope that it will be useful, ** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details. ** Lesser General Public License for more details.
** **
** You should have received a copy of the GNU Lesser General Public ** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software ** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -45,10 +45,10 @@ using namespace LIBMATROSKA_NAMESPACE;
using namespace std; using namespace std;
/*! /*!
\see http://www.unicode.org/charts/ \see http://www.unicode.org/charts/
\see http://www-106.ibm.com/developerworks/linux/library/l-linuni.html \see http://www-106.ibm.com/developerworks/linux/library/l-linuni.html
\see http://www.cl.cam.ac.uk/~mgk25/unicode.html#libs \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 ftp://ftp.ilog.fr/pub/Users/haible/utf8/Unicode-HOWTO-6.html#ss6.1
*/ */
int main(void) int main(void)
{ {
@ -69,7 +69,7 @@ int main(void)
testUTF8_1 = test1.c_str(); testUTF8_1 = test1.c_str();
TruncString8 testUTF8_2(10); 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 // in UTF8 0xE8=1110-1000 should become 110.00110-10.001000=0xC6 0x88
FileName test01(64); FileName test01(64);