flv

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

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

Go to latest
Published: Sep 24, 2015 License: MIT Imports: 5 Imported by: 4

README

Documentation

Index

Constants

View Source
const (
	AUDIO_TAG       = byte(0x08)
	VIDEO_TAG       = byte(0x09)
	SCRIPT_DATA_TAG = byte(0x12)
	DURATION_OFFSET = 53
	HEADER_LEN      = 13
)

Variables

View Source
var (
	HEADER_BYTES = []byte{
		'F', 'L', 'V',
		0x01,
		0x05,
		0x00, 0x00, 0x00, 0x09,
		0x00, 0x00, 0x00, 0x00,
		0x12, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x02, 0x00, 0x0a, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61,
		0x08, 0x00, 0x00, 0x00, 0x01,
		0x00, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6F, 0x6E,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x09,
		0x00, 0x00, 0x00, 0x33}
)

Functions

func AudioMetaData

func AudioMetaData(data []byte) (format int, sampleRate int, size int, stereo bool)

extracts meta data for an audio tag

Format: 0 = Linear PCM, platform endian 1 = ADPCM 2 = MP3 3 = Linear PCM, little endian 4 = Nellymoser 16 kHz mono 5 = Nellymoser 8 kHz mono 6 = Nellymoser 7 = G.711 A-law logarithmic PCM 8 = G.711 mu-law logarithmic PCM 9 = reserved 10 = AAC 11 = Speex 14 = MP3 8 kHz 15 = Device-specific sound

Rate: 0 = 5.5 kHz 1 = 11 kHz 2 = 22 kHz 3 = 44 kHz

Sample size: 0 = 8-bit samples 1 = 16-bit samples

func VideoMetaData

func VideoMetaData(data []byte) (frameType int, codec int)

extracts meta data for an video tag

Frame type: 1 = key frame (for AVC, a seekable frame) 2 = inter frame (for AVC, a non-seekable frame) 3 = disposable inter frame (H.263 only) 4 = generated key frame (reserved for server use only) 5 = video info/command frame

Codec: 2 = Sorenson H.263 3 = Screen video 4 = On2 VP6 5 = On2 VP6 with alpha channel 6 = Screen video version 2 7 = AVC

Types

type File

type File struct {
	// contains filtered or unexported fields
}

func CreateFile

func CreateFile(name string) (flvFile *File, err error)

func OpenFile

func OpenFile(name string) (flvFile *File, err error)

func (*File) Close

func (flvFile *File) Close()

func (*File) FilePath

func (flvFile *File) FilePath() string

func (*File) IsFinished

func (flvFile *File) IsFinished() bool

func (*File) LoopBack

func (flvFile *File) LoopBack()

func (*File) ReadTag

func (flvFile *File) ReadTag() (header *TagHeader, data []byte, err error)

func (*File) SetDuration

func (flvFile *File) SetDuration(duration float64)

func (*File) Size

func (flvFile *File) Size() (size int64)

func (*File) Sync

func (flvFile *File) Sync() (err error)

func (*File) WriteAudioTag

func (flvFile *File) WriteAudioTag(data []byte, timestamp uint32) (err error)

Data with audio header

func (*File) WriteTag

func (flvFile *File) WriteTag(data []byte, tagType byte, timestamp uint32) (err error)

Write tag

func (*File) WriteVideoTag

func (flvFile *File) WriteVideoTag(data []byte, timestamp uint32) (err error)

Data with video header

type TagHeader

type TagHeader struct {
	TagType   byte
	Encrypted bool
	DataSize  uint32
	Timestamp uint32
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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