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
|
||||
|
||||
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 {
|
||||
SyncByte byte
|
||||
TEI bool
|
||||
PUSI bool
|
||||
Priority bool
|
||||
PID uint
|
||||
TSC byte
|
||||
AFC byte
|
||||
CC byte
|
||||
AdaptionField []byte
|
||||
Payload []byte
|
||||
SyncByte byte
|
||||
TEI bool // Transport Error Indicator
|
||||
PUSI bool // Payload Unit Start Indicator
|
||||
Priority bool
|
||||
PID int
|
||||
TSC byte // Transport Scrambling Control
|
||||
AFC byte // Adaption Field Control
|
||||
CC int // Continuity Counter
|
||||
AF []byte // Adaption Field
|
||||
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