swf

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 24, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

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, unrheadlen int) 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, unrheadlen int) (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

Jump to

Keyboard shortcuts

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