In-Place Processing

 
Microsoft DirectShow 9.0

In-Place Processing

Certain data transformations can be accomplished by directly modifying the data. This is called in-place processing. Many audio and video effects can be done in this manner. If a DMO supports in-place processing, it exposes the IMediaObjectInPlace interface. In-place processing is generally more efficient than using separate buffers for the output. (One major exception is when the buffer resides in video memory. In that situation, read operations are much slower than write operations, so in-place processing is not recommended.) 

To process data in place, the client makes a single call to the IMediaObjectInPlace::Process method, rather than separate calls to ProcessInput and ProcessOutput. The Process method is synchronous; all processing occurs inside the call. Also, in-place processing does not use IMediaBuffer objects. The Process method takes a pointer directly to the memory buffer.

A DMO that supports in-place processing still must implement the IMediaObject interface, including the ProcessInput and ProcessOutput methods. The client can choose whether to use in-place processing or use separate buffers. However, do not mix the two types of processing. If you call Process, do not call ProcessInput or ProcessOutput, and vice-versa.

Effect Tails

An in-place DMO might create some additional output after the input stops. This is called an effect tail. For example, a reverb effect continues after the input reaches silence. If there is an effect tail, the Process method returns S_FALSE. Once the application has processed all of its data, it can generate the effect tail by sending empty buffers to the Process method.

See Also