Function parse_swf

Source
pub fn parse_swf(swf_buf: &SwfBuf) -> Result<Swf<'_>>
Expand description

Parse a decompressed SWF.

ยงExample

let data = std::fs::read("tests/swfs/DefineSprite.swf").unwrap();
let stream = swf::decompress_swf(&data[..]).unwrap();
let swf = swf::parse_swf(&stream).unwrap();
println!("Number of frames: {}", swf.header.num_frames());
Examples found in repository?
examples/reading.rs (line 8)
4fn main() {
5    let file = File::open("tests/swfs/SimpleRedBackground.swf").unwrap();
6    let reader = BufReader::new(file);
7    let swf_buf = swf::decompress_swf(reader).unwrap();
8    let swf = swf::parse_swf(&swf_buf).unwrap();
9    println!("The SWF has {} frame(s).", swf.header.num_frames());
10    println!("The SWF has {} tag(s).", swf.tags.len());
11}