/usr/share/doc/ruby-sdl/examples/plaympeg.rb is in ruby-sdl 2.2.0-1build2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | # This sample needs a MPEG file `sample.mpg'.
require 'sdl'
SDL.init( SDL::INIT_VIDEO|SDL::INIT_AUDIO )
SDL::Mixer.open
screen = SDL::Screen.open( 320, 240, 16, SDL::SWSURFACE )
mpeg = SDL::MPEG.load( 'sample.mpg' )
info = mpeg.info
p(info)
mpeg.enable_audio true
mpeg.enable_video true
mpeg.set_display(screen)
mpeg.set_display_region( 0, 0, screen.w, screen.h )
mpeg.play
loop do
case event = SDL::Event.poll
when SDL::Event::Quit
mpeg.stop
exit
when SDL::Event::KeyDown
case event.sym
when SDL::Key::S
mpeg.stop
when SDL::Key::P
mpeg.play
when SDL::Key::R
mpeg.rewind
mpeg.play
when SDL::Key::ESCAPE
exit
end
end
sleep 0.1
end
|