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:
parent
d1e1cd98c2
commit
7f7698601f
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user