gstreamer 2.0.2 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e5dae1b600eb1d4da52276edffbab5f5d966e1ed
4
+ data.tar.gz: 469806a880b450c82d5e264998a19539e7f934e1
5
+ SHA512:
6
+ metadata.gz: 79720374491dd9b9d8cb060bef7fe151bdb35ed26aa1e5ad3b7d83496d73b1a4a8dfe56975570085359738c233e23f105688de9e37e767234ad2ce5ace44f248
7
+ data.tar.gz: ac541135ebc128862565a6ee50ca106f4150c66526bbee3b490f194908cebf6fe931c27fa638a2d41fd6c7a470a9e544c27e7e5cc68716e00b942f0ea19f303f
data/Rakefile CHANGED
@@ -7,8 +7,8 @@ package = GNOME2Package.new do |_package|
7
7
  _package.summary = "Ruby/GStreamer is a Ruby binding for GStreamer."
8
8
  _package.description = "Ruby/GStreamer is a Ruby binding for GStreamer."
9
9
  _package.dependency.gem.runtime = ["glib2", "gobject-introspection"]
10
- _package.win32.packages = ["libsoup"]
11
- _package.win32.dependencies = ["jpeg", "libxml2"]
10
+ _package.win32.packages = []
11
+ _package.win32.dependencies = []
12
12
  _package.win32.build_dependencies = [
13
13
  "glib2", "atk", "pango", "gdk_pixbuf2", "gtk2", "gobject-introspection",
14
14
  ]
@@ -17,22 +17,61 @@ package = GNOME2Package.new do |_package|
17
17
  sf_net_download_url_base = "http://downloads.sourceforge.net/project"
18
18
  libmad_version = "0.15.1b"
19
19
  _package.external_packages = [
20
+ {
21
+ :name => "libjpeg",
22
+ :base_name => "jpeg-9",
23
+ :archive_base_name => "jpegsrc.v9.tar.gz",
24
+ :download_base_url => "http://www.ijg.org/files",
25
+ :label => "libjpeg",
26
+ :windows => {
27
+ :configure_args => [],
28
+ :built_file => "bin/libjpeg-9.dll",
29
+ },
30
+ },
31
+ {
32
+ :name => "sqlite-autoconf",
33
+ :download_base_url => "http://www.sqlite.org/2013",
34
+ :label => "SQLite",
35
+ :version => "3080200",
36
+ :compression_method => "gz",
37
+ :windows => {
38
+ :configure_args => [],
39
+ :built_file => "bin/libsqlite3-0.dll",
40
+ },
41
+ },
42
+ {
43
+ :name => "libsoup",
44
+ :download_site => :gnome,
45
+ :label => "libsoup",
46
+ :version => "2.45.3",
47
+ :compression_method => "xz",
48
+ :windows => {
49
+ :configure_args => [
50
+ "--enable-introspection",
51
+ "--without-apache-httpd",
52
+ ],
53
+ :build_concurrently => false,
54
+ :built_file => "bin/libsoup-2.4-1.dll",
55
+ },
56
+ },
20
57
  {
21
58
  :name => "libogg",
22
59
  :download_base_url => "#{xiph_download_url_base}/ogg",
23
60
  :label => "Ogg",
24
- :version => "1.3.0",
61
+ :version => "1.3.1",
25
62
  :windows => {
26
63
  :configure_args => [],
64
+ :built_file => "bin/libogg-0.dll",
27
65
  },
28
66
  },
29
67
  {
30
68
  :name => "libvorbis",
31
69
  :download_base_url => "#{xiph_download_url_base}/vorbis",
32
70
  :label => "Vorbis",
33
- :version => "1.3.2",
71
+ :version => "1.3.3",
34
72
  :windows => {
35
73
  :configure_args => [],
74
+ :built_file => "bin/libvorbis-0.dll",
36
75
  },
37
76
  },
38
77
  {
@@ -45,6 +84,10 @@ package = GNOME2Package.new do |_package|
45
84
  "--disable-examples"
46
85
  ],
47
86
  :build_concurrently => false,
87
+ :patches => [
88
+ "libtheora-1.1.1-use-lf-in-def.diff",
89
+ ],
90
+ :built_file => "bin/libtheora-0.dll",
48
91
  },
49
92
  },
50
93
  # {
@@ -62,14 +105,11 @@ package = GNOME2Package.new do |_package|
62
105
  :name => "flac",
63
106
  :download_base_url => "#{xiph_download_url_base}/flac",
64
107
  :label => "FLAC",
65
- :version => "1.2.1",
108
+ :version => "1.3.0",
109
+ :compression_method => "xz",
66
110
  :windows => {
67
111
  :configure_args => ["--disable-cpplibs"],
68
- :need_autogen => true,
69
- :patches => [
70
- "flac-1.2.1-fix-mingw-build.diff",
71
- # "flac-1.2.1-fix-doc-install.diff",
72
- ],
112
+ :built_file => "bin/libFLAC-8.dll",
73
113
  },
