Important:
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.
A version of this page is also available for
4/8/2010

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

The template implements all IMediaObjectmethods. 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, Lockand 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::ProcessInputand IMediaObject::ProcessOutputmethods automatically call IMediaObject::AllocateStreamingResources.

The derived class must implement the IUnknowninterface; the template does not provide this interface. You can use the Active Template Library (ATL) for Windows Embedded CE 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 Lockand Unlockmethods. If you create your class using ATL for Windows Embedded CE, however, the default ATL for Windows Embedded CE implementations for these methods are probably sufficient.

See Also