Video Port Pins

A capture device with a hardware video port might use the video port extensions (VPE) in Microsoft® DirectX®. If so, the capture filter will have a video port (VP) pin. No video data travels from the VP pin through the filter graph. Instead, video frames are produced in hardware and sent directly to video memory. The VP pin allows control messages to be sent to the hardware.

It is important to connect the VP pin, even if your application only performs file capture with no preview. If you leave the pin unconnected, the graph will not run correctly. This is different from preview pins, which do not have to be connected.

The different DirectShow video renderers provide varying support for VP pins:

  • Video Renderer: Connect the VP pin to pin 0 on the Overlay Mixer filter, and connect the Overlay Mixer filter to the Video Renderer.
  • VMR-7: Connect the VP pin to the Video Port Manager filter, and connect the Video Port Manager to the VMR-7.
  • VMR-9: You cannot use the VMR-9 if the device has a VP pin, because Direct3D 9 does not support video ports. Use either the Video Renderer or the VMR-7.

For video port scenarios, the Overlay Mixer and Video Renderer are recommended over the Video Port Manager and VMR-7, because not all drivers support the Video Port Manager. In general, the Overlay Mixer is the most reliable option for video ports.

The ICaptureGraphBuilder2::RenderStream method automatically inserts the Overlay Mixer if there is a VP pin. If you are building the graph without using this method, you should check for a video port pin on the capture filter, and if one is present, connect it to the Overlay Mixer filter, as shown in the following diagram.

Connecting a video port pin to the Overlay Mixer filter.

You can use the ICaptureGraphBuilder2::FindPin method to search for a VP pin on the capture filter:

hr = pBuild->FindPin(
    pCap,                    // Pointer to the capture filter.
    PINDIR_OUTPUT,           // Look for an output pin.
    &PIN_CATEGORY_VIDEOPORT, // Look for a video port pin.
    NULL,                    // Any media type.
    FALSE,                   // Pin can be connected.
    0,                       // Retrieve the first matching pin.
    &pVPPin                  // Receives a pointer to the pin.

After you add the Overlay Mixer to the graph, call FindPin again to find pin 0 on the Overlay Mixer. Pin 0 is always the first input pin on the filter.

pBuild->FindPin(pOvMix, PINDIR_INPUT, NULL, NULL, TRUE, 0, &pOVPin);

Connect the two pins by calling IGraphBuilder::Connect.

pGraph->Connect(pVPPin, pOvPin);

Then connect the Overlay Mixer's output pin to the Video Renderer filter. You can hide the video by calling the IVideoWindow::put_AutoShow and IVideoWindow::put_Visible methods on the Filter Graph Manager.

For TV tuners, the capture filter might also have a video port VBI pin (PIN_CATEGORY_VIDEOPORT_VBI). If so, connect that pin to the VBI Surface Allocator filter. For more information, see Viewing Closed Captions.

Related topics

Advanced Capture Topics
Using the Overlay Mixer in Video Capture