swf

package module
v0.0.0-...-f76892f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 30, 2016 License: MIT Imports: 7 Imported by: 4

README

go-swf

GoDoc Build Status Go Report Card Go Coverage

Package swf contains utilities to read Shockwave Flash Format files

Documentation

See here

Example
parser := swf.NewParser(r)
swfFile, err := parser.Parse()
fmt.Printf("Tags count : %v\n", len(swfFile.Tags))

Documentation

Overview

Package swf contains utilities to read Shockwave Flash Format files It provides a Parser to parse an entire Swf file. It also provides a Reader implementation that can read basic data types defined by the specification (see http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/swf/pdf/swf-file-format-spec.pdf)

Index

Constants

View Source
const (
	CompressionNone = iota
	CompressionZlib
	CompressionLZMA // Currently not implemented
)

These represent possible Swf compression algorithm

View Source
const (
	CodeTagEnd   = 0  // CodeTagEnd is the code representing a Tag of type End
	CodeTagDoABC = 82 // CodeTagDoABC is the code representing a Tag of type DoABC
)

These represent code of handled Swf tags

Variables

View Source
var ErrMalformedHeader = errors.New("malformed header")

ErrMalformedHeader means that the swf file header is malformed. The signature is malformed

View Source
var ErrUnsupportedFile = errors.New("unsupported file")

ErrUnsupportedFile means that the swf file is not supported. The file is compressed with an unsupported algorithm

Functions

This section is empty.

Types

type Header struct {
	Compression uint8
	Version     uint8
	FileLength  uint32
	FrameSize   Rect
	FrameRate   float32
	FrameCount  uint16
}

Header represents a Swf file's header

type Parser

type Parser interface {
	Parse() (Swf, error)
}

Parser is the minimal interface for parsing a Swf file

func NewParser

func NewParser(origin io.ReadSeeker) Parser

NewParser provides a simple way to create a Swf file

type Reader

type Reader interface {
	io.Reader
	io.Seeker
	ReadByte() (byte, error)
	ReadBits(n uint) (uint32, error)
	ReadInt8() (int8, error)
	ReadInt16() (int16, error)
	ReadInt32() (int32, error)
	ReadUInt8() (uint8, error)
	ReadUInt16() (uint16, error)
	ReadUInt32() (uint32, error)
	ReadEUInt32() (uint32, error)
	ReadBitValue(n uint8) (int32, error)
	ReadUBitValue(n uint8) (uint32, error)
	ReadFixed() (float32, error)
	ReadFixed8() (float32, error)
	ReadString() (string, error)
}

Reader is the minimal interface required to read a swf

func NewReader

func NewReader(r io.ReadSeeker) Reader

NewReader provides a simple way to create a Reader from a given io.Reader

type Rect

type Rect struct {
	NBits uint8
	Xmin  int32
	Xmax  int32
	Ymin  int32
	Ymax  int32
}

Rect represents a Rectangle record

type Swf

type Swf struct {
	Header Header
	Tags   []Tag
}

Swf represents a Swf file deserialized

func Parse

func Parse(origin io.ReadSeeker) (Swf, error)

Parse creates a Parser and parses the given input

type Tag

type Tag interface {
	Code() uint16
	Length() uint32
}

Tag represents the generic interface for representing a Swf Tag

type TagDoABC

type TagDoABC struct {
	Flags   uint32
	Name    string
	ABCData []byte
	// contains filtered or unexported fields
}

TagDoABC represents a DoABC Tag

func (*TagDoABC) Code

func (t *TagDoABC) Code() uint16

func (*TagDoABC) Length

func (t *TagDoABC) Length() uint32

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL