// VR Media Server 2.0 — shared TypeScript types // All detection / classification / feed types live here. export type Projection = | "vr180" | "vr360" | "fisheye" | "dual_fisheye" | "flat" | "unknown"; export type Stereo = | "sbs" // side-by-side | "ou" // over/under (aka top-bottom) | "top_bottom" // alias of ou | "mono" | "unknown"; export type LensType = | "fisheye" | "dual_fisheye" | "none" | "unknown"; export type ResolutionTier = | "SD" // < 720p | "HD" // 720p | "FHD" // 1080p | "4K" | "5K" | "6K" | "7K" | "8K" | "12K" | "unknown"; export type ContentType = | "standard_vr" | "passthrough" | "mixed_reality" | "ar" | "unknown"; export type VideoStatus = "pending" | "scanning" | "ready" | "error"; /** Connected cloud storage provider that hosts the video. */ export type VideoSource = "offcloud" | "terabox" | "blomp"; /** A video discovered on any connected cloud source (pre-database shape). */ export interface SourceFile { source: VideoSource; /** Provider-specific id (Offcloud requestId, TeraBox fs_id, Blomp container/object). */ sourceId: string; /** Provider-specific absolute path (TeraBox path, Blomp container/object). */ sourcePath: string | null; name: string; folderPath: string; streamUrl: string; size: string; duration?: number; addedAt?: Date; isMock?: boolean; } export type QueueStep = | "metadata" | "filename" | "stream" | "alpha" | "mask" | "frame" | "depth" | "classify"; /** Weighted scoring per the spec. */ export const CONFIDENCE_WEIGHTS = { alpha_channel: 0.4, // Layer 4 mask_track: 0.25, // Layer 5 feed_metadata: 0.15, // Layer 8 frame_analysis: 0.1, // Layer 10 filename_intelligence: 0.05, // Layer 6 folder_intelligence: 0.05, // Layer 7 } as const; /** Keyword dictionary for Layer 6 (Filename Intelligence Engine). */ export const FILENAME_KEYWORDS = { projection: { vr180: ["vr180", "180vr", "180_sbs", "180sbs", "180°", "180-degree", "_180_", "-180-", "_180-", "-180_", "fisheye180", "fisheye190", "fisheye_180", "fisheye_190", "180_fisheye", "190_fisheye"], vr360: ["vr360", "360vr", "360_sbs", "360sbs", "360°", "360-degree", "_360_", "-360-", "_360-", "-360_", "fisheye360", "fisheye_360"], }, stereo: { sbs: ["sbs", "sidebyside", "side-by-side", "side_by_side", "_sbs_", "-sbs-", "_sbs", "-sbs", "sbs_", "sbs-"], ou: ["_ou_", "-ou-", "_ou", "-ou", "ou_", "ou-", "overunder", "over-under", "topbottom", "top_bottom", "top-bottom", "_tb_", "-tb-"], }, lens: { fisheye: ["fisheye", "fish_eye", "fisheye180", "fisheye190", "fisheye_180", "fisheye_190"], dual_fisheye: ["dualfisheye", "dual-fisheye", "dual_fisheye", "dualfisheye180", "dualfisheye190"], }, // Short tokens (ar, mr, pt) use boundary-aware matching to avoid false positives // on substrings like "start" or "smart". The analyzer splits on word boundaries. passthrough: [ "passthrough", "pass-through", "pass_through", "pass-thru", "mixedreality", "mixed-reality", "mixed_reality", "quest3", "quest-3", "quest_3", "alpha", "_alpha", "-alpha", "ar", "mr", "pt", ], resolution: { "4K": ["4k", "2160p", "uhd", "4096p"], "5K": ["5k", "2880p", "2880x1440", "5k_lr"], "6K": ["6k", "3240p"], "7K": ["7k", "3780p"], "8K": ["8k", "4320p", "8kuhd"], "12K": ["12k", "6480p"], }, } as const; /** Folder patterns for Layer 7 (Folder Intelligence). */ export const FOLDER_PATTERNS = { passthrough: ["passthrough", "mixedreality", "mixed-reality", "ar", "quest3", "quest-3"], fisheye: ["fisheye", "dualfisheye", "dual-fisheye"], sbs: ["sbs", "sidebyside"], ou: ["ou", "overunder", "topbottom"], vr180: ["vr180", "180"], vr360: ["vr360", "360"], } as const; /** Mask-track filenames for Layer 5. */ export const MASK_FILENAMES = ["mask", "alpha", "matte", "transparency"]; /** Pixel formats that contain an alpha channel (Layer 4). */ export const ALPHA_PIXEL_FORMATS = [ "rgba", "bgra", "argb", "abgr", "yuva420p", "yuva422p", "yuva444p", "yuva420p10le", "yuva422p10le", "yuva444p10le", "yuva420p12le", "yuva422p12le", "yuva444p12le", "yuva420p16le", "yuva422p16le", "yuva444p16le", "pal8", // paletted can carry alpha ]; /** DEOVR projection values. */ export const DEOVR_PROJECTION_MAP: Record = { vr180: "180_sbs" in {} as never ? "" : "180", // corrected below vr360: "360", fisheye: "fisheye", dual_fisheye: "fisheye_dual", flat: "flat", unknown: "flat", }; /** DEOVR stereo values. */ export const DEOVR_STEREO_MAP: Record = { sbs: "sbs", ou: "ou", top_bottom: "tb", mono: "off", unknown: "off", }; /** A single detection layer's output. */ export interface LayerResult { layer: number; name: string; confidence: number; // 0-1 source: string; data: T; notes?: string; } /** The full detection report stored on each Video. */ export interface DetectionReport { layers: LayerResult[]; classification: { projection: Projection; stereo: Stereo; lensType: LensType; resolutionTier: ResolutionTier; contentType: ContentType; passthrough: boolean; }; confidence: { overall: number; passthrough: number; projection: number; stereo: number; }; evidence: { filenameMatch: boolean; folderMatch: boolean; sbsDetected: boolean; fisheyeDetected: boolean; alphaTrack: boolean; maskTrack: boolean; feedMetadata: boolean; frameAnalysis: boolean; depthAnalysis: boolean; }; createdAt: string; } /** Lightweight video list item. */ export interface VideoListItem { id: string; source: VideoSource; sourceId: string | null; sourcePath: string | null; name: string; folderPath: string; projection: Projection | null; stereo: Stereo | null; lensType: LensType | null; resolutionTier: ResolutionTier | null; contentType: ContentType | null; passthrough: boolean; duration: number | null; size: string; codec: string | null; status: VideoStatus; confidence: number | null; questCompatible: boolean; feedValid: boolean; thumbnailUrl: string | null; /** True when a user-uploaded cloud-drive image is matched as the thumbnail. */ customThumb?: boolean; manualOverride: boolean; createdAt: string; } /** Detailed video for the Inspector view. */ export interface VideoDetail extends VideoListItem { offcloudId: string; streamUrl: string; bitrate: string | null; fps: number | null; width: number | null; height: number | null; addedAt: string | null; lastScannedAt: string | null; passthroughScore: number | null; projectionScore: number | null; manualOverride: boolean; detectionReport: DetectionReport | null; feedErrors: string[] | null; errorMessage: string | null; } /** DEOVR feed entry — one per video. */ export interface DeovrFeedScene { name: string; list: string[]; // stream URLs videoLength: number; // seconds thumbnailUrl: string | null; authorized: -1 | 0 | 1; sceneType: 0 | 1 | 2 | 3 | 4; // 0=trusted, 1=third-party, etc. cast: string[]; tags: string[]; isFavorite: boolean; isWatchlist: boolean; is3D: boolean; projection: string; // DEOVR code stereo: string; // DEOVR code fov: number; // 180 or 360 lens: string | null; videoAverage: number; // rating 0-100 heatMap: string | null; // VR Media Server extensions passthrough: boolean; passthroughScore: number; questCompatible: boolean; resolution: string | null; codec: string | null; source: VideoSource; } /** Top-level DEOVR feed object. */ export interface DeovrFeed { authorized: -1 | 0 | 1; scenes: DeovrFeedScene[]; } /** Dashboard stats. */ export interface DashboardStats { total: number; byProjection: Record; byStereo: Record; byContentType: Record; byResolution: Record; passthrough: number; questCompatible: number; feedValid: number; scanning: number; pending: number; errors: number; offcloudStatus: "connected" | "disconnected" | "mock" | "error"; teraboxStatus: "connected" | "disconnected" | "error"; teraboxMode: "cookie" | "oauth" | null; blompStatus: "connected" | "disconnected" | "error"; blompContainer: string | null; blompRoot: string | null; bySource: Record; feedStatus: "operational" | "degraded" | "down"; activeStreams: number; } /** Processing queue item. */ export interface QueueItemView { id: string; videoId: string; videoName: string; source: VideoSource; status: "queued" | "running" | "done" | "error"; currentStep: QueueStep | null; stepProgress: number; startedAt: string | null; errorMessage: string | null; steps: { step: QueueStep; label: string; status: "pending" | "running" | "done" | "error" }[]; } /** Search query AST. */ export interface SearchQuery { raw: string; text: string; filters: { projection?: Projection; stereo?: Stereo; lensType?: LensType; resolution?: ResolutionTier; passthrough?: boolean; questCompatible?: boolean; codec?: string; minDuration?: number; // seconds minResolution?: ResolutionTier; }; } /** SPA view identifier. */ export type ViewId = | "dashboard" | "library" | "inspector" | "feed-manager" | "search" | "queue" | "learning" | "settings" | "v3-roadmap"; /** Inspector view receives a videoId. */ export interface ViewState { view: ViewId; videoId?: string; // for inspector searchQuery?: string; // for search }