RTCP is the Real-Time Control Protocol
This page hosts a formal specification of rtcp network payload (single udp packet) using Kaitai Struct. This specification can be automatically translated into a variety of programming languages to get a parsing library.
// Code generated by kaitai-struct-compiler from a .ksy source file. DO NOT EDIT.
import (
"github.com/kaitai-io/kaitai_struct_go_runtime/kaitai"
"bytes"
)
/**
* RTCP is the Real-Time Control Protocol
* @see <a href="https://www.rfc-editor.org/rfc/rfc3550">Source</a>
*/
type RtcpPayload_PayloadType int
const (
RtcpPayload_PayloadType__Fir RtcpPayload_PayloadType = 192
RtcpPayload_PayloadType__Nack RtcpPayload_PayloadType = 193
RtcpPayload_PayloadType__Ij RtcpPayload_PayloadType = 195
RtcpPayload_PayloadType__Sr RtcpPayload_PayloadType = 200
RtcpPayload_PayloadType__Rr RtcpPayload_PayloadType = 201
RtcpPayload_PayloadType__Sdes RtcpPayload_PayloadType = 202
RtcpPayload_PayloadType__Bye RtcpPayload_PayloadType = 203
RtcpPayload_PayloadType__App RtcpPayload_PayloadType = 204
RtcpPayload_PayloadType__Rtpfb RtcpPayload_PayloadType = 205
RtcpPayload_PayloadType__Psfb RtcpPayload_PayloadType = 206
RtcpPayload_PayloadType__Xr RtcpPayload_PayloadType = 207
RtcpPayload_PayloadType__Avb RtcpPayload_PayloadType = 208
RtcpPayload_PayloadType__Rsi RtcpPayload_PayloadType = 209
)
var values_RtcpPayload_PayloadType = map[RtcpPayload_PayloadType]struct{}{192: {}, 193: {}, 195: {}, 200: {}, 201: {}, 202: {}, 203: {}, 204: {}, 205: {}, 206: {}, 207: {}, 208: {}, 209: {}}
func (v RtcpPayload_PayloadType) isDefined() bool {
_, ok := values_RtcpPayload_PayloadType[v]
return ok
}
type RtcpPayload_PsfbSubtype int
const (
RtcpPayload_PsfbSubtype__Pli RtcpPayload_PsfbSubtype = 1
RtcpPayload_PsfbSubtype__Sli RtcpPayload_PsfbSubtype = 2
RtcpPayload_PsfbSubtype__Rpsi RtcpPayload_PsfbSubtype = 3
RtcpPayload_PsfbSubtype__Fir RtcpPayload_PsfbSubtype = 4
RtcpPayload_PsfbSubtype__Tstr RtcpPayload_PsfbSubtype = 5
RtcpPayload_PsfbSubtype__Tstn RtcpPayload_PsfbSubtype = 6
RtcpPayload_PsfbSubtype__Vbcm RtcpPayload_PsfbSubtype = 7
RtcpPayload_PsfbSubtype__Afb RtcpPayload_PsfbSubtype = 15
)
var values_RtcpPayload_PsfbSubtype = map[RtcpPayload_PsfbSubtype]struct{}{1: {}, 2: {}, 3: {}, 4: {}, 5: {}, 6: {}, 7: {}, 15: {}}
func (v RtcpPayload_PsfbSubtype) isDefined() bool {
_, ok := values_RtcpPayload_PsfbSubtype[v]
return ok
}
type RtcpPayload_RtpfbSubtype int
const (
RtcpPayload_RtpfbSubtype__Nack RtcpPayload_RtpfbSubtype = 1
RtcpPayload_RtpfbSubtype__Tmmbr RtcpPayload_RtpfbSubtype = 3
RtcpPayload_RtpfbSubtype__Tmmbn RtcpPayload_RtpfbSubtype = 4
RtcpPayload_RtpfbSubtype__Rrr RtcpPayload_RtpfbSubtype = 5
RtcpPayload_RtpfbSubtype__TransportFeedback RtcpPayload_RtpfbSubtype = 15
)
var values_RtcpPayload_RtpfbSubtype = map[RtcpPayload_RtpfbSubtype]struct{}{1: {}, 3: {}, 4: {}, 5: {}, 15: {}}
func (v RtcpPayload_RtpfbSubtype) isDefined() bool {
_, ok := values_RtcpPayload_RtpfbSubtype[v]
return ok
}
type RtcpPayload_SdesSubtype int
const (
RtcpPayload_SdesSubtype__Pad RtcpPayload_SdesSubtype = 0
RtcpPayload_SdesSubtype__Cname RtcpPayload_SdesSubtype = 1
RtcpPayload_SdesSubtype__Name RtcpPayload_SdesSubtype = 2
RtcpPayload_SdesSubtype__Email RtcpPayload_SdesSubtype = 3
RtcpPayload_SdesSubtype__Phone RtcpPayload_SdesSubtype = 4
RtcpPayload_SdesSubtype__Loc RtcpPayload_SdesSubtype = 5
RtcpPayload_SdesSubtype__Tool RtcpPayload_SdesSubtype = 6
RtcpPayload_SdesSubtype__Note RtcpPayload_SdesSubtype = 7
RtcpPayload_SdesSubtype__Priv RtcpPayload_SdesSubtype = 8
)
var values_RtcpPayload_SdesSubtype = map[RtcpPayload_SdesSubtype]struct{}{0: {}, 1: {}, 2: {}, 3: {}, 4: {}, 5: {}, 6: {}, 7: {}, 8: {}}
func (v RtcpPayload_SdesSubtype) isDefined() bool {
_, ok := values_RtcpPayload_SdesSubtype[v]
return ok
}
type RtcpPayload struct {
RtcpPackets []*RtcpPayload_RtcpPacket
_io *kaitai.Stream
_root *RtcpPayload
_parent kaitai.Struct
}
func NewRtcpPayload() *RtcpPayload {
return &RtcpPayload{
}
}
func (this RtcpPayload) IO_() *kaitai.Stream {
return this._io
}
func (this *RtcpPayload) Read(io *kaitai.Stream, parent kaitai.Struct, root *RtcpPayload) (err error) {
this._io = io
this._parent = parent
this._root = root
for i := 0;; i++ {
tmp1, err := this._io.EOF()
if err != nil {
return err
}
if tmp1 {
break
}
tmp2 := NewRtcpPayload_RtcpPacket()
err = tmp2.Read(this._io, this, this._root)
if err != nil {
return err
}
this.RtcpPackets = append(this.RtcpPackets, tmp2)
}
return err
}
type RtcpPayload_PacketStatusChunk struct {
T bool
S2 uint64
S1 bool
Rle uint64
SymbolList uint64
_io *kaitai.Stream
_root *RtcpPayload
_parent kaitai.Struct
_f_s bool
s int
}
func NewRtcpPayload_PacketStatusChunk() *RtcpPayload_PacketStatusChunk {
return &RtcpPayload_PacketStatusChunk{
}
}
func (this RtcpPayload_PacketStatusChunk) IO_() *kaitai.Stream {
return this._io
}
func (this *RtcpPayload_PacketStatusChunk) Read(io *kaitai.Stream, parent kaitai.Struct, root *RtcpPayload) (err error) {
this._io = io
this._parent = parent
this._root = root
tmp3, err := this._io.ReadBitsIntBe(1)
if err != nil {
return err
}
this.T = tmp3 != 0
tmp4 := 0
if this.T {
tmp4 = 1
}
if (tmp4 == 0) {
tmp5, err := this._io.ReadBitsIntBe(2)
if err != nil {
return err
}
this.S2 = tmp5
}
tmp6 := 0
if this.T {
tmp6 = 1
}
if (tmp6 == 1) {
tmp7, err := this._io.ReadBitsIntBe(1)
if err != nil {
return err
}
this.S1 = tmp7 != 0
}
tmp8 := 0
if this.T {
tmp8 = 1
}
if (tmp8 == 0) {
tmp9, err := this._io.ReadBitsIntBe(13)
if err != nil {
return err
}
this.Rle = tmp9
}
tmp10 := 0
if this.T {
tmp10 = 1
}
if (tmp10 == 1) {
tmp11, err := this._io.ReadBitsIntBe(14)
if err != nil {
return err
}
this.SymbolList = tmp11
}
return err
}
func (this *RtcpPayload_PacketStatusChunk) S() (v int, err error) {
if (this._f_s) {
return this.s, nil
}
this._f_s = true
var tmp12 uint64;
tmp13 := 0
if this.T {
tmp13 = 1
}
if (tmp13 == 0) {
tmp12 = this.S2
} else {
var tmp14 int8;
tmp15 := 0
if this.S1 {
tmp15 = 1
}
if (tmp15 == 0) {
tmp14 = 1
} else {
tmp14 = 0
}
tmp12 = tmp14
}
this.s = int(tmp12)
return this.s, nil
}
type RtcpPayload_PsfbAfbPacket struct {
Uid uint32
Contents interface{}
_io *kaitai.Stream
_root *RtcpPayload
_parent *RtcpPayload_PsfbPacket
_raw_Contents []byte
}
func NewRtcpPayload_PsfbAfbPacket() *RtcpPayload_PsfbAfbPacket {
return &RtcpPayload_PsfbAfbPacket{
}
}
func (this RtcpPayload_PsfbAfbPacket) IO_() *kaitai.Stream {
return this._io
}
func (this *RtcpPayload_PsfbAfbPacket) Read(io *kaitai.Stream, parent *RtcpPayload_PsfbPacket, root *RtcpPayload) (err error) {
this._io = io
this._parent = parent
this._root = root
tmp16, err := this._io.ReadU4be()
if err != nil {
return err
}
this.Uid = uint32(tmp16)
switch (this.Uid) {
case 1380273474:
tmp17, err := this._io.ReadBytesFull()
if err != nil {
return err
}
tmp17 = tmp17
this._raw_Contents = tmp17
_io__raw_Contents := kaitai.NewStream(bytes.NewReader(this._raw_Contents))
tmp18 := NewRtcpPayload_PsfbAfbRembPacket()
err = tmp18.Read(_io__raw_Contents, this, this._root)
if err != nil {
return err
}
this.Contents = tmp18
default:
tmp19, err := this._io.ReadBytesFull()
if err != nil {
return err
}
tmp19 = tmp19
this._raw_Contents = tmp19
}
return err
}
type RtcpPayload_PsfbAfbRembPacket struct {
NumSsrc uint8
BrExp uint64
BrMantissa uint64
SsrcList []uint32
_io *kaitai.Stream
_root *RtcpPayload
_parent *RtcpPayload_PsfbAfbPacket
_f_maxTotalBitrate bool
maxTotalBitrate int
}
func NewRtcpPayload_PsfbAfbRembPacket() *RtcpPayload_PsfbAfbRembPacket {
return &RtcpPayload_PsfbAfbRembPacket{
}
}
func (this RtcpPayload_PsfbAfbRembPacket) IO_() *kaitai.Stream {
return this._io
}
func (this *RtcpPayload_PsfbAfbRembPacket) Read(io *kaitai.Stream, parent *RtcpPayload_PsfbAfbPacket, root *RtcpPayload) (err error) {
this._io = io
this._parent = parent
this._root = root
tmp20, err := this._io.ReadU1()
if err != nil {
return err
}
this.NumSsrc = tmp20
tmp21, err := this._io.ReadBitsIntBe(6)
if err != nil {
return err
}
this.BrExp = tmp21
tmp22, err := this._io.ReadBitsIntBe(18)
if err != nil {
return err
}
this.BrMantissa = tmp22
this._io.AlignToByte()
for i := 0; i < int(this.NumSsrc); i++ {
_ = i
tmp23, err := this._io.ReadU4be()
if err != nil {
return err
}
this.SsrcList = append(this.SsrcList, tmp23)
}
return err
}
func (this *RtcpPayload_PsfbAfbRembPacket) MaxTotalBitrate() (v int, err error) {
if (this._f_maxTotalBitrate) {
return this.maxTotalBitrate, nil
}
this._f_maxTotalBitrate = true
this.maxTotalBitrate = int(this.BrMantissa * (1 << this.BrExp))
return this.maxTotalBitrate, nil
}
type RtcpPayload_PsfbPacket struct {
Ssrc uint32
SsrcMediaSource uint32
FciBlock interface{}
_io *kaitai.Stream
_root *RtcpPayload
_parent *RtcpPayload_RtcpPacket
_raw_FciBlock []byte
_f_fmt bool
fmt RtcpPayload_PsfbSubtype
}
func NewRtcpPayload_PsfbPacket() *RtcpPayload_PsfbPacket {
return &RtcpPayload_PsfbPacket{
}
}
func (this RtcpPayload_PsfbPacket) IO_() *kaitai.Stream {
return this._io
}
func (this *RtcpPayload_PsfbPacket) Read(io *kaitai.Stream, parent *RtcpPayload_RtcpPacket, root *RtcpPayload) (err error) {
this._io = io
this._parent = parent
this._root = root
tmp24, err := this._io.ReadU4be()
if err != nil {
return err
}
this.Ssrc = uint32(tmp24)
tmp25, err := this._io.ReadU4be()
if err != nil {
return err
}
this.SsrcMediaSource = uint32(tmp25)
tmp26, err := this.Fmt()
if err != nil {
return err
}
switch (tmp26) {
case RtcpPayload_PsfbSubtype__Afb:
tmp27, err := this._io.ReadBytesFull()
if err != nil {
return err
}
tmp27 = tmp27
this._raw_FciBlock = tmp27
_io__raw_FciBlock := kaitai.NewStream(bytes.NewReader(this._raw_FciBlock))
tmp28 := NewRtcpPayload_PsfbAfbPacket()
err = tmp28.Read(_io__raw_FciBlock, this, this._root)
if err != nil {
return err
}
this.FciBlock = tmp28
default:
tmp29, err := this._io.ReadBytesFull()
if err != nil {
return err
}
tmp29 = tmp29
this._raw_FciBlock = tmp29
}
return err
}
func (this *RtcpPayload_PsfbPacket) Fmt() (v RtcpPayload_PsfbSubtype, err error) {
if (this._f_fmt) {
return this.fmt, nil
}
this._f_fmt = true
this.fmt = RtcpPayload_PsfbSubtype(RtcpPayload_PsfbSubtype(this._parent.Subtype))
return this.fmt, nil
}
type RtcpPayload_ReportBlock struct {
SsrcSource uint32
LostVal uint8
HighestSeqNumReceived uint32
InterarrivalJitter uint32
Lsr uint32
Dlsr uint32
_io *kaitai.Stream
_root *RtcpPayload
_parent kaitai.Struct
_f_cumulativePacketsLost bool
cumulativePacketsLost int
_f_fractionLost bool
fractionLost int
}
func NewRtcpPayload_ReportBlock() *RtcpPayload_ReportBlock {
return &RtcpPayload_ReportBlock{
}
}
func (this RtcpPayload_ReportBlock) IO_() *kaitai.Stream {
return this._io
}
func (this *RtcpPayload_ReportBlock) Read(io *kaitai.Stream, parent kaitai.Struct, root *RtcpPayload) (err error) {
this._io = io
this._parent = parent
this._root = root
tmp30, err := this._io.ReadU4be()
if err != nil {
return err
}
this.SsrcSource = uint32(tmp30)
tmp31, err := this._io.ReadU1()
if err != nil {
return err
}
this.LostVal = tmp31
tmp32, err := this._io.ReadU4be()
if err != nil {
return err
}
this.HighestSeqNumReceived = uint32(tmp32)
tmp33, err := this._io.ReadU4be()
if err != nil {
return err
}
this.InterarrivalJitter = uint32(tmp33)
tmp34, err := this._io.ReadU4be()
if err != nil {
return err
}
this.Lsr = uint32(tmp34)
tmp35, err := this._io.ReadU4be()
if err != nil {
return err
}
this.Dlsr = uint32(tmp35)
return err
}
func (this *RtcpPayload_ReportBlock) CumulativePacketsLost() (v int, err error) {
if (this._f_cumulativePacketsLost) {
return this.cumulativePacketsLost, nil
}
this._f_cumulativePacketsLost = true
this.cumulativePacketsLost = int(this.LostVal & 16777215)
return this.cumulativePacketsLost, nil
}
func (this *RtcpPayload_ReportBlock) FractionLost() (v int, err error) {
if (this._f_fractionLost) {
return this.fractionLost, nil
}
this._f_fractionLost = true
this.fractionLost = int(this.LostVal >> 24)
return this.fractionLost, nil
}
type RtcpPayload_RrPacket struct {
Ssrc uint32
ReportBlock []*RtcpPayload_ReportBlock
_io *kaitai.Stream
_root *RtcpPayload
_parent *RtcpPayload_RtcpPacket
}
func NewRtcpPayload_RrPacket() *RtcpPayload_RrPacket {
return &RtcpPayload_RrPacket{
}
}
func (this RtcpPayload_RrPacket) IO_() *kaitai.Stream {
return this._io
}
func (this *RtcpPayload_RrPacket) Read(io *kaitai.Stream, parent *RtcpPayload_RtcpPacket, root *RtcpPayload) (err error) {
this._io = io
this._parent = parent
this._root = root
tmp36, err := this._io.ReadU4be()
if err != nil {
return err
}
this.Ssrc = uint32(tmp36)
for i := 0; i < int(this._parent.Subtype); i++ {
_ = i
tmp37 := NewRtcpPayload_ReportBlock()
err = tmp37.Read(this._io, this, this._root)
if err != nil {
return err
}
this.ReportBlock = append(this.ReportBlock, tmp37)
}
return err
}
type RtcpPayload_RtcpPacket struct {
Version uint64
Padding bool
Subtype uint64
PayloadType RtcpPayload_PayloadType
Length uint16
Body interface{}
_io *kaitai.Stream
_root *RtcpPayload
_parent *RtcpPayload
_raw_Body []byte
}
func NewRtcpPayload_RtcpPacket() *RtcpPayload_RtcpPacket {
return &RtcpPayload_RtcpPacket{
}
}
func (this RtcpPayload_RtcpPacket) IO_() *kaitai.Stream {
return this._io
}
func (this *RtcpPayload_RtcpPacket) Read(io *kaitai.Stream, parent *RtcpPayload, root *RtcpPayload) (err error) {
this._io = io
this._parent = parent
this._root = root
tmp38, err := this._io.ReadBitsIntBe(2)
if err != nil {
return err
}
this.Version = tmp38
tmp39, err := this._io.ReadBitsIntBe(1)
if err != nil {
return err
}
this.Padding = tmp39 != 0
tmp40, err := this._io.ReadBitsIntBe(5)
if err != nil {
return err
}
this.Subtype = tmp40
this._io.AlignToByte()
tmp41, err := this._io.ReadU1()
if err != nil {
return err
}
this.PayloadType = RtcpPayload_PayloadType(tmp41)
tmp42, err := this._io.ReadU2be()
if err != nil {
return err
}
this.Length = uint16(tmp42)
switch (this.PayloadType) {
case RtcpPayload_PayloadType__Psfb:
tmp43, err := this._io.ReadBytes(int(4 * this.Length))
if err != nil {
return err
}
tmp43 = tmp43
this._raw_Body = tmp43
_io__raw_Body := kaitai.NewStream(bytes.NewReader(this._raw_Body))
tmp44 := NewRtcpPayload_PsfbPacket()
err = tmp44.Read(_io__raw_Body, this, this._root)
if err != nil {
return err
}
this.Body = tmp44
case RtcpPayload_PayloadType__Rr:
tmp45, err := this._io.ReadBytes(int(4 * this.Length))
if err != nil {
return err
}
tmp45 = tmp45
this._raw_Body = tmp45
_io__raw_Body := kaitai.NewStream(bytes.NewReader(this._raw_Body))
tmp46 := NewRtcpPayload_RrPacket()
err = tmp46.Read(_io__raw_Body, this, this._root)
if err != nil {
return err
}
this.Body = tmp46
case RtcpPayload_PayloadType__Rtpfb:
tmp47, err := this._io.ReadBytes(int(4 * this.Length))
if err != nil {
return err
}
tmp47 = tmp47
this._raw_Body = tmp47
_io__raw_Body := kaitai.NewStream(bytes.NewReader(this._raw_Body))
tmp48 := NewRtcpPayload_RtpfbPacket()
err = tmp48.Read(_io__raw_Body, this, this._root)
if err != nil {
return err
}
this.Body = tmp48
case RtcpPayload_PayloadType__Sdes:
tmp49, err := this._io.ReadBytes(int(4 * this.Length))
if err != nil {
return err
}
tmp49 = tmp49
this._raw_Body = tmp49
_io__raw_Body := kaitai.NewStream(bytes.NewReader(this._raw_Body))
tmp50 := NewRtcpPayload_SdesPacket()
err = tmp50.Read(_io__raw_Body, this, this._root)
if err != nil {
return err
}
this.Body = tmp50
case RtcpPayload_PayloadType__Sr:
tmp51, err := this._io.ReadBytes(int(4 * this.Length))
if err != nil {
return err
}
tmp51 = tmp51
this._raw_Body = tmp51
_io__raw_Body := kaitai.NewStream(bytes.NewReader(this._raw_Body))
tmp52 := NewRtcpPayload_SrPacket()
err = tmp52.Read(_io__raw_Body, this, this._root)
if err != nil {
return err
}
this.Body = tmp52
default:
tmp53, err := this._io.ReadBytes(int(4 * this.Length))
if err != nil {
return err
}
tmp53 = tmp53
this._raw_Body = tmp53
}
return err
}
type RtcpPayload_RtpfbPacket struct {
Ssrc uint32
SsrcMediaSource uint32
FciBlock interface{}
_io *kaitai.Stream
_root *RtcpPayload
_parent *RtcpPayload_RtcpPacket
_raw_FciBlock []byte
_f_fmt bool
fmt RtcpPayload_RtpfbSubtype
}
func NewRtcpPayload_RtpfbPacket() *RtcpPayload_RtpfbPacket {
return &RtcpPayload_RtpfbPacket{
}
}
func (this RtcpPayload_RtpfbPacket) IO_() *kaitai.Stream {
return this._io
}
func (this *RtcpPayload_RtpfbPacket) Read(io *kaitai.Stream, parent *RtcpPayload_RtcpPacket, root *RtcpPayload) (err error) {
this._io = io
this._parent = parent
this._root = root
tmp54, err := this._io.ReadU4be()
if err != nil {
return err
}
this.Ssrc = uint32(tmp54)
tmp55, err := this._io.ReadU4be()
if err != nil {
return err
}
this.SsrcMediaSource = uint32(tmp55)
tmp56, err := this.Fmt()
if err != nil {
return err
}
switch (tmp56) {
case RtcpPayload_RtpfbSubtype__TransportFeedback:
tmp57, err := this._io.ReadBytesFull()
if err != nil {
return err
}
tmp57 = tmp57
this._raw_FciBlock = tmp57
_io__raw_FciBlock := kaitai.NewStream(bytes.NewReader(this._raw_FciBlock))
tmp58 := NewRtcpPayload_RtpfbTransportFeedbackPacket()
err = tmp58.Read(_io__raw_FciBlock, this, this._root)
if err != nil {
return err
}
this.FciBlock = tmp58
default:
tmp59, err := this._io.ReadBytesFull()
if err != nil {
return err
}
tmp59 = tmp59
this._raw_FciBlock = tmp59
}
return err
}
func (this *RtcpPayload_RtpfbPacket) Fmt() (v RtcpPayload_RtpfbSubtype, err error) {
if (this._f_fmt) {
return this.fmt, nil
}
this._f_fmt = true
this.fmt = RtcpPayload_RtpfbSubtype(RtcpPayload_RtpfbSubtype(this._parent.Subtype))
return this.fmt, nil
}
type RtcpPayload_RtpfbTransportFeedbackPacket struct {
BaseSequenceNumber uint16
PacketStatusCount uint16
B4 uint32
Remaining []byte
_io *kaitai.Stream
_root *RtcpPayload
_parent *RtcpPayload_RtpfbPacket
_f_fbPktCount bool
fbPktCount int
_f_packetStatus bool
packetStatus []byte
_f_recvDelta bool
recvDelta []byte
_f_referenceTime bool
referenceTime int
}
func NewRtcpPayload_RtpfbTransportFeedbackPacket() *RtcpPayload_RtpfbTransportFeedbackPacket {
return &RtcpPayload_RtpfbTransportFeedbackPacket{
}
}
func (this RtcpPayload_RtpfbTransportFeedbackPacket) IO_() *kaitai.Stream {
return this._io
}
func (this *RtcpPayload_RtpfbTransportFeedbackPacket) Read(io *kaitai.Stream, parent *RtcpPayload_RtpfbPacket, root *RtcpPayload) (err error) {
this._io = io
this._parent = parent
this._root = root
tmp60, err := this._io.ReadU2be()
if err != nil {
return err
}
this.BaseSequenceNumber = uint16(tmp60)
tmp61, err := this._io.ReadU2be()
if err != nil {
return err
}
this.PacketStatusCount = uint16(tmp61)
tmp62, err := this._io.ReadU4be()
if err != nil {
return err
}
this.B4 = uint32(tmp62)
tmp63, err := this._io.ReadBytesFull()
if err != nil {
return err
}
tmp63 = tmp63
this.Remaining = tmp63
return err
}
func (this *RtcpPayload_RtpfbTransportFeedbackPacket) FbPktCount() (v int, err error) {
if (this._f_fbPktCount) {
return this.fbPktCount, nil
}
this._f_fbPktCount = true
this.fbPktCount = int(this.B4 & 255)
return this.fbPktCount, nil
}
func (this *RtcpPayload_RtpfbTransportFeedbackPacket) PacketStatus() (v []byte, err error) {
if (this._f_packetStatus) {
return this.packetStatus, nil
}
this._f_packetStatus = true
tmp64, err := this._io.ReadBytes(int(0))
if err != nil {
return nil, err
}
tmp64 = tmp64
this.packetStatus = tmp64
return this.packetStatus, nil
}
func (this *RtcpPayload_RtpfbTransportFeedbackPacket) RecvDelta() (v []byte, err error) {
if (this._f_recvDelta) {
return this.recvDelta, nil
}
this._f_recvDelta = true
tmp65, err := this._io.ReadBytes(int(0))
if err != nil {
return nil, err
}
tmp65 = tmp65
this.recvDelta = tmp65
return this.recvDelta, nil
}
func (this *RtcpPayload_RtpfbTransportFeedbackPacket) ReferenceTime() (v int, err error) {
if (this._f_referenceTime) {
return this.referenceTime, nil
}
this._f_referenceTime = true
this.referenceTime = int(this.B4 >> 8)
return this.referenceTime, nil
}
type RtcpPayload_SdesPacket struct {
SourceChunk []*RtcpPayload_SourceChunk
_io *kaitai.Stream
_root *RtcpPayload
_parent *RtcpPayload_RtcpPacket
_f_sourceCount bool
sourceCount uint64
}
func NewRtcpPayload_SdesPacket() *RtcpPayload_SdesPacket {
return &RtcpPayload_SdesPacket{
}
}
func (this RtcpPayload_SdesPacket) IO_() *kaitai.Stream {
return this._io
}
func (this *RtcpPayload_SdesPacket) Read(io *kaitai.Stream, parent *RtcpPayload_RtcpPacket, root *RtcpPayload) (err error) {
this._io = io
this._parent = parent
this._root = root
tmp66, err := this.SourceCount()
if err != nil {
return err
}
for i := 0; i < int(tmp66); i++ {
_ = i
tmp67 := NewRtcpPayload_SourceChunk()
err = tmp67.Read(this._io, this, this._root)
if err != nil {
return err
}
this.SourceChunk = append(this.SourceChunk, tmp67)
}
return err
}
func (this *RtcpPayload_SdesPacket) SourceCount() (v uint64, err error) {
if (this._f_sourceCount) {
return this.sourceCount, nil
}
this._f_sourceCount = true
this.sourceCount = uint64(this._parent.Subtype)
return this.sourceCount, nil
}
type RtcpPayload_SdesTlv struct {
Type RtcpPayload_SdesSubtype
Length uint8
Value []byte
_io *kaitai.Stream
_root *RtcpPayload
_parent *RtcpPayload_SourceChunk
}
func NewRtcpPayload_SdesTlv() *RtcpPayload_SdesTlv {
return &RtcpPayload_SdesTlv{
}
}
func (this RtcpPayload_SdesTlv) IO_() *kaitai.Stream {
return this._io
}
func (this *RtcpPayload_SdesTlv) Read(io *kaitai.Stream, parent *RtcpPayload_SourceChunk, root *RtcpPayload) (err error) {
this._io = io
this._parent = parent
this._root = root
tmp68, err := this._io.ReadU1()
if err != nil {
return err
}
this.Type = RtcpPayload_SdesSubtype(tmp68)
if (this.Type != RtcpPayload_SdesSubtype__Pad) {
tmp69, err := this._io.ReadU1()
if err != nil {
return err
}
this.Length = tmp69
}
if (this.Type != RtcpPayload_SdesSubtype__Pad) {
tmp70, err := this._io.ReadBytes(int(this.Length))
if err != nil {
return err
}
tmp70 = tmp70
this.Value = tmp70
}
return err
}
type RtcpPayload_SourceChunk struct {
Ssrc uint32
SdesTlv []*RtcpPayload_SdesTlv
_io *kaitai.Stream
_root *RtcpPayload
_parent *RtcpPayload_SdesPacket
}
func NewRtcpPayload_SourceChunk() *RtcpPayload_SourceChunk {
return &RtcpPayload_SourceChunk{
}
}
func (this RtcpPayload_SourceChunk) IO_() *kaitai.Stream {
return this._io
}
func (this *RtcpPayload_SourceChunk) Read(io *kaitai.Stream, parent *RtcpPayload_SdesPacket, root *RtcpPayload) (err error) {
this._io = io
this._parent = parent
this._root = root
tmp71, err := this._io.ReadU4be()
if err != nil {
return err
}
this.Ssrc = uint32(tmp71)
for i := 0;; i++ {
tmp72, err := this._io.EOF()
if err != nil {
return err
}
if tmp72 {
break
}
tmp73 := NewRtcpPayload_SdesTlv()
err = tmp73.Read(this._io, this, this._root)
if err != nil {
return err
}
this.SdesTlv = append(this.SdesTlv, tmp73)
}
return err
}
type RtcpPayload_SrPacket struct {
Ssrc uint32
NtpMsw uint32
NtpLsw uint32
RtpTimestamp uint32
SenderPacketCount uint32
SenderOctetCount uint32
ReportBlock []*RtcpPayload_ReportBlock
_io *kaitai.Stream
_root *RtcpPayload
_parent *RtcpPayload_RtcpPacket
_f_ntp bool
ntp int
}
func NewRtcpPayload_SrPacket() *RtcpPayload_SrPacket {
return &RtcpPayload_SrPacket{
}
}
func (this RtcpPayload_SrPacket) IO_() *kaitai.Stream {
return this._io
}
func (this *RtcpPayload_SrPacket) Read(io *kaitai.Stream, parent *RtcpPayload_RtcpPacket, root *RtcpPayload) (err error) {
this._io = io
this._parent = parent
this._root = root
tmp74, err := this._io.ReadU4be()
if err != nil {
return err
}
this.Ssrc = uint32(tmp74)
tmp75, err := this._io.ReadU4be()
if err != nil {
return err
}
this.NtpMsw = uint32(tmp75)
tmp76, err := this._io.ReadU4be()
if err != nil {
return err
}
this.NtpLsw = uint32(tmp76)
tmp77, err := this._io.ReadU4be()
if err != nil {
return err
}
this.RtpTimestamp = uint32(tmp77)
tmp78, err := this._io.ReadU4be()
if err != nil {
return err
}
this.SenderPacketCount = uint32(tmp78)
tmp79, err := this._io.ReadU4be()
if err != nil {
return err
}
this.SenderOctetCount = uint32(tmp79)
for i := 0; i < int(this._parent.Subtype); i++ {
_ = i
tmp80 := NewRtcpPayload_ReportBlock()
err = tmp80.Read(this._io, this, this._root)
if err != nil {
return err
}
this.ReportBlock = append(this.ReportBlock, tmp80)
}
return err
}
func (this *RtcpPayload_SrPacket) Ntp() (v int, err error) {
if (this._f_ntp) {
return this.ntp, nil
}
this._f_ntp = true
this.ntp = int((this.NtpMsw << 32) & this.NtpLsw)
return this.ntp, nil
}