mirror of
https://github.com/Vateron-Media/XC_VM.git
synced 2026-10-31 19:03:43 +01:00
A module declares SourceDriverInterface classes in module.json
("source_drivers", optional "start_timeout") and claims URL schemes of its
own; core runs the driver's engine in ffmpeg's place for those sources.
- SourceDriverRegistry: scheme -> driver, loaded via ModuleLoader::loadAll()
(no bootAll, so the streaming entry point works), core schemes reserved,
a scheme claimed by two modules goes to neither, unknown schemes refused.
- StreamProcess: per-source choice in the supervised spec and the PHP
monitor path; ffmpeg-only settings (transcode, maps, RTMP, delay…) refuse
the driver; argv escaped by core, must name the playlist; no fallback_cmd
or probe_cmd; the driver's start_timeout extends the start wait.
- ProcessManager recognises a driver engine by binary + playlist, so
monitor, stop and cron treat it as the stream's producer.
- MonitorCommand priority/force checks go through sourceAnswers()
(driver's available() or ffprobe).
- Offset the added branches in startStream/buildSupervisorSpec/producerKind
with behaviour-preserving simplifications (CRAP ratchet).
29 lines
713 B
PHP
29 lines
713 B
PHP
<?php
|
|
|
|
use XcVm\Core\Module\SourceDriverInterface;
|
|
|
|
/** A scriptable source driver for the source-driver tests. */
|
|
class TestSourceDriver implements SourceDriverInterface {
|
|
public array $argv = [];
|
|
public bool $up = true;
|
|
|
|
public function __construct(private array $schemes, private string $binary = 'xcvm-test') {
|
|
}
|
|
|
|
public function schemes(): array {
|
|
return $this->schemes;
|
|
}
|
|
|
|
public function binary(): string {
|
|
return $this->binary;
|
|
}
|
|
|
|
public function buildArgv(array $ctx): array {
|
|
return $this->argv ?: ['/opt/' . $this->binary, '-i', $ctx['url'], '-o', $ctx['hls']['dir'] . $ctx['hls']['playlist']];
|
|
}
|
|
|
|
public function available(int $streamId, string $url): bool {
|
|
return $this->up;
|
|
}
|
|
}
|