Documentation ¶
Index ¶
- Constants
- Variables
- type AAC
- type AV1
- type AVRingReader
- type Audio
- func (a *Audio) Attach()
- func (a *Audio) CompleteAVCC(value *AVFrame)
- func (a *Audio) CompleteRTP(value *AVFrame)
- func (a *Audio) Detach()
- func (av *Audio) Flush()
- 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 BytesData
- type Data
- type DataReader
- type G711
- type H264
- type H265
- func (vt *H265) CompleteAVCC(rv *AVFrame)
- func (vt *H265) CompleteRTP(value *AVFrame)
- func (vt *H265) GetNALU_SEI() (item *util.ListItem[util.Buffer])
- func (vt *H265) WriteRTPFrame(rtpItem *util.ListItem[RTPFrame])
- 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() *AVFrame
- func (av *Media) Flush()
- func (av *Media) GetFromPool(b util.IBytes) (item *util.ListItem[util.Buffer])
- func (av *Media) GetRTPFromPool() (result *util.ListItem[RTPFrame])
- func (av *Media) LastWriteTime() time.Time
- func (av *Media) PacketizeRTP(payloads ...[][]byte)
- func (av *Media) PreFrame() *AVFrame
- func (av *Media) SetSpeedLimit(value time.Duration)
- func (av *Media) SetStuff(stuff ...any)
- func (av *Media) SnapForJson()
- func (av *Media) WriteRTP(raw *util.ListItem[RTPFrame])
- 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 *AVFrame)
- func (v *Video) Detach()
- func (vt *Video) Flush()
- 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 AAC ¶
func (*AAC) CompleteRTP ¶
func (aac *AAC) CompleteRTP(value *AVFrame)
func (*AAC) WriteRTPFrame ¶
func (*AAC) WriteSequenceHead ¶
type AV1 ¶
type AV1 struct { Video // contains filtered or unexported fields }
func (*AV1) CompleteAVCC ¶
func (vt *AV1) CompleteAVCC(rv *AVFrame)
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 (a *Audio) CompleteAVCC(value *AVFrame)
func (*Audio) CompleteRTP ¶
func (a *Audio) CompleteRTP(value *AVFrame)
func (*Audio) WriteSequenceHead ¶
type BytesData ¶
func NewBytesDataTrack ¶
type Data ¶
type Data[T any] struct { Base[T, *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 G711 ¶
type G711 struct {
Audio
}
func (*G711) CompleteRTP ¶
func (g711 *G711) CompleteRTP(value *AVFrame)
func (*G711) WriteRTPFrame ¶
type H264 ¶
type H264 struct { Video // contains filtered or unexported fields }
func (*H264) WriteRTPFrame ¶
func (*H264) WriteSequenceHead ¶
func (*H264) WriteSliceBytes ¶
type H265 ¶
func (*H265) CompleteAVCC ¶
func (vt *H265) CompleteAVCC(rv *AVFrame)
func (*H265) WriteRTPFrame ¶
func (*H265) WriteSequenceHead ¶
func (*H265) WriteSliceBytes ¶
type IDRingList ¶
type IDRingList struct { IDRList util.List[*util.Ring[*AVFrame]] IDRing *util.Ring[*AVFrame] HistoryRing *util.Ring[*AVFrame] }
func (*IDRingList) AddIDR ¶
func (p *IDRingList) AddIDR(IDRing *util.Ring[*AVFrame])
func (*IDRingList) ShiftIDR ¶
func (p *IDRingList) ShiftIDR()
type Media ¶
type Media struct { Base[any, *AVFrame] PayloadType byte IDRingList `json:"-" yaml:"-"` //最近的关键帧位置,首屏渲染 SSRC uint32 SampleRate uint32 BytesPool util.BytesPool `json:"-" yaml:"-"` RtpPool util.Pool[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 (av *Media) CurrentFrame() *AVFrame
func (*Media) GetFromPool ¶
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 Opus ¶
type Opus struct {
Audio
}
func (*Opus) CompleteRTP ¶
func (opus *Opus) CompleteRTP(value *AVFrame)
func (*Opus) WriteRTPFrame ¶
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 ParamaterSets `json:"-" yaml:"-"` SPS []byte `json:"-" yaml:"-"` PPS []byte `json:"-" yaml:"-"` SEIReader *DataReader[[]byte] `json:"-" yaml:"-"` // contains filtered or unexported fields }
func (*Video) CompleteAVCC ¶
func (vt *Video) CompleteAVCC(rv *AVFrame)
func (*Video) SetLostFlag ¶
func (vt *Video) SetLostFlag()
func (*Video) WriteSequenceHead ¶
func (*Video) WriteSliceByte ¶
Click to show internal directories.
Click to hide internal directories.