Initial commit: Null DRM Official
Capture, decrypt, and restream toolkit with compiled-in app modules (RTE, TG4, BBC), on-device MITM proxy, streamd control plane, and www. BBC module.yaml is published (clear streams); other module values stay local.
This commit is contained in:
commit
2fa8f2435f
121 changed files with 17802 additions and 0 deletions
118
apps/modules/rte/config.go
Normal file
118
apps/modules/rte/config.go
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
package rte
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"drmdecryption/modcfg"
|
||||
"drmdecryption/modules/provider"
|
||||
"drmdecryption/mpd"
|
||||
)
|
||||
|
||||
// Name is the module id (--app rte).
|
||||
const Name = "rte"
|
||||
|
||||
// Channel is one live channel's phone-UI selectors and encoder identity. All of
|
||||
// it is data: nothing here is compiled into the binary.
|
||||
type Channel struct {
|
||||
Label string `yaml:"label"`
|
||||
// ChipDesc matches the channel chip on the Live tab.
|
||||
ChipDesc []string `yaml:"chip_desc"`
|
||||
// PlayDesc matches the large hero Play button.
|
||||
PlayDesc []string `yaml:"play_desc"`
|
||||
}
|
||||
|
||||
// Config is apps/modules/rte/module.yaml.
|
||||
type Config struct {
|
||||
provider.Common `yaml:",inline"`
|
||||
|
||||
Channels map[string]Channel `yaml:"channels"`
|
||||
|
||||
// Origins maps an encoder channel id to its Smooth Streaming origin base.
|
||||
Origins map[string]string `yaml:"origins"`
|
||||
// KIDs maps an encoder channel id to its Widevine KID.
|
||||
KIDs map[string]string `yaml:"kids"`
|
||||
// EncoderChannelRE matches origin channel ids that use the encoder timeline.
|
||||
EncoderChannelRE string `yaml:"encoder_channel_re"`
|
||||
// OriginMarker is the path element identifying an origin BaseURL.
|
||||
OriginMarker string `yaml:"origin_marker"`
|
||||
|
||||
// Synthetic tunes the generated MPD. Everything in it has a safe default.
|
||||
Synthetic mpd.SyntheticConfig `yaml:"synthetic"`
|
||||
|
||||
// HeroMinArea is the smallest node area accepted as the hero Play button.
|
||||
HeroMinArea int `yaml:"hero_min_area"`
|
||||
|
||||
Timeouts Timeouts `yaml:"timeouts"`
|
||||
UI UI `yaml:"ui"`
|
||||
}
|
||||
|
||||
// Timeouts for the launch / autoplay sequence. Written as "25s" in module.yaml.
|
||||
type Timeouts struct {
|
||||
LaunchWaitUI provider.Duration `yaml:"launch_wait_ui"`
|
||||
LiveTab provider.Duration `yaml:"live_tab"`
|
||||
ChipWait provider.Duration `yaml:"chip_wait"`
|
||||
PlayWait provider.Duration `yaml:"play_wait"`
|
||||
Playback provider.Duration `yaml:"playback"`
|
||||
LaunchSettle provider.Duration `yaml:"launch_settle"`
|
||||
AfterLiveTab provider.Duration `yaml:"after_live_tab"`
|
||||
AfterChip provider.Duration `yaml:"after_chip"`
|
||||
}
|
||||
|
||||
// UI holds the markers the launch/autoplay sequence waits on, as config so an
|
||||
// app UI redesign needs no rebuild.
|
||||
type UI struct {
|
||||
// LaunchDescContains: any of these means the app is up.
|
||||
LaunchDescContains []string `yaml:"launch_desc_contains"`
|
||||
// LiveTabDescRE matches the Live tab to tap.
|
||||
LiveTabDescRE []string `yaml:"live_tab_desc_re"`
|
||||
}
|
||||
|
||||
func (c Config) withDefaults() Config {
|
||||
if c.EncoderChannelRE == "" {
|
||||
c.EncoderChannelRE = `^(vc|channel)\d+$`
|
||||
}
|
||||
if c.OriginMarker == "" {
|
||||
c.OriginMarker = ".isml"
|
||||
}
|
||||
if c.HeroMinArea == 0 {
|
||||
c.HeroMinArea = 200_000
|
||||
}
|
||||
t := &c.Timeouts
|
||||
t.LaunchWaitUI = provider.Duration(t.LaunchWaitUI.D(25 * time.Second))
|
||||
t.LiveTab = provider.Duration(t.LiveTab.D(30 * time.Second))
|
||||
t.ChipWait = provider.Duration(t.ChipWait.D(20 * time.Second))
|
||||
t.PlayWait = provider.Duration(t.PlayWait.D(15 * time.Second))
|
||||
t.Playback = provider.Duration(t.Playback.D(45 * time.Second))
|
||||
t.LaunchSettle = provider.Duration(t.LaunchSettle.D(4 * time.Second))
|
||||
t.AfterLiveTab = provider.Duration(t.AfterLiveTab.D(2 * time.Second))
|
||||
t.AfterChip = provider.Duration(t.AfterChip.D(2 * time.Second))
|
||||
if len(c.UI.LaunchDescContains) == 0 {
|
||||
c.UI.LaunchDescContains = []string{"live tab", "header logo"}
|
||||
}
|
||||
if len(c.UI.LiveTabDescRE) == 0 {
|
||||
c.UI.LiveTabDescRE = []string{"Live tab"}
|
||||
}
|
||||
c.Synthetic = c.Synthetic.WithDefaults()
|
||||
return c
|
||||
}
|
||||
|
||||
// flag overrides, bound before any app is constructed.
|
||||
var flags struct {
|
||||
packageName string
|
||||
licenseURL string
|
||||
caHash string
|
||||
proxyBin string
|
||||
}
|
||||
|
||||
func loadConfig() (Config, modcfg.Result, error) {
|
||||
var cfg Config
|
||||
res, err := modcfg.Load(Name, &cfg)
|
||||
if err != nil {
|
||||
return cfg, res, err
|
||||
}
|
||||
cfg.Package = modcfg.Override(Name, "package", flags.packageName, cfg.Package)
|
||||
cfg.LicenseURL = modcfg.Override(Name, "license_url", flags.licenseURL, cfg.LicenseURL)
|
||||
cfg.CAHash = modcfg.Override(Name, "ca_hash", flags.caHash, cfg.CAHash)
|
||||
cfg.ProxyBin = modcfg.Override(Name, "proxy_bin", flags.proxyBin, cfg.ProxyBin)
|
||||
return cfg.withDefaults(), res, nil
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue