-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.d.ts
More file actions
144 lines (126 loc) · 3.39 KB
/
index.d.ts
File metadata and controls
144 lines (126 loc) · 3.39 KB
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
/**
* Type definitions for node-gst-player
* A Node.js addon for playing media using GStreamer with WebGL rendering
*/
declare module "node-gst-player" {
/**
* GstPlayer class for low-level GStreamer pipeline control
*/
export class GstPlayer {
/**
* Pipeline state constants
*/
static readonly GST_STATE_VOID_PENDING: number;
static readonly GST_STATE_NULL: number;
static readonly GST_STATE_READY: number;
static readonly GST_STATE_PAUSED: number;
static readonly GST_STATE_PLAYING: number;
/**
* AppSink event constants
*/
static readonly AppSinkSetup: number;
static readonly AppSinkNewPreroll: number;
static readonly AppSinkNewSample: number;
static readonly AppSinkEos: number;
/**
* Parse and create a GStreamer pipeline
* @param pipelineString - GStreamer pipeline description string
*/
parseLaunch(pipelineString: string): void;
/**
* Add callback to an app sink element
* @param elementName - Name of the app sink element
* @param callback - Callback function for events
*/
addAppSinkCallback(elementName: string, callback: AppSinkCallback): void;
/**
* Add probe to an element pad for caps changes
* @param elementName - Name of the element
* @param padName - Name of the pad
* @param callback - Callback function for caps changes
*/
addCapsProbe(elementName: string, padName: string, callback: CapsProbeCallback): void;
/**
* Set the pipeline state
* @param state - GST_STATE_* constant
*/
setState(state: number): void;
/**
* Send end-of-stream event to the pipeline
*/
sendEos(): void;
}
/**
* WebGLGstPlayer class for hardware-accelerated video rendering
*/
export class WebGLGstPlayer {
/**
* Create a WebGL video player
* @param canvas - HTML canvas element for rendering
*/
constructor(canvas: HTMLCanvasElement);
/**
* Start playback with a GStreamer pipeline
* @param pipelineDesc - GStreamer pipeline description
*/
start(pipelineDesc: string): void;
/**
* Stop playback by sending EOS event
*/
stop(): void;
/**
* Get total frames rendered
* @returns Frame count
*/
getFrameCount(): number;
/**
* Reference to the underlying GstPlayer instance
*/
player: GstPlayer;
}
/**
* Video format information
*/
export interface VideoInfo {
width: number;
height: number;
pixelFormat: string;
mediaType: string;
caps?: string;
fpsNum?: number;
fpsDen?: number;
parNum?: number;
parDen?: number;
}
/**
* Audio format information
*/
export interface AudioInfo {
channels: number;
samplingRate: number;
sampleSize: number;
format: string;
mediaType: string;
caps?: string;
}
/**
* Media info (video or audio)
*/
export type MediaInfo = VideoInfo | AudioInfo;
/**
* AppSink callback event types
*/
export type AppSinkEvent =
| typeof GstPlayer.AppSinkSetup
| typeof GstPlayer.AppSinkNewPreroll
| typeof GstPlayer.AppSinkNewSample
| typeof GstPlayer.AppSinkEos;
/**
* AppSink callback function type
*/
export type AppSinkCallback = (event: AppSinkEvent, ...args: any[]) => void;
/**
* Caps probe callback function type
*/
export type CapsProbeCallback = (caps: MediaInfo) => void;
}