Share via


IMediaObject Methods

Most of the IMediaObject methods are wrappers that call an internal version of the same method. The derived class must implement the internal versions, which have the prefix Internal-.

For a list of methods the derived class must implement, see DMO Base Class. The following remarks give details about some of the implementations.

AllocateStreamingResources

The template keeps a private flag that indicates whether this method has been called. If the method is called when the flag is already TRUE, it returns S_OK without calling the InternalAllocateStreamingResources method. The FreeStreamingResources method resets the flag to FALSE.

DMOLock

The DMOLock method implements the IMediaObject::Lock method. To avoid name conflicts with ATL for Windows CE, IMediaObjectImpl has renamed the method as DMOLock.

When you build the derived class, define FIX_LOCK_NAME before you include the DMO header file. The FIX_LOCK_NAME directive causes the preprocessor to substitute DMOLock for Lock in the declaration of the IMediaObject interface. Applications can still invoke the method using the name Lock because the vtable order does not change.

#define FIX_LOCK_NAME
#include <dmo.h>

This method calls Lock if the parameter is TRUE or Unlock if the parameter is FALSE. The derived class must implement the Lock and Unlock methods.

Flush

The template keeps a private flag that indicates the object's flushed state. The Flush method sets the flag to TRUE, and the ProcessInput method resets it to FALSE. If Flush is called when the flag is already TRUE, the method returns S_OK without calling the InternalFlush method.

GetInputSizeInfo and GetOutputSizeInfo

The GetInputSizeInfo and GetOutputSizeInfo methods return DMO_E_TYPE_NOT_SET unless all of the nonoptional streams have media types. Therefore, in the derived class, the internal methods can assume that all of the nonoptional streams have media types.

GetInputStatus

The GetInputStatus method calls the InternalAcceptingInput method, which the derived class must implement. The InternalAcceptingInput method returns S_OK if the specified input stream can accept input. Otherwise, it returns S_FALSE.

Unless all of the non-optional streams have media types, the GetInputStatus method returns DMO_E_TYPE_NOT_SET. Therefore, the implementation of InternalAcceptingInput does not have to check for this condition.

ProcessInput

Before the ProcessInput method calls InternalProcessInput, it calls AllocateStreamingResources and InternalAcceptingInput. Therefore, the implementation of InternalProcessInput can assume the following:

  • All resources have been allocated.
  • The input stream can accept data.

ProcessOutput

Before the ProcessOutputmethod calls InternalProcessOutput, it calls AllocateStreamingResources. Therefore, the implementation of InternalProcessOutput can assume that all resources have been allocated.

SetInputType

The SetInputTypemethod tests, sets, or clears the media type on an input stream. It calls the InternalCheckInputType method, which the derived class must implement. The InternalCheckInputType method returns S_OK if the media type is acceptable or returns an error code otherwise. The SetInputType method implements the rest of the functionality.

The SetInputType method does not allocate any resources. When the DMO switches to a streaming state, it calls the AllocateStreamingResources method. The derived class should use the InternalAllocateStreamingResources method to allocate any resources that it needs, such as memory buffers.

SetOutputType

The SetOutputType method tests, sets, or clears the media type on an output stream. It calls the InternalCheckOutputType method, which the derived class must implement. The InternalCheckOutputType method returns S_OK if the media type is acceptable or returns an error code otherwise. The SetOutputType method implements the rest of the functionality.

The SetOutputType method does not allocate any resources. When the DMO switches to a streaming state, it calls the AllocateStreamingResources method. The derived class should use the InternalAllocateStreamingResources method to allocate any resources that it needs, such as memory buffers.

See Also

DMO Reference | DMO Base Class Reference | IMediaObjectImpl | IMediaObject | IMediaObject::Lock | Lock | Unlock | InternalAcceptingInput | InternalAcceptingInput | InternalCheckInputType | InternalCheckOutputType

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.