IMediaStream::AllocateSample method (mmstream.h)

[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  This interface is deprecated. New applications should not use it.
 
Allocates a new stream sample object for the current media stream.

Syntax

HRESULT AllocateSample(
  [in]  DWORD         dwFlags,
  [out] IStreamSample **ppSample
);

Parameters

[in] dwFlags

Flags. Must be zero.

[out] ppSample

Address of a pointer to the newly created stream sample's IStreamSample interface.

Return value

Returns one of the following values.

Return code Description
E_OUTOFMEMORY
There isn't enough memory available to create a stream sample.
E_POINTER
A parameter is invalid.
S_OK
Success.

Remarks

This method allocates the sample and its associated backing object or buffer. The backing object is either the DirectDraw surface for video or the IAudioData object for audio.

Requirements

Requirement Value
Target Platform Windows
Header mmstream.h

See also

IMediaStream Interface