Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

配置CMMFCodec将音频编码为AMR格式

From Wiki
Jump to: navigation, search
Article Metadata

兼容于
平台: S60 2nd Edition, FP2 and FP3, S60 3rd Edition
S60 3rd Edition (initial release)

文章
翻译:
huwell
最后由 hamishwillee 在 30 May 2013 编辑
  • 详细描述

在S60第二版FP2和FP3上,可以通过CMMFCodec接口将PCM16音频格式转换为AMR-NB格式。

CMMFCodec也提供了一个方法来配置编码器,这里指定AMR为最终编码格式。


  • 解决方案
#include <mmf\plugin\mmfCodecImplementationUIDs.hrh>
 
const TUid KMMFCodecAMREncode = {KAdvancedUidCodecPCM16ToAMR}; // 0x101FAF68
 
const TUid KUidConfig = {KUidMmfCodecAudioSettings}; // 0x10203622
 
CMMFCodec* codec = CMMFCodec::NewL(KMMFCodecAMREncode);
 
TAmrEncParams iEncoderParams;
 
iEncoderParams.iMode = mode; // AMR-NB mode between 0...7
 
iEncoderParams.iDTX = EFalse; // DTX mode
 
codec->ConfigureL(KUidConfig, (const TDesC8&)iEncoderParams);
 
// proceed to call CMMFCodec::ProcessL()
 
// see CMMFCodec documentation on SDK Help for more info

SDK中已经没有TAmrEncParams的定义了,但下列定义仍可以使用:

class TAmrEncParams
{
public:
inline TAmrEncParams();
public:
// encoding mode 0-7 (0=MR475,1=MR515,...,7=MR122, default 7)
TInt iMode;
// DTX (discontinuous transmission) flag (true/false)
TInt iDTX;
};
 
TAmrEncParams::TAmrEncParams() :
iMode(7), iDTX(0) {}


  • 注意

当前大部分S60设备中的录音/播放/流都是使用更加高级的硬件解码(DSP)完成的。这些编码可以用于更高级的音频API(CMdaAudio[Player|Recorder]Utility, CMdaAudio[Input|Output]Stream)中,但它们无法通过CMMFCodec接口使用。例如某些编码(如AMR-NB)一个CMMFCodec的实现包括管理回溯的能力。


  • S60第三版

上述对TAmrEncParams的定义在第三版上也能正常工作。但AMR-NB MMF编码并非包含在所有的第三版手机上,下列手机型号是包括这些编码的:

  • Nokia 3250
  • Nokia E62
  • Nokia N71
  • Nokia N73
  • Nokia N75
  • Nokia N80
  • Nokia N92
  • Nokia N93
  • Nokia N95
  • Nokia 6290
This page was last modified on 30 May 2013, at 03:55.
123 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×