Directshow - Stop and close a file (but reuse graph and some filters)

0

I am building a multistream video player. I am currently having issues trying to close a file. Effectively I may have 1 to 4 video files playing at any one time. When I am playing 4 files, then the next sequence only has one, I can't seem to repaint the video panel correctly after removing the source file filter.

I must say that I am building and managing the graph manually (to get some extra speed), including connecting all filters/renderers etc. I have looked into GMFBridge, but ultimately I ran into issues keeping the render graph and file graph in sync all the time (issues such as fast playback (catching up due to timecoding) and having to run/pause/stop/step the mediacontrol on both render and file graphs simultaneously (failed playback sometimes)). From memory the render graph needs to be configured correctly and my scenario didn't fit in exactly with the sample provided (need to playback seemlessly but still required the individual time coding for each file - not merged into one large file).

I reuse the IFilterGraph2/VMR/DirectSound objects throughout the lifetime of the application. The only thing that changes is the SourceFilter and neccessary decoders/demuxes.

So the process is:

  1. Build graph
  2. Add Renderer
  3. Attempt to play a file - according to file type, add the source filter and demux/decoders etc (remove any obsolete filters)
  4. Connect the filters together (manually connect the pins)
  5. Seek/play etc
  6. Once done, unload the current source file by calling Graph.RemoveFilter(), but leave the renderers in the graph and disconnect all pins.

I have experienced the following error:

  • COM+ exception when closing the file (and calling VMR.RepaintVideo())

EDIT: The error is this:

COM+ is required for this operation, but is not installed (Exception from HRESULT: 0x8004020C)

I do call VMR.SetVideoClippingWindow() once when adding the renderer to the graph.

Is there any way to unload the file, without disposing the filtergraph, and repaint/clear the video window? for that matter, is there any way to repaint the video when there is no source file filter in the graph?

c#
video
com
directshow
directshow.net
asked on Stack Overflow Oct 15, 2013 by Simon • edited Oct 15, 2013 by Roman R.

1 Answer

1
  1. I don't think you have any significant speed gain if you stop the graph and even disconnect pins
  2. The error is not really COM+, the codes overlap and this error has a different meaning (what is the code exactly?)

The only way to eliminate all artifacts and smoothly swap the files and make it quick is to split the pipeline into parts and have video renderer in the filter graph you never stop and disconnect. This takes you back to bridging, or instead to similar technique of synchronization streams between upstream file graph and downstream presentation graph.

UPD. The error is 0x8004020C VFW_E_BUFFER_NOTSET "No buffer space has been set.", use ShowHresult to decode codes, this tool has in particular priority to DirectShow codes when it hits overlapped code blocks.

answered on Stack Overflow Oct 15, 2013 by Roman R. • edited Oct 15, 2013 by Roman R.

User contributions licensed under CC BY-SA 3.0