I am trying to implement audio streaming in Nokia 6630 using symbian 8.0. I could do it successfully for PCM format. Now I want to convert the data to AMR.
I found this piece of code in one of the forum to convert PCM to AMR
// Uid of PCM16toAMR codec is 0x101FAF68
CMMFCodec* codec = CMMFCodec::NewL(TUid::Uid(0x101FAF68));
CMMFDescriptorBuffer* srcbuf = CMMFDescriptorBuffer::NewL(320);
// Copy your PCM frame data into srcbuf, for example: srcbuf->Data().Copy(pcmbuf);
CMMFDescriptorBuffer* dstbuf = CMMFDescriptorBuffer::NewL(32);
TCodecProcessResult result = codec->ProcessL(*srcbuf, *dstbuf):
// now the dstbuf contains an AMR frame data
But the CMMFCodec::ProcessL() is a pure virtual function which needs to be implemented. But I don't know what is the processing included in that? Can anyone help me please?
it is correct that CMMFCodec::ProcessL() is pure virtual, because concrete codec plugins are derived from this class. Look what the SDK says:
"Codec plugins are derived from CMMFCodec and can be used by controller plugins to convert data from one data type to another."
"The functions in the CMMFCodec base class, from which a specific CMMFCodec must derive, are: CMMFCodec::NewL() and CMMFCodec::ProcessL(). Optional additions are CMMFCodec::ConfigureL() and CMMFCodec::ResetL()."
So now should be clear, that CMMFCodec is just base class. You choose the implementation when NewL() method is called by using fourCC or better concrete codec UID.
I probably found what confuse you. You probably looked into mmf\common\mmfcodec.h file and found here definition of CMMFCodec class. Ok it should look, that its methods ProcessL() and ConfigureL() dont do anything.Let me explain it.
When you want do build your own codec you will use CMMFCodec class as base and you will write code like this:
// Declares an example of MMF plug-in codec
class CMMFExCodec : public CMMFCodec
static CMMFCodec* NewL(TAny* aInitParams);
// Implement CMMFCodec
TCodecProcessResult ProcessL(const CMMFBuffer& aSrc, CMMFBuffer& aDst);
EXACLTY IN THE SAME way is implemented CMMFCodec class - it returns the pointer to instance of concrete codec implementation specified by its uid for example, BUT if uid is false it simply return pointer to 'this', so you cannot use ProcessL() method !!!!