Created by the British Broadcasting Corporation.
00001 /* ***** BEGIN LICENSE BLOCK ***** 00002 * 00003 * $Id: dirac_cppparser.h,v 1.3 2004/11/22 14:05:03 asuraparaju Exp $ $Name: Dirac_0_5_2 $ 00004 * 00005 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 00006 * 00007 * The contents of this file are subject to the Mozilla Public License 00008 * Version 1.1 (the "License"); you may not use this file except in compliance 00009 * with the License. You may obtain a copy of the License at 00010 * http://www.mozilla.org/MPL/ 00011 * 00012 * Software distributed under the License is distributed on an "AS IS" basis, 00013 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for 00014 * the specific language governing rights and limitations under the License. 00015 * 00016 * The Original Code is BBC Research and Development code. 00017 * 00018 * The Initial Developer of the Original Code is the British Broadcasting 00019 * Corporation. 00020 * Portions created by the Initial Developer are Copyright (C) 2004. 00021 * All Rights Reserved. 00022 * 00023 * Contributor(s): Anuradha Suraparaju (Original Author) 00024 * 00025 * Alternatively, the contents of this file may be used under the terms of 00026 * the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser 00027 * Public License Version 2.1 (the "LGPL"), in which case the provisions of 00028 * the GPL or the LGPL are applicable instead of those above. If you wish to 00029 * allow use of your version of this file only under the terms of the either 00030 * the GPL or LGPL and not to allow others to use your version of this file 00031 * under the MPL, indicate your decision by deleting the provisions above 00032 * and replace them with the notice and other provisions required by the GPL 00033 * or LGPL. If you do not delete the provisions above, a recipient may use 00034 * your version of this file under the terms of any one of the MPL, the GPL 00035 * or the LGPL. 00036 * ***** END LICENSE BLOCK ***** */ 00037 00038 00039 00040 #ifndef DIRAC_CPPPARSER_H 00041 #define DIRAC_CPPPARSER_H 00042 00043 #include <istream> 00044 #include <streambuf> 00045 #include <libdirac_decoder/decoder_types.h> //for DecoderState 00046 #include <libdirac_common/common.h> 00047 00048 namespace dirac 00049 { 00050 class SequenceDecompressor; 00051 class Frame; 00052 00054 class InputStreamBuffer : public std::streambuf 00055 { 00056 public: 00058 InputStreamBuffer (); 00059 00061 ~InputStreamBuffer(); 00062 00064 std::ios::pos_type Rewind(); 00065 00067 00072 std::ios::pos_type Seek(std::ios::pos_type bytes, 00073 std::ios::seekdir pos = std::ios::cur); 00074 00076 std::ios::pos_type Tell(); 00077 00079 00084 void Copy(char *start, int bytes); 00085 00087 void PurgeProcessedData(); 00088 00089 private: 00090 00092 InputStreamBuffer (const InputStreamBuffer& inbuf); 00093 00095 InputStreamBuffer& operator = (const InputStreamBuffer& inbuf); 00096 00098 static const int m_buffer_size = 1232896; 00099 00101 char *m_chunk_buffer; 00102 }; 00103 00105 00117 class DiracParser 00118 { 00119 public: 00121 00125 DiracParser(bool verbose = false ); 00126 00128 ~DiracParser(); 00129 00131 00135 void SetBuffer (char *start, char *end); 00136 00138 00148 DecoderState Parse(); 00149 00151 const SeqParams& GetSeqParams() const; 00152 00154 const FrameParams& GetNextFrameParams() const; 00155 00157 const Frame& GetNextFrame() const; 00158 00160 const Frame& GetLastFrame() const; 00161 00163 00167 void SetSkip (bool skip); 00168 00169 private: 00170 00172 DecoderState SeekChunk(); 00173 00175 void InitStateVars(); 00176 00177 private: 00178 00180 DiracParser (const DiracParser &dp); 00182 DiracParser& operator = (const DiracParser &dp); 00184 DecoderState m_state; 00186 DecoderState m_next_state; 00188 int m_show_fnum; 00190 SequenceDecompressor *m_decomp; 00192 std::istream *m_istr; 00194 InputStreamBuffer m_sbuf; 00196 bool m_skip; 00198 FrameSort m_skip_type; 00200 bool m_verbose; 00202 bool m_found_start; 00204 bool m_found_end; 00206 unsigned m_shift; 00207 }; 00208 00209 } // namespace dirac 00210 00211 #endif
© 2004 British Broadcasting Corporation.
Dirac code licensed under the Mozilla Public License (MPL) Version 1.1.
HTML documentation generated by Dimitri van Heesch's
excellent Doxygen tool.