X-Git-Url: https://git.nihav.org/?a=blobdiff_plain;f=nihed-cros-libva%2Fsrc%2Fbuffer.rs;h=3d1cceb2e5e40438c2e6e01f1dd583a5804ec96c;hb=49bf1d79384ecf1b28822101233719fb1c1b29b1;hp=41d59340b4ca95774ef4e6df747fadd32509bb51;hpb=683627242f69bed0b818d976d4b03d651e529697;p=nihav-player.git diff --git a/nihed-cros-libva/src/buffer.rs b/nihed-cros-libva/src/buffer.rs index 41d5934..3d1cceb 100644 --- a/nihed-cros-libva/src/buffer.rs +++ b/nihed-cros-libva/src/buffer.rs @@ -16,11 +16,8 @@ pub use vp9::*; use std::rc::Rc; -use anyhow::Result; -use log::error; - use crate::bindings; -use crate::status::Status; +use crate::status::*; use crate::Context; /// Wrapper type representing a buffer created with `vaCreateBuffer`. @@ -32,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_ { @@ -102,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(), @@ -133,10 +130,10 @@ 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() { - error!("vaDestroyBuffer failed: {}", status.unwrap_err()); + println!("vaDestroyBuffer failed: {}", status.unwrap_err()); } } }