74
114
  },
75
115
  {
@@ -79,13 +119,14 @@ package = GNOME2Package.new do |_package|
79
119
  :version => "1.2rc1",
80
120
  :windows => {
81
121
  :configure_args => [],
122
+ :built_file => "bin/libspeex-1.dll",
82
123
  },
83
124
  },
84
125
  {
85
126
  :name => "gstreamer",
86
127
  :download_base_url => "#{freedesktop_download_url_base}/gstreamer",
87
128
  :label => "GStreamer",
88
- :version => "1.0.7",
129
+ :version => "1.2.1",
89
130
  :compression_method => "xz",
90
131
  :windows => {
91
132
  :configure_args => [
@@ -93,48 +134,55 @@ package = GNOME2Package.new do |_package|
93
134
  "--enable-introspection",
94
135
  ],
95
136
  :build_concurrently => false,
137
+ :built_file => "bin/libgstreamer-1.0-0.dll",
96
138
  },
97
139
  },
98
140
  {
99
141
  :name => "gst-plugins-base",
100
142
  :download_base_url => "#{freedesktop_download_url_base}/gst-plugins-base",
101
143
  :label => "GStreamer plugins (base)",
102
- :version => "1.0.7",
144
+ :version => "1.2.1",
103
145
  :compression_method => "xz",
104
146
  :windows => {
105
147
  :configure_args => [
106
148
  "--enable-introspection",
107
149
  ],
108
150
  :build_concurrently => false,
151
+ :built_file => "lib/gstreamer-1.0/libgstgio.dll",
109
152
  },
110
153
  },
111
154
  {
112
155
  :name => "gst-plugins-good",
113
156
  :download_base_url => "#{freedesktop_download_url_base}/gst-plugins-good",
114
157
  :label => "GStreamer plugins (good)",
115
- :version => "1.0.7",
158
+ :version => "1.2.1",
116
159
  :compression_method => "xz",
117
160
  :windows => {
118
161
  :configure_args => [
119
162
  "--disable-shout2",
120
163
  ],
164
+ :built_file => "lib/gstreamer-1.0/libgstcairo.dll",
121
165
  },
122
166
  },
123
167
  {
124
168
  :name => "gst-plugins-bad",
125
169
  :download_base_url => "#{freedesktop_download_url_base}/gst-plugins-bad",
126
170
  :label => "GStreamer plugins (bad)",
127
- :version => "1.0.7",
171
+ :version => "1.2.1",
128
172
  :compression_method => "xz",
129
173
  :windows => {
130
174
  :configure_args => ["--disable-librfb"],
175
+ :cc_args => [
176
+ "-std=c99",
177
+ ],
178
+ :built_file => "lib/gstreamer-1.0/libgstfaac.dll",
131
179
  },
132
180
  },
133
181
  # {
134
182
  # :name => "gst-plugins-ugly",
135
183
  # :download_base_url => "#{freedesktop_download_url_base}/gst-plugins-ugly",
136
184
  # :label => "GStreamer plugins (ugly)",
137
- # :version => "1.0.7",
185
+ # :version => "1.2.1",
138
186
  # :compression_method => "xz",
139
187
  # :windows => {
140
188
  # :configure_args => [],
@@ -144,23 +192,31 @@ package = GNOME2Package.new do |_package|
144
192
  :name => "gst-libav",
145
193
  :download_base_url => "#{freedesktop_download_url_base}/gst-libav",
146
194
  :label => "GStreamer libav",
147
- :version => "1.0.7",
195
+ :version => "1.2.1",
148
196
  :compression_method => "xz",
149
197
  :windows => {
150
- :configure_args => ["--with-libav-extra-configure=" +
151
- "--cross-prefix=#{_package.win32.build_host}- " +
152
- "--target-os=mingw32 " +
153
- "--arch=i686 " +
154
- "--pkg-config=pkg-config " +
155
- "--disable-gpl"],
198
+ :configure_args => [
199
+ "--with-libav-extra-configure=" +
200
+ "--cross-prefix=#{_package.win32.build_host}- " +
201
+ "--target-os=mingw32 " +
202
+ "--arch=i686 " +
203
+ "--pkg-config=pkg-config " +
204
+ "--disable-gpl",
205
+ ],
206
+ :built_file => "lib/gstreamer-1.0/libgstlibav.dll",
156
207
  },
157
208
  :bundled_packages => [
158
209
  {
159
210
  :name => "libav",
160
211
  :path => "gst-libs/ext/libav",
161
- :license_files => ["LICENSE", "CREDITS",
162
- "COPYING.GPLv2", "COPYING.GPLv3",
163
- "COPYING.LGPLv2.1", "COPYING.LGPLv3"],
212
+ :license_files => [
213
+ "LICENSE",
214
+ "CREDITS",
215
+ "COPYING.GPLv2",
216
+ "COPYING.GPLv3",
217
+ "COPYING.LGPLv2.1",
218
+ "COPYING.LGPLv3",
219
+ ],
164
220
  }
165
221
  ],
