×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Regular Contributor
    Join Date
    Mar 2007
    Location
    B'lore
    Posts
    72

    AAC Codec for S60_3rd FP2 devices

    Hi,

    In our application we were successfully using CMMFCodec to convert AAC data into PCM16. This was in FP1 devices.

    Now same code is not working in FP2 devices. It crashes as soon as I try to create the codec with fourCC as AAC.

    The crash code is -5, which is KErrNotSupported.

    Does that mean the AAC Codec is no longer supported in FP2 devices..??? And if that is the case then is there any workaround to this problem...??

    Thanks,
    Ruchir
    Ruchir

  2. #2
    Super Contributor
    Join Date
    Jul 2007
    Location
    ShenZhen, China
    Posts
    4,346

    Re: AAC Codec for S60_3rd FP2 devices

    hi ruchirvasavada, I find it seem truth, on N96, I use
    iCodec = CMMFCodec::NewL(TUid::Uid(0x101faf81)
    it will leave -1.
    but I test, eaac+ codec exists.
    iCodec = CMMFCodec::NewL(TUid::Uid(0x10207AA9)); // it is ok on n96
    I use it can open aac audio.
    and a example param is below, (not very correct, but ok for my test aac)
    Code:
        configParams.Append(iSampleRate);
        configParams.Append(iChannel);
        configParams.Append(1);
        configParams.Append(4096);
        configParams.Append(1024);
        configParams.Append(iSampleRate);
        configParams.Append(0);
        configParams.Append(0);
        configParams.Append(16);
        configParams.Append(16000);
        configParams.Append(0);
    ----------------------------
    坚持学习, 坚持编码
    http://www.devdiv.net/
    qxiaoyuan

  3. #3
    Regular Contributor
    Join Date
    Mar 2007
    Location
    B'lore
    Posts
    72

    Re: AAC Codec for S60_3rd FP2 devices

    Thanks qxiaoyuan,

    with your code, I could at least create a coded with eAAC+ format, but now my target is to convert AAC to PCM16. Where do I give the destination format detail or is it understood that destination is always PCM16?

    Actually after trying code suggested by you, the ProcessL() method panics (don't know the panic code) any idea why..? If required I can put some code also.

    Thanks,
    Ruchir
    Ruchir

  4. #4
    Super Contributor
    Join Date
    Jul 2007
    Location
    ShenZhen, China
    Posts
    4,346

    Re: AAC Codec for S60_3rd FP2 devices

    1. decode data is always PCM16.
    2. aac codec can receive any frame data, but eaac+ decode must give it data with full frame.
    so you need only transfer full frame data to it.

    I research aac format, and do a little decode, which judge full frame edge.

    Code:
    TBool CAacCodec::DecodeAudio(const TDesC8& aSrc, TDes8& aDest)
    {
        //FUNC_U_TRACE();
        TPtr8 pSrc(0, 0, 0);
        
        if ( iRemainData.Length() <= 0 )
        {
            pSrc.Set((TUint8*)aSrc.Ptr(), aSrc.Length(), aSrc.Length());
        }
        else
        {
            TInt len = iRemainData.Length() + aSrc.Length();
            if ( !iSrcBuf )
            {
                TInt maxLen = iRemainData.MaxLength() + 2 * aSrc.Length();
                iSrcBuf = HBufC8::NewL(maxLen);
                LOG_FORMAT(( _L("in CAacCodec::DecodeAudio, iSrcBuf.MaxLength() = %d"), iSrcBuf->Des().MaxLength() ));
            }
            else
            if ( len > iSrcBuf->Des().MaxLength() )
            {
                TInt maxLen = 2 * iSrcBuf->Des().MaxLength();
                maxLen = Max(maxLen, 2 * len);
                delete iSrcBuf;
                iSrcBuf = NULL;
                iSrcBuf = HBufC8::NewL(maxLen);
                LOG_FORMAT(( _L("in CAacCodec::DecodeAudio, iSrcBuf.MaxLength() = %d"), iSrcBuf->Des().MaxLength() ));
            }
            iSrcBuf->Des().Copy(iRemainData);
            iSrcBuf->Des().Append(aSrc);
            pSrc.Set((TUint8*)iSrcBuf->Ptr(), iSrcBuf->Length(), iSrcBuf->Des().MaxLength());
        }
    
    
        TInt frameNum = 0;
        TInt len = pSrc.Length();
        TInt lastFramePos = 0;
        const TUint8* datap = pSrc.Ptr();
        TInt i = 0;
        while ( i < (len - 6) )
        {
            if ( (datap[i] != 0xff) || ((datap[i+1] & 0xf0) != 0xf0) )
            {
                if ( (datap[i+2] & 0xf0) != 0xf0 )
                {
                    //LOG_FORMAT((_L("datap[%d] = 0x%02x, datap[%d] = 0x%02x, datap[%d] = 0x%02x"), i, datap[i], i+1, datap[i+1], i+2, datap[i+2]));
                }
                i++;
                continue;
            }
            TInt frameSize = (datap[i + 2] << 24) | (datap[i + 3] << 16) | (datap[i + 4] << 8) | datap[i + 5];
            frameSize &= 0x0003ffc0;
            frameSize >>= 5;
            if ( frameSize + i >= len )
            {   //不完整的帧
                break;
            }
            frameNum++;
            lastFramePos = i;
            i += frameSize;
        }
    
        TInt remainLen = len - lastFramePos;
        if ( remainLen > 0 )
        {
            TInt l = Min(iRemainData.MaxLength(), remainLen);
            iRemainData.Copy(pSrc.Right(l));
        }
    
        if ( frameNum < 1 )
        {   //如果1个帧都没有, 那么无需转换
            LOG(_L("========== panic frameNum = 0 ============="));
            return EFalse;
        }
    
    
        pSrc.SetLength(lastFramePos);
        iSrc->SetPtr(pSrc);
    
        aDest.Zero();
        TPtr8 pDest((TUint8*)aDest.Ptr(), 0, aDest.MaxLength());
        iDest->SetPtr(pDest);
        
    
        TCodecProcessResult ret;
        TRAPD(perr, ret = iCodec->ProcessL(*iSrc, *iDest));
        if ( perr != KErrNone )
        {
            LOG_FORMAT((_L("iCodec->ProcessL leave = %d"), perr));
            return EFalse;
        }
        else
        if ( ret != TCodecProcessResult::EProcessComplete)
        {
            TBuf<300> phone;
            if ( ret == TCodecProcessResult::EProcessIncomplete) phone.Append(_L("EProcessIncomplete"));
            if ( ret == TCodecProcessResult::EEndOfData) phone.Append(_L("EEndOfData"));
            if ( ret == TCodecProcessResult::EDstNotFilled) phone.Append(_L("EDstNotFilled"));
            if ( ret == TCodecProcessResult::EProcessError) phone.Append(_L("EProcessError"));
            if ( ret == TCodecProcessResult::EProcessIncompleteRepositionRequest) phone.Append(_L("EProcessIncompleteRepositionRequest"));
            if ( ret == TCodecProcessResult::EProcessCompleteRepositionRequest) phone.Append(_L("EProcessCompleteRepositionRequest"));
            LOG_FORMAT((_L("iCodec->ProcessL = %S"), &phone));
            LOG_FORMAT(( _L("iDest->Data().Length() = %d"), iDest->Data().Length() ));
            return EFalse;
        }
    
        aDest.SetLength(iDest->Data().Length());
        return ETrue;
    }
    ----------------------------
    坚持学习, 坚持编码
    http://www.devdiv.net/
    qxiaoyuan

  5. #5
    Regular Contributor
    Join Date
    Mar 2007
    Location
    B'lore
    Posts
    72

    Re: AAC Codec for S60_3rd FP2 devices

    Thank you very very much for those leads..

    From your code, I managed to extract out the frame size and read that much data from the file.

    But the ProcessL still leaves. The leave code is -1 (KErrNotFound). Does that mean the codec could not be found??

    Any idea why that error..??
    Ruchir

  6. #6
    Registered User
    Join Date
    Jul 2003
    Posts
    190

    Re: AAC Codec for S60_3rd FP2 devices

    Same problem for me tested on Nokia 6220 classic. Although I can successfully create decoder UID 0x10207aa9, and ConfigureL it with UID 0x10203622 (KUidMmfCodecAudioSettings), ProcessL function always fails with error -18 (KErrNotReady).

  7. #7
    Super Contributor
    Join Date
    Jul 2007
    Location
    ShenZhen, China
    Posts
    4,346

    Re: AAC Codec for S60_3rd FP2 devices

    Quote Originally Posted by ruchirvasavada View Post
    Thank you very very much for those leads..

    From your code, I managed to extract out the frame size and read that much data from the file.

    But the ProcessL still leaves. The leave code is -1 (KErrNotFound). Does that mean the codec could not be found??

    Any idea why that error..??
    no, it means the data has some strange format, so codec can't decode, and normally I just ignore the frame data, jump next frame data, and it will work ok.
    ----------------------------
    坚持学习, 坚持编码
    http://www.devdiv.net/
    qxiaoyuan

  8. #8
    Registered User
    Join Date
    Jul 2003
    Posts
    190

    Re: AAC Codec for S60_3rd FP2 devices

    Successfully solved here.

  9. #9
    Regular Contributor
    Join Date
    Nov 2006
    Location
    India
    Posts
    170

    Re: AAC Codec for S60_3rd FP2 devices

    Quote Originally Posted by mike.b View Post
    Successfully solved here.
    Hi
    Plz have a look here
    http://discussion.forum.nokia.com/fo...d.php?t=143284

    I wanted to implement codec for s60 3rd & 5th ed.
    But in sdk doc its mentioned that mmfcodec.h is not available in sdk then
    from where I get it?

    Please help.

    thanks
    bnvaikos

Similar Threads

  1. Replies: 7
    Last Post: 2007-09-05, 10:38
  2. Location Acquisition on S60 2nd Ed. FP2 devices ?
    By sujith in forum General Development Questions
    Replies: 2
    Last Post: 2006-11-29, 09:23
  3. CMMFCodec on 3rd edition devices for gsm6.10 codec
    By inguvaseshu in forum Symbian Media (Closed)
    Replies: 38
    Last Post: 2006-10-29, 14:01
  4. Alerting on BT devices out of range or off
    By jameelh in forum Bluetooth Technology
    Replies: 8
    Last Post: 2006-04-07, 15:44
  5. Using PC Suite with several devices
    By palmcrust in forum PC Suite API and PC Connectivity SDK
    Replies: 1
    Last Post: 2004-02-25, 20:05

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×