Compartilhar via


IWMReaderAllocatorEx::AllocateForStreamEx method (wmsdkidl.h)

[The feature associated with this page, Windows Media Format 11 SDK, is a legacy feature. It has been superseded by Source Reader and Sink Writer. Source Reader and Sink Writer have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use Source Reader and Sink Writer instead of Windows Media Format 11 SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The AllocateForStreamEx method allocates a user-created buffer for samples delivered to the IWMReaderCallbackAdvanced::OnStreamSample method.

Syntax

HRESULT AllocateForStreamEx(
  [in]  WORD       wStreamNum,
  [in]  DWORD      cbBuffer,
  [out] INSSBuffer **ppBuffer,
  [in]  DWORD      dwFlags,
  [in]  QWORD      cnsSampleTime,
  [in]  QWORD      cnsSampleDuration,
  [in]  void       *pvContext
);

Parameters

[in] wStreamNum

WORD containing the stream number.

[in] cbBuffer

Size of ppBuffer, in bytes.

[out] ppBuffer

Pointer to a pointer to an INSSBuffer object.

[in] dwFlags

DWORD containing the relevant flags.

Flag Description
WM_SFEX_NOTASYNCPOINT This flag is the opposite of the WM_SF_CLEANPOINT flag used in other methods of this SDK. It indicates that the point is not a key frame, or is not a good point to go to during a seek. This inverse definition is used for compatibility with Direct Show.
WM_SFEX_DATALOSS Some data has been lost between the previous sample and the sample with the flag set.

[in] cnsSampleTime

Specifies the sample time, in 100-nanosecond units.

[in] cnsSampleDuration

Specifies the sample duration, in 100-nanosecond units.

[in] pvContext

Generic pointer, for use by the application. This pointer is the context pointer given to the IWMReader::Start method.

Return value

If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code.

Remarks

This method differs from IWMReaderCallbackAdvanced::AllocateForStream in that sample time and duration values can be passed.

When you allocate a sample in your implementation of this method, you should call INSSBuffer::SetLength to set the length of the buffer to the length passed by the reader in the cbBuffer parameter. If you do not set the current length on the buffer, the reader may encounter an error.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only],Windows Media Format 7 SDK, or later versions of the SDK
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header wmsdkidl.h (include Wmsdk.h)

See also

INSSBuffer Interface

IWMReaderAllocatorEx Interface

IWMReaderCallbackAdvanced Interface