@girs/gstcuda-1.0 1.0.0-4.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/README.md +104 -0
- package/gstcuda-1.0-ambient.d.ts +12 -0
- package/gstcuda-1.0-ambient.js +2 -0
- package/gstcuda-1.0-import.d.ts +12 -0
- package/gstcuda-1.0-import.js +3 -0
- package/gstcuda-1.0.d.ts +591 -0
- package/gstcuda-1.0.js +6 -0
- package/package.json +60 -0
- package/tsconfig.json +23 -0
- package/typedoc.json +7 -0
package/README.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
|
|
2
|
+
# GstCuda-1.0
|
|
3
|
+
|
|
4
|
+

|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
GJS TypeScript type definitions for GstCuda-1.0, generated from library version 1.0.0 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.0.0.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
To use this type definitions, install them with NPM:
|
|
14
|
+
```bash
|
|
15
|
+
npm install @girs/gstcuda-1.0
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
You can import this package into your project like this:
|
|
21
|
+
```ts
|
|
22
|
+
import GstCuda from '@girs/gstcuda-1.0';
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Or if you prefer CommonJS, you can also use this:
|
|
26
|
+
```ts
|
|
27
|
+
const GstCuda = require('@girs/gstcuda-1.0');
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Ambient Modules
|
|
31
|
+
|
|
32
|
+
You can also use [ambient modules](https://github.com/gjsify/ts-for-gir/tree/main/packages/cli#ambient-modules) to import this module like you would do this in JavaScript.
|
|
33
|
+
For this you need to include `@girs/gstcuda-1.0` or `@girs/gstcuda-1.0/ambient` in your `tsconfig` or entry point Typescript file:
|
|
34
|
+
|
|
35
|
+
`index.ts`:
|
|
36
|
+
```ts
|
|
37
|
+
import '@girs/gstcuda-1.0'
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
`tsconfig.json`:
|
|
41
|
+
```json
|
|
42
|
+
{
|
|
43
|
+
"compilerOptions": {
|
|
44
|
+
...
|
|
45
|
+
},
|
|
46
|
+
"include": ["@girs/gstcuda-1.0"],
|
|
47
|
+
...
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Now you can import the ambient module with TypeScript support:
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import GstCuda from 'gi://GstCuda?version=1.0';
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Global import
|
|
58
|
+
|
|
59
|
+
You can also import the module with Typescript support using the global `imports.gi` object of GJS.
|
|
60
|
+
For this you need to include `@girs/gstcuda-1.0` or `@girs/gstcuda-1.0/import` in your `tsconfig` or entry point Typescript file:
|
|
61
|
+
|
|
62
|
+
`index.ts`:
|
|
63
|
+
```ts
|
|
64
|
+
import '@girs/gstcuda-1.0'
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
`tsconfig.json`:
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"compilerOptions": {
|
|
71
|
+
...
|
|
72
|
+
},
|
|
73
|
+
"include": ["@girs/gstcuda-1.0"],
|
|
74
|
+
...
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Now you have also type support for this, too:
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
const GstCuda = imports.gi.GstCuda;
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
### ESM vs. CommonJS
|
|
86
|
+
|
|
87
|
+
GJS supports two different import syntaxes. The new modern ESM syntax and the old global imports syntax.
|
|
88
|
+
|
|
89
|
+
In TypeScript projects for GJS and GNOME Shell extensions, you have the flexibility to use `ESM` syntax and then decide the import syntax for your bundled file. If your bundler is configured to use `CommonJS`, it will convert to the GJS-specific global imports syntax, like `const moduleName = imports.gi[moduleName]`. This is different from the traditional `require` syntax seen in Node.js. The global imports syntax is chosen because it aligns with the CommonJS format supported by NPM, which is used for the generated type definitions and this package.
|
|
90
|
+
|
|
91
|
+
On the other hand, if you configure your bundler to use ESM, it will retain the ESM import syntax. It's crucial to ensure that your bundler is set up to correctly translate and bundle these imports into either CommonJS or ESM format, depending on your project's requirements.
|
|
92
|
+
|
|
93
|
+
This approach is particularly important due to the `@girs` types, which include both `*.cjs `files, using the GJS global imports syntax, and `*.js` files, which utilize the ESM syntax. By appropriately setting up your bundler, you can control which syntax—CommonJS or ESM—is used in your project. The choice of CommonJS in this context is also due to the similarity between the GJS-specific global imports and CommonJS syntax, allowing for easier management and bundling in these specific types of projects.
|
|
94
|
+
|
|
95
|
+
Since GNOME Shell 45, you should only use ESM, even for GNOME Shell extensions. Before that, extensions had to use the global import syntax, unlike normal GJS applications, where ESM has been available for some time.
|
|
96
|
+
|
|
97
|
+
### Bundle
|
|
98
|
+
|
|
99
|
+
Depending on your project configuration, it is recommended to use a bundler like [esbuild](https://esbuild.github.io/). You can find examples using different bundlers [here](https://github.com/gjsify/ts-for-gir/tree/main/examples).
|
|
100
|
+
|
|
101
|
+
## Other packages
|
|
102
|
+
|
|
103
|
+
All existing pre-generated packages can be found on [gjsify/types](https://github.com/gjsify/types).
|
|
104
|
+
|
package/gstcuda-1.0.d.ts
ADDED
|
@@ -0,0 +1,591 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Type Definitions for Gjs (https://gjs.guide/)
|
|
3
|
+
*
|
|
4
|
+
* These type definitions are automatically generated, do not edit them by hand.
|
|
5
|
+
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import './gstcuda-1.0-ambient.d.ts';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* GstCuda-1.0
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import type GstVideo from '@girs/gstvideo-1.0';
|
|
15
|
+
import type GstBase from '@girs/gstbase-1.0';
|
|
16
|
+
import type Gst from '@girs/gst-1.0';
|
|
17
|
+
import type GObject from '@girs/gobject-2.0';
|
|
18
|
+
import type GLib from '@girs/glib-2.0';
|
|
19
|
+
import type GModule from '@girs/gmodule-2.0';
|
|
20
|
+
import type GstGL from '@girs/gstgl-1.0';
|
|
21
|
+
import type CudaGst from '@girs/cudagst-1.0';
|
|
22
|
+
|
|
23
|
+
export namespace GstCuda {
|
|
24
|
+
enum CudaGraphicsResourceType {
|
|
25
|
+
NONE,
|
|
26
|
+
GL_BUFFER,
|
|
27
|
+
D3D11_RESOURCE,
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* CUDA memory allocation method
|
|
31
|
+
*/
|
|
32
|
+
enum CudaMemoryAllocMethod {
|
|
33
|
+
UNKNOWN,
|
|
34
|
+
/**
|
|
35
|
+
* Memory allocated via cuMemAlloc or cuMemAllocPitch
|
|
36
|
+
*/
|
|
37
|
+
MALLOC,
|
|
38
|
+
/**
|
|
39
|
+
* Memory allocated via cuMemCreate and cuMemMap
|
|
40
|
+
*/
|
|
41
|
+
MMAP,
|
|
42
|
+
}
|
|
43
|
+
enum CudaQuarkId {
|
|
44
|
+
GRAPHICS_RESOURCE,
|
|
45
|
+
MAX,
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Name of the caps feature for indicating the use of #GstCudaMemory
|
|
49
|
+
*/
|
|
50
|
+
const CAPS_FEATURE_MEMORY_CUDA_MEMORY: string;
|
|
51
|
+
const CUDA_CONTEXT_TYPE: string;
|
|
52
|
+
/**
|
|
53
|
+
* Name of cuda memory type
|
|
54
|
+
*/
|
|
55
|
+
const CUDA_MEMORY_TYPE_NAME: string;
|
|
56
|
+
/**
|
|
57
|
+
* Flag indicating that we should map the CUDA device memory
|
|
58
|
+
* instead of to system memory.
|
|
59
|
+
*
|
|
60
|
+
* Combining #GST_MAP_CUDA with #GST_MAP_WRITE has the same semantics as though
|
|
61
|
+
* you are writing to CUDA device/host memory.
|
|
62
|
+
* Conversely, combining #GST_MAP_CUDA with
|
|
63
|
+
* #GST_MAP_READ has the same semantics as though you are reading from
|
|
64
|
+
* CUDA device/host memory
|
|
65
|
+
*/
|
|
66
|
+
const MAP_CUDA: number;
|
|
67
|
+
/**
|
|
68
|
+
* Gets configured allocation method
|
|
69
|
+
* @param config a buffer pool config
|
|
70
|
+
*/
|
|
71
|
+
function buffer_pool_config_get_cuda_alloc_method(config: Gst.Structure): CudaMemoryAllocMethod;
|
|
72
|
+
function buffer_pool_config_get_cuda_stream(config: Gst.Structure): CudaStream | null;
|
|
73
|
+
/**
|
|
74
|
+
* Sets allocation method
|
|
75
|
+
* @param config a buffer pool config
|
|
76
|
+
* @param method
|
|
77
|
+
*/
|
|
78
|
+
function buffer_pool_config_set_cuda_alloc_method(config: Gst.Structure, method: CudaMemoryAllocMethod): void;
|
|
79
|
+
/**
|
|
80
|
+
* Sets `stream` on `config`
|
|
81
|
+
* @param config a buffer pool config
|
|
82
|
+
* @param stream a #GstCudaStream
|
|
83
|
+
*/
|
|
84
|
+
function buffer_pool_config_set_cuda_stream(config: Gst.Structure, stream: CudaStream): void;
|
|
85
|
+
function context_new_cuda_context(cuda_ctx: CudaContext): Gst.Context;
|
|
86
|
+
/**
|
|
87
|
+
* Creates new user token value
|
|
88
|
+
* @returns user token value
|
|
89
|
+
*/
|
|
90
|
+
function cuda_create_user_token(): number;
|
|
91
|
+
/**
|
|
92
|
+
* Perform the steps necessary for retrieving a #GstCudaContext from the
|
|
93
|
+
* surrounding elements or from the application using the #GstContext mechanism.
|
|
94
|
+
*
|
|
95
|
+
* If the content of `cuda_ctx` is not %NULL, then no #GstContext query is
|
|
96
|
+
* necessary for #GstCudaContext.
|
|
97
|
+
* @param element the #GstElement running the query
|
|
98
|
+
* @param device_id preferred device-id, pass device_id >=0 when the device_id explicitly required. Otherwise, set -1.
|
|
99
|
+
* @param cuda_ctx the resulting #GstCudaContext
|
|
100
|
+
* @returns whether a #GstCudaContext exists in @cuda_ctx
|
|
101
|
+
*/
|
|
102
|
+
function cuda_ensure_element_context(
|
|
103
|
+
element: Gst.Element,
|
|
104
|
+
device_id: number,
|
|
105
|
+
cuda_ctx: CudaContext,
|
|
106
|
+
): [boolean, CudaContext];
|
|
107
|
+
function cuda_handle_context_query(element: Gst.Element, query: Gst.Query, cuda_ctx?: CudaContext | null): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Helper function for implementing #GstElementClass.set_context() in
|
|
110
|
+
* CUDA capable elements.
|
|
111
|
+
*
|
|
112
|
+
* Retrieves the #GstCudaContext in `context` and places the result in `cuda_ctx`.
|
|
113
|
+
* @param element a #GstElement
|
|
114
|
+
* @param context a #GstContext
|
|
115
|
+
* @param device_id preferred device-id, pass device_id >=0 when the device_id explicitly required. Otherwise, set -1.
|
|
116
|
+
* @param cuda_ctx location of a #GstCudaContext
|
|
117
|
+
* @returns whether the @cuda_ctx could be set successfully
|
|
118
|
+
*/
|
|
119
|
+
function cuda_handle_set_context(
|
|
120
|
+
element: Gst.Element,
|
|
121
|
+
context: Gst.Context,
|
|
122
|
+
device_id: number,
|
|
123
|
+
cuda_ctx: CudaContext,
|
|
124
|
+
): [boolean, CudaContext];
|
|
125
|
+
/**
|
|
126
|
+
* Loads the cuda library
|
|
127
|
+
* @returns %TRUE if the libcuda could be loaded %FALSE otherwise
|
|
128
|
+
*/
|
|
129
|
+
function cuda_load_library(): boolean;
|
|
130
|
+
/**
|
|
131
|
+
* Ensures that the #GstCudaAllocator is initialized and ready to be used.
|
|
132
|
+
*/
|
|
133
|
+
function cuda_memory_init_once(): void;
|
|
134
|
+
function cuda_nvrtc_compile(source: string): string;
|
|
135
|
+
function cuda_nvrtc_compile_cubin(source: string, device: number): string;
|
|
136
|
+
/**
|
|
137
|
+
* Loads the nvrtc library.
|
|
138
|
+
* @returns %TRUE if the library could be loaded, %FALSE otherwise
|
|
139
|
+
*/
|
|
140
|
+
function cuda_nvrtc_load_library(): boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Check if `mem` is a cuda memory
|
|
143
|
+
* @param mem A #GstMemory
|
|
144
|
+
*/
|
|
145
|
+
function is_cuda_memory(mem: Gst.Memory): boolean;
|
|
146
|
+
/**
|
|
147
|
+
* CUDA memory transfer flags
|
|
148
|
+
*/
|
|
149
|
+
enum CudaMemoryTransfer {
|
|
150
|
+
/**
|
|
151
|
+
* the device memory needs downloading to the staging memory
|
|
152
|
+
*/
|
|
153
|
+
DOWNLOAD,
|
|
154
|
+
/**
|
|
155
|
+
* the staging memory needs uploading to the device memory
|
|
156
|
+
*/
|
|
157
|
+
UPLOAD,
|
|
158
|
+
/**
|
|
159
|
+
* the device memory needs synchronization
|
|
160
|
+
*/
|
|
161
|
+
SYNC,
|
|
162
|
+
}
|
|
163
|
+
module CudaAllocator {
|
|
164
|
+
// Constructor properties interface
|
|
165
|
+
|
|
166
|
+
interface ConstructorProps extends Gst.Allocator.ConstructorProps {}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* A #GstAllocator subclass for cuda memory
|
|
171
|
+
*/
|
|
172
|
+
class CudaAllocator extends Gst.Allocator {
|
|
173
|
+
static $gtype: GObject.GType<CudaAllocator>;
|
|
174
|
+
|
|
175
|
+
// Constructors of GstCuda.CudaAllocator
|
|
176
|
+
|
|
177
|
+
constructor(properties?: Partial<CudaAllocator.ConstructorProps>, ...args: any[]);
|
|
178
|
+
|
|
179
|
+
_init(...args: any[]): void;
|
|
180
|
+
|
|
181
|
+
// Own virtual methods of GstCuda.CudaAllocator
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Controls the active state of `allocator`. Default #GstCudaAllocator is
|
|
185
|
+
* stateless and therefore active state is ignored, but subclass implementation
|
|
186
|
+
* (e.g., #GstCudaPoolAllocator) will require explicit active state control
|
|
187
|
+
* for its internal resource management.
|
|
188
|
+
*
|
|
189
|
+
* This method is conceptually identical to gst_buffer_pool_set_active method.
|
|
190
|
+
* @param active the new active state
|
|
191
|
+
*/
|
|
192
|
+
vfunc_set_active(active: boolean): boolean;
|
|
193
|
+
|
|
194
|
+
// Own methods of GstCuda.CudaAllocator
|
|
195
|
+
|
|
196
|
+
alloc(context: CudaContext, stream: CudaStream | null, info: GstVideo.VideoInfo): Gst.Memory | null;
|
|
197
|
+
// Conflicted with Gst.Allocator.alloc
|
|
198
|
+
alloc(...args: never[]): any;
|
|
199
|
+
/**
|
|
200
|
+
* Allocates a new memory that wraps the given CUDA device memory.
|
|
201
|
+
*
|
|
202
|
+
* `info` must represent actual memory layout, in other words, offset, stride
|
|
203
|
+
* and size fields of `info` should be matched with memory layout of `dev_ptr`
|
|
204
|
+
*
|
|
205
|
+
* By default, wrapped `dev_ptr` will be freed at the time when #GstMemory
|
|
206
|
+
* is freed if `notify` is %NULL. Otherwise, if caller sets `notify,`
|
|
207
|
+
* freeing `dev_ptr` is callers responsibility and default #GstCudaAllocator
|
|
208
|
+
* will not free it.
|
|
209
|
+
* @param context a #GstCudaContext
|
|
210
|
+
* @param stream a #GstCudaStream
|
|
211
|
+
* @param info a #GstVideoInfo
|
|
212
|
+
* @param dev_ptr a CUdeviceptr CUDA device memory
|
|
213
|
+
* @param notify Called with @user_data when the memory is freed
|
|
214
|
+
* @returns a new #GstMemory
|
|
215
|
+
*/
|
|
216
|
+
alloc_wrapped(
|
|
217
|
+
context: CudaContext,
|
|
218
|
+
stream: CudaStream | null,
|
|
219
|
+
info: GstVideo.VideoInfo,
|
|
220
|
+
dev_ptr: CudaGst.deviceptr,
|
|
221
|
+
notify?: GLib.DestroyNotify | null,
|
|
222
|
+
): Gst.Memory;
|
|
223
|
+
/**
|
|
224
|
+
* Controls the active state of `allocator`. Default #GstCudaAllocator is
|
|
225
|
+
* stateless and therefore active state is ignored, but subclass implementation
|
|
226
|
+
* (e.g., #GstCudaPoolAllocator) will require explicit active state control
|
|
227
|
+
* for its internal resource management.
|
|
228
|
+
*
|
|
229
|
+
* This method is conceptually identical to gst_buffer_pool_set_active method.
|
|
230
|
+
* @param active the new active state
|
|
231
|
+
* @returns %TRUE if active state of @allocator was successfully updated.
|
|
232
|
+
*/
|
|
233
|
+
set_active(active: boolean): boolean;
|
|
234
|
+
/**
|
|
235
|
+
* Allocates new #GstMemory object with CUDA virtual memory.
|
|
236
|
+
* @param context a #GstCudaContext
|
|
237
|
+
* @param stream a #GstCudaStream
|
|
238
|
+
* @param info a #GstVideoInfo
|
|
239
|
+
* @param prop allocation property
|
|
240
|
+
* @param granularity_flags allocation flags
|
|
241
|
+
* @returns a newly allocated memory object or %NULL if allocation is not supported
|
|
242
|
+
*/
|
|
243
|
+
virtual_alloc(
|
|
244
|
+
context: CudaContext,
|
|
245
|
+
stream: CudaStream,
|
|
246
|
+
info: GstVideo.VideoInfo,
|
|
247
|
+
prop: CudaGst.memAllocationProp,
|
|
248
|
+
granularity_flags: CudaGst.memAllocationGranularity_flags,
|
|
249
|
+
): Gst.Memory | null;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
module CudaBufferPool {
|
|
253
|
+
// Constructor properties interface
|
|
254
|
+
|
|
255
|
+
interface ConstructorProps extends Gst.BufferPool.ConstructorProps {}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
class CudaBufferPool extends Gst.BufferPool {
|
|
259
|
+
static $gtype: GObject.GType<CudaBufferPool>;
|
|
260
|
+
|
|
261
|
+
// Own fields of GstCuda.CudaBufferPool
|
|
262
|
+
|
|
263
|
+
context: CudaContext;
|
|
264
|
+
|
|
265
|
+
// Constructors of GstCuda.CudaBufferPool
|
|
266
|
+
|
|
267
|
+
constructor(properties?: Partial<CudaBufferPool.ConstructorProps>, ...args: any[]);
|
|
268
|
+
|
|
269
|
+
_init(...args: any[]): void;
|
|
270
|
+
|
|
271
|
+
static ['new'](context: CudaContext): CudaBufferPool;
|
|
272
|
+
// Conflicted with Gst.BufferPool.new
|
|
273
|
+
|
|
274
|
+
static ['new'](...args: never[]): any;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
module CudaContext {
|
|
278
|
+
// Constructor properties interface
|
|
279
|
+
|
|
280
|
+
interface ConstructorProps extends Gst.Object.ConstructorProps {
|
|
281
|
+
cuda_device_id: number;
|
|
282
|
+
cudaDeviceId: number;
|
|
283
|
+
os_handle: boolean;
|
|
284
|
+
osHandle: boolean;
|
|
285
|
+
virtual_memory: boolean;
|
|
286
|
+
virtualMemory: boolean;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
class CudaContext extends Gst.Object {
|
|
291
|
+
static $gtype: GObject.GType<CudaContext>;
|
|
292
|
+
|
|
293
|
+
// Own properties of GstCuda.CudaContext
|
|
294
|
+
|
|
295
|
+
get cuda_device_id(): number;
|
|
296
|
+
get cudaDeviceId(): number;
|
|
297
|
+
/**
|
|
298
|
+
* OS handle supportability in virtual memory management
|
|
299
|
+
*/
|
|
300
|
+
get os_handle(): boolean;
|
|
301
|
+
/**
|
|
302
|
+
* OS handle supportability in virtual memory management
|
|
303
|
+
*/
|
|
304
|
+
get osHandle(): boolean;
|
|
305
|
+
/**
|
|
306
|
+
* Virtual memory management supportability
|
|
307
|
+
*/
|
|
308
|
+
get virtual_memory(): boolean;
|
|
309
|
+
/**
|
|
310
|
+
* Virtual memory management supportability
|
|
311
|
+
*/
|
|
312
|
+
get virtualMemory(): boolean;
|
|
313
|
+
|
|
314
|
+
// Own fields of GstCuda.CudaContext
|
|
315
|
+
|
|
316
|
+
object: Gst.Object;
|
|
317
|
+
|
|
318
|
+
// Constructors of GstCuda.CudaContext
|
|
319
|
+
|
|
320
|
+
constructor(properties?: Partial<CudaContext.ConstructorProps>, ...args: any[]);
|
|
321
|
+
|
|
322
|
+
_init(...args: any[]): void;
|
|
323
|
+
|
|
324
|
+
static ['new'](device_id: number): CudaContext;
|
|
325
|
+
|
|
326
|
+
static new_wrapped(handler: CudaGst.context, device: CudaGst.device): CudaContext;
|
|
327
|
+
|
|
328
|
+
// Own static methods of GstCuda.CudaContext
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Pops the current CUDA context from CPU thread
|
|
332
|
+
* @param cuda_ctx
|
|
333
|
+
*/
|
|
334
|
+
static pop(cuda_ctx: CudaGst.context): boolean;
|
|
335
|
+
|
|
336
|
+
// Own methods of GstCuda.CudaContext
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Query whether `ctx` can access any memory which belongs to `peer` directly.
|
|
340
|
+
* @param peer a #GstCudaContext
|
|
341
|
+
* @returns %TRUE if @ctx can access @peer directly
|
|
342
|
+
*/
|
|
343
|
+
can_access_peer(peer: CudaContext): boolean;
|
|
344
|
+
/**
|
|
345
|
+
* Get CUDA device context. Caller must not modify and/or destroy
|
|
346
|
+
* returned device context.
|
|
347
|
+
* @returns the `CUcontext` of @ctx
|
|
348
|
+
*/
|
|
349
|
+
get_handle(): any | null;
|
|
350
|
+
/**
|
|
351
|
+
* Get required texture alignment by device
|
|
352
|
+
* @returns the `CUcontext` of @ctx
|
|
353
|
+
*/
|
|
354
|
+
get_texture_alignment(): number;
|
|
355
|
+
/**
|
|
356
|
+
* Pushes the given `ctx` onto the CPU thread's stack of current contexts.
|
|
357
|
+
* The specified context becomes the CPU thread's current context,
|
|
358
|
+
* so all CUDA functions that operate on the current context are affected.
|
|
359
|
+
* @returns %TRUE if @ctx was pushed without error.
|
|
360
|
+
*/
|
|
361
|
+
push(): boolean;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
module CudaPoolAllocator {
|
|
365
|
+
// Constructor properties interface
|
|
366
|
+
|
|
367
|
+
interface ConstructorProps extends CudaAllocator.ConstructorProps {}
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* A #GstCudaAllocator subclass for cuda memory pool
|
|
372
|
+
*/
|
|
373
|
+
class CudaPoolAllocator extends CudaAllocator {
|
|
374
|
+
static $gtype: GObject.GType<CudaPoolAllocator>;
|
|
375
|
+
|
|
376
|
+
// Own fields of GstCuda.CudaPoolAllocator
|
|
377
|
+
|
|
378
|
+
context: CudaContext;
|
|
379
|
+
|
|
380
|
+
// Constructors of GstCuda.CudaPoolAllocator
|
|
381
|
+
|
|
382
|
+
constructor(properties?: Partial<CudaPoolAllocator.ConstructorProps>, ...args: any[]);
|
|
383
|
+
|
|
384
|
+
_init(...args: any[]): void;
|
|
385
|
+
|
|
386
|
+
static ['new'](context: CudaContext, stream: CudaStream | null, info: GstVideo.VideoInfo): CudaPoolAllocator;
|
|
387
|
+
|
|
388
|
+
static new_for_virtual_memory(
|
|
389
|
+
context: CudaContext,
|
|
390
|
+
stream: CudaStream | null,
|
|
391
|
+
info: GstVideo.VideoInfo,
|
|
392
|
+
prop: CudaGst.memAllocationProp,
|
|
393
|
+
granularity_flags: CudaGst.memAllocationGranularity_flags,
|
|
394
|
+
): CudaPoolAllocator;
|
|
395
|
+
|
|
396
|
+
// Own methods of GstCuda.CudaPoolAllocator
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* Acquires a #GstMemory from `allocator`. `memory` should point to a memory
|
|
400
|
+
* location that can hold a pointer to the new #GstMemory.
|
|
401
|
+
* @returns a #GstFlowReturn such as %GST_FLOW_FLUSHING when the allocator is inactive.
|
|
402
|
+
*/
|
|
403
|
+
acquire_memory(): [Gst.FlowReturn, Gst.Memory];
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
type CudaAllocatorClass = typeof CudaAllocator;
|
|
407
|
+
abstract class CudaAllocatorPrivate {
|
|
408
|
+
static $gtype: GObject.GType<CudaAllocatorPrivate>;
|
|
409
|
+
|
|
410
|
+
// Constructors of GstCuda.CudaAllocatorPrivate
|
|
411
|
+
|
|
412
|
+
_init(...args: any[]): void;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
type CudaBufferPoolClass = typeof CudaBufferPool;
|
|
416
|
+
abstract class CudaBufferPoolPrivate {
|
|
417
|
+
static $gtype: GObject.GType<CudaBufferPoolPrivate>;
|
|
418
|
+
|
|
419
|
+
// Constructors of GstCuda.CudaBufferPoolPrivate
|
|
420
|
+
|
|
421
|
+
_init(...args: any[]): void;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
type CudaContextClass = typeof CudaContext;
|
|
425
|
+
abstract class CudaContextPrivate {
|
|
426
|
+
static $gtype: GObject.GType<CudaContextPrivate>;
|
|
427
|
+
|
|
428
|
+
// Constructors of GstCuda.CudaContextPrivate
|
|
429
|
+
|
|
430
|
+
_init(...args: any[]): void;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
class CudaGraphicsResource {
|
|
434
|
+
static $gtype: GObject.GType<CudaGraphicsResource>;
|
|
435
|
+
|
|
436
|
+
// Own fields of GstCuda.CudaGraphicsResource
|
|
437
|
+
|
|
438
|
+
cuda_context: CudaContext;
|
|
439
|
+
graphics_context: Gst.Object;
|
|
440
|
+
type: CudaGraphicsResourceType;
|
|
441
|
+
resource: CudaGst.graphicsResource;
|
|
442
|
+
flags: CudaGst.graphicsRegisterFlags;
|
|
443
|
+
registered: boolean;
|
|
444
|
+
mapped: boolean;
|
|
445
|
+
|
|
446
|
+
// Constructors of GstCuda.CudaGraphicsResource
|
|
447
|
+
|
|
448
|
+
_init(...args: any[]): void;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
class CudaMemory {
|
|
452
|
+
static $gtype: GObject.GType<CudaMemory>;
|
|
453
|
+
|
|
454
|
+
// Own fields of GstCuda.CudaMemory
|
|
455
|
+
|
|
456
|
+
context: CudaContext;
|
|
457
|
+
|
|
458
|
+
// Constructors of GstCuda.CudaMemory
|
|
459
|
+
|
|
460
|
+
_init(...args: any[]): void;
|
|
461
|
+
|
|
462
|
+
// Own static methods of GstCuda.CudaMemory
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* Ensures that the #GstCudaAllocator is initialized and ready to be used.
|
|
466
|
+
*/
|
|
467
|
+
static init_once(): void;
|
|
468
|
+
|
|
469
|
+
// Own methods of GstCuda.CudaMemory
|
|
470
|
+
|
|
471
|
+
/**
|
|
472
|
+
* Exports virtual memory handle to OS specific handle.
|
|
473
|
+
*
|
|
474
|
+
* On Windows, `os_handle` should be pointer to HANDLE (i.e., void **), and
|
|
475
|
+
* pointer to file descriptor (i.e., int *) on Linux.
|
|
476
|
+
*
|
|
477
|
+
* The returned `os_handle` is owned by `mem` and therefore caller shouldn't
|
|
478
|
+
* close the handle.
|
|
479
|
+
* @returns %TRUE if successful
|
|
480
|
+
*/
|
|
481
|
+
['export'](): [boolean, any];
|
|
482
|
+
/**
|
|
483
|
+
* Query allocation method
|
|
484
|
+
*/
|
|
485
|
+
get_alloc_method(): CudaMemoryAllocMethod;
|
|
486
|
+
/**
|
|
487
|
+
* Gets CUDA stream object associated with `mem`
|
|
488
|
+
* @returns a #GstCudaStream or %NULL if default CUDA stream is in use
|
|
489
|
+
*/
|
|
490
|
+
get_stream(): CudaStream | null;
|
|
491
|
+
/**
|
|
492
|
+
* Creates CUtexObject with given parameters
|
|
493
|
+
* @param plane the plane index
|
|
494
|
+
* @param filter_mode filter mode
|
|
495
|
+
* @returns %TRUE if successful
|
|
496
|
+
*/
|
|
497
|
+
get_texture(plane: number, filter_mode: CudaGst.filter_mode): [boolean, CudaGst.texObject];
|
|
498
|
+
/**
|
|
499
|
+
* Gets back user data pointer stored via gst_cuda_memory_set_token_data()
|
|
500
|
+
* @param token an user token
|
|
501
|
+
* @returns user data pointer or %NULL
|
|
502
|
+
*/
|
|
503
|
+
get_token_data(token: number): any | null;
|
|
504
|
+
/**
|
|
505
|
+
* Gets user data pointer stored via gst_cuda_allocator_alloc_wrapped()
|
|
506
|
+
* @returns the user data pointer
|
|
507
|
+
*/
|
|
508
|
+
get_user_data(): any | null;
|
|
509
|
+
/**
|
|
510
|
+
* Sets an opaque user data on a #GstCudaMemory
|
|
511
|
+
* @param token an user token
|
|
512
|
+
* @param data an user data
|
|
513
|
+
*/
|
|
514
|
+
set_token_data(token: number, data?: any | null): void;
|
|
515
|
+
/**
|
|
516
|
+
* Performs synchronization if needed
|
|
517
|
+
*/
|
|
518
|
+
sync(): void;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
abstract class CudaMemoryPrivate {
|
|
522
|
+
static $gtype: GObject.GType<CudaMemoryPrivate>;
|
|
523
|
+
|
|
524
|
+
// Constructors of GstCuda.CudaMemoryPrivate
|
|
525
|
+
|
|
526
|
+
_init(...args: any[]): void;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
type CudaPoolAllocatorClass = typeof CudaPoolAllocator;
|
|
530
|
+
abstract class CudaPoolAllocatorPrivate {
|
|
531
|
+
static $gtype: GObject.GType<CudaPoolAllocatorPrivate>;
|
|
532
|
+
|
|
533
|
+
// Constructors of GstCuda.CudaPoolAllocatorPrivate
|
|
534
|
+
|
|
535
|
+
_init(...args: any[]): void;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
class CudaStream {
|
|
539
|
+
static $gtype: GObject.GType<CudaStream>;
|
|
540
|
+
|
|
541
|
+
// Own fields of GstCuda.CudaStream
|
|
542
|
+
|
|
543
|
+
context: CudaContext;
|
|
544
|
+
|
|
545
|
+
// Constructors of GstCuda.CudaStream
|
|
546
|
+
|
|
547
|
+
constructor(context: CudaContext);
|
|
548
|
+
_init(...args: any[]): void;
|
|
549
|
+
|
|
550
|
+
static ['new'](context: CudaContext): CudaStream;
|
|
551
|
+
|
|
552
|
+
// Own methods of GstCuda.CudaStream
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* Get CUDA stream handle
|
|
556
|
+
* @returns a `CUstream` handle of @stream or %NULL if @stream is %NULL
|
|
557
|
+
*/
|
|
558
|
+
get_handle(): CudaGst.stream;
|
|
559
|
+
/**
|
|
560
|
+
* Increase the reference count of `stream`.
|
|
561
|
+
* @returns @stream
|
|
562
|
+
*/
|
|
563
|
+
ref(): CudaStream;
|
|
564
|
+
/**
|
|
565
|
+
* Decrease the reference count of `stream`.
|
|
566
|
+
*/
|
|
567
|
+
unref(): void;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
abstract class CudaStreamPrivate {
|
|
571
|
+
static $gtype: GObject.GType<CudaStreamPrivate>;
|
|
572
|
+
|
|
573
|
+
// Constructors of GstCuda.CudaStreamPrivate
|
|
574
|
+
|
|
575
|
+
_init(...args: any[]): void;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
/**
|
|
579
|
+
* Name of the imported GIR library
|
|
580
|
+
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
|
|
581
|
+
*/
|
|
582
|
+
const __name__: string;
|
|
583
|
+
/**
|
|
584
|
+
* Version of the imported GIR library
|
|
585
|
+
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
|
|
586
|
+
*/
|
|
587
|
+
const __version__: string;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
export default GstCuda;
|
|
591
|
+
// END
|
package/gstcuda-1.0.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@girs/gstcuda-1.0",
|
|
3
|
+
"version": "1.0.0-4.0.0",
|
|
4
|
+
"description": "GJS TypeScript type definitions for GstCuda-1.0, generated from library version 1.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"module": "gstcuda-1.0.js",
|
|
7
|
+
"main": "gstcuda-1.0.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
"./ambient": {
|
|
10
|
+
"types": "./gstcuda-1.0-ambient.d.ts",
|
|
11
|
+
"import": "./gstcuda-1.0-ambient.js",
|
|
12
|
+
"default": "./gstcuda-1.0-ambient.js"
|
|
13
|
+
},
|
|
14
|
+
"./import": {
|
|
15
|
+
"types": "./gstcuda-1.0-import.d.ts",
|
|
16
|
+
"import": "./gstcuda-1.0-import.js",
|
|
17
|
+
"default": "./gstcuda-1.0-import.js"
|
|
18
|
+
},
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./gstcuda-1.0.d.ts",
|
|
21
|
+
"import": "./gstcuda-1.0.js",
|
|
22
|
+
"default": "./gstcuda-1.0.js"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"test": "NODE_OPTIONS=--max_old_space_size=9216 tsc --noEmit gstcuda-1.0.d.ts"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@girs/cudagst-1.0": "^1.0.0-4.0.0",
|
|
30
|
+
"@girs/gjs": "^4.0.0-beta.1",
|
|
31
|
+
"@girs/glib-2.0": "^2.77.0-4.0.0-beta.1",
|
|
32
|
+
"@girs/gmodule-2.0": "^2.0.0-4.0.0-beta.1",
|
|
33
|
+
"@girs/gobject-2.0": "^2.77.0-4.0.0-beta.1",
|
|
34
|
+
"@girs/gst-1.0": "^1.23.0-4.0.0-beta.1",
|
|
35
|
+
"@girs/gstbase-1.0": "^1.0.0-4.0.0-beta.1",
|
|
36
|
+
"@girs/gstgl-1.0": "^1.0.0-4.0.0-beta.1",
|
|
37
|
+
"@girs/gstvideo-1.0": "^1.0.0-4.0.0-beta.1"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"typescript": "*"
|
|
41
|
+
},
|
|
42
|
+
"keywords": [
|
|
43
|
+
"Gir",
|
|
44
|
+
"TypeScript",
|
|
45
|
+
"types",
|
|
46
|
+
"GObject-Introspection",
|
|
47
|
+
"GJS",
|
|
48
|
+
"GstCuda-1.0"
|
|
49
|
+
],
|
|
50
|
+
"author": "ts-for-gir",
|
|
51
|
+
"license": "MIT",
|
|
52
|
+
"repository": {
|
|
53
|
+
"type": "git",
|
|
54
|
+
"url": "git+https://github.com/gjsify/ts-for-gir.git"
|
|
55
|
+
},
|
|
56
|
+
"bugs": {
|
|
57
|
+
"url": "https://github.com/gjsify/ts-for-gir/issues"
|
|
58
|
+
},
|
|
59
|
+
"homepage": "https://github.com/gjsify/types/tree/main/gstcuda-1.0#readme"
|
|
60
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
// General settings for code interpretation
|
|
4
|
+
"target": "ESNext",
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"lib": ["ESNext"],
|
|
7
|
+
"types": [],
|
|
8
|
+
"experimentalDecorators": true,
|
|
9
|
+
"moduleResolution": "node",
|
|
10
|
+
"noEmit": true,
|
|
11
|
+
"noEmitOnError": false,
|
|
12
|
+
"baseUrl": "./",
|
|
13
|
+
"rootDir": ".",
|
|
14
|
+
// General settings for code generation
|
|
15
|
+
"removeComments": false,
|
|
16
|
+
"inlineSourceMap": false,
|
|
17
|
+
"inlineSources": false,
|
|
18
|
+
"newLine": "LF"
|
|
19
|
+
},
|
|
20
|
+
"include": ["./gstcuda-1.0.d.ts"]
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|