Discussion:
How to open WME streaming URL in Directshow
(too old to reply)
jack123
2009-12-02 07:24:01 UTC
Permalink
I set up a broadcast session with Windows Media Encoder.
My URL is something like http://127.0.0.1:8080.
I can open this Url in Windows Media player, video is working fine.
How can I open this Url in Directshow.
Alessandro Angeli
2009-12-02 19:05:00 UTC
Permalink
From: "jack123"
Post by jack123
I set up a broadcast session with Windows Media Encoder.
My URL is something like http://127.0.0.1:8080.
I can open this Url in Windows Media player, video is
working fine. How can I open this Url in Directshow.
You need to use the WMASFReader filter. However, by default
the HTTP protocol is handled by the URLReader filter, which
won't work with a WMSP source like WME.

However, an HTTP URL which ends with a WM extension (e.g.
ASF, WMA, WMV...) will be handled by the WMASFReader. So you
can just use

http://127.0.0.1:8080/ignore.wmv

to make it work with IGraphBuilder::AddSourceFilter() or
IGraphBuilder::RenderFile(), since WME ignores the path URI.

Otherwise, you can manually use the WMASFReader (in
pseudo-C++):

IGraphBuilder* pGrfBuilder;
IBaseFilter* pAsfFilter
=
CoCreateInstance(CLSID_WMAsfReader,NULL,CLSCTX_INPROC_SERVER,IID_IBaseFilter);
pGrfBuilder->AddFilter(pAsfFilter,NULL);
IFileSourceFilter* pAsfSource
= pAsfFilter->QueryInterface(IID_IFileSourceFilter);
pAsfSource->Load(L"http://127.0.0.1:8080",NULL);
IEnumPins* pAsfPins
= pAsfFilter->EnumPins();
while(IPin* pAsfPin = pAsfPins->Next(1)) {
pGrfBuilder->Render(pAsfPin);
}

You could also change the "Source Filter" value in the
[HKEY_CLASSES_ROOT\http] registry key to point to the
WMASFReader CLSID, but it would be a very bad idea. Or you
could set the TreatAs key in the URLReader registration
(manually or through CoTreatAsClass()), but this is also a
global change and thus a bad idea.

