XVideo display

Using the class XVideoOutput one can display images using the Xvideo extension for 2D hardware acceleration.  This is the fastest display method supported by HornetsEye.  However there may be problems with some colourspaces on some graphic cards.  If there are problems you may try to force the YV12 colourspace (as shown in the uncommented line below) which is usually well supported.

#!/usr/bin/env ruby
require 'hornetseye'
include Hornetseye
input = XineInput.new '../../data/videos/sts-116.avi'
display = X11Display.new
output = XVideoOutput.new
window = X11Window.new display, output, input.width, input.height
window.title = 'XVideo display'
window.show
delay = input.frame_duration / 90000.0
t = Time.new.to_f
img = nil
while display.status? and input.status?
  output.write input.read
  # output.write input.read.to_yv12
  remaining = t + delay - Time.new.to_f
  display.eventLoop remaining * 1000
  t += delay
end
Output object to display images on an X-display with Xvideo extension to make use of 2D hardware acceleration.
Close