locked
How to set media type for LPCM in media source?

    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


    haha

    Monday, September 10, 2012 9:39 AM

Answers

  • the dump data is OK, i can play it by Audacity.

    Is LPCM's media type the same as PCM's media type? And how can MFT distinguish them?


    haha

    • Marked as answer by wuyueduzun Wednesday, September 19, 2012 9:08 AM
    Wednesday, September 12, 2012 2:14 AM

All replies

  • Hello,

    Nothing jumps out at me. I would recommend writing the data to a file and comparing the output with the original in a hex editor to see if you can find where the boundaries are off.

    I hope this helps,

    James


    Windows Media SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    Monday, September 10, 2012 10:46 PM
    Moderator
  • the dump data is OK, i can play it by Audacity.

    Is LPCM's media type the same as PCM's media type? And how can MFT distinguish them?


    haha

    • Marked as answer by wuyueduzun Wednesday, September 19, 2012 9:08 AM
    Wednesday, September 12, 2012 2:14 AM