Documentation ¶
Index ¶
- Variables
- func SplitAnnexB[T ~[]byte](frame T, process func(T), delimiter []byte)
- type AVFrame
- type AVTrack
- type AudioTrack
- type Base
- func (bt *Base[T, F]) ComputeBPS(bytes int)
- func (bt *Base[T, F]) Dispose()
- func (bt *Base[T, F]) GetBPS() int
- func (bt *Base[T, F]) GetDrops() int
- func (bt *Base[T, F]) GetFPS() int
- func (bt *Base[T, F]) GetName() string
- func (bt *Base[T, F]) GetRBSize() int
- func (bt *Base[T, F]) SetStuff(stuff ...any)
- func (bt *Base[T, F]) SnapForJson()
- type DTSEstimator
- type DataFrame
- func (df *DataFrame[T]) Discard() int32
- func (df *DataFrame[T]) GetSequence() uint32
- func (df *DataFrame[T]) Init()
- func (df *DataFrame[T]) IsDiscarded() bool
- func (df *DataFrame[T]) IsWriting() bool
- func (df *DataFrame[T]) ReaderCount() int32
- func (df *DataFrame[T]) ReaderEnter() int32
- func (df *DataFrame[T]) ReaderLeave() int32
- func (df *DataFrame[T]) Ready()
- func (df *DataFrame[T]) Reset()
- func (df *DataFrame[T]) SetSequence(sequence uint32)
- func (df *DataFrame[T]) StartWrite() bool
- type IDataFrame
- type IStream
- type ParamaterSets
- type RTPFrame
- type RingWriter
- func (rb *RingWriter[T, F]) GetReaderCount() int32
- func (rb *RingWriter[T, F]) Glow(size int) (newItem *util.Ring[F])
- func (rb *RingWriter[T, F]) Init(n int, constructor func() F) *RingWriter[T, F]
- func (rb *RingWriter[T, F]) Recycle(r *util.Ring[F])
- func (rb *RingWriter[T, F]) Reduce(size int)
- func (rb *RingWriter[T, F]) Step() (normal bool)
- type TimelineData
- type Track
- type TrackState
- type VideoTrack
Constants ¶
This section is empty.
Variables ¶
View Source
var EmptyLocker emptyLocker
Functions ¶
func SplitAnnexB ¶
Types ¶
type AVFrame ¶
type AVFrame struct { DataFrame[any] IFrame bool PTS time.Duration DTS time.Duration Timestamp time.Duration // 绝对时间戳 ADTS *util.ListItem[util.Buffer] `json:"-" yaml:"-"` // ADTS头 AVCC util.BLL `json:"-" yaml:"-"` // 打包好的AVCC格式(MPEG-4格式、Byte-Stream Format) RTP util.List[RTPFrame] `json:"-" yaml:"-"` AUList util.BLLs `json:"-" yaml:"-"` // 裸数据 }
func NewAVFrame ¶
func NewAVFrame() *AVFrame
type AVTrack ¶
type AVTrack interface { Track PreFrame() *AVFrame CurrentFrame() *AVFrame Attach() Detach() WriteAVCC(ts uint32, frame *util.BLL) error //写入AVCC格式的数据 WriteRTP(*util.ListItem[RTPFrame]) WriteRTPPack(*rtp.Packet) WriteSequenceHead(sh []byte) error Flush() SetSpeedLimit(time.Duration) GetRTPFromPool() *util.ListItem[RTPFrame] GetFromPool(util.IBytes) *util.ListItem[util.Buffer] }
type AudioTrack ¶
type Base ¶
type Base[T any, F IDataFrame[T]] struct { RingWriter[T, F] Name string log.Zap `json:"-" yaml:"-"` Stream IStream `json:"-" yaml:"-"` Attached atomic.Bool `json:"-" yaml:"-"` State TrackState DropCount int `json:"-" yaml:"-"` //丢帧数 BPS int FPS int Drops int // 丢帧率 RawSize int // 裸数据长度 RawPart []int // 裸数据片段用于UI上显示 // contains filtered or unexported fields }
Base 基础Track类
func (*Base[T, F]) ComputeBPS ¶
func (*Base[T, F]) SnapForJson ¶
func (bt *Base[T, F]) SnapForJson()
type DTSEstimator ¶
type DTSEstimator struct {
// contains filtered or unexported fields
}
DTSEstimator is a DTS estimator.
func NewDTSEstimator ¶
func NewDTSEstimator() *DTSEstimator
NewDTSEstimator allocates a DTSEstimator.
func (*DTSEstimator) Clone ¶
func (d *DTSEstimator) Clone() *DTSEstimator
func (*DTSEstimator) Feed ¶
func (d *DTSEstimator) Feed(pts uint32) uint32
Feed provides PTS to the estimator, and returns the estimated DTS.
type DataFrame ¶
type DataFrame[T any] struct { DeltaTime uint32 // 相对上一帧时间戳,毫秒 WriteTime time.Time // 写入时间,可用于比较两个帧的先后 Sequence uint32 // 在一个Track中的序号 BytesIn int // 输入字节数用于计算BPS CanRead bool `json:"-" yaml:"-"` // 是否可读取 Data T `json:"-" yaml:"-"` sync.Cond `json:"-" yaml:"-"` // contains filtered or unexported fields }
func NewDataFrame ¶
func (*DataFrame[T]) GetSequence ¶
func (*DataFrame[T]) IsDiscarded ¶
func (*DataFrame[T]) ReaderCount ¶
func (*DataFrame[T]) ReaderEnter ¶
func (*DataFrame[T]) ReaderLeave ¶
func (*DataFrame[T]) SetSequence ¶
func (*DataFrame[T]) StartWrite ¶
type IDataFrame ¶
type IDataFrame[T any] interface { Init() // 初始化 Reset() // 重置数据,复用内存 Ready() // 标记为可读取 ReaderEnter() int32 // 读取者数量+1 ReaderLeave() int32 // 读取者数量-1 StartWrite() bool // 开始写入 SetSequence(uint32) // 设置序号 GetSequence() uint32 // 获取序号 ReaderCount() int32 // 读取者数量 Discard() int32 // 如果写入时还有读取者没有离开则废弃该帧,剥离RingBuffer,防止并发读写 IsDiscarded() bool // 是否已废弃 IsWriting() bool // 是否正在写入 Wait() // 阻塞等待可读取 Broadcast() // 广播可读取 }
type ParamaterSets ¶
type ParamaterSets [][]byte
func (ParamaterSets) GetAnnexB ¶
func (v ParamaterSets) GetAnnexB() (r net.Buffers)
func (ParamaterSets) WriteAnnexBTo ¶
func (v ParamaterSets) WriteAnnexBTo(w io.Writer) (n int, err error)
type RTPFrame ¶
func (*RTPFrame) H264Type ¶
func (r *RTPFrame) H264Type() (naluType codec.H264NALUType)
func (*RTPFrame) H265Type ¶
func (r *RTPFrame) H265Type() (naluType codec.H265NALUType)
type RingWriter ¶
type RingWriter[T any, F IDataFrame[T]] struct { *util.Ring[F] `json:"-" yaml:"-"` ReaderCount atomic.Int32 `json:"-" yaml:"-"` Size int LastValue F // contains filtered or unexported fields }
func (*RingWriter[T, F]) GetReaderCount ¶
func (rb *RingWriter[T, F]) GetReaderCount() int32
func (*RingWriter[T, F]) Init ¶
func (rb *RingWriter[T, F]) Init(n int, constructor func() F) *RingWriter[T, F]
func (*RingWriter[T, F]) Recycle ¶
func (rb *RingWriter[T, F]) Recycle(r *util.Ring[F])
func (*RingWriter[T, F]) Reduce ¶
func (rb *RingWriter[T, F]) Reduce(size int)
func (*RingWriter[T, F]) Step ¶
func (rb *RingWriter[T, F]) Step() (normal bool)
type TimelineData ¶
type TrackState ¶
type TrackState byte
const ( TrackStateOnline TrackState = iota // 上线 TrackStateOffline // 下线 )
Click to show internal directories.
Click to hide internal directories.