IMediaTransform::Process

The Process method enables your transform to process a block of data.

Syntax

HRESULT Process(
  IBufferManager*  pManager,
  TIME_INFO*  pTimeInfo,
  PIPELINE_TIME  duration,
  IBuffer**  ppInputs,
  DWORD  dwInputCount,
  IBuffer*  pOutput
);

Parameters

pManager

[in]  Pointer to an IBufferManager manager object that can be used to allocate buffers or surfaces or acquire the Direct3D device.

pTimeInfo

[in]  Pointer to a TIME_INFO structure that describes the submitted sample.

duration

[in]  A PIPELINE_TIME value that describes the duration of the effect or transition.

ppInputs

[in]  An array of IBuffer interface pointers that contain sample data. Each element of the array points to a buffer containing a sample from one input source. An effect transform will have only one input; a transition will have two.

dwInputCount

[in]  DWORD that specifies the number of buffers in ppInputs.

pOutput

[in]  Pointer to an IBuffer that holds the output sample. Windows Movie Maker allocates this buffer for the transform.

Return Values

The transform can return S_OK to indicate success, or an error code to indicate failure. If the transform returns an error code, Windows Movie Maker will no longer call the Process method of this transform for the current playback. If the user stops and restarts the clip, Windows Movie Maker will begin calling Process again.

Remarks

Nodes should not cache temporary surface buffers but should create them each time Process is called. Caching temporary buffers is not recommended because the application could lose access to the device or could lose system resources between calls. If your transform loads parameters from an XML initialization file, you must navigate to the required parameter and either retrieve the value (by calling ITransformPropertyPoint::get_Value) or ask Windows Movie Maker to calculate the current value for you by calling ITransformProperty::CalcValueAtTime. For more information about property interfaces, see Property Management Interfaces.

The following steps show how to handle the Process call:

  1. Call GetSurface on output/inputs to get surfaces to read from and write to.
  2. Call GetTexture on inputs/outputs to get textures to read from/write to.
  3. Query the IBufferManager interface passed in for ISurfaceManager to get an IDirect3DDevice9 interface for the device.
  4. Call IDirect3DDevice9::BeginScene to begin rendering.
  5. Call IDirect3DDevice9::SetRenderTarget and pass in pOutput.
  6. Manipulate the data as needed. If this is a transition, you will need to calculate the position of the current frame within the total transition. This is done by calculating pTimeInfo.segmentTime / duration. Get new or existing surfaces and textures, as described later in this topic.
  7. Call IDirect3DDevice9::EndScene to queue the scene for rendering.
  8. Free any temporary caches you created, increment any persistent values that need to be modified, and return.

To create a new texture, call IDirect3DDevice9::CreateTexture.

To retrieve an existing surface or texture, call GetSurface or GetTexture, passing in the IBuffer interface that holds the existing surface or texture you want to use.

Requirements

Client: Windows Vista

Header: Include gputransformplugin.h and GPUPipelineTime.h.

Library: Use GPUPipelineVC7.lib (for Visual Studio .NET) or GPUPipelineVC8.lib (for Visual Studio 2005).

See Also