Events
Nov 19, 11 PM - Nov 21, 11 PM
Gain the competitive edge you need with powerful AI and Cloud solutions by attending Microsoft Ignite online.
Register nowThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
[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.]
Pure virtual method that derived classes override.
virtual HRESULT GetStaticImage(
long *pBufferSize,
long *pDIBImage
) = 0;
pBufferSize
Pointer to the size of the output buffer.
pDIBImage
Pointer to the output buffer.
Returns an HRESULT value.
Through the IBasicVideo interface, an application can request that it be given a copy of the current image in a memory buffer (some renderers can return E_NOTIMPL to this if they do not support it). The derived class determines how to retrieve the image. When the application calls CBaseControlVideo::GetStaticImage, it calls this pure virtual method that the derived class should override to implement it. This is also called by the CBaseControlVideo::GetCurrentImage member function.
The class provides a helper member function, CBaseControlVideo::CopyImage, that can be given a sample that contains an image, and the member function will copy the relevant section of it (based on the current source rectangle) into the output buffer supplied by the application.
The following example demonstrates an implementation of this member function in a derived class. In this example, m_pRenderer holds an object of a class derived from CBaseVideoRenderer.
// Return a copy of the current image in the video renderer
HRESULT CVideoText::GetStaticImage(long *pBufferSize,long *pDIBImage)
{
// Get any sample the renderer may be holding.
IMediaSample *pMediaSample = m_pRenderer->GetCurrentSample();
if (pMediaSample == NULL) {
return E_UNEXPECTED;
}
// Call the base class helper method to do the work.
HRESULT hr = CopyImage(pMediaSample, // Buffer containing image
&m_pRenderer->m_mtIn, // Type representing bitmap
pBufferSize, // Size of buffer for DIB
(BYTE*) pDIBImage); // Data buffer for output
pMediaSample->Release();
return hr;
}
Requirement | Value |
---|---|
Header |
|
Library |
|
Events
Nov 19, 11 PM - Nov 21, 11 PM
Gain the competitive edge you need with powerful AI and Cloud solutions by attending Microsoft Ignite online.
Register now