lib/rtsp/client.rb in rtsp-0.2.2 vs lib/rtsp/client.rb in rtsp-0.3.0

- old
+ new

@@ -1,21 +1,21 @@ require 'socket' require 'tempfile' require 'timeout' +require 'rtp/receiver' require_relative 'transport_parser' -require_relative 'capturer' require_relative 'error' require_relative 'global' require_relative 'helpers' require_relative 'message' require_relative 'response' module RTSP # This is the main interface to an RTSP server. A client object uses a couple - # main objects for configuration: an +RTSP::Capturer+ and a Connection Struct. + # main objects for configuration: an +RTP::Receiver+ and a Connection Struct. # Use the capturer to configure how to capture the data which is the RTP # stream provided by the RTSP server. Use the connection object to control # the connection to the server. # # You can initialize your client object using a block: @@ -54,11 +54,10 @@ # @todo Break Stream out in to its own class. class Client include RTSP::Helpers extend RTSP::Global - DEFAULT_CAPFILE_NAME = "ruby_rtsp_capture.rtsp" MAX_BYTES_TO_RECEIVE = 3000 # @return [URI] The URI that points to the RTSP server's resource. attr_reader :server_uri @@ -78,12 +77,12 @@ # @return [Struct::Connection] attr_accessor :connection # Use to get/set an object for capturing received data. - # @param [RTSP::Capturer] - # @return [RTSP::Capturer] + # @param [RTP::Receiver] + # @return [RTP::Receiver] attr_accessor :capturer # @return [Symbol] See {RFC section A.1.}[http://tools.ietf.org/html/rfc2326#page-76] attr_reader :session_state @@ -93,11 +92,11 @@ yield self if block_given? end # @param [String] server_url URL to the resource to stream. If no scheme is # given, "rtsp" is assumed. If no port is given, 554 is assumed. - # @yield [Struct::Connection, RTSP::Capturer] + # @yield [Struct::Connection, RTP::Receiver] # @yieldparam [Struct::Connection] server_url= # @yieldparam [Struct::Connection] timeout= # @yieldparam [Struct::Connection] socket= # @yieldparam [Struct::Connection] do_capture= # @yieldparam [Struct::Connection] interleave= @@ -109,11 +108,11 @@ Struct.new("Connection", :server_url, :timeout, :socket, :do_capture, :interleave) end @connection = Struct::Connection.new - @capturer = RTSP::Capturer.new + @capturer = RTP::Receiver.new yield(connection, capturer) if block_given? @connection.server_url = server_url || @connection.server_url @server_uri = build_resource_uri_from(@connection.server_url) @@ -122,10 +121,10 @@ @connection.do_capture ||= true @connection.interleave ||= false @capturer.rtp_port ||= 9000 @capturer.transport_protocol ||= :UDP @capturer.broadcast_type ||= :unicast - @capturer.rtp_file ||= Tempfile.new(DEFAULT_CAPFILE_NAME) + @capturer.rtp_file ||= Tempfile.new(RTP::Receiver::DEFAULT_CAPFILE_NAME) @play_thread = nil @cseq = 1 reset_state end