|This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.|
Most of the IMediaObjectmethods 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.
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 InternalAllocateStreamingResourcesmethod. The FreeStreamingResourcesmethod resets the flag to FALSE.
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 DMOLockfor _DERIVED_::Lockin the declaration of the IMediaObjectinterface. Applications can still invoke the method using the name Lockbecause the vtable order does not change.
#define FIX_LOCK_NAME #include <dmo.h>
This method calls Lockif the parameter is TRUE or _DERIVED_::Unlockif the parameter is FALSE. The derived class must implement the Lockand Unlockmethods.
The template keeps a private flag that indicates the object's flushed state. The IMediaObject::Flushmethod sets the flag to TRUE, and the IMediaObject::ProcessInputmethod resets it to FALSE. If Flushis called when the flag is already TRUE, the method returns S_OK without calling the InternalFlushmethod.
GetInputSizeInfo and GetOutputSizeInfo
The IMediaObject::GetInputSizeInfoand IMediaObject::GetOutputSizeInfomethods 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.
The IMediaObject::GetInputStatusmethod calls the _DERIVED_::InternalAcceptingInputmethod, which the derived class must implement. The InternalAcceptingInputmethod 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 GetInputStatusmethod returns DMO_E_TYPE_NOT_SET. Therefore, the implementation of InternalAcceptingInputdoes not have to check for this condition.
Before the IMediaObject::ProcessInputmethod calls InternalProcessInput, it calls IMediaObject::AllocateStreamingResourcesand _DERIVED_::InternalAcceptingInput. Therefore, the implementation of InternalProcessInputcan assume the following:
- All resources have been allocated.
- The input stream can accept data.
Before the IMediaObject::ProcessOutputmethod calls InternalProcessOutput, it calls AllocateStreamingResources. Therefore, the implementation of InternalProcessOutputcan assume that all resources have been allocated.
The IMediaObject::SetInputTypemethod tests, sets, or clears the media type on an input stream. It calls the _DERIVED_::InternalCheckInputTypemethod, which the derived class must implement. The InternalCheckInputTypemethod returns S_OK if the media type is acceptable or returns an error code otherwise. The SetInputTypemethod implements the rest of the functionality.
The SetInputTypemethod does not allocate any resources. When the DMO switches to a streaming state, it calls the AllocateStreamingResourcesmethod. The derived class should use the InternalAllocateStreamingResourcesmethod to allocate any resources that it needs, such as memory buffers.
The InternalCheckOutputTypemethod returns S_OK if the media type is acceptable or returns an error code otherwise. The SetOutputTypemethod implements the rest of the functionality.
The SetOutputTypemethod does not allocate any resources. When the DMO switches to a streaming state, it calls the AllocateStreamingResourcesmethod. The derived class should use the InternalAllocateStreamingResourcesmethod to allocate any resources that it needs, such as memory buffers.