Documentation ¶
Index ¶
- Constants
- Variables
- func PackHTTPFLVTag(t uint8, timestamp uint32, in []byte) []byte
- type FLVFileReader
- type FLVFileWriter
- func (ffw *FLVFileWriter) Dispose() error
- func (ffw *FLVFileWriter) Name() string
- func (ffw *FLVFileWriter) Open(filename string) (err error)
- func (ffw *FLVFileWriter) WriteFLVHeader() (err error)
- func (ffw *FLVFileWriter) WriteRaw(b []byte) (err error)
- func (ffw *FLVFileWriter) WriteTag(tag Tag) (err error)
- type ModPullSessionOption
- type OnReadFLVTag
- type PullSession
- func (session *PullSession) AppName() string
- func (session *PullSession) Dispose() error
- func (session *PullSession) GetStat() base.StatSession
- func (session *PullSession) IsAlive() (readAlive, writeAlive bool)
- func (session *PullSession) Pull(rawURL string, onReadFLVTag OnReadFLVTag) error
- func (session *PullSession) RawQuery() string
- func (session *PullSession) StreamName() string
- func (session *PullSession) URL() string
- func (session *PullSession) UniqueKey() string
- func (session *PullSession) UpdateStat(intervalSec uint32)
- func (session *PullSession) WaitChan() <-chan error
- type PullSessionOption
- type Server
- type ServerConfig
- type ServerObserver
- type SubSession
- func (session *SubSession) AppName() string
- func (session *SubSession) Dispose() error
- func (session *SubSession) GetStat() base.StatSession
- func (session *SubSession) IsAlive() (readAlive, writeAlive bool)
- func (session *SubSession) RawQuery() string
- func (session *SubSession) ReadRequest() (err error)
- func (session *SubSession) RunLoop() error
- func (session *SubSession) StreamName() string
- func (session *SubSession) URL() string
- func (session *SubSession) UniqueKey() string
- func (session *SubSession) UpdateStat(intervalSec uint32)
- func (session *SubSession) WriteFLVHeader()
- func (session *SubSession) WriteHTTPResponseHeader()
- func (session *SubSession) WriteRawPacket(pkt []byte)
- func (session *SubSession) WriteTag(tag *Tag)
- type Tag
- func (tag *Tag) IsAACSeqHeader() bool
- func (tag *Tag) IsAVC() bool
- func (tag *Tag) IsAVCKeyNALU() bool
- func (tag *Tag) IsAVCKeySeqHeader() bool
- func (tag *Tag) IsHEVC() bool
- func (tag *Tag) IsHEVCKeyNALU() bool
- func (tag *Tag) IsHEVCKeySeqHeader() bool
- func (tag *Tag) IsMetadata() bool
- func (tag *Tag) IsVideoKeyNALU() bool
- func (tag *Tag) IsVideoKeySeqHeader() bool
- func (tag *Tag) ModTagTimestamp(timestamp uint32)
- func (tag *Tag) Payload() []byte
- type TagHeader
Constants ¶
View Source
const ( TagHeaderSize int = 11 PrevTagSizeFieldSize int = 4 )
View Source
const ( TagTypeMetadata uint8 = 18 TagTypeVideo uint8 = 9 TagTypeAudio uint8 = 8 )
View Source
const ( AVCKeyFrame = frameTypeKey<<4 | codecIDAVC AVCInterFrame = frameTypeInter<<4 | codecIDAVC HEVCKeyFrame = frameTypeKey<<4 | codecIDHEVC HEVCInterFrame = frameTypeInter<<4 | codecIDHEVC )
View Source
const ( AVCPacketTypeSeqHeader uint8 = 0 AVCPacketTypeNALU uint8 = 1 HEVCPacketTypeSeqHeader uint8 = 0 HEVCPacketTypeNALU uint8 = 1 AACPacketTypeSeqHeader uint8 = 0 AACPacketTypeRaw uint8 = 1 )
View Source
const (
SoundFormatAAC uint8 = 10
)
Variables ¶
View Source
var ErrHTTPFLV = errors.New("lal.httpflv: fxxk")
View Source
var FLVHeader = []byte{0x46, 0x4c, 0x56, 0x01, 0x05, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00}
Functions ¶
Types ¶
type FLVFileReader ¶
type FLVFileReader struct {
// contains filtered or unexported fields
}
func (*FLVFileReader) Dispose ¶
func (ffr *FLVFileReader) Dispose()
func (*FLVFileReader) Open ¶
func (ffr *FLVFileReader) Open(filename string) (err error)
func (*FLVFileReader) ReadFLVHeader ¶
func (ffr *FLVFileReader) ReadFLVHeader() ([]byte, error)
func (*FLVFileReader) ReadTag ¶
func (ffr *FLVFileReader) ReadTag() (Tag, error)
type FLVFileWriter ¶
type FLVFileWriter struct {
// contains filtered or unexported fields
}
func (*FLVFileWriter) Dispose ¶
func (ffw *FLVFileWriter) Dispose() error
func (*FLVFileWriter) Name ¶ added in v0.19.12
func (ffw *FLVFileWriter) Name() string
func (*FLVFileWriter) Open ¶
func (ffw *FLVFileWriter) Open(filename string) (err error)
func (*FLVFileWriter) WriteFLVHeader ¶ added in v0.19.12
func (ffw *FLVFileWriter) WriteFLVHeader() (err error)
func (*FLVFileWriter) WriteRaw ¶
func (ffw *FLVFileWriter) WriteRaw(b []byte) (err error)
func (*FLVFileWriter) WriteTag ¶
func (ffw *FLVFileWriter) WriteTag(tag Tag) (err error)
type ModPullSessionOption ¶
type ModPullSessionOption func(option *PullSessionOption)
type OnReadFLVTag ¶
type OnReadFLVTag func(tag Tag)
type PullSession ¶
type PullSession struct {
// contains filtered or unexported fields
}
func NewPullSession ¶
func NewPullSession(modOptions ...ModPullSessionOption) *PullSession
func (*PullSession) AppName ¶
func (session *PullSession) AppName() string
文档请参考: interface ISessionURLContext
func (*PullSession) Dispose ¶
func (session *PullSession) Dispose() error
文档请参考: interface IClientSessionLifecycle
func (*PullSession) GetStat ¶
func (session *PullSession) GetStat() base.StatSession
文档请参考: interface ISessionStat
func (*PullSession) IsAlive ¶
func (session *PullSession) IsAlive() (readAlive, writeAlive bool)
文档请参考: interface ISessionStat
func (*PullSession) Pull ¶
func (session *PullSession) Pull(rawURL string, onReadFLVTag OnReadFLVTag) error
阻塞直到和对端完成拉流前,握手部分的工作(也即发送完HTTP Request),或者发生错误
rawURL 支持如下两种格式。(当然,关键点是对端支持)
http://{domain}/{app_name}/{stream_name}.flv http://{ip}/{domain}/{app_name}/{stream_name}.flv
onReadFLVTag 读取到 flv tag 数据时回调。回调结束后,PullSession 不会再使用这块 <tag> 数据。
func (*PullSession) RawQuery ¶
func (session *PullSession) RawQuery() string
文档请参考: interface ISessionURLContext
func (*PullSession) StreamName ¶
func (session *PullSession) StreamName() string
文档请参考: interface ISessionURLContext
func (*PullSession) URL ¶ added in v0.19.12
func (session *PullSession) URL() string
文档请参考: interface ISessionURLContext
func (*PullSession) UniqueKey ¶
func (session *PullSession) UniqueKey() string
文档请参考: interface IObject
func (*PullSession) UpdateStat ¶
func (session *PullSession) UpdateStat(intervalSec uint32)
文档请参考: interface ISessionStat
func (*PullSession) WaitChan ¶ added in v0.19.12
func (session *PullSession) WaitChan() <-chan error
文档请参考: interface IClientSessionLifecycle
type PullSessionOption ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(observer ServerObserver, config ServerConfig) *Server
type ServerConfig ¶
type ServerObserver ¶
type ServerObserver interface { // 通知上层有新的拉流者 // 返回值: true则允许拉流,false则关闭连接 OnNewHTTPFLVSubSession(session *SubSession) bool OnDelHTTPFLVSubSession(session *SubSession) }
type SubSession ¶
type SubSession struct { IsFresh bool // contains filtered or unexported fields }
func NewSubSession ¶
func NewSubSession(conn net.Conn, scheme string) *SubSession
func (*SubSession) AppName ¶
func (session *SubSession) AppName() string
func (*SubSession) Dispose ¶
func (session *SubSession) Dispose() error
func (*SubSession) GetStat ¶
func (session *SubSession) GetStat() base.StatSession
func (*SubSession) IsAlive ¶
func (session *SubSession) IsAlive() (readAlive, writeAlive bool)
func (*SubSession) RawQuery ¶
func (session *SubSession) RawQuery() string
func (*SubSession) ReadRequest ¶
func (session *SubSession) ReadRequest() (err error)
TODO chef: read request timeout
func (*SubSession) RunLoop ¶
func (session *SubSession) RunLoop() error
func (*SubSession) StreamName ¶
func (session *SubSession) StreamName() string
func (*SubSession) URL ¶
func (session *SubSession) URL() string
func (*SubSession) UniqueKey ¶
func (session *SubSession) UniqueKey() string
func (*SubSession) UpdateStat ¶
func (session *SubSession) UpdateStat(intervalSec uint32)
func (*SubSession) WriteFLVHeader ¶
func (session *SubSession) WriteFLVHeader()
func (*SubSession) WriteHTTPResponseHeader ¶
func (session *SubSession) WriteHTTPResponseHeader()
func (*SubSession) WriteRawPacket ¶
func (session *SubSession) WriteRawPacket(pkt []byte)
func (*SubSession) WriteTag ¶
func (session *SubSession) WriteTag(tag *Tag)
type Tag ¶
type Tag struct { Header TagHeader Raw []byte // 结构为 (11字节的 tag header) + (body) + (4字节的 prev tag size) }
func ReadAllTagsFromFLVFile ¶
func (*Tag) IsAACSeqHeader ¶
func (*Tag) IsAVCKeyNALU ¶
func (*Tag) IsAVCKeySeqHeader ¶
func (*Tag) IsHEVCKeyNALU ¶
func (*Tag) IsHEVCKeySeqHeader ¶
func (*Tag) IsMetadata ¶
func (*Tag) ModTagTimestamp ¶
Click to show internal directories.
Click to hide internal directories.