core: Add SwfMovie::uncompressed_len
This commit is contained in:
parent
077c7f045e
commit
172ad82aa5
|
@ -769,7 +769,7 @@ fn get_bytes_loaded<'gc>(
|
|||
let bytes_loaded = if movie_clip.is_root() {
|
||||
movie_clip
|
||||
.movie()
|
||||
.map(|mv| mv.header().uncompressed_len())
|
||||
.map(|mv| mv.uncompressed_len())
|
||||
.unwrap_or_default()
|
||||
} else {
|
||||
movie_clip.tag_stream_len() as u32
|
||||
|
@ -787,7 +787,7 @@ fn get_bytes_total<'gc>(
|
|||
let bytes_total = if movie_clip.is_root() {
|
||||
movie_clip
|
||||
.movie()
|
||||
.map(|mv| mv.header().uncompressed_len())
|
||||
.map(|mv| mv.uncompressed_len())
|
||||
.unwrap_or_default()
|
||||
} else {
|
||||
movie_clip.tag_stream_len() as u32
|
||||
|
|
|
@ -114,7 +114,7 @@ pub fn get_progress<'gc>(
|
|||
"bytesLoaded",
|
||||
movieclip
|
||||
.movie()
|
||||
.map(|mv| (mv.header().uncompressed_len()).into())
|
||||
.map(|mv| (mv.uncompressed_len()).into())
|
||||
.unwrap_or(Value::Undefined),
|
||||
Attribute::empty(),
|
||||
);
|
||||
|
@ -123,7 +123,7 @@ pub fn get_progress<'gc>(
|
|||
"bytesTotal",
|
||||
movieclip
|
||||
.movie()
|
||||
.map(|mv| (mv.header().uncompressed_len()).into())
|
||||
.map(|mv| (mv.uncompressed_len()).into())
|
||||
.unwrap_or(Value::Undefined),
|
||||
Attribute::empty(),
|
||||
);
|
||||
|
|
|
@ -107,11 +107,9 @@ pub fn bytes_total<'gc>(
|
|||
if let Some(this) = this {
|
||||
if let Some(loader_stream) = this.as_loader_stream() {
|
||||
match &*loader_stream {
|
||||
LoaderStream::Stage => {
|
||||
return Ok(activation.context.swf.compressed_length().into())
|
||||
}
|
||||
LoaderStream::Stage => return Ok(activation.context.swf.compressed_len().into()),
|
||||
LoaderStream::Swf(movie, _) => {
|
||||
return Ok(movie.compressed_length().into());
|
||||
return Ok(movie.compressed_len().into());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ pub struct SwfMovie {
|
|||
encoding: &'static swf::Encoding,
|
||||
|
||||
/// The compressed length of the entire datastream
|
||||
compressed_length: usize,
|
||||
compressed_len: usize,
|
||||
}
|
||||
|
||||
impl SwfMovie {
|
||||
|
@ -47,7 +47,7 @@ impl SwfMovie {
|
|||
loader_url: None,
|
||||
parameters: Vec::new(),
|
||||
encoding: swf::UTF_8,
|
||||
compressed_length: 0,
|
||||
compressed_len: 0,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ impl SwfMovie {
|
|||
loader_url: source.loader_url.clone(),
|
||||
parameters: source.parameters.clone(),
|
||||
encoding: source.encoding,
|
||||
compressed_length: source.compressed_length,
|
||||
compressed_len: source.compressed_len,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ impl SwfMovie {
|
|||
url: Option<String>,
|
||||
loader_url: Option<String>,
|
||||
) -> Result<Self, Error> {
|
||||
let compressed_length = swf_data.len();
|
||||
let compressed_len = swf_data.len();
|
||||
let swf_buf = swf::read::decompress_swf(swf_data)?;
|
||||
let encoding = swf::SwfStr::encoding_for_version(swf_buf.header.version());
|
||||
Ok(Self {
|
||||
|
@ -96,7 +96,7 @@ impl SwfMovie {
|
|||
loader_url,
|
||||
parameters: Vec::new(),
|
||||
encoding,
|
||||
compressed_length,
|
||||
compressed_len,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -149,8 +149,12 @@ impl SwfMovie {
|
|||
self.parameters.extend(params);
|
||||
}
|
||||
|
||||
pub fn compressed_length(&self) -> usize {
|
||||
self.compressed_length
|
||||
pub fn compressed_len(&self) -> usize {
|
||||
self.compressed_len
|
||||
}
|
||||
|
||||
pub fn uncompressed_len(&self) -> u32 {
|
||||
self.header.uncompressed_len()
|
||||
}
|
||||
|
||||
pub fn avm_type(&self) -> AvmType {
|
||||
|
|
Loading…
Reference in New Issue