Windows XP で ruby+gstreamer のビデオ出力に問題があります。
以前は別途インストールした gstreamer 0.1 で ruby1.86 (mingw32 ではない) の" dshowvideosink " を使用していました。すべてが大丈夫だった。
ここで、ruby1.9 (またはそれ以降) と任意の gstreamer が必要です。ruby1.9.3-mingw32とruby
2.0.0-mingw32
をインストールしようとしました。
また、どちらの場合も、「gem.bat install gstreamer」コマンドを使用して gstreamer をインストールしました。
しかし、新しいバージョンの ruby+gstreamer には "dshowvideosink" がありません!!!
次の例で問題を調査します。
require 'gtk2'
require 'gst'
def os_family
case RUBY_PLATFORM
when /ix/i, /ux/i, /gnu/i, /sysv/i, /solaris/i, /sunos/i, /bsd/i
'unix'
when /win/i, /ming/i
'windows'
else
'other'
end
end
Gst.init
pipeline = Gst::Pipeline.new('pipeline1')
videosrc = Gst::ElementFactory.make('videotestsrc', 'videosrc1')
videoconvert = Gst::ElementFactory.make('autovideoconvert', 'videoconvert1')
videosink = Gst::ElementFactory.make('autovideosink', 'videosink1');
pipeline.add(videosrc, videoconvert, videosink)
videosrc >> videoconvert >> videosink
window = Gtk::Window.new('Video test')
window.signal_connect("destroy") { pipeline.stop; Gtk.main_quit }
window.set_default_size(320, 240)
window.show_all
pipeline.bus.add_watch do |bus, message|
if (message and message.structure and message.structure.name \
and (message.structure.name == 'prepare-xwindow-id'))
Gdk::Threads.synchronize do
Gdk::Display.default.sync
if not window.destroyed? and window.window
win_id = nil
if os_family=='windows'
win_id = window.window.handle
else
win_id = window.window.xid
end
imagesink = message.src
imagesink.set_property("force-aspect-ratio", true)
imagesink.set_xwindow_id(win_id)
end
end
end
true
end
pipeline.play
Gtk.main
Linux (Lubuntu) では問題なく動作しますが、Windows (XP) では動作しません!
提案してください:
1) ruby 1.9 または 2.0 で "dshowvideosink" をどのように復活させることができますか?
2) Windows で「dshowvideosink」の代わりに使用できるコンポーネントは何ですか?
3) gstreamer またはそのプラグインを ruby-mingw32 とは別に (gem なしで) [再] インストールするにはどうすればよいですか?