import * as grpc from "@grpc/grpc-js"; import { Version, CurrentLoad } from "@norskvideo/norsk-api/lib/shared/common_pb"; import { AmdMA35DLoad, LicenseEvent } from "@norskvideo/norsk-api/lib/media_pb"; import { MediaNodeState, PinToKey } from "./media_nodes/common"; import { NorskInput } from "./media_nodes/input"; import { Gain, NorskProcessor, NorskDuplex } from "./media_nodes/processor"; import { NorskOutput } from "./media_nodes/output"; import { EncryptionSettings, StreamKey, StreamMetadata, Context, Wave } from "./media_nodes/types"; import { NorskInspect } from "./media_nodes/inspect"; import { IrohEndpointEvent, NorskSystem } from "./system"; import { NorskMediaStore } from "./media_nodes/mediaStore"; import { Timestamp } from "@bufbuild/protobuf/wkt"; export * from "./types"; export * from "./system"; export * from "./media_nodes/types"; export * from "./media_nodes/input"; export * from "./media_nodes/output"; export * from "./media_nodes/inspect"; export * from "./media_nodes/processor"; export * from "./media_nodes/spectrum"; export * from "./media_nodes/common"; export * from "./media_nodes/mediaStore"; export * from "./media_nodes/embeddedAI"; export * from "./media_nodes/reasoningPlan"; export * from "./media_nodes/reasoningEvaluate"; export * from "./license-identity"; export { LiveSpec, LivePlanSettings, LivePlanSession } from "./media_nodes/livePlan"; export { LiveEvaluateNode, LiveEvaluateSettings, LiveEvaluateStatus, LiveEvaluateUsage, LiveEvaluateVideoSettings, LiveReasoningProvider } from "./media_nodes/liveEvaluate"; export * from "./media_nodes/st2110"; export { MqaAudioWeights, MqaConfig, MqaTsErrorWeights, MqaVideoWeights } from "./media_nodes/mqa"; export { CurrentLoad, } from "@norskvideo/norsk-api/lib/shared/common_pb"; export { AmdMA35DLoad } from "@norskvideo/norsk-api/lib/media_pb"; export { AudioCodec } from "@norskvideo/norsk-api/lib/media_pb"; export * from "./system"; export { Version } from "@norskvideo/norsk-api/lib/shared/common_pb"; /** @public */ export type Log = { level: "emergency" | "alert" | "critical" | "error" | "warning" | "notice" | "info" | "debug"; timestamp: Date; message: string; metadata: object; }; /** @public */ export type Notification = { level: "error" | "warning" | "info"; /** Descriptive notification message text. */ text: string; /** Code/tag identifying the class of notification from this source */ code: string; /** When was the notification raised (if a recurring issue, this particular latest instance) */ timestamp: Date; /** The media node raising the notification */ mediaNodeId?: string; /** The type of the raising media node (description) */ mediaNodeClass?: string; /** * The type of processor within the media node giving rise to the notification (this can be used to understand the * cause of the notification with reference to the visualiser for that media node). */ nodeClass?: string; /** * For media nodes that contain multiple instances of the indicated notification origin, an indicator as to the particular source, * e.g. for an SRT listener with multiple TS decoders, this will indicate which source decoder was the origin */ instance?: string; /** * Labels specific to the type of notification which may give additional information */ labels: Record; }; /** * @public * Retraction of a previously-raised notification (matched by `code` for the * given `mediaNodeId`). Sent when the underlying condition clears. */ export type NotificationCleared = { /** Code/tag of the notification being retracted (matches Notification.code) */ code: string; /** The media node the notification was raised against */ mediaNodeId: string; }; /** * @public * Top level Norsk configuration */ export interface NorskSettings { /** * Callback URL to listen on for gRPC session with Norsk Media * Defaults to $NORSK_HOST:$NORSK_PORT if the environment variables are set * where NORSK_HOST defaults to "127.0.0.1" and NORSK_PORT to "6790" * (so "127.0.0.1:6790" if neither variable is set) */ url?: string; onAttemptingToConnect?: () => void; onConnecting?: () => void; onReady?: () => void; onFailedToConnect?: () => void; /** Code to execute if the Norsk node is shutdown - by default it logs and nothing else */ onShutdown?: () => void; onCurrentLoad?: (load: CurrentLoad) => void; onAmdMA35DLoad?: (load: AmdMA35DLoad) => void; onHello?: (version: Version) => void; onLogEvent?: (log: Log) => void; /** * Manually handle license events, such as missing/invalid licenses and * sandbox timeout. (Logs messages to console by default.) */ onLicenseEvent?: (message: string, running: boolean, fullEvent: LicenseEvent) => void; onNotification?: (notification: Notification) => void; /** A previously-raised notification has been retracted (condition cleared) */ onNotificationCleared?: (cleared: NotificationCleared) => void; /** * A connection event on the shared iroh endpoint (peer connected / * rejected by the allow-list / disconnected). remoteNodeId is the * peer's TLS-verified public key (64-char hex). */ onIrohEndpointEvent?: (event: IrohEndpointEvent) => void; /** * Licensing V2: called if the license handshake fails (or no responder was * supplied). connect() still resolves; `norsk.licenseHandshake` carries the * same outcome. Media node creation will be refused by the engine. */ onLicenseChallengeFailed?: (message: string) => void; /** * Licensing V2: respond to the engine's license challenge. Engines holding * a per-product (V2) license send a challenge nonce in their hello and * refuse to create media nodes until a product (e.g. Studio) has answered * it with its certs and signatures. V1-licensed engines never issue a * challenge, so plain SDK applications can ignore this setting entirely. */ onLicenseChallenge?: (challenge: Uint8Array) => Promise | LicenseChallengeResponse; grpc?: Partial; } /** * @public * Licensing V2: a product's answer to the engine's license challenge. * Certs are Norsk-root-signed JSON envelopes; signatures are Ed25519 by the * respective cert holder's private key. */ export type LicenseChallengeResponse = { /** Root-signed studio-runtime cert (JSON envelope bytes) */ studioCert: Uint8Array; /** Signature over the challenge nonce by the studio-runtime key */ studioSig: Uint8Array; /** The declared product, e.g. "norsk-studio" — must appear in the license */ productName: string; /** Image ref of the product container, checked against the license entry */ imageRef: string; /** * Root-signed product-signer cert (JSON envelope bytes). Present only for * "signed" products (e.g. Probe) where the runtime relays a signed workflow; * omit for "designer" products (Studio), which carry no workflow signature. */ productCert?: Uint8Array; /** sha256 of the workflow document — present with productCert. */ yamlHash?: Uint8Array; /** Signature over yamlHash by the product-signer key — present with productCert. */ yamlSig?: Uint8Array; }; /** * @public * The entrypoint for all Norsk Media applications * * @example * ```ts * const norsk = new Norsk(); * ``` */ export declare class Norsk { /** * All of the nodes created for this Norsk instance */ get Nodes(): MediaNodeState[]; /** * Nodes that are in the process of being created */ get PendingNodes(): MediaNodeState[]; /** * Implements the {@link NorskInput} interface */ input: NorskInput; /** * Implements the {@link NorskOutput} interface */ output: NorskOutput; /** * Implements the {@link NorskDuplex} interface */ duplex: NorskDuplex; /** * Implements the {@link NorskProcessor} interface */ processor: NorskProcessor; /** * Implements the {@link NorskMediaStore} interface */ mediaStore: NorskMediaStore; /** * Implements the {@link NorskInspect} interface */ inspect: NorskInspect; /** * Implements the {@link NorskSystem} interface */ system: NorskSystem; /** /* The settings used to create this Norsk instance */ settings: NorskSettings; /** * Norsk Runtime version information */ version: Version; /** * Norsk SDK version information */ sdkVersion: string; /** * Norsk license information */ license: { email: string; timeout?: number; expiry?: Timestamp; activeFeaturePacks: string[]; expiredFeaturePacks: string[]; }; /** * Licensing V2: the outcome of the license handshake, once connect() has * resolved. `undefined` on a V1-licensed engine (no handshake); `{accepted}` * on a V2 engine. When `accepted` is false, media node creation will be * refused — `message` carries the engine's reason. connect() resolves either * way so callers can read this and surface it rather than discovering the * failure only at the first node creation. */ licenseHandshake?: { accepted: boolean; message: string; }; close(): Promise; /** @public */ static connect(settings?: NorskSettings): Promise; private onConnectionTimeout; } /** * @public * Filters a context to only the audio streams within it * @param streams - The media context from which to return the streams * @returns The audio streams in the media context */ export declare function audioStreams(streams: readonly StreamMetadata[]): StreamMetadata[]; /** * @public * Filters a context to only the video streams within it * @param streams - The media context from which to return the streams * @returns The video streams in the media context */ export declare function videoStreams(streams: readonly StreamMetadata[]): StreamMetadata[]; /** * @public * Filters a context to only the subtitle streams within it * @param streams - The media context from which to return the streams * @returns The subtitle streams in the media context */ export declare function subtitleStreams(streams: readonly StreamMetadata[]): StreamMetadata[]; /** * @public * Filters a context to only the playlist streams within it * @param streams - The media context from which to return the streams * @returns The playlist streams in the media context */ export declare function playlistStreams(streams: readonly StreamMetadata[]): StreamMetadata[]; /** * @public * Filters a context to only the ancillary streams within it * @param streams - The media context from which to return the streams * @returns The ancillary streams in the media context */ export declare function ancillaryStreams(streams: readonly StreamMetadata[]): StreamMetadata[]; /** * @public * Returns the stream keys for audio streams in a media context * @param streams - The media context from which to return the stream keys * @returns The audio stream keys in the media context */ export declare function audioStreamKeys(streams: readonly StreamMetadata[]): StreamKey[]; /** * @public * Returns the stream keys for video streams in a media context * @param streams - The media context from which to return the stream keys * @returns The video stream keys in the media context */ export declare function videoStreamKeys(streams: readonly StreamMetadata[]): StreamKey[]; /** * @public * Returns the stream keys for subtitle streams in a media context * @param streams - The media context from which to return the stream keys * @returns The subtitle stream keys in the media context */ export declare function subtitleStreamKeys(streams: readonly StreamMetadata[]): StreamKey[]; /** * @public * Returns the stream keys for playlist streams in a media context * @param streams - The media context from which to return the stream keys * @returns The playlist stream keys in the media context */ export declare function playlistStreamKeys(streams: readonly StreamMetadata[]): StreamKey[]; /** * @public * Returns the stream keys for ancillary streams in a media context * @param streams - The media context from which to return the stream keys * @returns The ancillary stream keys in the media context */ export declare function ancillaryStreamKeys(streams: readonly StreamMetadata[]): StreamKey[]; /** @public */ export declare function newSilentMatrix(rows: number, cols: number): Gain[][]; /** * @public * * Provided for compatibilty, this is just e.g. `{ type: "sine", freq: 444 }` */ export declare function mkSine(freq: number): Wave; /** * @public * Select all the streams from the input * @param streams - The streams from the inbound Context * @returns Array of selected StreamKeys */ export declare function selectAll(streams: readonly StreamMetadata[]): StreamKey[]; /** * @public * Select all the audio and video streams from the input * @param streams - The streams from the inbound Context * @returns Array of selected StreamKeys */ export declare function selectAV(streams: readonly StreamMetadata[]): StreamKey[]; /** * @public * Select all the subtitle streams from the input * @param streams - The streams from the inbound Context * @returns Array of selected StreamKeys */ export declare function selectSubtitles(streams: readonly StreamMetadata[]): StreamKey[]; /** * @public * Select all the audio streams from the input * @param streams - The streams from the inbound Context * @returns Array of selected StreamKeys */ export declare function selectAudio(streams: readonly StreamMetadata[]): StreamKey[]; /** * @public * Select all the video streams from the input * @param streams - The streams from the inbound Context * @returns Array of selected StreamKeys */ export declare function selectVideo(streams: readonly StreamMetadata[]): StreamKey[]; /** * @public * Select all the ancillary data streams from the input * @param streams - The streams from the inbound Context * @returns Array of selected StreamKeys */ export declare function selectAncillary(streams: readonly StreamMetadata[]): StreamKey[]; /** * @public * Create a selector selecting all the video streams from the input with the specified rendition name * @param renditionName - The streams from the inbound Context * @returns Array of selected StreamKeys */ export declare function selectVideoRendition(renditionName: string): (streams: readonly StreamMetadata[]) => StreamKey[]; /** * @public * Select the audio stream with the given renditionName — e.g. to subscribe to * one named output of an {@link NorskTransform.audioGraph} node. */ export declare function selectAudioRendition(renditionName: string): (streams: readonly StreamMetadata[]) => StreamKey[]; /** @public */ export declare function selectExactKey(key: StreamKey): (streams: readonly StreamMetadata[]) => StreamKey[]; /** @public */ export declare function selectPlaylist(streams: readonly StreamMetadata[]): StreamKey[]; /** * @public * Generate encryption parameters from from an encryption KeyID and Key, * in the form KEYID:KEY, both 16byte hexadecimal */ export declare function mkEncryption(encryption: string | undefined, pssh?: string | undefined): EncryptionSettings | undefined; /** @public */ export declare function videoToPin(pin: Pins): (streams: StreamMetadata[]) => PinToKey; /** @public */ export declare function audioToPin(pin: Pins): (streams: StreamMetadata[]) => PinToKey; /** @public */ export declare function avToPin(pin: Pins): (streams: StreamMetadata[]) => PinToKey; /** @public */ export declare function sourceToPin(source: string, pin: Pins): (streams: StreamMetadata[]) => PinToKey; /** @public */ export declare function subtitlesToPin(pin: Pins): (streams: StreamMetadata[]) => PinToKey; /** @public */ export declare function ancillaryToPin(pin: Pins): (streams: StreamMetadata[]) => PinToKey; /** * @public * Validation function to require at least one audio and at least one video stream. Often the default validation * will happen to ensure this, as audio and video are subscribed from separate media nodes, but when one media node * will produce both audio and video, default validation cannot know that both are required. */ export declare function requireAV(ctx: Context): boolean; /** * @public * Validation function to require exactly N audio and exactly M video streams. Often the default validation * will happen to ensure this, as audio and video are subscribed from separate media nodes, but when one media node * will produce both audio and video, default validation cannot know that both are required. */ export declare function requireExactAV({ audio, video }: { audio: number; video: number; }): (ctx: Context) => boolean; /** * @public * Compares two stream keys by value, returning true if the stream keys refer to the same stream */ export declare function streamKeysAreEqual(l: StreamKey, r: StreamKey): unknown; //# sourceMappingURL=sdk.d.ts.map