pub struct VideoPlayer<Api: Api = Default, const FREE_ON_DROP: bool = true>(/* private fields */);Implementations§
Source§impl<Api: Api + Copy> VideoPlayer<Api, true>
impl<Api: Api + Copy> VideoPlayer<Api, true>
Convert this video player into the same but that will not be freed on drop. That means that only C-part of the player will not be freed.
Safety is guaranteed by the caller.
Source§impl<Api: Api> VideoPlayer<Api, true>
impl<Api: Api> VideoPlayer<Api, true>
Sourcepub fn load<P: AsRef<Path>>(path: P) -> Result<Self, ApiError>where
Api: Default,
pub fn load<P: AsRef<Path>>(path: P) -> Result<Self, ApiError>where
Api: Default,
Opens the pdv file at path and returns a new video player object for rendering its frames.
Source§impl<Api: Api, const FOD: bool> VideoPlayer<Api, FOD>
impl<Api: Api, const FOD: bool> VideoPlayer<Api, FOD>
Sourcepub fn set_context<'a, 'b: 'a>(
&'a self,
bitmap: &'b impl AnyBitmap,
) -> Result<(), Error>
pub fn set_context<'a, 'b: 'a>( &'a self, bitmap: &'b impl AnyBitmap, ) -> Result<(), Error>
Sets the rendering destination for the video player to the given bitmap.
If the function fails, it returns Error::Video if err-message supplied by C-API,
or Error::Unknown in other cases.
Sourcepub fn get_context(&self) -> Result<BitmapRef<'_>, Error>
pub fn get_context(&self) -> Result<BitmapRef<'_>, Error>
Gets the rendering destination for the video player.
If no rendering context has been set allocates a context bitmap with the same dimensions as the video will be allocated.
Sourcepub fn use_screen_context(&self)
pub fn use_screen_context(&self)
Sourcepub fn render_frame(&self, n: c_int) -> Result<(), Error>
pub fn render_frame(&self, n: c_int) -> Result<(), Error>
Renders frame number n into the current context.
In case of error, it returns Error::Video if err-message supplied by C-API,
or Error::Unknown in other cases.
Sourcepub fn info(&self) -> VideoPlayerOutInfo
pub fn info(&self) -> VideoPlayerOutInfo
Retrieves information about the video.
Sourcepub fn info_to(&self, info: &mut VideoPlayerOutInfo)
pub fn info_to(&self, info: &mut VideoPlayerOutInfo)
Retrieves information about the video, by passing values into given info.
Sourcepub fn info_raw(
&self,
width: Option<&mut c_int>,
height: Option<&mut c_int>,
frame_rate: Option<&mut c_float>,
frame_count: Option<&mut c_int>,
current_frame: Option<&mut c_int>,
)
pub fn info_raw( &self, width: Option<&mut c_int>, height: Option<&mut c_int>, frame_rate: Option<&mut c_float>, frame_count: Option<&mut c_int>, current_frame: Option<&mut c_int>, )
Retrieves information about the video, by passing optional mutable references.
Example:
let mut frame_count = Some(0);
let mut current_frame = Some(0);
player.info_raw(None, None, None,
frame_count.as_mut(),
current_frame.as_mut()
);
println!( "{}/{}", current_frame.unwrap(), frame_count.unwrap());Sourcepub fn get_error(&self) -> Option<Error>
pub fn get_error(&self) -> Option<Error>
Returns Error with text describing the most recent error.
Inner text is borrowed by C, so it should be used immediately or converted to something owned.
See also VideoPlayer::get_error_cstr.
Sourcepub fn get_error_cstr(&self) -> Option<&CStr>
pub fn get_error_cstr(&self) -> Option<&CStr>
Returns [CStr] describing the most recent error.
String-slice is borrowed by C, so it should be used immediately or converted to something owned.
Trait Implementations§
Source§impl<Api: Debug + Api, const FREE_ON_DROP: bool> Debug for VideoPlayer<Api, FREE_ON_DROP>
impl<Api: Debug + Api, const FREE_ON_DROP: bool> Debug for VideoPlayer<Api, FREE_ON_DROP>
Auto Trait Implementations§
impl<Api, const FREE_ON_DROP: bool> Freeze for VideoPlayer<Api, FREE_ON_DROP>where
Api: Freeze,
impl<Api, const FREE_ON_DROP: bool> RefUnwindSafe for VideoPlayer<Api, FREE_ON_DROP>where
Api: RefUnwindSafe,
impl<Api = Default, const FREE_ON_DROP: bool = true> !Send for VideoPlayer<Api, FREE_ON_DROP>
impl<Api = Default, const FREE_ON_DROP: bool = true> !Sync for VideoPlayer<Api, FREE_ON_DROP>
impl<Api, const FREE_ON_DROP: bool> Unpin for VideoPlayer<Api, FREE_ON_DROP>where
Api: Unpin,
impl<Api, const FREE_ON_DROP: bool> UnwindSafe for VideoPlayer<Api, FREE_ON_DROP>where
Api: UnwindSafe,
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T, U> Into<U> for Twhere
U: From<T>,
impl<T, U> Into<U> for Twhere
U: From<T>,
§impl<T, U> TryFrom<U> for Twhere
U: Into<T>,
impl<T, U> TryFrom<U> for Twhere
U: Into<T>,
Layout§
Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.