rtsp 0.0.1.alpha → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +3 -0
- data/.infinity_test +1 -1
- data/.yardopts +4 -0
- data/ChangeLog.rdoc +9 -0
- data/Gemfile +15 -6
- data/Gemfile.lock +78 -40
- data/LICENSE.rdoc +20 -0
- data/PostInstall.txt +0 -3
- data/README.rdoc +85 -36
- data/Rakefile +33 -49
- data/bin/rtsp_client +129 -0
- data/features/client_changes_state.feature +58 -0
- data/features/client_requests.feature +27 -0
- data/features/control_streams_as_client.feature +26 -0
- data/features/step_definitions/client_changes_state_steps.rb +46 -0
- data/features/step_definitions/client_requests_steps.rb +74 -0
- data/features/step_definitions/control_streams_as_client_steps.rb +34 -0
- data/features/support/env.rb +31 -29
- data/features/support/hooks.rb +3 -0
- data/gemspec.yml +30 -0
- data/lib/ext/logger.rb +8 -0
- data/lib/rtsp.rb +3 -6
- data/lib/rtsp/capturer.rb +105 -0
- data/lib/rtsp/client.rb +446 -204
- data/lib/rtsp/error.rb +6 -0
- data/lib/rtsp/global.rb +63 -0
- data/lib/rtsp/helpers.rb +28 -0
- data/lib/rtsp/message.rb +270 -0
- data/lib/rtsp/response.rb +89 -29
- data/lib/rtsp/transport_parser.rb +64 -0
- data/lib/rtsp/version.rb +4 -0
- data/nsm_test.rb +26 -0
- data/rtsp.gemspec +284 -0
- data/sarix_test.rb +23 -0
- data/soma_test.rb +39 -0
- data/spec/rtsp/client_spec.rb +302 -27
- data/spec/rtsp/helpers_spec.rb +53 -0
- data/spec/rtsp/message_spec.rb +420 -0
- data/spec/rtsp/response_spec.rb +144 -58
- data/spec/rtsp/transport_parser_spec.rb +54 -0
- data/spec/rtsp_spec.rb +3 -3
- data/spec/spec_helper.rb +66 -7
- data/spec/support/fake_rtsp_server.rb +123 -0
- data/tasks/metrics.rake +27 -0
- data/tasks/roodi_config.yml +14 -0
- data/tasks/stats.rake +12 -0
- metadata +174 -183
- data/.autotest +0 -23
- data/History.txt +0 -4
- data/Manifest.txt +0 -26
- data/bin/rtsp +0 -121
- data/features/step_definitions/stream_steps.rb +0 -50
- data/features/stream.feature +0 -17
- data/features/support/common.rb +0 -1
- data/features/support/world.rb +0 -1
- data/lib/rtsp/request_messages.rb +0 -104
- data/lib/rtsp/status_code.rb +0 -7
data/spec/rtsp/response_spec.rb
CHANGED
@@ -1,62 +1,77 @@
|
|
1
|
-
|
1
|
+
require_relative '../spec_helper'
|
2
2
|
require 'rtsp/response'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
describe RTSP::Response do
|
5
|
+
describe "#initialize" do
|
6
|
+
it "expects a non-nil string on" do
|
7
|
+
lambda { RTSP::Response.new(nil) }.should raise_exception RTSP::Error
|
8
|
+
end
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
Content-length: 406\r\n
|
15
|
-
Date: Sun, 23 Jan 2011 00:36:45 GMT\r\n
|
16
|
-
Expires: Sun, 23 Jan 2011 00:36:45 GMT\r\n
|
17
|
-
Content-Type: application/sdp\r\n
|
18
|
-
x-Accept-Retransmit: our-retransmit\r\n
|
19
|
-
x-Accept-Dynamic-Rate: 1\r\n
|
20
|
-
Content-Base: rtsp://64.202.98.91:554/gs.sdp/\r\n
|
21
|
-
\r\n\r\n
|
22
|
-
v=0
|
23
|
-
o=- 545877020 467920391 IN IP4 127.0.0.1
|
24
|
-
s=Groove Salad from SomaFM [aacPlus]
|
25
|
-
i=Downtempo Ambient Groove
|
26
|
-
c=IN IP4 0.0.0.0
|
27
|
-
t=0 0
|
28
|
-
a=x-qt-text-cmt:Orban Opticodec-PC
|
29
|
-
a=x-qt-text-nam:Groove Salad from SomaFM [aacPlus]
|
30
|
-
a=x-qt-text-inf:Downtempo Ambient Groove
|
31
|
-
a=control:*
|
32
|
-
m=audio 0 RTP/AVP 96
|
33
|
-
b=AS:48
|
34
|
-
a=rtpmap:96 MP4A-LATM/44100/2
|
35
|
-
a=fmtp:96 cpresent=0;config=400027200000
|
36
|
-
a=control:trackID=1
|
37
|
-
}
|
10
|
+
it "expects a non-empty string on" do
|
11
|
+
lambda { RTSP::Response.new("") }.should raise_exception RTSP::Error
|
12
|
+
end
|
13
|
+
end
|
38
14
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
}
|
15
|
+
describe "#parse_head" do
|
16
|
+
it "raises when RTSP version is corrupted" do
|
17
|
+
response = RTSP::Response.new OPTIONS_RESPONSE
|
18
|
+
lambda { response.parse_head "RTSP/ 200 OK\r\n" }.should raise_error RTSP::Error
|
19
|
+
end
|
45
20
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
Session: 118\r\n
|
51
|
-
RTP-Info: url=rtsp://10.221.222.235/stream1/track1;seq=17320;rtptime=400880602\r\n
|
52
|
-
}
|
21
|
+
it "raises when the response code is corrupted" do
|
22
|
+
response = RTSP::Response.new OPTIONS_RESPONSE
|
23
|
+
lambda { response.parse_head "RTSP/1.0 2 OK\r\n" }.should raise_error RTSP::Error
|
24
|
+
end
|
53
25
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
26
|
+
it "raises when the response message is corrupted" do
|
27
|
+
response = RTSP::Response.new OPTIONS_RESPONSE
|
28
|
+
lambda { response.parse_head "RTSP/1.0 200 \r\n" }.should raise_error RTSP::Error
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "#parse_body" do
|
33
|
+
it "returns an SDP::Description when @content_type is 'application/sdp" do
|
34
|
+
response = RTSP::Response.new DESCRIBE_RESPONSE
|
35
|
+
sdp = SDP::Description.new
|
36
|
+
sdp.username = "me"
|
37
|
+
sdp.id = 12345
|
38
|
+
sdp.version = 12345
|
39
|
+
sdp.network_type = "IN"
|
40
|
+
sdp.address_type = "IP4"
|
41
|
+
body = response.parse_body sdp.to_s
|
42
|
+
body.class.should == SDP::Description
|
43
|
+
end
|
44
|
+
|
45
|
+
it "returns the text that was passed to it but with line feeds removed" do
|
46
|
+
response = RTSP::Response.new OPTIONS_RESPONSE
|
47
|
+
string = "hi\r\nguys\r\n\r\n"
|
48
|
+
body = response.parse_body string
|
49
|
+
body.class.should == String
|
50
|
+
body.should == string
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
describe "#to_s" do
|
55
|
+
it "returns the text that was passed in" do
|
56
|
+
response = RTSP::Response.new OPTIONS_RESPONSE
|
57
|
+
response.to_s.should == OPTIONS_RESPONSE
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe "#inspect" do
|
62
|
+
before do
|
63
|
+
@response = RTSP::Response.new OPTIONS_RESPONSE
|
64
|
+
end
|
65
|
+
|
66
|
+
it "contains the class name and object ID first" do
|
67
|
+
@response.inspect.should match /^#<RTSP::Response:\d+/
|
68
|
+
end
|
69
|
+
|
70
|
+
it "begins with <# and ends with >" do
|
71
|
+
@response.inspect.should match /^#<.*>$/
|
72
|
+
end
|
73
|
+
end
|
58
74
|
|
59
|
-
describe RTSP::Response do
|
60
75
|
context "options" do
|
61
76
|
before do
|
62
77
|
@response = RTSP::Response.new OPTIONS_RESPONSE
|
@@ -94,14 +109,14 @@ describe RTSP::Response do
|
|
94
109
|
|
95
110
|
it "returns all header fields" do
|
96
111
|
@response.server.should == "DSS/5.5 (Build/489.7; Platform/Linux; Release/Darwin; )"
|
97
|
-
@response.cseq.should ==
|
112
|
+
@response.cseq.should == 1
|
98
113
|
@response.cache_control.should == "no-cache"
|
99
|
-
@response.content_length.should ==
|
114
|
+
@response.content_length.should == 406
|
100
115
|
@response.date.should == "Sun, 23 Jan 2011 00:36:45 GMT"
|
101
116
|
@response.expires.should == "Sun, 23 Jan 2011 00:36:45 GMT"
|
102
117
|
@response.content_type.should == "application/sdp"
|
103
118
|
@response.x_accept_retransmit.should == "our-retransmit"
|
104
|
-
@response.x_accept_dynamic_rate.should ==
|
119
|
+
@response.x_accept_dynamic_rate.should == 1
|
105
120
|
@response.content_base.should == "rtsp://64.202.98.91:554/gs.sdp/"
|
106
121
|
end
|
107
122
|
|
@@ -135,7 +150,7 @@ describe RTSP::Response do
|
|
135
150
|
end
|
136
151
|
|
137
152
|
it "returns the session" do
|
138
|
-
@response.session.should ==
|
153
|
+
@response.session.should == 118
|
139
154
|
end
|
140
155
|
end
|
141
156
|
|
@@ -161,7 +176,7 @@ describe RTSP::Response do
|
|
161
176
|
end
|
162
177
|
|
163
178
|
it "returns the session" do
|
164
|
-
@response.session.should ==
|
179
|
+
@response.session.should == 118
|
165
180
|
end
|
166
181
|
|
167
182
|
it "returns the rtp_info" do
|
@@ -186,4 +201,75 @@ describe RTSP::Response do
|
|
186
201
|
@response.date.should == 'Fri, Jan 28 2011 01:14:47 GMT'
|
187
202
|
end
|
188
203
|
end
|
189
|
-
|
204
|
+
|
205
|
+
context "#parse_head" do
|
206
|
+
before do
|
207
|
+
@response = RTSP::Response.new OPTIONS_RESPONSE
|
208
|
+
end
|
209
|
+
|
210
|
+
it "extracts the RTSP version from the header" do
|
211
|
+
@response.rtsp_version.should == "1.0"
|
212
|
+
end
|
213
|
+
|
214
|
+
it "extracts the response code from the header as a Fixnum" do
|
215
|
+
@response.code.is_a?(Fixnum).should be_true
|
216
|
+
@response.code.should == 200
|
217
|
+
end
|
218
|
+
|
219
|
+
it "extracts the response message from the header" do
|
220
|
+
@response.message.should == "OK"
|
221
|
+
end
|
222
|
+
|
223
|
+
it "returns empty value string when header has no value" do
|
224
|
+
response = RTSP::Response.new NO_CSEQ_VALUE_RESPONSE
|
225
|
+
response.parse_head NO_CSEQ_VALUE_RESPONSE
|
226
|
+
response.instance_variable_get(:@cseq).should == ""
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
describe "#split_head_and_body_from" do
|
231
|
+
it "splits responses with headers and no body" do
|
232
|
+
response = RTSP::Response.new OPTIONS_RESPONSE
|
233
|
+
head_and_body = response.split_head_and_body_from OPTIONS_RESPONSE
|
234
|
+
head_and_body.first.should == %Q{RTSP/1.0 200 OK\r\n
|
235
|
+
CSeq: 1\r\n
|
236
|
+
Date: Fri, Jan 28 2011 01:14:42 GMT\r\n
|
237
|
+
Public: OPTIONS, DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE\r\n
|
238
|
+
}
|
239
|
+
end
|
240
|
+
|
241
|
+
it "splits responses with headers and body" do
|
242
|
+
response = RTSP::Response.new DESCRIBE_RESPONSE
|
243
|
+
head_and_body = response.split_head_and_body_from DESCRIBE_RESPONSE
|
244
|
+
head_and_body.first.should == %{RTSP/1.0 200 OK\r\n
|
245
|
+
Server: DSS/5.5 (Build/489.7; Platform/Linux; Release/Darwin; )\r\n
|
246
|
+
Cseq: 1\r\n
|
247
|
+
Cache-Control: no-cache\r\n
|
248
|
+
Content-length: 406\r\n
|
249
|
+
Date: Sun, 23 Jan 2011 00:36:45 GMT\r\n
|
250
|
+
Expires: Sun, 23 Jan 2011 00:36:45 GMT\r\n
|
251
|
+
Content-Type: application/sdp\r\n
|
252
|
+
x-Accept-Retransmit: our-retransmit\r\n
|
253
|
+
x-Accept-Dynamic-Rate: 1\r\n
|
254
|
+
Content-Base: rtsp://64.202.98.91:554/gs.sdp/\r\n
|
255
|
+
}
|
256
|
+
head_and_body.last.should == %{
|
257
|
+
v=0
|
258
|
+
o=- 545877020 467920391 IN IP4 127.0.0.1
|
259
|
+
s=Groove Salad from SomaFM [aacPlus]
|
260
|
+
i=Downtempo Ambient Groove
|
261
|
+
c=IN IP4 0.0.0.0
|
262
|
+
t=0 0
|
263
|
+
a=x-qt-text-cmt:Orban Opticodec-PC
|
264
|
+
a=x-qt-text-nam:Groove Salad from SomaFM [aacPlus]
|
265
|
+
a=x-qt-text-inf:Downtempo Ambient Groove
|
266
|
+
a=control:*
|
267
|
+
m=audio 0 RTP/AVP 96
|
268
|
+
b=AS:48
|
269
|
+
a=rtpmap:96 MP4A-LATM/44100/2
|
270
|
+
a=fmtp:96 cpresent=0;config=400027200000
|
271
|
+
a=control:trackID=1
|
272
|
+
}
|
273
|
+
end
|
274
|
+
end
|
275
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
require 'rtsp/transport_parser'
|
3
|
+
|
4
|
+
describe RTSP::TransportParser do
|
5
|
+
before do
|
6
|
+
@parser = RTSP::TransportParser.new
|
7
|
+
end
|
8
|
+
|
9
|
+
describe "a basic Transport header" do
|
10
|
+
before do
|
11
|
+
transport = "RTP/AVP;unicast;client_port=9000-9001"
|
12
|
+
@result = @parser.parse transport
|
13
|
+
end
|
14
|
+
|
15
|
+
it "extracts the protocol" do
|
16
|
+
@result[:streaming_protocol].should == 'RTP'
|
17
|
+
end
|
18
|
+
|
19
|
+
it "extracts the profile" do
|
20
|
+
@result[:profile].should == 'AVP'
|
21
|
+
end
|
22
|
+
|
23
|
+
it "extracts the broadcast type" do
|
24
|
+
@result[:broadcast_type].should == 'unicast'
|
25
|
+
end
|
26
|
+
|
27
|
+
it "extracts the client RTP port" do
|
28
|
+
@result[:client_port][:rtp].should == '9000'
|
29
|
+
end
|
30
|
+
|
31
|
+
it "extracts the client RTCP port" do
|
32
|
+
@result[:client_port][:rtcp].should == '9001'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe "a TCP binary interleaved Transport header" do
|
37
|
+
before do
|
38
|
+
transport = "RTP/AVP/TCP;unicast;interleaved=0-1"
|
39
|
+
@result = @parser.parse transport
|
40
|
+
end
|
41
|
+
|
42
|
+
it "extracts the lower transport type" do
|
43
|
+
@result[:transport_protocol].should == 'TCP'
|
44
|
+
end
|
45
|
+
|
46
|
+
it "extracts the interleaved RTP channel" do
|
47
|
+
@result[:interleaved][:rtp_channel].should == '0'
|
48
|
+
end
|
49
|
+
|
50
|
+
it "extracts the interleaved RTCP channel" do
|
51
|
+
@result[:interleaved][:rtcp_channel].should == '1'
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
data/spec/rtsp_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
require_relative 'spec_helper'
|
2
2
|
|
3
3
|
describe Kernel do
|
4
4
|
def self.get_requires
|
@@ -21,7 +21,7 @@ describe RTSP do
|
|
21
21
|
RTSP.const_defined?('VERSION').should be_true
|
22
22
|
end
|
23
23
|
|
24
|
-
it "
|
25
|
-
RTSP.
|
24
|
+
it "has version 0.1.0" do
|
25
|
+
RTSP::VERSION.should == '0.1.0'
|
26
26
|
end
|
27
27
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,11 +1,70 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
gem 'rspec'
|
6
|
-
require 'rspec'
|
1
|
+
require 'simplecov'
|
2
|
+
|
3
|
+
SimpleCov.start do
|
4
|
+
add_filter "/spec/"
|
7
5
|
end
|
8
6
|
|
7
|
+
require 'rspec'
|
9
8
|
$:.unshift(File.dirname(__FILE__) + '/../lib')
|
10
9
|
require 'rtsp'
|
11
|
-
|
10
|
+
|
11
|
+
OPTIONS_RESPONSE = %Q{RTSP/1.0 200 OK\r\n
|
12
|
+
CSeq: 1\r\n
|
13
|
+
Date: Fri, Jan 28 2011 01:14:42 GMT\r\n
|
14
|
+
Public: OPTIONS, DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE\r\n
|
15
|
+
}
|
16
|
+
|
17
|
+
DESCRIBE_RESPONSE = %{RTSP/1.0 200 OK\r\n
|
18
|
+
Server: DSS/5.5 (Build/489.7; Platform/Linux; Release/Darwin; )\r\n
|
19
|
+
Cseq: 1\r\n
|
20
|
+
Cache-Control: no-cache\r\n
|
21
|
+
Content-length: 406\r\n
|
22
|
+
Date: Sun, 23 Jan 2011 00:36:45 GMT\r\n
|
23
|
+
Expires: Sun, 23 Jan 2011 00:36:45 GMT\r\n
|
24
|
+
Content-Type: application/sdp\r\n
|
25
|
+
x-Accept-Retransmit: our-retransmit\r\n
|
26
|
+
x-Accept-Dynamic-Rate: 1\r\n
|
27
|
+
Content-Base: rtsp://64.202.98.91:554/gs.sdp/\r\n
|
28
|
+
\r\n\r\n
|
29
|
+
v=0
|
30
|
+
o=- 545877020 467920391 IN IP4 127.0.0.1
|
31
|
+
s=Groove Salad from SomaFM [aacPlus]
|
32
|
+
i=Downtempo Ambient Groove
|
33
|
+
c=IN IP4 0.0.0.0
|
34
|
+
t=0 0
|
35
|
+
a=x-qt-text-cmt:Orban Opticodec-PC
|
36
|
+
a=x-qt-text-nam:Groove Salad from SomaFM [aacPlus]
|
37
|
+
a=x-qt-text-inf:Downtempo Ambient Groove
|
38
|
+
a=control:*
|
39
|
+
m=audio 0 RTP/AVP 96
|
40
|
+
b=AS:48
|
41
|
+
a=rtpmap:96 MP4A-LATM/44100/2
|
42
|
+
a=fmtp:96 cpresent=0;config=400027200000
|
43
|
+
a=control:trackID=1
|
44
|
+
}
|
45
|
+
|
46
|
+
SETUP_RESPONSE = %Q{RTSP/1.0 200 OK\r\n
|
47
|
+
CSeq: 1\r\n
|
48
|
+
Date: Fri, Jan 28 2011 01:14:42 GMT\r\n
|
49
|
+
Transport: RTP/AVP;unicast;destination=10.221.222.186;source=10.221.222.235;client_port=9000-9001;server_port=6700-6701\r\n
|
50
|
+
Session: 118\r\n
|
51
|
+
\r\n}
|
52
|
+
|
53
|
+
PLAY_RESPONSE = %Q{RTSP/1.0 200 OK\r\n
|
54
|
+
CSeq: 1\r\n
|
55
|
+
Date: Fri, Jan 28 2011 01:14:42 GMT\r\n
|
56
|
+
Range: npt=0.000-\r\n
|
57
|
+
Session: 118\r\n
|
58
|
+
RTP-Info: url=rtsp://10.221.222.235/stream1/track1;seq=17320;rtptime=400880602\r\n
|
59
|
+
\r\n}
|
60
|
+
|
61
|
+
TEARDOWN_RESPONSE = %Q{RTSP/1.0 200 OK\r\n
|
62
|
+
CSeq: 1\r\n
|
63
|
+
Date: Fri, Jan 28 2011 01:14:47 GMT\r\n
|
64
|
+
\r\n}
|
65
|
+
|
66
|
+
NO_CSEQ_VALUE_RESPONSE = %Q{ RTSP/1.0 460 Only Aggregate Option Allowed\r\n
|
67
|
+
Server: DSS/5.5 (Build/489.7; Platform/Linux; Release/Darwin; )\r\n
|
68
|
+
Cseq: \r\n
|
69
|
+
Connection: Close\r\n
|
70
|
+
\r\n}
|
@@ -0,0 +1,123 @@
|
|
1
|
+
require 'time'
|
2
|
+
|
3
|
+
class FakeRTSPServer
|
4
|
+
def initialize(*args)
|
5
|
+
end
|
6
|
+
|
7
|
+
def send(*args)
|
8
|
+
message = args.first
|
9
|
+
message =~ /^(\w+) .+CSeq: (\S+)/m
|
10
|
+
@message_type = $1.downcase
|
11
|
+
@cseq = $2
|
12
|
+
@session = 1234567890
|
13
|
+
end
|
14
|
+
|
15
|
+
def recvfrom(size)
|
16
|
+
response = eval @message_type
|
17
|
+
[response]
|
18
|
+
end
|
19
|
+
|
20
|
+
def options
|
21
|
+
message = "RTSP/1.0 200 OK\r\n"
|
22
|
+
message << "CSeq: #{@cseq}\r\n"
|
23
|
+
message << "Date: #{Time.now.httpdate}\r\n"
|
24
|
+
message << "Public: DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE\r\n"
|
25
|
+
message << "\r\n"
|
26
|
+
end
|
27
|
+
|
28
|
+
def describe
|
29
|
+
message = "RTSP/1.0 200 OK\r\n"
|
30
|
+
message << "CSeq: #{@cseq}\r\n"
|
31
|
+
message << "Server: DSS/5.5 (Build/489.7; Platform/Linux; Release/Darwin; )\r\n"
|
32
|
+
message << "Cache-Control: no-cache\r\n"
|
33
|
+
message << "Content-length: 380\r\n"
|
34
|
+
message << "Date: Tue, 15 Mar 2011 01:28:57 GMT\r\n"
|
35
|
+
message << "Expires: Tue, 15 Mar 2011 01:28:57 GMT\r\n"
|
36
|
+
message << "Content-Type: application/sdp\r\n"
|
37
|
+
message << "x-Accept-Retransmit: our-retransmit\r\n"
|
38
|
+
message << "x-Accept-Dynamic-Rate: 1\r\n"
|
39
|
+
message << "Content-Base: rtsp://64.202.98.91:554/sa.sdp/\r\n"
|
40
|
+
message << "\r\n"
|
41
|
+
message << "v=\r\n"
|
42
|
+
message << "o=- 1905836198 1274535354 IN IP4 127.0.0.1\r\n"
|
43
|
+
message << "s=Secret Agent from SomaFM\r\n"
|
44
|
+
message << "i=Downtempo Spy Lounge\r\n"
|
45
|
+
message << "c=IN IP4 0.0.0.0\r\n"
|
46
|
+
message << "t=0 0\r\n"
|
47
|
+
message << "a=x-qt-text-cmt:Orban Opticodec-PC\r\n"
|
48
|
+
message << "a=x-qt-text-nam:Secret Agent from SomaFM\r\n"
|
49
|
+
message << "a=x-qt-text-inf:Downtempo Spy Lounge\r\n"
|
50
|
+
message << "a=control:*\r\n"
|
51
|
+
message << "m=audio 0 RTP/AVP 96\r\n"
|
52
|
+
message << "b=AS:40\r\n"
|
53
|
+
message << "a=rtpmap:96 MP4A-LATM/44100/2\r\n"
|
54
|
+
message << "a=fmtp:96 cpresent=0;config=400027200000\r\n"
|
55
|
+
message << "a=control:trackID=1\r\n"
|
56
|
+
message << "\r\n"
|
57
|
+
end
|
58
|
+
|
59
|
+
def announce
|
60
|
+
message = "RTSP/1.0 200 OK\r\n"
|
61
|
+
message << "CSeq: #{@cseq}\r\n"
|
62
|
+
message << "\r\n"
|
63
|
+
end
|
64
|
+
|
65
|
+
def setup
|
66
|
+
%Q{RTSP/1.0 200 OK\r
|
67
|
+
CSeq: #{@cseq}\r
|
68
|
+
Date: #{Time.now.httpdate}\r
|
69
|
+
Transport: RTP/AVP;unicast;destination=10.221.222.186;source=10.221.222.235;client_port=9000-9001;server_port=6700-6701\r
|
70
|
+
Session: #{@session}\r
|
71
|
+
\r\n}
|
72
|
+
end
|
73
|
+
|
74
|
+
def play
|
75
|
+
%Q{RTSP/1.0 200 OK\r
|
76
|
+
CSeq: #{@cseq}\r
|
77
|
+
Date: #{Time.now.httpdate}\r
|
78
|
+
Range: npt=0.000-\r
|
79
|
+
Session: #{@session}\r
|
80
|
+
RTP-Info: url=rtsp://10.221.222.235/stream1/track1;seq=17320;rtptime=400880602\r
|
81
|
+
\r\n}
|
82
|
+
end
|
83
|
+
|
84
|
+
def pause
|
85
|
+
%Q{RTSP/1.0 200 OK\r
|
86
|
+
CSeq: #{@cseq}\r
|
87
|
+
Date: #{Time.now.httpdate}\r
|
88
|
+
\r\n}
|
89
|
+
end
|
90
|
+
|
91
|
+
def teardown
|
92
|
+
%Q{RTSP/1.0 200 OK\r
|
93
|
+
CSeq: #{@cseq}\r
|
94
|
+
Server: DSS/5.5 (Build/489.7; Platform/Linux; Release/Darwin; )\r
|
95
|
+
Session: #{@session}\r
|
96
|
+
Connection: Close\r
|
97
|
+
\r\n}
|
98
|
+
end
|
99
|
+
|
100
|
+
def get_parameter
|
101
|
+
%Q{RTSP/1.0 200 OK\r
|
102
|
+
CSeq: #{@cseq}\r
|
103
|
+
Content-Length: 8\r
|
104
|
+
\r
|
105
|
+
response\r
|
106
|
+
\r\n}
|
107
|
+
end
|
108
|
+
|
109
|
+
def set_parameter
|
110
|
+
%Q{RTSP/1.0 200 OK\r
|
111
|
+
CSeq: #{@cseq}\r
|
112
|
+
Content-Length: 8\r
|
113
|
+
\r
|
114
|
+
response\r
|
115
|
+
\r\n}
|
116
|
+
end
|
117
|
+
|
118
|
+
def record
|
119
|
+
%Q{RTSP/1.0 200 OK\r
|
120
|
+
CSeq: #{@cseq}\r
|
121
|
+
\r\n}
|
122
|
+
end
|
123
|
+
end
|