VorbisDecoder.hpp

00001 /*********************************************************************** 00002 * * 00003 * ViTooKi * 00004 * * 00005 * title: VorbisDecoder.hpp * 00006 * * 00007 * * 00008 * * 00009 * ITEC institute of the University of Klagenfurt (Austria) * 00010 * http://www.itec.uni-klu.ac.at * 00011 * * 00012 * * 00013 * For more information visit the ViTooKi homepage: * 00014 * http://ViTooKi.sourceforge.net * 00015 * vitooki-user@lists.sourceforge.net * 00016 * vitooki-devel@lists.sourceforge.net * 00017 * * 00018 * This file is part of ViTooKi, a free video toolkit. * 00019 * ViTooKi is free software; you can redistribute it and/or * 00020 * modify it under the terms of the GNU General Public License * 00021 * as published by the Free Software Foundation; either version 2 * 00022 * of the License, or (at your option) any later version. * 00023 * * 00024 * This program is distributed in the hope that it will be useful, * 00025 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00026 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00027 * GNU General Public License for more details. * 00028 * * 00029 * You should have received a copy of the GNU General Public License * 00030 * along with this program; if not, write to the Free Software * 00031 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 00032 * MA 02111-1307, USA. * 00033 * * 00034 ***********************************************************************/ 00035 00036 /*********************************************************************** 00037 * * 00038 * REVISION HISTORY: * 00039 * * 00040 * * 00041 * * 00042 ***********************************************************************/ 00043 00044 #ifndef _VORBIS_DECODER_HPP 00045 #define _VORBIS_DECODER_HPP 00046 00047 #ifdef ENABLE_OGG 00048 00049 #include "AudioAdaptor.hpp" 00050 #include "AudioESInfo.hpp" 00051 #include "Frame.hpp" 00052 #include "UncompressedAudioFrame.hpp" 00053 #include "container/OGGContainerFile.hpp" 00054 #include <vorbis/codec.h> 00055 #include <vorbis/vorbisfile.h> 00056 #include <vorbis/vorbisenc.h> 00057 00058 class VorbisDecoder : public AudioAdaptor { 00059 public: 00060 00061 /* Constructor 00062 * @param outStream defines th IO class for writing the output 00063 * @param autoFix if set to <code>false</code>, automatic insertion feature turned off 00064 * 00065 */ 00066 VorbisDecoder(AudioESInfo* es); 00067 00068 virtual ~VorbisDecoder(); 00069 00070 list < Frame * >adapt(Frame * frm); 00071 00072 Adaptor* clone() { return new VorbisDecoder(es); }; 00073 00074 void initialize(); 00075 00076 list < Frame * >close() { 00077 list < Frame * >tmp; 00078 return tmp; 00079 }; 00080 00081 00086 u32 getTranscodingCosts() const { 00087 return es->getAvgBandwidth()/8; 00088 } 00089 00090 private: 00091 protected: 00092 00093 #define VORBIS_INPUT_BUFFER_SIZE (5*8192) 00094 00095 OGGStreamInfo *osi; 00096 vorbis_dsp_state *vd; 00097 00098 unsigned char *inputBuffer; 00099 unsigned char *guardPtr; 00100 int Status; 00101 unsigned long FrameCount; 00102 00103 u32 numInFrames; 00104 bool initialized; 00105 u32 lastTS; 00106 AU * pAU; 00107 }; 00108 00109 #endif 00110 #endif