Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I write a source filter to read asf/wmv/wma files? 1

Status
Not open for further replies.

liyi

Programmer
Jun 20, 2002
3
CN
Based on the sample "Async" which is placed in the samples of DirectShow SDK, I have write a source filter to read mpg/avi/mp3 files. Now I want to write a source filter to read asf/wmv/wma files. But I failed for many times.
Can anyone tell me how to achieve my goal?
 
I would like to know how you rewrite Async Filter to read AVI files. According to the DirectX Document, Async Sample Filter's output pin proposes MEDIATYPE_Stream and MEDIASUBTYPE_NULL for the media type. But the input pin on the AVI Splitter filter does not accept MEDIASUBTYPE_NULL. Therefore, the pin connection fails. So I really need your help to rewrite Async Filter to offer MEDIASUBTYPE_Avi. Thanks you very much.
 
Hi,mikelin:
I am glad if I can give you some useful advice.
Firstly, my work is based on the sample Async of DirectShow SDK.

If you want to write a player,please rewrite the "memfile" project in the Async sample.
In function "main()"
//
if (lstrcmpi(lpType, TEXT("avi")) == 0) {
mt.subtype = MEDIASUBTYPE_Avi;
}
//

If you want to write a source filter,please rewrite the "filter" project in the Async sample.
In function "Load(LPCOLESTR lpwszFileName, const AM_MEDIA_TYPE *pmt)" of CAsyncFilter
//
//According to the extension of filename
...........................
if (lstrcmpi(m_szUserData, TEXT("mpg")) == 0) {
cmt.subtype = MEDIASUBTYPE_MPEG1System;
} else
if (lstrcmpi(m_szUserData, TEXT("avi")) == 0) {
cmt.subtype = MEDIASUBTYPE_Avi;
}..........................
//
I think this will help you to support "avi" files.
 
Hi liyi.
Did you find a solution? if so, I'd be glad to know about it...
Anyway, I assume this is not that simple, since the wmv source filter has 2 output pins rather than 1 in the async sample filter. ALso - you should know how to split the data between the two pins...
 
Hi, blutob,
Because of other develop task, I have suspended the asf source filter development.
Just like you said, it is very difficult. I think perhaps we can find solution using Windows Media Format SDK. But now I have no time to do it. You can try. If you succeed, please tell me.
 
I'm trying to create a source filter for wmv files using the IWMReader interface form the windows media format SDK. This is the correct way to do it. This following is from the MSDN


"...you must create a custom source filter like the one in the top diagram. Basically, this filter will use the Windows Media Format SDK to instantiate a WM Reader object, decompress the samples, and send them downstream on its output pins. This discussion assumes that you have created the source filter already and are now ready..."

However this isn't really helpful! and I'm still unable to get my source filter to work.
Anyone know how to do this?

Darragh
 
I can get the source filter to work with the WaitForCompletion() after pMC->Run(). However, if i put
the filter into a dialog interface and remove the WaitForCompletion() call, the filter crashes right away.
Seems thou the memory for m_pStream is completely destroyed
by the main windows Thread. Wondering what im missing
here, WaitForCompletion cannot be used since it locks
up the main thread, rendering the interface dead until
the media is finished playing

Gooseneck
 
Hi ,
I am also working on playing asf/wmv/wma files.
i am developing an application in which the windows media files will be encoded using an algorithmn ,split into 10 mb files and be uploaded to the server.Then these contents can be downloaded.while downloading these contents into the player these files will be decoded using the same algorithmn again.Then in play button click i have added the CLSID_WMAsfReader filter and then i call render function to render the stream.I am using the direct show 9 sdk .but when i am trying to render the stream it says "No combination of filters could be found to render the stream.".I am using the async filter given in the dXSDK/samples folder.
should i write a separate source filter in order to render the pins of the wmv content?Can anyone help me solve this problem.If i have to write a separate filter can u tell me how to do so.

thanks in advance
homihachiman

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top