Class: Net::RTSP
- Inherits:
-
Protocol
- Object
- Protocol
- Net::RTSP
- Defined in:
- lib/raop/rtsp.rb
Defined Under Namespace
Classes: Announce, Flush, GetParameter, Options, RTSPGenericRequest, RTSPResponse, Record, SetParameter, Setup, Teardown
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#debug_output ⇒ Object
Returns the value of attribute debug_output.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
Class Method Summary collapse
Instance Method Summary collapse
- #connect ⇒ Object
-
#initialize(address, id, instance, port = RTSP.default_port) ⇒ RTSP
constructor
A new instance of RTSP.
- #request(req) ⇒ Object
- #start ⇒ Object
- #started? ⇒ Boolean
Constructor Details
#initialize(address, id, instance, port = RTSP.default_port) ⇒ RTSP
Returns a new instance of RTSP.
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/raop/rtsp.rb', line 16 def initialize(address, id, instance, port = RTSP.default_port) @address = address @port = port @started = false @debug_output = nil @cseq = 0 @open_timeout = nil @socket = nil @client_id = id @client_instance = instance end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
14 15 16 |
# File 'lib/raop/rtsp.rb', line 14 def address @address end |
#debug_output ⇒ Object
Returns the value of attribute debug_output.
12 13 14 |
# File 'lib/raop/rtsp.rb', line 12 def debug_output @debug_output end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
13 14 15 |
# File 'lib/raop/rtsp.rb', line 13 def port @port end |
Class Method Details
.default_port ⇒ Object
7 8 9 |
# File 'lib/raop/rtsp.rb', line 7 def default_port 5000 end |
Instance Method Details
#connect ⇒ Object
57 58 59 60 |
# File 'lib/raop/rtsp.rb', line 57 def connect s = timeout(@open_timeout) { TCPSocket.open(address(), port())} @socket = BufferedIO.new(s) end |
#request(req) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/raop/rtsp.rb', line 28 def request(req) unless started? start { return request(req) } end req['Client-Instance'] = @client_instance begin_transport(req) res = transport_request(req) end_transport(req, res) res end |
#start ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/raop/rtsp.rb', line 41 def start raise IOError, 'RTSP session already open' if @started if block_given? begin do_start return yield(self) ensure do_finish end end do_start self end |
#started? ⇒ Boolean
55 |
# File 'lib/raop/rtsp.rb', line 55 def started?; @started; end |