gstreamer 1.0.3 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. data/Rakefile +201 -3
  2. data/ext/gstreamer/extconf.rb +10 -10
  3. data/ext/gstreamer/misc.c +16 -15
  4. data/ext/gstreamer/rbgst-bin.c +75 -83
  5. data/ext/gstreamer/rbgst-buffer.c +91 -91
  6. data/ext/gstreamer/rbgst-bus.c +21 -21
  7. data/ext/gstreamer/rbgst-caps.c +98 -91
  8. data/ext/gstreamer/rbgst-child-proxy.c +19 -18
  9. data/ext/gstreamer/rbgst-clock.c +34 -32
  10. data/ext/gstreamer/rbgst-element-factory.c +79 -85
  11. data/ext/gstreamer/rbgst-element.c +245 -210
  12. data/ext/gstreamer/rbgst-event.c +18 -18
  13. data/ext/gstreamer/rbgst-ghost-pad.c +24 -21
  14. data/ext/gstreamer/rbgst-index-factory.c +31 -29
  15. data/ext/gstreamer/rbgst-install-plugins-context.c +86 -0
  16. data/ext/gstreamer/rbgst-install-plugins-return.c +45 -0
  17. data/ext/gstreamer/rbgst-install-plugins.c +45 -111
  18. data/ext/gstreamer/rbgst-message.c +15 -16
  19. data/ext/gstreamer/rbgst-mini-object.c +37 -37
  20. data/ext/gstreamer/rbgst-object.c +29 -26
  21. data/ext/gstreamer/rbgst-pad-template.c +36 -35
  22. data/ext/gstreamer/rbgst-pad.c +96 -96
  23. data/ext/gstreamer/rbgst-pipeline.c +32 -31
  24. data/ext/gstreamer/rbgst-plugin-feature.c +47 -48
  25. data/ext/gstreamer/rbgst-plugin.c +62 -64
  26. data/ext/gstreamer/rbgst-private.c +14 -15
  27. data/ext/gstreamer/rbgst-private.h +76 -16
  28. data/ext/gstreamer/rbgst-query.c +22 -20
  29. data/ext/gstreamer/rbgst-seek.c +22 -19
  30. data/ext/gstreamer/rbgst-static-caps.c +26 -24
  31. data/ext/gstreamer/rbgst-static-pad-template.c +27 -26
  32. data/ext/gstreamer/rbgst-structure.c +61 -59
  33. data/ext/gstreamer/rbgst-system-clock.c +23 -20
  34. data/ext/gstreamer/rbgst-type-find-factory.c +44 -43
  35. data/ext/gstreamer/rbgst-value.c +40 -28
  36. data/ext/gstreamer/rbgst-x-overlay.c +32 -31
  37. data/ext/gstreamer/rbgst.c +78 -128
  38. data/ext/gstreamer/rbgst.h +16 -16
  39. data/ext/gstreamer/rbgstclockentry.c +46 -43
  40. data/ext/gstreamer/rbgstformat.c +64 -61
  41. data/ext/gstreamer/rbgstindex.c +67 -64
  42. data/ext/gstreamer/rbgstindexentry.c +31 -28
  43. data/ext/gstreamer/rbgstparse.c +32 -29
  44. data/ext/gstreamer/rbgstquerytype.c +64 -61
  45. data/ext/gstreamer/rbgstregistry.c +79 -76
  46. data/ext/gstreamer/rbgsttag.c +34 -32
  47. data/ext/gstreamer/rbgsttagsetter.c +22 -19
  48. data/ext/gstreamer/rbgstxml.c +78 -75
  49. data/lib/gst.rb +15 -1
  50. data/test/test_buffer.rb +5 -2
  51. data/test/test_element.rb +7 -9
  52. data/test/test_value.rb +2 -2
  53. metadata +11 -11
  54. data/ChangeLog +0 -1202
  55. data/test/test_clock.rb +0 -7
data/Rakefile CHANGED
@@ -1,15 +1,213 @@
1
1
  # -*- ruby -*-
2
2
 
3
3
  require './../glib2/lib/gnome2-raketask'
4
+ require 'open-uri'
4
5
 
5
6
  package = GNOME2Package.new do |_package|
6
7
  _package.summary = "Ruby/GStreamer is a Ruby binding for GStreamer."
7
8
  _package.description = "Ruby/GStreamer is a Ruby binding for GStreamer."
