IMediaObjectImpl::LockIt Class

[The feature associated with this page, DirectShow, is a legacy feature. It has been superseded by MediaPlayer, IMFMediaEngine, and Audio/Video Capture in Media Foundation. Those features have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer, IMFMediaEngine and Audio/Video Capture in Media Foundation instead of DirectShow, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The LockIt class is an internal class that locks and unlocks the DMO.

LockIt(
    _DERIVED_ *p
);

Parameters

p

Pointer to the derived object.

Remarks

The LockIt constructor locks the DMO, and the destructor unlocks the DMO. To lock the object from inside your derived class, declare a local variable of type LockIt. The DMO is locked while the LockIt object remains in scope:

void SomeMethod()
{
    // The DMO is not locked.
    {
        LockIt dmoLock(this); // Locks the DMO.
        /* ... */
    } 
    // dmoLock goes out of scope, DMO is unlocked.
}

The methods in IMediaObjectImpl automatically lock the DMO.

Requirements

Requirement Value
Header
Dmoimpl.h
Library
Dmoguids.lib;
Msdmo.lib

See also

IMediaObjectImpl Class Template