如何同步在多个监视器上使用DirectShow播放多个视频? [英] How to play multiple videos in sync over multiple monitors using directshow?

查看:134
本文介绍了如何同步在多个监视器上使用DirectShow播放多个视频?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从来就成功地管理与使用使用C#中directshowlib多个流的单个视频窗口同步播放多达8个视频。问题是视频窗口只发挥在单一屏幕上 - 当我试图把它跨越多个屏幕这是行不通的。该应用程序窗口正确跨越,但只有一个屏幕上的视频播放。任何想法?

I´ve successfully managed to play up to 8 videos in sync using a single video window with multiple streams using the directshowlib for c#. The problem is the video window plays only on a single screen - when I try to have it span over many screens it does not work. The app window spans correctly, but the video plays only on one screen. Any ideas?

非常感谢在前进。

推荐答案

我假设您正在使用VMR有多个输入引脚。的VMR是要呈现在单个表面上,这需要一个单一的显示器上。你应该能够使您的流多个VMRS,每个VMR放置在您的最大化的窗口中一个单独的显示器上。

I assume that you're using the VMR with multiple input pins. The VMR is going to render to a single surface, which needs to be on a single display. You should be able to render your streams to multiple VMRs, with each VMR placed on a separate display within your maximised window.

这听起来好像你都在流一个图。您可以将它们分成不同的图形,具有一个源和一个呈现每个图表。启动同步图形意味着使用IMediaFilter ::运行,而不是IMediaControl ::运行:

It sounds as though you have all the streams in a single graph. You can separate them into different graphs, with each graph having one source and one renderer. Starting the graphs in sync means using IMediaFilter::Run instead of IMediaControl::Run:


  • 选择一个图形作为主

  • 确保主有一个时钟。这将激活时正常完成,但你可以强制它在图中调用SetDefaultSyncSource更早发生。

  • 查询IMediaFilter图形,使用GetSyncSource从主图获得时钟和它传递给使用SetSyncSource其他图形。

  • 暂停所有图形。

  • 等到GETSTATE返回S_OK(暂停结束)。

  • 从图中获取时间和添加10ms的左右。

  • 通话IMediaFilter ::上所有图形运行,经过这段时间(现在+ 10ms)的作为参数。

  • Pick one graph as the master.
  • Make sure the master has a clock. This is normally done when going active, but you can force it to happen earlier by calling SetDefaultSyncSource on the graph.
  • Query the graphs for IMediaFilter, get the clock from the master graph using GetSyncSource and pass it to the other graphs using SetSyncSource.
  • Pause all the graphs.
  • Wait until GetState returns S_OK (the pause is complete).
  • Get the time from the graph and add 10ms or so.
  • Call IMediaFilter::Run on all graphs, passing this time (now + 10ms) as the parameter.

这篇关于如何同步在多个监视器上使用DirectShow播放多个视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