You could also locally redirect the URLReader's CLSID to the
WMASFReader using RegisterClassObject(). This is still
process-wide, but at least not system-wide or permanent.
--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm
jack123
2009-12-03 06:19:01 UTC
Permalink
Thanks Alessandro Angeli.
I can play video using WMASFReader Filter.
Post by Alessandro Angeli
From: "jack123"
Post by jack123
I set up a broadcast session with Windows Media Encoder.
My URL is something like http://127.0.0.1:8080.
I can open this Url in Windows Media player, video is
working fine. How can I open this Url in Directshow.
You need to use the WMASFReader filter. However, by default
the HTTP protocol is handled by the URLReader filter, which
won't work with a WMSP source like WME.
However, an HTTP URL which ends with a WM extension (e.g.
ASF, WMA, WMV...) will be handled by the WMASFReader. So you
can just use
http://127.0.0.1:8080/ignore.wmv
to make it work with IGraphBuilder::AddSourceFilter() or
IGraphBuilder::RenderFile(), since WME ignores the path URI.
Otherwise, you can manually use the WMASFReader (in
IGraphBuilder* pGrfBuilder;
IBaseFilter* pAsfFilter
=
CoCreateInstance(CLSID_WMAsfReader,NULL,CLSCTX_INPROC_SERVER,IID_IBaseFilter);
pGrfBuilder->AddFilter(pAsfFilter,NULL);
IFileSourceFilter* pAsfSource
= pAsfFilter->QueryInterface(IID_IFileSourceFilter);
pAsfSource->Load(L"http://127.0.0.1:8080",NULL);
IEnumPins* pAsfPins
= pAsfFilter->EnumPins();
while(IPin* pAsfPin = pAsfPins->Next(1)) {
pGrfBuilder->Render(pAsfPin);
}
You could also change the "Source Filter" value in the
[HKEY_CLASSES_ROOT\http] registry key to point to the
WMASFReader CLSID, but it would be a very bad idea. Or you
could set the TreatAs key in the URLReader registration
(manually or through CoTreatAsClass()), but this is also a
global change and thus a bad idea.
You could also locally redirect the URLReader's CLSID to the
WMASFReader using RegisterClassObject(). This is still
process-wide, but at least not system-wide or permanent.
--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm
.
jack123
2009-12-03 06:35:01 UTC
Permalink
Hi Alessandro Angeli,
Can you please tell how can I reduce buffer value in Directshow, like
WMP(Tools->Options->Performance->Buffer default is 5 seconds).
Post by Alessandro Angeli
From: "jack123"
Post by jack123
I set up a broadcast session with Windows Media Encoder.
My URL is something like http://127.0.0.1:8080.
I can open this Url in Windows Media player, video is
working fine. How can I open this Url in Directshow.
You need to use the WMASFReader filter. However, by default
the HTTP protocol is handled by the URLReader filter, which
won't work with a WMSP source like WME.
However, an HTTP URL which ends with a WM extension (e.g.
ASF, WMA, WMV...) will be handled by the WMASFReader. So you
can just use
http://127.0.0.1:8080/ignore.wmv
to make it work with IGraphBuilder::AddSourceFilter() or
IGraphBuilder::RenderFile(), since WME ignores the path URI.
Otherwise, you can manually use the WMASFReader (in
IGraphBuilder* pGrfBuilder;
IBaseFilter* pAsfFilter
=
CoCreateInstance(CLSID_WMAsfReader,NULL,CLSCTX_INPROC_SERVER,IID_IBaseFilter);
pGrfBuilder->AddFilter(pAsfFilter,NULL);
IFileSourceFilter* pAsfSource
= pAsfFilter->QueryInterface(IID_IFileSourceFilter);
pAsfSource->Load(L"http://127.0.0.1:8080",NULL);
IEnumPins* pAsfPins
= pAsfFilter->EnumPins();
while(IPin* pAsfPin = pAsfPins->Next(1)) {
pGrfBuilder->Render(pAsfPin);
}
You could also change the "Source Filter" value in the
[HKEY_CLASSES_ROOT\http] registry key to point to the
WMASFReader CLSID, but it would be a very bad idea. Or you
could set the TreatAs key in the URLReader registration
(manually or through CoTreatAsClass()), but this is also a
global change and thus a bad idea.
You could also locally redirect the URLReader's CLSID to the
WMASFReader using RegisterClassObject(). This is still
process-wide, but at least not system-wide or permanent.
--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm
.
Alessandro Angeli
2009-12-03 18:58:41 UTC
Permalink
From: "jack123"
Post by jack123
Can you please tell how can I reduce buffer value in
Directshow, like WMP(Tools->Options->Performance->Buffer
default is 5 seconds).
WMP can do things normal humans can't, because it uses its
own top-secret magical source filter. Anyway, both WMP's
source filter and the public WMASFReader filter use the
WMReader object internally. There is no direct way to get a
reference to it, but you can get one this way (pseudo-C++):

IBaseFilter* pAsfFilter;
IServiceProvider* pAsfService
= pAsfFilter->QueryInterface(IID_IServiceProvider);
/// I don't care if you do not need this,
/// you *must* ask for it anyway!
IWMDRMReader* pAsfDrm
= pAsfService->QueryService(IID_IWMDRMReader,
IID_IWMDRMReader);
IWMReaderNetworkConfig* pAsfNetwork
= pAsfDrm->QueryInterface(IID_IWMReaderNetworkConfig);
--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm
Claude Boulard
2011-01-27 12:43:43 UTC
Permalink
Hi,
I'm a software engineer, and for my 'leisure' I'm designing a demotic system.

One function of this system, is to play music in the different rooms of my home. The music played can be different in each room.

This works fine, I can play any music stored in the PC in any room; I'd like now to play internet audio (mainly webcast radios) in each room.

I'd just need to know how to get the audio data from the url stream. Then I'm able to convert it (bitrate, resolution etc) to my playing format, which is audio CD format.

I've tried the sample mentionned in your article, '35433823/how-to-open-wme-streaming-url-in-directshow.aspx' but it doesn't work.

I've downloaded and checked in the Windows Media Format 11 SDK, but I haven't found a sample helpfull for me.

As you may have understood, I'm compfortable in C++ programming, audio processing etc., but I'm a 'newbie' in Window Media SDK.

Any suggestion or link will be greatly appreciated.

Thanks,

Claude.
Post by jack123
I set up a broadcast session with Windows Media Encoder.
My URL is something like http://127.0.0.1:8080.
I can open this Url in Windows Media player, video is working fine.
How can I open this Url in Directshow.
Post by Alessandro Angeli
From: "jack123"
You need to use the WMASFReader filter. However, by default
the HTTP protocol is handled by the URLReader filter, which
will not work with a WMSP source like WME.
However, an HTTP URL which ends with a WM extension (e.g.
ASF, WMA, WMV...) will be handled by the WMASFReader. So you
can just use
http://127.0.0.1:8080/ignore.wmv
to make it work with IGraphBuilder::AddSourceFilter() or
IGraphBuilder::RenderFile(), since WME ignores the path URI.
Otherwise, you can manually use the WMASFReader (in
IGraphBuilder* pGrfBuilder;
IBaseFilter* pAsfFilter
=
CoCreateInstance(CLSID_WMAsfReader,NULL,CLSCTX_INPROC_SERVER,IID_IBaseFilter);
pGrfBuilder->AddFilter(pAsfFilter,NULL);
IFileSourceFilter* pAsfSource
= pAsfFilter->QueryInterface(IID_IFileSourceFilter);
pAsfSource->Load(L"http://127.0.0.1:8080",NULL);
IEnumPins* pAsfPins
= pAsfFilter->EnumPins();
while(IPin* pAsfPin = pAsfPins->Next(1)) {
pGrfBuilder->Render(pAsfPin);
}
You could also change the "Source Filter" value in the
[HKEY_CLASSES_ROOT\http] registry key to point to the
WMASFReader CLSID, but it would be a very bad idea. Or you
could set the TreatAs key in the URLReader registration
(manually or through CoTreatAsClass()), but this is also a
global change and thus a bad idea.
You could also locally redirect the URLReader's CLSID to the
WMASFReader using RegisterClassObject(). This is still
process-wide, but at least not system-wide or permanent.
--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm
Post by jack123
Thanks Alessandro Angeli.
I can play video using WMASFReader Filter.
Post by jack123
Hi Alessandro Angeli,
Can you please tell how can I reduce buffer value in Directshow, like
WMP(Tools->Options->Performance->Buffer default is 5 seconds).
Post by Alessandro Angeli
From: "jack123"
WMP can do things normal humans cannot, because it uses its
own top-secret magical source filter. Anyway, both WMP's
source filter and the public WMASFReader filter use the
WMReader object internally. There is no direct way to get a
IBaseFilter* pAsfFilter;
IServiceProvider* pAsfService
= pAsfFilter->QueryInterface(IID_IServiceProvider);
/// I do not care if you do not need this,
/// you *must* ask for it anyway!
IWMDRMReader* pAsfDrm
= pAsfService->QueryService(IID_IWMDRMReader,
IID_IWMDRMReader);
IWMReaderNetworkConfig* pAsfNetwork
= pAsfDrm->QueryInterface(IID_IWMReaderNetworkConfig);
--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm
Submitted via EggHeadCafe
WCF Generic DataContract object Serializer
http://www.eggheadcafe.com/tutorials/aspnet/59ae2b9e-a3be-4cd5-a0ef-939a7abbdc3a/wcf-generic-datacontract-object-serializer.aspx
Loading...