mirror of
https://github.com/lkmio/lkm.git
synced 2025-10-04 14:52:44 +08:00
source封装
This commit is contained in:
@@ -17,6 +17,7 @@ func NewPublisher(sourceId string) *Publisher {
|
|||||||
return publisher
|
return publisher
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// OnVideo 从rtmpchunk解析过来的数据包
|
||||||
func (p *Publisher) OnVideo(data []byte, ts uint32) {
|
func (p *Publisher) OnVideo(data []byte, ts uint32) {
|
||||||
_ = p.deMuxer.InputVideo(data, ts)
|
_ = p.deMuxer.InputVideo(data, ts)
|
||||||
}
|
}
|
||||||
|
@@ -5,7 +5,7 @@ import (
|
|||||||
"github.com/yangjiechina/live-server/transcode"
|
"github.com/yangjiechina/live-server/transcode"
|
||||||
)
|
)
|
||||||
|
|
||||||
type TransMuxerId uint32
|
type TransStreamId uint32
|
||||||
|
|
||||||
// SourceType Source 推流类型
|
// SourceType Source 推流类型
|
||||||
type SourceType uint32
|
type SourceType uint32
|
||||||
@@ -61,7 +61,7 @@ type ISource interface {
|
|||||||
AddSink(sink ISink) bool
|
AddSink(sink ISink) bool
|
||||||
|
|
||||||
// RemoveSink 删除Sink/**
|
// RemoveSink 删除Sink/**
|
||||||
RemoveSink(tid TransMuxerId, sinkId string) bool
|
RemoveSink(tid TransStreamId, sinkId string) bool
|
||||||
|
|
||||||
// Close 关闭Source
|
// Close 关闭Source
|
||||||
// 停止一切封装和转发流以及转码工作
|
// 停止一切封装和转发流以及转码工作
|
||||||
@@ -78,14 +78,14 @@ type SourceImpl struct {
|
|||||||
type_ SourceType
|
type_ SourceType
|
||||||
state SessionState
|
state SessionState
|
||||||
|
|
||||||
deMuxer ITransDeMuxer
|
deMuxer ITransDeMuxer //负责从推流协议中解析出AVStream和AVPacket
|
||||||
recordSink ISink
|
recordSink ISink //每个Source唯一的一个录制流
|
||||||
audioTranscoders []transcode.ITranscoder
|
audioTranscoders []transcode.ITranscoder //音频解码器
|
||||||
videoTranscoders []transcode.ITranscoder
|
videoTranscoders []transcode.ITranscoder //视频解码器
|
||||||
transcodeStreams []utils.AVStream
|
transcodeStreams []utils.AVStream //从音视频解码器中获得的AVStream
|
||||||
|
|
||||||
//所有的输出协议, 持有Sink
|
//所有的输出协议, 持有Sink
|
||||||
transMuxers map[Protocol]map[TransMuxerId]ITransMuxer
|
transStreams map[TransStreamId]TransStream
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SourceImpl) Id() string {
|
func (s *SourceImpl) Id() string {
|
||||||
@@ -123,7 +123,7 @@ func (s *SourceImpl) AddSink(sink ISink) bool {
|
|||||||
panic("implement me")
|
panic("implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SourceImpl) RemoveSink(tid TransMuxerId, sinkId string) bool {
|
func (s *SourceImpl) RemoveSink(tid TransStreamId, sinkId string) bool {
|
||||||
//TODO implement me
|
//TODO implement me
|
||||||
panic("implement me")
|
panic("implement me")
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user