NAME
SWF::Header - extract header information from SWF files.
SYNOPSIS
use SWF::Header;
my $header_data = SWF::Header->read_file('/path/to/file.swf');
or
my $header_data = SWF::Header->read_data($binary_data);
or
my $h = SWF::Header->new();
my %headers = map { $_ => $h->read_file($_) } @files;
DESCRIPTION
SWF::Header pulls the descriptive information out of the header of a shockwave (.swf) file. It returns a hashref of height, width, duration, framerate, shockwave version and file size.
METHODS
- new()
-
Creates a reader object. You don't normally need to call the constructor directly unless you want to read several files. Either read_file or read_data will construct an object to do the work if called as a class method.
- stream( $stream )
-
A set or get method that can be used to provide an SWF::BinStream::Read object you want to work with. If none is supplied or exists already, calls new_stream to create a new one.
- new_stream()
-
Resets the reader's stream to a new SWF::BinStream::Read object, ready to start from scratch. Both read_file and read_data call this method before handing over to parse_header.
- read_file( $file )
-
Opens and reads the first few bytes of the file supplied (as either a filehandle or a path), uses them to start a new stream then calls parse_header.
- read_data( $string )
-
Just for consistency. All this does is start a new stream with the data supplied and call parse_header.
- parse_header( $string )
-
Checks that this is a properly-formatted SWF file, then pulls the relevant bytes out of the header block of the file and returns a hashref containing the stage dimensions, coordinates, duration, frame rate, version and file size. In detail:
{ signature => 'FWS' or 'CWS', version => Shockwave language version, filelen => Length of entire file in bytes, xmin => Stage left edge, in twips, xmax => Stage right edge, in twips from left, ymin => Stage top edge, ymax => Stage bottom edge, in twips from top, rate => Frame rate in fps, count => total number of frames in movie, width => calculated width of stage (in pixels), height => calculated height of stage (in pixels), duration => calculated duration of movie (in seconds), background => calculated background color of movie (in html format), }
COPYRIGHT
Copyright 2004 William Ross (wross@cpan.org)
But obviously based entirely on previous work by Yasuhiro Sasama.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
SWF::File, SWF::Parser, SWF::BinStream, SWF::Element
The SWF file format specification from Macromedia can be found at http://www.openswf.org/spec/SWFfileformat.html
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 170:
You forgot a '=back' before '=head1'