Go to index / Go to protocols

treeland_capture_unstable_v1 ↗

protocol for capturing output contents or window contents

This protocol allows authorized application to capture output contents or window contents(useful for window streaming).

Warning! This protocol is EXPERIMENTAL and under active development. It may change at any time, including in backward-incompatible ways, without incrementing the interface major version and without prior notice. No compatibility guarantees of any kind are provided. Clients and compositors must track the upstream definition in treeland-protocols and must not rely on the current interface names, requests, events, or semantics remaining stable across releases.

treeland_capture_unstable_v1
treeland_capture_session_v1

Version 1

persistent screen capture session

Represents a persistent screen capture session that continuously sends frames.

treeland_capture_session_v1
enum cancel_reason {
    temporary = 0,
    permanent = 1,
    resizing = 2,
}
  • temporary — temporary error, source will produce more frames
  • permanent — fatal error, source will not produce frames
  • resizing — temporary error, source will produce more frames
treeland_capture_session_v1
enum flags {
    transient = 0x1,
}
This is a bitfield
  • transient — clients should copy frame before processing
treeland_capture_session_v1
request destroy()
Destructor

    delete this object

    Unreferences the frame. This request must be called as soon as it's no longer valid.

    treeland_capture_session_v1
    request start()

      start session

      Start session and keeps sending frame.

      treeland_capture_session_v1
      request frame_done(
          tv_sec_hi: uint,
          tv_sec_lo: uint,
          tv_usec: uint,
      )
      • tv_sec_hi — high 32 bits of the ready timestamp seconds
      • tv_sec_lo — low 32 bits of the ready timestamp seconds
      • tv_usec — ready timestamp microseconds

      Indicates current frame is done.

      This is the ACK to the current "ready" event. The next "frame" event will be sent only when current "ready" event is acknowledged. The timestamp should be the same as the one sent in "ready" event. If the frame has the "transient" flag, all objects sent before become invalid after this event.

      treeland_capture_session_v1
      event frame(
          offset_x: int,
          offset_y: int,
          width: uint,
          height: uint,
          buffer_flags: uint,
          flags: uint<flags>,
          format: uint,
          mod_high: uint,
          mod_low: uint,
          num_objects: uint,
      )
      • offset_x — crop offset x
      • offset_y — crop offset y
      • width — frame width in pixels
      • height — frame height in pixels
      • buffer_flags — buffer flags
      • format — DRM format code
      • mod_high — DRM format modifier high bits
      • mod_low — DRM format modifier low bits
      • num_objects — number of DMA-BUF objects in the frame

      supply the client with information about the frame

      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. When mask is provided, x and y should be offset relative to mask surface origin. Otherwise offset_x and offset_y should always be zero.

      treeland_capture_session_v1
      event object(
          index: uint,
          fd: fd,
          size: uint,
          offset: uint,
          stride: uint,
          plane_index: uint,
      )
      • index — object index
      • fd — DMA-BUF file descriptor
      • size — size of the DMA-BUF in bytes
      • offset — offset into the DMA-BUF
      • stride — line stride in bytes
      • plane_index — plane index within the buffer

      supply the client with object fd

      Provides a DMA-BUF object for the current frame.

      treeland_capture_session_v1
      event ready(
          tv_sec_hi: uint,
          tv_sec_lo: uint,
          tv_nsec: uint,
      )
      • tv_sec_hi — high 32 bits of the presentation timestamp seconds
      • tv_sec_lo — low 32 bits of the presentation timestamp seconds
      • tv_nsec — presentation timestamp nanoseconds

      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.

      treeland_capture_session_v1
      event cancel(
          reason: uint<cancel_reason>,
      )

        Notifies current 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.

        treeland_capture_unstable_v1
        treeland_capture_frame_v1

        Version 1
        treeland_capture_frame_v1
        enum flags {
            y_inverted = 0x1,
        }
        This is a bitfield
        • y_inverted — contents are y-inverted
        treeland_capture_frame_v1
        request destroy()
        Destructor

          delete this object, used or not

          Destroys the context. This request can be sent at any time by the client.

          treeland_capture_frame_v1
          request copy(
              buffer: object<wl_buffer>,
          )

            copy capture contents

            Copy capture contents to provided buffer

            treeland_capture_frame_v1
            event buffer(
                format: uint<wl_shm.format>,
                width: uint,
                height: uint,
                stride: uint,
            )

              inform client to prepare buffer

              Inform client to prepare buffer.

              treeland_capture_frame_v1
              event buffer_done()

                all buffer formats have done

                Inform client that all buffer formats supported are emitted.

                treeland_capture_frame_v1
                event flags(
                    flags: uint<flags>,
                )
                • flags — frame flags

                frame flags

                Provides flags about the frame. This event is sent once before the "ready" event.

                treeland_capture_frame_v1
                event ready()

                  buffer is copied

                  Inform that buffer is ready for reading

                  treeland_capture_frame_v1
                  event failed()

                    frame copy failed

                    Inform that frame copy fails.

                    treeland_capture_unstable_v1
                    treeland_capture_context_v1

                    Version 1
                    treeland_capture_context_v1
                    enum source_type {
                        output = 0x1,
                        window = 0x2,
                        region = 0x4,
                    }
                    This is a bitfield
                    • output — output source type
                    • window — window source type
                    • region — region source type
                    treeland_capture_context_v1
                    enum source_failure {
                        selector_busy = 1,
                        user_cancel = 2,
                        source_destroyed = 3,
                        other = 4,
                    }
                    • selector_busy — selector is occupied by other context
                    • user_cancel — User cancel this context from compositor
                    • source_destroyed — Source has been destroyed
                    • other — other failure

                    source failure reason

                    treeland_capture_context_v1
                    request destroy()
                    Destructor

                      delete this object, used or not

                      Destroys the context. This request can be sent at any time by the client.

                      treeland_capture_context_v1
                      request select_source(
                          source_hint: uint<source_type>,
                          freeze: uint,
                          with_cursor: uint,
                          mask: nullable object<wl_surface>,
                      )
                      • source_hint — hint for the type of source to select
                      • freeze — freeze compositing or not
                      • with_cursor — whether source content contains cursor or not
                      • mask — this mask is guaranteed to be at the top most

                      select source interactively

                      Selector is provided by compositor. Client can provide source hint to hint compositor to provide certain kinds of source.

                      treeland_capture_context_v1
                      request capture(
                          frame: new_id<treeland_capture_frame_v1>,
                      )
                      • frame — the new capture frame object

                      capture one frame

                      This request can be called just once. A second call might result in a protocol error cause we just provide transient

                      treeland_capture_context_v1
                      request create_session(
                          session: new_id<treeland_capture_session_v1>,
                      )

                        create a persistent session for capturing

                        Often used by a screen recorder.

                        treeland_capture_context_v1
                        event source_ready(
                            region_x: int,
                            region_y: int,
                            region_width: uint,
                            region_height: uint,
                            source_type: uint<source_type>,
                        )
                        • region_x — offset x of capture region relative to mask for capture contents
                        • region_y — offset y of capture region relative to mask for capture contents
                        • region_width — width of capture region
                        • region_height — height of capture region
                        • source_type — final capture source type

                        notify client that source is ready

                        This event supplies the client some information about the capture source, including the capture region relative to mask and source type.

                        treeland_capture_context_v1
                        event source_failed(
                            reason: uint<source_failure>,
                        )

                          notify client that source selection is failed

                          There could a lot of reasons but the most common one is that selector is busy

                          treeland_capture_unstable_v1
                          treeland_capture_manager_v1

                          Version 1
                          Compositor Support
                          Version 1
                          treeland 0.8.0

                          capture manager

                          Global factory for creating capture sessions and capture contexts.

                          treeland_capture_manager_v1
                          request destroy()
                          Destructor

                            destroy the capture manager

                            Destroy the treeland_capture_manager_v1 object.

                            treeland_capture_manager_v1
                            request get_context(
                                context: new_id<treeland_capture_context_v1>,
                            )

                              get a capture context