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?

Roman R.
  • 68,205
  • 6
  • 94
  • 158
Simon
  • 9,197
  • 13
  • 72
  • 115

1 Answers1

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.

Roman R.
  • 68,205
  • 6
  • 94
  • 158
  • Thanks Roman, Added the error code. Are you suggesting to go back to GMFBridge? It is an option I guess – Simon Oct 15 '13 at 07:23
  • We have seen a reasonable speed improvement manually connecting the pins, about 180ms manual to 500ms if we use intelligent connect – Simon Oct 15 '13 at 07:26
  • Yes you can win time against Intelligent Connect, esp. when a lot of filters installed and it tries first those it will never use further. You can watch its attempts looking at DLLs it loads and unloads. You can indeed improve things here, but if you want to do even better than you will have to split graphs. Video renderer initialization and pin connection alone adds to delay. I added the error code description above, it probably comes from filter going through some transition state (stopping etc). – Roman R. Oct 15 '13 at 07:31
  • Thanks Roman, helpful. Have you had any experience with GMFBridge? Specifically keeping the source and renderer graphs in sync? If i want the current file time, I have to use IMediaSeeking on the file not the render graph, correct? Is there a way I can run the render graph, and simply pause/stop/seek the file graph? – Simon Oct 15 '13 at 07:49
  • I never used GMFBridge exactly, so I cannot guide you here exactly. It possibly implements `IMediaSeeking` so that you could use (second) graph's `IMediaSeeking`/`IMediaPosition` without thinking too much where it internally routes to. Of course you will eventually have to take care of timing and clocks. You can possibly use `IMediaSeeking`/`IMediaPosition` of the first graph as well. – Roman R. Oct 15 '13 at 08:04