Delen via


VideoMediaFrame Class

Definition

Represents a frame from a MediaFrameSource that provides data in a video frame represented by a IDirect3DSurface or SoftwareBitmap.

public ref class VideoMediaFrame sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 196608)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class VideoMediaFrame final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 196608)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class VideoMediaFrame
Public NotInheritable Class VideoMediaFrame
Inheritance
Object Platform::Object IInspectable VideoMediaFrame
Attributes

Windows requirements

Device family
Windows 10 Anniversary Edition (introduced in 10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v3.0)

Remarks

Get an instance of this class by accessing the VideoMediaFrame property of a MediaFrameReference object that was obtained from a media frame source.

Important

If you access the SoftwareBitmap or Direct3DSurface objects provided by the VideoMediaFrame property of a MediaFrameReference, the system creates a strong reference to these objects, which means that they will not be disposed when you call Dispose on the containing MediaFrameReference. You must explicitly call the Dispose method of the SoftwareBitmap or Direct3DSurface directly for the objects to be immediately disposed. Otherwise, the garbage collector will eventually free the memory for these objects, but you can't know when this will occur, and if the number of allocated bitmaps or surfaces exceeds the maximum amount allowed by the system, the flow of new frames will stop. In that same line of thought, if you have called (GetVideoFrame())[videomediaframe_getvideoframe_824740069.md], then the (VideoFrame)[../windows.media/videoframe.md] retrieved has a reference on the SoftwareBitmap or Direct3DSurface objects provided by the VideoMediaFrame and needs to be disposed of by calling manually its Dispose method to avoid blocking the fow of frames. If you intend to hold on to a VideoFrame retrieved via (GetVideoFrame())[videomediaframe_getvideoframe_824740069.md] for an extended period of time, it may be better to hold on to a copy of it instead.

For how-to guidance on using MediaFrameSource to capture frames, see Process media frames with MediaFrameReader.

Properties

CameraIntrinsics

Gets an object that describes the distortion model of the camera that generated the VideoMediaFrame.

DepthMediaFrame

Gets a DepthMediaFrame containing depth data for the VideoMediaFrame, if the frame contains depth data.

Direct3DSurface

Gets an IDirect3DSurface object containing the image data for the VideoMediaFrame.

FrameReference

Gets the MediaFrameReference wrapper object associated with the VideoMediaFrame, which provides access to format information and other properties of the media frame.

InfraredMediaFrame

Gets an InfraredMediaFrame containing depth data for the VideoMediaFrame, if the frame contains infrared data.

SoftwareBitmap

Gets a SoftwareBitmap object containing the image data for the VideoMediaFrame.

VideoFormat

Gets an object describing the format of the VideoMediaFrame image data.

Methods

GetVideoFrame()

Creates a copy of the VideoMediaFrame as a VideoFrame object.

Applies to

See also