SWF::Parser - Parse SWF file.
use SWF::Parser; $parser = SWF::Parser->new( 'header-callback' => \&header, 'tag-callback' => \&tag); # parse binary data $parser->parse( $data ); # or parse SWF file $parser->parse_file( 'flash.swf' );
SWF::Parser module provides a parser for SWF (Macromedia Flash(R)) file. It splits SWF into a header and tags and calls user subroutines.
Creates a parser. The parser calls user subroutines when find SWF header and tags. You can set SWF::BinStream::Read object as the read stream. If not, internal stream is used. If you want to parse a tag block without SWF header, set header => 'no'.
You should define a header-callback subroutine in your script. It is called with the following arguments:
$self: Parser object itself. $signature: 'FWS' for normal SWF and 'CWS' for compressed SWF. $version: SWF version No. $length: File length. $xmin, $ymin, $xmax, $ymax: Boundary rectangle size of frames, ($xmin,$ymin)-($xmax, $ymax), in TWIPS(1/20 pixels). $framerate: The number of frames per seconds. $framecount: Total number of frames in the SWF.
You should define a tag-callback subroutine in your script. It is called with the following arguments:
$self: Parser object itself. $tagno: The ID number of the tag. $length: Length of tag. $datastream: The SWF::BinStream::Read object that can be read the rest of tag data.
parses the data block as a SWF. Can be called multiple times.
parses a SWF file. The argument can be a filename or an already opened file handle.
parses a SWF header and calls &headersub. You don't need to call this method specifically because this method is usually called from parse method.
parses SWF tags and calls &tagsub. You don't need to call this method specifically because this method is usually called from parse method.
tells the parser to abort parsing.
Copyright 2000 Yasuhiro Sasama (ySas), <firstname.lastname@example.org>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SWF file format specification from Macromedia.