Partager via


CBaseObject and CUnknown Classes (Windows CE 5.0)

Send Feedback

The CbaseObject class is the root of all base classes. It exists primarily to provide debugging assistance by keeping a count of all DirectShow objects that are active.

All derived base class constructors provide a debugging object name as the first parameter and call the CBaseObject constructor.

You can view the debugging object name sent to this base class on a debugging monitor.

The following illustration shows the class hierarchy for CBaseObject and CUnknown.

Aa451227.cbase01(en-us,MSDN.10).gif

All DirectShow classes that implement interfaces derive from a base class called CUnknown, which is derived from CBaseObject. CUnknown implements the INonDelegatingUnknown interface which, like the IUnknown interface, provides methods to request an interface, and to add or release references to that interface.

Two interfaces implement the services of IUnknown because of aggregation. Aggregation is the COM term for the combining of more than one object into a single larger object.

Although filter graph objects, such as filters and pins, are rarely aggregated, the capability is available for future extensibility and also for implementing plug-in distributors (PID), which are objects that are aggregated with the filter graph manager. In an aggregated object, the outer object (the one containing the other objects) uses the IUnknown interface to communicate outside the object.

The IUnknown interface on the outer object passes out references to the IUnknown interfaces of its internal objects. That is, when an application calls the IUnknown interface on the outer object and asks for the interface belonging to one of its internal objects, the outer object calls the IUnknown interface of the internal object to retrieve the requested interface.

Because the internal objects must delegate IUnknown interfaces to the IUnknown of the outer object, the IUnknown interface of the internal object should not be accessed privately (that is, without going through the outer object's IUnknown interface).

The internal object's IUnknown is reserved exclusively for communicating through the outer object. However, it is possible that objects will attempt to connect to other objects privately, without knowledge of the outer object. For example, pins on filters are likely to need to query interfaces on pins of other objects privately.

The INonDelegatingUnknown interface provides direct, private access to interfaces, regardless of whether the object is aggregated.

Direct access is important in most communication between the DirectShow objects such as pins, allocators, and filters, and is the default method of communication.

In fact, the base classes implement the IUnknown interface on nonaggregated objects to call the nondelegating interface directly. The nonaggregated objects include almost every object in the filter graph)

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.