pub use bindings::VAProfile;
pub use bindings::VASurfaceAttribType;
pub use bindings::VASurfaceID;
-pub use bindings::VASurfaceStatus;
pub use buffer::*;
pub use config::*;
pub use context::*;
///
/// This call can be used to implement a non-blocking path, wherein a decoder queries the status
/// of the surface after each decode operation instead of blocking on it.
- pub fn query_status(&self) -> VAResult<bindings::VASurfaceStatus::Type> {
+ pub fn query_status(&self) -> VAResult<VASurfaceStatus> {
self.inner.surface.borrow_mut().query_status()
}
}
}
}
}
+
+/// Surface status.
+#[repr(u32)]
+#[derive(Clone, Copy, Debug, PartialEq)]
+pub enum VASurfaceStatus {
+ /// Rendering in progress.
+ Rendering = 1,
+ /// Displaying in progress (not safe to render into it).
+ ///
+ /// This status is useful if surface is used as the source of an overlay.
+ Displaying = 2,
+ /// Not being rendered or displayed.
+ Ready = 3,
+ /// Indicate a skipped frame during encode.
+ Skipped = 8,
+}
+
+impl std::fmt::Display for VASurfaceStatus {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ write!(f, "{:?}", self)
+ }
+}
}
/// Wrapper over `vaQuerySurfaceStatus` to find out any pending ops on the render target.
- pub fn query_status(&self) -> VAResult<bindings::VASurfaceStatus::Type> {
+ pub fn query_status(&self) -> VAResult<VASurfaceStatus> {
let mut status: bindings::VASurfaceStatus::Type = 0;
// Safe because `self` represents a valid VASurface.
(unsafe {
bindings::vaQuerySurfaceStatus(self.display.handle(), self.id, &mut status)
})
.check()?;
- Ok(status)
+ match status {
+ bindings::VASurfaceStatus::VASurfaceRendering => Ok(VASurfaceStatus::Rendering),
+ bindings::VASurfaceStatus::VASurfaceDisplaying => Ok(VASurfaceStatus::Displaying),
+ bindings::VASurfaceStatus::VASurfaceReady => Ok(VASurfaceStatus::Ready),
+ bindings::VASurfaceStatus::VASurfaceSkipped => Ok(VASurfaceStatus::Skipped),
+ _ => Err(VAError::Unknown),
+ }
}
/// Returns the ID of this surface.