flvio

package
v1.0.2-0...-fa1a6e9 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TAG_AUDIO      = 8
	TAG_VIDEO      = 9
	TAG_SCRIPTDATA = 18
)
View Source
const (
	SOUND_MP3                   = 2
	SOUND_NELLYMOSER_16KHZ_MONO = 4
	SOUND_NELLYMOSER_8KHZ_MONO  = 5
	SOUND_NELLYMOSER            = 6
	SOUND_ALAW                  = 7
	SOUND_MULAW                 = 8
	SOUND_AAC                   = 10
	SOUND_SPEEX                 = 11

	SOUND_5_5Khz = 0
	SOUND_11Khz  = 1
	SOUND_22Khz  = 2
	SOUND_44Khz  = 3

	SOUND_8BIT  = 0
	SOUND_16BIT = 1

	SOUND_MONO   = 0
	SOUND_STEREO = 1

	AAC_SEQHDR = 0
	AAC_RAW    = 1
)
View Source
const (
	AVC_SEQHDR = 0
	AVC_NALU   = 1
	AVC_EOS    = 2

	FRAME_KEY   = 1
	FRAME_INTER = 2

	VIDEO_H264 = 7
	VIDEO_H265 = 12
)
View Source
const (
	NGX_RTMP_VIDEO_JPEG          = 1
	NGX_RTMP_VIDEO_SORENSON_H263 = 2
	NGX_RTMP_VIDEO_SCREEN        = 3
	NGX_RTMP_VIDEO_ON2_VP6       = 4
	NGX_RTMP_VIDEO_ON2_VP6_ALPHA = 5
	NGX_RTMP_VIDEO_SCREEN2       = 6
	NGX_RTMP_VIDEO_H264          = 7
	NGX_RTMP_VIDEO_H265          = 12
)

Video codecs

View Source
const (
	// TypeFlagsReserved UB[5]
	// TypeFlagsAudio    UB[1] Audio tags are present
	// TypeFlagsReserved UB[1] Must be 0
	// TypeFlagsVideo    UB[1] Video tags are present
	FILE_HAS_AUDIO = 0x4
	FILE_HAS_VIDEO = 0x1
)
View Source
const FileHeaderLength = 9
View Source
const MaxTagSubHeaderLength = 16
View Source
const TagHeaderLength = 11
View Source
const TagTrailerLength = 4

Variables

This section is empty.

Functions

func FillAMF0Val

func FillAMF0Val(b []byte, n *int, _val interface{})

func FillAMF0ValMalloc

func FillAMF0ValMalloc(v interface{}) (b []byte)

func FillAMF0Vals

func FillAMF0Vals(b []byte, vals []interface{}) (n int)

func FillAMF0ValsMalloc

func FillAMF0ValsMalloc(vals []interface{}) (b []byte)

func FillFileHeader

func FillFileHeader(b []byte, flags uint8) (n int)

func FillTagHeader

func FillTagHeader(b []byte, tagtype uint8, datalen int, ts int32) (n int)

func FillTagTrailer

func FillTagTrailer(b []byte, datalen int) (n int)

func ParseAMF0Val

func ParseAMF0Val(b []byte, n *int) (val interface{}, err error)

func ParseAMF3Val

func ParseAMF3Val(b []byte, n *int) (val interface{}, err error)

func ParseAMFVals

func ParseAMFVals(b []byte, isamf3 bool) (arr []interface{}, err error)

func ParseFileHeader

func ParseFileHeader(b []byte) (flags uint8, skip int, err error)

func TimeToTs

func TimeToTs(tm time.Duration) int32

func TsToTime

func TsToTime(ts int32) time.Duration

func WriteTag

func WriteTag(w io.Writer, tag *Tag, ts int32, b []byte) (err error)

Types

type AMFArray

type AMFArray []interface{}

type AMFECMAArray

type AMFECMAArray AMFMap

type AMFKv

type AMFKv struct {
	K string
	V interface{}
}

type AMFMap

type AMFMap []AMFKv

func (AMFMap) Del

func (a AMFMap) Del(dk string) AMFMap

func (AMFMap) Get

func (a AMFMap) Get(k string) *AMFKv

func (AMFMap) GetBool

func (a AMFMap) GetBool(k string) (bool, bool)

func (AMFMap) GetFloat64

func (a AMFMap) GetFloat64(k string) (float64, bool)

func (AMFMap) GetString

func (a AMFMap) GetString(k string) (string, bool)

func (AMFMap) GetV

func (a AMFMap) GetV(k string) (interface{}, bool)

func (AMFMap) MarshalJSON

func (a AMFMap) MarshalJSON() ([]byte, error)

func (AMFMap) Set

func (a AMFMap) Set(k string, v interface{}) AMFMap

type AMFParseError

type AMFParseError struct {
	Offset  int
	Message string
	Next    *AMFParseError
	Bytes   []byte
}

func (*AMFParseError) Error

func (e *AMFParseError) Error() string

type Tag

type Tag struct {
	Type uint8

	/*
		SoundFormat: UB[4]
		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
		Formats 7, 8, 14, and 15 are reserved for internal use
		AAC is supported in Flash Player 9,0,115,0 and higher.
		Speex is supported in Flash Player 10 and higher.
	*/
	SoundFormat uint8

	/*
		SoundRate: UB[2]
		Sampling rate
		0 = 5.5-kHz For AAC: always 3
		1 = 11-kHz
		2 = 22-kHz
		3 = 44-kHz
	*/
	SoundRate uint8

	/*
		SoundSize: UB[1]
		0 = snd8Bit
		1 = snd16Bit
		Size of each sample.
		This parameter only pertains to uncompressed formats.
		Compressed formats always decode to 16 bits internally
	*/
	SoundSize uint8

	/*
		SoundType: UB[1]
		0 = sndMono
		1 = sndStereo
		Mono or stereo sound For Nellymoser: always 0
		For AAC: always 1
	*/
	SoundType uint8

	/*
		0: AAC sequence header
		1: AAC raw
	*/
	AACPacketType uint8

	/*
		1: keyframe (for AVC, a seekable frame)
		2: inter frame (for AVC, a non- seekable frame)
		3: disposable inter frame (H.263 only)
		4: generated keyframe (reserved for server use only)
		5: video info/command frame
	*/
	FrameType uint8

	/*
		1: JPEG (currently unused)
		2: Sorenson H.263
		3: Screen video
		4: On2 VP6
		5: On2 VP6 with alpha channel
		6: Screen video version 2
		7: AVC
	*/
	CodecID uint8

	/*
		0: AVC sequence header
		1: AVC NALU
		2: AVC end of sequence (lower level NALU sequence ender is not required or supported)
	*/
	AVCPacketType uint8

	CompositionTime int32
	NoHead          bool
	Data            []byte
}

func ParseTagHeader

func ParseTagHeader(b []byte) (tag Tag, ts int32, datalen int, err error)

func ReadTag

func ReadTag(r io.Reader, b []byte) (tag Tag, ts int32, err error)

func (Tag) ChannelLayout

func (self Tag) ChannelLayout() av.ChannelLayout

func (Tag) FillHeader

func (self Tag) FillHeader(b []byte) (n int)

func (*Tag) ParseHeader

func (self *Tag) ParseHeader(b []byte) (n int, err error)

Jump to

Keyboard shortcuts

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