Commit e311d3e2 authored by Yann Renard's avatar Yann Renard

A first version for some of the OpenViBE common components



git-svn-id: svn://scm.gforge.inria.fr/svn/openvibe@9 c330d7e9-fc0c-0410-a5b3-fd85c6f5aa8f
parent 3a073c0f
OPTION(BUILD_OPENVIBE_MODULES "Build OpenViBE modules" ON)
OPTION(BUILD_OPENVIBE_MODULES_EXAMPLES "Build OpenViBE modules examples" OFF)
IF(BUILD_OPENVIBE_MODULES)
OPTION(BUILD_OPENVIBE_MODULES_EBML "Build OpenViBE module EBML" ON)
OPTION(BUILD_OPENVIBE_MODULES_FS "Build OpenViBE module FS" ON)
OPTION(BUILD_OPENVIBE_MODULES_XML "Build OpenViBE module XML" ON)
OPTION(BUILD_OPENVIBE_MODULES_SYSTEM "Build OpenViBE module SYSTEM" ON)
IF(BUILD_OPENVIBE_MODULES_EBML)
SUBDIRS(ebml)
ENDIF(BUILD_OPENVIBE_MODULES_EBML)
IF(BUILD_OPENVIBE_MODULES_FS)
SUBDIRS(fs)
ENDIF(BUILD_OPENVIBE_MODULES_FS)
IF(BUILD_OPENVIBE_MODULES_SYSTEM)
SUBDIRS(system)
ENDIF(BUILD_OPENVIBE_MODULES_SYSTEM)
IF(BUILD_OPENVIBE_MODULES_XML)
SUBDIRS(xml)
ENDIF(BUILD_OPENVIBE_MODULES_XML)
ENDIF(BUILD_OPENVIBE_MODULES)
PROJECT(OpenViBE-module-EBML)
SET(PROJECT_VERSION_MAJOR 1)
SET(PROJECT_VERSION_MINOR 0)
SET(PROJECT_VERSION_PATCH 0)
SET(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
# ---------------------------------
# Target macros
# Defines target operating system
# Defines target architecture
# Defines target compilator
# ---------------------------------
IF(WIN32)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)
ADD_DEFINITIONS(-DTARGET_OS_Windows)
ADD_DEFINITIONS(-DTARGET_ARCHITECTURE_i386)
ADD_DEFINITIONS(-DTARGET_COMPILATOR_VisualStudio)
ENDIF(WIN32)
IF(UNIX)
# ADD_DEFINITIONS(-fvisibility=hidden) # This flag should be present... man gcc
ADD_DEFINITIONS(-g)
ADD_DEFINITIONS(-DTARGET_OS_Linux)
ADD_DEFINITIONS(-DTARGET_ARCHITECTURE_i386)
ADD_DEFINITIONS(-DTARGET_COMPILATOR_GCC)
ENDIF(UNIX)
# ---------------------------------
# Configures paths if not already defined
# Defines executable path
# Defines library output path
# Defines include output path
# ---------------------------------
IF(NOT EXECUTABLE_OUTPUT_PATH)
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
MESSAGE(STATUS "EXECUTABLE_OUTPUT_PATH configured to default ${EXECUTABLE_OUTPUT_PATH}")
ENDIF(NOT EXECUTABLE_OUTPUT_PATH)
IF(NOT LIBRARY_OUTPUT_PATH)
SET(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
MESSAGE(STATUS "LIBRARY_OUTPUT_PATH configured to default ${LIBRARY_OUTPUT_PATH}")
ENDIF(NOT LIBRARY_OUTPUT_PATH)
SET(INCLUDE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/include)
SUBDIRS(src)
IF(BUILD_OPENVIBE_MODULES_EXAMPLES)
SUBDIRS(test)
ENDIF(BUILD_OPENVIBE_MODULES_EXAMPLES)
/**
* \mainpage
*
* Welcome on this tiny EBML parser / formater library documentation
* pages.
*
* In order to start with the library, one should know what EBML is
* and why it is of interest. Check \ref Doc_WhatIsEBML if needed.
*
* Then depending on your needs, you may need to visit these two pages :
* - \ref Doc_FormatingEBMLStreams
* - \ref Doc_ParsingEBMLStreams
*
* And finally enjoy the class design :o)
*/
/**
* \namespace EBML
* \author Yann Renard
* \date 2006-08-07
* \brief Namespace for the EBML lib
*
* This namespace contains the classes, types and functions used
* and offered by the EBML parsing/formating library.
*
* Most important classes to look at are :
* - EBML::IReader for EBML parsing
* - EBML::IWriter for EBML formating
*/
/**
* \page Doc_WhatIsEBML What is EBML
*
* This page tries to explain what EBML is and why it is usefull.
*
* - see http://ebml.sourceforge.net/ for more details
* - see http://ebml.sourceforge.net/specs/ for specifications
* - see http://www.matroska.org/technical/specs/ for even more details
*
* - check libebml for a sample implementation of EBML
* - check libmatroska for a sample of library using libebml
* and a concrete use of EBML
*
* \todo Write more documentation on what EBML is
*/
Matroska_Identifier_Segment 0x18538067 master container
Matroska_Identifier_SeekHead 0x114d9b74 master container
Matroska_Identifier_Seek 0x4dbb master container
Matroska_Identifier_SeekId 0x53ab no_master binary
Matroska_Identifier_SeekPosition 0x53ac no_master uinteger
Matroska_Identifier_Info 0x1549a966 master container
Matroska_Identifier_SegmentUID 0x73a4 no_master binary
Matroska_Identifier_SegmentFilename 0x7384 no_master string
Matroska_Identifier_SegmentUID 0x73a4 no_master binary
Matroska_Identifier_SegmentFilename 0x7384 no_master string
Matroska_Identifier_PrevUID 0x3cb923 no_master binary
Matroska_Identifier_PrevFilename 0x3c83ab no_master string
Matroska_Identifier_NextUID 0x3eb923 no_master binary
Matroska_Identifier_NextFilename 0x3e83bb no_master string
Matroska_Identifier_TimecodeScale 0x2ad7b1 no_master uinteger
Matroska_Identifier_Duration 0x4489 no_master float
Matroska_Identifier_DateUTC 0x4461 no_master date
Matroska_Identifier_Title 0x7ba9 no_master string
Matroska_Identifier_MuxingApp 0x4d80 no_master string
Matroska_Identifier_WritingApp 0x5741 no_master string
Matroska_Identifier_Cluster 0x1f43b675 master container
Matroska_Identifier_Timecode 0xe7 no_master uinteger
Matroska_Identifier_Position 0xa7 no_master uinteger
Matroska_Identifier_PrevSize 0xab no_master uinteger
Matroska_Identifier_BlockGroup 0xa0 master container
Matroska_Identifier_Block 0xa1 no_master binary
Matroska_Identifier_BlockVirtual 0xa2 no_master binary
Matroska_Identifier_BlockAdditions 0x75a1 master container
Matroska_Identifier_BlockMore 0xa6 master container
Matroska_Identifier_BlockAddID 0xee no_master uinteger
Matroska_Identifier_BlockAdditional 0xa5 no_master binary
Matroska_Identifier_BlockDuration 0x9b no_master uinteger
Matroska_Identifier_ReferencePriority 0xfa no_master uinteger
Matroska_Identifier_ReferenceBlock 0xfb no_master integer
Matroska_Identifier_ReferenceVirtual 0xfd no_master integer
Matroska_Identifier_CodecState 0xa4 no_master binary
Matroska_Identifier_Slices 0x8e master container
Matroska_Identifier_TimeSlice 0xe8 master container
Matroska_Identifier_LaceNumber 0xcc no_master uinteger
Matroska_Identifier_FrameNumber 0xcd no_master uinteger
Matroska_Identifier_BlockAdditionID 0xcb no_master uinteger
Matroska_Identifier_Delay 0xce no_master uinteger
Matroska_Identifier_Duration 0xcf no_master uinteger
Matroska_Identifier_Tracks 0x1654ae6b master container
Matroska_Identifier_TrackEntry 0xae master container
Matroska_Identifier_TrackNumber 0xd7 no_master uinteger
Matroska_Identifier_TrackUID 0x73c5 no_master uinteger
Matroska_Identifier_TrackType 0x83 no_master uinteger
Matroska_Identifier_FlagEnabled 0xb9 no_master uinteger
Matroska_Identifier_FlagDefault 0x88 no_master uinteger
Matroska_Identifier_FlagLacing 0x9c no_master uinteger
Matroska_Identifier_MinCache 0x6de7 no_master uinteger
Matroska_Identifier_MaxCache 0x6df8 no_master uinteger
Matroska_Identifier_DefaultDuration 0x23e383 no_master uinteger
Matroska_Identifier_TrackTimecodeScale 0x23314f no_master float
Matroska_Identifier_Name 0x536e no_master string
Matroska_Identifier_Language 0x22b59c no_master string
Matroska_Identifier_CodecID 0x86 no_master string
Matroska_Identifier_CodecPrivate 0x63a2 no_master binary
Matroska_Identifier_CodecName 0x258688 no_master string
Matroska_Identifier_CodecSettings 0x3a9697 no_master string
Matroska_Identifier_CodecInfoURL 0x3b4040 no_master string
Matroska_Identifier_CodecDownloadURL 0x26b240 no_master string
Matroska_Identifier_CodecDecodeAll 0xaa no_master uinteger
Matroska_Identifier_TrackOverlay 0x6fab no_master uinteger
Matroska_Identifier_Video 0xe0 master container
Matroska_Identifier_FlagInterlaced 0x9a no_master uinteger
Matroska_Identifier_StereoMode 0x53b8 no_master uinteger
Matroska_Identifier_PixelWidth 0xb0 no_master uinteger
Matroska_Identifier_PixelHeight 0xba no_master uinteger
Matroska_Identifier_DisplayWidth 0x54b0 no_master uinteger
Matroska_Identifier_DisplayHeight 0x54ba no_master uinteger
Matroska_Identifier_DisplayUnit 0x54b2 no_master uinteger
Matroska_Identifier_AspectRatioType 0x54b3 no_master uinteger
Matroska_Identifier_ColourSpace 0x2eb524 no_master binary
Matroska_Identifier_GammaValue 0x2fb523 no_master float
Matroska_Identifier_Audio 0xe1 master container
Matroska_Identifier_SamplingFrequency 0xb5 no_master float
Matroska_Identifier_OutputSamplingFrequency 0x78b5 no_master float
Matroska_Identifier_Channels 0x94 no_master uinteger
Matroska_Identifier_ChannelPositions 0x7d7b no_master binary
Matroska_Identifier_BitDepth 0x6264 no_master uinteger
Matroska_Identifier_ContentEncodings 0x6d80 master container
Matroska_Identifier_ContentEncoding 0x6240 master container
Matroska_Identifier_ContentEncodingOrder 0x5031 no_master uinteger
Matroska_Identifier_ContentEncodingScope 0x5032 no_master uinteger
Matroska_Identifier_ContentEncodingType 0x5033 no_master uinteger
Matroska_Identifier_ContentCompression 0x5034 master container
Matroska_Identifier_ContentCompAlgo 0x4254 no_master uinteger
Matroska_Identifier_ContentCompSettings 0x4255 no_master binary
Matroska_Identifier_ContentEncryption 0x5035 master container
Matroska_Identifier_ContentEncAlgo 0x47e1 no_master uinteger
Matroska_Identifier_ContentEncKeyID 0x47e2 no_master binary
Matroska_Identifier_ContentSignature 0x47e3 no_master binary
Matroska_Identifier_ContentSigKeyID 0x47e4 no_master binary
Matroska_Identifier_ContentSigAlgo 0x47e5 no_master uinteger
Matroska_Identifier_ContentSigHashAlgo 0x47e6 no_master uinteger
Matroska_Identifier_Cues 0x1c53bb6b master container
Matroska_Identifier_CuePoint 0xbb master container
Matroska_Identifier_CueTime 0xb3 no_master uinteger
Matroska_Identifier_CueTrackPositions 0xb7 master container
Matroska_Identifier_CueTrack 0xf7 no_master uinteger
Matroska_Identifier_CueClusterPosition 0xf1 no_master uinteger
Matroska_Identifier_CueBlockNumber 0x5378 no_master uinteger
Matroska_Identifier_CueCodecState 0xea no_master uinteger
Matroska_Identifier_CueReference 0xdb master container
Matroska_Identifier_CueRefTime 0x96 no_master uinteger
Matroska_Identifier_CueRefCluster 0x97 no_master uinteger
Matroska_Identifier_CueRefNumber 0x535f no_master uinteger
Matroska_Identifier_CueRefCodecState 0xeb no_master uinteger
Matroska_Identifier_Attachments 0x1941a469 master container
Matroska_Identifier_AttachedFile 0x61a7 master container
Matroska_Identifier_FileDescription 0x467e no_master string
Matroska_Identifier_FileName 0x466e no_master string
Matroska_Identifier_FileMimeType 0x4660 no_master string
Matroska_Identifier_FileData 0x465c no_master binary
Matroska_Identifier_FileUID 0x46ae no_master uinteger
Matroska_Identifier_Chapters 0x1043a770 master container
Matroska_Identifier_EditionEntry 0x45b9 master container
Matroska_Identifier_ChapterAtom 0xb6 master container
Matroska_Identifier_ChapterUID 0x73c4 no_master uinteger
Matroska_Identifier_ChapterTimeStart 0x91 no_master uinteger
Matroska_Identifier_ChapterTimeEnd 0x92 no_master uinteger
Matroska_Identifier_ChapterFlagHidden 0x98 no_master uinteger
Matroska_Identifier_ChapterFlagEnabled 0x4598 no_master uinteger
Matroska_Identifier_ChapterTrack 0x8f master container
Matroska_Identifier_ChapterTrackNumber 0x89 no_master uinteger
Matroska_Identifier_ChapterDisplay 0x80 master container
Matroska_Identifier_ChapString 0x85 no_master string
Matroska_Identifier_ChapLanguage 0x437c no_master string
Matroska_Identifier_ChapCountry 0x437e no_master string
Matroska_Identifier_Tags 0x1254c367 master container
Matroska_Identifier_Tag 0x7373 master container
Matroska_Identifier_Targets 0x63c0 master container
Matroska_Identifier_TrackUID 0x63c5 no_master uinteger
Matroska_Identifier_ChapterUID 0x63c4 no_master uinteger
Matroska_Identifier_AttachmentUID 0x63c6 no_master uinteger
Matroska_Identifier_SimpleTag 0x67c8 master container
Matroska_Identifier_TagName 0x45a3 no_master string
Matroska_Identifier_TagString 0x4487 no_master string
Matroska_Identifier_TagBinary 0x4485 no_master binary
FILE(GLOB_RECURSE source_files *.cpp)
FILE(GLOB_RECURSE all_files *.*)
ADD_LIBRARY(${PROJECT_NAME}-static ${source_files})
ADD_DEFINITIONS(-DEBML_Shared)
ADD_DEFINITIONS(-DEBML_Exports)
ADD_LIBRARY(${PROJECT_NAME}-dynamic SHARED ${source_files})
SET_TARGET_PROPERTIES(${PROJECT_NAME}-dynamic PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR})
# ---------------------------------
# Copies all files to include path
# and then remove not .h files
# ---------------------------------
# Copies all the source files
STRING(REPLACE ${CMAKE_CURRENT_SOURCE_DIR}/ ";" all_files ${all_files})
ADD_CUSTOM_COMMAND(
TARGET ${PROJECT_NAME}-static
POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR} ${INCLUDE_OUTPUT_PATH})
# Lists .h files to remove at clean stage
# Lists not .h files to remove immediatly
SET(remove_files "")
FOREACH(current_file ${all_files})
# GET_FILENAME_COMPONENT(current_file_path ${INCLUDE_OUTPUT_PATH}/${current_file} PATH)
IF(${current_file} MATCHES ".*\\.h$")
SET(remove_files "${remove_files};${INCLUDE_OUTPUT_PATH}/${current_file};${current_file_path}")
# MESSAGE(STATUS "${current_file} will be deleted later !")
ELSE(${current_file} MATCHES ".*\\.h$")
ADD_CUSTOM_COMMAND(
TARGET ${PROJECT_NAME}-static
POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -E remove ${INCLUDE_OUTPUT_PATH}/${current_file})
ADD_CUSTOM_COMMAND(
TARGET ${PROJECT_NAME}-dynamic
POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -E remove ${INCLUDE_OUTPUT_PATH}/${current_file})
# MESSAGE(STATUS "${current_file} is deleted now !")
ENDIF(${current_file} MATCHES ".*\\.h$")
ENDFOREACH(current_file)
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${remove_files}")
/**
* \page Doc_FormatingEBMLStreams Formating EBML streams
*
* \section Doc_FormatingEBMLStreams_Introduction Introduction
*
* This page tries to teach how a user of this library should use
* the writing functions in order to build and format an EBML
* stream correctly. For those who don't know what EBML is,
* it is basically a binary XML created and used by the matroska
* developpers. The libmatroska is based on the libebml
* implementation of these guys. Fore more details, please read
* the \ref Doc_WhatIsEBML page first and eventually visit the
* EBML web page at http://ebml.sourceforge.net/
*
* \section Doc_FormatingEBMLStreams_Concept Concepts
*
* The idea of this formating library is to transform the data
* provided by the user application into EBML buffers. Those EBML
* buffers are then given to a user callback object which know
* what to do with the computed data (maybe write it to a file,
* send it on a socket, log it in a console, whatever...)
*
* The library is divided into three main components :
* - The writer itself that does the formating stuff
* - An implementation of the callback object (the implementation
* is left to the user application developper)
* - An optionnal helper object that knows more on the
* content of the EBML stream.
*
* Here comes the organisation of the different modules and how
* data go from one to another. Note that the user application
* and the user callback object may share some information so the
* callback object communicates with the application itself.
*
* \image html ebml_formating_concept.png "Concept"
*
* Here comes the UML class diagram, presenting the main classes
* involved in the presented behavior.
*
* \image html ebml_formating_class.png "Class Diagram"
*
* See EBML::IWriter, EBML::IWriterCallBack and EBML::IWriterHelper
* for more details on each of these classes.
*
* \section Doc_FormatingEBMLStreams_SampleCode Sample code
*
* In this section, a sample of user application code is presented
* that opens several child nodes and dumps the created stream
* into a file for later use. This file can be parsed using
* the sample code of the page named \ref Doc_ParsingEBMLStreams
*
* The callback object implementation looks something like this :
*
* \code
* class CWriterCallBack : virtual public EBML::IWriterCallBack
* {
* public:
* CWriterCallBack(char* sFileName)
* {
* m_pFile=fopen(sFileName, "wb");
* }
* virtual ~CWriterCallBack(void)
* {
* if(m_pFile) fclose(m_pFile);
* }
* virtual void write(const void* pBuffer, const EBML::uint64 ui64BufferSize)
* {
* if(m_pFile) fwrite(pBuffer, ui64BufferSize, 1, m_pFile);
* }
* FILE* m_pFile;
* };
* \endcode
*
* Then in the user application code, we can write the
* initialisation this way :
*
* \code
* CWriterCallBack oCallback("test.ebml");
* EBML::IWriter* pWriter=EBML::createWriter(oCallback);
* EBML::IWriterHelper* pWriterHelper=EBML::createWriterHelper();
* pWriterHelper->connect(pWriter);
* \endcode
*
* The use of the EBML writer looks something like this :
*
* \code
* pWriterHelper->openChild(EBML_Identifier_Header);
* pWriterHelper->openChild(EBML_Identifier_DocType);
* pWriterHelper->setASCIIStringAsChildData("EBML basic sample");
* pWriterHelper->closeChild();
* pWriterHelper->openChild(EBML_Identifier_DocTypeVersion);
* pWriterHelper->setUIntegerAsChildData(1);
* pWriterHelper->closeChild();
* pWriterHelper->closeChild();
* \endcode
*
* Finally, we have to release the objects and to clean memory :
*
* \code
* pWriterHelper->disconnect();
* pWriterHelper->release();
* pWriter->release();
* \endcode
*/
/**
* \page Doc_ParsingEBMLStreams Parsing EBML streams
*
* \section Doc_ParsingEBMLStreams_Introduction Introduction
*
* This page tries to teach how a user of this library should use
* the reading functions in order to read and parse an EBML
* stream correctly. For those who don't know what EBML is,
* it is basically a binary XML created and used by the matroska
* developpers. The libmatroska is based on the libebml
* implementation of these guys. Fore more details, please read
* the \ref Doc_WhatIsEBML page first and eventually visit the
* EBML web page at http://ebml.sourceforge.net/
*
* \section Doc_ParsingEBMLStreams_Concept Concepts
*
* The idea of this parsing library is to transform the stream
* data provided by the user application into understandable
* EBML interpreted commands. Once the EBML nodes are found and
* parsed, they are sent to a callback object that should know
* what to do with them.
*
* The design of the parsing interface is closed to the one of
* \c eXpat, an XML parser library (see http://expat.sourceforge.net
* for more details on \c eXpat). Using such interface allows light
* code and on-the-fly parsing, that means the parser does not
* need to have all the data ready before starting the parsing
* process... The data can arrive while the parsing is beeing
* done.
*
* It is the responsability of the user application to read
* the EBML stream from a file, a socket, a user input or
* whatever, and then to send this to the parser...
*
* At least, the callback object may use a reader helper that
* knows how to read standard EBML types such as integers,
* floats, strings etc...
*
* The library is divided into three main components :
* - The reader itself that does the parsing stuffs
* - An implementation of the callback object (the implementation
* is left to the user application developper)
* - An optionnal helper object that knows more on the
* content of the EBML stream.
*
* Here comes the organisation of the different modules and how
* data go from one to another. Note that the user application
* and the user callback object may share some information so the
* callback object communicates with the application itself.
*
* \image html ebml_parsing_concept.png "Concept"
*
* Here comes the UML class diagram, presenting the main classes
* involved in the presented behavior.
*
* \image html ebml_parsing_class.png "Class Diagram"
*
* See EBML::IReader, EBML::IReaderCallBack and EBML::IReaderHelper
* for more details on each of these classes.
*
* \section Doc_ParsingEBMLStreams_SampleCode Sample code
*
* In this section, a sample of user application code is presented
* that parses the sample file created in the page named :
* \ref Doc_FormatingEBMLStreams
*
* The parsed value are printed in the console.
*
* The callback object looks something like this :
*
* \code
* class CReaderCallBack : virtual public EBML::IReaderCallBack
* {
* public:
* CReaderCallBack(void)
* {
* m_pReaderHelper=EBML::createReaderHelper();
* }
* virtual ~CReaderCallBack(void)
* {
* if(m_pReaderHelper) m_pReaderHelper->release();
* }
* virtual bool isMasterChild(const EBML::CIdentifier& rIdentifier)
* {
* if(rIdentifier==EBML_Identifier_Header) return true;
* if(rIdentifier==EBML_Identifier_DocType) return true;
* if(rIdentifier==EBML_Identifier_DocTypeVersion) return true;
* return false;
* }
* virtual void openChild(const EBML::CIdentifier& rIdentifier)
* {
* m_oCurrent=rIdentifier;
* }
* virtual void processChildData(cosnt void* pBuffer, const EBML::uint64 ui64BufferSize)
* {
* if(m_oCurrent==EBML_Identifier_DocType)
* std::cout << "Doc type:" << m_pReaderHelper->getASCIIStringFromChildData(pBuffer, ui64BufferSize) << std::endl;
* if(m_oCurrent==EBML_Identifier_DocTypeVersion)
* std::cout << "Dox type version:" << m_pReaderHelper->getUIntegerFromChildData(pBuffer, ui64BufferSize) << std::endl;
* }
* virtual void closeChild(void)
* {
* }
* EBML::IReaderHelper* m_pReaderHelper;
* };
* \endcode
*
* Then in the user application code, we can write the
* initialisation this way :
*
* \code
* CReaderCallBack oCallback;
* EBML::IReader* pReader=EBML::createReader(oCallback);
* \endcode
*
* Now suppose the user application got some data from the file
* in a \c pBuffer of size \c ui64BufferSize ; it is sent to the
* parser this way :
*
* \code
* pReader->processData(pBuffer, ui64BufferSize);
* \endcode
*
* Finally, don't forget to release the object and to clean memory :
*
* \code
* pReader->release();
* \endcode
*/
#include "CIdentifier.h"
using namespace EBML;
CIdentifier::CIdentifier(void)
:m_ui64Identifier(0)
{
}
CIdentifier::CIdentifier(const uint64 ui64Identifier)
:m_ui64Identifier(ui64Identifier)
{
}
CIdentifier::CIdentifier(const CIdentifier& rIdentifier)
:m_ui64Identifier(rIdentifier.m_ui64Identifier)
{
}
const CIdentifier& CIdentifier::operator=(const CIdentifier& rIdentifier)
{
m_ui64Identifier=rIdentifier.m_ui64Identifier;
return *this;
}
EBML_API boolean EBML::operator==(const CIdentifier& rIdentifier1, const CIdentifier& rIdentifier2)
{
return rIdentifier1.m_ui64Identifier==rIdentifier2.m_ui64Identifier;
}
EBML_API boolean EBML::operator!=(const CIdentifier& rIdentifier1, const CIdentifier& rIdentifier2)
{
return rIdentifier1.m_ui64Identifier!=rIdentifier2.m_ui64Identifier;
}
EBML_API boolean EBML::operator<=(const CIdentifier& rIdentifier1, const CIdentifier& rIdentifier2)
{
return rIdentifier1.m_ui64Identifier<=rIdentifier2.m_ui64Identifier;
}
EBML_API boolean EBML::operator>=(const CIdentifier& rIdentifier1, const CIdentifier& rIdentifier2)
{
return rIdentifier1.m_ui64Identifier>=rIdentifier2.m_ui64Identifier;
}
EBML_API boolean EBML::operator<(const CIdentifier& rIdentifier1, const CIdentifier& rIdentifier2)
{
return rIdentifier1.m_ui64Identifier<rIdentifier2.m_ui64Identifier;
}
EBML_API boolean EBML::operator>(const CIdentifier& rIdentifier1, const CIdentifier& rIdentifier2)
{
return rIdentifier1.m_ui64Identifier>rIdentifier2.m_ui64Identifier;
}
CIdentifier::operator uint64(void) const
{
return m_ui64Identifier;
}
/**
* \file CIdentifier.h
* \author Yann Renard (INRIA/IRISA)
* \date 2006-08-07
* \brief EBML::CIdentifier class definition
*/
#ifndef __EBML_CIdentifier_H__
#define __EBML_CIdentifier_H__
#include "defines.h"
namespace EBML
{
/**
* \class CIdentifier
* \author Yann Renard (INRIA/IRISA)
* \date 2006-08-07
* \brief Base class to work with EBML identifiers
*
* This class is used in order to work on EBML identifier.
* It handles 64 bits values for now, but could easily be
* changed to handle bigger values if needed.
*
* Be sure to look at http://ebml.sourceforge.net/specs/ in
* order to understand what an identifier is and how it works
*/
class EBML_API CIdentifier
{
public:
/** \name Constructors */
//@{
/**
* \brief Basic constructor
*
* Initializes the identifier to 0.
*/
CIdentifier(void);
/**
* \brief Integer based constructor
* \param ui64Identifier [in] : The value to use
*
* Initializes the identifier to the given 64 bits value.
*/
CIdentifier(const EBML::uint64 ui64Identifier);
/**
* \brief Copy constructor
* \param rIdentifier [in] : The source identifier to use
*
* Initializes this identifier to the same value as
* the given source identifier.
*/
CIdentifier(const EBML::CIdentifier& rIdentifier);
//@}
/** \name Operators */
//@{
/**
* \brief Copy operator
* \param rIdentifier [in] : The source identifier to copy from
* \return a const reference on this identifier
*
* Initializes this identifier to the same value as
* the given source identifier.
*/
const EBML::CIdentifier& operator=(const EBML::CIdentifier& rIdentifier);
/**
* \brief Equality comparison operator
* \param rIdentifier1 [in] : The first identifier to compare
* \param rIdentifier2 [in] : The second identifier to compare
* \return \e true when the identifiers are equal, \e false
* when they are different.
*
* This function compares the two 64 bits values.
*/
friend EBML_API bool operator==(const EBML::CIdentifier& rIdentifier1, const EBML::CIdentifier& rIdentifier2);
/**
* \brief Difference comparison operator
* \param rIdentifier1 [in] : The first identifier to compare
* \param rIdentifier2 [in] : The second identifier to compare
* \return \e true when the identifiers are different, \e false
* when they are equal.
*
* This function compares the two 64 bits values.
*/