Freigeben über


IAMMediaTypeStream::CreateSample method (amstream.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.
 
The CreateSample method creates a stream sample and optionally specifies the sample buffer.

Syntax

HRESULT CreateSample(
  [in] long               lSampleSize,
  [in] BYTE               *pbBuffer,
  [in] DWORD              dwFlags,
  [in] IUnknown           *pUnkOuter,
  [in] IAMMediaTypeSample **ppAMMediaTypeSample
);

Parameters

[in] lSampleSize

Size of the sample.

[in] pbBuffer

[optional] Pointer to an array of bytes that contains the sample data, or NULL.

[in] dwFlags

Reserved.

[in] pUnkOuter

[optional] Pointer to the interface of an object that aggregates the stream sample.

[in] ppAMMediaTypeSample

Address of an IAMMediaTypeSample interface pointer that receives a pointer to the created sample.

Return value

Returns one of the following values.

Return code Description
E_OUTOFMEMORY
Insufficient memory.
E_POINTER
NULL pointer argument.
S_OK
Success.

Remarks

If pUnkOuter is non-NULL, the new stream sample is aggregated into the specified object. Filters that receive the sample can then query it for interfaces supported by the aggregating object.

Requirements

Requirement Value
Target Platform Windows
Header amstream.h

See also

IAMMediaTypeStream Interface