Re: Filters\Async sample with WMA?
From: Alessandro Angeli [MVP::DigitalMedia] (nobody_at_nowhere.in.the.net)
Date: 09/29/04
- Next message: Alessandro Angeli [MVP::DigitalMedia]: "Re: Accurate position set in variable-rate mp3"
- Previous message: Alessandro Angeli [MVP::DigitalMedia]: "Re: Bug in IFileSourceFilter"
- In reply to: Ryan Melville: "Filters\Async sample with WMA?"
- Next in thread: Chris P. [MVP]: "Re: Filters\Async sample with WMA?"
- Reply: Chris P. [MVP]: "Re: Filters\Async sample with WMA?"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 29 Sep 2004 22:11:51 +0200
Ryan Melville wrote:
> The DirectX 9.0 SDK includes an "Async" sample in
> Samples\C++\DirectShow\Filteres that can play from a
> memory byte stream instead of from a file. This is
> terrific, but the sample only includes some video formats
> and WAV. Adding MP3 support wasn't hard - just added
> MEDIATYPE_Stream/MEDIASUBTYPE_MPEG1Audio.
Adding support for (almost) any file type is quite easy
since the media type is always stream, the format is always
null and you only need to guess at the subtype. I did it
with an hardcoded lookup table containing
<extension,subtype> pairs. You can even do it the same way
the stock file source filter does using the registry (but it
requires some work).
> Adding WMA support is proving more difficult. Either I
> don't know the correct meda/sub types or there is a trick
> I'm missing. DirectShow cannot render the output pin of
> the filter... Depending on what I try I get
> VFW_E_CANNOT_RENDER or VFW_E_INVALIDMEDIATYPE.
All the stream sources, both the stock file and URL sources
and the async sample, are simply data readers and know
nothing about the stream format. Thus they require a
parser/splitter filter downstream that reads the data from
them in pull mode and actually does the parsing. DirectShow
includes splitters for MPEG1, MPEG2, WAV, AVI... but not ASF
(WMA is an audio-only ASF). The only ASF parser is embedded
in the 2 WindowsMedia source filters and can not be used in
any way as a generic splitter.
> I need to play from a memory location and not a file
> system file. If anyone has some suggestions or knows how
> to play a WMA through the Async sample I would appreciate
> the help!
You need to write your own ASF splitter filter either using
the synchronous WMReader object with an IStream data source
(it is not the easiest of things but it's not that hard
either - Jeremey here did it not long ago IIRC) or parsing
the ASF yourself (ASF is documented but it is quite
difficult to parse). Otherwise, you can hack the WMASFReader
source filter to make it read from an IStream: the hack is
very easy to implement using the Detours library from MSR,
but if you are going to redistribute your application
commercially you'll break the license and it may even be
illegal to distribute a hack.
-- // Alessandro Angeli // MVP :: Digital Media // a dot angeli at psynet dot net
- Next message: Alessandro Angeli [MVP::DigitalMedia]: "Re: Accurate position set in variable-rate mp3"
- Previous message: Alessandro Angeli [MVP::DigitalMedia]: "Re: Bug in IFileSourceFilter"
- In reply to: Ryan Melville: "Filters\Async sample with WMA?"
- Next in thread: Chris P. [MVP]: "Re: Filters\Async sample with WMA?"
- Reply: Chris P. [MVP]: "Re: Filters\Async sample with WMA?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|