forked from ianshade/grandiose
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.d.ts
115 lines (104 loc) · 2.23 KB
/
index.d.ts
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
export interface AudioFrame {
type: 'audio'
audioFormat: AudioFormat
referenceLevel: number
sampleRate: number // Hz
channels: number
samples: number
channelStrideInBytes: number
timestamp: [number, number] // PTP timestamp
timecode: [number, number] // timecode as PTP value
data: Buffer
}
export interface VideoFrame {
type: 'video'
xres: number
yres: number
frameRateN: number
frameRateD: number
fourCC: FourCC
pictureAspectRatio: number
timestamp: [ number, number ] // PTP timestamp
frameFormatType: FrameType
timecode: [ number, number ] // Measured in nanoseconds
lineStrideBytes: number
data: Buffer
}
export interface Receiver {
embedded: unknown
video: (timeout?: number) => Promise<VideoFrame>
audio: (params: {
audioFormat: AudioFormat
referenceLevel: number
}, timeout?: number) => Promise<AudioFrame>
metadata: any
data: any
source: Source
colorFormat: ColorFormat
bandwidth: Bandwidth
allowVideoFields: boolean
}
export interface Sender {
embedded: unknown
video: (frame: VideoFrame) => Promise<void>
audio: (frame: AudioFrame) => Promise<void>
name: string
groups?: string | string[]
clockVideo: boolean
clockAudio: boolean
}
export interface Source {
name: string
urlAddress?: string
}
export const enum FrameType {
Progressive = 1,
Interlaced = 0,
Field0 = 2,
Field1 = 3,
}
export const enum ColorFormat {
BGRX_BGRA = 0,
UYVY_BGRA = 1,
RGBX_RGBA = 2,
UYVY_RGBA = 3,
Fastest = 100,
Best = 101
}
export const enum FourCC {
UYVY = 1498831189,
UYVA = 1096178005,
P216 = 909193808,
PA16 = 909197648,
YV12 = 842094169,
I420 = 808596553,
NV12 = 842094158,
BGRA = 1095911234,
BGRX = 1481787202,
RGBA = 1094862674,
RGBX = 1480738642
}
export const enum AudioFormat {
Float32Separate = 0,
Float32Interleaved = 1,
Int16Interleaved = 2
}
export const enum Bandwidth {
MetadataOnly = -10,
AudioOnly = 10,
Lowest = 0,
Highest = 100
}
export function receive(params: {
source: Source
colorFormat?: ColorFormat
bandwidth?: Bandwidth
allowVideoFields?: boolean
name?: string
}): Receiver
export function send(params: {
name: string
groups?: string | string[]
clockVideo?: boolean
clockAudio?: boolean
}): Sender