core: Rename the video dependency enums to better describe their meaning.
This commit is contained in:
parent
4d0b73feeb
commit
5fcdb79528
|
@ -33,15 +33,28 @@ impl<'a> EncodedFrame<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// What dependencies a given video frame has on any previous frames.
|
/// What dependencies a given video frame has on any previous frames.
|
||||||
|
#[derive(Copy, Clone, Debug)]
|
||||||
pub enum FrameDependency {
|
pub enum FrameDependency {
|
||||||
/// This frame has no reference frames and can be seeked to at any time.
|
/// This frame has no reference frames and can be seeked to at any time.
|
||||||
Keyframe,
|
None,
|
||||||
|
|
||||||
/// This frame has one reference frame which must be completely decoded
|
/// This frame has some number of reference frames that prohibit any
|
||||||
/// before this frame can be decoded.
|
/// out-of-order decoding.
|
||||||
///
|
///
|
||||||
/// The reference frame is the previous frame in the video stream.
|
/// The only legal way to decode a `Past` frame is to decode every prior
|
||||||
LastFrame,
|
/// frame from the last `None` frame. In the event that there is no prior
|
||||||
|
/// `None` frame, then video decoding should start from the beginning.
|
||||||
|
Past,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FrameDependency {
|
||||||
|
/// Determine if this given frame is a keyframe.
|
||||||
|
///
|
||||||
|
/// A keyframe is a frame that can be independently seeked to without
|
||||||
|
/// decoding any prior or future frames.
|
||||||
|
pub fn is_keyframe(self) -> bool {
|
||||||
|
matches!(self, FrameDependency::None)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A backend that provides access to some number of video decoders.
|
/// A backend that provides access to some number of video decoders.
|
||||||
|
@ -112,7 +125,7 @@ pub struct NullVideoBackend {
|
||||||
/// Specifically:
|
/// Specifically:
|
||||||
///
|
///
|
||||||
/// * Registering a video stream succeeds but does nothing
|
/// * Registering a video stream succeeds but does nothing
|
||||||
/// * All video frames are silently marked as keyframes
|
/// * All video frames are silently marked as keyframes (`None` dependency)
|
||||||
/// * Video stream decoding fails with an error that video decoding is
|
/// * Video stream decoding fails with an error that video decoding is
|
||||||
/// unimplemented
|
/// unimplemented
|
||||||
impl NullVideoBackend {
|
impl NullVideoBackend {
|
||||||
|
@ -145,7 +158,7 @@ impl VideoBackend for NullVideoBackend {
|
||||||
_stream: VideoStreamHandle,
|
_stream: VideoStreamHandle,
|
||||||
_encoded_frame: EncodedFrame<'_>,
|
_encoded_frame: EncodedFrame<'_>,
|
||||||
) -> Result<FrameDependency, Error> {
|
) -> Result<FrameDependency, Error> {
|
||||||
Ok(FrameDependency::Keyframe)
|
Ok(FrameDependency::None)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn decode_video_stream_frame(
|
fn decode_video_stream_frame(
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
use crate::avm1::{Object as Avm1Object, StageObject as Avm1StageObject};
|
use crate::avm1::{Object as Avm1Object, StageObject as Avm1StageObject};
|
||||||
use crate::avm2::{Object as Avm2Object, StageObject as Avm2StageObject};
|
use crate::avm2::{Object as Avm2Object, StageObject as Avm2StageObject};
|
||||||
use crate::backend::render::BitmapHandle;
|
use crate::backend::render::BitmapHandle;
|
||||||
use crate::backend::video::{EncodedFrame, FrameDependency, VideoStreamHandle};
|
use crate::backend::video::{EncodedFrame, VideoStreamHandle};
|
||||||
use crate::bounding_box::BoundingBox;
|
use crate::bounding_box::BoundingBox;
|
||||||
use crate::collect::CollectWrapper;
|
use crate::collect::CollectWrapper;
|
||||||
use crate::context::{RenderContext, UpdateContext};
|
use crate::context::{RenderContext, UpdateContext};
|
||||||
|
@ -267,7 +267,7 @@ impl<'gc> TDisplayObject<'gc> for Video<'gc> {
|
||||||
);
|
);
|
||||||
|
|
||||||
match dep {
|
match dep {
|
||||||
Ok(FrameDependency::Keyframe) => {
|
Ok(d) if d.is_keyframe() => {
|
||||||
keyframes.insert(*frame_id);
|
keyframes.insert(*frame_id);
|
||||||
}
|
}
|
||||||
Ok(_) => {}
|
Ok(_) => {}
|
||||||
|
|
Loading…
Reference in New Issue