mirror of https://bitbucket.org/ausocean/av.git
Working out how to convert to byte slice
This commit is contained in:
parent
4118d27769
commit
b1771483ce
|
@ -28,19 +28,50 @@ LICENSE
|
||||||
|
|
||||||
package packet
|
package packet
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strconv"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Length of some fields in bits
|
||||||
|
const (
|
||||||
|
SyncByteLength = 8
|
||||||
|
TEILength = 1
|
||||||
|
PUSILength = 1
|
||||||
|
PriorityLength = 1
|
||||||
|
PIDLength = 13
|
||||||
|
TSCLength = 2
|
||||||
|
AFCLength = 2
|
||||||
|
CCLength = 4
|
||||||
|
)
|
||||||
|
|
||||||
|
// Index of the fields
|
||||||
|
const (
|
||||||
|
SyncByteIndex = 0
|
||||||
|
TEIIndex = SyncByteIndex + SyncByteLength
|
||||||
|
PUSIIndex = TEIIndex + TEILength
|
||||||
|
PriorityIndex = PUSIIndex + PUSILength
|
||||||
|
PIDIndex = PriorityIndex + PriorityLength
|
||||||
|
TSCIndex = PIDIndex + PIDLength
|
||||||
|
AFCIndex = TSCIndex + TSCLength
|
||||||
|
CCIndex = AFCIndex + AFCLength
|
||||||
|
AFIndex = CCIndex + CCLength
|
||||||
|
)
|
||||||
|
|
||||||
type MpegTsPacket struct {
|
type MpegTsPacket struct {
|
||||||
SyncByte byte
|
SyncByte byte
|
||||||
TEI bool
|
TEI bool // Transport Error Indicator
|
||||||
PUSI bool
|
PUSI bool // Payload Unit Start Indicator
|
||||||
Priority bool
|
Priority bool
|
||||||
PID uint
|
PID int
|
||||||
TSC byte
|
TSC byte // Transport Scrambling Control
|
||||||
AFC byte
|
AFC byte // Adaption Field Control
|
||||||
CC byte
|
CC int // Continuity Counter
|
||||||
AdaptionField []byte
|
AF []byte // Adaption Field
|
||||||
Payload []byte
|
Payload []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
type (p *MpegTsPacket) toByteSlice() []byte {
|
func getHex()
|
||||||
|
func (p *MpegTsPacket) toByteSlice() (output []byte) {
|
||||||
|
output[0] = p.SyncByte
|
||||||
|
output[1] =
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue