Class: Argus::TcpVideoStreamer

Inherits:
Object
  • Object
show all
Defined in:
lib/argus/tcp_video_streamer.rb

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ TcpVideoStreamer

Returns a new instance of TcpVideoStreamer.



4
5
6
7
8
# File 'lib/argus/tcp_video_streamer.rb', line 4

def initialize(opts={})
  @host = opts.fetch(:remote_host)
  @port = opts.fetch(:port, 5555)
  @tcp_socket = TCPSocket.new(@host, @port)
end

Instance Method Details

#read(n) ⇒ Object



16
17
18
# File 'lib/argus/tcp_video_streamer.rb', line 16

def read(n)
  @tcp_socket.read(n)
end

#start_stream(udp_socket = nil) ⇒ Object



10
11
12
13
14
# File 'lib/argus/tcp_video_streamer.rb', line 10

def start_stream(udp_socket=nil)
  sock = udp_socket || UDPSocket.new
  sock.send("\x01\x00\x00\x00", 0, @host, @port)
  sock.close
end