examples/sfexamples/oggvorbiscodec/src/VorbisDecoder/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     TBool IsLastPage(CMMFDataBuffer& aBuf);
00025 private:
00026     CVorbisDecoder();
00027     void ConstructL();
00028 private:
00029     enum TState
00030         {
00031         EInitializing,
00032         EReady,
00033         ENotVorbis, // not vorbis data
00034         EBadStream  // corrupt stream
00035         };
00036     TState iState;
00037     TInt iPacketCount;
00038     vorbis_info iInfo;
00039     vorbis_comment iComment;
00040     vorbis_dsp_state iDspState;
00041     vorbis_block iBlock;
00042     ogg_sync_state* iSyncState;
00043     ogg_stream_state* iStreamState;
00044     ogg_page iPage;
00045     ogg_packet iPacket;
00046     TInt iPageNumber;
00047     };
00048 
00049 /*
00050  This class is responsible for decoding the vorbis data obtained from the CVorbisEncoderPlugInWrapper into
00051  pcm data. It also returns the result of the operation.
00052  */
00053 class CVorbisDecoderProcessor : public CBase
00054     {
00055 public:
00056     enum TProcessResult
00057         {
00058         EComplete,
00059         EIncomplete,
00060         EDestNotFilled
00061         };
00062 
00063     static CVorbisDecoderProcessor* NewL();
00064     virtual ~CVorbisDecoderProcessor();
00065 
00066     void ProcessL(const CMMFBuffer& aSource,
00067                            CMMFBuffer& aDest,
00068                            TProcessResult& aRes,
00069                            TUint& aSourceUsed,
00070                            TUint& aDestWritten);
00071 private:
00072     CVorbisDecoderProcessor();
00073     void ConstructL();
00074 private:
00075     CVorbisDecoder* iDecoder;
00076     TUint iLastFrame; //lastframenumber
00077 #ifdef SYMBIAN_SEP_HEAP    
00078     RHeap* iDefaultHeap;
00079     RHeap* iVorbisHeap;
00080     RChunk iVorbisChunk;
00081 #endif
00082     };
00083 #endif //VORBISDECODER_H

Generated by  doxygen 1.6.2