Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Windos
win32.3rdparty
win32.directx.audio
win32.directx.ddk
win32.directx.graphics
win32.directx.input
win32.directx.managed
win32.directx.misc
win32.directx.networking
win32.directx.sdk
win32.directx.video
win32.dirx.grap.shaders
win32.gdi
win32.international
win32.kernel
win32.messaging
win32.mmedia
win32.networks
win32.ole
win32.rtc
win32.tapi
win32.tapi.beta
win32.tools
win32.ui
win32.wince
win32.wmi
windows.mediacenter
winfx.aero
winfx.announcements
winfx.avalon
winfx.collaboration
winfx.fundamentals
winfx.general
winfx.indigo
winfx.sdk
winfx.winfs
  
 
date: Wed, 2 Jul 2008 14:40:12 -0700 (PDT),    group: microsoft.public.win32.programmer.directx.video        back       


DirectShow: Specifying a source file at runtime   
I am new to DirectShow.  I have a DirectShow source filter that takes
a file name as input.  It outputs video and audio.  I have built a
graph and can run it and all works fine.   For my testing, I have hard
coded the name of the input file using the IFileSourceFilter at the
time I build the graph.   I have also added test code that will later
change the source filter on my graph to a different file at runtime
and this works fine.

Now that my testing is complete, I want to move this code into
production.   For production - the source file is not known until
runtime.   So I want to remove the initial setting of a hard coded
file name when I create the graph, and just change it as needed at
runtime.

I tried changing my code to not set the source file when I build the
graph (both by omitting the code, and by passing a null string for the
file name).   Neither worked.   When I try to connect the pins - I
receive an error connecting the audio output pin to the default
DirectShow audio device (error 0x80004005 ).   Seems that a missing or
invalid file name will not even allow me to connect the pins to build
the graph.

I was hoping to just build the graph once when my app initializes,
leave it around, and then change the source file as needed during the
operation of my program.

As I see it, my choices are:

A) Have a dummy file that can be loaded at initialization.  Then just
change it as needed.  Don't like this.

B) Add the filters needed to the graph when I startup, and then
connect all the pins later when I need to load a file.  Keeping a flag
to tell me if the pins are already connected so there is no need to do
this again.  Don't like this much either.

So what is the the "normal" order of operations for this type of thing
in DirectShow?  Can somebody offer me an "option C"?

-TIA
-Figmo
date: Wed, 2 Jul 2008 14:40:12 -0700 (PDT)   author:   Figmo

Re: DirectShow: Specifying a source file at runtime   
From: "Figmo"

> A) Have a dummy file that can be loaded at
> initialization.  Then just change it as needed.  Don't
> like this.
>
> B) Add the filters needed to the graph when I startup,
> and then connect all the pins later when I need to load a
> file.  Keeping a flag to tell me if the pins are already
> connected so there is no need to do this again.  Don't
> like this much either.

http://msdn.microsoft.com/en-us/library/ms785719(VS.85).aspx
<<<It is not designed to load multiple files, and any calls 
to this method after the first call will fail.>>>

> So what is the the "normal" order of operations for this
> type of thing in DirectShow?  Can somebody offer me an
> "option C"?

Build the graph when you know the file name: 1. you can not 
change the file and 2. the file is required to know the 
media types and thus what filters are needed.


-- 
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm
date: Wed, 2 Jul 2008 18:37:33 -0400   author:   Alessandro Angeli

Re: DirectShow: Specifying a source file at runtime   
On Wed, 2 Jul 2008 14:40:12 -0700 (PDT), Figmo wrote:

> I was hoping to just build the graph once when my app initializes,
> leave it around, and then change the source file as needed during the
> operation of my program.

As Alessandro wrote, this is not something that IFileSourceFilter is meant
to do.

The usual approach to this is to use two graphs.  See Geraint's free
GMFBridge which comes with source code.  The samples includes a playlist of
multiple files.


-- 
Please read this before replying:
1. Dshow & posting help:  http://tmhare.mvps.org/help.htm
2. Trim & respond inline (please don't top post or snip everything)
3. Benefit others:  follow up if you are helped or you found a solution
date: Wed, 2 Jul 2008 19:03:37 -0600   author:   The March Hare [MVP] erland

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us