golanggohlsrtmpwebrtcmedia-serverobs-studiortcprtmp-proxyrtmp-serverrtprtsprtsp-proxyrtsp-relayrtsp-serversrtstreamingwebrtc-proxy
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
123 lines
2.4 KiB
123 lines
2.4 KiB
package client |
|
|
|
import ( |
|
"github.com/aler9/gortsplib" |
|
"github.com/aler9/gortsplib/pkg/base" |
|
"github.com/aler9/gortsplib/pkg/headers" |
|
|
|
"github.com/aler9/rtsp-simple-server/internal/conf" |
|
) |
|
|
|
// Client can be |
|
// *clientrtsp.Client |
|
// *clientrtmp.Client |
|
type Client interface { |
|
IsClient() |
|
IsSource() |
|
Close() |
|
Authenticate([]headers.AuthMethod, |
|
string, []interface{}, |
|
string, string, interface{}) error |
|
OnReaderFrame(int, gortsplib.StreamType, []byte) |
|
} |
|
|
|
// ErrAuthNotCritical is a non-critical authentication error. |
|
type ErrAuthNotCritical struct { |
|
*base.Response |
|
} |
|
|
|
// Error implements the error interface. |
|
func (ErrAuthNotCritical) Error() string { |
|
return "non-critical authentication error" |
|
} |
|
|
|
// ErrAuthCritical is a critical authentication error. |
|
type ErrAuthCritical struct { |
|
*base.Response |
|
} |
|
|
|
// Error implements the error interface. |
|
func (ErrAuthCritical) Error() string { |
|
return "critical authentication error" |
|
} |
|
|
|
// DescribeRes is a client describe response. |
|
type DescribeRes struct { |
|
SDP []byte |
|
Redirect string |
|
Err error |
|
} |
|
|
|
// DescribeReq is a client describe request. |
|
type DescribeReq struct { |
|
Client Client |
|
PathName string |
|
Req *base.Request |
|
Res chan DescribeRes |
|
} |
|
|
|
// SetupPlayRes is a setup/play response. |
|
type SetupPlayRes struct { |
|
Path Path |
|
Err error |
|
} |
|
|
|
// SetupPlayReq is a setup/play request. |
|
type SetupPlayReq struct { |
|
Client Client |
|
PathName string |
|
TrackID int |
|
Req *base.Request |
|
Res chan SetupPlayRes |
|
} |
|
|
|
// AnnounceRes is a client announce response. |
|
type AnnounceRes struct { |
|
Path Path |
|
Err error |
|
} |
|
|
|
// AnnounceReq is a client announce request. |
|
type AnnounceReq struct { |
|
Client Client |
|
PathName string |
|
Tracks gortsplib.Tracks |
|
Req interface{} |
|
Res chan AnnounceRes |
|
} |
|
|
|
// RemoveReq is a remove request. |
|
type RemoveReq struct { |
|
Client Client |
|
Res chan struct{} |
|
} |
|
|
|
// PlayReq is a play request. |
|
type PlayReq struct { |
|
Client Client |
|
Res chan struct{} |
|
} |
|
|
|
// RecordReq is a record request. |
|
type RecordReq struct { |
|
Client Client |
|
Res chan struct{} |
|
} |
|
|
|
// PauseReq is a pause request. |
|
type PauseReq struct { |
|
Client Client |
|
Res chan struct{} |
|
} |
|
|
|
// Path is implemented by path.Path. |
|
type Path interface { |
|
Name() string |
|
SourceTrackCount() int |
|
Conf() *conf.PathConf |
|
OnClientRemove(RemoveReq) |
|
OnClientPlay(PlayReq) |
|
OnClientRecord(RecordReq) |
|
OnClientPause(PauseReq) |
|
OnFrame(int, gortsplib.StreamType, []byte) |
|
}
|
|
|