c++ - multichannel support for Windows Media Foundation AAC encoder -


i'm writing program using windows media foundation aac encoder encode audio. according documentation here - aac encoder - 6 channels supported. in program when set 6, i'll mf_e_invalidmeidatype error. below code

clsid* pclsids = null;// pointer array of clisds. uint32 ncount = 0; mft_register_type_info encoderinfo; encoderinfo.guidmajortype = mfmediatype_audio;  encoderinfo.guidsubtype = mfaudioformat_aac;// aac encoder class id not exposed, have enumerate        hresult hr = fpmftenum(mft_category_audio_encoder, 0, null, &encoderinfo, null, &pclsids, &ncount); ciencoder.createobject(pclsids[0], iid_imftransform); lcomobject<imfmediatype> ciinputtype;  // input media type of encoder hr = fpmfcreatemediatype((imfmediatype**)(ciinputtype.getassignableptrref())); hr = ciinputtype->setguid(mf_mt_major_type, mfmediatype_audio); hr = ciinputtype->setguid(mf_mt_subtype, mfaudioformat_pcm); hr = ciinputtype->setuint32(mf_mt_audio_bits_per_sample, 16); // must 16 hr = ciinputtype->setuint32(mf_mt_audio_samples_per_second, samplerate); hr = ciinputtype->setuint32(mf_mt_audio_num_channels, channels); //must 1 (mono)or 2 (stereo), or 6 (5.1). hr = ciencoder->setinputtype(0, ciinputtype.get(), 0);       if (failed(hr)) {    ldebug("failed set encoder input meida type");     break;       } 

i've removed error handling code , please ignore wrapper on com object.

ciencoder->setinputtype() fail when channels == 6. when channels == 1 or 2, setinputtype succeeds. happens on both 32 , 64 bit win7 professional.

original windows 7 aac encoder did not have support 5.1 audio. added later newer os releases (windows 8 or 8.1). msdn article not have mention of this.


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -