X-Git-Url: https://git.nihav.org/?a=blobdiff_plain;f=nihed-cros-libva%2Fsrc%2Fcontext.rs;h=7d42917a78c50adbb5f1f445a6dc25b1e0396928;hb=69e6ce021284f1ebaf148b38b236068d08249e0f;hp=cc3136aa97c4ed2940439bb5ffd49adf9fce56f6;hpb=51b33b65943d47a3826be9763728815ba2b9e7d5;p=nihav-player.git diff --git a/nihed-cros-libva/src/context.rs b/nihed-cros-libva/src/context.rs index cc3136a..7d42917 100644 --- a/nihed-cros-libva/src/context.rs +++ b/nihed-cros-libva/src/context.rs @@ -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>, progressive: bool, - ) -> Result> { + ) -> VAResult> { 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, type_: BufferType) -> Result { + pub fn create_buffer(self: &Rc, type_: BufferType) -> VAResult { 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()); }