Hi,
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));
CleanupStack::PushL(codec);
CMMFDescriptorBuffer* srcbuf = CMMFDescriptorBuffer::NewL(320);
CleanupStack::PushL(srcbuf);
// Copy your PCM frame data into srcbuf, for example: srcbuf->Data().Copy(pcmbuf);
CMMFDescriptorBuffer* dstbuf = CMMFDescriptorBuffer::NewL(32);
CleanupStack::PushL(dstbuf);
TCodecProcessResult result = codec->ProcessL(*srcbuf, *dstbuf):
// now the dstbuf contains an AMR frame data
CleanupStack::PopAndDestroy(dstbuf);
CleanupStack::PopAndDestroy(srcbuf);
CleanupStack::PopAndDestroy(codec);
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?
check few posts down from here, and you'kll find post from sten that works strait away, just remember to add all needed headers & libraries accordingly.
Thanks yucca for ur response.
I have included the following:
mmf\server\mmfcodec.h
mmf\server\mmfdatabuffer.h
mmf\plugin\mmfcodecimplementationuids.hrh
and the Library:
MMFServerBaseClasses.lib
But still i get a syntax error near CMMFCodec::ProcessL(). Can u tell me where I went wrong?
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.
Bye
STeN
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
{
public:
// Construction
static CMMFCodec* NewL(TAny* aInitParams);
// Implement CMMFCodec
TCodecProcessResult ProcessL(const CMMFBuffer& aSrc, CMMFBuffer& aDst);
Notice, that factory NewL() methods still returns pointer to the base class CMMFCodec! But it returns the pointer to concrete implementation through it, the NewL() method could look like this:
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 !!!!