Documentation ¶
Overview ¶
Package bits - bit reading and writing including Golomb codes and EBSP.
Beyond plain bit reading and writing, reading of ebsp (Encapsulated Byte Sequence Packets) Golomb codes as used in the AVC/H.264 and HEVC video coding standards.
Index ¶
- Variables
- func EBSP2rbsp(ebsp []byte) []byte
- type AccErrByteWriter
- func (a *AccErrByteWriter) AccError() error
- func (a *AccErrByteWriter) WriteSlice(s []byte)
- func (a *AccErrByteWriter) WriteUint16(u uint16)
- func (a *AccErrByteWriter) WriteUint32(u uint32)
- func (a *AccErrByteWriter) WriteUint48(u uint64)
- func (a *AccErrByteWriter) WriteUint64(u uint64)
- func (a *AccErrByteWriter) WriteUint8(b byte)
- type AccErrEBSPReader
- func (r *AccErrEBSPReader) AccError() error
- func (r *AccErrEBSPReader) IsSeeker() bool
- func (r *AccErrEBSPReader) MoreRbspData() (bool, error)
- func (r *AccErrEBSPReader) NrBitsReadInCurrentByte() int
- func (r *AccErrEBSPReader) NrBytesRead() int
- func (r *AccErrEBSPReader) Read(n int) uint
- func (r *AccErrEBSPReader) ReadBytes(n int) []byte
- func (r *AccErrEBSPReader) ReadExpGolomb() uint
- func (r *AccErrEBSPReader) ReadFlag() bool
- func (r *AccErrEBSPReader) ReadRbspTrailingBits() error
- func (r *AccErrEBSPReader) ReadSignedGolomb() int
- func (r *AccErrEBSPReader) SetError(err error)
- type AccErrReader
- type EBSPReader
- func (r *EBSPReader) IsSeeker() bool
- func (r *EBSPReader) MoreRbspData() (bool, error)
- func (r *EBSPReader) MustRead(n int) uint
- func (r *EBSPReader) MustReadExpGolomb() uint
- func (r *EBSPReader) MustReadFlag() bool
- func (r *EBSPReader) MustReadSignedGolomb() int
- func (r *EBSPReader) NrBitsReadInCurrentByte() int
- func (r *EBSPReader) NrBytesRead() int
- func (r *EBSPReader) Read(n int) (uint, error)
- func (r *EBSPReader) ReadExpGolomb() (uint, error)
- func (r *EBSPReader) ReadFlag() (bool, error)
- func (r *EBSPReader) ReadRbspTrailingBits() error
- func (r *EBSPReader) ReadSignedGolomb() (int, error)
- type EBSPWriter
- func (w *EBSPWriter) AccError() error
- func (w *EBSPWriter) BitsInBuffer() (bits, n uint)
- func (w *EBSPWriter) NrBitsInBuffer() uint
- func (w *EBSPWriter) StuffByteWithZeros()
- func (w *EBSPWriter) Write(bits uint, n int)
- func (w *EBSPWriter) WriteExpGolomb(nr uint)
- func (w *EBSPWriter) WriteRbspTrailingBits()
- func (w *EBSPWriter) WriteSEIValue(val uint)
- type FixedSliceReader
- func (s *FixedSliceReader) AccError() error
- func (s *FixedSliceReader) GetPos() int
- func (s *FixedSliceReader) Length() int
- func (s *FixedSliceReader) NrRemainingBytes() int
- func (s *FixedSliceReader) ReadBytes(n int) []byte
- func (s *FixedSliceReader) ReadFixedLengthString(n int) string
- func (s *FixedSliceReader) ReadInt16() int16
- func (s *FixedSliceReader) ReadInt32() int32
- func (s *FixedSliceReader) ReadInt64() int64
- func (s *FixedSliceReader) ReadUint16() uint16
- func (s *FixedSliceReader) ReadUint24() uint32
- func (s *FixedSliceReader) ReadUint32() uint32
- func (s *FixedSliceReader) ReadUint64() uint64
- func (s *FixedSliceReader) ReadUint8() byte
- func (s *FixedSliceReader) ReadZeroTerminatedString(maxLen int) string
- func (s *FixedSliceReader) RemainingBytes() []byte
- func (s *FixedSliceReader) SetPos(pos int)
- func (s *FixedSliceReader) SkipBytes(n int)
- type FixedSliceWriter
- func (sw *FixedSliceWriter) AccError() error
- func (sw *FixedSliceWriter) Bytes() []byte
- func (sw *FixedSliceWriter) Capacity() int
- func (sw *FixedSliceWriter) FlushBits()
- func (sw *FixedSliceWriter) Len() int
- func (sw *FixedSliceWriter) Offset() int
- func (sw *FixedSliceWriter) WriteBits(bits uint, n int)
- func (sw *FixedSliceWriter) WriteBytes(byteSlice []byte)
- func (sw *FixedSliceWriter) WriteFlag(f bool)
- func (sw *FixedSliceWriter) WriteInt16(n int16)
- func (sw *FixedSliceWriter) WriteInt32(n int32)
- func (sw *FixedSliceWriter) WriteInt64(n int64)
- func (sw *FixedSliceWriter) WriteString(s string, addZeroEnd bool)
- func (sw *FixedSliceWriter) WriteUint16(n uint16)
- func (sw *FixedSliceWriter) WriteUint24(n uint32)
- func (sw *FixedSliceWriter) WriteUint32(n uint32)
- func (sw *FixedSliceWriter) WriteUint48(u uint64)
- func (sw *FixedSliceWriter) WriteUint64(n uint64)
- func (sw *FixedSliceWriter) WriteUint8(n byte)
- func (sw *FixedSliceWriter) WriteUnityMatrix()
- func (sw *FixedSliceWriter) WriteZeroBytes(n int)
- type Reader
- type SliceReader
- type SliceWriter
- type Writer
Constants ¶
This section is empty.
Variables ¶
var (
ErrNotReedSeeker = errors.New("Reader does not support Seek")
)
ESBPReader errors
var (
ErrSliceRead = fmt.Errorf("Read too far in SliceReader")
)
SliceReader errors
var SliceWriterError = errors.New("overflow in SliceWriter")
Functions ¶
Types ¶
type AccErrByteWriter ¶ added in v0.17.0
type AccErrByteWriter struct {
// contains filtered or unexported fields
}
AccErrByteWriter - writer that wraps an io.Writer and accumulates error
func NewAccErrByteWriter ¶ added in v0.17.0
func NewAccErrByteWriter(w io.Writer) *AccErrByteWriter
NewAccErrByteWriter - create accumulated error writer around io.Writer
func (*AccErrByteWriter) AccError ¶ added in v0.17.0
func (a *AccErrByteWriter) AccError() error
AccError - return accumulated error
func (*AccErrByteWriter) WriteSlice ¶ added in v0.17.0
func (a *AccErrByteWriter) WriteSlice(s []byte)
WriteSlice - write a slice
func (*AccErrByteWriter) WriteUint16 ¶ added in v0.17.0
func (a *AccErrByteWriter) WriteUint16(u uint16)
WriteUint16 - write uint16
func (*AccErrByteWriter) WriteUint32 ¶ added in v0.17.0
func (a *AccErrByteWriter) WriteUint32(u uint32)
WriteUint32 - write uint32
func (*AccErrByteWriter) WriteUint48 ¶ added in v0.17.0
func (a *AccErrByteWriter) WriteUint48(u uint64)
WriteUint48 - write uint48
func (*AccErrByteWriter) WriteUint64 ¶ added in v0.17.0
func (a *AccErrByteWriter) WriteUint64(u uint64)
WriteUint64 - write uint64
func (*AccErrByteWriter) WriteUint8 ¶ added in v0.17.0
func (a *AccErrByteWriter) WriteUint8(b byte)
WriteUint8 - write a byte
type AccErrEBSPReader ¶ added in v0.17.0
type AccErrEBSPReader struct {
// contains filtered or unexported fields
}
AccErrEBSPReader - Reader that drops start code emulation 0x03 after two bytes of 0x00
func NewAccErrEBSPReader ¶ added in v0.17.0
func NewAccErrEBSPReader(rd io.Reader) *AccErrEBSPReader
NewAccErrEBSPReader - return a new reader accumulating errors.
func (*AccErrEBSPReader) AccError ¶ added in v0.17.0
func (r *AccErrEBSPReader) AccError() error
AccError - accumulated error
func (*AccErrEBSPReader) IsSeeker ¶ added in v0.17.0
func (r *AccErrEBSPReader) IsSeeker() bool
IsSeeker - does reader support Seek
func (*AccErrEBSPReader) MoreRbspData ¶ added in v0.17.0
func (r *AccErrEBSPReader) MoreRbspData() (bool, error)
MoreRbspData - false if next bit is 1 and last 1 in fullSlice. Underlying reader must support ReadSeeker interface to reset after check Return false, nil if underlying error
func (*AccErrEBSPReader) NrBitsReadInCurrentByte ¶ added in v0.17.0
func (r *AccErrEBSPReader) NrBitsReadInCurrentByte() int
NrBitsReadInCurrentByte - how many bits have been read
func (*AccErrEBSPReader) NrBytesRead ¶ added in v0.17.0
func (r *AccErrEBSPReader) NrBytesRead() int
NrBytesRead - how many bytes read into parser
func (*AccErrEBSPReader) Read ¶ added in v0.17.0
func (r *AccErrEBSPReader) Read(n int) uint
Read - read n bits and return 0 if (previous) error
func (*AccErrEBSPReader) ReadBytes ¶ added in v0.26.0
func (r *AccErrEBSPReader) ReadBytes(n int) []byte
Read - read n bytes and return nil if (previous) error or if n bytes not available
func (*AccErrEBSPReader) ReadExpGolomb ¶ added in v0.17.0
func (r *AccErrEBSPReader) ReadExpGolomb() uint
ReadExpGolomb - Read one unsigned exponential golomb code. Return 0 if error
func (*AccErrEBSPReader) ReadFlag ¶ added in v0.17.0
func (r *AccErrEBSPReader) ReadFlag() bool
ReadFlag - read 1 bit into bool. Return false if not possible
func (*AccErrEBSPReader) ReadRbspTrailingBits ¶ added in v0.17.0
func (r *AccErrEBSPReader) ReadRbspTrailingBits() error
ReadRbspTrailingBits - read rbsp_traling_bits. Return error if wrong pattern If other error, return nil and let AccError provide that error
func (*AccErrEBSPReader) ReadSignedGolomb ¶ added in v0.17.0
func (r *AccErrEBSPReader) ReadSignedGolomb() int
ReadSignedGolomb - Read one signed exponential golomb code. Return 0 if error
func (*AccErrEBSPReader) SetError ¶ added in v0.28.0
func (r *AccErrEBSPReader) SetError(err error)
SetError - set an error if not already set.
type AccErrReader ¶ added in v0.16.0
type AccErrReader struct {
// contains filtered or unexported fields
}
AccErrReader - bit reader that accumulates error First error can be fetched as reader.AccError()
func NewAccErrReader ¶ added in v0.16.0
func NewAccErrReader(rd io.Reader) *AccErrReader
NewAccErrReader - return a new Reader
func (*AccErrReader) AccError ¶ added in v0.16.0
func (r *AccErrReader) AccError() error
AccError - accumulated error is first error that occurred
func (*AccErrReader) Read ¶ added in v0.16.0
func (r *AccErrReader) Read(n int) uint
Read - read n bits. Return 0, if error now or previously
func (*AccErrReader) ReadFlag ¶ added in v0.16.0
func (r *AccErrReader) ReadFlag() bool
ReadFlag - read 1 bit into flag. Return false if error now or previously
func (*AccErrReader) ReadRemainingBytes ¶ added in v0.27.0
func (r *AccErrReader) ReadRemainingBytes() []byte
ReadRemainingBytes - read remaining bytes if byte-aligned
func (*AccErrReader) ReadVInt ¶ added in v0.26.0
func (r *AccErrReader) ReadVInt(n int) int
ReadFlag - Read i(v) which is 2-complement of n bits
type EBSPReader ¶
type EBSPReader struct {
// contains filtered or unexported fields
}
EBSPReader - Reader that drops start code emulation 0x03 after two bytes of 0x00
func NewEBSPReader ¶
func NewEBSPReader(rd io.Reader) *EBSPReader
NewEBSPReader - return a new Reader.
func (*EBSPReader) IsSeeker ¶ added in v0.12.0
func (r *EBSPReader) IsSeeker() bool
IsSeeker - does reader support Seek
func (*EBSPReader) MoreRbspData ¶ added in v0.12.0
func (r *EBSPReader) MoreRbspData() (bool, error)
MoreRbspData - false if next bit is 1 and last 1 in fullSlice Underlying reader must support ReadSeeker interface to reset after check
func (*EBSPReader) MustRead ¶
func (r *EBSPReader) MustRead(n int) uint
MustRead - read n bits and panic if not possible
func (*EBSPReader) MustReadExpGolomb ¶
func (r *EBSPReader) MustReadExpGolomb() uint
MustReadExpGolomb - Read one unsigned exponential golomb code. Panic if not possible
func (*EBSPReader) MustReadFlag ¶
func (r *EBSPReader) MustReadFlag() bool
MustReadFlag - read 1 bit into flag. Panic if not possible
func (*EBSPReader) MustReadSignedGolomb ¶
func (r *EBSPReader) MustReadSignedGolomb() int
MustReadSignedGolomb - Read one signed exponential golomb code. Panic if not possible
func (*EBSPReader) NrBitsReadInCurrentByte ¶ added in v0.12.0
func (r *EBSPReader) NrBitsReadInCurrentByte() int
NrBitsReadInCurrentByte - how many bits have been read
func (*EBSPReader) NrBytesRead ¶
func (r *EBSPReader) NrBytesRead() int
NrBytesRead - how many bytes read into parser
func (*EBSPReader) Read ¶
func (r *EBSPReader) Read(n int) (uint, error)
Read - read n bits and return error if not possible
func (*EBSPReader) ReadExpGolomb ¶
func (r *EBSPReader) ReadExpGolomb() (uint, error)
ReadExpGolomb - Read one unsigned exponential golomb code
func (*EBSPReader) ReadFlag ¶
func (r *EBSPReader) ReadFlag() (bool, error)
ReadFlag - read 1 bit into flag. Return error if not possible
func (*EBSPReader) ReadRbspTrailingBits ¶ added in v0.12.0
func (r *EBSPReader) ReadRbspTrailingBits() error
ReadRbspTrailingBits - read rbsp_traling_bits. Return false if wrong pattern
func (*EBSPReader) ReadSignedGolomb ¶
func (r *EBSPReader) ReadSignedGolomb() (int, error)
ReadSignedGolomb - Read one signed exponential golomb code
type EBSPWriter ¶ added in v0.15.0
type EBSPWriter struct {
// contains filtered or unexported fields
}
EBSPWriter - write bits and insert start-code emulation prevention bytes as necessary. Cease writing at first error. Errors that have occurred can later be checked with AccError().
func NewEBSPWriter ¶ added in v0.15.0
func NewEBSPWriter(w io.Writer) *EBSPWriter
NewEBSPWriter - returns a new Writer
func (*EBSPWriter) AccError ¶ added in v0.28.0
func (w *EBSPWriter) AccError() error
AccError - return accumulated error
func (*EBSPWriter) BitsInBuffer ¶ added in v0.28.0
func (w *EBSPWriter) BitsInBuffer() (bits, n uint)
BitsInBuffer - n bits written in buffer byte, not written to underlying writer
func (*EBSPWriter) NrBitsInBuffer ¶ added in v0.28.0
func (w *EBSPWriter) NrBitsInBuffer() uint
NrBitsInBuffer - number bits written in buffer byte
func (*EBSPWriter) StuffByteWithZeros ¶ added in v0.15.0
func (w *EBSPWriter) StuffByteWithZeros()
StuffByteWithZeros - write zero bits until byte boundary (0-7bits)
func (*EBSPWriter) Write ¶ added in v0.15.0
func (w *EBSPWriter) Write(bits uint, n int)
Write - write n bits from bits and save error state
func (*EBSPWriter) WriteExpGolomb ¶ added in v0.28.0
func (w *EBSPWriter) WriteExpGolomb(nr uint)
WriteExpGolomb - write an exponential Golomb code
func (*EBSPWriter) WriteRbspTrailingBits ¶ added in v0.15.0
func (w *EBSPWriter) WriteRbspTrailingBits()
WriteRbspTrailingBits - write rbsp trailing bits (a 1 followed by zeros to a byte boundary)
func (*EBSPWriter) WriteSEIValue ¶ added in v0.30.0
func (w *EBSPWriter) WriteSEIValue(val uint)
WriteSEIValue insert 0xFF until value is less than 255. Used in SEI payload type and size.
type FixedSliceReader ¶ added in v0.27.0
type FixedSliceReader struct {
// contains filtered or unexported fields
}
FixedSliceReader - read integers and other data from a fixed slice. Accumulates error, and the first error can be retrieved. If err != nil, 0 or empty string is returned
func NewFixedSliceReader ¶ added in v0.27.0
func NewFixedSliceReader(data []byte) *FixedSliceReader
bits.NewFixedSliceReader - create a new slice reader reading from data
func NewFixedSliceReaderWithSize ¶ added in v0.27.0
func NewFixedSliceReaderWithSize(size int) *FixedSliceReader
bits.NewFixedSliceReader - create a new slice reader reading from data
func (*FixedSliceReader) AccError ¶ added in v0.27.0
func (s *FixedSliceReader) AccError() error
AccError - get accumulated error after read operations
func (*FixedSliceReader) GetPos ¶ added in v0.27.0
func (s *FixedSliceReader) GetPos() int
GetPos - get read position is slice
func (*FixedSliceReader) Length ¶ added in v0.27.0
func (s *FixedSliceReader) Length() int
Length - get length of slice
func (*FixedSliceReader) NrRemainingBytes ¶ added in v0.27.0
func (s *FixedSliceReader) NrRemainingBytes() int
NrRemainingBytes - return number of bytes remaining
func (*FixedSliceReader) ReadBytes ¶ added in v0.27.0
func (s *FixedSliceReader) ReadBytes(n int) []byte
ReadBytes - read a slice of n bytes Return empty slice if n bytes not available
func (*FixedSliceReader) ReadFixedLengthString ¶ added in v0.27.0
func (s *FixedSliceReader) ReadFixedLengthString(n int) string
ReadFixedLengthString - read string of specified length n. Sets err and returns empty string if full length not available
func (*FixedSliceReader) ReadInt16 ¶ added in v0.27.0
func (s *FixedSliceReader) ReadInt16() int16
ReadInt16 - read int16 from slice
func (*FixedSliceReader) ReadInt32 ¶ added in v0.27.0
func (s *FixedSliceReader) ReadInt32() int32
ReadInt32 - read int32 from slice
func (*FixedSliceReader) ReadInt64 ¶ added in v0.27.0
func (s *FixedSliceReader) ReadInt64() int64
ReadInt64 - read int64 from slice
func (*FixedSliceReader) ReadUint16 ¶ added in v0.27.0
func (s *FixedSliceReader) ReadUint16() uint16
ReadUint16 - read uint16 from slice
func (*FixedSliceReader) ReadUint24 ¶ added in v0.27.0
func (s *FixedSliceReader) ReadUint24() uint32
ReadUint24 - read uint24 from slice
func (*FixedSliceReader) ReadUint32 ¶ added in v0.27.0
func (s *FixedSliceReader) ReadUint32() uint32
ReadUint32 - read uint32 from slice
func (*FixedSliceReader) ReadUint64 ¶ added in v0.27.0
func (s *FixedSliceReader) ReadUint64() uint64
ReadUint64 - read uint64 from slice
func (*FixedSliceReader) ReadUint8 ¶ added in v0.27.0
func (s *FixedSliceReader) ReadUint8() byte
ReadUint8 - read uint8 from slice
func (*FixedSliceReader) ReadZeroTerminatedString ¶ added in v0.27.0
func (s *FixedSliceReader) ReadZeroTerminatedString(maxLen int) string
ReadZeroTerminatedString - read string until zero byte but at most maxLen Set err and return empty string if no zero byte found
func (*FixedSliceReader) RemainingBytes ¶ added in v0.27.0
func (s *FixedSliceReader) RemainingBytes() []byte
RemainingBytes - return remaining bytes of this slice
func (*FixedSliceReader) SetPos ¶ added in v0.27.0
func (s *FixedSliceReader) SetPos(pos int)
SetPos - set read position is slice
func (*FixedSliceReader) SkipBytes ¶ added in v0.27.0
func (s *FixedSliceReader) SkipBytes(n int)
SkipBytes - skip passed n bytes
type FixedSliceWriter ¶ added in v0.27.0
type FixedSliceWriter struct {
// contains filtered or unexported fields
}
FixedSliceWriter - write numbers to a fixed []byte slice
func NewFixedSliceWriter ¶ added in v0.27.0
func NewFixedSliceWriter(size int) *FixedSliceWriter
NewSliceWriter - create slice writer with fixed size.
func NewFixedSliceWriterFromSlice ¶ added in v0.27.0
func NewFixedSliceWriterFromSlice(data []byte) *FixedSliceWriter
NewFixedSliceWriter - create writer around slice. The slice will not grow, but stay the same size. If too much data is written, there will be an accumuluated error. Can be retrieved with AccError()
func (*FixedSliceWriter) AccError ¶ added in v0.27.0
func (sw *FixedSliceWriter) AccError() error
AccError - return accumulated erro
func (*FixedSliceWriter) Bytes ¶ added in v0.27.0
func (sw *FixedSliceWriter) Bytes() []byte
Bytes - return buf up to what's written
func (*FixedSliceWriter) Capacity ¶ added in v0.27.0
func (sw *FixedSliceWriter) Capacity() int
Capacity - max length of FixedSliceWriter buffer
func (*FixedSliceWriter) FlushBits ¶ added in v0.27.0
func (sw *FixedSliceWriter) FlushBits()
FlushBits - write remaining bits to the underlying .Writer. bits will be left-shifted.
func (*FixedSliceWriter) Len ¶ added in v0.27.0
func (sw *FixedSliceWriter) Len() int
Len - length of FixedSliceWriter buffer written. Same as Offset()
func (*FixedSliceWriter) Offset ¶ added in v0.27.0
func (sw *FixedSliceWriter) Offset() int
Offset - offset for writing in FixedSliceWriter buffer
func (*FixedSliceWriter) WriteBits ¶ added in v0.27.0
func (sw *FixedSliceWriter) WriteBits(bits uint, n int)
func (*FixedSliceWriter) WriteBytes ¶ added in v0.27.0
func (sw *FixedSliceWriter) WriteBytes(byteSlice []byte)
WriteBytes - write []byte
func (*FixedSliceWriter) WriteFlag ¶ added in v0.30.0
func (sw *FixedSliceWriter) WriteFlag(f bool)
WriteFlag writes a flag as 1 bit.
func (*FixedSliceWriter) WriteInt16 ¶ added in v0.27.0
func (sw *FixedSliceWriter) WriteInt16(n int16)
WriteInt16 - write int16 to slice
func (*FixedSliceWriter) WriteInt32 ¶ added in v0.27.0
func (sw *FixedSliceWriter) WriteInt32(n int32)
WriteInt32 - write int32 to slice
func (*FixedSliceWriter) WriteInt64 ¶ added in v0.27.0
func (sw *FixedSliceWriter) WriteInt64(n int64)
WriteInt64 - write int64 to slice
func (*FixedSliceWriter) WriteString ¶ added in v0.27.0
func (sw *FixedSliceWriter) WriteString(s string, addZeroEnd bool)
WriteString - write string to slice with or without zero end
func (*FixedSliceWriter) WriteUint16 ¶ added in v0.27.0
func (sw *FixedSliceWriter) WriteUint16(n uint16)
WriteUint16 - write uint16 to slice
func (*FixedSliceWriter) WriteUint24 ¶ added in v0.27.0
func (sw *FixedSliceWriter) WriteUint24(n uint32)
WriteUint24 - write uint24 to slice
func (*FixedSliceWriter) WriteUint32 ¶ added in v0.27.0
func (sw *FixedSliceWriter) WriteUint32(n uint32)
WriteUint32 - write uint32 to slice
func (*FixedSliceWriter) WriteUint48 ¶ added in v0.27.0
func (sw *FixedSliceWriter) WriteUint48(u uint64)
WriteUint48 - write uint48
func (*FixedSliceWriter) WriteUint64 ¶ added in v0.27.0
func (sw *FixedSliceWriter) WriteUint64(n uint64)
WriteUint64 - write uint64 to slice
func (*FixedSliceWriter) WriteUint8 ¶ added in v0.27.0
func (sw *FixedSliceWriter) WriteUint8(n byte)
WriteUint8 - write byte to slice
func (*FixedSliceWriter) WriteUnityMatrix ¶ added in v0.27.0
func (sw *FixedSliceWriter) WriteUnityMatrix()
WriteUnityMatrix - write a unity matrix for mvhd or tkhd
func (*FixedSliceWriter) WriteZeroBytes ¶ added in v0.27.0
func (sw *FixedSliceWriter) WriteZeroBytes(n int)
WriteZeroBytes - write n byte of zeroes
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader - read bits from the given io.Reader
func (*Reader) MustReadFlag ¶
MustReadFlag - read 1 bit into flag and panic if not possible
type SliceReader ¶ added in v0.17.0
type SliceReader interface { AccError() error ReadUint8() byte ReadUint16() uint16 ReadInt16() int16 ReadUint24() uint32 ReadUint32() uint32 ReadInt32() int32 ReadUint64() uint64 ReadInt64() int64 ReadFixedLengthString(n int) string ReadZeroTerminatedString(maxLen int) string ReadBytes(n int) []byte RemainingBytes() []byte NrRemainingBytes() int SkipBytes(n int) SetPos(pos int) GetPos() int Length() int }
type SliceWriter ¶ added in v0.27.0
type SliceWriter interface { Len() int Capacity() int Offset() int Bytes() []byte AccError() error WriteUint8(n byte) WriteUint16(n uint16) WriteInt16(n int16) WriteUint24(n uint32) WriteUint32(n uint32) WriteInt32(n int32) WriteUint48(u uint64) WriteUint64(n uint64) WriteInt64(n int64) WriteString(s string, addZeroEnd bool) WriteZeroBytes(n int) WriteBytes(byteSlice []byte) WriteUnityMatrix() WriteBits(bits uint, n int) FlushBits() }
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer writes bits into underlying io.Writer. Stops writing at first error. Errors that have occurred can later be checked with Error().