video: Use the new `H263State.parse_picture` convenience method

This commit is contained in:
David Wendt 2021-08-21 15:50:01 -04:00 committed by kmeisthax
parent 1f951b6b9f
commit 57fffbe699
3 changed files with 9 additions and 8 deletions

4
Cargo.lock generated
View File

@ -1697,7 +1697,7 @@ dependencies = [
[[package]]
name = "h263-rs"
version = "0.1.0"
source = "git+https://github.com/ruffle-rs/h263-rs?rev=837f075d280680abc8dd3fc3d47656d5a770c48e#837f075d280680abc8dd3fc3d47656d5a770c48e"
source = "git+https://github.com/ruffle-rs/h263-rs?rev=ce3d3c798190be1c78c47099e76d095756a195ac#ce3d3c798190be1c78c47099e76d095756a195ac"
dependencies = [
"bitflags",
"lazy_static",
@ -1708,7 +1708,7 @@ dependencies = [
[[package]]
name = "h263-rs-yuv"
version = "0.1.0"
source = "git+https://github.com/ruffle-rs/h263-rs?rev=837f075d280680abc8dd3fc3d47656d5a770c48e#837f075d280680abc8dd3fc3d47656d5a770c48e"
source = "git+https://github.com/ruffle-rs/h263-rs?rev=ce3d3c798190be1c78c47099e76d095756a195ac#ce3d3c798190be1c78c47099e76d095756a195ac"
[[package]]
name = "hashbrown"

View File

@ -36,8 +36,8 @@ encoding_rs = "0.8.28"
rand = { version = "0.8.4", features = ["std", "small_rng"], default-features = false }
serde = { version = "1.0.127", features = ["derive"], optional = true }
nellymoser-rs = { git = "https://github.com/ruffle-rs/nellymoser" }
h263-rs = { git = "https://github.com/ruffle-rs/h263-rs", rev = "837f075d280680abc8dd3fc3d47656d5a770c48e", optional = true }
h263-rs-yuv = { git = "https://github.com/ruffle-rs/h263-rs", rev = "837f075d280680abc8dd3fc3d47656d5a770c48e", optional = true }
h263-rs = { git = "https://github.com/ruffle-rs/h263-rs", rev = "ce3d3c798190be1c78c47099e76d095756a195ac", optional = true }
h263-rs-yuv = { git = "https://github.com/ruffle-rs/h263-rs", rev = "ce3d3c798190be1c78c47099e76d095756a195ac", optional = true }
regress = "0.4"
flash-lso = { git = "https://github.com/ruffle-rs/rust-flash-lso", rev = "19fecd07b9888c4bdaa66771c468095783b52bed" }
json = "0.12.4"

View File

@ -135,7 +135,7 @@ trait VideoDecoder {
mod h263 {
use crate::backend::video::software::VideoDecoder;
use crate::backend::video::{DecodedFrame, EncodedFrame, Error, FrameDependency};
use h263_rs::parser::{decode_picture, H263Reader};
use h263_rs::parser::H263Reader;
use h263_rs::{DecoderOption, H263State, PictureTypeCode};
use h263_rs_yuv::bt601::yuv420_to_rgba;
@ -154,9 +154,10 @@ mod h263 {
encoded_frame: EncodedFrame<'_>,
) -> Result<FrameDependency, Error> {
let mut reader = H263Reader::from_source(encoded_frame.data());
let picture =
decode_picture(&mut reader, DecoderOption::SORENSON_SPARK_BITSTREAM, None)?
.ok_or("Picture in video stream is not a picture")?;
let picture = self
.0
.parse_picture(&mut reader, None)?
.ok_or("Picture in video stream is not a picture")?;
match picture.picture_type {
PictureTypeCode::IFrame => Ok(FrameDependency::None),