8
9
  _package.dependency.gem.runtime = ["glib2"]
9
- # TODO: use http://code.google.com/p/ossbuild/downloads/list ???
10
- _package.win32.packages = []
11
- _package.win32.dependencies = []
10
+ _package.win32.packages = ["libsoup"]
11
+ _package.win32.dependencies = ["jpeg", "libxml2"]
12
12
  _package.post_install_message = "This library is experimental."
13
+ _package.cross_compiling do |spec|
14
+ if /mingw|mswin/ =~ spec.platform.to_s
15
+ spec.add_runtime_dependency("cairo", ">= 1.10.1")
16
+ spec.add_runtime_dependency("pango", ">= #{_package.version}")
17
+ spec.add_runtime_dependency("gdk_pixbuf2", ">= #{_package.version}")
18
+ end
19
+ end
13
20
  end
14
21
  package.define_tasks
15
22
 
23
+ namespace :win32 do
24
+ host = "i686-w64-mingw32"
25
+
26
+ dist_dir = Pathname.new("vendor/local").expand_path
27
+ license_dir = dist_dir + "share" + "license"
28
+ tmp_dir = Pathname.new("tmp").expand_path
29
+ download_dir = tmp_dir + "download"
30
+
31
+ rcairo_win32_path = ENV["RCAIRO_WIN32_PATH"] || "../../rcairo.win32"
32
+ rcairo_win32_path = File.expand_path(rcairo_win32_path)
33
+ rcairo_win32_include_path = "#{rcairo_win32_path}/vendor/local/include"
34
+ rcairo_win32_lib_path = "#{rcairo_win32_path}/vendor/local/lib"
35
+
36
+ xiph_download_url_base = "http://downloads.xiph.org/releases"
37
+ freedesktop_download_url_base = "http://gstreamer.freedesktop.org/src"
38
+ packages = [
39
+ {
40
+ :name => "libogg",
41
+ :download_base_url => "#{xiph_download_url_base}/ogg",
42
+ :label => "Ogg",
43
+ :version => "1.3.0",
44
+ :configure_args => [],
45
+ },
46
+ {
47
+ :name => "libvorbis",
48
+ :download_base_url => "#{xiph_download_url_base}/vorbis",
49
+ :label => "Vorbis",
50
+ :version => "1.3.2",
51
+ :configure_args => [],
52
+ },
53
+ {
54
+ :name => "libtheora",
55
+ :download_base_url => "#{xiph_download_url_base}/theora",
56
+ :label => "Theora",
57
+ :version => "1.1.1",
58
+ :configure_args => [],
59
+ },
60
+ # {
61
+ # :name => "flac",
62
+ # :download_base_url => "#{xiph_download_url_base}/flac",
63
+ # :label => "FLAC",
64
+ # :version => "1.2.1",
65
+ # :configure_args => ["--disable-cpplibs"],
66
+ # },
67
+ {
68
+ :name => "speex",
69
+ :download_base_url => "#{xiph_download_url_base}/speex",
70
+ :label => "Speex",
71
+ :version => "1.2rc1",
72
+ :configure_args => [],
73
+ },
74
+ {
75
+ :name => "gstreamer",
76
+ :download_base_url => "#{freedesktop_download_url_base}/gstreamer",
77
+ :label => "GStreamer",
78
+ :version => "0.10.35",
79
+ :configure_args => ["--enable-check"],
80
+ },
81
+ {
82
+ :name => "gst-plugins-base",
83
+ :download_base_url => "#{freedesktop_download_url_base}/gst-plugins-base",
84
+ :label => "GStreamer plugins (base)",
85
+ :version => "0.10.35",
86
+ :configure_args => ["--disable-gnome_vfs"],
87
+ },
88
+ {
89
+ :name => "gst-plugins-good",
90
+ :download_base_url => "#{freedesktop_download_url_base}/gst-plugins-good",
91
+ :label => "GStreamer plugins (good)",
92
+ :version => "0.10.30",
93
+ :configure_args => ["--disable-gconf"],
94
+ },
95
+ {
96
+ :name => "gst-plugins-bad",
97
+ :download_base_url => "#{freedesktop_download_url_base}/gst-plugins-bad",
98
+ :label => "GStreamer plugins (bad)",
99
+ :version => "0.10.22",
100
+ :configure_args => ["--disable-librfb"],
101
+ },
102
+ {
103
+ :name => "gst-ffmpeg",
104
+ :download_base_url => "#{freedesktop_download_url_base}/gst-ffmpeg",
105
+ :label => "GStreamer ffmpeg",
106
+ :version => "0.10.12",
107
+ :configure_args => ["--with-ffmpeg-extra-configure=" +
108
+ "--cross-prefix=#{host}- " +
109
+ "--target-os=mingw32 " +
110
+ "--arch=i686 " +
111
+ "--pkg-config=pkg-config"],
112
+ :bundled_packages => [
113
+ {
114
+ :name => "libav",
115
+ :path => "gst-libs/ext/libav",
116
+ :license_files => ["LICENSE", "CREDITS",
117
+ "COPYING.GPLv2", "COPYING.GPLv3",
118
+ "COPYING.LGPLv2.1", "COPYING.LGPLv3"],
119
+ }
120
+ ],
121
+ },
122
+ ]
123
+
124
+ namespace :download do
125
+ packages.each do |_package|
126
+ base = "#{_package[:name]}-#{_package[:version]}"
127
+ tar_gz = "#{base}.tar.gz"
128
+ tar_gz_url = "#{_package[:download_base_url]}/#{tar_gz}"
129
+ tar_gz_full_path = download_dir + tar_gz
130
+
131
+ desc "Download #{_package[:label]} into #{download_dir}."
132
+ task _package[:name] => tar_gz_full_path.to_s
133
+
134
+ directory_path = tar_gz_full_path.dirname
135
+ directory directory_path.to_s
136
+ file tar_gz_full_path.to_s => directory_path.to_s do
137
+ rake_output_message "downloading... #{tar_gz_url}"
138
+ open(tar_gz_url) do |downloaded_tar_gz|
139
+ tar_gz_full_path.open("wb") do |tar_gz_file|
140
+ tar_gz_file.print(downloaded_tar_gz.read)
141
+ end
142
+ end
143
+ end
144
+ end
145
+ end
146
+
147
+ namespace :build do
148
+ task :prepare do
149
+ depended_packages = ["glib2", "atk", "pango", "gdk_pixbuf2", "gtk2"]
150
+ pkg_config_path = (["gstreamer"] + depended_packages).collect do |_package|
151
+ "../#{_package}/vendor/local/lib/pkgconfig"
152
+ end
153
+ ENV["PKG_CONFIG_PATH"] = pkg_config_path.collect do |path|
154
+ File.expand_path(path)
155
+ end.join(":")
156
+ ENV["PKG_CONFIG_LIBDIR"] = "#{rcairo_win32_path}/vendor/local/lib/pkgconfig"
157
+ end
158
+
159
+ packages.each do |_package|
160
+ desc "Build #{_package[:label]} and install it into #{dist_dir}."
161
+ task _package[:name] => [:prepare, "win32:download:#{_package[:name]}"] do
162
+ package_tmp_dir = tmp_dir + _package[:name]
163
+ rm_rf(package_tmp_dir)
164
+ mkdir_p(package_tmp_dir)
165
+
166
+ base = "#{_package[:name]}-#{_package[:version]}"
167
+ tar_gz = "#{base}.tar.gz"
168
+ tar_gz_full_path = download_dir + tar_gz
169
+ Dir.chdir(package_tmp_dir.to_s) do
170
+ sh("tar", "xzf", tar_gz_full_path.to_s) or exit(false)
171
+ end
172
+
173
+ Dir.chdir((package_tmp_dir + base).to_s) do
174
+ sh("./configure",
175
+ "CPPFLAGS=-I#{rcairo_win32_include_path} -I#{dist_dir + 'include'}",
176
+ "LDFLAGS=-L#{rcairo_win32_lib_path} -L#{dist_dir + 'lib'}",
177
+ "--prefix=#{dist_dir}",
178
+ "--host=#{host}",
179
+ *_package[:configure_args]) or exit(false)
180
+ common_make_args = []
181
+ common_make_args << "GLIB_COMPILE_SCHEMAS=glib-compile-schemas"
182
+ build_make_args = common_make_args.dup
183
+ install_make_args = common_make_args.dup
184
+ make_n_jobs = ENV["MAKE_N_JOBS"]
185
+ build_make_args << "-j#{make_n_jobs}" if make_n_jobs
186
+ ENV["GREP_OPTIONS"] = "--text"
187
+ sh("nice", "make", *build_make_args) or exit(false)
188
+ sh("make", "install", *install_make_args) or exit(false)
189
+
190
+ package_license_dir = license_dir + _package[:name]
191
+ mkdir_p(package_license_dir)
192
+ package_license_files = ["AUTHORS", "COPYING", "COPYING.LIB"]
193
+ package_license_files = package_license_files.reject do |file|
194
+ not File.exist?(file)
195
+ end
196
+ cp(package_license_files, package_license_dir)
197
+ bundled_packages = _package[:bundled_packages] || []
198
+ bundled_packages.each do |bundled_package|
199
+ bundled_package_license_dir = license_dir + bundled_package[:name]
200
+ mkdir_p(bundled_package_license_dir)
201
+ license_files = bundled_package[:license_files].collect do |file|
202
+ File.join(bundled_package[:path], file)
203
+ end
204
+ cp(license_files, bundled_package_license_dir)
205
+ end
206
+ end
207
+ end
208
+ end
209
+ end
210
+
211
+ desc "Build GStreamer binaries"
212
+ task :build => packages.collect {|_package| "win32:build:#{_package[:name]}"}
213
+ end
@@ -19,7 +19,7 @@ end
19
19
 
