Skip to content

zwlr_export_dmabuf_frame_v1¤

wayland.zwlr_export_dmabuf_frame_v1 ¤

A dma-buf frame

This object represents a single DMA-BUF frame.

If the capture is successful, the compositor will first send a "frame" event, followed by one or several "object". When the frame is available for readout, the "ready" event is sent.

If the capture failed, the "cancel" event is sent. This can happen anytime before the "ready" event.

Once either a "ready" or a "cancel" event is received, the client should destroy the frame. Once an "object" event is received, the client is responsible for closing the associated file descriptor.

All frames are read-only and may not be written into or altered.

Methods:

  • destroy

    Delete this object, used or not

  • on_frame

    A frame description.

  • on_object

    An object description.

  • on_ready

    Indicates frame is available for reading.

  • on_cancel

    Indicates the frame is no longer valid.

flags ¤

Frame flags

Special flags that should be respected by the client.

  • transient
    Clients should copy frame before processing

cancel_reason ¤

Cancel reason

Indicates reason for cancelling the frame.

  • temporary
    Temporary error, source will produce more frames
  • permanent
    Fatal error, source will not produce frames
  • resizing
    Temporary error, source will produce more frames

events

frame ¤

A frame description

Main event supplying the client with information about the frame. If the capture didn't fail, this event is always emitted first before any other events.

This event is followed by a number of "object" as specified by the "num_objects" argument.

Parameters:

  • width ¤

    (int) –

    Frame width in pixels

  • height ¤

    (int) –

    Frame height in pixels

  • offset_x ¤

    (int) –

    Crop offset for the x axis

  • offset_y ¤

    (int) –

    Crop offset for the y axis

  • buffer_flags ¤

    (int) –

    Flags which indicate properties (invert, interlacing), has the same values as zwp_linux_buffer_params_v1:flags

  • flags ¤

    (flags) –

    Indicates special frame features

  • format ¤

    (int) –

    Format of the frame (drm_format_*)

  • mod_high ¤

    (int) –

    Drm format modifier, high

  • mod_low ¤

    (int) –

    Drm format modifier, low

  • num_objects ¤

    (int) –

    Indicates how many objects (fds) the frame has (max 4)

object ¤

object(
    index: int, fd: fd, size: int, offset: int, stride: int, plane_index: int
) -> None

An object description

Event which serves to supply the client with the file descriptors containing the data for each object.

After receiving this event, the client must always close the file descriptor as soon as they're done with it and even if the frame fails.

Parameters:

  • index ¤

    (int) –

    Index of the current object

  • fd ¤

    (fd) –

    Fd of the current object

  • size ¤

    (int) –

    Size in bytes for the current object

  • offset ¤

    (int) –

    Starting point for the data in the object's fd

  • stride ¤

    (int) –

    Line size in bytes

  • plane_index ¤

    (int) –

    Index of the plane the data in the object applies to

ready ¤

ready(tv_sec_hi: int, tv_sec_lo: int, tv_nsec: int) -> None

Indicates frame is available for reading

This event is sent as soon as the frame is presented, indicating it is available for reading. This event includes the time at which presentation happened at.

The timestamp is expressed as tv_sec_hi, tv_sec_lo, tv_nsec triples, each component being an unsigned 32-bit value. Whole seconds are in tv_sec which is a 64-bit value combined from tv_sec_hi and tv_sec_lo, and the additional fractional part in tv_nsec as nanoseconds. Hence, for valid timestamps tv_nsec must be in [0, 999999999]. The seconds part may have an arbitrary offset at start.

After receiving this event, the client should destroy this object.

Parameters:

  • tv_sec_hi ¤

    (int) –

    High 32 bits of the seconds part of the timestamp

  • tv_sec_lo ¤

    (int) –

    Low 32 bits of the seconds part of the timestamp

  • tv_nsec ¤

    (int) –

    Nanoseconds part of the timestamp

cancel ¤

cancel(reason: cancel_reason) -> None

Indicates the frame is no longer valid

If the capture failed or if the frame is no longer valid after the "frame" event has been emitted, this event will be used to inform the client to scrap the frame.

If the failure is temporary, the client may capture again the same source. If the failure is permanent, any further attempts to capture the same source will fail again.

After receiving this event, the client should destroy this object.

Parameters:

  • reason ¤

    (cancel_reason) –

    Indicates a reason for cancelling this frame capture

destroy ¤

destroy() -> None

Delete this object, used or not

Unreferences the frame. This request must be called as soon as its no longer used.

It can be called at any time by the client. The client will still have to close any FDs it has been given.

on_frame ¤

on_frame(
    width: int,
    height: int,
    offset_x: int,
    offset_y: int,
    buffer_flags: int,
    flags: flags,
    format: int,
    mod_high: int,
    mod_low: int,
    num_objects: int,
) -> None

A frame description.

Override to handle wayland.zwlr_export_dmabuf_frame_v1.events.frame.

on_object ¤

on_object(
    index: int, fd: fd, size: int, offset: int, stride: int, plane_index: int
) -> None

An object description.

Override to handle wayland.zwlr_export_dmabuf_frame_v1.events.object.

on_ready ¤

on_ready(tv_sec_hi: int, tv_sec_lo: int, tv_nsec: int) -> None

Indicates frame is available for reading.

Override to handle wayland.zwlr_export_dmabuf_frame_v1.events.ready.

on_cancel ¤

on_cancel(reason: cancel_reason) -> None

Indicates the frame is no longer valid.

Override to handle wayland.zwlr_export_dmabuf_frame_v1.events.cancel.