166
222
  },
@@ -0,0 +1,61 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2013 Ruby-GNOME2 Project Team
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this library; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
+ * MA 02110-1301 USA
19
+ */
20
+
21
+ #include "rbgst.h"
22
+
23
+ #define RG_TARGET_NAMESPACE cElementFactory
24
+
25
+ #define SELF(object) (GST_ELEMENT_FACTORY(RVAL2GOBJ(object)))
26
+
27
+ static VALUE cStaticPadTemplate;
28
+
29
+ static VALUE
30
+ rg_static_pad_templates(VALUE self)
31
+ {
32
+ GstElementFactory *factory = SELF(self);
33
+ const GList *templates;
34
+ VALUE rb_templates;
35
+
36
+ rb_templates = rb_ary_new();
37
+ templates = gst_element_factory_get_static_pad_templates(factory);
38
+ for (; templates; templates = g_list_next(templates)) {
39
+ GstStaticPadTemplate *template = templates->data;
40
+ VALUE rb_template;
41
+ rb_template = rb_funcall(cStaticPadTemplate, rb_intern("new"), 0);
42
+ memcpy(DATA_PTR(rb_template), template, sizeof(GstStaticPadTemplate));
43
+ rb_ary_push(rb_templates, rb_template);
44
+ }
45
+
46
+ return rb_templates;
47
+ }
48
+
49
+ void
50
+ rb_gst_init_element_factory(void)
51
+ {
52
+ VALUE mGst;
53
+ VALUE RG_TARGET_NAMESPACE;
54
+
55
+ mGst = rb_const_get(rb_cObject, rb_intern("Gst"));
56
+ RG_TARGET_NAMESPACE = rb_const_get(mGst, rb_intern("ElementFactory"));
57
+ cStaticPadTemplate = rb_const_get(mGst, rb_intern("StaticPadTemplate"));
58
+
59
+ rb_remove_method(RG_TARGET_NAMESPACE, "static_pad_templates");
60
+ RG_DEF_METHOD(static_pad_templates, 0);
61
+ }
@@ -18,11 +18,7 @@
18
18
  * MA 02110-1301 USA
19
19
  */
20
20
 
21
- #include <gst/gst.h>
22
-
23
- #include <rb-gobject-introspection.h>
24
-
25
- extern void Init_gstreamer (void);
21
+ #include "rbgst.h"
26
22
 
27
23
  static gboolean
28
24
  name_equal(GIArgInfo *info, const gchar *target_name)
@@ -130,10 +126,59 @@ rg_gst_tag_foreach_func_callback_finder(GIArgInfo *info)
130
126
  return rg_gst_tag_foreach_func_callback;
131
127
  }
132
128
 
129
+ static void
130
+ rg_gst_value_list_r2g(VALUE from, GValue *to)
131
+ {
132
+ int i, n;
133
+
134
+ if (NIL_P(from)) {
135
+ return;
136
+ }
137
+
138
+ from = rbg_to_array(from);
139
+ n = RARRAY_LEN(from);
140
+ for (i = 0; i < n; i++) {
141
+ VALUE rb_element;
142
+ const RGObjClassInfo *class_info;
143
+ GValue element = G_VALUE_INIT;
144
+
145
+ rb_element = rb_ary_entry(from, i);
146
+ class_info = RVAL2CINFO(rb_element);
147
+ g_value_init(&element, class_info->gtype);
148
+ rbgobj_rvalue_to_gvalue(rb_element, &element);
149
+ gst_value_list_append_value(to, &element);
150
+ }
151
+ }
152
+
153
+ static VALUE
154
+ rg_gst_value_list_g2r(const GValue *from)
155
+ {
156
+ guint i, n;
157
+ VALUE rb_values;
158
+
159
+ n = gst_value_list_get_size(from);
160
+ rb_values = rb_ary_new();
161
+ for (i = 0; i < n; i++) {
162
+ const GValue *value;
163
+ VALUE rb_value;
164
+
165
+ value = gst_value_list_get_value(from, i);
166
+ rb_value = rbgobj_gvalue_to_rvalue(value);
167
+ rb_ary_push(rb_values, rb_value);
168
+ }
169
+
170
+ return rb_values;
171
+ }
172
+
133
173
  void
134
174
  Init_gstreamer (void)
135
175
  {
136
176
  rb_gi_callback_register_finder(rg_gst_bus_func_callback_finder);
137
177
  rb_gi_callback_register_finder(rg_gst_bus_sync_handler_callback_finder);
138
178
  rb_gi_callback_register_finder(rg_gst_tag_foreach_func_callback_finder);
179
+
180
+ rbgobj_register_r2g_func(GST_TYPE_LIST, rg_gst_value_list_r2g);
181
+ rbgobj_register_g2r_func(GST_TYPE_LIST, rg_gst_value_list_g2r);
182
+
183
+ rb_gst_init_element_factory();
139
184
  }
