1
1
mirror of https://github.com/wader/fq.git synced 2024-11-23 00:57:15 +03:00

ogg: Cleanup bitio in format out, maybe later

This commit is contained in:
Mattias Wadman 2021-11-30 13:12:14 +01:00
parent d1e1cd98c2
commit 7f7698601f
3 changed files with 9 additions and 13 deletions

View File

@ -1,9 +1,5 @@
package format
import (
"github.com/wader/fq/pkg/bitio"
)
//nolint:revive
const (
ALL = "all"
@ -142,7 +138,7 @@ type OggPageOut struct {
IsContinuedPacket bool
StreamSerialNumber uint32
SequenceNo uint32
Segments []*bitio.Buffer // TODO: bitio.Reader (bitio.MultiReader internally?)
Segments [][]byte
}
type AvcIn struct {

View File

@ -102,13 +102,9 @@ func decodeOgg(d *decode.D, in interface{}) interface{} {
// // log.Println("page gap")
// }
for _, ps := range oggPageOut.Segments {
psBytes := ps.Len() / 8
// TODO: cleanup
b, _ := ps.BytesRange(0, int(psBytes))
s.packetBuf = append(s.packetBuf, b...)
if psBytes < 255 { // TODO: list range maps of demuxed packets?
for _, bs := range oggPageOut.Segments {
s.packetBuf = append(s.packetBuf, bs...)
if len(bs) < 255 {
bb := bitio.NewBufferFromBytes(s.packetBuf, -1)
if s.codec == codecUnknown {

View File

@ -42,7 +42,11 @@ func pageDecode(d *decode.D, in interface{}) interface{} {
})
d.FieldArray("segments", func(d *decode.D) {
for _, ss := range segmentTable {
p.Segments = append(p.Segments, d.FieldRawLen("segment", int64(ss)*8))
bs, err := d.FieldRawLen("segment", int64(ss)*8).Bytes()
if err != nil {
d.IOPanic(err, "d.BitBufRange segment")
}
p.Segments = append(p.Segments, bs)
}
})
endPos := d.Pos()