in Application with Direct Show SDK and WIndows Media Format SDK

in Application with Direct Show SDK and WIndows Media Format SDK

Post by HyunKeun Par » Fri, 21 Feb 2003 13:06:20



Hi..

I am developing application that played WMV media Files with Direct Show SDK
and WIndows Media Format SDK.

Sorry, My English is poor...

How can I set IWMReadercallback ?

// Create IGraphBuilder
hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
IID_IGraphBuilder, (void **)&m_pIGraphBuilder);

// Create ASF Reader Filter
hr = CreateFilter(CLSID_WMAsfReader, &m_pASFReader);

// Adding ASF Reader Filter in Filter Graph
hr = m_pIGraphBuilder->AddFilter(m_pASFReader, L"ASF Reader");

// Create File Source Filter
IFileSourceFilter* pIFileSourceFilter = NULL;
hr = m_pASFReader->QueryInterface(IID_IFileSourceFilter, (void **)
&pIFileSourceFilter);

hr = pIFileSourceFilter->Load(L"mms://test/80k.wmv", NULL );
SAFE_ARROW_RELEASE_INTERFACE(pIFileSourceFilter);

// Render in Output Pin of ASF Reader Filter
hr = RenderOutputPins(m_pIGraphBuilder, m_pASFReader);

// Create IWMReaderAdvanced2
hr = m_pASFReader->QueryInterface(&m_pIWMReaderAdvanced2);

                ???????
                m_pIWMReaderAdvanced2->OpenStream(IStream*  pStream,
IWMReaderCallback*  ck,
  void*  pvContext);

Quote:}

 
 
 

in Application with Direct Show SDK and WIndows Media Format SDK

Post by Guy Pritchard [MSF » Fri, 28 Feb 2003 05:51:25


Hello HyunKeun!

If I am understanding you correctly you are looking for a means to pass a
IWMReadercallback interface into the IWMReaderAdvanced2::OpenStream method.
 In order to do this you need to implement the IWMReadercallback interface
on a class yourself.  Given that this is a COM interface we need to be
polite and follow the rules of COM (Supporting IUnknown's QueryInterface,
AddRef and Release functions)
For some pointers on doing this the new Windows Media 9 Format SDK has an
excellent sample called ReadFromStream which has a class which implements
IWMReadercallback. (Reader.cpp/.h).  
Once you have this you simply create an instance of the class and pass a
pointer to the class into the OpenStream method as a IWMReadercallback  
pointer.  This will allow the Format SDK to call you back on your own
class's methods and inform you of of events that are occuring whilst
reading the file.

I hope this helps!

Guy Pritchard
Microsoft

This posting is provided "AS IS" with no warranties, and confers no rights.