×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

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

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

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

(OP)
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?

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

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.

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

(OP)
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.

RE: How can I write a source filter to read asf/wmv/wma 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...

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

(OP)
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.

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

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

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmform/htm/enablingdirectxvideoacceleration.asp

"...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

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

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

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

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close