Module ashpd::desktop::camera

source ·
Expand description

Check if a camera is available, request access to it and open a PipeWire remote stream.

§Examples

use ashpd::desktop::camera::Camera;

pub async fn run() -> ashpd::Result<()> {
    let camera = Camera::new().await?;
    if camera.is_present().await? {
        camera.request_access().await?;
        let remote_fd = camera.open_pipe_wire_remote().await?;
        // pass the remote fd to GStreamer for example
    }
    Ok(())
}

Structs§

  • The interface lets sandboxed applications access camera devices, such as web cams.
  • A PipeWire camera stream returned by pipewire_streams.

Functions§

  • A helper to get a list of PipeWire streams to use with the camera file descriptor returned by Camera::open_pipe_wire_remote.
  • requestpipewire
    Request access to the camera and return a file descriptor and a list of the available streams, one per camera.