streamd: preview quality picker, dashboard polish, C4 wrap keys
All checks were successful
release / build-and-upload (push) Successful in 6m18s
modules-release / build-and-upload (push) Successful in 5m18s

- Preview player can select FHD/HD/SD (or ABR master) from publish links
- Embed dashboard screenshots in README; Linux streamd+agent setup guide
- C4 Widevine wrap license mode + require --wvd; prefer Widevine PSSH
- Channel 4 and My5 modules; streamd auth, variants, schedules, HLS gate
This commit is contained in:
404errordeveloper 2026-10-09 20:57:43 +02:00
parent b3955bd81e
commit 066e018749
113 changed files with 19002 additions and 1541 deletions

View file

@ -9,15 +9,19 @@ import (
"drmdecryption/repo"
)
// streamSettings are the downloader knobs for one stream. They come from the
// stream's app module when it declares them, so the supervisor never has to
// guess from an app name or a stream name.
// streamSettings are the downloader and packager knobs for one stream. They
// come from the stream row first, then the stream's app module, then the
// installation-wide settings, then neutral defaults — so the supervisor never
// has to guess from an app name or a stream name.
type streamSettings struct {
VideoSelect string
AudioSelect string
Rewriter string
LiveWait int
TSReadyBytes int64
// HLSTime and HLSListSize shape every output's segmenting.
HLSTime int
HLSListSize int
// IsHLS drives packaging choices that depend on the manifest format.
IsHLS bool
}
@ -31,15 +35,20 @@ const (
hlsLiveWait = 6
)
// settingsFor resolves a stream's downloader settings: the app module's
// declarations first, then the stream row, then neutral defaults.
func settingsFor(st db.Stream) streamSettings {
// settingsFor resolves a stream's settings. globals is the installation-wide
// layer, read from the settings table; pass the zero value when there is none.
func settingsFor(st db.Stream, globals db.PackagerSettings) streamSettings {
// Per-stream overrides win over everything.
own := db.ParsePackagerSettings(st.SettingsJSON)
s := streamSettings{
VideoSelect: strings.TrimSpace(st.VideoSelect),
AudioSelect: strings.TrimSpace(st.AudioSelect),
Rewriter: strings.TrimSpace(st.Rewriter),
LiveWait: defaultLiveWait,
TSReadyBytes: defaultTSReadyBytes,
LiveWait: own.LiveWait,
TSReadyBytes: int64(own.TSReadyBytes),
HLSTime: own.HLSTime,
HLSListSize: own.HLSListSize,
IsHLS: isHLS(st),
}
if sd := streamDefaultsFor(st.App); sd != nil {
@ -52,21 +61,53 @@ func settingsFor(st db.Stream) streamSettings {
if s.Rewriter == "" {
s.Rewriter = sd.RewriterName()
}
if n := sd.LiveWaitSeconds(); n > 0 {
s.LiveWait = n
if s.LiveWait == 0 {
if n := sd.LiveWaitSeconds(); n > 0 {
s.LiveWait = n
}
}
if n := sd.TSReadyBytes(); n > 0 {
s.TSReadyBytes = n
if s.TSReadyBytes == 0 {
if n := sd.TSReadyBytes(); n > 0 {
s.TSReadyBytes = n
}
}
}
// Installation-wide settings.
if s.LiveWait == 0 {
s.LiveWait = globals.LiveWait
}
if s.TSReadyBytes == 0 {
s.TSReadyBytes = int64(globals.TSReadyBytes)
}
if s.HLSTime == 0 {
s.HLSTime = globals.HLSTime
}
if s.HLSListSize == 0 {
s.HLSListSize = globals.HLSListSize
}
// An HLS source needs a longer wait and a bigger buffer before probing,
// but only when nothing more specific asked otherwise.
if s.IsHLS {
if s.LiveWait == defaultLiveWait {
if s.LiveWait == 0 {
s.LiveWait = hlsLiveWait
}
if s.TSReadyBytes == defaultTSReadyBytes {
if s.TSReadyBytes == 0 {
s.TSReadyBytes = hlsTSReadyBytes
}
}
// Neutral defaults.
if s.LiveWait == 0 {
s.LiveWait = defaultLiveWait
}
if s.TSReadyBytes == 0 {
s.TSReadyBytes = defaultTSReadyBytes
}
if s.HLSTime == 0 {
s.HLSTime = defaultHLSTime
}
if s.HLSListSize == 0 {
s.HLSListSize = defaultHLSListSize
}
if s.VideoSelect == "" {
s.VideoSelect = "for=best"
}