import type { Browser, Page } from "puppeteer-core"; import type { HdmiEncoderDefinition } from "./config.js"; /** * Runtime state for a single encoder's Chrome instance. */ interface EncoderBrowserState { /** The Puppeteer Browser handle. null when not launched. */ browser: Browser | null; /** The currently active Page (tab). null when no channel is loaded. */ page: Page | null; /** The URL currently being displayed. null when idle. */ currentUrl: string | null; /** True while a launch or navigation is in progress (prevents concurrent operations). */ busy: boolean; /** The encoder definition (display coordinates, stream URL, etc.). */ def: HdmiEncoderDefinition; /** The encoder index (0-based). */ index: number; } /** * Initializes the encoder state map from the loaded encoder definitions. Called once at startup. * @param defs - The array of encoder definitions from encoders.json. */ export declare function initializeEncoderStates(defs: HdmiEncoderDefinition[]): void; /** * Returns the runtime state for a given encoder index, or undefined if the index is invalid. * @param index - The encoder index. */ export declare function getEncoderState(index: number): EncoderBrowserState | undefined; /** * Returns the number of configured encoders. */ export declare function getEncoderCount(): number; /** * Navigates the specified encoder's Chrome instance to the given URL. Launches Chrome first if it * is not already running. Reuses the existing page if it is already on the correct URL. * * After navigation, calls initializePlayback() from browser/video.ts to detect the video element * and start playback — the same logic used by the main PrismCast streaming pipeline. * * @param index - The encoder index. * @param url - The streaming site URL to navigate to. * @returns true on success, false on failure. */ export declare function navigateEncoderToChannel(index: number, url: string): Promise; /** * Releases the current channel on an encoder by navigating to about:blank. Keeps the Chrome * process running so the next tune is fast. * @param index - The encoder index. */ export declare function releaseEncoder(index: number): Promise; /** * Returns a snapshot of all encoder states for the status endpoint. */ export declare function getEncoderStatusList(): { currentUrl: string | null; index: number; label: string; running: boolean; streamUrl: string; }[]; /** * Closes all encoder Chrome instances. Called during graceful shutdown. */ export declare function shutdownAllEncoderBrowsers(): Promise; export {};