Re: ASF Writer with WAVEFORMATEXTENSIBLE



Jonathan Benedicto wrote:

Hello All,

How can I use WAVEFORMATEXTENSIBLE with the WM ASF
Writer? I setup my AM_MEDIA_TYPE like this:

pmt.majortype := MEDIATYPE_Audio;
pmt.subtype := MEDIASUBTYPE_PCM;
pmt.bFixedSizeSamples := true;
pmt.bTemporalCompression := false;
pmt.lSampleSize := 1;
pmt.formattype := FORMAT_WaveFormatEx;
pmt.pUnk := NULL;
pmt.cbFormat := sizeof( WAVEFORMATEX ) +
pwfx.Format.cbSize; ...

where pmt is a AM_MEDIA_TYPE structure and pwfx is a
WAVEFORMATEXTENSIBLE structure, and set the profile to
use the Windows Media Audio Professional codec, but I get
a 0x80040217 error when I try to connect the audio source
to the writer.

HRESULT: 0x80040217 (2147746327)
Name: VFW_E_CANNOT_CONNECT
Description: No combination of intermediate filters could be
found to make the connection.

I can't tell you for sure, but what comes to my mind is that
the subtype should match the wFormatTag and yours isn't. If
your pwfx points to a WAVEFORMATEXTENSIBLE, then wFormatTag
should be WAVE_FORMAT_EXTENSIBLE while MEDIASUBTYPE_PCM
matches WAVE_FORMAT_PCM. That is, MEDIASUBTYPE_PCM is the
same as FOURCCMap(WAVE_FORMAT_PCM) when you'd need
FOURCCMap(WAVE_FORMAT_EXTENSIBLE).

A FOURCCMap() is just a GUID where the GUID::dwData1 field
is the same as the wFormatTag value and the rest has a fixed
value (see
http://msdn.microsoft.com/library/en-us/directshow/htm/audiosubtypes.asp).



--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// a dot angeli at psynet dot net
// http://www.riseoftheants.com/mmx/faq.htm


.