description | ms.assetid | title | ms.topic | ms.date |
---|---|---|---|---|
Video Samples |
1ee2ad6f-5e84-45ba-9849-cd3bd8e7eb29 |
Video Samples |
article |
05/31/2018 |
The video sample object is a specialized implementation of the IMFSample interface for use with the Enhanced Video Renderer (EVR). To create an instance of this object, call the MFCreateVideoSampleFromSurface function. The function takes a pointer to a Direct3D surface and returns a pointer to the IMFSample interface. The following types of objects should allocate samples using this function:
-
Custom EVR presenters. A presenter allocates video samples and sends them to the mixer's IMFTransform::ProcessOutput method. For more information, see How to Write an EVR Presenter.
-
Video decoders that support video acceleration. For more information, see Supporting DXVA 2.0 in Media Foundation.
The video sample object implements the following interfaces:
If the pUnkSurface parameter of MFCreateVideoSampleFromSurface is non-NULL, the resulting video sample contains a single media buffer that encapsulates the Direct3D surface. This buffer object has limited functionality:
-
The buffer's IMFMediaBuffer::Lock method returns E_NOTIMPL.
-
The buffer does not implement the IMF2DBuffer interface.
The only way to access the surface from the buffer is to call IMFGetService::GetService, using the service identifier MR_BUFFER_SERVICE.
If the pUnkSurface parameter is NULL, the video sample is created with zero media buffers. To add a buffer the sample, do the following:
-
Create a Direct3D surface.
-
Create a surface buffer by calling MFCreateDXSurfaceBuffer. For more information, see DirectX Surface Buffer.
-
Add the buffer to the sample by calling IMFSample::AddBuffer.
Use this approach if you need the surface memory to be accessible through the IMF2DBuffer interface.