@@ -0,0 +1,26 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2013 Ruby-GNOME2 Project Team
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this library; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
+ * MA 02110-1301 USA
19
+ */
20
+
21
+ #include <gst/gst.h>
22
+
23
+ #include <rb-gobject-introspection.h>
24
+
25
+ extern void Init_gstreamer (void);
26
+ G_GNUC_INTERNAL extern void rb_gst_init_element_factory (void);
data/lib/gst.rb CHANGED
@@ -14,6 +14,8 @@
14
14
  # License along with this library; if not, write to the Free Software
15
15
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
+ require "English"
18
+
17
19
  require "gobject-introspection"
18
20
 
19
21
  base_dir = Pathname.new(__FILE__).dirname.dirname.expand_path
@@ -43,29 +45,44 @@ module Gst
43
45
  end
44
46
  end
45
47
 
48
+ def method_missing(name, *args, &block)
49
+ init()
50
+ if respond_to?(name)
51
+ __send__(name, *args, &block)
52
+ else
53
+ super
54
+ end
55
+ end
56
+
46
57
  def init(*argv)
47
58
  loader = Loader.new(self, argv)
48
59
  loader.load("Gst")
49
60
  require "gst/bin"
50
61
  require "gst/bus"
62
+ require "gst/caps"
51
63
  require "gst/element"
64
+ require "gst/element-factory"
65
+ require "gst/plugin-feature"
66
+ require "gst/registry"
67
+ require "gst/structure"
52
68
  init_base
53
69
  init_controller
54
70
  class << self
55
71
  remove_method(:init)
56
72
  remove_method(:const_missing)
73
+ remove_method(:method_missing)
57
74
  end
58
75
  end
59
76
 
60
77
  private
61
78
  def init_base
62
- require "gst/base_loader"
79
+ require "gst/base-loader"
63
80
  base_loader = BaseLoader.new(self)
64
81
  base_loader.load("GstBase")
65
82
  end
66
83
 
67
84
  def init_controller
68
- require "gst/controller_loader"
85
+ require "gst/controller-loader"
69
86
  controller_loader = ControllerLoader.new(self)
70
87
  controller_loader.load("GstController")
71
88
  end
@@ -79,16 +96,28 @@ module Gst
79
96
 
80
97
  private
81
98
  def pre_load(repository, namespace)
99
+ call_init_function(repository, namespace)
100
+ define_value_modules
101
+ end
102
+
103
+ def call_init_function(repository, namespace)
82
104
  init_check = repository.find(namespace, "init_check")
83
105
  arguments = [
84
106
  1 + @init_arguments.size,
85
107
  [$0] + @init_arguments,
86
108
  ]
87
- succeeded, argc, argv, error = init_check.invoke(arguments)
109
+ succeeded, argc, argv, error = init_check.invoke(:arguments => arguments)
88
110
  @init_arguments.replace(argv[1..-1])
89
111
  raise error unless succeeded
90
112
  end
91
113
 
114
+ def define_value_modules
115
+ @value_functions_module = Module.new
116
+ @value_methods_module = Module.new
117
+ @base_module.const_set("ValueFunctions", @value_functions_module)
118
+ @base_module.const_set("ValueMethods", @value_methods_module)
119
+ end
120
+
92
121
  def post_load(repository, namespace)
93
122
  require_extension
94
123
  self.class.start_callback_dispatch_thread
@@ -104,8 +133,25 @@ module Gst
104
133
  end
105
134
 
106
135
  def load_function_info(info)
107
- return if info.name == "init"
108
- super
136
+ case info.name
137
+ when "init"
138
+ # ignore
139
+ when /\Avalue_/
140
+ method_name = $POSTMATCH
141
+ load_value_function_info(info, method_name)
142
+ else
143
+ super
144
+ end
145
+ end
146
+
147
+ def load_value_function_info(info, method_name)
148
+ value_functions_module = @value_functions_module
149
+ define_module_function(value_functions_module, method_name, info)
150
+ @value_methods_module.module_eval do
151
+ define_method(method_name) do |*arguments, &block|
152
+ value_functions_module.send(method_name, self, *arguments, &block)
153
+ end
154
+ end
109
155
  end
110
156
 
