Documentation
¶
Index ¶
- Constants
- Variables
- type AAC
- type AV1
- type AVRingReader
- type Audio
- func (a *Audio) Attach()
- func (a *Audio) CompleteAVCC(value *common.AVFrame)
- func (a *Audio) CompleteRTP(value *common.AVFrame)
- func (a *Audio) Detach()
- func (av *Audio) Flush()
- func (a *Audio) GetCodec() codec.AudioCodecID
- func (a *Audio) GetName() string
- func (a *Audio) Narrow()
- func (av *Audio) WriteADTS(pts uint32, adts util.IBytes)
- func (av *Audio) WriteAVCC(ts uint32, frame *util.BLL)
- func (av *Audio) WriteRawBytes(pts uint32, raw util.IBytes)
- func (av *Audio) WriteSequenceHead(sh []byte) error
- 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]) GetPublisher() common.IPuber
- func (bt *Base[T, F]) GetRBSize() int
- func (bt *Base[T, F]) SetStuff(stuff ...any)
- func (bt *Base[T, F]) SnapForJson()
- type BytesData
- type Channel
- type Data
- type DataReader
- type G711
- type H264
- type H265
- func (vt *H265) CompleteAVCC(rv *common.AVFrame)
- func (vt *H265) CompleteRTP(value *common.AVFrame)
- func (vt *H265) GetNALU_SEI() (item util.LIBP)
- func (vt *H265) WriteRTPFrame(rtpItem *common.LIRTP)
- func (vt *H265) WriteSequenceHead(head []byte) (err error)
- func (vt *H265) WriteSliceBytes(slice []byte)
- type IDRingList
- type Media
- func (av *Media) AddIDR()
- func (av *Media) AppendAuBytes(b ...[]byte)
- func (av *Media) CurrentFrame() *common.AVFrame
- func (av *Media) Flush()
- func (av *Media) GetFromPool(b util.IBytes) (item util.LIBP)
- func (av *Media) GetRTPFromPool() (result *common.LIRTP)
- func (av *Media) LastWriteTime() time.Time
- func (av *Media) PacketizeRTP(payloads ...[][]byte)
- func (av *Media) PreFrame() *common.AVFrame
- func (av *Media) SetSpeedLimit(value time.Duration)
- func (av *Media) SetStuff(stuff ...any)
- func (av *Media) SnapForJson()
- func (av *Media) WriteRTP(raw *common.LIRTP)
- func (av *Media) WriteRTPPack(p *rtp.Packet)
- func (av *Media) WriteSequenceHead(sh []byte)
- type Opus
- type RTPDemuxer
- type RecycleData
- type RingReader
- type SpesificTrack
- type Video
- func (v *Video) Attach()
- func (vt *Video) CompleteAVCC(rv *common.AVFrame)
- func (v *Video) Detach()
- func (vt *Video) Flush()
- func (vt *Video) GetCodec() codec.VideoCodecID
- func (vt *Video) GetName() string
- func (vt *Video) SetLostFlag()
- func (vt *Video) WriteAVCC(ts uint32, frame *util.BLL) (err error)
- func (vt *Video) WriteAnnexB(pts uint32, dts uint32, frame []byte)
- func (vt *Video) WriteNalu(pts uint32, dts uint32, nalu []byte)
- func (vt *Video) WriteSequenceHead(sh []byte)
- func (vt *Video) WriteSliceByte(b ...byte)
Constants ¶
View Source
const ( READSTATE_INIT = iota READSTATE_FIRST READSTATE_NORMAL )
View Source
const ( SUBMODE_REAL = iota SUBMODE_NOJUMP SUBMODE_BUFFER )
View Source
const RTPMTU = 1400
Variables ¶
View Source
var ErrDiscard = errors.New("discard")
Functions ¶
This section is empty.
Types ¶
type AV1 ¶
type AV1 struct { Video // contains filtered or unexported fields }
func (*AV1) CompleteAVCC ¶
func (*AV1) WriteRTPFrame ¶
func (*AV1) WriteSequenceHead ¶
type AVRingReader ¶
type AVRingReader struct { RingReader[any, *common.AVFrame] Track *Media State byte FirstSeq uint32 StartTs time.Duration FirstTs time.Duration SkipTs time.Duration //ms ConfSeq int AbsTime uint32 Delay uint32 *log.Logger // contains filtered or unexported fields }
func NewAVRingReader ¶
func NewAVRingReader(t *Media) *AVRingReader
func (*AVRingReader) DecConfChanged ¶
func (r *AVRingReader) DecConfChanged() bool
func (*AVRingReader) GetDTS32 ¶
func (r *AVRingReader) GetDTS32() uint32
func (*AVRingReader) GetPTS32 ¶
func (r *AVRingReader) GetPTS32() uint32
func (*AVRingReader) ReadFrame ¶
func (r *AVRingReader) ReadFrame(mode int) (err error)
func (*AVRingReader) ResetAbsTime ¶
func (r *AVRingReader) ResetAbsTime()
type Audio ¶
type Audio struct { Media CodecID codec.AudioCodecID Channels byte SampleSize byte SizeLength int // 通常为13 IndexLength int IndexDeltaLength int AVCCHead []byte // 音频包在AVCC格式中,AAC会有两个字节,其他的只有一个字节 codec.AudioSpecificConfig }
func (*Audio) CompleteAVCC ¶
func (*Audio) CompleteRTP ¶
func (*Audio) GetCodec ¶
func (a *Audio) GetCodec() codec.AudioCodecID
func (*Audio) WriteSequenceHead ¶
type Base ¶
type Base[T any, F util.IDataFrame[T]] struct { util.RingWriter[T, F] Name string log.Zap `json:"-" yaml:"-"` Publisher common.IPuber `json:"-" yaml:"-"` //所属发布者 State common.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]) GetPublisher ¶
func (*Base[T, F]) SnapForJson ¶
func (bt *Base[T, F]) SnapForJson()
type BytesData ¶
type BytesData struct { RecycleData[util.LIBP] Pool util.BytesPool }
func NewBytesDataTrack ¶
type Channel ¶
type Channel[T any] struct { // contains filtered or unexported fields }
func (*Channel[T]) AddListener ¶
func (r *Channel[T]) AddListener(c chan T)
func (*Channel[T]) CreateReader ¶
type Data ¶
type Data[T any] struct { Base[T, *common.DataFrame[T]] sync.Locker `json:"-" yaml:"-"` // 写入锁,可选,单一协程写入可以不加锁 }
func NewDataTrack ¶
func (*Data[T]) LastWriteTime ¶
type DataReader ¶
type DataReader[T any] struct { RingReader[T, *common.DataFrame[T]] }
type H264 ¶
type H264 struct { Video // contains filtered or unexported fields }
func (*H264) GetNALU_SEI ¶
func (*H264) WriteRTPFrame ¶
func (*H264) WriteSequenceHead ¶
func (*H264) WriteSliceBytes ¶
type H265 ¶
func (*H265) CompleteAVCC ¶
func (*H265) GetNALU_SEI ¶
func (*H265) WriteRTPFrame ¶
func (*H265) WriteSequenceHead ¶
func (*H265) WriteSliceBytes ¶
type IDRingList ¶
type IDRingList struct { IDRList util.List[*util.Ring[*common.AVFrame]] IDRing *util.Ring[*common.AVFrame] HistoryRing *util.Ring[*common.AVFrame] }
func (*IDRingList) ShiftIDR ¶
func (p *IDRingList) ShiftIDR()
type Media ¶
type Media struct { Base[any, *common.AVFrame] BufferTime time.Duration //发布者配置中的缓冲时间(时光回溯) PayloadType byte IDRingList `json:"-" yaml:"-"` //最近的关键帧位置,首屏渲染 SSRC uint32 SampleRate uint32 BytesPool util.BytesPool `json:"-" yaml:"-"` RtpPool util.Pool[common.RTPFrame] `json:"-" yaml:"-"` SequenceHead []byte `json:"-" yaml:"-"` //H264(SPS、PPS) H265(VPS、SPS、PPS) AAC(config) SequenceHeadSeq int RTPDemuxer SpesificTrack `json:"-" yaml:"-"` // contains filtered or unexported fields }
Media 基础媒体Track类
func (*Media) AppendAuBytes ¶
func (*Media) CurrentFrame ¶
func (*Media) GetRTPFromPool ¶
func (*Media) LastWriteTime ¶
func (*Media) PacketizeRTP ¶
https://www.cnblogs.com/moonwalk/p/15903760.html Packetize packetizes the payload of an RTP packet and returns one or more RTP packets
func (*Media) SetSpeedLimit ¶
func (*Media) WriteRTPPack ¶
WriteRTPPack 写入已反序列化的RTP包,已经排序过了的
func (*Media) WriteSequenceHead ¶
type RTPDemuxer ¶
type RTPDemuxer struct {
// contains filtered or unexported fields
}
type RecycleData ¶
type RecycleData[T util.Recyclable] struct { Data[T] }
func NewRecycleDataTrack ¶
func NewRecycleDataTrack[T util.Recyclable](name string) (dt *RecycleData[T])
func (*RecycleData[T]) Push ¶
func (dt *RecycleData[T]) Push(data T)
type RingReader ¶
func (*RingReader[T, F]) ReadNext ¶
func (r *RingReader[T, F]) ReadNext() (err error)
func (*RingReader[T, F]) StartRead ¶
func (r *RingReader[T, F]) StartRead(ring *util.Ring[F]) (err error)
func (*RingReader[T, F]) TryRead ¶
func (r *RingReader[T, F]) TryRead() (f F, err error)
type SpesificTrack ¶
type Video ¶
type Video struct { Media CodecID codec.VideoCodecID GOP int //关键帧间隔 codec.SPSInfo common.ParamaterSets `json:"-" yaml:"-"` SPS []byte `json:"-" yaml:"-"` PPS []byte `json:"-" yaml:"-"` // contains filtered or unexported fields }
func (*Video) CompleteAVCC ¶
func (*Video) GetCodec ¶
func (vt *Video) GetCodec() codec.VideoCodecID
func (*Video) SetLostFlag ¶
func (vt *Video) SetLostFlag()
func (*Video) WriteSequenceHead ¶
func (*Video) WriteSliceByte ¶
Click to show internal directories.
Click to hide internal directories.