mirror of https://github.com/q191201771/lal.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
566 B
Go
31 lines
566 B
Go
package httpflv
|
|
|
|
import (
|
|
"github.com/q191201771/lal/bele"
|
|
"io"
|
|
"log"
|
|
)
|
|
|
|
var tagHeaderSize = 11
|
|
|
|
type TagHeader struct {
|
|
t uint8 // type
|
|
dataSize uint32
|
|
timestamp uint32
|
|
streamId uint32 // always 0
|
|
}
|
|
|
|
func readTagHeader(rd io.Reader) (h *TagHeader, raw []byte, err error) {
|
|
raw = make([]byte, tagHeaderSize)
|
|
if _, err = io.ReadAtLeast(rd, raw, tagHeaderSize); err != nil {
|
|
log.Println(err)
|
|
return
|
|
}
|
|
|
|
h = &TagHeader{}
|
|
h.t = raw[0]
|
|
h.dataSize = bele.BeUInt24(raw[1:])
|
|
h.timestamp = (uint32(raw[7]) << 24) + bele.BeUInt24(raw[4:])
|
|
return
|
|
}
|