|
From: NAKAJIMA T. <nak...@ni...> - 2013-02-02 12:31:26
|
はじめまして、中島と申します。
先日ruby-listにアナウンスいただきましたRuby-GNOME2リリースの案内で
GObject Introspectionを利用したサンプル移植のお誘いを読ませていただき、
素人ながら無謀にも挑戦してみることにしました。
GStreamerのhelloworld.cからと思ったのですが、以下のコード2行目の
初期化の時点でつまづいてしまい、どなたかご助言いただければ幸いです。
テストコード(simple.rb):
require "gst-gi"
Gst.init
エラーメッセージ:
/home/nakajima/.gem/ruby/1.9.1/gems/gobject-introspection-1.2.1/lib/gobject-introspection/loader.rb:248:in
`value': undefined method `new' for NilClass:Class (NoMethodError)
from
/home/nakajima/.gem/ruby/1.9.1/gems/gobject-introspection-1.2.1/lib/gobject-introspection/loader.rb:248:in
`load_constant_info'
from
/home/nakajima/.gem/ruby/1.9.1/gems/gobject-introspection-1.2.1/lib/gobject-introspection/loader.rb:60:in
`load_info'
from
/home/nakajima/.gem/ruby/1.9.1/gems/gobject-introspection-1.2.1/lib/gobject-introspection/loader.rb:35:in
`block in load'
from
/home/nakajima/.gem/ruby/1.9.1/gems/gobject-introspection-1.2.1/lib/gobject-introspection/repository.rb:27:in
`block (2 levels) in each'
from
/home/nakajima/.gem/ruby/1.9.1/gems/gobject-introspection-1.2.1/lib/gobject-introspection/repository.rb:26:in
`times'
from
/home/nakajima/.gem/ruby/1.9.1/gems/gobject-introspection-1.2.1/lib/gobject-introspection/repository.rb:26:in
`block in each'
from
/home/nakajima/.gem/ruby/1.9.1/gems/gobject-introspection-1.2.1/lib/gobject-introspection/repository.rb:25:in
`each'
from
/home/nakajima/.gem/ruby/1.9.1/gems/gobject-introspection-1.2.1/lib/gobject-introspection/repository.rb:25:in
`each'
from
/home/nakajima/.gem/ruby/1.9.1/gems/gobject-introspection-1.2.1/lib/gobject-introspection/loader.rb:34:in
`load'
from
/home/nakajima/Projects/ruby/gtk/ruby-gnome2/gstreamer/sample/gst-gi.rb:34:in
`init'
from simple.rb:2:in `<main>'
環境:
OS: Fedora 18
Ruby: ruby 1.9.3p374 (2013-01-15 revision 38858) [x86_64-linux]
GStreamer(RPM): gstreamer1-devel-1.0.5-1.fc18.x86_64
Gem version:
gobject-introspection (1.2.1, 1.2.0)
gtk2 (1.2.1, 1.2.0)
Ruby-GNOME2ソース: (1/27にgit clone)
やったこと:
(1)Ruby側
原因が環境なのかコードなのかわかりませんが、例外が起きている場所が
gobject-introspectionのloader.loadなので、gst-gi.rbにloadメソッドを
コピーして、repositoryの列挙ループの挙動を見たところ、8番目にある
info.nameがBUFFER_COPY_ALLというところで落ちているようです。
この箇所のgirファイル(Gst-1.0.gir)は、以下のようなものでした。
<constant name="BUFFER_COPY_ALL" value="0" c:type="GST_BUFFER_COPY_ALL">
<type name="BufferCopyFlags" c:type="GstBufferCopyFlags"/>
</constant>
(2)C側
ライブラリ側のソースを追いかけながら、見よう見まねで別にCコードを
書いてrepositoryを叩いてみたところ、上記BUFFER_COPY_ALLのデータは
以下のように見えました。
1)列挙したGIBaseInfoをg_base_info_get_typeでGIInfoTypeを取ると
GI_INFO_TYPE_CONSTANT。
2)そこからg_constant_info_get_typeでGITypeInfoを取ると
GI_TYPE_TAG_INTERFACE。
3)GITypeInfoからg_type_info_get_interfaceでGIBaseInfoを取り、
さらにg_base_info_get_typeでGIInfoTypeを取ると
GI_INFO_TYPE_FLAGS。
Rubyクラスを作るところまで追いたかったのですが、迷ってしまい
力尽きました...
|