111
157
  RENAME_MAP = {
@@ -0,0 +1,25 @@
1
+ # Copyright (C) 2013 Ruby-GNOME2 Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ module Gst
18
+ class Caps
19
+ def structures
20
+ size.times.collect do |i|
21
+ get_structure(i)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,35 @@
1
+ # Copyright (C) 2013 Ruby-GNOME2 Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ module Gst
18
+ class ElementFactory
19
+ def long_name
20
+ get_metadata("long-name")
21
+ end
22
+
23
+ def klass
24
+ get_metadata("klass")
25
+ end
26
+
27
+ def description
28
+ get_metadata("description")
29
+ end
30
+
31
+ def author
32
+ get_metadata("author")
33
+ end
34
+ end
35
+ end
@@ -44,5 +44,10 @@ module Gst
44
44
  link_element(element)
45
45
  element
46
46
  end
47
+
48
+ alias_method :flags_raw, :flags
49
+ def flags
50
+ ElementFlags.new(flags_raw)
51
+ end
47
52
  end
48
53
  end
@@ -0,0 +1,24 @@
1
+ # Copyright (C) 2013 Ruby-GNOME2 Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ module Gst
18
+ class PluginFeature
19
+ alias_method :rank_raw, :rank
20
+ def rank
21
+ Rank.new(rank_raw)
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,30 @@
1
+ # Copyright (C) 2013 Ruby-GNOME2 Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ module Gst
18
+ class Registry
19
+ alias_method :plugins, :plugin_list
20
+ def get_features(name_or_type)
21
+ if name_or_type.is_a?(GLib::Type)
22
+ type = name_or_type
23
+ get_feature_list(type)
24
+ else
25
+ name = name_or_type
26
+ get_feature_list_by_plugin(name)
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,28 @@
1
+ # Copyright (C) 2013 Ruby-GNOME2 Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ module Gst
18
+ class Structure
19
+ def fields
20
+ n_fields.times.collect do |i|
21
+ field_name = nth_field_name(i)
22
+ value = get_value(field_name)
23
+ value.extend(ValueMethods)
24
+ [field_name, value]
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,478 @@
1
+ #!/usr/bin/evn ruby
2
+ #
3
+ # This sample code is a port of gstreamer/tools/gst-inspect.c. It is
4
+ # licensed under the terms of the GNU Library General Public License,
5
+ # version 2 or (at your option) later.
6
+ #
7
+ # The followin is the original code's copyright notation:
8
+ # Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
9
+ # 2000 Wim Taymans <wtay@chello.be>
10
+ # 2004 Thomas Vander Stichele <thomas@apestaart.org>
11
+ #
12
+ #
13
+ # Copyright (C) 2013 Ruby-GNOME2 Project Team
14
+ #
15
+ # This library is free software; you can redistribute it and/or
16
+ # modify it under the terms of the GNU Lesser General Public
17
+ # License as published by the Free Software Foundation; either
18
+ # version 2.1 of the License, or (at your option) any later version.
19
+ #
20
+ # This library is distributed in the hope that it will be useful,
21
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23
+ # Lesser General Public License for more details.
24
+ #
25
+ # You should have received a copy of the GNU Lesser General Public
26
+ # License along with this library; if not, write to the Free Software
27
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
28
+
29
+ require "optparse"
30
+ require "ostruct"
31
+
32
+ require "gst"
33
+
34
+ def parse(argv)
35
+ options = OpenStruct.new
36
+ options.print_all = false
37
+ options.print_auto_install_info = false
38
+
39
+ opts = OptionParser.new do |opts|
40
+ opts.banner += " [ELEMENT-NAME|PLUGIN-NAME]"
41
+
42
+ opts.version = Gst.version
43
+
44
+ opts.separator("")
45
+ opts.on("-a", "--print-all", "Print all elements") do
46
+ options.print_all = true
47
+ end
48
+
49
+ opts.on("--print-plugin-auto-install-info",
50
+ "Print a machine-parsable list of features",
51
+ "the specified plugin provides.",
52
+ "Useful in connection with external",
53
+ "automatic plugin installation mechanisms") do
54
+ options.print_auto_install_info = true
55
+ end
56
+ end
57
+ opts.parse!(argv)
58
+
59
+ [options, argv.first]
60
+ end
61
+
62
+ class Inspector
63
+ def initialize
64
+ @prefix = ""
65
+ end
66
+
67
+ def print_list(print_all)
68
+ plugins = {}
69
+ n_features = 0
70
+ each_feature do |plugin, feature|
71
+ plugins[plugin.name] = nil
72
+ n_features += 1
73
+ if print_all
74
+ if feature.is_a?(Gst::ElementFactory)
75
+ print_element_factory(feature, true)
76
+ end
77
+ else
78
+ print_feature(plugin, feature)
79
+ end
80
+ end
81
+ puts
82
+ puts("Total count: #{plugins.size} plugins, #{n_features} features")
83
+ end
84
+
85
+ def print_element(name)
86
+ factory = Gst::ElementFactory.find(name)
87
+ print_element_factory(factory, false)
88
+ end
89
+
90
+ private
91
+ def puts(*args)
92
+ if args.empty?
93
+ super(@prefix)
94
+ else
95
+ super(*(args.collect {|arg| "#{@prefix}#{arg}"}))
96
+ end
97
+ end
98
+
99
+ def prefix(new_prefix)
100
+ prefix, @prefix = @prefix, new_prefix
101
+ yield
102
+ ensure
103
+ @prefix = prefix
104
+ end
105
+
106
+ def each_feature
107
+ registry = Gst::Registry.get
108
+ registry.plugins.sort_by {|plugin| plugin.name}.each do |plugin|
109
+ features = registry.get_features(plugin.name)
110
+ features.sort_by {|feature| feature.name}.each do |feature|
111
+ yield(plugin, feature)
112
+ end
113
+ end
114
+ end
115
+
116
+ def print_factory_details_info(factory)
117
+ puts("Factory Details:",
118
+ " Rank:\t\t#{factory.rank.nick} (#{factory.rank.to_i})",
119
+ " Long name:\t#{factory.long_name}",
120
+ " Class:\t#{factory.klass}",
121
+ " Description:\t#{factory.description}",
122
+ " Author(s):\t#{factory.author}",
123
+ "")
124
+ end
125
+
126
+ def print_plugin_info(name)
127
+ return if name.nil?
128
+ registry = Gst::Registry.get
129
+ plugin = registry.find_plugin(name)
130
+ return if plugin.nil?
131
+
132
+ puts("Plugin Details:",
133
+ " Name:\t\t\t#{plugin.name}",
134
+ " Description:\t\t#{plugin.description}",
135
+ " Filename:\t\t#{plugin.filename || '(null)'}",
136
+ " Version:\t\t#{plugin.version}",
137
+ " License:\t\t#{plugin.license}",
138
+ " Source module:\t#{plugin.source}")
139
+ release_date = plugin.release_date_string
140
+ if release_date
141
+ puts(" Source release date:\t#{release_date}")
142
+ end
143
+ puts(" Binary package:\t#{plugin.package}",
144
+ " Origin URL:\t\t#{plugin.origin}",
145
+ "")
146
+ end
147
+
148
+ def print_hierarchy(element)
149
+ ancestors = []
150
+ type = element.gtype
151
+ while type
152
+ ancestors << type
153
+ type = type.parent
154
+ end
155
+ ancestors.reverse.each_with_index do |klass, i|
156
+ if i.zero?
157
+ mark = ""
158
+ else
159
+ mark = " " + (" " * (i - 1)) + "+----"
160
+ end
161
+ puts("#{mark}#{klass.name}")
162
+ end
163
+ puts
164
+ end
165
+
166
+ def print_interfaces(element)
167
+ interfaces = element.gtype.interfaces
168
+ return if interfaces.empty?
169
+
170
+ puts("Implemented Interfaces:")
171
+ interfaces.each do |interface|
172
+ puts(" #{interface.name}")
173
+ end
174
+ puts
175
+ end
176
+
177
+ def print_caps(caps)
178
+ if caps.any?
179
+ puts("ANY")
180
+ return
181
+ end
182
+ if caps.empty?
183
+ puts("EMPTY")
184
+ return
185
+ end
186
+
187
+ caps.structures.each do |structure|
188
+ puts(structure.name)
189
+ structure.fields.each do |name, value|
190
+ puts(" %15s: %s" % [name, value.serialize])
191
+ end
192
+ end
193
+ end
194
+
195
+ def print_pad_template_info(template)
196
+ prefix("#{@prefix} ") do
197
+ puts("#{template.direction.nick.upcase} template: '#{template.name_template}'")
198
+ prefix("#{@prefix} ") do
199
+ if template.presence == Gst::PadPresence::REQUEST
200
+ puts("Availability: On request")
201
+ else
202
+ puts("Availability: #{template.presence.nick.capitalize}")
203
+ end
204
+ end
205
+ end
206
+
207
+ caps = template.caps
208
+ return if caps.nil?
209
+ prefix("#{@prefix} ") do
210
+ puts("Capabilities:")
211
+ prefix("#{@prefix} ") do
212
+ print_caps(caps)
213
+ end
214
+ end
215
+ puts
216
+ end
217
+
218
+ def print_pad_templates_info(element, factory)
219
+ puts("Pad Templates:")
220
+ templates = factory.static_pad_templates
221
+
222
+ if templates.empty?
223
+ puts(" none")
224
+ return
225
+ end
226
+
227
+ templates.each do |template|
228
+ print_pad_template_info(template)
229
+ end
230
+ end
231
+
232
+ def print_element_flag_info(element)
233
+ puts("Element Flags:")
234
+ puts(" no flags set")
235
+ puts
236
+
237
+ return unless element.is_a?(Gst::Bin)
238
+ puts("Bin Flags:")
239
+ puts(" no flags set")
240
+ puts
241
+ end
242
+
243
+ def print_implementation_info(element)
244
+ puts("Element Implementation:")
245
+ puts(" not supported")
246
+ puts
247
+ end
248
+
249
+ def print_clocking_info(element)
250
+ if !element.flags.require_clock? and
251
+ !element.flags.provide_clock? and
252
+ element.clock.nil?
253
+ puts("Element has no clocking capabilities.")
254
+ return
255
+ end
256
+
257
+ puts("Clocking Interaction:")
258
+ puts(" element requires a clock") if element.flags.require_clock?
259
+ if element.flags.provide_clock?
260
+ clock = element.clock
261
+ if clock.nil?
262
+ puts(" element is supported tot provide a clock but returned nil")
263
+ else
264
+ puts(" element provides a clock: #{clock.name}")
265
+ end
266
+ end
267
+ puts
268
+ end
269
+
270
+ def print_index_info(element)
271
+ if element.flags.indexable?
272
+ puts("Indexing capabilities:")
273
+ puts(" element can do indexing")
274
+ else
275
+ puts("Element has no indexing capabilities.")
276
+ end
277
+ puts
278
+ end
279
+
280
+ def uri_type(element)
281
+ case element.uri_type
282
+ when Gst::URIType::SRC
283
+ "source"
284
+ when Gst::URIType::SINK
285
+ "sink"
286
+ else
287
+ "unknown"
288
+ end
289
+ end
290
+
291
+ def print_uri_handler_info(element)
292
+ if element.is_a?(Gst::URIHandler)
293
+ puts("URI handling capabilities:")
294
+ puts(" Element can act as #{uri_type(element)}.")
295
+ protocols = element.protocols
296
+ if protocols.empty?
297
+ puts(" No supported URI protocols")
298
+ else
299
+ puts(" Supported URI protocols:")
300
+ protocols.each do |protocol|
301
+ puts(" #{protocol}")
302
+ end
303
+ end
304
+ else
305
+ puts("Element has no URI handling capabilities.")
306
+ end
307
+ puts
308
+ end
309
+
310
+ def print_pad_info(element)
311
+ puts("Pads:")
312
+ pads = element.pads
313
+ if pads.empty?
314
+ puts(" none")
315
+ return
316
+ end
317
+
318
+ pads.each do |pad|
319
+ prefix("#{@prefix} ") do
320
+ puts("#{pad.direction.nick.upcase}: '#{pad.name}'")
321
+ prefix("#{@prefix} ") do
322
+ template = pad.template
323
+ puts("Pad Template: '#{template.name}'") if template
324
+
325
+ caps = pad.caps
326
+ break if caps.nil?
327
+ puts("Capabilities:")
328
+ prefix("#{@prefix} ") do
329
+ print_caps(caps)
330
+ end
331
+ end
332
+ end
333
+ end
334
+ puts
335
+ end
336
+
337
+ def print_element_properties_info(element)
338
+ puts("Element Properties:")
339
+ properties = element.class.properties
340
+ if properties.empty?
341
+ puts(" none")
342
+ return
343
+ end
344
+
345
+ properties.each do |name|
346
+ param = element.class.property(name)
347
+ puts(" %-20s: %s" % [param.name, param.blurb])
348
+
349
+ flags = []
350
+ flags << "readable" if param.readable?
351
+ flags << "writable" if param.writable?
352
+ # flags << "controllable" if param.controllable?
353
+
354
+ prefix("#{@prefix}#{' ' * 23} ") do
355
+ puts("flags: #{flags.join(', ')}")
356
+ description = ""
357
+ type_name = param.value_type.name
358
+ description << "#{type_name}."
359
+ if param.readable?
360
+ case param.gtype
361
+ when GLib::Type["GParamObject"]
362
+ # do nothing
363
+ else
364
+ default_value = element.get_property(name)
365
+ description << " Default: #{default_value.inspect}"
366
+ end
367
+ else
368
+ description << " Write only"
369
+ end
370
+ puts(description)
371
+ end
372
+ end
373
+ puts
374
+ end
375
+
376
+ def print_signal_info(element, signal)
377
+ args = ["object(#{element.class})"]
378
+ signal.param_types.each_with_index do |name, i|
379
+ args << "arg#{i}(#{name})"
380
+ end
381
+ args = args.join(", ")
382
+ signature = "{|#{args}| ...} # => #{signal.return_type}"
383
+ puts(" #{signal.name.inspect}: #{signature}")
384
+ end
385
+
386
+ def print_signals_info(element)
387
+ signals = []
388
+ actions = []
389
+ element.class.signals.each do |name|
390
+ signal = element.class.signal(name)
391
+ next if signal.owner >= Gst::Element
392
+ if signal.action?
393
+ actions << signal
394
+ else
395
+ signals << signal
396
+ end
397
+ end
398
+
399
+ [[signals, "Signals"],
400
+ [actions, "Actions"]].each do |target_signals, description|
401
+ unless target_signals.empty?
402
+ puts("Element #{description}:")
403
+ target_signals.each do |signal|
404
+ print_signal_info(element, signal)
405
+ end
406
+ end
407
+ end
408
+ puts
409
+ end
410
+
411
+ def print_children_info(element)
412
+ return unless element.is_a?(Gst::Bin)
413
+ children = element.children
414
+ return if children.empty?
415
+
416
+ puts("Children:")
417
+ children.each do |child|
418
+ puts(" #{child.name}")
419
+ end
420
+ end
421
+
422
+ def print_element_factory(factory, print_names)
423
+ factory = factory.load
424
+ if factory.nil?
425
+ puts("element plugin (#{factory.name}) couldn't be loaded\n")
426
+ return
427
+ end
428
+
429
+ element = factory.create
430
+
431
+ prefix(print_names ? "#{factory.name}: " : "") do
432
+ print_factory_details_info(factory)
433
+ print_plugin_info(factory.plugin.name)
434
+
435
+ print_hierarchy(element)
436
+ print_interfaces(element)
437
+
438
+ print_pad_templates_info(element, factory)
439
+ puts
440
+
441
+ print_element_flag_info(element)
442
+ print_implementation_info(element)
443
+ print_clocking_info(element)
444
+ print_index_info(element)
445
+ print_uri_handler_info(element)
446
+ print_pad_info(element)
447
+ print_element_properties_info(element)
448
+ print_signals_info(element)
449
+ print_children_info(element)
450
+ end
451
+ end
452
+
453
+ def print_feature(plugin, feature)
454
+ prefix("#{plugin.name}: #{feature.name}") do
455
+ case feature
456
+ when Gst::ElementFactory
457
+ puts(": #{feature.long_name}")
458
+ when Gst::TypeFindFactory
459
+ if feature.extensions.empty?
460
+ message = "no extensions"
461
+ else
462
+ message = feature.extensions.join(", ")
463
+ end
464
+ puts(": #{message}")
465
+ else
466
+ puts(" (#{feature.gtype})")
467
+ end
468
+ end
469
+ end
470
+ end
471
+
472
+ options, element_name = parse(ARGV)
473
+ inspector = Inspector.new
474
+ if element_name
475
+ inspector.print_element(element_name)
476
+ else
477
+ inspector.print_list(options.print_all)
478
+ end
metadata CHANGED
@@ -1,48 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gstreamer
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
5
- prerelease:
4
+ version: 2.0.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - The Ruby-GNOME2 Project Team
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-05-26 00:00:00.000000000 Z
11
+ date: 2013-12-28 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: glib2
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - '='
20
18
  - !ruby/object:Gem::Version
21
- version: 2.0.2
19
+ version: 2.0.3
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - '='
28
25
  - !ruby/object:Gem::Version
29
- version: 2.0.2
26
+ version: 2.0.3
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: gobject-introspection
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - '='
36
32
  - !ruby/object:Gem::Version
37
- version: 2.0.2
33
+ version: 2.0.3
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - '='
44
39
  - !ruby/object:Gem::Version
45
- version: 2.0.2
40
+ version: 2.0.3
46
41
  description: Ruby/GStreamer is a Ruby binding for GStreamer.
47
42
  email: ruby-gnome2-devel-en@lists.sourceforge.net
48
43
  executables: []
@@ -53,16 +48,24 @@ files:
53
48
  - Rakefile
54
49
  - extconf.rb
55
50
  - lib/gst.rb
56
- - lib/gst/base_loader.rb
51
+ - lib/gst/base-loader.rb
57
52
  - lib/gst/bin.rb
58
53
  - lib/gst/bus.rb
59
- - lib/gst/controller_loader.rb
54
+ - lib/gst/caps.rb
55
+ - lib/gst/controller-loader.rb
56
+ - lib/gst/element-factory.rb
60
57
  - lib/gst/element.rb
58
+ - lib/gst/plugin-feature.rb
59
+ - lib/gst/registry.rb
60
+ - lib/gst/structure.rb
61
61
  - ext/gstreamer/depend
62
62
  - ext/gstreamer/extconf.rb
63
+ - ext/gstreamer/rbgst-element-factory.c
63
64
  - ext/gstreamer/rbgst.c
65
+ - ext/gstreamer/rbgst.h
64
66
  - sample/audio-example.rb
65
67
  - sample/framestep1.rb
68
+ - sample/gst-inspect.rb
66
69
  - sample/helloworld.rb
67
70
  - sample/mp3parselaunch.rb
68
71
  - sample/queue.rb
@@ -71,26 +74,25 @@ files:
71
74
  - sample/typefind.rb
72
75
  homepage: http://ruby-gnome2.sourceforge.jp/
73
76
  licenses: []
77
+ metadata: {}
74
78
  post_install_message:
75
79
  rdoc_options: []
76
80
  require_paths:
77
81
  - lib
78
82
  required_ruby_version: !ruby/object:Gem::Requirement
79
- none: false
80
83
  requirements:
81
- - - ! '>='
84
+ - - '>='
82
85
  - !ruby/object:Gem::Version
83
- version: 1.8.5
86
+ version: 1.9.3
84
87
  required_rubygems_version: !ruby/object:Gem::Requirement
85
- none: false
86
88
  requirements:
87
- - - ! '>='
89
+ - - '>='
88
90
  - !ruby/object:Gem::Version
89
91
  version: '0'
90
92
  requirements: []
91
93
  rubyforge_project:
92
- rubygems_version: 1.8.23
94
+ rubygems_version: 2.0.14
93
95
  signing_key:
94
- specification_version: 3
96
+ specification_version: 4
95
97
  summary: Ruby/GStreamer is a Ruby binding for GStreamer.
96
98
  test_files: []