Video Samples
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.
Related topics