X-Git-Url: https://git.nihav.org/?a=blobdiff_plain;f=nihed-cros-libva%2Fsrc%2Fbuffer.rs;h=3d1cceb2e5e40438c2e6e01f1dd583a5804ec96c;hb=HEAD;hp=62f8f510cfd388435de994f46322554d807f71c5;hpb=51b33b65943d47a3826be9763728815ba2b9e7d5;p=nihav-player.git diff --git a/nihed-cros-libva/src/buffer.rs b/nihed-cros-libva/src/buffer.rs index 62f8f51..3d1cceb 100644 --- a/nihed-cros-libva/src/buffer.rs +++ b/nihed-cros-libva/src/buffer.rs @@ -16,10 +16,8 @@ pub use vp9::*; use std::rc::Rc; -use anyhow::Result; - use crate::bindings; -use crate::status::Status; +use crate::status::*; use crate::Context; /// Wrapper type representing a buffer created with `vaCreateBuffer`. @@ -31,7 +29,7 @@ pub struct Buffer { impl Buffer { /// Creates a new buffer by wrapping a `vaCreateBuffer` call. This is just a helper for /// [`Context::create_buffer`]. - pub(crate) fn new(context: Rc, mut type_: BufferType) -> Result { + pub(crate) fn new(context: Rc, mut type_: BufferType) -> VAResult { let mut buffer_id = 0; let (ptr, size) = match type_ { @@ -101,7 +99,7 @@ impl Buffer { // Safe because `self` represents a valid `VAContext`. `ptr` and `size` are also ensured to // be correct, as `ptr` is just a cast to `*c_void` from a Rust struct, and `size` is // computed from `std::mem::size_of_val`. - Status(unsafe { + (unsafe { bindings::vaCreateBuffer( context.display().handle(), context.id(), @@ -132,7 +130,7 @@ impl Drop for Buffer { // Safe because `self` represents a valid buffer, created with // vaCreateBuffers. let status = - Status(unsafe { bindings::vaDestroyBuffer(self.context.display().handle(), self.id) }) + (unsafe { bindings::vaDestroyBuffer(self.context.display().handle(), self.id) }) .check(); if status.is_err() { println!("vaDestroyBuffer failed: {}", status.unwrap_err());