examples/sfexamples/oggvorbiscodec/src/omx/decoder/VorbisDecoder.h

00001 // VorbisDecoder.h
00002 //
00003 // Copyright (c) Symbian Software Ltd 2005-2007.  All rights reserved.
00004 //
00005 
00006 #ifndef VORBISDECODER_H
00007 #define VORBISDECODER_H
00008 
00009 #include "ivorbiscodec.h"
00010 
00011 /*
00012  Central decoding class - talks to the Xiph vorbis libraries. It is responsible to convert the 
00013  errors returned by these library method calls into Symbian error codes.
00014  */
00015 class CVorbisDecoder : public CBase
00016     {
00017 public:
00018     static CVorbisDecoder* NewL();
00019     virtual ~CVorbisDecoder();
00020     void PacketInL(ogg_packet aPacket);
00021     void PcmOutL(TDes8& aBuf);   
00022     void DecoderL(const CMMFDataBuffer& aBuf,TDes8& aDstBuf);
00023     void Reset();
00024 private:
00025     CVorbisDecoder();
00026     void ConstructL();
00027 private:
00028     enum TState
00029         {
00030         EInitializing,
00031         EReady,
00032         ENotVorbis, // not vorbis data
00033         EBadStream  // corrupt stream
00034         };
00035     TState iState;
00036     TInt iPacketCount;
00037     vorbis_info iInfo;
00038     vorbis_comment iComment;
00039     vorbis_dsp_state iDspState;
00040     vorbis_block iBlock;
00041     ogg_sync_state* iSyncState;
00042     ogg_stream_state* iStreamState;
00043     ogg_page iPage;
00044     ogg_packet iPacket;
00045     TInt iPageNumber;
00046     };
00047 
00048 /*
00049  This class is responsible for decoding the vorbis data obtained from the CVorbisEncoderPlugInWrapper into
00050  pcm data. It also returns the result of the operation.
00051  */
00052 class CVorbisDecoderProcessor : public CBase
00053     {
00054 public:
00055     enum TProcessResult
00056         {
00057         EComplete,
00058         EIncomplete,
00059         EDestNotFilled
00060         };
00061 
00062     static CVorbisDecoderProcessor* NewL();
00063     virtual ~CVorbisDecoderProcessor();
00064 
00065     void ProcessL(const CMMFBuffer& aSource,
00066                            CMMFBuffer& aDest,
00067                            TProcessResult& aRes,
00068                            TUint& aSourceUsed,
00069                            TUint& aDestWritten);
00070 private:
00071     CVorbisDecoderProcessor();
00072     void ConstructL();
00073 private:
00074     CVorbisDecoder* iDecoder;
00075     TUint iLastFrame; //lastframenumber
00076 #ifdef SYMBIAN_SEP_HEAP    
00077     RHeap* iDefaultHeap;
00078     RHeap* iVorbisHeap;
00079     RChunk iVorbisChunk;
00080 #endif
00081     };
00082 #endif //VORBISDECODER_H

Generated by  doxygen 1.6.2