-
Notifications
You must be signed in to change notification settings - Fork 11
/
sdp.d.ts
220 lines (175 loc) · 5.68 KB
/
sdp.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
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
export type SDPBlob = string;
export type SDPLine = string;
export type SDPSection = string;
export type SDPDirection = 'sendonly' | 'recvonly' | 'sendrecv' | 'inactive';
export interface SDPIceCandidate {
foundation: string;
component: 'rtp' | 'rtcp' | number;
protocol: 'tcp' | 'udp';
priority: number;
ip: string;
address: string;
port: number;
type: 'host' | 'prflx' | 'srflx' | 'relay';
relatedAddress?: string;
relatedPort?: number;
tcpType?: string;
ufrag?: string;
usernameFragment?: string;
}
export interface SDPIceParameters {
iceLite?: boolean;
usernameFragment: string;
password: string;
}
export interface SDPCodecParameters {
payloadType: number;
preferredPayloadType?: number;
name: string;
clockRate: number;
channels: number;
numChannels?: number;
maxptime?: number;
}
export interface SDPCodecAdditionalParameters {
[key: string]: string;
}
export interface SDPHeaderExtension {
id: number;
direction?: SDPDirection;
uri: string;
attributes: string | undefined;
}
export interface SDPFeedbackParameter {
type: string;
parameter: string;
}
export interface SDPFingerprint {
algorithm: string;
value: string;
}
export interface SDPDtlsParameters {
role: string;
fingerprints: SDPFingerprint[];
}
export interface SDPMediaSource {
ssrc: number;
attribute?: string;
value?: string;
}
export interface SDPMediaSourceGroup {
semantics: string;
ssrcs: number[];
}
export interface SDPMediaStreamId {
stream: string;
track: string;
}
export interface SDPCodec extends SDPCodecParameters {
payloadType: number;
preferredPayloadType?: number;
parameters?: SDPCodecAdditionalParameters;
rtcpFeedback?: SDPFeedbackParameter[];
}
export interface SDPGroup {
semantics: string;
mids: string[];
}
export interface SDPMLine {
kind: string;
port?: number;
protocol: string;
fmt?: string;
}
export interface SDPOLine {
username: string;
sessionId: string;
sessionVersion: number;
netType: string;
addressType: string;
address: string;
}
export interface SDPRtcpParameters {
cname?: string;
ssrc?: number;
reducedSize?: boolean;
compound?: boolean;
mux?: boolean;
}
export interface SDPEncodingParameters {
ssrc: number;
codecPayloadType?: number;
rtx?: {
ssrc: number;
};
fec?: {
ssrc: number;
mechanism: string;
};
}
export interface SDPRtpCapabilities {
codecs: SDPCodec[];
headerExtensions: SDPHeaderExtension[];
fecMechanisms: string[];
rtcp?: SDPRtcpParameters[];
}
export interface SDPSctpDescription {
port: number;
protocol: string;
maxMessageSize?: number;
}
export const localCname: string;
export function generateIdentifier(): string;
export function splitLines(blob: SDPBlob): SDPLine[];
export function splitSections(blob: SDPBlob): SDPSection[];
export function getDescription(blob: SDPBlob): SDPSection;
export function getMediaSections(blob: SDPBlob): SDPSection[];
export function matchPrefix(blob: SDPBlob, prefix: string): SDPLine[];
export function parseCandidate(line: SDPLine): SDPIceCandidate;
export function writeCandidate(candidate: SDPIceCandidate): SDPLine;
export function parseIceOptions(line: SDPLine): string[];
export function parseRtpMap(line: SDPLine): SDPCodecParameters;
export function writeRtpMap(codec: SDPCodecParameters): SDPLine;
export function parseExtmap(line: SDPLine): SDPHeaderExtension;
export function writeExtmap(headerExtension: SDPHeaderExtension): SDPLine;
export function parseFmtp(line: SDPLine): SDPCodecAdditionalParameters;
export function writeFmtp(codec: SDPCodec): SDPLine;
export function parseRtcpFb(line: SDPLine): SDPFeedbackParameter;
export function writeRtcpFb(codec: SDPCodec): SDPLine[];
export function parseSsrcMedia(line: SDPLine): SDPMediaSource;
export function parseSsrcGroup(line: SDPLine): SDPMediaSourceGroup;
export function getMid(mediaSection: SDPSection): string;
export function parseFingerprint(line: SDPLine): SDPFingerprint;
export function getDtlsParameters(
mediaSection: SDPSection,
session: SDPSection
): SDPDtlsParameters;
export function writeDtlsParameters(params: SDPDtlsParameters, setupType: string): SDPLine;
export function getIceParameters(
mediaSection: SDPSection,
session: SDPSection
): SDPIceParameters;
export function writeIceParameters(params: SDPIceParameters): SDPLine;
export function parseRtpParameters(mediaSection: SDPSection): SDPRtpCapabilities;
export function writeRtpDescription(kind: string, caps: SDPRtpCapabilities): SDPSection;
export function parseRtpEncodingParameters(mediaSection: SDPSection): SDPEncodingParameters[];
export function parseRtcpParameters(mediaSection: SDPSection): SDPRtcpParameters;
export function writeRtcpParameters(params: SDPRtcpParameters): SDPLine;
export function parseMsid(mediaSection: SDPSection): SDPMediaStreamId;
export function parseSctpDescription(mediaSection: SDPSection): SDPSctpDescription;
export function writeSctpDescription(
mediaSection: SDPMLine,
desc: SDPSctpDescription
): SDPSection;
export function generateSessionId(): string;
export function writeSessionBoilerplate(
sessId?: string,
sessVer?: number,
sessUser?: string
): SDPBlob;
export function getDirection(mediaSection: SDPSection, sessionpart: SDPSection): SDPDirection;
export function getKind(mediaSection: SDPSection): string;
export function isRejected(mediaSection: SDPSection): boolean;
export function parseMLine(mediaSection: SDPSection): SDPMLine;
export function parseOLine(mediaSection: SDPSection): SDPOLine;
export function isValidSDP(blob: SDPBlob): boolean;