Module: Vidibus::Recording::Backend
- Defined in:
- lib/vidibus/recording/backend.rb,
lib/vidibus/recording/backend/rtmpdump.rb
Defined Under Namespace
Classes: ConfigurationError, ProtocolError, Rtmpdump, RuntimeError
Constant Summary collapse
- BACKENDS =
%w[rtmpdump]
Class Method Summary collapse
-
.load(attributes) ⇒ Object
Returns an instance of a backend processor that is able to record the given stream.
Class Method Details
.load(attributes) ⇒ Object
Returns an instance of a backend processor that is able to record the given stream.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/vidibus/recording/backend.rb', line 13 def self.load(attributes) stream = attributes[:stream] raise ConfigurationError.new("No input stream given") unless stream protocol = stream.match(/^[^:]+/).to_s raise ProtocolError.new(%(No protocol could be derived stream "#{stream}")) if protocol == '' for backend in BACKENDS backend_class = "Vidibus::Recording::Backend::#{backend.classify}".constantize if backend_class::PROTOCOLS.include?(protocol) return backend_class.new(attributes) end end raise ProtocolError.new(%(No recording backend available for "#{protocol}" protocol.)) end |