File size: 9,977 Bytes
5c0175e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 | // 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<Projection, string> = {
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<Stereo, string> = {
sbs: "sbs",
ou: "ou",
top_bottom: "tb",
mono: "off",
unknown: "off",
};
/** A single detection layer's output. */
export interface LayerResult<T = unknown> {
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<string, number>;
byStereo: Record<string, number>;
byContentType: Record<string, number>;
byResolution: Record<string, number>;
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<string, number>;
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
}
|