20
20
  $LOAD_PATH.unshift(mkmf_gnome2_dir.to_s)
21
21
 
22
- module_name = "gst"
22
+ module_name = "gstreamer"
23
23
  package_id = "gstreamer-0.10"
24
24
 
25
25
  begin
@@ -30,6 +30,15 @@ rescue LoadError
30
30
  require 'mkmf-gnome2'
31
31
  end
32
32
 
33
+ ["glib2"].each do |package|
34
+ directory = "#{package}#{version_suffix}"
35
+ build_dir = "#{directory}/tmp/#{RUBY_PLATFORM}/#{package}/#{RUBY_VERSION}"
36
+ add_depend_package(package, "#{directory}/ext/#{package}",
37
+ top_dir.to_s,
38
+ :top_build_dir => top_build_dir.to_s,
39
+ :target_build_dir => build_dir)
40
+ end
41
+
33
42
  setup_win32(module_name, base_dir)
34
43
 
35
44
  PKGConfig.have_package(package_id) or exit 1
@@ -47,15 +56,6 @@ if PKGConfig.have_package("gstreamer-pbutils-0.10")
47
56
  $CFLAGS += " -DHAVE_GST_PBUTILS"
48
57
  end
49
58
 
50
- ["glib2"].each do |package|
51
- directory = "#{package}#{version_suffix}"
52
- build_dir = "#{directory}/tmp/#{RUBY_PLATFORM}/#{package}/#{RUBY_VERSION}"
53
- add_depend_package(package, "#{directory}/ext/#{package}",
54
- top_dir.to_s,
55
- :top_build_dir => top_build_dir.to_s,
56
- :target_build_dir => build_dir)
57
- end
58
-
59
59
  create_pkg_config_file("Ruby/GStreamer", package_id)
