Documentation
¶
Index ¶
- type AAC
- type Audio
- type Base
- type Data
- type G711
- type H264
- type H265
- type Media
- func (av *Media[T]) CurrentFrame() *AVFrame[T]
- func (av *Media[T]) Flush()
- func (av *Media[T]) GetDecoderConfiguration() DecoderConfiguration[T]
- func (av *Media[T]) LastWriteTime() time.Time
- func (av *Media[T]) PacketizeRTP(payloads ...[]byte)
- func (av *Media[T]) Play(ctx context.Context, onMedia func(*AVFrame[T]) error) error
- func (av *Media[T]) PreFrame() *AVFrame[T]
- func (av *Media[T]) ReadRing() *AVRing[T]
- func (av *Media[T]) UnmarshalRTP(raw []byte) (frame *RTPFrame)
- func (av *Media[T]) WriteAVCC(ts uint32, frame AVCCFrame)
- func (av *Media[T]) WriteSlice(slice T)
- type UnknowAudio
- type UnknowVideo
- type Video
- func (t *Video) Attach()
- func (t *Video) ComputeGOP()
- func (t *Video) Detach()
- func (vt *Video) Flush()
- func (t *Video) GetName() string
- func (vt *Video) ReadRing() *AVRing[NALUSlice]
- func (vt *Video) WriteAVCC(ts uint32, frame AVCCFrame)
- func (vt *Video) WriteAnnexB(pts uint32, dts uint32, frame AnnexBFrame)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Audio ¶
type Audio struct { Media[AudioSlice] CodecID codec.AudioCodecID Channels byte // contains filtered or unexported fields }
type Data ¶
func (*Data) LastWriteTime ¶
type H264 ¶
type H264 struct { Video // contains filtered or unexported fields }
func (*H264) WriteAnnexB ¶
func (*H264) WriteSlice ¶
func (vt *H264) WriteSlice(slice NALUSlice)
type H265 ¶
type H265 struct {
Video
}
func (*H265) WriteAnnexB ¶
func (*H265) WriteSlice ¶
func (vt *H265) WriteSlice(slice NALUSlice)
type Media ¶
type Media[T RawSlice] struct { Base AVRing[T] `json:"-"` SampleRate uint32 SampleSize byte DecoderConfiguration DecoderConfiguration[T] `json:"-"` //H264(SPS、PPS) H265(VPS、SPS、PPS) AAC(config) // contains filtered or unexported fields }
Media 基础媒体Track类
func (*Media[T]) CurrentFrame ¶
func (av *Media[T]) CurrentFrame() *AVFrame[T]
func (*Media[T]) GetDecoderConfiguration ¶
func (av *Media[T]) GetDecoderConfiguration() DecoderConfiguration[T]
func (*Media[T]) LastWriteTime ¶
func (*Media[T]) PacketizeRTP ¶
Packetize packetizes the payload of an RTP packet and returns one or more RTP packets
func (*Media[T]) UnmarshalRTP ¶
func (*Media[T]) WriteSlice ¶
func (av *Media[T]) WriteSlice(slice T)
type UnknowAudio ¶
type UnknowAudio struct { Base AudioTrack }
func (*UnknowAudio) Flush ¶
func (ua *UnknowAudio) Flush()
func (*UnknowAudio) GetName ¶
func (ua *UnknowAudio) GetName() string
func (*UnknowAudio) WriteAVCC ¶
func (ua *UnknowAudio) WriteAVCC(ts uint32, frame AVCCFrame)
type UnknowVideo ¶
type UnknowVideo struct { Base VideoTrack }
func (*UnknowVideo) Flush ¶
func (uv *UnknowVideo) Flush()
func (*UnknowVideo) GetName ¶
func (uv *UnknowVideo) GetName() string
func (*UnknowVideo) WriteAVCC ¶
func (vt *UnknowVideo) WriteAVCC(ts uint32, frame AVCCFrame)
func (*UnknowVideo) WriteAnnexB ¶
func (vt *UnknowVideo) WriteAnnexB(pts uint32, dts uint32, frame AnnexBFrame)
Access Unit的首个nalu是4字节起始码。 这里举个例子说明,用JM可以生成这样一段码流(不要使用JM8.6,它在这部分与标准不符),这个码流可以见本楼附件:
SPS (4字节头) PPS (4字节头) SEI (4字节头) I0(slice0) (4字节头) I0(slice1) (3字节头) P1(slice0) (4字节头) P1(slice1) (3字节头) P2(slice0) (4字节头) P2(slice1) (3字节头)
I0(slice0)是序列第一帧(I帧)的第一个slice,是当前Access Unit的首个nalu,所以是4字节头。而I0(slice1)表示第一帧的第二个slice,所以是3字节头。P1(slice0) 、P1(slice1)同理。
type Video ¶
type Video struct { Media[NALUSlice] CodecID codec.VideoCodecID IDRing *util.Ring[AVFrame[NALUSlice]] `json:"-"` //最近的关键帧位置,首屏渲染 SPSInfo codec.SPSInfo GOP int //关键帧间隔 // contains filtered or unexported fields }
func (*Video) ComputeGOP ¶
func (t *Video) ComputeGOP()
func (*Video) WriteAnnexB ¶
Click to show internal directories.
Click to hide internal directories.