pub struct SwfHeaders { /* private fields */ }
Expand description
The primary struct, managing all the parsing and storage of SWF header information.
Implementations§
Source§impl SwfHeaders
impl SwfHeaders
Sourcepub fn open<T: AsRef<Path>>(path: T) -> Result<(Self, DecodedSwf), Error>
pub fn open<T: AsRef<Path>>(path: T) -> Result<(Self, DecodedSwf), Error>
Wraps over read_from(), taking a path and opening it for you.
§Examples
use swf_headers::SwfHeaders;
if let Ok((headers, decoded)) = SwfHeaders::open("example.swf") {
// ...
}
Sourcepub fn read_from(file: File) -> Result<(Self, DecodedSwf), Error>
pub fn read_from(file: File) -> Result<(Self, DecodedSwf), Error>
Takes a SWF file and parses its headers, returning the header struct along with a readable DecodedSwf if you wish to continue parsing the file.
The vast bulk of SWF parsing happens in here. The code is documented, so you can read through the source if you want to understand how it all works.
§Examples
use std::fs::File;
use swf_headers::SwfHeaders;
if let Ok(file) = File::open("example.swf") {
let (headers, decoded) = SwfHeaders::read_from(file).unwrap();
// ...
}
Sourcepub fn signature(&self) -> Signature
pub fn signature(&self) -> Signature
Returns the signature as an enum representing all valid values.
Sourcepub fn file_length(&self) -> u32
pub fn file_length(&self) -> u32
Returns the uncompressed total file length in bytes.
Sourcepub fn dimensions_twips(&self) -> (u32, u32)
pub fn dimensions_twips(&self) -> (u32, u32)
Returns the dimensions in twips (the measurement unit flash uses, 1/20th of a pixel).
Sourcepub fn dimensions(&self) -> (u32, u32)
pub fn dimensions(&self) -> (u32, u32)
Returns the dimensions in pixels (converted from twips, sometimes losing accuracy).
Sourcepub fn frame_rate(&self) -> u16
pub fn frame_rate(&self) -> u16
Returns the frame rate (note: does not yet handle fractional framerates).
Sourcepub fn frame_count(&self) -> u16
pub fn frame_count(&self) -> u16
Returns the frame count.
Trait Implementations§
Source§impl Clone for SwfHeaders
impl Clone for SwfHeaders
Source§fn clone(&self) -> SwfHeaders
fn clone(&self) -> SwfHeaders
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more