base

package
v0.16.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2020 License: MIT Imports: 1 Imported by: 20

Documentation

Index

Constants

View Source
const (
	// spec-rtmp_specification_1.0.pdf
	// 7.1. Types of Messages
	RTMPTypeIDAudio              uint8 = 8
	RTMPTypeIDVideo              uint8 = 9
	RTMPTypeIDMetadata           uint8 = 18 // RTMPTypeIDDataMessageAMF0
	RTMPTypeIDSetChunkSize       uint8 = 1
	RTMPTypeIDAck                uint8 = 3
	RTMPTypeIDUserControl        uint8 = 4
	RTMPTypeIDWinAckSize         uint8 = 5
	RTMPTypeIDBandwidth          uint8 = 6
	RTMPTypeIDCommandMessageAMF3 uint8 = 17
	RTMPTypeIDCommandMessageAMF0 uint8 = 20

	// user control message type
	RTMPUserControlStreamBegin uint8 = 0
	RTMPUserControlRecorded    uint8 = 4

	// spec-video_file_format_spec_v10.pdf
	// Video tags
	//   VIDEODATA
	//     FrameType UB[4]
	//     CodecID   UB[4]
	//   AVCVIDEOPACKET
	//     AVCPacketType   UI8
	//     CompositionTime SI24
	//     Data            UI8[n]
	RTMPFrameTypeKey   uint8 = 1
	RTMPFrameTypeInter uint8 = 2

	RTMPCodecIDAVC  uint8 = 7
	RTMPCodecIDHEVC uint8 = 12

	RTMPAVCPacketTypeSeqHeader  uint8 = 0
	RTMPAVCPacketTypeNALU       uint8 = 1
	RTMPHEVCPacketTypeSeqHeader       = RTMPAVCPacketTypeSeqHeader
	RTMPHEVCPacketTypeNALU            = RTMPAVCPacketTypeNALU

	RTMPAVCKeyFrame    = RTMPFrameTypeKey<<4 | RTMPCodecIDAVC
	RTMPHEVCKeyFrame   = RTMPFrameTypeKey<<4 | RTMPCodecIDHEVC
	RTMPAVCInterFrame  = RTMPFrameTypeInter<<4 | RTMPCodecIDAVC
	RTMPHEVCInterFrame = RTMPFrameTypeInter<<4 | RTMPCodecIDHEVC

	// spec-video_file_format_spec_v10.pdf
	// Audio tags
	//   AUDIODATA
	//     SoundFormat UB[4]
	//     SoundRate   UB[2]
	//     SoundSize   UB[1]
	//     SoundType   UB[1]
	//   AACAUDIODATA
	//     AACPacketType UI8
	//     Data          UI8[n]
	RTMPSoundFormatAAC         uint8 = 10
	RTMPAACPacketTypeSeqHeader       = 0
	RTMPAACPacketTypeRaw             = 1
)
View Source
const (
	// 注意,AVC和HEVC都可能使用96,所以不能直接通过96判断是AVC还是HEVC
	RTPPacketTypeAVCOrHEVC = 96
	RTPPacketTypeAAC       = 97
)
View Source
const (
	// StatGroup.AudioCodec
	AudioCodecAAC = "AAC"

	// StatGroup.VideoCodec
	VideoCodecAVC  = "H264"
	VideoCodecHEVC = "H265"

	// StatSession.Protocol
	ProtocolRTMP    = "RTMP"
	ProtocolRTSP    = "RTSP"
	ProtocolHTTPFLV = "HTTP-FLV"
	ProtocolHTTPTS  = "HTTP-TS"
)

Variables

