nihed-cros-libva: use simple error enum instead of anyhow crate
[nihav-player.git] / nihed-cros-libva / src / buffer.rs
index 62f8f510cfd388435de994f46322554d807f71c5..3d1cceb2e5e40438c2e6e01f1dd583a5804ec96c 100644 (file)
@@ -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<Context>, mut type_: BufferType) -> Result<Self> {
+    pub(crate) fn new(context: Rc<Context>, mut type_: BufferType) -> VAResult<Self> {
         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());