2013-06-21 23 views
0

我在Windows XP上的ruby + gstreamer中的視頻輸出有問題。視頻輸出在Windows上的ruby-mingw32 + gstreamer

在我使用「dshowvideosink」在ruby1.86(不mingw32)與gstreamer 0.1,它是單獨安裝。一切都很好。

現在我需要ruby1.9(或更高版本)和任何gstreamer。
我試過安裝ruby​​1.9.3-mingw32ruby​​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)我如何能夠從ruby-mingw32(不含gem)中單獨安裝gstreamer或其插件?

回答

0

回覆2: 對於windows,您應該使用d3dvideosink。

+0

ruby​​中默認的gstreamer中沒有這樣的元素。 –

+0

我很抱歉我一直在使用C#構建過去一個月左右,完全忘了它不在Ruby中 –

+0

值得注意的是,它在Ruby1.86中工作正常,但不起作用(「從框中」) Ruby1.93。 –