View Source
var (
	LALLibraryName = "lal"
	LALGitHubRepo  = "github.com/q191201771/lal"

	// e.g. lal v0.12.3 (github.com/q191201771/lal)
	LALFullInfo = LALLibraryName + " " + LALVersion + " (" + LALGitHubRepo + ")"

	// e.g. 0.12.3
	LALVersionDot string

	// e.g. 0,12,3
	LALVersionComma string
)
View Source
var (
	// 植入rtmp握手随机字符串中
	// e.g. lal v0.12.3 (github.com/q191201771/lal)
	LALRTMPHandshakeWaterMark string

	// 植入rtmp server中的connect result信令中
	// 注意,有两个object,第一个object中的fmsVer我们保持通用公认的值,在第二个object中植入
	// e.g. 0,12,3
	LALRTMPConnectResultVersion string

	// e.g. lal0.12.3
	LALRTMPPushSessionConnectVersion string

	// e.g. lal0.12.3
	LALRTMPBuildMetadataEncoder string

	// e.g. lal/0.12.3
	LALHTTPFLVPullSessionUA string

	// e.g. lal0.12.3
	LALHTTPFLVSubSessionServer string

	// e.g. lal0.12.3
	LALHLSM3U8Server string

	// e.g. lal0.12.3
	LALHLSTSServer string

	// e.g. lal0.12.3
	LALRTSPOptionsResponseServer string

	// e.g. lal0.12.3
	LALHTTPTSSubSessionServer string

	// e.g. lal0.12.3
	LALHTTPAPIServer string
)
View Source
var LALVersion = "v0.15.1"

版本,该变量由build脚本修改维护

Functions

This section is empty.

Types

type AVPacket

type AVPacket struct {
	Timestamp   uint32
	PayloadType AVPacketPT
	Payload     []byte
}

目前供package rtsp使用。以后可能被多个package使用。 不排除不同package使用时,字段含义也不同的情况出现。 使用AVPacket的地方,应注明各字段的含义。

type AVPacketPT added in v0.16.0

type AVPacketPT int
var (
	AVPacketPTAVC  AVPacketPT = RTPPacketTypeAVCOrHEVC
	AVPacketPTAAC  AVPacketPT = RTPPacketTypeAAC
	AVPacketPTHEVC AVPacketPT = 98
)

type RTMPHeader

type RTMPHeader struct {
	CSID         int
	MsgLen       uint32 // 不包含header的大小
	MsgTypeID    uint8  // 8 audio 9 video 18 metadata
	MsgStreamID  int
	TimestampAbs uint32 // 经过计算得到的流上的绝对时间戳
}

type RTMPMsg

type RTMPMsg struct {
	Header  RTMPHeader
	Payload []byte // 不包含 rtmp 头
}

func (RTMPMsg) IsAACSeqHeader

func (msg RTMPMsg) IsAACSeqHeader() bool

func (RTMPMsg) IsAVCKeyNALU

func (msg RTMPMsg) IsAVCKeyNALU() bool

func (RTMPMsg) IsAVCKeySeqHeader

func (msg RTMPMsg) IsAVCKeySeqHeader() bool

func (RTMPMsg) IsHEVCKeyNALU

func (msg RTMPMsg) IsHEVCKeyNALU() bool

func (RTMPMsg) IsHEVCKeySeqHeader

func (msg RTMPMsg) IsHEVCKeySeqHeader() bool

func (RTMPMsg) IsVideoKeyNALU

func (msg RTMPMsg) IsVideoKeyNALU() bool

func (RTMPMsg) IsVideoKeySeqHeader

func (msg RTMPMsg) IsVideoKeySeqHeader() bool

type StatGroup added in v0.16.0

type StatGroup struct {
	StreamName  string    `json:"stream_name"`
	AudioCodec  string    `json:"audio_codec"`
	VideoCodec  string    `json:"video_codec"`
	VideoWidth  int       `json:"video_width"`
	VideoHeight int       `json:"video_height"`
	StatPub     StatPub   `json:"pub"`
	StatSubs    []StatSub `json:"subs"`
}

type StatPub added in v0.16.0

type StatPub struct {
	StatSession
}

func StatSession2Pub added in v0.16.0

func StatSession2Pub(ss StatSession) (ret StatPub)

type StatSession added in v0.16.0

type StatSession struct {
	Protocol      string `json:"protocol"`
	StartTime     string `json:"start_time"`
	RemoteAddr    string `json:"remote_addr"`
	ReadBytesSum  uint64 `json:"read_bytes_sum"`
	WroteBytesSum uint64 `json:"wrote_bytes_sum"`
	Bitrate       int    `json:"bitrate"`
}

type StatSub added in v0.16.0

type StatSub struct {
	StatSession
}

func StatSession2Sub added in v0.16.0

func StatSession2Sub(ss StatSession) (ret StatSub)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL