locked
How to set media type for LPCM? RRS feed

  • Question

  • Hi,

    I have to support LPCM in my media source, so i set the media type like below, but i only hear noise. what's wrong with my code?

    				WAVEFORMATEX wfx;
    				memset(&wfx, 0, sizeof(WAVEFORMATEX));
    
    				wfx.wFormatTag = WAVE_FORMAT_PCM;
    				wfx.nChannels = audioTrack.Channel;
    				wfx.nSamplesPerSec = audioTrack.SampleRate;
    				wfx.wBitsPerSample = 16;
    				wfx.nBlockAlign = wfx.nChannels * wfx.wBitsPerSample/8;
    				wfx.nAvgBytesPerSec = wfx.nBlockAlign * wfx.nSamplesPerSec;
    
    				hr = MFInitMediaTypeFromWaveFormatEx(pType, (const WAVEFORMATEX*)&wfx, sizeof(wfx));
    				
    				hr = pType->SetGUID(MF_MT_SUBTYPE, MFAudioFormat_PCM);
    
    				hr = pType->SetUINT32(MF_MT_ALL_SAMPLES_INDEPENDENT, TRUE);


    haha


    • Edited by wuyueduzun Friday, September 7, 2012 10:03 AM
    Friday, September 7, 2012 10:03 AM

Answers

  • And i have check the media info of my test file with my parameter, no error

    haha

    • Marked as answer by wuyueduzun Wednesday, September 19, 2012 9:08 AM
    Friday, September 7, 2012 10:05 AM