// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-use anyhow::Result;
-
use crate::bindings;
use crate::picture::Picture;
use crate::picture::PictureSync;
-use crate::status::Status;
+use crate::status::*;
/// Wrapper around `VAImage` that is tied to the lifetime of a given `Picture`.
///
width: u32,
height: u32,
derive: bool,
- ) -> Result<Self> {
+ ) -> VAResult<Self> {
// An all-zero byte-pattern is a valid initial value for `VAImage`.
let mut image: bindings::VAImage = Default::default();
let mut addr = std::ptr::null_mut();
// Safe since `picture.inner.context` represents a valid `VAContext` and `image` has been
// successfully created at this point.
- match Status(unsafe {
+ match (unsafe {
bindings::vaMapBuffer(picture.display().handle(), image.buf, &mut addr)
})
.check()
format: &mut bindings::VAImageFormat,
width: u32,
height: u32,
- ) -> Result<()> {
+ ) -> VAResult<()> {
let dpy = picture.display().handle();
// Safe because `picture.inner.context` represents a valid
// VAContext.
- Status(unsafe { bindings::vaCreateImage(dpy, format, width as i32, height as i32, image) })
+ (unsafe { bindings::vaCreateImage(dpy, format, width as i32, height as i32, image) })
.check()?;
// Safe because `picture.inner.context` represents a valid VAContext,
// `picture.surface` represents a valid VASurface and `image` represents
// a valid `VAImage`.
- if let Err(e) = Status(unsafe {
+ if let Err(e) = (unsafe {
bindings::vaGetImage(
dpy,
picture.surface().id(),
fn derive_image(
picture: &'a Picture<PictureSync>,
image: &mut bindings::VAImage,
- ) -> Result<bool> {
- let status = Status(unsafe {
+ ) -> VAResult<bool> {
+ let status = unsafe {
bindings::vaDeriveImage(picture.display().handle(), picture.surface().id(), image)
- });
+ };
- if status.0 == bindings::constants::VA_STATUS_ERROR_OPERATION_FAILED as i32 {
+ if status == bindings::constants::VA_STATUS_ERROR_OPERATION_FAILED as i32 {
// The implementation can't derive, try the create API instead.
Ok(false)
} else {