A library for reading the headers of a swf file, and optionally for helping you read the rest of it, too.
```rust extern crate swf_headers;
use std::io::Read; // Needed for calling readtoend()
use swfheaders::SwfHeaders; use swfheaders::Error as SwfError; use swf_headers::DecodedSwf;
let (headers, mut decodedswf) = SwfHeaders::open("example.swf").unwraporelse(|err| { match err { SwfError::IoError() => panic!("Oh no! An IO error!"), SwfError::NotSwf => panic!("Oh no! It wasn't actually a swf file!") } });
println!("The compression method is {:?}", headers.signature()); println!("The swf version is {}", headers.version()); println!("The file length in bytes is {}", headers.filelength()); println!("The dimensions in pixels are {:?}", headers.dimensions()); println!("The frame rate is {}", headers.framerate()); println!("And finally, the frame count is {}!", headers.frame_count());
let mut therestoftheswf: Vec
Testing is a pain when you have to test on proprietary blobs. See tests/README.md for more information.
A: Why not? I had some experience with it, and I noticed there were no swf parsing tools on crates.io, so I identified my niche and ran with it.
A: Sadly, yes. The swf spec is awful, so swf files usually end up with half the header compressed with either zlib or LZMA.
A: Here. You'll probably want to read that through if you're planning on parsing the rest of the swf, but for understanding this library you just need the first chapter and page 27.
A: Sure! Test coverage is proving to be the hardest part of this whole ordeal, so I could always welcome small swf files to test with.
A: Also sure! Pull Requests are welcome.