|
|
// Copyright 2021, Chef. All rights reserved.
|
|
|
// https://github.com/q191201771/lal
|
|
|
//
|
|
|
// Use of this source code is governed by a MIT-style license
|
|
|
// that can be found in the License file.
|
|
|
//
|
|
|
// Author: Chef (191201771@qq.com)
|
|
|
|
|
|
package logic
|
|
|
|
|
|
import (
|
|
|
"github.com/q191201771/lal/pkg/base"
|
|
|
"github.com/q191201771/lal/pkg/hls"
|
|
|
"github.com/q191201771/lal/pkg/httpflv"
|
|
|
"github.com/q191201771/lal/pkg/httpts"
|
|
|
"github.com/q191201771/lal/pkg/rtmp"
|
|
|
"github.com/q191201771/lal/pkg/rtsp"
|
|
|
)
|
|
|
|
|
|
// client.pub: rtmp, rtsp
|
|
|
// client.sub: rtmp, rtsp, flv, ts
|
|
|
// server.push: rtmp, rtsp
|
|
|
// server.pull: rtmp, rtsp, flv
|
|
|
// other: rtmp.ClientSession rtsp.BaseInSession rtsp.BaseOutSession rtsp.ClientCommandSession rtsp.ServerCommandSession
|
|
|
|
|
|
// IClientSession: 所有Client Session都满足
|
|
|
var (
|
|
|
_ base.IClientSession = &rtmp.PushSession{}
|
|
|
_ base.IClientSession = &rtmp.PullSession{}
|
|
|
_ base.IClientSession = &rtsp.PushSession{}
|
|
|
_ base.IClientSession = &rtsp.PullSession{}
|
|
|
_ base.IClientSession = &httpflv.PullSession{}
|
|
|
)
|
|
|
|
|
|
// IServerSession
|
|
|
var (
|
|
|
_ base.IServerSession = &rtmp.ServerSession{}
|
|
|
_ base.IServerSession = &httpflv.SubSession{}
|
|
|
_ base.IServerSession = &httpts.SubSession{}
|
|
|
|
|
|
// 这两个比较特殊,它们没有RunLoop函数,RunLoop在rtsp.ServerCommandSession上
|
|
|
//_ base.IServerSession = &rtsp.PubSession{}
|
|
|
//_ base.IServerSession = &rtsp.SubSession{}
|
|
|
)
|
|
|
|
|
|
// IClientSessionLifecycle: 所有Client Session都满足
|
|
|
var (
|
|
|
_ base.IClientSessionLifecycle = &rtmp.PushSession{}
|
|
|
_ base.IClientSessionLifecycle = &rtmp.PullSession{}
|
|
|
_ base.IClientSessionLifecycle = &rtsp.PushSession{}
|
|
|
_ base.IClientSessionLifecycle = &rtsp.PullSession{}
|
|
|
_ base.IClientSessionLifecycle = &httpflv.PullSession{}
|
|
|
)
|
|
|
|
|
|
// IServerSessionLifecycle
|
|
|
var (
|
|
|
// server session
|
|
|
_ base.IServerSessionLifecycle = &rtmp.ServerSession{}
|
|
|
_ base.IServerSessionLifecycle = &httpflv.SubSession{}
|
|
|
_ base.IServerSessionLifecycle = &httpts.SubSession{}
|
|
|
|
|
|
// 这两个比较特殊,它们没有RunLoop函数,RunLoop在rtsp.ServerCommandSession上
|
|
|
//_ base.IServerSessionLifecycle = &rtsp.PubSession{}
|
|
|
//_ base.IServerSessionLifecycle = &rtsp.SubSession{}
|
|
|
// other
|
|
|
_ base.IServerSessionLifecycle = &rtsp.ServerCommandSession{}
|
|
|
)
|
|
|
|
|
|
// ISessionStat: 所有Session(client/server)都满足
|
|
|
var (
|
|
|
// client
|
|
|
_ base.ISessionStat = &rtmp.PushSession{}
|
|
|
_ base.ISessionStat = &rtsp.PushSession{}
|
|
|
_ base.ISessionStat = &rtmp.PullSession{}
|
|
|
_ base.ISessionStat = &rtsp.PullSession{}
|
|
|
_ base.ISessionStat = &httpflv.PullSession{}
|
|
|
// server session
|
|
|
_ base.ISessionStat = &rtmp.ServerSession{}
|
|
|
_ base.ISessionStat = &rtsp.PubSession{}
|
|
|
_ base.ISessionStat = &rtsp.SubSession{}
|
|
|
_ base.ISessionStat = &httpflv.SubSession{}
|
|
|
_ base.ISessionStat = &httpts.SubSession{}
|
|
|
// other
|
|
|
_ base.ISessionStat = &rtmp.ClientSession{}
|
|
|
_ base.ISessionStat = &rtsp.BaseInSession{}
|
|
|
_ base.ISessionStat = &rtsp.BaseOutSession{}
|
|
|
_ base.ISessionStat = &rtsp.ServerCommandSession{}
|
|
|
)
|
|
|
|
|
|
// ISessionURLContext: 所有Session(client/server)都满足
|
|
|
var (
|
|
|
// client
|
|
|
_ base.ISessionURLContext = &rtmp.PushSession{}
|
|
|
_ base.ISessionURLContext = &rtsp.PushSession{}
|
|
|
_ base.ISessionURLContext = &rtmp.PullSession{}
|
|
|
_ base.ISessionURLContext = &rtsp.PullSession{}
|
|
|
_ base.ISessionURLContext = &httpflv.PullSession{}
|
|
|
// server session
|
|
|
_ base.ISessionURLContext = &rtmp.ServerSession{}
|
|
|
_ base.ISessionURLContext = &rtsp.PubSession{}
|
|
|
_ base.ISessionURLContext = &httpflv.SubSession{}
|
|
|
_ base.ISessionURLContext = &httpts.SubSession{}
|
|
|
_ base.ISessionURLContext = &rtsp.SubSession{}
|
|
|
// other
|
|
|
_ base.ISessionURLContext = &rtmp.ClientSession{}
|
|
|
_ base.ISessionURLContext = &rtsp.ClientCommandSession{}
|
|
|
)
|
|
|
|
|
|
// IObject: 所有Session(client/server)都满足
|
|
|
var (
|
|
|
//// client
|
|
|
_ base.IObject = &rtmp.PushSession{}
|
|
|
_ base.IObject = &rtsp.PushSession{}
|
|
|
_ base.IObject = &rtmp.PullSession{}
|
|
|
_ base.IObject = &rtsp.PullSession{}
|
|
|
_ base.IObject = &httpflv.PullSession{}
|
|
|
// server session
|
|
|
_ base.IObject = &rtmp.ServerSession{}
|
|
|
_ base.IObject = &rtsp.PubSession{}
|
|
|
_ base.IObject = &rtsp.SubSession{}
|
|
|
_ base.IObject = &httpflv.SubSession{}
|
|
|
_ base.IObject = &httpts.SubSession{}
|
|
|
//// other
|
|
|
_ base.IObject = &rtmp.ClientSession{}
|
|
|
_ base.IObject = &rtsp.BaseInSession{}
|
|
|
_ base.IObject = &rtsp.BaseOutSession{}
|
|
|
_ base.IObject = &rtsp.ClientCommandSession{}
|
|
|
_ base.IObject = &rtsp.ServerCommandSession{}
|
|
|
)
|
|
|
|
|
|
// ---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
var _ rtmp.ServerObserver = &ServerManager{}
|
|
|
var _ rtsp.ServerObserver = &ServerManager{}
|
|
|
var _ httpflv.ServerObserver = &ServerManager{}
|
|
|
var _ httpts.ServerObserver = &ServerManager{}
|
|
|
|
|
|
var _ HTTPAPIServerObserver = &ServerManager{}
|
|
|
|
|
|
var _ rtmp.PubSessionObserver = &Group{} //
|
|
|
var _ rtsp.PullSessionObserver = &Group{}
|
|
|
var _ rtsp.PubSessionObserver = &Group{}
|
|
|
var _ hls.MuxerObserver = &Group{}
|
|
|
var _ rtsp.BaseInSessionObserver = &Group{} //
|
|
|
|
|
|
var _ rtmp.ServerSessionObserver = &rtmp.Server{}
|
|
|
var _ rtmp.HandshakeClient = &rtmp.HandshakeClientSimple{}
|
|
|
var _ rtmp.HandshakeClient = &rtmp.HandshakeClientComplex{}
|
|
|
|
|
|
var _ rtsp.ServerCommandSessionObserver = &rtsp.Server{}
|
|
|
var _ rtsp.ClientCommandSessionObserver = &rtsp.PushSession{}
|
|
|
var _ rtsp.ClientCommandSessionObserver = &rtsp.PullSession{}
|
|
|
var _ rtsp.IInterleavedPacketWriter = &rtsp.PushSession{}
|
|
|
var _ rtsp.IInterleavedPacketWriter = &rtsp.PullSession{}
|
|
|
var _ rtsp.IInterleavedPacketWriter = &rtsp.PubSession{}
|
|
|
var _ rtsp.IInterleavedPacketWriter = &rtsp.SubSession{}
|
|
|
var _ rtsp.IInterleavedPacketWriter = &rtsp.ClientCommandSession{}
|
|
|
var _ rtsp.IInterleavedPacketWriter = &rtsp.ServerCommandSession{}
|
|
|
|
|
|
var _ hls.StreamerObserver = &hls.Muxer{}
|