Multimonitor Support


So far, all of the samples in this book have used the default monitor. Here are some tips on using the VMR with multiple monitors .

First, consider the case when an application runs in full-screen mode. If the monitors are on separate display adapters, each adapter requires its own Direct3D device, as well as its own resources, such as textures and vertex buffers. Therefore, if you want to switch monitors while using a custom allocator-presenter, you ll have to manage both devices yourself. Whenever you change the device, call IVMRSurfaceAllocatorNotify9::ChangeD3DDevice on the VMR. Unfortunately, there is no easy way to make the video span two monitors at once; this is an inherent limitation of the Direct3D architecture.

Instead of having separate adapters, a computer might have a multihead card, which is a video card that supports two monitors. In DirectX 9.0 or later, both monitors on a multihead card can share the same device, which means you can create two swap chains for one device and share resources between them ” however, not all graphics drivers support this capability. You can also treat a multihead card as if it were two display adapters, and create separate Direct3D devices. The topic Multihead in the DirectX SDK documentation has more information about multihead card support.

Now consider the case where the application is windowed. If you move the window to another monitor, Direct3D automatically copies the contents to the other frame buffer. However, this can severely degrade performance. The VMR s default allocator-presenter automatically handles this case by switching to another device. To maximize performance, it never renders the video on two monitors at once. If the window straddles both monitors, the VMR draws the video on whichever monitor contains a larger area of the window. (It paints the area on the other monitor with the background color .)

When the VMR connects to a decoder filter, by default it selects the primary display adapter as the device. In most cases that works fine, but you can override this behavior by calling IVMRMonitorConfig9::SetMonitor before the pins are connected. For example, you might want to select the best monitor based on the hardware capabilities.

If you are using a custom allocator-presenter in a windowed application, you can replicate the behavior of the VMR s default allocator-presenter by checking on each frame whether the window has moved to another monitor, or is straddling two monitors.




Fundamentals of Audio and Video Programming for Games
Fundamentals of Audio and Video Programming for Games (Pro-Developer)
ISBN: 073561945X
EAN: 2147483647
Year: 2003
Pages: 120

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net