Overview of IMediaObjectImpl (Compact 2013)

3/26/2014

The IMediaObjectImpl template is a class template that inherits the IMediaObject interface. To create a DMO using the template, define a class that derives from IMediaObjectImpl.

The template implements all IMediaObject methods. In most cases, the template method calls a corresponding internal method, which the derived class must provide.

Thus, the template provides generic functionality, such as validating parameters, while the derived class provides the core functionality for the DMO.

The template provides the following functionality:

  • Basic parameter checking. The template methods verify that required parameters are not NULL, that stream indexes are within range, and that flags are valid.
  • Locking. The template methods call two internal methods, Lock and Unlock, to serialize operations on the DMO. This ensures that the DMO is thread-safe.
  • Media types. The template stores the media types that are set for the streams in the DMO. It also provides accessor methods for the media types.
  • Streaming. The template prevents streaming until the client has set media types for all nonoptional streams. Also, the IMediaObject::ProcessInput and IMediaObject::ProcessOutput methods automatically call IMediaObject::AllocateStreamingResources.

The derived class must implement the IUnknown interface; the template does not provide this interface. You can use the Active Template Library (ATL) for Windows Embedded Compact to implement IUnknown, or you can provide some other implementation.

The template also does not implement the locking mechanism. The derived class must implement the Lock and Unlock methods. If you create your class using ATL for Windows Embedded Compact, however, the default ATL for Windows Embedded Compact implementations for these methods are probably sufficient.

See Also

Reference

Using the DMO Base Class
DirectX Media Objects Reference
DMO Base Class Reference