@open-orpheus/plugin-api 0.0.0-stage → 0.0.0
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/host/_native/open-orpheus__database.d.ts +50 -0
- package/dist/host/_native/open-orpheus__window.d.ts +266 -0
- package/dist/host/src/constants.d.ts +6 -0
- package/dist/host/src/main/afp.d.ts +1 -0
- package/dist/host/src/main/arguments.d.ts +4 -0
- package/dist/host/src/main/audio/ChunkTracker.d.ts +23 -0
- package/dist/host/src/main/audio/DownloadScheduler.d.ts +53 -0
- package/dist/host/src/main/audio/MediaEngine.d.ts +47 -0
- package/dist/host/src/main/audio/OnlineStreamer.d.ts +66 -0
- package/dist/host/src/main/audio/StorageManager.d.ts +18 -0
- package/dist/host/src/main/audio.d.ts +6 -0
- package/dist/host/src/main/av3a/Av3aEngine.d.ts +24 -0
- package/dist/host/src/main/av3a/Av3aM4aSession.d.ts +101 -0
- package/dist/host/src/main/av3a/Av3aPlaybackProcess.d.ts +52 -0
- package/dist/host/src/main/av3a/detect.d.ts +6 -0
- package/dist/host/src/main/av3a/sources.d.ts +13 -0
- package/dist/host/src/main/av3a/types.d.ts +54 -0
- package/dist/host/src/main/bridge/modules/inputRegion.d.ts +1 -0
- package/dist/host/src/main/bridge/modules/lyrics.d.ts +1 -0
- package/dist/host/src/main/bridge/modules/settings.d.ts +1 -0
- package/dist/host/src/main/bridge/register.d.ts +9 -0
- package/dist/host/src/main/cache/HttpCacheStorage.d.ts +10 -0
- package/dist/host/src/main/cache/LyricCahceManager.d.ts +21 -0
- package/dist/host/src/main/cache/PlayCacheManager.d.ts +72 -0
- package/dist/host/src/main/cache.d.ts +7 -0
- package/dist/host/src/main/calls/app.d.ts +1 -0
- package/dist/host/src/main/calls/audioeffect.d.ts +1 -0
- package/dist/host/src/main/calls/browser.d.ts +1 -0
- package/dist/host/src/main/calls/desktop.d.ts +2 -0
- package/dist/host/src/main/calls/desktoppet.d.ts +1 -0
- package/dist/host/src/main/calls/download.d.ts +1 -0
- package/dist/host/src/main/calls/index.d.ts +16 -0
- package/dist/host/src/main/calls/musiclibrary.d.ts +1 -0
- package/dist/host/src/main/calls/network.d.ts +1 -0
- package/dist/host/src/main/calls/os.d.ts +1 -0
- package/dist/host/src/main/calls/player.d.ts +22 -0
- package/dist/host/src/main/calls/process.d.ts +1 -0
- package/dist/host/src/main/calls/rtc.d.ts +1 -0
- package/dist/host/src/main/calls/storage.d.ts +1 -0
- package/dist/host/src/main/calls/trayicon.d.ts +1 -0
- package/dist/host/src/main/calls/update.d.ts +1 -0
- package/dist/host/src/main/calls/winhelper.d.ts +1 -0
- package/dist/host/src/main/calls.d.ts +5 -0
- package/dist/host/src/main/channel.d.ts +1 -0
- package/dist/host/src/main/cookie.d.ts +13 -0
- package/dist/host/src/main/crypto.d.ts +46 -0
- package/dist/host/src/main/database/KeyvSqliteDriver.d.ts +6 -0
- package/dist/host/src/main/database.d.ts +5 -0
- package/dist/host/src/main/dawn.d.ts +31 -0
- package/dist/host/src/main/device.d.ts +3 -0
- package/dist/host/src/main/download.d.ts +40 -0
- package/dist/host/src/main/error.d.ts +1 -0
- package/dist/host/src/main/folders.d.ts +18 -0
- package/dist/host/src/main/fonts.d.ts +1 -0
- package/dist/host/src/main/gui.d.ts +4 -0
- package/dist/host/src/main/id3.d.ts +42 -0
- package/dist/host/src/main/lifecycle.d.ts +118 -0
- package/dist/host/src/main/logger.d.ts +12 -0
- package/dist/host/src/main/lyrics/DbusLyricsService.d.ts +115 -0
- package/dist/host/src/main/lyrics/LyricsDispatcher.d.ts +26 -0
- package/dist/host/src/main/lyrics/dbus.d.ts +16 -0
- package/dist/host/src/main/lyrics/parse.d.ts +21 -0
- package/dist/host/src/main/lyrics.d.ts +2 -0
- package/dist/host/src/main/mediaSession.d.ts +42 -0
- package/dist/host/src/main/menu/AppMenu.d.ts +35 -0
- package/dist/host/src/main/menu/anchor.d.ts +13 -0
- package/dist/host/src/main/menu/backend/DesktopWindowBackend.d.ts +30 -0
- package/dist/host/src/main/menu/backend/MenuBackend.d.ts +28 -0
- package/dist/host/src/main/menu/backend/WaylandOverlayBackend.d.ts +15 -0
- package/dist/host/src/main/menu/backend/WaylandPopupBackend.d.ts +31 -0
- package/dist/host/src/main/menu/constants.d.ts +12 -0
- package/dist/host/src/main/menu/index.d.ts +2 -0
- package/dist/host/src/main/menu/native-popup.d.ts +16 -0
- package/dist/host/src/main/menu/patch.d.ts +3 -0
- package/dist/host/src/main/menu/skin.d.ts +3 -0
- package/dist/host/src/main/menu/surface/BaseWindowMenuSurface.d.ts +69 -0
- package/dist/host/src/main/menu/surface/MenuSurface.d.ts +29 -0
- package/dist/host/src/main/menu/surface/MenuSurfacePath.d.ts +29 -0
- package/dist/host/src/main/menu/surface/SurfacePool.d.ts +15 -0
- package/dist/host/src/main/menu/workaround.d.ts +6 -0
- package/dist/host/src/main/ncae.d.ts +8 -0
- package/dist/host/src/main/network/handler.d.ts +3 -0
- package/dist/host/src/main/network/interceptor.d.ts +2 -0
- package/dist/host/src/main/network/interceptors/anonymous.d.ts +2 -0
- package/dist/host/src/main/network/pipeline.d.ts +8 -0
- package/dist/host/src/main/network/types.d.ts +70 -0
- package/dist/host/src/main/orpheus.d.ts +10 -0
- package/dist/host/src/main/pack.d.ts +27 -0
- package/dist/host/src/main/packs/Pack.d.ts +12 -0
- package/dist/host/src/main/packs/SkinPack.d.ts +6 -0
- package/dist/host/src/main/packs/WebPack.d.ts +6 -0
- package/dist/host/src/main/playback/PlaybackController.d.ts +57 -0
- package/dist/host/src/main/playback/PlayerCommandRouter.d.ts +85 -0
- package/dist/host/src/main/playback/adapters/MediaSessionAdapter.d.ts +61 -0
- package/dist/host/src/main/playback/adapters/MprisAdapter.d.ts +48 -0
- package/dist/host/src/main/playback/adapters/NowPlayingAdapter.d.ts +23 -0
- package/dist/host/src/main/playback/adapters/SmtcAdapter.d.ts +23 -0
- package/dist/host/src/main/playback/artwork.d.ts +47 -0
- package/dist/host/src/main/playback/modes.d.ts +8 -0
- package/dist/host/src/main/playback/types.d.ts +39 -0
- package/dist/host/src/main/plugin/discover.d.ts +36 -0
- package/dist/host/src/main/plugin/index.d.ts +12 -0
- package/dist/host/src/main/plugin/loader.d.ts +43 -0
- package/dist/host/src/main/plugin/manager.d.ts +15 -0
- package/dist/host/src/main/plugin/metadata.d.ts +24 -0
- package/dist/host/src/main/plugin/state.d.ts +17 -0
- package/dist/host/src/main/plugin/tree.d.ts +13 -0
- package/dist/host/src/main/plugin/types.d.ts +18 -0
- package/dist/host/src/main/protocol.d.ts +4 -0
- package/dist/host/src/main/request.d.ts +16 -0
- package/dist/host/src/main/settings.d.ts +6 -0
- package/dist/host/src/main/shortcuts.d.ts +10 -0
- package/dist/host/src/main/shutdown.d.ts +32 -0
- package/dist/host/src/main/skin/color.d.ts +2 -0
- package/dist/host/src/main/skin/dui.d.ts +15 -0
- package/dist/host/src/main/tray.d.ts +8 -0
- package/dist/host/src/main/update.d.ts +2 -0
- package/dist/host/src/main/util/display.d.ts +3 -0
- package/dist/host/src/main/util/env.d.ts +1 -0
- package/dist/host/src/main/util/fs.d.ts +21 -0
- package/dist/host/src/main/util/image.d.ts +1 -0
- package/dist/host/src/main/util/musicFile.d.ts +1 -0
- package/dist/host/src/main/util/musicPicture.d.ts +2 -0
- package/dist/host/src/main/util/path.d.ts +2 -0
- package/dist/host/src/main/util/send.d.ts +13 -0
- package/dist/host/src/main/util/url.d.ts +19 -0
- package/dist/host/src/main/util/window.d.ts +2 -0
- package/dist/host/src/main/window.d.ts +294 -0
- package/dist/host/src/main/windows/desktop-lyrics.d.ts +12 -0
- package/dist/host/src/main/windows/desktop-pet.d.ts +8 -0
- package/dist/host/src/main/windows/main.d.ts +6 -0
- package/dist/host/src/main/windows/manage.d.ts +2 -0
- package/dist/host/src/main/windows/mini-player.d.ts +16 -0
- package/dist/host/src/main/windows/music-desktop.d.ts +13 -0
- package/dist/host/src/main/windows/package-download.d.ts +2 -0
- package/dist/host/src/main/windows/plugin-manager.d.ts +5 -0
- package/dist/host/src/main/xeapi.d.ts +53 -0
- package/dist/host/src/preload/AudioEffectManager.d.ts +124 -0
- package/dist/host/src/preload/PlaybackBackend.d.ts +34 -0
- package/dist/host/src/preload/Player.d.ts +221 -0
- package/dist/host/src/preload/av3a/Av3aPcmPlayer.d.ts +84 -0
- package/dist/host/src/preload/av3a/bridge.d.ts +21 -0
- package/dist/host/src/preload/av3a/channel.d.ts +40 -0
- package/dist/host/src/preload/av3a/detect.d.ts +6 -0
- package/dist/host/src/preload/backends/Av3aPlaybackBackend.d.ts +32 -0
- package/dist/host/src/preload/backends/MediaPlaybackBackend.d.ts +25 -0
- package/dist/host/src/shared/CallDispatcher.d.ts +12 -0
- package/dist/host/src/shared/contracts/av3a-api.d.ts +50 -0
- package/dist/host/src/shared/contracts/av3a-process.d.ts +56 -0
- package/dist/host/src/shared/contracts/desktop-lyrics-api.d.ts +23 -0
- package/dist/host/src/shared/contracts/input-region-api.d.ts +6 -0
- package/dist/host/src/shared/contracts/lyrics-api.d.ts +11 -0
- package/dist/host/src/shared/contracts/manage-api.d.ts +33 -0
- package/dist/host/src/shared/contracts/mini-player-api.d.ts +19 -0
- package/dist/host/src/shared/contracts/plugin-manager-api.d.ts +34 -0
- package/dist/host/src/shared/contracts/settings-api.d.ts +15 -0
- package/dist/host/src/shared/playbackMode.d.ts +2 -0
- package/dist/host/src/shared/plugin/registry.d.ts +32 -0
- package/dist/host/src/shared/types/desktop-lyrics.d.ts +44 -0
- package/dist/host/src/shared/types/dui.d.ts +37 -0
- package/dist/host/src/shared/types/input-region.d.ts +6 -0
- package/dist/host/src/shared/types/lyrics.d.ts +15 -0
- package/dist/host/src/shared/types/manage.d.ts +14 -0
- package/dist/host/src/shared/types/menu-surface.d.ts +43 -0
- package/dist/host/src/shared/types/menu.d.ts +29 -0
- package/dist/host/src/shared/types/mini-player.d.ts +90 -0
- package/dist/host/src/shared/types/ncae.d.ts +21 -0
- package/dist/host/src/shared/types/package-download.d.ts +6 -0
- package/dist/host/src/shared/types/playback-mode.d.ts +3 -0
- package/dist/host/src/shared/types/settings.d.ts +9 -0
- package/dist/host/src/shared/types/update.d.ts +6 -0
- package/dist/host/src/shared/util.d.ts +22 -0
- package/dist/index.d.ts +7 -0
- package/dist/preload/host/src/constants.d.ts +6 -0
- package/dist/preload/host/src/main/network/types.d.ts +70 -0
- package/dist/preload/host/src/preload/AudioEffectManager.d.ts +124 -0
- package/dist/preload/host/src/preload/MusicRecognizer.d.ts +25 -0
- package/dist/preload/host/src/preload/PlaybackBackend.d.ts +34 -0
- package/dist/preload/host/src/preload/Player.d.ts +221 -0
- package/dist/preload/host/src/preload/YunxinIM.d.ts +15 -0
- package/dist/preload/host/src/preload/audioplayer.d.ts +4 -0
- package/dist/preload/host/src/preload/av3a/Av3aPcmPlayer.d.ts +84 -0
- package/dist/preload/host/src/preload/av3a/bridge.d.ts +21 -0
- package/dist/preload/host/src/preload/av3a/channel.d.ts +40 -0
- package/dist/preload/host/src/preload/av3a/detect.d.ts +6 -0
- package/dist/preload/host/src/preload/backends/Av3aPlaybackBackend.d.ts +32 -0
- package/dist/preload/host/src/preload/backends/MediaPlaybackBackend.d.ts +25 -0
- package/dist/preload/host/src/preload/calls/app.d.ts +1 -0
- package/dist/preload/host/src/preload/calls/audioeffect.d.ts +1 -0
- package/dist/preload/host/src/preload/calls/audioplayer.d.ts +1 -0
- package/dist/preload/host/src/preload/calls/im.d.ts +1 -0
- package/dist/preload/host/src/preload/calls/index.d.ts +6 -0
- package/dist/preload/host/src/preload/calls/network.d.ts +1 -0
- package/dist/preload/host/src/preload/calls/nimsys.d.ts +1 -0
- package/dist/preload/host/src/preload/calls/os.d.ts +1 -0
- package/dist/preload/host/src/preload/calls/player.d.ts +1 -0
- package/dist/preload/host/src/preload/calls/update.d.ts +1 -0
- package/dist/preload/host/src/preload/calls.d.ts +4 -0
- package/dist/preload/host/src/preload/channel.d.ts +1 -0
- package/dist/preload/host/src/preload/playbackMode.d.ts +13 -0
- package/dist/preload/host/src/preload/plugin/types.d.ts +18 -0
- package/dist/preload/host/src/preload/util.d.ts +1 -0
- package/dist/preload/host/src/shared/CallDispatcher.d.ts +12 -0
- package/dist/preload/host/src/shared/contracts/av3a-api.d.ts +50 -0
- package/dist/preload/host/src/shared/contracts/av3a-process.d.ts +56 -0
- package/dist/preload/host/src/shared/playbackMode.d.ts +2 -0
- package/dist/preload/host/src/shared/plugin/registry.d.ts +32 -0
- package/dist/preload/host/src/shared/types/ncae.d.ts +21 -0
- package/dist/preload/host/src/shared/types/playback-mode.d.ts +3 -0
- package/dist/preload/host/src/shared/util.d.ts +22 -0
- package/dist/preload/index.d.ts +7 -0
- package/dist/preload/registry-map.d.ts +36 -0
- package/dist/registry-map.d.ts +145 -0
- package/package.json +58 -4
- package/README.md +0 -3
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/* auto-generated by NAPI-RS */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Which binding artifact the generated loader actually loaded: `'native'` for
|
|
6
|
+
* a native addon, otherwise the `platformArchABI` of the WASI flavor. Every
|
|
7
|
+
* flavor napi-rs can build is listed, because `NAPI_RS_NATIVE_LIBRARY_PATH`
|
|
8
|
+
* can point the loader at a WASI artifact this package does not build itself.
|
|
9
|
+
*/
|
|
10
|
+
export declare const __napiBindingTarget: 'native' | 'wasm32-wasi' | 'wasm32-wasip1'
|
|
11
|
+
|
|
12
|
+
export declare class Database {
|
|
13
|
+
constructor(path: string)
|
|
14
|
+
/** Gets the path to database file. */
|
|
15
|
+
get filePath(): string
|
|
16
|
+
/** Execute a single SQL statement with named parameters. */
|
|
17
|
+
execNamed(sql: string, parameters: Record<string, unknown>): Promise<[number, Record<string, unknown>[]]>
|
|
18
|
+
/** Execute a single SQL statement with positional (`?`) parameters. */
|
|
19
|
+
exec(sql: string, parameters: unknown[]): Promise<[number, Record<string, unknown>[]]>
|
|
20
|
+
/**
|
|
21
|
+
* Execute SQL string, returns an array of objects representing rows,
|
|
22
|
+
* and an array of performance info (total time, execution time, rows affected).
|
|
23
|
+
*
|
|
24
|
+
* For NCM, not intended for Open Orpheus.
|
|
25
|
+
*/
|
|
26
|
+
executeSql(sql: string): Promise<[number, Record<string, string>[], [number, number, number]]>
|
|
27
|
+
/**
|
|
28
|
+
* Execute a SQL contains multiple statements as one transaction.
|
|
29
|
+
*
|
|
30
|
+
* For NCM, not intended for Open Orpheus.
|
|
31
|
+
*/
|
|
32
|
+
executeTransaction(sql: string): Promise<[number, Record<string, string>[], [number, number, number]]>
|
|
33
|
+
/**
|
|
34
|
+
* Execute multiple SQL statements inside an array, returns values of the last statement as an array.
|
|
35
|
+
*
|
|
36
|
+
* ## Example return
|
|
37
|
+
* ```json
|
|
38
|
+
* {
|
|
39
|
+
* "value": [
|
|
40
|
+
* [
|
|
41
|
+
* "a",
|
|
42
|
+
* "b"
|
|
43
|
+
* ]
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* For NCM, not intended for Open Orpheus.
|
|
48
|
+
*/
|
|
49
|
+
executeSqls(sqls: string[]): Promise<{ value: string[][] }>
|
|
50
|
+
}
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
/* auto-generated by NAPI-RS */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Which binding artifact the generated loader actually loaded: `'native'` for
|
|
6
|
+
* a native addon, otherwise the `platformArchABI` of the WASI flavor. Every
|
|
7
|
+
* flavor napi-rs can build is listed, because `NAPI_RS_NATIVE_LIBRARY_PATH`
|
|
8
|
+
* can point the loader at a WASI artifact this package does not build itself.
|
|
9
|
+
*/
|
|
10
|
+
export declare const __napiBindingTarget: 'native' | 'wasm32-wasi' | 'wasm32-wasip1'
|
|
11
|
+
|
|
12
|
+
/** Cancel a pending pointer-axis capture. */
|
|
13
|
+
export declare function cancelWindowPointerAxisCapture(token: number): boolean
|
|
14
|
+
|
|
15
|
+
export declare function cancelWindowTouch(token: number): boolean
|
|
16
|
+
|
|
17
|
+
/** Capture the first pointer enter on an existing managed window surface. */
|
|
18
|
+
export declare function captureCursorEnter(windowId: string, timeoutMs: number): Promise<[number, number] | null>
|
|
19
|
+
|
|
20
|
+
/** Invoke once when a Wayland pointer-axis event reaches this window's client. */
|
|
21
|
+
export declare function captureWindowNextPointerAxis(windowId: string, callback: (axis: number) => void): number
|
|
22
|
+
|
|
23
|
+
/** Invoke once when a touch press lands in a managed window. */
|
|
24
|
+
export declare function captureWindowTouch(windowId: string, callback: (x: number, y: number) => void): number
|
|
25
|
+
|
|
26
|
+
/** Withdraw a popup policy the window will not use after all. */
|
|
27
|
+
export declare function clearWindowPopupPolicy(targetWindowId: string): boolean
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Attach the managed window id to a title, the way the proxy expects it.
|
|
31
|
+
*
|
|
32
|
+
* The window id rides in front of the real title, separated from it by
|
|
33
|
+
* invisible characters, so the proxy can name the window on the wire while the
|
|
34
|
+
* compositor is shown only the title. `ManagedWindow` writes titles through
|
|
35
|
+
* this and nothing else writes them at all.
|
|
36
|
+
*/
|
|
37
|
+
export declare function decorateWindowTitle(id: string, title: string): string
|
|
38
|
+
|
|
39
|
+
export declare const enum DesktopEnvironment {
|
|
40
|
+
Wayland = 0,
|
|
41
|
+
X11 = 1,
|
|
42
|
+
Windows = 2,
|
|
43
|
+
Darwin = 3,
|
|
44
|
+
Unknown = 4,
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export declare function dragWindow(hwnd: Buffer): void
|
|
48
|
+
|
|
49
|
+
/** Release completed native input callbacks on the JavaScript thread. */
|
|
50
|
+
export declare function drainWindowCallbacks(): void
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Release the native state recorded for a window that will not return.
|
|
54
|
+
*
|
|
55
|
+
* The layer-shell policy and the recorded input region are dropped, so a
|
|
56
|
+
* discarded wrapper cannot leave them behind. Do not call this for a window
|
|
57
|
+
* that merely hides and is shown again: it keeps its id and needs the record.
|
|
58
|
+
*/
|
|
59
|
+
export declare function forgetWindowState(windowId: string): boolean
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Gets the position of the cursor
|
|
63
|
+
*
|
|
64
|
+
* Only for X11 on Linux.
|
|
65
|
+
*/
|
|
66
|
+
export declare function getCursorPosition(): [number, number] | null
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Get current detected desktop environment.
|
|
70
|
+
*
|
|
71
|
+
* Mostly for Linux to use, on Windows/macOS, returns hardcoded values.
|
|
72
|
+
*/
|
|
73
|
+
export declare function getDesktopEnvironment(): DesktopEnvironment
|
|
74
|
+
|
|
75
|
+
/** Current pointer position inside a window surface, when the pointer is over it. */
|
|
76
|
+
export declare function getPointerPosition(windowId: string): WindowPointerPosition | null
|
|
77
|
+
|
|
78
|
+
/** Native popup capability. */
|
|
79
|
+
export declare function getPopupCapability(): PopupCapability
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* The compositor's unique name for the output Electron reports as a `Display.id`.
|
|
83
|
+
*
|
|
84
|
+
* On Linux, this is the `wl_output.name` event (for example `DP-1`), looked up
|
|
85
|
+
* across the live Wayland connections. `null` when none of them knows the display,
|
|
86
|
+
* the client has not bound it yet, or the compositor is too old to send a name.
|
|
87
|
+
*
|
|
88
|
+
* On the other platforms, this is a ID that will be consistent across sessions.
|
|
89
|
+
*/
|
|
90
|
+
export declare function getUniqueDisplayId(displayId: number): string | null
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Whether the compositor advertises `zwlr_layer_shell_v1`.
|
|
94
|
+
*
|
|
95
|
+
* Only meaningful for Wayland on Linux; everywhere else it is `false`.
|
|
96
|
+
*/
|
|
97
|
+
export declare function isLayerShellAvailable(): boolean
|
|
98
|
+
|
|
99
|
+
/** Whether the compositor currently reports the window's toplevel as activated. */
|
|
100
|
+
export declare function isWindowActivated(windowId: string): boolean
|
|
101
|
+
|
|
102
|
+
/** Whether a pointer is currently over this window's surface. */
|
|
103
|
+
export declare function isWindowPointerInside(windowId: string): boolean
|
|
104
|
+
|
|
105
|
+
/** Whether the window's Wayland surface was converted to an xdg_popup. */
|
|
106
|
+
export declare function isWindowWaylandPopup(windowId: string): boolean
|
|
107
|
+
|
|
108
|
+
/** Latest mouse/touch press across all tracked windows, if any. */
|
|
109
|
+
export declare function latestWindowPress(): LatestWindowPress | null
|
|
110
|
+
|
|
111
|
+
export interface LatestWindowPress {
|
|
112
|
+
windowId: string
|
|
113
|
+
x: number
|
|
114
|
+
y: number
|
|
115
|
+
touch: boolean
|
|
116
|
+
ageMs: number
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** The stacking layer a layer surface is placed in, bottom-most first. */
|
|
120
|
+
export declare const enum LayerShellLayer {
|
|
121
|
+
Background = 0,
|
|
122
|
+
Bottom = 1,
|
|
123
|
+
Top = 2,
|
|
124
|
+
Overlay = 3,
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Layer-shell state for a window the application is about to create.
|
|
129
|
+
*
|
|
130
|
+
* With an owner, applied only to that managed window; without one, applied to
|
|
131
|
+
* the next eligible toplevel. Declare it before the window (or its surface) is
|
|
132
|
+
* brought into existence. A declaration without size or anchors covers the output.
|
|
133
|
+
*/
|
|
134
|
+
export interface LayerShellOptions {
|
|
135
|
+
/** Purpose of the surface, e.g. `"open-orpheus-menu"`. Required. */
|
|
136
|
+
namespace: string
|
|
137
|
+
/** Defaults to the top layer. */
|
|
138
|
+
layer?: LayerShellLayer
|
|
139
|
+
/**
|
|
140
|
+
* The `Display.id` of the output to create the layer surface on.
|
|
141
|
+
*
|
|
142
|
+
* Electron's `Display.id` is the Wayland registry global name, so it can
|
|
143
|
+
* be passed through unchanged. Omit it to let the compositor choose.
|
|
144
|
+
*/
|
|
145
|
+
output?: number
|
|
146
|
+
anchorTop?: boolean
|
|
147
|
+
anchorBottom?: boolean
|
|
148
|
+
anchorLeft?: boolean
|
|
149
|
+
anchorRight?: boolean
|
|
150
|
+
/**
|
|
151
|
+
* Surface size in surface-local coordinates. `0` lets the compositor
|
|
152
|
+
* decide, which requires the two opposite anchors on that axis.
|
|
153
|
+
*/
|
|
154
|
+
width?: number
|
|
155
|
+
height?: number
|
|
156
|
+
marginTop?: number
|
|
157
|
+
marginRight?: number
|
|
158
|
+
marginBottom?: number
|
|
159
|
+
marginLeft?: number
|
|
160
|
+
/** `-1` ignore other surfaces, `0` avoid them, `>0` reserve space. */
|
|
161
|
+
exclusiveZone?: number
|
|
162
|
+
/** `0` none, `1` exclusive, `2` on demand (needs layer shell v4). */
|
|
163
|
+
keyboardInteractivity?: number
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Listen for windows whose layer-shell role was refused.
|
|
168
|
+
*
|
|
169
|
+
* A compositor never releases a surface's role, so a window whose surface is
|
|
170
|
+
* already an ordinary toplevel can never become a layer surface. The callback
|
|
171
|
+
* gets the custom window id that was refused; the application has to re-create
|
|
172
|
+
* that window (a new surface) for the role to apply.
|
|
173
|
+
*
|
|
174
|
+
* Only for Wayland on Linux.
|
|
175
|
+
*/
|
|
176
|
+
export declare function onLayerShellRoleRefused(callback: (windowId: string) => void): void
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Whether the active Wayland hooks allow a native popup attempt.
|
|
180
|
+
*
|
|
181
|
+
* Independent of the desktop name. This does not guarantee that a particular
|
|
182
|
+
* window can become a popup: arming still requires a tracked parent, anchor
|
|
183
|
+
*/
|
|
184
|
+
export interface PopupCapability {
|
|
185
|
+
supported: boolean
|
|
186
|
+
reason?: string
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Set regions that the window is used to receive inputs.
|
|
191
|
+
*
|
|
192
|
+
* Only for Linux.
|
|
193
|
+
*/
|
|
194
|
+
export declare function setInputRegion(windowHandle: string | Buffer, rects?: { x: number, y: number, w: number, h: number }[] | null): boolean
|
|
195
|
+
|
|
196
|
+
export declare function setWindowAsBackground(hwnd: Buffer, displayId?: number | undefined | null): void
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Register (or clear) the layer-shell policy for a managed window.
|
|
200
|
+
*
|
|
201
|
+
* The policy is keyed by the id the application names the window with, so it
|
|
202
|
+
* may be registered before the window — or its surface — exists. It is read
|
|
203
|
+
* once, when the proxy resolves a surface's window id from the decorated
|
|
204
|
+
* title: a surface that has not taken a role yet becomes a layer surface with
|
|
205
|
+
* these options, and a surface that is already an ordinary toplevel can never
|
|
206
|
+
* become one.
|
|
207
|
+
*
|
|
208
|
+
* Returns whether the policy was accepted; `None` clears the policy. Refused
|
|
209
|
+
* options are not stored, and the window is still created as an ordinary one.
|
|
210
|
+
*/
|
|
211
|
+
export declare function setWindowLayerShell(windowId: string, options?: LayerShellOptions | undefined | null): boolean
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Register the intent to present `target_window_id` as an xdg_popup of
|
|
215
|
+
* `parent_window_id`, with the size the renderer measured.
|
|
216
|
+
*
|
|
217
|
+
* Identified by managed window id, like the layer-shell policy: the role is
|
|
218
|
+
* decided when the decorated title names the window, and everything the
|
|
219
|
+
* positioner needs (the parent's surface, the anchor, the object id) is
|
|
220
|
+
* resolved then. Omit the anchor to use the last pointer-button position on
|
|
221
|
+
* the parent. `shadow_inset` excludes transparent client-side shadow margins
|
|
222
|
+
* from the window geometry. Returns whether the intent was accepted.
|
|
223
|
+
*/
|
|
224
|
+
export declare function setWindowPopupPolicy(targetWindowId: string, parentWindowId: string, width: number, height: number, anchorX?: number | undefined | null, anchorY?: number | undefined | null, shadowInset?: number | undefined | null, anchorRectWidth?: number | undefined | null): boolean
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Whether native xdg_popup conversion is available.
|
|
228
|
+
* data and a reusable object ID. Callers must retain an overlay fallback.
|
|
229
|
+
*/
|
|
230
|
+
export declare function supportsNativeWaylandPopup(): boolean
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Re-key the native state recorded for one managed window under another.
|
|
234
|
+
*
|
|
235
|
+
* A policy switch replaces the wrapper, and the replacement is a different
|
|
236
|
+
* window with a different id. The layer-shell policy and the recorded input
|
|
237
|
+
* region follow it, so nothing has to be mirrored on the application side.
|
|
238
|
+
*/
|
|
239
|
+
export declare function transferWindowState(fromId: string, toId: string): boolean
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Whether a layer-shell policy could be sent.
|
|
243
|
+
*
|
|
244
|
+
* The same option validation `setWindowLayerShell` applies, without storing
|
|
245
|
+
* anything: callers can report options that could never be sent, and a
|
|
246
|
+
* settings UI can check a choice before anything is created.
|
|
247
|
+
*
|
|
248
|
+
* This answers for the options only, never for the compositor: whether it
|
|
249
|
+
* takes layer surfaces at all is `isLayerShellAvailable()`, and a caller that
|
|
250
|
+
* needs both asks both.
|
|
251
|
+
*/
|
|
252
|
+
export declare function validateLayerShellOptions(options: LayerShellOptions): boolean
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* How long ago the most recent pointer button press landed in this window.
|
|
256
|
+
*
|
|
257
|
+
* `undefined` when that press was somewhere else, or there was none. A caller
|
|
258
|
+
* can use it to tell a click that just happened here from a press that merely
|
|
259
|
+
* happened at some point in the past.
|
|
260
|
+
*/
|
|
261
|
+
export declare function windowLastPressAgeMs(windowId: string): number | null
|
|
262
|
+
|
|
263
|
+
export interface WindowPointerPosition {
|
|
264
|
+
x: number
|
|
265
|
+
y: number
|
|
266
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const BUILD: string;
|
|
2
|
+
export declare const VERSION: string;
|
|
3
|
+
export declare const CORE_VERSION: string;
|
|
4
|
+
export declare const NATIVE_VERSION = "60316";
|
|
5
|
+
export declare const SECRET_KEY = "7ada0f7ccadbe165e6e7fbe01113f4df";
|
|
6
|
+
export declare const OSVER = "Microsoft-Windows-11--build-22631-64bit";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function GenerateFP(samples: Float32Array): string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function raceArgument<T>(predicate: (arg: string, index: number, array: string[]) => Promise<T | null> | T | null, argv?: string[]): Promise<T | null>;
|
|
2
|
+
export declare function parseMoveRun(arg: string, index: number, array: string[]): [string, string] | null;
|
|
3
|
+
export declare function parseWebCommand(arg: string): string | null;
|
|
4
|
+
export declare function parseLocalFile(arg: string): Promise<string | null>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type ChunkInterval = {
|
|
2
|
+
start: number;
|
|
3
|
+
end: number;
|
|
4
|
+
};
|
|
5
|
+
export type ChunkInstruction = ChunkInterval & {
|
|
6
|
+
type: "hit" | "miss";
|
|
7
|
+
};
|
|
8
|
+
export default class ChunkTracker {
|
|
9
|
+
private intervals;
|
|
10
|
+
get loadedBytes(): number;
|
|
11
|
+
addInterval(start: number, end: number): number;
|
|
12
|
+
getIntervals(): {
|
|
13
|
+
start: number;
|
|
14
|
+
end: number;
|
|
15
|
+
}[];
|
|
16
|
+
getDownloadedEnd(start: number, limit: number): number;
|
|
17
|
+
getDownloadedSpanFrom(start: number, limit: number): number;
|
|
18
|
+
getGapEnd(start: number, limit: number): number;
|
|
19
|
+
isRangeDownloaded(start: number, end: number): boolean;
|
|
20
|
+
getMissingIntervals(start: number, end: number): ChunkInterval[];
|
|
21
|
+
getInstructions(start: number, end: number): ChunkInstruction[];
|
|
22
|
+
isComplete(totalLength: number): boolean;
|
|
23
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type ChunkTracker from "./ChunkTracker";
|
|
2
|
+
import type StorageManager from "./StorageManager";
|
|
3
|
+
type DownloadSchedulerOptions = {
|
|
4
|
+
url: string;
|
|
5
|
+
toleranceThreshold: number;
|
|
6
|
+
tracker: ChunkTracker;
|
|
7
|
+
storage: StorageManager;
|
|
8
|
+
getTotalLength: () => number;
|
|
9
|
+
onProgress: () => void;
|
|
10
|
+
onComplete: () => void;
|
|
11
|
+
onError: (error: Error) => void;
|
|
12
|
+
};
|
|
13
|
+
export type UrgentSession = {
|
|
14
|
+
signal: AbortSignal;
|
|
15
|
+
abort: (reason?: unknown) => void;
|
|
16
|
+
close: () => void;
|
|
17
|
+
};
|
|
18
|
+
export default class DownloadScheduler {
|
|
19
|
+
private readonly url;
|
|
20
|
+
private readonly toleranceThreshold;
|
|
21
|
+
private readonly tracker;
|
|
22
|
+
private readonly storage;
|
|
23
|
+
private readonly getTotalLength;
|
|
24
|
+
private readonly onProgress;
|
|
25
|
+
private readonly onComplete;
|
|
26
|
+
private readonly onError;
|
|
27
|
+
private readonly activeRequests;
|
|
28
|
+
private readonly backgroundController;
|
|
29
|
+
private urgentController;
|
|
30
|
+
private backgroundStarted;
|
|
31
|
+
private destroyed;
|
|
32
|
+
private completeEmitted;
|
|
33
|
+
private writeChain;
|
|
34
|
+
private activeUrgentRange;
|
|
35
|
+
private urgentRangeVersion;
|
|
36
|
+
private backgroundRetryDelay;
|
|
37
|
+
private readonly urgentRangeWaiters;
|
|
38
|
+
constructor(options: DownloadSchedulerOptions);
|
|
39
|
+
startBackground(): void;
|
|
40
|
+
createUrgentSession(signal?: AbortSignal): UrgentSession;
|
|
41
|
+
streamUrgent(start: number, end: number, signal: AbortSignal): AsyncGenerator<Buffer<ArrayBuffer>, void, unknown>;
|
|
42
|
+
destroy(): void;
|
|
43
|
+
private runBackground;
|
|
44
|
+
private findBackgroundGap;
|
|
45
|
+
private getUrgentReservedEnd;
|
|
46
|
+
private waitForUrgentRangeChange;
|
|
47
|
+
private notifyUrgentRangeChanged;
|
|
48
|
+
private downloadRange;
|
|
49
|
+
private waitForRangeResponse;
|
|
50
|
+
private checkBeforeWrite;
|
|
51
|
+
private emitCompleteIfNeeded;
|
|
52
|
+
}
|
|
53
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { AudioPlayInfo } from "../../preload/Player";
|
|
2
|
+
/**
|
|
3
|
+
* Main-process engine for media-element playback. It never decodes — Chromium
|
|
4
|
+
* plays the `<audio>` element — it only serves that element over `audio://audio`
|
|
5
|
+
* from the current load: a local file (ranged reads) or an `OnlineStreamer`
|
|
6
|
+
* (URL, cache-on-complete). Distinct from `Av3aEngine`, which manages the AV3A
|
|
7
|
+
* decode utility process; exactly one of them is active at a time and the
|
|
8
|
+
* renderer routes which one.
|
|
9
|
+
*/
|
|
10
|
+
export declare class MediaEngine {
|
|
11
|
+
private state;
|
|
12
|
+
/**
|
|
13
|
+
* Deletions `stop()` started but did not wait for.
|
|
14
|
+
*
|
|
15
|
+
* A song switch must not block on deleting the previous file, so those
|
|
16
|
+
* deletions run unattended — but a shutdown has to wait for them, or a file
|
|
17
|
+
* whose deletion was still in flight outlives the process and is only
|
|
18
|
+
* reclaimed by the next launch's cleanup.
|
|
19
|
+
*/
|
|
20
|
+
private pendingDestructions;
|
|
21
|
+
get active(): boolean;
|
|
22
|
+
/** Delete a retired streamer's file without blocking the caller. */
|
|
23
|
+
private destroyInBackground;
|
|
24
|
+
private sendProgress;
|
|
25
|
+
/**
|
|
26
|
+
* Register the serving state for a media-element (non-AV3A) play info.
|
|
27
|
+
* Local files are served by path; URLs get an `OnlineStreamer` whose
|
|
28
|
+
* completion writes the download into the play cache.
|
|
29
|
+
*/
|
|
30
|
+
activate(playInfo: AudioPlayInfo): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Retire the current serving state. Any streamer is destroyed in the
|
|
33
|
+
* background (its file deletion must not block a fast song switch).
|
|
34
|
+
*/
|
|
35
|
+
stop(): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Retire the current serving state and wait for every streamer's file to be
|
|
38
|
+
* deleted, including deletions {@link stop} left running.
|
|
39
|
+
*
|
|
40
|
+
* Distinct from {@link stop}, which deliberately does not wait: a song switch
|
|
41
|
+
* must not block on deleting the previous file, but a shutdown has nothing
|
|
42
|
+
* after it and wants the temp file gone rather than left for the next launch.
|
|
43
|
+
*/
|
|
44
|
+
dispose(): Promise<void>;
|
|
45
|
+
/** Serve an `audio://audio` request (the `<audio>` element) for this state. */
|
|
46
|
+
serve(request: Request): Promise<Response>;
|
|
47
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Readable } from "node:stream";
|
|
2
|
+
import Emittery from "emittery";
|
|
3
|
+
export type OnlineStreamerEvents = {
|
|
4
|
+
progress: {
|
|
5
|
+
loaded: number;
|
|
6
|
+
total: number;
|
|
7
|
+
};
|
|
8
|
+
complete: undefined;
|
|
9
|
+
error: Error;
|
|
10
|
+
};
|
|
11
|
+
export interface StreamerOptions {
|
|
12
|
+
toleranceThreshold?: number;
|
|
13
|
+
}
|
|
14
|
+
export declare class OnlineStreamer extends Emittery<OnlineStreamerEvents> {
|
|
15
|
+
static tempDir: string;
|
|
16
|
+
private static readonly activeTempFiles;
|
|
17
|
+
readonly url: string;
|
|
18
|
+
readonly tempFilePath: string;
|
|
19
|
+
totalLength: number;
|
|
20
|
+
private readonly tracker;
|
|
21
|
+
private readonly storage;
|
|
22
|
+
private readonly scheduler;
|
|
23
|
+
private readonly metaAbortController;
|
|
24
|
+
private readonly metaReadyPromise;
|
|
25
|
+
private readonly emittedErrors;
|
|
26
|
+
private mimeType;
|
|
27
|
+
private _destroyed;
|
|
28
|
+
get destroyed(): boolean;
|
|
29
|
+
static cleanup(): Promise<void>;
|
|
30
|
+
constructor(url: string, options?: StreamerOptions);
|
|
31
|
+
handleRequest(request: Request): Promise<Response>;
|
|
32
|
+
getDownloadedIntervals(): {
|
|
33
|
+
start: number;
|
|
34
|
+
end: number;
|
|
35
|
+
}[];
|
|
36
|
+
/**
|
|
37
|
+
* Length of the contiguous downloaded prefix starting at byte 0.
|
|
38
|
+
*
|
|
39
|
+
* A decoder that reads the sparse temp file directly must not read past
|
|
40
|
+
* this point: bytes beyond it are still zeros until the background worker
|
|
41
|
+
* persists them.
|
|
42
|
+
*/
|
|
43
|
+
downloadedPrefixEnd(): number;
|
|
44
|
+
/** Resolves once the source metadata (total length) is known. */
|
|
45
|
+
whenReady(): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Download `[start, end)` with urgent priority and resolve once the bytes
|
|
48
|
+
* are persisted in the temp file (so a decoder can read them). Aborts when
|
|
49
|
+
* `signal` is aborted or the streamer is destroyed.
|
|
50
|
+
*/
|
|
51
|
+
ensureRangeDownloaded(start: number, end: number, signal?: AbortSignal): Promise<void>;
|
|
52
|
+
readBuffer(start?: number, end?: number): Promise<Buffer<ArrayBuffer>>;
|
|
53
|
+
createReadStream(start?: number, end?: number): Readable;
|
|
54
|
+
destroy(): Promise<void>;
|
|
55
|
+
private prepare;
|
|
56
|
+
private fetchMetadata;
|
|
57
|
+
private fetchHeadMetadata;
|
|
58
|
+
private fetchRangeMetadata;
|
|
59
|
+
private normalizeReadRange;
|
|
60
|
+
private createReadStreamIterator;
|
|
61
|
+
private assertNotDestroyed;
|
|
62
|
+
private emitProgress;
|
|
63
|
+
private emitComplete;
|
|
64
|
+
private emitError;
|
|
65
|
+
}
|
|
66
|
+
export default OnlineStreamer;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Readable } from "node:stream";
|
|
2
|
+
export default class StorageManager {
|
|
3
|
+
readonly filePath: string;
|
|
4
|
+
private fileHandle;
|
|
5
|
+
private openingPromise;
|
|
6
|
+
private writeQueue;
|
|
7
|
+
private closed;
|
|
8
|
+
constructor(filePath: string);
|
|
9
|
+
open(): Promise<void>;
|
|
10
|
+
setLength(length: number): Promise<void>;
|
|
11
|
+
write(position: number, chunk: Uint8Array): Promise<void>;
|
|
12
|
+
readBuffer(start: number, end: number): Promise<Buffer<ArrayBuffer>>;
|
|
13
|
+
readRange(start: number, end: number): AsyncGenerator<Buffer<ArrayBuffer>, void, unknown>;
|
|
14
|
+
createReadStream(start: number, end: number): Readable;
|
|
15
|
+
close(): Promise<void>;
|
|
16
|
+
delete(): Promise<void>;
|
|
17
|
+
private getFileHandle;
|
|
18
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { AudioPlayInfo } from "../../preload/Player";
|
|
2
|
+
/**
|
|
3
|
+
* Main-process manager for AV3A playback: a decode utility process plus the
|
|
4
|
+
* file it reads (a streamed temp file or a local one). Distinct from
|
|
5
|
+
* `MediaEngine` (the media-element engine): AV3A is never served over
|
|
6
|
+
* `audio://audio`; PCM and renderer flow control travel on a direct
|
|
7
|
+
* renderer<->utility channel.
|
|
8
|
+
*/
|
|
9
|
+
export declare class Av3aEngine {
|
|
10
|
+
private state;
|
|
11
|
+
/** Monotonic sequence for AV3A start requests (only the newest may win). */
|
|
12
|
+
private requestSeq;
|
|
13
|
+
get active(): boolean;
|
|
14
|
+
/** Push a fallback `av3a.<event>` to the player window. */
|
|
15
|
+
private sendEvent;
|
|
16
|
+
/** Stop the currently active AV3A session. Has no freshness side effects. */
|
|
17
|
+
stopActive(): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* External stop (user stop / play-info change): cancels any pending startup
|
|
20
|
+
* too, by advancing the request sequence before stopping active playback.
|
|
21
|
+
*/
|
|
22
|
+
stop(): Promise<void>;
|
|
23
|
+
start(playInfo: AudioPlayInfo): Promise<void>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { Av3aDecodeExecutor, Av3aDecodedFrame, Av3aTrackInfo } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Source abstraction over anything that can supply an AV3A-in-M4A file that
|
|
4
|
+
* may still be downloading. `OnlineStreamer` satisfies this interface: the
|
|
5
|
+
* sparse temp file grows in place, `prefixEnd()` reports how many contiguous
|
|
6
|
+
* bytes are readable, and `ensureRange()` downloads a byte range urgently.
|
|
7
|
+
*/
|
|
8
|
+
export type Av3aM4aSource = {
|
|
9
|
+
/** Absolute path to the (possibly partial) M4A/MP4 file. */
|
|
10
|
+
path: string;
|
|
11
|
+
/** Total expected file size in bytes. */
|
|
12
|
+
totalLength: number;
|
|
13
|
+
/** Contiguous downloaded prefix length starting at byte 0. */
|
|
14
|
+
prefixEnd(): number;
|
|
15
|
+
/** Download `[start, end)` and resolve once the bytes are on disk. */
|
|
16
|
+
ensureRange(start: number, end: number, signal?: AbortSignal): Promise<void>;
|
|
17
|
+
};
|
|
18
|
+
/** `pts` is the presentation timestamp of the frame in milliseconds. */
|
|
19
|
+
export type Av3aPcmFrame = Av3aDecodedFrame & {
|
|
20
|
+
pts: number;
|
|
21
|
+
};
|
|
22
|
+
export type Av3aM4aSessionCallbacks = {
|
|
23
|
+
/** Fired once the `moov` box has been indexed. */
|
|
24
|
+
onOpened?: (info: Av3aTrackInfo) => void;
|
|
25
|
+
/** Fired for every decoded frame. */
|
|
26
|
+
onPcm?: (frame: Av3aPcmFrame) => void;
|
|
27
|
+
/** Fired when the last frame of the track has been decoded. */
|
|
28
|
+
onDone?: () => void;
|
|
29
|
+
/** Fired on a fatal error (e.g. the file has no AV3A track). */
|
|
30
|
+
onError?: (error: Error) => void;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Drives an [`Av3aDecodeExecutor`] against a progressively downloaded M4A file.
|
|
34
|
+
*
|
|
35
|
+
* Decoding starts as early as possible:
|
|
36
|
+
* 1. The decoder is opened (retried) as soon as the `moov` box is readable;
|
|
37
|
+
* if the prefix stops growing, the tail is probed in case `moov` sits at
|
|
38
|
+
* the end of the file.
|
|
39
|
+
* 2. Before each frame is decoded, the session ensures the bytes that sample
|
|
40
|
+
* needs are on disk (`nextSampleRange` + `ensureRange`), so a sparse temp
|
|
41
|
+
* file is never read through its zero-filled holes. It only asks the source
|
|
42
|
+
* when the frame reaches past the source's known contiguous prefix, so
|
|
43
|
+
* steady-state decode never round-trips the data owner.
|
|
44
|
+
*
|
|
45
|
+
* PCM frames are delivered through `onPcm`; a consumer that cannot keep up can
|
|
46
|
+
* call [`pause`] (decode stops at the next frame boundary) and [`resume`].
|
|
47
|
+
*/
|
|
48
|
+
export declare class Av3aM4aSession {
|
|
49
|
+
private readonly executor;
|
|
50
|
+
private readonly source;
|
|
51
|
+
private readonly callbacks;
|
|
52
|
+
private readonly abortController;
|
|
53
|
+
private running;
|
|
54
|
+
private runPromise;
|
|
55
|
+
/** Track info from the last successful open (reused when restarting). */
|
|
56
|
+
private info;
|
|
57
|
+
private paused;
|
|
58
|
+
private resumeWaiter;
|
|
59
|
+
/** Absolute frame index to reposition to on the next decode-loop pass. */
|
|
60
|
+
private pendingSeekFrame;
|
|
61
|
+
constructor(executor: Av3aDecodeExecutor, source: Av3aM4aSource, callbacks?: Av3aM4aSessionCallbacks);
|
|
62
|
+
get signal(): AbortSignal;
|
|
63
|
+
get isRunning(): boolean;
|
|
64
|
+
/** Pause after the current frame; no-op when already paused or idle. */
|
|
65
|
+
pause(): void;
|
|
66
|
+
/** Resume decoding. */
|
|
67
|
+
resume(): void;
|
|
68
|
+
/**
|
|
69
|
+
* Reposition the decode to an absolute track frame index. Applied on the
|
|
70
|
+
* next decode-loop iteration; also unblocks a paused session so the request
|
|
71
|
+
* is processed promptly.
|
|
72
|
+
*/
|
|
73
|
+
seekToFrame(frameIndex: number): void;
|
|
74
|
+
/** Abort the session. The worker is closed by `run()`'s cleanup. */
|
|
75
|
+
destroy(): void;
|
|
76
|
+
/** Run the decode loop until the track ends, is aborted, or fails. */
|
|
77
|
+
run(): Promise<void>;
|
|
78
|
+
/**
|
|
79
|
+
* Restart decoding from an absolute track frame after a previous run already
|
|
80
|
+
* finished (e.g. the user seeks after the track ended). The decoder is
|
|
81
|
+
* reopened (runs close it when they finish) and decoding resumes at
|
|
82
|
+
* `frameIndex` without re-emitting `onOpened`.
|
|
83
|
+
*/
|
|
84
|
+
runFrom(frameIndex: number): Promise<void>;
|
|
85
|
+
/** Decode again from `info` starting at `pendingSeekFrame` (already set). */
|
|
86
|
+
private restartLoop;
|
|
87
|
+
/**
|
|
88
|
+
* Abort the session and wait until the decode worker has fully stopped, so
|
|
89
|
+
* callers can safely release the underlying file afterwards.
|
|
90
|
+
*/
|
|
91
|
+
close(): Promise<void>;
|
|
92
|
+
private runLoop;
|
|
93
|
+
/**
|
|
94
|
+
* Retry `open` until the `moov` box is readable. For non-faststart files the
|
|
95
|
+
* `moov` sits at the end: once the sequential prefix stops advancing, probe
|
|
96
|
+
* the tail instead of waiting for the whole file to download.
|
|
97
|
+
*/
|
|
98
|
+
private openUntilReady;
|
|
99
|
+
private decodeLoop;
|
|
100
|
+
private waitIfPaused;
|
|
101
|
+
}
|