Gjsify LogoGjsify Logo

A video frame obtained from gst_video_frame_map()

record

Hierarchy

  • VideoFrame

Index

Constructors

Properties

buffer: Gst.Buffer

the mapped buffer

field
data: object[]

pointers to the plane data

field

#GstVideoFrameFlags for the frame

field
id: number

id of the mapped frame. the id can for example be used to identify the frame in case of multiview video.

field
info: VideoInfo

the #GstVideoInfo

field
map: MapInfo[]

mappings of the planes

field
meta: object

pointer to metadata if any

field
name: string

Methods

  • Copy the contents from src to dest.

    Note: Since: 1.18, dest dimensions are allowed to be smaller than src dimensions.

    Parameters

    Returns boolean

  • copy_plane(src: VideoFrame, plane: number): boolean
  • Copy the plane with index plane from src to dest.

    Note: Since: 1.18, dest dimensions are allowed to be smaller than src dimensions.

    Parameters

    • src: VideoFrame

      a #GstVideoFrame

    • plane: number

      a plane

    Returns boolean

  • unmap(): void
  • Use info and buffer to fill in the values of frame. frame is usually allocated on the stack, and you will pass the address to the #GstVideoFrame structure allocated on the stack; gst_video_frame_map() will then fill in the structures with the various video-specific information you need to access the pixels of the video buffer. You can then use accessor macros such as GST_VIDEO_FRAME_COMP_DATA(), GST_VIDEO_FRAME_PLANE_DATA(), GST_VIDEO_FRAME_COMP_STRIDE(), GST_VIDEO_FRAME_PLANE_STRIDE() etc. to get to the pixels.

      GstVideoFrame vframe;
    ...
    // set RGB pixels to black one at a time
    if (gst_video_frame_map (&vframe, video_info, video_buffer, GST_MAP_WRITE)) {
    guint8 *pixels = GST_VIDEO_FRAME_PLANE_DATA (vframe, 0);
    guint stride = GST_VIDEO_FRAME_PLANE_STRIDE (vframe, 0);
    guint pixel_stride = GST_VIDEO_FRAME_COMP_PSTRIDE (vframe, 0);

    for (h = 0; h < height; ++h) {
    for (w = 0; w < width; ++w) {
    guint8 *pixel = pixels + h * stride + w * pixel_stride;

    memset (pixel, 0, pixel_stride);
    }
    }

    gst_video_frame_unmap (&vframe);
    }
    ...

    All video planes of buffer will be mapped and the pointers will be set in frame->data.

    The purpose of this function is to make it easy for you to get to the video pixels in a generic way, without you having to worry too much about details such as whether the video data is allocated in one contiguous memory chunk or multiple memory chunks (e.g. one for each plane); or if custom strides and custom plane offsets are used or not (as signalled by GstVideoMeta on each buffer). This function will just fill the #GstVideoFrame structure with the right values and if you use the accessor macros everything will just work and you can access the data easily. It also maps the underlying memory chunks for you.

    Parameters

    Returns [boolean, VideoFrame]

  • Use info and buffer to fill in the values of frame with the video frame information of frame id.

    When id is -1, the default frame is mapped. When id != -1, this function will return %FALSE when there is no GstVideoMeta with that id.

    All video planes of buffer will be mapped and the pointers will be set in frame->data.

    Parameters

    Returns [boolean, VideoFrame]

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method