Struct re_renderer::video::player::VideoPlayer
source · pub struct VideoPlayer {
data: Arc<VideoData>,
chunk_decoder: VideoChunkDecoder,
video_texture: VideoTexture,
current_gop_idx: usize,
current_sample_idx: usize,
last_error: Option<TimedDecodingError>,
}
Expand description
Decode video to a texture, optimized for extracting successive frames over time.
If you want to sample multiple points in a video simultaneously, use multiple video players.
Fields§
§data: Arc<VideoData>
§chunk_decoder: VideoChunkDecoder
§video_texture: VideoTexture
§current_gop_idx: usize
§current_sample_idx: usize
§last_error: Option<TimedDecodingError>
Last error that was encountered during decoding.
Only fully reset after a successful decode.
Implementations§
source§impl VideoPlayer
impl VideoPlayer
pub fn new( debug_name: &str, render_ctx: &RenderContext, data: Arc<VideoData>, decode_settings: &DecodeSettings ) -> Result<Self, VideoPlayerError>
sourcepub fn frame_at(
&mut self,
render_ctx: &RenderContext,
time_since_video_start_in_seconds: f64,
video_data: &[u8]
) -> Result<VideoFrameTexture, VideoPlayerError>
pub fn frame_at( &mut self, render_ctx: &RenderContext, time_since_video_start_in_seconds: f64, video_data: &[u8] ) -> Result<VideoFrameTexture, VideoPlayerError>
Get the video frame at the given time stamp.
This will seek in the video if needed. If you want to sample multiple points in a video simultaneously, use multiple decoders.
fn enqueue_samples( &mut self, presentation_timestamp: Time, video_data: &[u8] ) -> Result<(), VideoPlayerError>
fn update_video_texture( &mut self, render_ctx: &RenderContext, presentation_timestamp: Time ) -> Result<(), VideoPlayerError>
sourcefn enqueue_gop(
&mut self,
gop_idx: usize,
video_data: &[u8]
) -> Result<(), VideoPlayerError>
fn enqueue_gop( &mut self, gop_idx: usize, video_data: &[u8] ) -> Result<(), VideoPlayerError>
Enqueue all samples in the given GOP.
Does nothing if the index is out of bounds.
sourcefn reset(&mut self) -> Result<(), VideoPlayerError>
fn reset(&mut self) -> Result<(), VideoPlayerError>
Reset the video decoder and discard all frames.
Auto Trait Implementations§
impl Freeze for VideoPlayer
impl !RefUnwindSafe for VideoPlayer
impl Send for VideoPlayer
impl Sync for VideoPlayer
impl Unpin for VideoPlayer
impl !UnwindSafe for VideoPlayer
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more