Repository URL to install this package:
Version:
0.6 ▾
|
lib |
README.md |
http://bitbucket.org/dmlary/ffi-hdhomerun
Ruby-FFI bindings and wrappers for libhdhomerun.
Allows the user to capture video from an HDHomeRun device within Ruby.
require 'ffi-hdhomerun'
# Dump the list of tuners on the network
HDHomeRun.discover.each do |hash|
puts "hdhomerun device %s found at %s" % [ hash[:id], hash[:ip_addr] ]
end
# Allocate a tuner
tuner = HDHomeRun::Tuner.new(:id => 'FFFFFFFF', :tuner => 0)
# Set the channel and optionally the program
tuner.channel = 20
tuner.program = 3
# Capture some data
File.open("capture.ts", "w") do |file|
puts "Capturing (^C to stop):"
tuner.capture do |buf|
file.write(buf)
STDOUT.write(buf.size > 0 ? "." : "?")
STDOUT.flush
end
end
libhdhomerun made a change to the device structure used for discovery sometime between version 20100121 and 20110323. They added a new field caller tuner_count, but the filename of the hdhomerun library was not incremented in ubuntu. As a result, on older releases such as Lucid, users of this gem will have to set FFI_HDHOMERUN_OLD_DEVICE_STRUCT in their environment to get proper results from the HDHomeRun.discover() method. This environment variable only needs to be set if you're planning on using the discovery method.
Copyright (c) 2011,2012 David M. Lary All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.