1
- import { Session } from 'inspector'
2
1
import { MessageType , SdpMessage } from '../../components/message'
3
2
import { NtpSeconds , seconds } from './ntp'
4
3
4
+ interface ConnectionField {
5
+ // c=<nettype> <addrtype> <connection-address>
6
+ networkType : 'IN'
7
+ addressType : 'IP4' | 'IP6'
8
+ connectionAddress : string
9
+ }
10
+
11
+ interface BandwidthField {
12
+ readonly type : string
13
+ readonly value : number
14
+ }
15
+
16
+ // RTSP extensions: https://tools.ietf.org/html/rfc7826 (22.15)
17
+ // exists on both session and media level
18
+ interface RtspExtensions {
19
+ readonly range ?: string
20
+ readonly control ?: string
21
+ readonly mtag ?: string
22
+ }
23
+
5
24
/**
6
25
* The session description protocol (SDP).
7
26
*
@@ -36,7 +55,7 @@ import { NtpSeconds, seconds } from './ntp'
36
55
* Names of the fields below are annotated above with
37
56
* the names used in Appendix A: SDP Grammar of RFC 2327.
38
57
*/
39
- export interface SessionDescription {
58
+ export interface SessionDescription extends RtspExtensions {
40
59
// v=0
41
60
readonly version : 0
42
61
// o=<username> <sess-id> <sess-version> <nettype> <addrtype> <unicast-address>
@@ -58,10 +77,6 @@ export interface SessionDescription {
58
77
// One or more time descriptions
59
78
readonly time : TimeDescription
60
79
readonly repeatTimes ?: RepeatTimeDescription
61
- // RTSP attributes
62
- readonly range ?: string
63
- readonly control ?: string
64
- readonly mtag ?: string
65
80
// Zero or more media descriptions
66
81
readonly media : MediaDescription [ ]
67
82
}
@@ -76,26 +91,6 @@ interface OriginField {
76
91
address : string
77
92
}
78
93
79
- interface ConnectionField {
80
- // c=<nettype> <addrtype> <connection-address>
81
- networkType : 'IN'
82
- addressType : 'IP4' | 'IP6'
83
- connectionAddress : string
84
- }
85
-
86
- interface BandwidthField {
87
- readonly type : string
88
- readonly value : number
89
- }
90
-
91
- // RTSP extensions: https://tools.ietf.org/html/rfc7826 (22.15)
92
- // exists on both session and media level
93
- interface RtspExtensions {
94
- readonly range ?: string
95
- readonly control ?: string
96
- readonly mtag ?: string
97
- }
98
-
99
94
/**
100
95
* Time description
101
96
*
@@ -130,7 +125,7 @@ export interface RepeatTimeDescription {
130
125
* can be multiple fmt values with corresponding rtpmap
131
126
* attributes)
132
127
*/
133
- export interface MediaDescription {
128
+ export interface MediaDescription extends RtspExtensions {
134
129
// m=<media> <port> <proto> <fmt> ...
135
130
// m=<media> <port>/<number of ports> <proto> <fmt> ...
136
131
readonly type : 'audio' | 'video' | 'application' | 'data' | 'control'
@@ -143,10 +138,6 @@ export interface MediaDescription {
143
138
* Any remaining attributes
144
139
* a=...
145
140
*/
146
- // RTSP attributes
147
- readonly range ?: string
148
- readonly control ?: string
149
- readonly mtag ?: string
150
141
// a=rtpmap:<payload type> <encoding name>/<clock rate> [/<encoding parameters>]
151
142
readonly rtpmap ?: {
152
143
readonly clockrate : number
@@ -214,7 +205,7 @@ export interface AACMedia extends AudioMedia {
214
205
}
215
206
216
207
export interface Sdp {
217
- readonly session : Session
208
+ readonly session : SessionDescription
218
209
readonly media : MediaDescription [ ]
219
210
}
220
211
0 commit comments