]> git.nihav.org Git - nihav-player.git/blobdiff - nihed-cros-libva/src/context.rs
nihed-cros-libva: expose and document some generated data structures
[nihav-player.git] / nihed-cros-libva / src / context.rs
index 45a5c45d4fcfe3002c37c50672fbe29d67cecef7..7d42917a78c50adbb5f1f445a6dc25b1e0396928 100644 (file)
@@ -4,14 +4,11 @@
 
 use std::rc::Rc;
 
-use anyhow::Result;
-use log::error;
-
 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;
 
@@ -31,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
@@ -47,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(),
@@ -78,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_)
     }
 }
@@ -87,9 +84,9 @@ 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() {
-            error!("vaDestroyContext failed: {}", status.unwrap_err());
+            println!("vaDestroyContext failed: {}", status.unwrap_err());
         }
     }
 }