Share via


IMediaObject Methods (Compact 2013)

3/26/2014

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 Reference. 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 Embedded Compact, IMediaObjectImpl Class Template 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 _DERIVED_::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 _DERIVED_::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 IMediaObject::Flush method sets the flag to TRUE, and the IMediaObject::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 IMediaObject::GetInputSizeInfo and IMediaObject::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 IMediaObject::GetInputStatus method calls the _DERIVED_::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 IMediaObject::ProcessInput method calls InternalProcessInput, it calls IMediaObject::AllocateStreamingResources and _DERIVED_::InternalAcceptingInput. Therefore, the implementation of InternalProcessInput can assume the following:

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

ProcessOutput

Before the IMediaObject::ProcessOutput method calls InternalProcessOutput, it calls AllocateStreamingResources. Therefore, the implementation of InternalProcessOutput can assume that all resources have been allocated.

SetInputType

The IMediaObject::SetInputType method tests, sets, or clears the media type on an input stream. It calls the _DERIVED_::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 IMediaObject::SetOutputType method tests, sets, or clears the media type on an output stream. It calls the _DERIVED_::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

Reference

IMediaObjectImpl Class Template
DirectX Media Objects Reference
DMO Base Class Reference
IMediaObject
IMediaObject::Lock
_DERIVED_::Lock
_DERIVED_::Unlock
_DERIVED_::InternalAcceptingInput
_DERIVED_::InternalAcceptingInput
_DERIVED_::InternalCheckInputType
_DERIVED_::InternalCheckOutputType