为什么即使没有发生监视器更改

为什么即使没有发生监视器更改

本文介绍了为什么即使没有发生监视器更改/切换也会发送 EC_DISPLAY_CHANGED?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在初始图形开始时,大约在 10 个视频样本后,我不断从 GraphManager 接收 EC_DISPLAY_CHANGE 事件,即使我没有将图形从一台显示器物理移动到另一台显示器,我只是在辅助显示器上启动它.

On the initial graph start, appoxly after 10 video samples, i keep receiving from the GraphManager the EC_DISPLAY_CHANGE event, even though, i didn't physically move the graph from one monitor to another, I only started it on the secondary monitor.

我试图搜索有关导致 CGraphManager 发送它的原因的其他信息,但找不到任何信息.

I tried to search for additional information regarding the causes the cause CGraphManager to send it but couldn't find any.

我还使用以下代码片段自行处理特定事件.

I've additionally used the following code snippet to handle the particular event by myself.

if (FAILED(hr = m_spMediaEventEx->CancelDefaultHandling(EC_DISPLAY_CHANGED)))
    return hr;

感谢您的帮助

推荐答案

EC_DISPLAY_CHANGE 在 MSDN 上:

EC_DISPLAY_CHANGE on MSDN:

如果显示模式发生变化,视频渲染器可能需要选择其他格式.通过发送此消息,渲染器向过滤器图管理器发出信号,表明它需要重新连接.在重新连接期间,渲染器可以选择新的格式.

典型的场景是视频渲染器希望显示在主显示器上,然后定位到辅助显示器上.渲染器生成事件以通过过滤器图转换更新自身.由于该事件是异步处理的,您会在已经流式传输几个样本后看到该事件.要解决此问题,请使用 IVMRMonitorConfig::SetMonitor 和朋友们提前正确定位渲染器.

The typical scenario is a video renderer expecting to be shown up on primary monitor, and then positioned onto secondary. The renderer generates the event in order to update itself through filter graph transition. You see the event after a few samples are already streamed because the event is handled asynchronously. To work this around, use IVMRMonitorConfig::SetMonitor and friends to position the renderer correctly well in advance.

注意,正常情况下,事件和重连只是一个很小的延迟,应该透明处理.

Note that under normal circumstances, the event and reconnected is just a small delay and should be handled transparently.

通过取消默认行为,您将完全取消以下行为.并且您应该注意自己试图修复的默认操作.

By canceling default behavior, you are canceling the following exactly. And you are expected to take care yourself of what default action is trying to fix.

默认操作

过滤器图形管理器暂时停止图形,然后断开并重新连接视频渲染器.它不会将事件传递给应用程序.

The filter graph manager temporarily stops the graph, and then disconnects and reconnects the video renderer. It does not pass the event to the application.

这篇关于为什么即使没有发生监视器更改/切换也会发送 EC_DISPLAY_CHANGED?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 17:22