@viji-dev/core 0.3.15 → 0.3.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{viji.worker-Cu6zt4AH.js → viji.worker-BnDb6mPh.js} +4 -1
- package/dist/assets/viji.worker-BnDb6mPh.js.map +1 -0
- package/dist/{essentia-wasm.web-CvBoZF2z.js → essentia-wasm.web-6nI8GVgc.js} +2 -2
- package/dist/{essentia-wasm.web-CvBoZF2z.js.map → essentia-wasm.web-6nI8GVgc.js.map} +1 -1
- package/dist/{index-CeLhExPX.js → index-DSNSJDmw.js} +49 -15
- package/dist/{index-CeLhExPX.js.map → index-DSNSJDmw.js.map} +1 -1
- package/dist/index.d.ts +18 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/assets/viji.worker-Cu6zt4AH.js.map +0 -1
|
@@ -551,7 +551,7 @@ class IFrameManager {
|
|
|
551
551
|
}
|
|
552
552
|
function WorkerWrapper(options) {
|
|
553
553
|
return new Worker(
|
|
554
|
-
"" + new URL("assets/viji.worker-
|
|
554
|
+
"" + new URL("assets/viji.worker-BnDb6mPh.js", import.meta.url).href,
|
|
555
555
|
{
|
|
556
556
|
type: "module",
|
|
557
557
|
name: options?.name
|
|
@@ -1900,7 +1900,7 @@ class EssentiaOnsetDetection {
|
|
|
1900
1900
|
this.initPromise = (async () => {
|
|
1901
1901
|
try {
|
|
1902
1902
|
const essentiaModule = await import("./essentia.js-core.es-DnrJE0uR.js");
|
|
1903
|
-
const wasmModule = await import("./essentia-wasm.web-
|
|
1903
|
+
const wasmModule = await import("./essentia-wasm.web-6nI8GVgc.js").then((n) => n.e);
|
|
1904
1904
|
const EssentiaClass = essentiaModule.Essentia || essentiaModule.default?.Essentia || essentiaModule.default;
|
|
1905
1905
|
let WASMModule = wasmModule.default || wasmModule.EssentiaWASM || wasmModule.default?.EssentiaWASM;
|
|
1906
1906
|
if (!WASMModule) {
|
|
@@ -15181,26 +15181,59 @@ class VijiCore {
|
|
|
15181
15181
|
timestamp: performance.now()
|
|
15182
15182
|
});
|
|
15183
15183
|
}
|
|
15184
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
15185
|
+
// Direct Frame Injection API (Compositor Pipeline)
|
|
15186
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
15184
15187
|
/**
|
|
15185
|
-
*
|
|
15188
|
+
* Worker-side stream index offset for direct frame slots.
|
|
15189
|
+
* Accounts for main video stream and additional media streams.
|
|
15186
15190
|
*/
|
|
15187
|
-
|
|
15191
|
+
get directFrameStartIndex() {
|
|
15192
|
+
return (this.videoStream ? 1 : 0) + this.videoStreams.length;
|
|
15193
|
+
}
|
|
15194
|
+
/**
|
|
15195
|
+
* Ensure the worker has enough direct frame slots prepared.
|
|
15196
|
+
* Auto-grows as needed; skips if already sufficient.
|
|
15197
|
+
*/
|
|
15198
|
+
ensureDirectFrameSlots(count) {
|
|
15199
|
+
if (count <= this.directFrameSlots) return;
|
|
15200
|
+
this.directFrameSlots = count;
|
|
15201
|
+
this.workerManager.postMessage("video-streams-prepare", {
|
|
15202
|
+
mainStream: !!this.videoStream,
|
|
15203
|
+
mediaStreamCount: this.videoStreams.length,
|
|
15204
|
+
directFrameCount: count
|
|
15205
|
+
});
|
|
15206
|
+
this.debugLog(`[Compositor] Prepared ${count} direct frame slot(s)`);
|
|
15207
|
+
}
|
|
15208
|
+
/**
|
|
15209
|
+
* Inject a single frame into a specific direct-frame stream slot.
|
|
15210
|
+
* Allows independent per-stream updates (e.g. during source hot-swap).
|
|
15211
|
+
* Auto-prepares slots as needed. Transfers ownership of the bitmap (zero-copy).
|
|
15212
|
+
*/
|
|
15213
|
+
injectFrame(bitmap, streamIndex) {
|
|
15188
15214
|
if (!this.workerManager?.ready) {
|
|
15189
15215
|
throw new VijiCoreError("Core not ready", "NOT_READY");
|
|
15190
15216
|
}
|
|
15191
|
-
|
|
15192
|
-
|
|
15193
|
-
|
|
15194
|
-
this.
|
|
15195
|
-
|
|
15196
|
-
|
|
15197
|
-
|
|
15198
|
-
|
|
15217
|
+
this.ensureDirectFrameSlots(streamIndex + 1);
|
|
15218
|
+
this.workerManager.postMessage("video-frame-direct", {
|
|
15219
|
+
imageBitmap: bitmap,
|
|
15220
|
+
streamIndex: this.directFrameStartIndex + streamIndex,
|
|
15221
|
+
timestamp: performance.now()
|
|
15222
|
+
}, [bitmap]);
|
|
15223
|
+
}
|
|
15224
|
+
/**
|
|
15225
|
+
* Inject frames for all direct-frame stream slots at once (compositor pipeline).
|
|
15226
|
+
* Auto-prepares slots on first call. Transfers ownership of all bitmaps (zero-copy).
|
|
15227
|
+
*/
|
|
15228
|
+
injectFrames(bitmaps) {
|
|
15229
|
+
if (!this.workerManager?.ready) {
|
|
15230
|
+
throw new VijiCoreError("Core not ready", "NOT_READY");
|
|
15199
15231
|
}
|
|
15232
|
+
this.ensureDirectFrameSlots(bitmaps.length);
|
|
15200
15233
|
bitmaps.forEach((bitmap, index) => {
|
|
15201
15234
|
this.workerManager.postMessage("video-frame-direct", {
|
|
15202
15235
|
imageBitmap: bitmap,
|
|
15203
|
-
streamIndex: directFrameStartIndex + index,
|
|
15236
|
+
streamIndex: this.directFrameStartIndex + index,
|
|
15204
15237
|
timestamp: performance.now()
|
|
15205
15238
|
}, [bitmap]);
|
|
15206
15239
|
});
|
|
@@ -15288,7 +15321,7 @@ class VijiCore {
|
|
|
15288
15321
|
this.debugLog(`[Compositor] Mixer renderer type: ${mixerType}`);
|
|
15289
15322
|
sourceCores.forEach((source, index) => {
|
|
15290
15323
|
const sourceType = source.stats.rendererType;
|
|
15291
|
-
const flipY =
|
|
15324
|
+
const flipY = mixerType === "shader";
|
|
15292
15325
|
this.debugLog(`[Compositor] Source ${index}: ${sourceType} → ${mixerType}, flipY=${flipY}`);
|
|
15293
15326
|
source.enableAutoCapture({ flipY });
|
|
15294
15327
|
});
|
|
@@ -16191,6 +16224,7 @@ class VijiCore {
|
|
|
16191
16224
|
this.latestFrameBuffer.close();
|
|
16192
16225
|
this.latestFrameBuffer = null;
|
|
16193
16226
|
}
|
|
16227
|
+
this.directFrameSlots = 0;
|
|
16194
16228
|
this.videoStream = null;
|
|
16195
16229
|
this.videoStreams = [];
|
|
16196
16230
|
await this.cleanup();
|
|
@@ -16258,4 +16292,4 @@ export {
|
|
|
16258
16292
|
VijiCoreError as b,
|
|
16259
16293
|
getDefaultExportFromCjs as g
|
|
16260
16294
|
};
|
|
16261
|
-
//# sourceMappingURL=index-
|
|
16295
|
+
//# sourceMappingURL=index-DSNSJDmw.js.map
|