mirror of https://bitbucket.org/ausocean/av.git
47 lines
699 B
Go
47 lines
699 B
Go
package flv
|
|
|
|
import (
|
|
"../tools"
|
|
)
|
|
|
|
const (
|
|
headerLength = 72
|
|
version = 0x01
|
|
)
|
|
|
|
type Header struct {
|
|
audioFlag bool
|
|
videoFlag bool
|
|
}
|
|
|
|
func (h *Header) toByteSlice() []byte {
|
|
output = make([]byte, 0, headerLength)
|
|
output = append(output, []byte{ 0x46, 0x4C, 0x56,
|
|
version,
|
|
0x00 | tools.boolToByte(h.audioFlag) << 3 | tools.boolToByte(h.videoFlag),
|
|
0x00, 0x00, 0x00, byte(72),
|
|
}...)
|
|
return
|
|
}
|
|
|
|
type VideoTag struct {
|
|
prevTagSize uint32
|
|
tagType uint
|
|
dataSize uint32
|
|
timeStamp uint32
|
|
timestampExtended uint32
|
|
data []byte
|
|
}
|
|
|
|
func (t *VideoTag) toByteSlice() (output []byte) {
|
|
|
|
}
|
|
|
|
type AudioTag struct {
|
|
|
|
}
|
|
|
|
func (t *AudioTage) toByteSlice() (output []byte) {
|
|
|
|
}
|