nihed-cros-libva: use simple error enum instead of anyhow crate
[nihav-player.git] / nihed-cros-libva / src / context.rs
index cc3136aa97c4ed2940439bb5ffd49adf9fce56f6..7d42917a78c50adbb5f1f445a6dc25b1e0396928 100644 (file)
@@ -4,13 +4,11 @@
 
 use std::rc::Rc;
 
-use anyhow::Result;
-
 use crate::bindings;
 use crate::buffer::Buffer;
 use crate::buffer::BufferType;
 use crate::display::Display;
-use crate::status::Status;
+use crate::status::*;
 use crate::Config;
 use crate::Surface;
 
@@ -30,7 +28,7 @@ impl Context {
         coded_height: i32,
         surfaces: Option<&Vec<Surface>>,
         progressive: bool,
-    ) -> Result<Rc<Self>> {
+    ) -> VAResult<Rc<Self>> {
         let mut context_id = 0;
         let flags = if progressive {
             bindings::constants::VA_PROGRESSIVE as i32
@@ -46,7 +44,7 @@ impl Context {
         // Safe because `self` represents a valid VADisplay and render_targets
         // and ntargets are properly initialized. Note that render_targets==NULL
         // is valid so long as ntargets==0.
-        Status(unsafe {
+        (unsafe {
             bindings::vaCreateContext(
                 display.handle(),
                 config.id(),
@@ -77,7 +75,7 @@ impl Context {
     }
 
     /// Create a new buffer of type `type_`.
-    pub fn create_buffer(self: &Rc<Self>, type_: BufferType) -> Result<Buffer> {
+    pub fn create_buffer(self: &Rc<Self>, type_: BufferType) -> VAResult<Buffer> {
         Buffer::new(Rc::clone(self), type_)
     }
 }
@@ -86,7 +84,7 @@ impl Drop for Context {
     fn drop(&mut self) {
         // Safe because `self` represents a valid VAContext.
         let status =
-            Status(unsafe { bindings::vaDestroyContext(self.display.handle(), self.id) }).check();
+            (unsafe { bindings::vaDestroyContext(self.display.handle(), self.id) }).check();
         if status.is_err() {
             println!("vaDestroyContext failed: {}", status.unwrap_err());
         }