Compartilhar via


IMSVidCtl::View

 
Microsoft DirectShow 9.0

IMSVidCtl::View

This topic applies to Windows XP or later.

The View method configures the Video Control to view an input source, which can be a tune request, a DVD, or a media file.

Syntax

  HRESULT View(
  
  VARIANT*
  
  v
  
  );

Parameters

  pv

[in]  Pointer to the input source as a VARIANT type. This parameter must be one of the following:

  • A pointer to a valid tune request object that supports the ITuneRequest interface. The tune request must be initialized with all the tuning information required for the particular network type.
  • The string "DVD:" for DVD playback.
  • The name of a media file.

Return Values

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

If the Video Control already has an active input device, this method configures the device for the specified input. Otherwise, this method locates an input device that can handle the input and activates it.

An input device typically corresponds to a source filter. If the pv parameter is a tune request object, the Video Control determines which filter to use by examining the network type on the tune request. For digital television, the input device will be a BDA Network Provider filter. For analog television, it will be a WDM TV Tuner filter. The specific name and implementation of the filter are device-dependent.

After calling View, use the following methods to build and run the filter graph:

  • The IMSVidCtl::Build method builds the rest of the filter graph, based on the selected input and the active features collection. The Build method leaves the graph in a stopped state.
  • The IMSVidCtl::Run method calls Build if the graph is not built, and puts the graph into a running state. When the filter graph runs, the video control starts playing the specified tune request.

If the filter graph is already built and running, an application can call View to specify a new tune request, either on the same network type or on a different network type.

If the View method succeeds, you can obtain the input device by calling the IMSVidCtl::get_InputActive method.

You can specify a particular input device by calling the IMSVidCtl::put_InputActive method and then calling IMSVidInputDevice::View on the device, instead of calling View on the Video Control. This might be useful if the local system has multiple devices of the same type. The View method is preferred, however, because it automatically locates the correct device type.

Example Code

The following example shows how to submit a tune request to the Video Control:

  

The next example shows how to play a local file:

CComVariant varFileName(OLESTR("C:Example.avi"));
hr = pVidControl->View(&varFileName);

Requirements

  Header: Dshow.h.

  Library: Quartz.dll.

See Also