// This file contains generated code. Do not edit directly. // To regenerate this, run 'make'. //! Bindings to the `Xv` X11 extension. #![allow(clippy::too_many_arguments)] #[allow(unused_imports)] use std::borrow::Cow; #[allow(unused_imports)] use std::convert::TryInto; #[allow(unused_imports)] use crate::utils::RawFdContainer; #[allow(unused_imports)] use crate::x11_utils::{Request, RequestHeader, Serialize, TryParse, TryParseFd}; use std::io::IoSlice; use crate::connection::RequestConnection; #[allow(unused_imports)] use crate::connection::Connection as X11Connection; #[allow(unused_imports)] use crate::cookie::{Cookie, CookieWithFds, VoidCookie}; use crate::errors::ConnectionError; #[allow(unused_imports)] use crate::errors::ReplyOrIdError; #[allow(unused_imports)] use super::shm; #[allow(unused_imports)] use super::xproto; pub use x11rb_protocol::protocol::xv::*; /// Get the major opcode of this extension fn major_opcode(conn: &Conn) -> Result { let info = conn.extension_information(X11_EXTENSION_NAME)?; let info = info.ok_or(ConnectionError::UnsupportedExtension)?; Ok(info.major_opcode) } pub fn query_extension(conn: &Conn) -> Result, ConnectionError> where Conn: RequestConnection + ?Sized, { let request0 = QueryExtensionRequest; let (bytes, fds) = request0.serialize(major_opcode(conn)?); let slices = [IoSlice::new(&bytes[0])]; assert_eq!(slices.len(), bytes.len()); conn.send_request_with_reply(&slices, fds) } pub fn query_adaptors(conn: &Conn, window: xproto::Window) -> Result, ConnectionError> where Conn: RequestConnection + ?Sized, { let request0 = QueryAdaptorsRequest { window, }; let (bytes, fds) = request0.serialize(major_opcode(conn)?); let slices = [IoSlice::new(&bytes[0])]; assert_eq!(slices.len(), bytes.len()); conn.send_request_with_reply(&slices, fds) } pub fn query_encodings(conn: &Conn, port: Port) -> Result, ConnectionError> where Conn: RequestConnection + ?Sized, { let request0 = QueryEncodingsRequest { port, }; let (bytes, fds) = request0.serialize(major_opcode(conn)?); let slices = [IoSlice::new(&bytes[0])]; assert_eq!(slices.len(), bytes.len()); conn.send_request_with_reply(&slices, fds) } pub fn grab_port(conn: &Conn, port: Port, time: A) -> Result, ConnectionError> where Conn: RequestConnection + ?Sized, A: Into, { let time: xproto::Timestamp = time.into(); let request0 = GrabPortRequest { port, time, }; let (bytes, fds) = request0.serialize(major_opcode(conn)?); let slices = [IoSlice::new(&bytes[0])]; assert_eq!(slices.len(), bytes.len()); conn.send_request_with_reply(&slices, fds) } pub fn ungrab_port(conn: &Conn, port: Port, time: A) -> Result, ConnectionError> where Conn: RequestConnection + ?Sized, A: Into, { let time: xproto::Timestamp = time.into(); let request0 = UngrabPortRequest { port, time, }; let (bytes, fds) = request0.serialize(major_opcode(conn)?); let slices = [IoSlice::new(&bytes[0])]; assert_eq!(slices.len(), bytes.len()); conn.send_request_without_reply(&slices, fds) } pub fn put_video(conn: &Conn, port: Port, drawable: xproto::Drawable, gc: xproto::Gcontext, vid_x: i16, vid_y: i16, vid_w: u16, vid_h: u16, drw_x: i16, drw_y: i16, drw_w: u16, drw_h: u16) -> Result, ConnectionError> where Conn: RequestConnection + ?Sized, { let request0 = PutVideoRequest { port, drawable, gc, vid_x, vid_y, vid_w, vid_h, drw_x, drw_y, drw_w, drw_h, }; let (bytes, fds) = request0.serialize(major_opcode(conn)?); let slices = [IoSlice::new(&bytes[0])]; assert_eq!(slices.len(), bytes.len()); conn.send_request_without_reply(&slices, fds) } pub fn put_still(conn: &Conn, port: Port, drawable: xproto::Drawable, gc: xproto::Gcontext, vid_x: i16, vid_y: i16, vid_w: u16, vid_h: u16, drw_x: i16, drw_y: i16, drw_w: u16, drw_h: u16) -> Result, ConnectionError> where Conn: RequestConnection + ?Sized, { let request0 = PutStillRequest { port, drawable, gc, vid_x, vid_y, vid_w, vid_h, drw_x, drw_y, drw_w, drw_h, }; let (bytes, fds) = request0.serialize(major_opcode(conn)?); let slices = [IoSlice::new(&bytes[0])]; assert_eq!(slices.len(), bytes.len()); conn.send_request_without_reply(&slices, fds) } pub fn get_video(conn: &Conn, port: Port, drawable: xproto::Drawable, gc: xproto::Gcontext, vid_x: i16, vid_y: i16, vid_w: u16, vid_h: u16, drw_x: i16, drw_y: i16, drw_w: u16, drw_h: u16) -> Result, ConnectionError> where Conn: RequestConnection + ?Sized, { let request0 = GetVideoRequest { port, drawable, gc, vid_x, vid_y, vid_w, vid_h, drw_x, drw_y, drw_w, drw_h, }; let (bytes, fds) = request0.serialize(major_opcode(conn)?); let slices = [IoSlice::new(&bytes[0])]; assert_eq!(slices.len(), bytes.len()); conn.send_request_without_reply(&slices, fds) } pub fn get_still(conn: &Conn, port: Port, drawable: xproto::Drawable, gc: xproto::Gcontext, vid_x: i16, vid_y: i16, vid_w: u16, vid_h: u16, drw_x: i16, drw_y: i16, drw_w: u16, drw_h: u16) -> Result, ConnectionError> where Conn: RequestConnection + ?Sized, { let request0 = GetStillRequest { port, drawable, gc, vid_x, vid_y, vid_w, vid_h, drw_x, drw_y, drw_w, drw_h, }; let (bytes, fds) = request0.serialize(major_opcode(conn)?); let slices = [IoSlice::new(&bytes[0])]; assert_eq!(slices.len(), bytes.len()); conn.send_request_without_reply(&slices, fds) } pub fn stop_video(conn: &Conn, port: Port, drawable: xproto::Drawable) -> Result, ConnectionError> where Conn: RequestConnection + ?Sized, { let request0 = StopVideoRequest { port, drawable, }; let (bytes, fds) = request0.serialize(major_opcode(conn)?); let slices = [IoSlice::new(&bytes[0])]; assert_eq!(slices.len(), bytes.len()); conn.send_request_without_reply(&slices, fds) } pub fn select_video_notify(conn: &Conn, drawable: xproto::Drawable, onoff: bool) -> Result, ConnectionError> where Conn: RequestConnection + ?Sized, { let request0 = SelectVideoNotifyRequest { drawable, onoff, }; let (bytes, fds) = request0.serialize(major_opcode(conn)?); let slices = [IoSlice::new(&bytes[0])]; assert_eq!(slices.len(), bytes.len()); conn.send_request_without_reply(&slices, fds) } pub fn select_port_notify(conn: &Conn, port: Port, onoff: bool) -> Result, ConnectionError> where Conn: RequestConnection + ?Sized, { let request0 = SelectPortNotifyRequest { port, onoff, }; let (bytes, fds) = request0.serialize(major_opcode(conn)?); let slices = [IoSlice::new(&bytes[0])]; assert_eq!(slices.len(), bytes.len()); conn.send_request_without_reply(&slices, fds) } pub fn query_best_size(conn: &Conn, port: Port, vid_w: u16, vid_h: u16, drw_w: u16, drw_h: u16, motion: bool) -> Result, ConnectionError> where Conn: RequestConnection + ?Sized, { let request0 = QueryBestSizeRequest { port, vid_w, vid_h, drw_w, drw_h, motion, }; let (bytes, fds) = request0.serialize(major_opcode(conn)?); let slices = [IoSlice::new(&bytes[0])]; assert_eq!(slices.len(), bytes.len()); conn.send_request_with_reply(&slices, fds) } pub fn set_port_attribute(conn: &Conn, port: Port, attribute: xproto::Atom, value: i32) -> Result, ConnectionError> where Conn: RequestConnection + ?Sized, { let request0 = SetPortAttributeRequest { port, attribute, value, }; let (bytes, fds) = request0.serialize(major_opcode(conn)?); let slices = [IoSlice::new(&bytes[0])]; assert_eq!(slices.len(), bytes.len()); conn.send_request_without_reply(&slices, fds) } pub fn get_port_attribute(conn: &Conn, port: Port, attribute: xproto::Atom) -> Result, ConnectionError> where Conn: RequestConnection + ?Sized, { let request0 = GetPortAttributeRequest { port, attribute, }; let (bytes, fds) = request0.serialize(major_opcode(conn)?); let slices = [IoSlice::new(&bytes[0])]; assert_eq!(slices.len(), bytes.len()); conn.send_request_with_reply(&slices, fds) } pub fn query_port_attributes(conn: &Conn, port: Port) -> Result, ConnectionError> where Conn: RequestConnection + ?Sized, { let request0 = QueryPortAttributesRequest { port, }; let (bytes, fds) = request0.serialize(major_opcode(conn)?); let slices = [IoSlice::new(&bytes[0])]; assert_eq!(slices.len(), bytes.len()); conn.send_request_with_reply(&slices, fds) } pub fn list_image_formats(conn: &Conn, port: Port) -> Result, ConnectionError> where Conn: RequestConnection + ?Sized, { let request0 = ListImageFormatsRequest { port, }; let (bytes, fds) = request0.serialize(major_opcode(conn)?); let slices = [IoSlice::new(&bytes[0])]; assert_eq!(slices.len(), bytes.len()); conn.send_request_with_reply(&slices, fds) } pub fn query_image_attributes(conn: &Conn, port: Port, id: u32, width: u16, height: u16) -> Result, ConnectionError> where Conn: RequestConnection + ?Sized, { let request0 = QueryImageAttributesRequest { port, id, width, height, }; let (bytes, fds) = request0.serialize(major_opcode(conn)?); let slices = [IoSlice::new(&bytes[0])]; assert_eq!(slices.len(), bytes.len()); conn.send_request_with_reply(&slices, fds) } pub fn put_image<'c, 'input, Conn>(conn: &'c Conn, port: Port, drawable: xproto::Drawable, gc: xproto::Gcontext, id: u32, src_x: i16, src_y: i16, src_w: u16, src_h: u16, drw_x: i16, drw_y: i16, drw_w: u16, drw_h: u16, width: u16, height: u16, data: &'input [u8]) -> Result, ConnectionError> where Conn: RequestConnection + ?Sized, { let request0 = PutImageRequest { port, drawable, gc, id, src_x, src_y, src_w, src_h, drw_x, drw_y, drw_w, drw_h, width, height, data: Cow::Borrowed(data), }; let (bytes, fds) = request0.serialize(major_opcode(conn)?); let slices = [IoSlice::new(&bytes[0]), IoSlice::new(&bytes[1]), IoSlice::new(&bytes[2])]; assert_eq!(slices.len(), bytes.len()); conn.send_request_without_reply(&slices, fds) } pub fn shm_put_image(conn: &Conn, port: Port, drawable: xproto::Drawable, gc: xproto::Gcontext, shmseg: shm::Seg, id: u32, offset: u32, src_x: i16, src_y: i16, src_w: u16, src_h: u16, drw_x: i16, drw_y: i16, drw_w: u16, drw_h: u16, width: u16, height: u16, send_event: u8) -> Result, ConnectionError> where Conn: RequestConnection + ?Sized, { let request0 = ShmPutImageRequest { port, drawable, gc, shmseg, id, offset, src_x, src_y, src_w, src_h, drw_x, drw_y, drw_w, drw_h, width, height, send_event, }; let (bytes, fds) = request0.serialize(major_opcode(conn)?); let slices = [IoSlice::new(&bytes[0])]; assert_eq!(slices.len(), bytes.len()); conn.send_request_without_reply(&slices, fds) } /// Extension trait defining the requests of this extension. pub trait ConnectionExt: RequestConnection { fn xv_query_extension(&self) -> Result, ConnectionError> { query_extension(self) } fn xv_query_adaptors(&self, window: xproto::Window) -> Result, ConnectionError> { query_adaptors(self, window) } fn xv_query_encodings(&self, port: Port) -> Result, ConnectionError> { query_encodings(self, port) } fn xv_grab_port(&self, port: Port, time: A) -> Result, ConnectionError> where A: Into, { grab_port(self, port, time) } fn xv_ungrab_port(&self, port: Port, time: A) -> Result, ConnectionError> where A: Into, { ungrab_port(self, port, time) } fn xv_put_video(&self, port: Port, drawable: xproto::Drawable, gc: xproto::Gcontext, vid_x: i16, vid_y: i16, vid_w: u16, vid_h: u16, drw_x: i16, drw_y: i16, drw_w: u16, drw_h: u16) -> Result, ConnectionError> { put_video(self, port, drawable, gc, vid_x, vid_y, vid_w, vid_h, drw_x, drw_y, drw_w, drw_h) } fn xv_put_still(&self, port: Port, drawable: xproto::Drawable, gc: xproto::Gcontext, vid_x: i16, vid_y: i16, vid_w: u16, vid_h: u16, drw_x: i16, drw_y: i16, drw_w: u16, drw_h: u16) -> Result, ConnectionError> { put_still(self, port, drawable, gc, vid_x, vid_y, vid_w, vid_h, drw_x, drw_y, drw_w, drw_h) } fn xv_get_video(&self, port: Port, drawable: xproto::Drawable, gc: xproto::Gcontext, vid_x: i16, vid_y: i16, vid_w: u16, vid_h: u16, drw_x: i16, drw_y: i16, drw_w: u16, drw_h: u16) -> Result, ConnectionError> { get_video(self, port, drawable, gc, vid_x, vid_y, vid_w, vid_h, drw_x, drw_y, drw_w, drw_h) } fn xv_get_still(&self, port: Port, drawable: xproto::Drawable, gc: xproto::Gcontext, vid_x: i16, vid_y: i16, vid_w: u16, vid_h: u16, drw_x: i16, drw_y: i16, drw_w: u16, drw_h: u16) -> Result, ConnectionError> { get_still(self, port, drawable, gc, vid_x, vid_y, vid_w, vid_h, drw_x, drw_y, drw_w, drw_h) } fn xv_stop_video(&self, port: Port, drawable: xproto::Drawable) -> Result, ConnectionError> { stop_video(self, port, drawable) } fn xv_select_video_notify(&self, drawable: xproto::Drawable, onoff: bool) -> Result, ConnectionError> { select_video_notify(self, drawable, onoff) } fn xv_select_port_notify(&self, port: Port, onoff: bool) -> Result, ConnectionError> { select_port_notify(self, port, onoff) } fn xv_query_best_size(&self, port: Port, vid_w: u16, vid_h: u16, drw_w: u16, drw_h: u16, motion: bool) -> Result, ConnectionError> { query_best_size(self, port, vid_w, vid_h, drw_w, drw_h, motion) } fn xv_set_port_attribute(&self, port: Port, attribute: xproto::Atom, value: i32) -> Result, ConnectionError> { set_port_attribute(self, port, attribute, value) } fn xv_get_port_attribute(&self, port: Port, attribute: xproto::Atom) -> Result, ConnectionError> { get_port_attribute(self, port, attribute) } fn xv_query_port_attributes(&self, port: Port) -> Result, ConnectionError> { query_port_attributes(self, port) } fn xv_list_image_formats(&self, port: Port) -> Result, ConnectionError> { list_image_formats(self, port) } fn xv_query_image_attributes(&self, port: Port, id: u32, width: u16, height: u16) -> Result, ConnectionError> { query_image_attributes(self, port, id, width, height) } fn xv_put_image<'c, 'input>(&'c self, port: Port, drawable: xproto::Drawable, gc: xproto::Gcontext, id: u32, src_x: i16, src_y: i16, src_w: u16, src_h: u16, drw_x: i16, drw_y: i16, drw_w: u16, drw_h: u16, width: u16, height: u16, data: &'input [u8]) -> Result, ConnectionError> { put_image(self, port, drawable, gc, id, src_x, src_y, src_w, src_h, drw_x, drw_y, drw_w, drw_h, width, height, data) } fn xv_shm_put_image(&self, port: Port, drawable: xproto::Drawable, gc: xproto::Gcontext, shmseg: shm::Seg, id: u32, offset: u32, src_x: i16, src_y: i16, src_w: u16, src_h: u16, drw_x: i16, drw_y: i16, drw_w: u16, drw_h: u16, width: u16, height: u16, send_event: u8) -> Result, ConnectionError> { shm_put_image(self, port, drawable, gc, shmseg, id, offset, src_x, src_y, src_w, src_h, drw_x, drw_y, drw_w, drw_h, width, height, send_event) } } impl ConnectionExt for C {}