Documentation ¶
Index ¶
Constants ¶
const ( // MpegTsPacketSize is the TS packet size (188 bytes) MpegTsPacketSize = 188 // MpegTsSyncByte is the byte value of the TS synchronization code (0x47) MpegTsSyncByte = 0x47 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FixedReader ¶ added in v0.7.0
type FixedReader struct {
// contains filtered or unexported fields
}
FixedReader implements a buffered reader that always reads a fixed amount of data from an underlying io.Reader.
It is intended to produce a stream from a packet-based network socket, such as net.UDPConn.
Note that packet-based sockets normally give no guarantee about the order of incoming packets, and don't account for resends of dropped ones. If order is important, reordering must be implemented by other means.
If the underlying reader implements the io.Closer interface, Close() calls will be forwarded. Otherwise, Close() is a no-op.
func NewFixedReader ¶ added in v0.7.0
func NewFixedReader(reader io.Reader, psize int) *FixedReader
NewFixedReader creates a new buffered reader that pulls in data from an io.Reader in chunks of psize bytes.
func (*FixedReader) Close ¶ added in v0.7.0
func (b *FixedReader) Close() error
Close closes the underlying reader.
Subsequent Read calls will succeed as long as the internal buffer still has data. If the buffer is drained, Read returns an error.
type ForkReader ¶ added in v0.9.0
type ForkReader struct {
// contains filtered or unexported fields
}
func NewForkReader ¶ added in v0.9.0
func NewForkReader(command string, arguments []string) (*ForkReader, error)
func (*ForkReader) Close ¶ added in v0.9.0
func (f *ForkReader) Close() error
type MpegTsPacket ¶ added in v0.7.0
type MpegTsPacket []byte
MpegTsPacket is an alias to a byte slice and represents one TS packet. It is 188 bytes long and starts with 0x47.
func ReadMpegTsPacket ¶ added in v0.7.0
func ReadMpegTsPacket(reader io.Reader) (MpegTsPacket, error)
ReadMpegTsPacket reads data from the input stream, scans for the sync byte and returns one packet from that point on.
If a sync byte can't be found among the first 188 bytes, no packets are returned