60
60
  $defs << "-DRUBY_GST_COMPILATION"
61
61
  create_makefile(module_name)
data/ext/gstreamer/misc.c CHANGED
@@ -1,24 +1,25 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
1
2
  /*
2
- * Copyright (C) 2003, 2004 Laurent Sansonetti <lrz@gnome.org>
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2003, 2004 Laurent Sansonetti <lrz@gnome.org>
3
5
  *
4
- * This file is part of Ruby/GStreamer.
6
+ * This library is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
5
10
  *
6
- * Ruby/GStreamer is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU Lesser General Public
8
- * License as published by the Free Software Foundation; either
9
- * version 2.1 of the License, or (at your option) any later version.
11
+ * This library is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
10
15
  *
11
- * Ruby/GStreamer is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
- * Lesser General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU Lesser General Public
17
- * License along with Ruby/GStreamer; if not, write to the Free Software
18
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with this library; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
+ * MA 02110-1301 USA
19
20
  */
20
21
 
21
- #include "rbgst.h"
22
+ #include "rbgst-private.h"
22
23
 
23
24
  VALUE
24
25
  rb_str_new_with_format (char *fmt, ...)
@@ -1,27 +1,28 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
1
2
  /*
2
- * Copyright (C) 2003, 2004 Laurent Sansonetti <lrz@gnome.org>
3
- * 2004 Erwan Loisant <erwan@loisant.org>
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2003, 2004 Laurent Sansonetti <lrz@gnome.org>
5
+ * 2004 Erwan Loisant <erwan@loisant.org>
4
6
  *
5
- * This file is part of Ruby/GStreamer.
7
+ * This library is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU Lesser General Public
9
+ * License as published by the Free Software Foundation; either
10
+ * version 2.1 of the License, or (at your option) any later version.
6
11
  *
7
- * Ruby/GStreamer is free software; you can redistribute it and/or
8
- * modify it under the terms of the GNU Lesser General Public
9
- * License as published by the Free Software Foundation; either
10
- * version 2.1 of the License, or (at your option) any later version.
12
+ * This library is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
+ * Lesser General Public License for more details.
11
16
  *
12
- * Ruby/GStreamer is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
- * Lesser General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU Lesser General Public
18
- * License along with Ruby/GStreamer; if not, write to the Free Software
19
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
+ * You should have received a copy of the GNU Lesser General Public
18
+ * License along with this library; if not, write to the Free Software
19
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20
+ * MA 02110-1301 USA
20
21
  */
