IMediaDet::WriteBitmapBits method

[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.]

Note

[Deprecated. This API may be removed from future releases of Windows.]

 

The WriteBitmapBits method retrieves a video frame at the specified media time and writes it to a file. The video frame is always in 24-bit RGB format.

Syntax

HRESULT WriteBitmapBits(
   double StreamTime,
   long   Width,
   long   Height,
   BSTR   Filename
);

Parameters

StreamTime

Time at which to retrieve the video frame.

Width

Width of the image, in pixels.

Height

Height of the image, in pixels.

Filename

Path of the file in which to save the bitmap. If the file already exists, this method overwrites it.

Return value

Returns S_OK it successful. Otherwise, returns an HRESULT value that indicates the cause of the error. Possible error codes include the following:

Return code Description
E_NOINTERFACE
Could not add the Sample Grabber filter to the graph.
E_FAIL
Failure.
E_OUTOFMEMORY
Insufficient memory.
E_UNEXPECTED
Unexpected error.
STG_E_ACCESSDENIED
Cannot overwrite file.
VFW_E_INVALIDMEDIATYPE
Invalid media type.

 

Remarks

Before calling this method, set the file name and stream by calling IMediaDet::put_Filename and IMediaDet::put_CurrentStream.

This method puts the media detector into bitmap grab mode. Once this method has been called, the various stream information methods in IMediaDet do not work, unless you create a new instance of the media detector.

Note

The header file Qedit.h is not compatible with Direct3D headers later than version 7.

 

Note

To obtain Qedit.h, download the Microsoft Windows SDK Update for Windows Vista and .NET Framework 3.0. Qedit.h is not available in the Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 Service Pack 1.

 

Requirements

Requirement Value
Header
Qedit.h
Library
Strmiids.lib

See also

IMediaDet Interface

Error and Success Codes