Also write tag size at end
This commit is contained in:
parent
fc4560076c
commit
5a21ef83d2
1 changed files with 12 additions and 4 deletions
|
@ -35,13 +35,21 @@ func (writer *FLVWriter) WriteMetadataTag(data *[]byte) (err error) {
|
||||||
binary.BigEndian.PutUint32(uint24_buf, uint32(len((*data)[16:])))
|
binary.BigEndian.PutUint32(uint24_buf, uint32(len((*data)[16:])))
|
||||||
copy(tag_header[1:4], uint24_buf[1:])
|
copy(tag_header[1:4], uint24_buf[1:])
|
||||||
|
|
||||||
_, err = writer.w.Write(tag_header)
|
if _, err = writer.w.Write(tag_header); err != nil {
|
||||||
if err == nil {
|
return
|
||||||
_, err = writer.w.Write((*data)[16:])
|
|
||||||
}
|
}
|
||||||
|
if _, err = writer.w.Write((*data)[16:]); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
tag_len_buf := make([]byte, 4)
|
||||||
|
binary.BigEndian.PutUint32(tag_len_buf, uint32(len((*data)[16:]) + 11))
|
||||||
|
_, err = writer.w.Write(tag_len_buf)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func (writer *FLVWriter) write_flv_header() (err error) {
|
func (writer *FLVWriter) write_flv_header() (err error) {
|
||||||
header := make([]byte, 13)
|
header := make([]byte, 13)
|
||||||
copy(header[:3], "FLV")
|
copy(header[:3], "FLV")
|
||||||
|
|
Loading…
Reference in a new issue