M
M
Michael Galyuk2013-06-21 00:59:07
linux
Michael Galyuk, 2013-06-21 00:59:07

GStreamer+Ruby(mingw32) bundle does not work properly on Windows

GStreamer works fine on Linux (Lubuntu), but fails on Windows (XP):

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

Tried both ruby1.9.3-mingw32 and ruby2.0.0-mingw32.
In both cases, I installed the libraries via rubygems:
gem.bat install gtk2 gstreamer
(because there is no other way to install it in mingw32)

Advise:
1) how to reanimate "dshowvideosink" in the new ruby(>=1.9)+gst(1.0) bundle?
2) what component can be used instead of "dshowvideosink" in Windows?
3) how to [re]install gstreamer (or plugins) separately from ruby ​​in case of "mingw32" variant?
4) are there now ruby ​​versions >= 1.9 not in the "mingw32" variant?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Borisovich, 2013-07-11
@Alexufo

very confused. What does not work then?) On a screw hosting is not initialized?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question