Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion WMP plays mp3, myapp(DShow) doesn't
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Alessandro Angeli [MVP::DigitalMedia]  
View profile  
 More options Dec 22 2005, 8:37 pm
Newsgroups: microsoft.public.win32.programmer.directx.audio
From: "Alessandro Angeli [MVP::DigitalMedia]" <nob...@nowhere.in.the.net>
Date: Fri, 23 Dec 2005 02:37:18 +0100
Local: Thurs, Dec 22 2005 8:37 pm
Subject: Re: WMP plays mp3, myapp(DShow) doesn't

Mike M. wrote:
> Strange. I resent. My maillog says it was Sent.

SMTP is not a reliable transport since it has no end-to-end
ACK.

Anyway, is the MP3 supposed to be a stereo VBR stream at
44100 Hz?

It starts with 25565 bytes of ID3v2 stuff, including an
embedded JFIF picture. The AsyncReader identifies this as an
MP3 (or rather an MPA) stream simply because it starts with
'ID3'. Then IntelligentConnect tries to connect the MPEG1
parser because that's the filter that knows how to handle an
MPA stream but the filter fails.

I can guess at a number of reasons why this fails: the
parser looks for a valid start code but it only looks so far
in the file and 25 KiB are a long way to go to find a valid
start code. Also, the JFIF is a JPEG stream, which means it
uses 0xFF bytes as marker prefixes so that it is very likely
that those JPEG markers end up emulating MPA start code
prefixes 0xFFE0. For example, there is one at byte offset 35
which causes an infinite loop on my machine. Of course, if
the MPEG1 parser knew how o handle ID3v2.x tags this would
npt happen, but ID3v2 was not common when this MPEG1 parser
was born.

If I strip the ID3 tag block, that is the first 25565 bytes,
everything works.

Why does it work with WMP? Because WMP plays MP3s like it
does ASFs, that it uses its internal ASF reader which
internally decodes the MP3 using the ACM decoder and outputs
PCM data. This is very different then the filter chain
IntelligentConnect has to build to get to the same point
(PCM data): AsyncReader->MPEG1Splitter->MP3Decoder instead
of just PrivateASFReader.

WMP's private ASF reader uses the MP3 reader provided by the
WindowsMedia runtime to parse the MP3 instead of the MPEG1
parser provided by DirectShow and it uses the FhG ACM MP3
decoder instead of the FhG DirectShow MP3 decoder.

The problem however is the parser and not the decoder.

You can do almost the same: instead of fully relying in
IntelligentConnect, manually add the public WMASFReader
source filter to an empty graph, use its
IFileSourceFilter::Load() method to open the MP3 and then
render its only output pin (exactly in this order!). The
WMASFReader uses the WMF runtime to parse the MP3 but
outputs MP3 instead of PCM that gets decoded by the usual
FhG DirectShow MP3 decoder. Since the problem is the parser,
this is enough.

In pseudo-code:

IGraphBuilder* pGrfBuilder
    = CoCreateInstance(CLSID_FilterGraph,IID_IGraphBuilder);
IBaseFilter* pAsfFilter
    = CoCreateInstance(CLSID_WMAsfReader,IID_IBaseFilter);
pGrfBuilder->AddFilter(pAsfReader);
IFileSourceFilter* pAsfSource
    = pAsfFilter->QueryInterface(IID_IFileSourceFilter);
pAsfSource->Load(szFile,NULL);
IPin* pAsfPin
    = pAsfFilter->FindPin(L"Raw Audio 0");
pGrfBuilder->Render(pAsfPin);

--
// Alessandro Angeli
// MVP :: Digital Media
// a dot angeli at psynet dot net


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google