Dirac - A Video Codec

Created by the British Broadcasting Corporation.


dirac_cppparser.h

Go to the documentation of this file.
00001 /* ***** BEGIN LICENSE BLOCK ***** 00002 * 00003 * $Id: dirac_cppparser.h,v 1.2 2004/08/19 11:50:50 asuraparaju Exp $ $Name: Dirac_0_4_3 $ 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 class SequenceDecompressor; 00049 class Frame; 00050 00052 class InputStreamBuffer : public std::streambuf 00053 { 00054 public: 00056 InputStreamBuffer (); 00057 00059 ~InputStreamBuffer(); 00060 00062 std::ios::pos_type Rewind(); 00063 00065 00070 std::ios::pos_type Seek(std::ios::pos_type bytes, std::ios::seekdir pos = std::ios::cur); 00071 00073 std::ios::pos_type Tell(); 00074 00076 00081 void Copy(char *start, int bytes); 00082 00084 void PurgeProcessedData(); 00085 00086 private: 00087 00089 InputStreamBuffer (const InputStreamBuffer& inbuf); 00090 00092 InputStreamBuffer& operator = (const InputStreamBuffer& inbuf); 00093 00095 static const int m_buffer_size = 1232896; 00096 00098 char *m_chunk_buffer; 00099 }; 00100 00102 00114 class DiracParser 00115 { 00116 public: 00118 00122 DiracParser(bool verbose = false ); 00123 00125 ~DiracParser(); 00126 00128 00132 void SetBuffer (char *start, char *end); 00133 00135 00145 DecoderState Parse(); 00146 00148 const SeqParams& GetSeqParams() const; 00149 00151 const FrameParams& GetNextFrameParams() const; 00152 00154 const Frame& GetNextFrame() const; 00155 00157 const Frame& GetLastFrame() const; 00158 00160 00164 void SetSkip (bool skip); 00165 00166 private: 00167 00169 DecoderState SeekChunk(); 00170 00172 void InitStateVars(); 00173 00174 private: 00175 00177 DiracParser (const DiracParser &dp); 00179 DiracParser& operator = (const DiracParser &dp); 00181 DecoderState m_state; 00183 DecoderState m_next_state; 00185 int m_show_fnum; 00187 SequenceDecompressor *m_decomp; 00189 std::istream *m_istr; 00191 InputStreamBuffer m_sbuf; 00193 bool m_skip; 00195 FrameSort m_skip_type; 00197 bool m_verbose; 00199 bool m_found_start; 00201 bool m_found_end; 00203 unsigned m_shift; 00204 }; 00205 00206 #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.