pipewire 1.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/package.json +19 -0
- package/src/context.ts +15 -0
- package/src/core.ts +37 -0
- package/src/dict.ts +12 -0
- package/src/hook.ts +16 -0
- package/src/index.ts +9 -0
- package/src/list.ts +8 -0
- package/src/loop.ts +15 -0
- package/src/main-loop.ts +17 -0
- package/src/pipewire.ts +6 -0
- package/src/properties.ts +3 -0
- package/src/proxy.ts +7 -0
- package/src/registry.ts +12 -0
- package/tsconfig.json +44 -0
package/package.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "pipewire",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [],
|
|
10
|
+
"author": "",
|
|
11
|
+
"license": "ISC",
|
|
12
|
+
"type": "commonjs",
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"koffi": "^3.3.2"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"typescript": "^7.0.2"
|
|
18
|
+
}
|
|
19
|
+
}
|
package/src/context.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import koffi from "koffi";
|
|
2
|
+
import { pw_loop } from "./loop.js";
|
|
3
|
+
import { pw_properties } from "./properties.js";
|
|
4
|
+
|
|
5
|
+
const pipewire = koffi.load("libpipewire-0.3.so.0");
|
|
6
|
+
|
|
7
|
+
export const pw_context = koffi.opaque("pw_context");
|
|
8
|
+
|
|
9
|
+
export const pw_context_new = pipewire.func("pw_context_new", koffi.pointer(pw_context), [
|
|
10
|
+
koffi.pointer(pw_loop),
|
|
11
|
+
koffi.pointer(pw_properties),
|
|
12
|
+
"size_t"
|
|
13
|
+
]);
|
|
14
|
+
|
|
15
|
+
export const pw_context_destroy = pipewire.func("pw_context_destroy", "void", [koffi.pointer(pw_context)]);
|
package/src/core.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import koffi from "koffi";
|
|
2
|
+
import { pw_context } from "./context.js";
|
|
3
|
+
import { pw_properties } from "./properties.js";
|
|
4
|
+
|
|
5
|
+
const pipewire = koffi.load("libpipewire-0.3.so.0");
|
|
6
|
+
|
|
7
|
+
export const pw_core = koffi.opaque("pw_core");
|
|
8
|
+
export const pw_registry = koffi.opaque("pw_registry");
|
|
9
|
+
|
|
10
|
+
export const pw_context_connect = pipewire.func("pw_context_connect", koffi.pointer(pw_core), [
|
|
11
|
+
koffi.pointer(pw_context),
|
|
12
|
+
koffi.pointer(pw_properties),
|
|
13
|
+
"size_t"
|
|
14
|
+
]);
|
|
15
|
+
|
|
16
|
+
export const pw_core_get_registry = pipewire.func("pw_core_get_registry", koffi.pointer(pw_registry), [
|
|
17
|
+
koffi.pointer(pw_core),
|
|
18
|
+
"uint32_t",
|
|
19
|
+
"size_t"
|
|
20
|
+
]);
|
|
21
|
+
|
|
22
|
+
export const pw_registry_events_globals = koffi.proto("void", [
|
|
23
|
+
"void*", // data
|
|
24
|
+
"uint32_t", // id
|
|
25
|
+
"uint32_t", // permissions
|
|
26
|
+
"const char*", // type
|
|
27
|
+
"uint32_t", // version
|
|
28
|
+
"void*" // props
|
|
29
|
+
]);
|
|
30
|
+
|
|
31
|
+
export const pw_registry_events = koffi.struct("pw_registry_events", {
|
|
32
|
+
vesion: "uint32_t",
|
|
33
|
+
global: "void*", // TODO
|
|
34
|
+
global_remove: "void*" // TODO
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export const pw_core_disconnect = pipewire.func("pw_core_disconnect", "int", [koffi.pointer(pw_core)]);
|
package/src/dict.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import koffi from "koffi";
|
|
2
|
+
|
|
3
|
+
export const spa_dict_item = koffi.struct("spa_dict_item", {
|
|
4
|
+
key: "const char*",
|
|
5
|
+
value: "const char*"
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export const spa_dict = koffi.struct("spa_dict", {
|
|
9
|
+
flags: "uint32_t",
|
|
10
|
+
n_items: "uint32_t",
|
|
11
|
+
items: koffi.pointer(spa_dict_item)
|
|
12
|
+
});
|
package/src/hook.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import koffi from "koffi";
|
|
2
|
+
import { spa_list } from "./list.js";
|
|
3
|
+
|
|
4
|
+
export const spa_callbacks = koffi.struct("spa_callbacks", {
|
|
5
|
+
funcs: "void*",
|
|
6
|
+
data: "void*"
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const spa_hook_opaque = koffi.opaque("spa_hook");
|
|
10
|
+
|
|
11
|
+
export const spa_hook = koffi.struct(spa_hook_opaque, {
|
|
12
|
+
link: spa_list,
|
|
13
|
+
cb: spa_callbacks,
|
|
14
|
+
removed: koffi.pointer(koffi.proto("void", [koffi.pointer(spa_hook_opaque)])),
|
|
15
|
+
priv: "void*"
|
|
16
|
+
});
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as context from "./context.js";
|
|
2
|
+
import * as core from "./core.js";
|
|
3
|
+
import * as hook from "./hook.js";
|
|
4
|
+
import * as main_loop from "./main-loop.js";
|
|
5
|
+
import * as pipewire from "./pipewire.js";
|
|
6
|
+
import * as proxy from "./proxy.js";
|
|
7
|
+
import * as registry from "./registry.js";
|
|
8
|
+
|
|
9
|
+
export { context, core, hook, main_loop, pipewire, proxy, registry };
|
package/src/list.ts
ADDED
package/src/loop.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import koffi from "koffi";
|
|
2
|
+
|
|
3
|
+
export const spa_system = koffi.opaque("spa_system");
|
|
4
|
+
export const spa_loop = koffi.opaque("spa_loop");
|
|
5
|
+
export const spa_loop_control = koffi.opaque("spa_loop_control");
|
|
6
|
+
|
|
7
|
+
export const spa_loop_utils = koffi.opaque("spa_loop_utils"); // TODO
|
|
8
|
+
|
|
9
|
+
export const pw_loop = koffi.struct("pw_loop", {
|
|
10
|
+
system: koffi.pointer(spa_system),
|
|
11
|
+
loop: koffi.pointer(spa_loop),
|
|
12
|
+
control: koffi.pointer(spa_loop_control),
|
|
13
|
+
utils: koffi.pointer(spa_loop_utils),
|
|
14
|
+
name: "const char*"
|
|
15
|
+
});
|
package/src/main-loop.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import koffi from "koffi";
|
|
2
|
+
import { spa_dict } from "./dict.js";
|
|
3
|
+
import { pw_loop } from "./loop.js";
|
|
4
|
+
|
|
5
|
+
const pipewire = koffi.load("libpipewire-0.3.so.0");
|
|
6
|
+
|
|
7
|
+
export const pw_main_loop = koffi.opaque("pw_main_loop");
|
|
8
|
+
|
|
9
|
+
export const pw_main_loop_new = pipewire.func("pw_main_loop_new", koffi.pointer(pw_main_loop), [
|
|
10
|
+
koffi.pointer(spa_dict)
|
|
11
|
+
]);
|
|
12
|
+
export const pw_main_loop_get_loop = pipewire.func("pw_main_loop_get_loop", koffi.pointer(pw_loop), [
|
|
13
|
+
koffi.pointer(pw_main_loop)
|
|
14
|
+
]);
|
|
15
|
+
export const pw_main_loop_run = pipewire.func("pw_main_loop_run", "int", [koffi.pointer(pw_main_loop)]);
|
|
16
|
+
export const pw_main_loop_quit = pipewire.func("pw_main_loop_quit", "int", [koffi.pointer(pw_main_loop)]);
|
|
17
|
+
export const pw_main_loop_destroy = pipewire.func("pw_main_loop_destroy", "void", [koffi.pointer(pw_main_loop)]);
|
package/src/pipewire.ts
ADDED
package/src/proxy.ts
ADDED
package/src/registry.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import koffi from "koffi";
|
|
2
|
+
import { pw_registry, pw_registry_events } from "./core.js";
|
|
3
|
+
import { spa_hook } from "./hook.js";
|
|
4
|
+
|
|
5
|
+
const pipewire = koffi.load("libpipewire-0.3.so.0");
|
|
6
|
+
|
|
7
|
+
export const pw_registry_add_listener = pipewire.func("pw_registry_add_listener", "int", [
|
|
8
|
+
koffi.pointer(pw_registry),
|
|
9
|
+
koffi.pointer(spa_hook),
|
|
10
|
+
koffi.pointer(pw_registry_events),
|
|
11
|
+
"void*"
|
|
12
|
+
]);
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Visit https://aka.ms/tsconfig to read more about this file
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
// File Layout
|
|
5
|
+
// "rootDir": "./src",
|
|
6
|
+
// "outDir": "./dist",
|
|
7
|
+
|
|
8
|
+
// Environment Settings
|
|
9
|
+
// See also https://aka.ms/tsconfig/module
|
|
10
|
+
"module": "nodenext",
|
|
11
|
+
"target": "esnext",
|
|
12
|
+
"types": [],
|
|
13
|
+
// For nodejs:
|
|
14
|
+
// "lib": ["esnext"],
|
|
15
|
+
// "types": ["node"],
|
|
16
|
+
// and npm install -D @types/node
|
|
17
|
+
|
|
18
|
+
// Other Outputs
|
|
19
|
+
"sourceMap": true,
|
|
20
|
+
"declaration": true,
|
|
21
|
+
"declarationMap": true,
|
|
22
|
+
|
|
23
|
+
// Stricter Typechecking Options
|
|
24
|
+
"noUncheckedIndexedAccess": true,
|
|
25
|
+
"exactOptionalPropertyTypes": true,
|
|
26
|
+
|
|
27
|
+
// Style Options
|
|
28
|
+
// "noImplicitReturns": true,
|
|
29
|
+
// "noImplicitOverride": true,
|
|
30
|
+
// "noUnusedLocals": true,
|
|
31
|
+
// "noUnusedParameters": true,
|
|
32
|
+
// "noFallthroughCasesInSwitch": true,
|
|
33
|
+
// "noPropertyAccessFromIndexSignature": true,
|
|
34
|
+
|
|
35
|
+
// Recommended Options
|
|
36
|
+
"strict": true,
|
|
37
|
+
"jsx": "react-jsx",
|
|
38
|
+
"verbatimModuleSyntax": true,
|
|
39
|
+
"isolatedModules": true,
|
|
40
|
+
"noUncheckedSideEffectImports": true,
|
|
41
|
+
"moduleDetection": "force",
|
|
42
|
+
"skipLibCheck": true,
|
|
43
|
+
}
|
|
44
|
+
}
|