> btw, would you know offhand why I get an E_FAIL when i query for the
> advanced writer from the IServiceProvider?
>
> here is my test code:
>
> HRESULT hr = 0;
> hr = ::CoInitialize(NULL);
> // Create the graph builder and the filtergraph
> hr = pCaptureGraphBuilder.CoCreateInstance
> ( CLSID_CaptureGraphBuilder2 );
> hr = pGraph.CoCreateInstance( CLSID_FilterGraph );
> hr = pCaptureGraphBuilder->SetFiltergraph( pGraph );
> hr = pDevEnum.CoCreateInstance(CLSID_SystemDeviceEnum);
>
> // Query all the interfaces needed later
> hr = pGraph.QueryInterface( &pMediaControl );
> hr = pGraph.QueryInterface( &pMediaEvent );
> hr = pGraph.QueryInterface( &pMediaSeeking );
>
> // Initialize the video capture filter
> pVideoCap.Attach( GetFirstInputDriver(Video));
> hr = pGraph->AddFilter( pVideoCap, L"Video capture source" );
>
> // Initialize the audio capture filter
> pAudioCaptureFilter.Attach(GetFirstInputDriver(Audio));
> hr = pGraph->AddFilter( pAudioCaptureFilter, L"Audio Capture
> Filter" );
>
> // Initialize the Video DMO Wrapper
> hr = pVideoEncoder.CoCreateInstance( CLSID_DMOWrapperFilter );
> hr = pVideoEncoder.QueryInterface( &pVideoWrapperFilter );
>
> // Load the WMV9 encoder in the DMO Wrapper.
> // To encode in MPEG, replace CLSID_CWMV9EncMediaObject with the
> // CLSID of your DMOCLSID_CWMV9EncMediaObject
>
> hr = pVideoWrapperFilter->Init(__uuidof(CWMV9EncMediaObject), //
> CLSID_CWMV9EncMediaObject,
> DMOCATEGORY_VIDEO_ENCODER );
> hr = pGraph->AddFilter( pVideoEncoder, L"WMV9 DMO Encoder" );
>
> // Load ASF multiplexer.
> // To create a MPEG file, change the CLSID_ASFWriter into the GUID
> // of your multiplexer
> hr = pAsfWriter.CoCreateInstance( CLSID_WMAsfWriter );
> IFileSinkFilter* fileSink;
> hr = pAsfWriter->QueryInterface( IID_IFileSinkFilter, (void**)
> &fileSink );
> pFileSinkFilter.Attach(fileSink);
> hr = pFileSinkFilter->SetFileName(L"C:\\test0.asf", NULL);
>
> IWMWriterNetworkSink* pNetSink = NULL;
> hr = ::WMCreateWriterNetworkSink(&pNetSink);
> pNetworkSink.Attach(pNetSink);
> DWORD port = 2727;
> hr = pNetworkSink->Open(&port);
>
> IServiceProvider* prov = NULL;
> hr = pAsfWriter->QueryInterface(IID_IServiceProvider, (void**)&prov);
> pProvider.Attach(prov);
> IWMWriterAdvanced2* writer = NULL;
>
> //THIS RETURNS E_FAIL
> hr = pProvider->QueryService
> (IID_IWMWriterAdvanced2,IID_IWMWriterAdvanced2, (void**)&writer);
> pWriterAdvanced.Attach(writer);
>
> On Nov 21, 1:51 pm, "Alessandro Angeli" <nob...[ at ]nowhere.in.the.net>
> wrote:
>
> > From: "Lehel"
>
> > > First, I experimented with GraphEdit to test out the
> > > ASFWriter filter for DirectShow. The writer creates an
>
> > [...]
>
> > The WMASFWriter filter is not designed to work in GraphEdit,
> > because you can not configure it.
>
> > You might want to read this older thread for details that
> > shouls answer all of your previous questions:
>
> >
http://groups.google.com/group/microsoft.public.win32.programmer.dire...>
> > As an alternative to the stock WMASFWriter, you can also use
> > my own ASF sink (Q20 in my FAQ, link at the bottom). You
> > will have to remove some of the code that forces the
> > WMWriter object to work as a muxer only.
>
> > > My last question has to do with the filters in GraphEdit.
> > > I tried simply to make a graph using my video and audio
> > > capture filters and connecting them directly to the
> > > ASFWriter which failed. I then tried adding a video and
> > > audio compressor filters, respectively, but when I did
> > > this, graphedit inserted a decoder right after my decoder
> > > and then into the asf writer. is the
> > > capture->encoder->decoder->asf_writer really necessary?
>
> > No, it's not. As I said, the WMASFWriter can not be used in
> > GraphEdit because you can not configure it and you need to
> > configure it with the right profile to successfully connect
> > to it.
>
> >
http://msdn.microsoft.com/en-us/library/aa384809(VS.85).aspx>
> > --
> > // Alessandro Angeli
> > // MVP :: DirectShow / MediaFoundation
> > // mvpnews at riseoftheants dot com
> > //
http://www.riseoftheants.com/mmx/faq.htm