X-Git-Url: https://git.nihav.org/?a=blobdiff_plain;f=nihed-cros-libva%2Fsrc%2Fsurface.rs;h=d16fedc127f0589abe675acc0c05c36648b037be;hb=69e6ce021284f1ebaf148b38b236068d08249e0f;hp=8c626ce36ed2f58d83eda34b6a15f3ade9f0c66e;hpb=51b33b65943d47a3826be9763728815ba2b9e7d5;p=nihav-player.git diff --git a/nihed-cros-libva/src/surface.rs b/nihed-cros-libva/src/surface.rs index 8c626ce..d16fedc 100644 --- a/nihed-cros-libva/src/surface.rs +++ b/nihed-cros-libva/src/surface.rs @@ -4,11 +4,9 @@ use std::rc::Rc; -use anyhow::Result; - use crate::bindings; use crate::display::Display; -use crate::status::Status; +use crate::status::*; use crate::UsageHint; /// An owned VA surface that is tied to the lifetime of a particular VADisplay @@ -30,7 +28,7 @@ impl Surface { height: u32, usage_hint: Option, num_surfaces: u32, - ) -> Result> { + ) -> VAResult> { let mut attrs = vec![]; if let Some(usage_hint) = usage_hint { @@ -66,7 +64,7 @@ impl Surface { // Safe because `self` represents a valid VADisplay. The `surface` and `attrs` vectors are // properly initialized and valid sizes are passed to the C function, so it is impossible to // write past the end of their storage by mistake. - Status(unsafe { + (unsafe { bindings::vaCreateSurfaces( display.handle(), rt_format, @@ -101,9 +99,9 @@ impl Surface { /// Blocks until all pending operations on the render target have been completed. Upon return it /// is safe to use the render target for a different picture. - pub fn sync(&self) -> Result<()> { + pub fn sync(&self) -> VAResult<()> { // Safe because `self` represents a valid VASurface. - Status(unsafe { bindings::vaSyncSurface(self.display.handle(), self.id) }).check() + (unsafe { bindings::vaSyncSurface(self.display.handle(), self.id) }).check() } /// Convenience function to return a VASurfaceID vector. Useful to interface with the C API @@ -113,10 +111,10 @@ impl Surface { } /// Wrapper over `vaQuerySurfaceStatus` to find out any pending ops on the render target. - pub fn query_status(&self) -> Result { + pub fn query_status(&self) -> VAResult { let mut status: bindings::VASurfaceStatus::Type = 0; // Safe because `self` represents a valid VASurface. - Status(unsafe { + (unsafe { bindings::vaQuerySurfaceStatus(self.display.handle(), self.id, &mut status) }) .check()?;