revid: changes made to stream/flv regarding last commit for removal of flv header bytes

This commit is contained in:
Saxon 2019-03-12 12:58:31 +10:30
parent 9d010ed76c
commit cce05db3f2
2 changed files with 5 additions and 38 deletions

View File

@ -60,7 +60,6 @@ type Encoder struct {
fps int
audio bool
video bool
header Header
start time.Time
}
@ -72,20 +71,7 @@ func NewEncoder(dst io.Writer, audio, video bool, fps int) (*Encoder, error) {
audio: audio,
video: video,
}
_, err := dst.Write(e.HeaderBytes())
if err != nil {
return nil, err
}
return &e, err
}
// HeaderBytes returns the a
func (e *Encoder) HeaderBytes() []byte {
header := Header{
HasAudio: e.audio,
HasVideo: e.video,
}
return header.Bytes()
return &e, nil
}
// getNextTimestamp generates and returns the next timestamp based on current time

View File

@ -71,25 +71,6 @@ func orderPutUint24(b []byte, v uint32) {
b[2] = byte(v)
}
var flvHeaderCode = []byte{'F', 'L', 'V', version}
type Header struct {
HasAudio bool
HasVideo bool
}
func (h *Header) Bytes() []byte {
// See https://download.macromedia.com/f4v/video_file_format_spec_v10_1.pdf
// section E.2.
const headerLength = 9
b := [headerLength]byte{
0: 'F', 1: 'L', 2: 'V', 3: version,
4: btb(h.HasAudio)<<2 | btb(h.HasVideo),
8: headerLength, // order.PutUint32(b[5:9], headerLength)
}
return b[:]
}
type VideoTag struct {
TagType uint8
DataSize uint32