21
22
 
22
- #include "rbgst.h"
23
23
  #include "rbgst-private.h"
24
24
 
25
+ #define RG_TARGET_NAMESPACE cBin
25
26
  #define SELF(self) RVAL2GST_BIN(self)
26
27
 
27
28
  /* Class: Gst::Bin
@@ -41,7 +42,7 @@
41
42
  * Returns: a newly allocated Gst::Bin object.
42
43
  */
43
44
  static VALUE
44
- rb_gst_bin_initialize(int argc, VALUE *argv, VALUE self)
45
+ rg_initialize(int argc, VALUE *argv, VALUE self)
45
46
  {
46
47
  GstElement *bin;
47
48
  VALUE name;
@@ -60,7 +61,7 @@ rb_gst_bin_initialize(int argc, VALUE *argv, VALUE self)
60
61
  * Returns: the number of elements in the container.
61
62
  */
62
63
  static VALUE
63
- rb_gst_bin_size(VALUE self)
64
+ rg_size(VALUE self)
64
65
  {
65
66
  return INT2NUM(GST_BIN_NUMCHILDREN(SELF(self)));
66
67
  }
@@ -75,7 +76,7 @@ rb_gst_bin_size(VALUE self)
75
76
  * implements the interface.
76
77
  */
77
78
  static VALUE
78
- rb_gst_bin_get_children(int argc, VALUE *argv, VALUE self)
79
+ rg_children(int argc, VALUE *argv, VALUE self)
79
80
  {
80
81
  VALUE children, iface;
81
82
 
@@ -106,7 +107,7 @@ rb_gst_bin_get_children(int argc, VALUE *argv, VALUE self)
106
107
  * bins.
107
108
  */
108
109
  static VALUE
109
- rb_gst_bin_get_children_recurse(VALUE self)
110
+ rg_children_recurse(VALUE self)
110
111
  {
111
112
  GstIterator *iter;
112
113
  VALUE children;
@@ -118,19 +119,19 @@ rb_gst_bin_get_children_recurse(VALUE self)
118
119
  }
119
120
 
120
121
  static VALUE
121
- rb_gst_bin_get_children_cookie(VALUE self)
122
+ rg_children_cookie(VALUE self)
122
123
  {
123
124
  return UINT2NUM(GST_BIN_CHILDREN_COOKIE(SELF(self)));
124
125
  }
125
126
 
126
127
  static VALUE
127
- rb_gst_bin_get_child_bus(VALUE self)
128
+ rg_child_bus(VALUE self)
128
129
  {
129
130
  return GST_BUS2RVAL(SELF(self)->child_bus);
130
131
  }
131
132
 
132
133
  static VALUE
133
- rb_gst_bin_get_messages(VALUE self)
134
+ rg_messages(VALUE self)
134
135
  {
135
136
  GList *node;
136
137
  VALUE messages;
@@ -144,13 +145,13 @@ rb_gst_bin_get_messages(VALUE self)
144
145
  }
145
146
 
146
147
  static VALUE
147
- rb_gst_bin_polling_p(VALUE self)
148
+ rg_polling_p(VALUE self)
148
149
  {
149
150
  return CBOOL2RVAL(SELF(self)->polling);
150
151
  }
151
152
 
152
153
  static VALUE
153
- rb_gst_bin_clock_dirty_p(VALUE self)
154
+ rg_clock_dirty_p(VALUE self)
154
155
  {
155
156
  return CBOOL2RVAL(SELF(self)->clock_dirty);
156
157
  }
@@ -164,7 +165,7 @@ rb_gst_bin_clock_dirty_p(VALUE self)
164
165
  * Returns: a Gst::Clock object, or nil.
165
166
  */
166
167
  static VALUE
167
- rb_gst_bin_get_provided_clock(VALUE self)
168
+ rg_provided_clock(VALUE self)
168
169
  {
169
170
  return GST_CLOCK2RVAL(SELF(self)->provided_clock);
170
171
  }
@@ -179,7 +180,7 @@ rb_gst_bin_get_provided_clock(VALUE self)
179
180
  * Returns: self.
180
181
  */
181
182
  static VALUE
182
- rb_gst_bin_set_provided_clock(VALUE self, VALUE clock)
183
+ rg_set_provided_clock(VALUE self, VALUE clock)
183
184
  {
184
185
  GstBin *bin;
185
186
 
@@ -195,7 +196,7 @@ rb_gst_bin_set_provided_clock(VALUE self, VALUE clock)
195
196
  }
196
197
 
197
198
  static VALUE
198
- rb_gst_bin_get_clock_provider(VALUE self)
199
+ rg_clock_provider(VALUE self)
199
200
  {
200
201
  return GST_ELEMENT2RVAL(SELF(self)->clock_provider);
201
202
  }
@@ -209,7 +210,7 @@ rb_gst_bin_get_clock_provider(VALUE self)
209
210
  * Returns: self.
210
211
  */
211
212
  static VALUE
212
- rb_gst_bin_add(VALUE self, VALUE element)
213
+ rg_operator_add(VALUE self, VALUE element)
213
214
  {
214
215
  VALUE klass = GTYPE2CLASS(GST_TYPE_ELEMENT);
215
216
 
@@ -230,17 +231,16 @@ rb_gst_bin_add(VALUE self, VALUE element)
230
231
  * Returns: nil.
231
232
  */
232
233
  static VALUE
233
- rb_gst_bin_add_multi(int argc, VALUE *argv, VALUE self)
234
+ rg_add(int argc, VALUE *argv, VALUE self)
234
235
  {
235
236
  int i;
236
237
 
237
238
  for (i = 0; i < argc; i++) {
238
- rb_gst_bin_add(self, argv[i]);
239
+ rg_operator_add(self, argv[i]);
239
240
  }
240
241
  return Qnil;
241
242
  }
242
243
 
243
-
244
244
  /*
245
245
  * Method: remove(*elements)
246
246
  * elements: a list of Gst::Element objects.
@@ -251,7 +251,7 @@ rb_gst_bin_add_multi(int argc, VALUE *argv, VALUE self)
251
251
  * Returns: nil.
252
252
  */
253
253
  static VALUE
254
- rb_gst_bin_remove(int argc, VALUE *argv, VALUE self)
254
+ rg_remove(int argc, VALUE *argv, VALUE self)
255
255
  {
256
256
  int i;
257
257
  GstBin *bin;
@@ -272,7 +272,7 @@ rb_gst_bin_remove(int argc, VALUE *argv, VALUE self)
272
272
  * Returns: nil.
273
273
  */
274
274
  static VALUE
275
- rb_gst_bin_clear(VALUE self)
275
+ rg_clear(VALUE self)
276
276
  {
277
277
  GstBin *bin;
278
278
  GList *node, *children;
@@ -296,9 +296,9 @@ rb_gst_bin_clear(VALUE self)
296
296
  * Returns: always nil.
297
297
  */
298
298
  static VALUE
299
- rb_gst_bin_each_element(int argc, VALUE *argv, VALUE self)
299
+ rg_each(int argc, VALUE *argv, VALUE self)
300
300
  {
301
- return rb_ary_yield(rb_gst_bin_get_children(argc, argv, self));
301
+ return rb_ary_yield(rg_children(argc, argv, self));
302
302
  }
303
303
 
304
304
  /*
@@ -310,9 +310,9 @@ rb_gst_bin_each_element(int argc, VALUE *argv, VALUE self)
310
310
  * Returns: always nil.
311
311
  */
312
312
  static VALUE
313
- rb_gst_bin_each_recurse_element(VALUE self)
313
+ rg_each_recurse(VALUE self)
314
314
  {
315
- return rb_ary_yield(rb_gst_bin_get_children_recurse(self));
315
+ return rb_ary_yield(rg_children_recurse(self));
316
316
  }
317
317
 
318
318
  /*
@@ -340,7 +340,7 @@ rb_gst_bin_each_recurse_element(VALUE self)
340
340
  * an element with the given name nor implementing the interface.
341
341
  */
342
342
  static VALUE
343
- rb_gst_bin_get(int argc, VALUE *argv, VALUE self)
343
+ rg_get_child(int argc, VALUE *argv, VALUE self)
344
344
  {
345
345
  VALUE index_or_name_or_interface, recurse;
346
346
  GstElement *element = NULL;
@@ -374,27 +374,27 @@ rb_gst_bin_get(int argc, VALUE *argv, VALUE self)
374
374
  }
375
375
 
376
376
  static VALUE
377
- rb_gst_bin_get_sinks(VALUE self)
377
+ rg_sinks(VALUE self)
378
378
  {
379
379
  return _rbgst_collect_elements(gst_bin_iterate_sinks(SELF(self)));
380
380
  }
381
381
 
382
382
  static VALUE
383
- rb_gst_bin_get_sources(VALUE self)
383
+ rg_sources(VALUE self)
384
384
  {
385
385
  return _rbgst_collect_elements(gst_bin_iterate_sources(SELF(self)));
386
386
  }
387
387
 
388
388
  #ifdef GST_DEBUG_BIN_TO_DOT_FILE
389
389
  static VALUE
390
- rb_gst_bin_to_dot_file(VALUE self, VALUE details, VALUE filename)
390
+ rg_to_dot_file(VALUE self, VALUE details, VALUE filename)
391
391
  {
392
392
  GST_DEBUG_BIN_TO_DOT_FILE(SELF(self), NUM2INT(details), RVAL2CSTR(filename));
393
393
  return Qnil;
394
394
  }
395
395
 
396
396
  static VALUE
397
- rb_gst_bin_to_dot_file_with_ts(VALUE self, VALUE details, VALUE filename)
397
+ rg_to_dot_file_with_ts(VALUE self, VALUE details, VALUE filename)
398
398
  {
399
399
  GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS(SELF(self),
400
400
  NUM2INT(details),
@@ -404,63 +404,55 @@ rb_gst_bin_to_dot_file_with_ts(VALUE self, VALUE details, VALUE filename)
404
404
  #endif
405
405
 
406
406
  void
407
- Init_gst_bin (void)
407
+ Init_gst_bin (VALUE mGst)
408
408
  {
409
- VALUE rb_cGstBin;
410
-
411
- rb_cGstBin = G_DEF_CLASS(GST_TYPE_BIN, "Bin", mGst);
409
+ VALUE RG_TARGET_NAMESPACE;
412
410
 
413
- rb_include_module(rb_cGstBin, rb_mEnumerable);
411
+ RG_TARGET_NAMESPACE = G_DEF_CLASS(GST_TYPE_BIN, "Bin", mGst);
414
412
 
415
- rb_define_method(rb_cGstBin, "initialize", rb_gst_bin_initialize, -1);
413
+ rb_include_module(RG_TARGET_NAMESPACE, rb_mEnumerable);
416
414
 
417
- rb_define_method(rb_cGstBin, "size", rb_gst_bin_size, 0);
418
- rb_define_alias(rb_cGstBin, "length", "size");
415
+ RG_DEF_METHOD(initialize, -1);
419
416
 
420
- rb_define_method(rb_cGstBin, "children", rb_gst_bin_get_children, -1);
421
- rb_define_method(rb_cGstBin, "each", rb_gst_bin_each_element, -1);
417
+ RG_DEF_METHOD(size, 0);
418
+ RG_DEF_ALIAS("length", "size");
422
419
 
423
- rb_define_method(rb_cGstBin, "children_recurse",
424
- rb_gst_bin_get_children_recurse, 0);
425
- rb_define_method(rb_cGstBin, "each_recurse",
426
- rb_gst_bin_each_recurse_element, 0);
420
+ RG_DEF_METHOD(children, -1);
421
+ RG_DEF_METHOD(each, -1);
427
422
 
428
- rb_define_method(rb_cGstBin, "children_cookie",
429
- rb_gst_bin_get_children_cookie, 0);
430
- rb_define_method(rb_cGstBin, "child_bus", rb_gst_bin_get_child_bus, 0);
431
- rb_define_method(rb_cGstBin, "messages", rb_gst_bin_get_messages, 0);
432
- rb_define_method(rb_cGstBin, "polling?", rb_gst_bin_polling_p, 0);
433
- rb_define_method(rb_cGstBin, "clock_dirty?", rb_gst_bin_clock_dirty_p, 0);
434
- rb_define_method(rb_cGstBin, "provided_clock",
435
- rb_gst_bin_get_provided_clock, 0);
436
- rb_define_method(rb_cGstBin, "set_provided_clock",
437
- rb_gst_bin_set_provided_clock, 1);
438
- rb_define_method(rb_cGstBin, "clock_provider",
439
- rb_gst_bin_get_clock_provider, 0);
423
+ RG_DEF_METHOD(children_recurse, 0);
424
+ RG_DEF_METHOD(each_recurse, 0);
440
425
 
426
+ RG_DEF_METHOD(children_cookie, 0);
427
+ RG_DEF_METHOD(child_bus, 0);
428
+ RG_DEF_METHOD(messages, 0);
429
+ RG_DEF_METHOD_P(polling, 0);
430
+ RG_DEF_METHOD_P(clock_dirty, 0);
431
+ RG_DEF_METHOD(provided_clock, 0);
432
+ RG_DEF_METHOD(set_provided_clock, 1);
433
+ RG_DEF_METHOD(clock_provider, 0);
441
434
 
442
- rb_define_method(rb_cGstBin, "<<", rb_gst_bin_add, 1);
443
- rb_define_method(rb_cGstBin, "add", rb_gst_bin_add_multi, -1);
444
- rb_define_method(rb_cGstBin, "remove", rb_gst_bin_remove, -1);
445
- rb_define_method(rb_cGstBin, "clear", rb_gst_bin_clear, 0);
435
+ RG_DEF_METHOD_OPERATOR("<<", add, 1);
436
+ RG_DEF_METHOD(add, -1);
437
+ RG_DEF_METHOD(remove, -1);
438
+ RG_DEF_METHOD(clear, 0);
446
439
 
447
- rb_define_method(rb_cGstBin, "get_child", rb_gst_bin_get, -1);
440
+ RG_DEF_METHOD(get_child, -1);
448
441
 
449
- rb_define_method(rb_cGstBin, "sinks", rb_gst_bin_get_sinks, 0);
450
- rb_define_method(rb_cGstBin, "sources", rb_gst_bin_get_sources, 0);
442
+ RG_DEF_METHOD(sinks, 0);
443
+ RG_DEF_METHOD(sources, 0);
451
444
 
452
445
  #ifdef GST_DEBUG_BIN_TO_DOT_FILE
453
- rb_define_method(rb_cGstBin, "to_dot_file", rb_gst_bin_to_dot_file, 2);
454
- rb_define_method(rb_cGstBin, "to_dot_file_with_ts",
455
- rb_gst_bin_to_dot_file_with_ts, 2);
446
+ RG_DEF_METHOD(to_dot_file, 2);
447
+ RG_DEF_METHOD(to_dot_file_with_ts, 2);
456
448
  #endif
457
449
 
458
- G_DEF_SETTERS(rb_cGstBin);
450
+ G_DEF_SETTERS(RG_TARGET_NAMESPACE);
459
451
 
460
- G_DEF_CLASS(GST_TYPE_BIN_FLAGS, "Flags", rb_cGstBin);
461
- G_DEF_CONSTANTS(rb_cGstBin, GST_TYPE_BIN_FLAGS, "GST_BIN_");
452
+ G_DEF_CLASS(GST_TYPE_BIN_FLAGS, "Flags", RG_TARGET_NAMESPACE);
453
+ G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GST_TYPE_BIN_FLAGS, "GST_BIN_");
462
454
  #ifdef GST_DEBUG_BIN_TO_DOT_FILE
463
- G_DEF_CONSTANTS(rb_cGstBin, GST_TYPE_DEBUG_GRAPH_DETAILS,
455
+ G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GST_TYPE_DEBUG_GRAPH_DETAILS,
464
456
  "GST_DEBUG_GRAPH_");
465
457
  #endif
466
458
  }