次の方法で共有


IMediaStream::CreateSharedSample 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.
 
Creates a new stream sample that shares the same backing object as the existing sample.

Syntax

HRESULT CreateSharedSample(
  [in]  IStreamSample *pExistingSample,
  [in]  DWORD         dwFlags,
  [out] IStreamSample **ppNewSample
);

Parameters

[in] pExistingSample

Pointer to the existing sample.

[in] dwFlags

Reserved for flag data. Must be zero.

[out] ppNewSample

Address of a pointer to an IStreamSample interface that will point to the newly created shared sample.

Return value

Returns one of the following values.

Return code Description
E_OUTOFMEMORY
There isn't enough memory available to create the sample.
E_POINTER
One of the parameters is invalid.
MS_E_INCOMPATIBLE
The existing sample isn't compatible with the specified media stream.
S_OK
Success; ppNewSample points to the newly created sample.

Remarks

This method calls IUnknown::QueryInterface on the existing sample to retrieve the media type-specific information, which it uses to create the shared sample.

Requirements

Requirement Value
Target Platform Windows
Header mmstream.h

See also

IMediaStream Interface