Skip to content

Commit

Permalink
[feat] avc: 新增Annexb2Avcc函数
Browse files Browse the repository at this point in the history
  • Loading branch information
q191201771 committed Mar 27, 2022
1 parent 0ebe60a commit c2fa468
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pkg/avc/avc.go
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,16 @@ func Avcc2Annexb(nals []byte) ([]byte, error) {
return ret, err
}

// TODO(chef): 是否需要 func NaluAvcc2Annexb, func NaluAnnexb2Avcc
func Annexb2Avcc(nals []byte) ([]byte, error) {
var buf nazabytes.Buffer
buf.Grow(len(nals))
err := IterateNaluAnnexb(nals, func(nal []byte) {
bele.BePutUint32(buf.ReserveBytes(4), uint32(len(nal)))
buf.Flush(4)
_, _ = buf.Write(nal)
})
return buf.Bytes(), err
}

// ---------------------------------------------------------------------------------------------------------------------

Expand Down

0 comments on commit c2fa468

Please sign in to comment.