Documentation
¶
Overview ¶
Package gamehost plays PC games on a computer with Steam and streams them to Matinee: the game host (cmd/matinee-gamehost) runs beside Steam, in a container or on a gaming PC, lists the games installed there, launches one, captures its picture and sound, encodes them on that computer's GPU and sends them to Matinee in the direct stream's messages (internal/gamestream/direct.go), taking the player's buttons back as virtual gamepads. Matinee passes the stream on to the player as it does an emulated game's.
Index ¶
Constants ¶
const ( KindVideo = 0x10 KindAudio = 0x11 )
const BigPicture = 0
BigPicture, as an app id, plays Steam itself: its Big Picture mode full screen, where the player picks and quits games with the controller.
const DesktopPath = "/v1/desktop/"
DesktopPath is where the host serves the desktop.
Variables ¶
var ErrBusy = errors.New("the game host is already playing a game")
ErrBusy means the host is already playing a game.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// URL is the host's address, such as http://steam:7174.
URL string
Token string
HTTP *http.Client
}
Client is Matinee's side of a game host.
func (*Client) Desktop ¶
Desktop passes requests on to the host's desktop: path is the part after the desktop's own address. It adds the token, and drops the player's cookies and credentials so they never reach the host.
type Game ¶
type Game struct {
AppID int `json:"appId"`
Name string `json:"name"`
// Size is how much room it takes on disk, in bytes.
Size int64 `json:"size,omitempty"`
}
Game is a game installed in Steam.
type Hello ¶
type Hello struct {
Width int `json:"width"`
Height int `json:"height"`
FPS float64 `json:"fps"`
// Encoder is what encodes the picture, such as h264_vaapi, for the
// server's logs.
Encoder string `json:"encoder,omitempty"`
}
Hello is the host's first message on the play socket: the picture it sends.
type Host ¶
type Host struct {
// SteamRoot is Steam's folder (see SteamRoot), or empty to look for it
// in SteamHome each time: on a first start Steam hasn't made it yet.
SteamRoot string
SteamHome string
// Token is what Matinee must send; empty lets anyone on the network in.
Token string
// Display is the X display the games show on, such as :55.
Display string
// FFmpeg encodes; VAAPI is the GPU's render node to encode on, such as
// /dev/dri/renderD128, or empty to encode on the CPU.
FFmpeg string
VAAPI string
// AudioSource is the PulseAudio source the games' sound is captured
// from: the default output's monitor unless set.
AudioSource string
// Bitrate is the picture's bitrate in megabits a second.
Bitrate int
// Steam is the command that launches a game: Steam's own, run with
// -applaunch <app id>.
Steam string
// Desktop is the address of a web page showing this computer's screen
// (see desktop.go), or empty for none.
Desktop string
Log *slog.Logger
// VideoInput and AudioInput replace FFmpeg's input arguments, for tests.
VideoInput, AudioInput []string
// contains filtered or unexported fields
}
Host is the game host's side: it serves the protocol in protocol.go.