00001 00002 /***************************************************************************** 00003 * mkv.cpp : matroska demuxer 00004 ***************************************************************************** 00005 * Copyright (C) 2003-2004 the VideoLAN team 00006 * $Id: 1ca708221a99cf250f025fb8635db4ccb8e79eaf $ 00007 * 00008 * Authors: Laurent Aimar <fenrir@via.ecp.fr> 00009 * Steve Lhomme <steve.lhomme@free.fr> 00010 * 00011 * This program is free software; you can redistribute it and/or modify 00012 * it under the terms of the GNU General Public License as published by 00013 * the Free Software Foundation; either version 2 of the License, or 00014 * (at your option) any later version. 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU General Public License 00022 * along with this program; if not, write to the Free Software 00023 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 00024 *****************************************************************************/ 00025 #ifndef _EBML_PARSER_HPP_ 00026 #define _EBML_PARSER_HPP_ 00027 00028 #include "mkv.hpp" 00029 00030 /***************************************************************************** 00031 * Ebml Stream parser 00032 *****************************************************************************/ 00033 class EbmlParser 00034 { 00035 public: 00036 EbmlParser( EbmlStream *es, EbmlElement *el_start, demux_t *p_demux ); 00037 virtual ~EbmlParser( void ); 00038 00039 void Up( void ); 00040 void Down( void ); 00041 void Reset( demux_t *p_demux ); 00042 EbmlElement *Get( void ); 00043 void Keep( void ); 00044 EbmlElement *UnGet( uint64 i_block_pos, uint64 i_cluster_pos ); 00045 00046 int GetLevel( void ); 00047 00048 /* Is the provided element presents in our upper elements */ 00049 bool IsTopPresent( EbmlElement * ); 00050 00051 private: 00052 EbmlStream *m_es; 00053 int mi_level; 00054 EbmlElement *m_el[10]; 00055 int64_t mi_remain_size[10]; 00056 00057 EbmlElement *m_got; 00058 00059 int mi_user_level; 00060 bool mb_keep; 00061 bool mb_dummy; 00062 }; 00063 00064 /* This class works around a bug in KaxBlockVirtual implementation */ 00065 class KaxBlockVirtualWorkaround : public KaxBlockVirtual 00066 { 00067 public: 00068 void Fix() 00069 { 00070 if( Data == DataBlock ) 00071 SetBuffer( NULL, 0 ); 00072 } 00073 }; 00074 00075 #endif
1.5.6