chunk

package
v0.0.0-...-f53f79a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTooManyBytes = errors.New("rtmp: read too many bytes into chunk")
)
View Source
var (
	ErrUnknownFormatId = errors.New("rtmp: unknown message header ID")
)

Functions

This section is empty.

Types

type BasicHeader

type BasicHeader struct {
	FormatId byte
	StreamId uint32
}

func (*BasicHeader) Read

func (h *BasicHeader) Read(r io.Reader) error

type Builder

type Builder struct {
	Header   *Header
	Payloads [][]byte
	// contains filtered or unexported fields
}

func NewBuilder

func NewBuilder(h *Header) *Builder

func (*Builder) Append

func (b *Builder) Append(slice []byte) (int, error)

func (*Builder) Build

func (b *Builder) Build() *Chunk

func (*Builder) Read

func (b *Builder) Read(r io.Reader, n int) (int, error)

type Chunk

type Chunk struct {
	Header *Header
	Data   []byte
}

func New

func New(header *Header, data []byte) *Chunk

func (*Chunk) TypeId

func (c *Chunk) TypeId() uint32

type ExtendedTimestamp

type ExtendedTimestamp struct {
	// Delta encodes the complete timestamp or extended timestamp field for
	// chunks matching the scenario as described above.
	Delta uint32
}

ExtendedTimestamp is an extra, optional, part of the standard RTMP chunk header. It is used to encode the complete 32-bit timestamp, or timestamp delta. It will only be present when the timestamp field of a type 0 header, or the timestamp delta field of a type 1 or 2 header is set to 0xffffff. Additionally, this field is present in type 3 chunks when the last type 0, 1 or 2 chunk indicated presence of this field.

func (*ExtendedTimestamp) Read

func (t *ExtendedTimestamp) Read(r io.Reader) error

Read slurps four bytes off of the given reader and parses the Delta field out as an unsigned, 32-bit integer.

type Header struct {
	BasicHeader       BasicHeader
	MessageHeader     MessageHeader
	ExtendedTimestamp ExtendedTimestamp
}

func (*Header) Read

func (h *Header) Read(r io.Reader) error

type MessageHeader

type MessageHeader struct {
	FormatId       byte
	Timestamp      uint32
	TimestampDelta bool
	Length         uint32
	TypeId         byte
	StreamId       uint32
}

func (*MessageHeader) HasExtendedTimestamp

func (m *MessageHeader) HasExtendedTimestamp() bool

func (*MessageHeader) Read

func (m *MessageHeader) Read(r io.Reader) error

type Stream

type Stream struct {
	// contains filtered or unexported fields
}

func (*Stream) Chunks

func (s *Stream) Chunks() <-chan *Chunk

func (*Stream) Errs

func (s *Stream) Errs() <-chan error

func (*Stream) ReadSize

func (s *Stream) ReadSize() int

func (*Stream) Recv

func (s *Stream) Recv()

func (*Stream) SetReadSize

func (s *Stream) SetReadSize(size int)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL