import type { DecodedVideoSample } from "#media/media-source"; import type { BoxStyle } from "supervision-js-core"; import type { BoxCornerStyle } from "supervision-js-core"; import type { EllipseStyle } from "supervision-js-core"; import type { BufferedDetectionTimeline, DetectionBufferState } from "supervision-js-core"; import type { DetectionLabelBounds, MediaFrameCapture, MediaFrameCaptureOptions, MediaRendererDiagnosticsOptions, MediaFrameRenderTimings, MediaRendererFit, MediaRendererPresentation, MediaRendererOptions } from "#types/media-renderer"; import type { DetectionPickResult, DetectionSelectionOptions, MediaInteractionOptions } from "supervision-js-core"; import type { FocusStyle } from "supervision-js-core"; import type { InteractionStyle } from "supervision-js-core"; import type { LabelStyle } from "supervision-js-core"; import type { MaskHaloStyle, MaskStyle } from "supervision-js-core"; import type { MarkerStyle } from "supervision-js-core"; import type { OrientedBoxStyle } from "supervision-js-core"; import type { PercentageBarStyle } from "supervision-js-core"; import type { RegionAnnotationRenderer, DepthAnnotationRenderer, HeatmapAnnotationRenderer, PolygonStyle, PolylineStyle, ShapeStyle, KeypointStyle } from "supervision-js-core"; import type { MediaDisplayAdjustments } from "supervision-js-core"; import type { Point, ViewportTransform } from "supervision-js-core"; import type { AnnotationEditingEngine, AnnotationOverlayStyle, PreviewOverlayData } from "supervision-js-core"; import type { RenderPreparationOptions, ResolvedRenderPreparationGateThresholds } from "#types/render-preparation"; import type { MaskBrushPreviewOptions } from "#editing/mask-brush-editor"; import type { DepthFrameProvider } from "#render-preparation/depth/source"; import type { ActiveDepthMap } from "#types/media-depth"; import type { PresentedFrameSource } from "./presented-frame-channel"; import type { PreparedAnnotationWindowSnapshot } from "./prepared-annotation-window"; import type { MediaRendererDisplay } from "#types/media-renderer-display"; export interface MediaRendererSceneOptions { readonly annotationAntialiasing?: MediaRendererPresentation["annotationAntialiasing"]; readonly container: HTMLElement; readonly backgroundColor: MediaRendererPresentation["backgroundColor"]; readonly fit: MediaRendererFit; readonly maxDevicePixelRatio: number | undefined; readonly pixelInspection?: MediaRendererOptions["pixelInspection"]; readonly detectionTimeline: BufferedDetectionTimeline; readonly boxStyle: BoxStyle | null | undefined; readonly boxCornerStyle: BoxCornerStyle | null | undefined; readonly ellipseStyle: EllipseStyle | null | undefined; readonly focusStyle: FocusStyle | null | undefined; readonly labelStyle: LabelStyle | null | undefined; readonly maskHaloStyle: MaskHaloStyle | null | undefined; readonly maskStyle: MaskStyle | null | undefined; readonly maskOrder?: MediaRendererOptions["maskOrder"]; readonly markerStyle: MarkerStyle | null | undefined; readonly orientedBoxStyle: OrientedBoxStyle | null | undefined; readonly percentageBarStyle: PercentageBarStyle | null | undefined; readonly polygonStyle: PolygonStyle | null | undefined; readonly polylineStyle: PolylineStyle | null | undefined; /** * Internal shape decoration hook. Renderer kinds that lower to shape * instructions will feed this; it has no public presentation field. */ readonly shapeStyle?: ShapeStyle | null; readonly keypointStyle: KeypointStyle | null | undefined; readonly regionRenderers: readonly RegionAnnotationRenderer[]; readonly heatmapRenderers?: readonly HeatmapAnnotationRenderer[]; readonly depthRenderers?: readonly DepthAnnotationRenderer[]; readonly interaction: MediaInteractionOptions | undefined; readonly interactionStyle: InteractionStyle | null | undefined; readonly canInteract: () => boolean; readonly renderPreparation: RenderPreparationOptions | undefined; readonly diagnostics: MediaRendererDiagnosticsOptions | undefined; readonly visibility: MediaRendererPresentation["visibility"]; readonly editingEngine: AnnotationEditingEngine | undefined; readonly annotationOverlayStyle: AnnotationOverlayStyle | null | undefined; readonly maskBrush: MaskBrushPreviewOptions | undefined; readonly previewOverlay: (() => PreviewOverlayData | null) | undefined; /** Propagates renderer-owned asynchronous visual changes into runtime state. */ readonly onPresentationUpdate?: (sample: PresentedMediaSample) => void; /** Propagates the fitted display and pixel ratio to the decoder. */ readonly onDisplayChange?: (display: MediaRendererDisplay) => void; /** * Present plane of a media source that decides for itself which frame is on * screen. Given one, the scene presents what the producer announces instead * of what the renderer pulls, and renders only when something changed. */ readonly presentedFrames?: PresentedFrameSource; /** * The media is a single frame with nothing to play. The scene then renders * only when something changed, as under push presentation, and runs the * ticker only while something on the frame animates. */ readonly stillFrame?: boolean; } export interface PresentedMediaSample { /** * Which frame the scene has on screen, as its count of the frames it has * presented. Two presentations of one media time carry different serials, and * every redraw of the frame on screen carries that frame's own. */ readonly presentedFrameSerial: number; readonly mediaTime: number; readonly duration?: number; readonly activeDetectionFrameTime: number | null; readonly activeDetectionFrameIndex: number | null; readonly activeDetectionCount: number; /** Detection frame the mask raster on screen belongs to, null when no mask is * up. Apart from `activeDetectionFrameTime` it names a desync in seconds. */ readonly drawnMaskFrameTime: number | null; /** The raster on screen and the detections over it name different frames. * This is an invariant breach: a pending mask must leave the frame bare. */ readonly maskHeldStale: boolean; readonly detectionBuffer: DetectionBufferState; readonly renderTimings?: MediaFrameRenderTimings; } export interface MediaRendererScene { readonly rendererBackend: string; /** * Explicit renders issued so far, which a push-presented scene only issues on * change. A scene that free-runs on the ticker has no such count. */ getRenderCount?(): number | null; /** * Which frames around the playhead have every enabled layer's data cooked. A * scene that free-runs on the ticker gates nothing and reports none. */ getPreparedAnnotationWindow?(): PreparedAnnotationWindowSnapshot | null; initializeMedia(dimensions: { width: number; height: number; }): void; /** * Whether the playhead is moving. Cooking far ahead of a resting playhead is * speculation, so the scene narrows what it prepares until the playhead moves * again. */ setPlaybackActive?(active: boolean): void; /** While a drag holds the playhead, work ahead of it follows the hand. */ setScrubbing?(scrubbing: boolean): void; setTimelineContext?(context: MediaRendererSceneTimelineContext): void; presentSample(sample: DecodedVideoSample): PresentedMediaSample; /** * Encodes the media pixels presented by the most recent sample, paired with * that sample's presentation timestamp. */ captureFrame?(options: MediaFrameCaptureOptions | undefined): Promise; /** * Whether `waitForRenderPreparation` would wait, scheduling nothing. A source * that owns its own playhead is held by stopping it, so the renderer needs * this answer before it opens a wait rather than from the wait itself. */ needsRenderPreparationWait?(mediaTime: number, options: ResolvedRenderPreparationGateThresholds): boolean; /** * Frames render preparation has finished, counted up over the scene's life. * A gate that gave up reads this to tell preparation that is slow from * preparation that is stuck: only the second deserves to stay given up on. */ getRenderPreparationProgress?(): number; waitForRenderPreparation?(mediaTime: number, options: ResolvedRenderPreparationGateThresholds, signal?: AbortSignal): Promise; setRenderQuality(maxDevicePixelRatio: number | undefined): void; setDisplayAdjustments?(adjustments: MediaDisplayAdjustments): void; getViewportTransform?(): ViewportTransform; setViewportTransform?(transform: Partial>): void; setViewportLocked?(locked: boolean): void; screenToMedia?(point: Point): Point; mediaToScreen?(point: Point): Point; getDetectionLabelBounds?(detectionId: string | number): DetectionLabelBounds | null; panViewportBy?(dx: number, dy: number): void; zoomViewportAt?(point: Point, factor: number): void; zoomViewportFromWheel?(point: Point, deltaY: number): void; setPresentation(presentation: MediaRendererPresentation, mediaTime: number): PresentedMediaSample | void; setSelectedDetection?(selection: DetectionSelectionOptions | null, mediaTime: number): DetectionPickResult | null; /** Redraws the frame on screen with the new depth; null removes it. */ setDepthSource?(source: DepthFrameProvider | null): void; getActiveDepth?(): ActiveDepthMap | null; /** Called on every playhead move, never from inside a present. */ prefetchDepth?(mediaTime: number): void; destroy(): void; } export interface MediaRendererSceneTimelineContext { readonly duration: number | null; readonly firstTimestamp: number; readonly loop: boolean; } //# sourceMappingURL=media-renderer-scene.d.ts.map