bin/rtsp_client in rtsp-0.4.4 vs bin/rtsp_client in rtsp-0.4.5

- old
+ new

@@ -1,10 +1,11 @@ #!/usr/bin/env ruby require 'tempfile' require 'optparse' require 'rtsp/client' +require 'rtp/receiver' optparse = OptionParser.new do |opts| opts.banner = "Usage: #{__FILE__} [options] url" #---------------------------------------------------------------------------- @@ -61,18 +62,17 @@ if url.nil? puts "Must pass in a URL." exit end - rtsp_client = RTSP::Client.new(url) do |_, capturer| - capturer.capture_file = File.open("#{Dir.pwd}/rtsp_client_stream.rtp", "wb") - end + rtsp_client = RTSP::Client.new(url) + rtsp_client.capturer = RTP::Receiver.new(capture_file: + File.open("#{Dir.pwd}/rtsp_client_stream.rtp", "wb")) begin puts "Getting server options..." response = rtsp_client.options - puts "\tServer: #{response.server}" puts "\tSupported methods: #{response.public}" puts "" puts "Getting description..." response = rtsp_client.describe @@ -102,13 +102,13 @@ print "." sleep 1 end puts "" - if rtsp_client.capturer.rtp_file.size.zero? + if rtsp_client.capturer.capture_file.size.zero? puts "Captured 0 bytes. Your firewall might be blocking the RTP traffic on port #{rtsp_client.capturer.rtp_port}." else - puts "RTP data captured to file: #{rtsp_client.capturer.rtp_file}" + puts "RTP data captured to file: #{rtsp_client.capturer.capture_file.path}" end puts "Tearing down..." r2 = rtsp_client.teardown(rtsp_client.aggregate_control_track) puts "\tconnection: #{r2.connection}" if r2.respond_to? "connection"