gstreamer 1.2.6 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. data/Rakefile +78 -39
  2. data/ext/gstreamer/extconf.rb +8 -22
  3. data/ext/gstreamer/rbgst.c +82 -194
  4. data/lib/gst/base_loader.rb +20 -0
  5. data/lib/gst/bin.rb +32 -0
  6. data/lib/gst/bus.rb +24 -0
  7. data/lib/gst/element.rb +48 -0
  8. data/lib/gst.rb +87 -22
  9. data/sample/helloworld.rb +75 -0
  10. data/sample/mp3parselaunch.rb +74 -0
  11. data/sample/queue.rb +92 -0
  12. data/sample/typefind.rb +101 -0
  13. metadata +29 -84
  14. data/README +0 -33
  15. data/ext/gstreamer/misc.c +0 -63
  16. data/ext/gstreamer/rbgst-bin.c +0 -456
  17. data/ext/gstreamer/rbgst-buffer.c +0 -363
  18. data/ext/gstreamer/rbgst-bus.c +0 -92
  19. data/ext/gstreamer/rbgst-caps.c +0 -446
  20. data/ext/gstreamer/rbgst-child-proxy.c +0 -34
  21. data/ext/gstreamer/rbgst-clock.c +0 -108
  22. data/ext/gstreamer/rbgst-element-factory.c +0 -249
  23. data/ext/gstreamer/rbgst-element.c +0 -1106
  24. data/ext/gstreamer/rbgst-event.c +0 -352
  25. data/ext/gstreamer/rbgst-ghost-pad.c +0 -45
  26. data/ext/gstreamer/rbgst-index-factory.c +0 -69
  27. data/ext/gstreamer/rbgst-install-plugins-context.c +0 -87
  28. data/ext/gstreamer/rbgst-install-plugins-return.c +0 -45
  29. data/ext/gstreamer/rbgst-install-plugins.c +0 -125
  30. data/ext/gstreamer/rbgst-message.c +0 -785
  31. data/ext/gstreamer/rbgst-mini-object.c +0 -221
  32. data/ext/gstreamer/rbgst-object.c +0 -81
  33. data/ext/gstreamer/rbgst-pad-template.c +0 -125
  34. data/ext/gstreamer/rbgst-pad.c +0 -336
  35. data/ext/gstreamer/rbgst-pipeline.c +0 -91
  36. data/ext/gstreamer/rbgst-plugin-feature.c +0 -131
  37. data/ext/gstreamer/rbgst-plugin.c +0 -162
  38. data/ext/gstreamer/rbgst-private.c +0 -88
  39. data/ext/gstreamer/rbgst-private.h +0 -97
  40. data/ext/gstreamer/rbgst-query.c +0 -291
  41. data/ext/gstreamer/rbgst-seek.c +0 -39
  42. data/ext/gstreamer/rbgst-static-caps.c +0 -49
  43. data/ext/gstreamer/rbgst-static-pad-template.c +0 -65
  44. data/ext/gstreamer/rbgst-structure.c +0 -300
  45. data/ext/gstreamer/rbgst-system-clock.c +0 -48
  46. data/ext/gstreamer/rbgst-type-find-factory.c +0 -125
  47. data/ext/gstreamer/rbgst-value.c +0 -527
  48. data/ext/gstreamer/rbgst-x-overlay.c +0 -131
  49. data/ext/gstreamer/rbgst.h +0 -197
  50. data/ext/gstreamer/rbgstclockentry.c +0 -271
  51. data/ext/gstreamer/rbgstformat.c +0 -162
  52. data/ext/gstreamer/rbgstindex.c +0 -315
  53. data/ext/gstreamer/rbgstindexentry.c +0 -99
  54. data/ext/gstreamer/rbgstparse.c +0 -69
  55. data/ext/gstreamer/rbgstquerytype.c +0 -162
  56. data/ext/gstreamer/rbgstregistry.c +0 -288
  57. data/ext/gstreamer/rbgsttag.c +0 -113
  58. data/ext/gstreamer/rbgsttagsetter.c +0 -53
  59. data/ext/gstreamer/rbgstxml.c +0 -192
  60. data/sample/audio-player.rb +0 -54
  61. data/sample/gst-gi.rb +0 -55
  62. data/sample/gst-inspect.rb +0 -417
  63. data/sample/install-plugins.rb +0 -40
  64. data/sample/media-type.rb +0 -55
  65. data/sample/media-type2.rb +0 -268
  66. data/sample/ogg-audio-player.rb +0 -54
  67. data/sample/type-find.rb +0 -46
  68. data/sample/video-player.rb +0 -57
  69. data/sample/xml-player.rb +0 -60
  70. data/test/gst-test-utils.rb +0 -18
  71. data/test/run-test.rb +0 -25
  72. data/test/test_bin.rb +0 -167
  73. data/test/test_buffer.rb +0 -185
  74. data/test/test_caps.rb +0 -24
  75. data/test/test_element.rb +0 -85
  76. data/test/test_element_factory.rb +0 -28
  77. data/test/test_event.rb +0 -10
  78. data/test/test_index_factory.rb +0 -7
  79. data/test/test_install-plugins.rb +0 -18
  80. data/test/test_message.rb +0 -191
  81. data/test/test_mini_object.rb +0 -38
  82. data/test/test_object.rb +0 -10
  83. data/test/test_pad.rb +0 -68
  84. data/test/test_plugin.rb +0 -6
  85. data/test/test_plugin_feature.rb +0 -20
  86. data/test/test_seek.rb +0 -17
  87. data/test/test_static_caps.rb +0 -18
  88. data/test/test_static_pad_template.rb +0 -16
  89. data/test/test_structure.rb +0 -159
  90. data/test/test_thread_handling.rb +0 -58
  91. data/test/test_type_find_factory.rb +0 -8
  92. data/test/test_value.rb +0 -69
data/Rakefile CHANGED
@@ -6,108 +6,152 @@ require 'gnome2-raketask'
6
6
  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
- _package.dependency.gem.runtime = ["glib2"]
9
+ _package.dependency.gem.runtime = ["glib2", "gobject-introspection"]
10
10
  _package.win32.packages = ["libsoup"]
11
11
  _package.win32.dependencies = ["jpeg", "libxml2"]
12
+ _package.win32.build_dependencies = [
13
+ "glib2", "atk", "pango", "gdk_pixbuf2", "gtk2", "gobject-introspection",
14
+ ]
12
15
  xiph_download_url_base = "http://downloads.xiph.org/releases"
13
16
  freedesktop_download_url_base = "http://gstreamer.freedesktop.org/src"
14
17
  sf_net_download_url_base = "http://downloads.sourceforge.net/project"
15
18
  libmad_version = "0.15.1b"
16
- _package.win32.build_packages = [
19
+ _package.external_packages = [
17
20
  {
18
21
  :name => "libogg",
19
22
  :download_base_url => "#{xiph_download_url_base}/ogg",
20
23
  :label => "Ogg",
21
24
  :version => "1.3.0",
22
- :configure_args => [],
25
+ :windows => {
26
+ :configure_args => [],
27
+ },
23
28
  },
24
29
  {
25
30
  :name => "libvorbis",
26
31
  :download_base_url => "#{xiph_download_url_base}/vorbis",
27
32
  :label => "Vorbis",
28
33
  :version => "1.3.2",
29
- :configure_args => [],
34
+ :windows => {
35
+ :configure_args => [],
36
+ },
30
37
  },
31
38
  {
32
39
  :name => "libtheora",
33
40
  :download_base_url => "#{xiph_download_url_base}/theora",
34
41
  :label => "Theora",
35
42
  :version => "1.1.1",
36
- :configure_args => [],
43
+ :windows => {
44
+ :configure_args => [],
45
+ :build_concurrently => false,
46
+ },
37
47
  },
38
48
  # {
39
49
  # :name => "libmad",
40
50
  # :download_base_url => "#{sf_net_download_url_base}/mad/libmad/#{libmad_version}",
41
51
  # :label => "MAD",
42
52
  # :version => libmad_version,
43
- # :configure_args => ["CFLAGS=-O3 -march=i686"],
44
- # :need_autoreconf => true,
45
- # :patches => ["libmad-0.15.1b-fix-mingw-build.diff"],
53
+ # :windows => {
54
+ # :configure_args => ["CFLAGS=-O3 -march=i686"],
55
+ # :need_autoreconf => true,
56
+ # :patches => ["libmad-0.15.1b-fix-mingw-build.diff"],
57
+ # },
46
58
  # },
47
59
  {
48
60
  :name => "flac",
49
61
  :download_base_url => "#{xiph_download_url_base}/flac",
50
62
  :label => "FLAC",
51
63
  :version => "1.2.1",
52
- :configure_args => ["--disable-cpplibs"],
53
- :need_autogen => true,
54
- :patches => [
55
- "flac-1.2.1-fix-mingw-build.diff",
56
- # "flac-1.2.1-fix-doc-install.diff",
57
- ],
64
+ :windows => {
65
+ :configure_args => ["--disable-cpplibs"],
66
+ :need_autogen => true,
67
+ :patches => [
68
+ "flac-1.2.1-fix-mingw-build.diff",
69
+ # "flac-1.2.1-fix-doc-install.diff",
70
+ ],
71
+ },
58
72
  },
59
73
  {
60
74
  :name => "speex",
61
75
  :download_base_url => "#{xiph_download_url_base}/speex",
62
76
  :label => "Speex",
63
77
  :version => "1.2rc1",
64
- :configure_args => [],
78
+ :windows => {
79
+ :configure_args => [],
80
+ },
65
81
  },
66
82
  {
67
83
  :name => "gstreamer",
68
84
  :download_base_url => "#{freedesktop_download_url_base}/gstreamer",
69
85
  :label => "GStreamer",
70
- :version => "0.10.35",
71
- :configure_args => ["--enable-check"],
86
+ :version => "1.0.6",
87
+ :compression_method => "xz",
88
+ :windows => {
89
+ :configure_args => [
90
+ "--enable-check",
91
+ "--enable-introspection",
92
+ ],
93
+ :build_concurrently => false,
94
+ },
72
95
  },
73
96
  {
74
97
  :name => "gst-plugins-base",
75
98
  :download_base_url => "#{freedesktop_download_url_base}/gst-plugins-base",
76
99
  :label => "GStreamer plugins (base)",
77
- :version => "0.10.35",
78
- :configure_args => ["--disable-gnome_vfs"],
100
+ :version => "1.0.6",
101
+ :compression_method => "xz",
102
+ :windows => {
103
+ :configure_args => [
104
+ "--enable-introspection",
105
+ ],
106
+ :build_concurrently => false,
107
+ },
79
108
  },
80
109
  {
81
110
  :name => "gst-plugins-good",
82
111
  :download_base_url => "#{freedesktop_download_url_base}/gst-plugins-good",
83
112
  :label => "GStreamer plugins (good)",
84
- :version => "0.10.30",
85
- :configure_args => ["--disable-gconf", "--disable-shout2"],
113
+ :version => "1.0.6",
114
+ :compression_method => "xz",
115
+ :windows => {
116
+ :configure_args => [
117
+ "--disable-shout2",
118
+ ],
119
+ },
86
120
  },
87
121
  {
88
122
  :name => "gst-plugins-bad",
89
123
  :download_base_url => "#{freedesktop_download_url_base}/gst-plugins-bad",
90
124
  :label => "GStreamer plugins (bad)",
91
- :version => "0.10.22",
92
- :configure_args => ["--disable-librfb"],
125
+ :version => "1.0.6",
126
+ :compression_method => "xz",
127
+ :windows => {
128
+ :configure_args => ["--disable-librfb"],
129
+ },
93
130
  },
94
131
  # {
95
132
  # :name => "gst-plugins-ugly",
96
133
  # :download_base_url => "#{freedesktop_download_url_base}/gst-plugins-ugly",
97
134
  # :label => "GStreamer plugins (ugly)",
98
- # :version => "0.10.18",
99
- # :configure_args => [],
135
+ # :version => "1.0.6",
136
+ # :compression_method => "xz",
137
+ # :windows => {
138
+ # :configure_args => [],
139
+ # },
100
140
  # },
101
141
  {
102
- :name => "gst-ffmpeg",
103
- :download_base_url => "#{freedesktop_download_url_base}/gst-ffmpeg",
104
- :label => "GStreamer ffmpeg",
105
- :version => "0.10.12",
106
- :configure_args => ["--with-ffmpeg-extra-configure=" +
107
- "--cross-prefix=#{_package.win32.build_host}- " +
108
- "--target-os=mingw32 " +
109
- "--arch=i686 " +
110
- "--pkg-config=pkg-config"],
142
+ :name => "gst-libav",
143
+ :download_base_url => "#{freedesktop_download_url_base}/gst-libav",
144
+ :label => "GStreamer libav",
145
+ :version => "1.0.6",
146
+ :compression_method => "xz",
147
+ :windows => {
148
+ :configure_args => ["--with-libav-extra-configure=" +
149
+ "--cross-prefix=#{_package.win32.build_host}- " +
150
+ "--target-os=mingw32 " +
151
+ "--arch=i686 " +
152
+ "--pkg-config=pkg-config " +
153
+ "--disable-gpl"],
154
+ },
111
155
  :bundled_packages => [
112
156
  {
113
157
  :name => "libav",
@@ -119,11 +163,6 @@ package = GNOME2Package.new do |_package|
119
163
  ],
120
164
  },
121
165
  ]
122
- _package.win32.build_dependencies = [
123
- "glib2", "atk", "pango", "gdk_pixbuf2", "gtk2",
124
- ]
125
- _package.win32.support_concurrent_build = false
126
- _package.post_install_message = "This library is experimental."
127
166
  _package.cross_compiling do |spec|
128
167
  if /mingw|mswin/ =~ spec.platform.to_s
129
168
  spec.add_runtime_dependency("cairo", ">= 1.10.1")
@@ -20,7 +20,7 @@ end
20
20
  $LOAD_PATH.unshift(mkmf_gnome2_dir.to_s)
21
21
 
22
22
  module_name = "gstreamer"
23
- package_id = "gstreamer-0.10"
23
+ package_id = "gstreamer-1.0"
24
24
 
25
25
  begin
26
26
  require 'mkmf-gnome2'
@@ -30,9 +30,11 @@ rescue LoadError
30
30
  require 'mkmf-gnome2'
31
31
  end
32
32
 
33
- ["glib2"].each do |package|
33
+ ["glib2", "gobject-introspection"].each do |package|
34
34
  directory = "#{package}#{version_suffix}"
35
- build_dir = "#{directory}/tmp/#{RUBY_PLATFORM}/#{package}/#{RUBY_VERSION}"
35
+ build_base_path = "#{directory}/tmp/#{RUBY_PLATFORM}"
36
+ package_library_name = package.gsub(/-/, "_")
37
+ build_dir = "#{build_base_path}/#{package_library_name}/#{RUBY_VERSION}"
36
38
  add_depend_package(package, "#{directory}/ext/#{package}",
37
39
  top_dir.to_s,
38
40
  :top_build_dir => top_build_dir.to_s,
@@ -42,30 +44,15 @@ end
42
44
  setup_win32(module_name, base_dir)
43
45
 
44
46
  unless required_pkg_config_package(package_id,
45
- :debian => "libgstreamer0.10-dev",
47
+ :debian => "libgstreamer1.0-dev",
46
48
  :redhat => "gstreamer-devel",
47
49
  :homebrew => "gstreamer",
48
50
  :macports => "gstreamer")
49
51
  exit(false)
50
52
  end
51
- unless required_pkg_config_package("gstreamer-plugins-base-0.10",
52
- :debian => "libgstreamer-plugins-base0.10-dev",
53
- :redhat => "gstreamer-plugins-base-devel",
54
- :homebrew => "gst-plugins-base",
55
- :macports => "gst-plugins-base")
56
- exit(false)
57
- end
58
53
 
59
- have_header("unistd.h")
60
- have_header("io.h")
61
-
62
- if have_library("gstinterfaces-0.10") and
63
- have_header("gst/interfaces/xoverlay.h")
64
- $CFLAGS += " -DHAVE_GST_OVERLAY"
65
- end
66
-
67
- if PKGConfig.have_package("gstreamer-pbutils-0.10")
68
- $CFLAGS += " -DHAVE_GST_PBUTILS"
54
+ unless PKGConfig.have_package("gobject-introspection-1.0")
55
+ exit(false)
69
56
  end
70
57
 
71
58
  create_pkg_config_file("Ruby/GStreamer", package_id)
@@ -78,4 +65,3 @@ if pkg_config_dir.is_a?(String)
78
65
  makefile.puts("pkgconfigdir=#{pkg_config_dir}")
79
66
  end
80
67
  end
81
-
@@ -1,8 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
- * Copyright (C) 2007 Ruby-GNOME2 Project Team
5
- * Copyright (C) 2003, 2004 Laurent Sansonetti <lrz@gnome.org>
3
+ * Copyright (C) 2013 Ruby-GNOME2 Project Team
6
4
  *
7
5
  * This library is free software; you can redistribute it and/or
8
6
  * modify it under the terms of the GNU Lesser General Public
@@ -20,218 +18,108 @@
20
18
  * MA 02110-1301 USA
21
19
  */
22
20
 
23
- #include "rbgst-private.h"
21
+ #include <gst/gst.h>
24
22
 
25
- #define RG_TARGET_NAMESPACE mGst
23
+ #include <rb-gobject-introspection.h>
26
24
 
27
- void Init_gstreamer (void);
25
+ extern void Init_gstreamer (void);
28
26
 
29
- /* Module: Gst
30
- * The GStreamer module.
31
- */
32
- VALUE RG_TARGET_NAMESPACE;
33
-
34
- static void
35
- Init_gst_classes (void)
27
+ static gboolean
28
+ rg_gst_bus_func_p(GIArgInfo *info)
36
29
  {
37
- Init_gst_bin (RG_TARGET_NAMESPACE);
38
- Init_gst_bus(RG_TARGET_NAMESPACE);
39
- Init_gst_caps (RG_TARGET_NAMESPACE);
40
- Init_gst_child_proxy(RG_TARGET_NAMESPACE);
41
- Init_gst_clock (RG_TARGET_NAMESPACE);
42
- Init_gst_clock_entry (RG_TARGET_NAMESPACE);
43
- Init_gst_element (RG_TARGET_NAMESPACE);
44
- Init_gst_elementfactory (RG_TARGET_NAMESPACE);
45
- Init_gst_seek(RG_TARGET_NAMESPACE);
46
- Init_gst_format (RG_TARGET_NAMESPACE);
47
- Init_gst_structure(RG_TARGET_NAMESPACE);
48
- Init_gst_index (RG_TARGET_NAMESPACE);
49
- Init_gst_indexentry (RG_TARGET_NAMESPACE);
50
- Init_gst_indexfactory (RG_TARGET_NAMESPACE);
51
- Init_gst_object (RG_TARGET_NAMESPACE);
52
- Init_gst_pad (RG_TARGET_NAMESPACE);
53
- Init_gst_pad_template(RG_TARGET_NAMESPACE);
54
- Init_gst_ghost_pad(RG_TARGET_NAMESPACE);
55
- Init_gst_parse (RG_TARGET_NAMESPACE);
56
- Init_gst_pipeline (RG_TARGET_NAMESPACE);
57
- Init_gst_plugin (RG_TARGET_NAMESPACE);
58
- Init_gst_plugin_feature(RG_TARGET_NAMESPACE);
59
- Init_gst_querytype (RG_TARGET_NAMESPACE);
60
- Init_gst_registry (RG_TARGET_NAMESPACE);
61
- Init_gst_static_caps(RG_TARGET_NAMESPACE);
62
- Init_gst_static_pad_template(RG_TARGET_NAMESPACE);
63
- Init_gst_systemclock (RG_TARGET_NAMESPACE);
64
- Init_gst_tag (RG_TARGET_NAMESPACE);
65
- Init_gst_tag_setter (RG_TARGET_NAMESPACE);
66
- Init_gst_typefindfactory (RG_TARGET_NAMESPACE);
67
- Init_gst_value(RG_TARGET_NAMESPACE);
68
- Init_gst_xml (RG_TARGET_NAMESPACE);
69
-
70
- Init_gst_mini_object(RG_TARGET_NAMESPACE);
71
- Init_gst_buffer(RG_TARGET_NAMESPACE);
72
- Init_gst_message(RG_TARGET_NAMESPACE);
73
- Init_gst_query(RG_TARGET_NAMESPACE);
74
- Init_gst_event(RG_TARGET_NAMESPACE);
75
-
76
- #if defined(HAVE_GST_OVERLAY)
77
- Init_gst_x_overlay (RG_TARGET_NAMESPACE);
78
- #endif
79
-
80
- #ifdef HAVE_MEDIA_INFO
81
- Init_gst_mediatype (RG_TARGET_NAMESPACE);
82
- #endif
83
-
84
- #ifdef HAVE_GST_PBUTILS
85
- Init_gst_install_plugins_context (RG_TARGET_NAMESPACE);
86
- Init_gst_install_plugins (RG_TARGET_NAMESPACE);
87
- Init_gst_install_plugins_return (RG_TARGET_NAMESPACE);
88
- #endif
89
- }
30
+ GITypeInfo type_info;
31
+ GIBaseInfo *interface_info;
32
+ const gchar *namespace;
33
+ const gchar *name;
34
+ gboolean gst_bus_func_p = FALSE;
35
+
36
+ g_arg_info_load_type(info, &type_info);
37
+ interface_info = g_type_info_get_interface(&type_info);
38
+ namespace = g_base_info_get_namespace(interface_info);
39
+ name = g_base_info_get_name(interface_info);
40
+ if (strcmp(namespace, "Gst") == 0 && strcmp(name, "BusFunc") == 0) {
41
+ gst_bus_func_p = TRUE;
42
+ }
43
+ g_base_info_unref(interface_info);
90
44
 
91
- /*
92
- * Class method: init(*args)
93
- *
94
- * Initializes the GStreamer library (using *args), setting up internal path
95
- * lists, registering built-in elements, and loading standard plugins.
96
- *
97
- * If *args are ommited, GStreamer will be initialized using arguments from the
98
- * Ruby command line.
99
- *
100
- * A RuntimeError exception will be raised if GStreamer could not be initialized.
101
- *
102
- * Returns: always true, or an exception on failure.
103
- */
45
+ return gst_bus_func_p;
46
+ }
104
47
 
105
- static VALUE
106
- rg_s_init (int argc, VALUE * argv, G_GNUC_UNUSED VALUE self)
48
+ static gboolean
49
+ rg_gst_bus_func_callback(GstBus *bus, GstMessage *message, gpointer user_data)
107
50
  {
108
- gint i, gargc;
109
- VALUE argary;
110
- gchar **gargv;
111
- GError *error = NULL;
112
- static gboolean initialized = FALSE;
113
-
114
- if (initialized)
115
- return Qtrue;
116
- initialized = TRUE;
117
-
118
- /*
119
- * Convert arguments in a Ruby array.
120
- * If no arguments are provided, we use the command line ones.
121
- */
122
- rb_scan_args (argc, argv, "01", &argary);
123
-
124
- if (NIL_P (argary)) {
125
- argary = rb_const_get(rb_cObject, rb_intern("ARGV"));
126
- gargc = RARRAY_LEN(argary);
127
- } else {
128
- Check_Type(argary, T_ARRAY);
129
- gargc = RARRAY_LEN(argary);
51
+ RBGICallbackData *callback_data = user_data;
52
+ VALUE rb_keep;
53
+ ID id_call;
54
+
55
+ CONST_ID(id_call, "call");
56
+ rb_keep = rb_funcall(callback_data->rb_callback, id_call, 2,
57
+ GOBJ2RVAL(bus),
58
+ BOXED2RVAL(message, GST_MINI_OBJECT_TYPE(message)));
59
+ if (callback_data->metadata->scope_type == GI_SCOPE_TYPE_ASYNC) {
60
+ rb_gi_callback_data_free(callback_data);
130
61
  }
62
+ return RVAL2CBOOL(rb_keep);
63
+ }
131
64
 
132
- /*
133
- * Fill the gargv array with the provided arguments.
134
- */
135
- gargv = ALLOCA_N (char *, gargc + 1);
136
-
137
- gargv[0] = RVAL2CSTR(rb_argv0);
138
-
139
- for (i = 0; i < gargc; i++) {
140
- if (TYPE (RARRAY_PTR(argary)[i]) == T_STRING) {
141
- gargv[i + 1] = RVAL2CSTR(RARRAY_PTR(argary)[i]);
142
- } else {
143
- gargv[i + 1] = "";
144
- }
65
+ static gpointer
66
+ rg_gst_bus_func_callback_finder(GIArgInfo *info)
67
+ {
68
+ if (!rg_gst_bus_func_p(info)) {
69
+ return NULL;
145
70
  }
146
- gargc++;
147
-
148
- /*
149
- * Now, we can initialize GStreamer.
150
- */
151
- if (!gst_init_check(&gargc, &gargv, &error))
152
- RAISE_GERROR(error);
153
-
154
- /*
155
- * Initialize all included classes
156
- */
157
- Init_gst_classes ();
71
+ return rg_gst_bus_func_callback;
72
+ }
158
73
 
159
- rbgutil_start_callback_dispatch_thread();
74
+ static gboolean
75
+ rg_gst_tag_foreach_func_p(GIArgInfo *info)
76
+ {
77
+ GITypeInfo type_info;
78
+ GIBaseInfo *interface_info;
79
+ const gchar *namespace;
80
+ const gchar *name;
81
+ gboolean gst_tag_foreach_func_p = FALSE;
82
+
83
+ g_arg_info_load_type(info, &type_info);
84
+ interface_info = g_type_info_get_interface(&type_info);
85
+ namespace = g_base_info_get_namespace(interface_info);
86
+ name = g_base_info_get_name(interface_info);
87
+ if (strcmp(namespace, "Gst") == 0 && strcmp(name, "TagForeachFunc") == 0) {
88
+ gst_tag_foreach_func_p = TRUE;
89
+ }
90
+ g_base_info_unref(interface_info);
160
91
 
161
- return Qtrue;
92
+ return gst_tag_foreach_func_p;
162
93
  }
163
94
 
164
- /*
165
- * Class method: version
166
- *
167
- * Gets the version number of the GStreamer library, in an array
168
- * of 3 fixnums, which represent major, minor and macro numbers.
169
- *
170
- * # Prints GStreamer version in a String 'major.minor.macro.nano'
171
- * p Gst.version.join('.')
172
- *
173
- * Returns: an Array of 4 fixnums (major, minor, macro and nano numbers).
174
- */
175
- static VALUE
176
- rg_s_version (G_GNUC_UNUSED VALUE self)
95
+ static void
96
+ rg_gst_tag_foreach_func_callback(const GstTagList *list, const gchar *tag,
97
+ gpointer user_data)
177
98
  {
178
- guint major, minor, micro, nano;
179
-
180
- gst_version(&major, &minor, &micro, &nano);
181
- return rb_ary_new3(4,
182
- INT2NUM(major), INT2NUM(minor),
183
- INT2NUM(micro), INT2NUM(nano));
99
+ RBGICallbackData *callback_data = user_data;
100
+ ID id_call;
101
+
102
+ CONST_ID(id_call, "call");
103
+ rb_funcall(callback_data->rb_callback, id_call, 2,
104
+ BOXED2RVAL(list, GST_MINI_OBJECT_TYPE(list)),
105
+ CSTR2RVAL(tag));
106
+ if (callback_data->metadata->scope_type == GI_SCOPE_TYPE_ASYNC) {
107
+ rb_gi_callback_data_free(callback_data);
108
+ }
184
109
  }
185
110
 
186
- static VALUE
187
- rg_s_check_version_p(G_GNUC_UNUSED VALUE self, VALUE rb_major, VALUE rb_minor, VALUE rb_micro)
111
+ static gpointer
112
+ rg_gst_tag_foreach_func_callback_finder(GIArgInfo *info)
188
113
  {
189
- guint major, minor, micro, nano;
190
-
191
- gst_version(&major, &minor, &micro, &nano);
192
- return CBOOL2RVAL(major > NUM2UINT(rb_major) ||
193
- (major == NUM2UINT(rb_major) &&
194
- minor > NUM2UINT(rb_minor)) ||
195
- (major == NUM2UINT(rb_major) &&
196
- minor == NUM2UINT(rb_minor) &&
197
- micro >= NUM2UINT(rb_micro)));
114
+ if (!rg_gst_tag_foreach_func_p(info)) {
115
+ return NULL;
116
+ }
117
+ return rg_gst_tag_foreach_func_callback;
198
118
  }
199
119
 
200
120
  void
201
121
  Init_gstreamer (void)
202
122
  {
203
- RG_TARGET_NAMESPACE = rb_define_module ("Gst");
204
-
205
- RG_DEF_SMETHOD(init, -1);
206
- RG_DEF_SMETHOD(version, 0);
207
-
208
- /*
209
- * Constant: VERSION_MAJOR
210
- * GStreamer's major version.
211
- */
212
- rb_define_const(RG_TARGET_NAMESPACE, "VERSION_MAJOR", INT2FIX(GST_VERSION_MAJOR));
213
-
214
- /*
215
- * Constant: VERSION_MINOR
216
- * GStreamer's minor version.
217
- */
218
- rb_define_const(RG_TARGET_NAMESPACE, "VERSION_MINOR", INT2FIX(GST_VERSION_MINOR));
219
-
220
- /*
221
- * Constant: VERSION_MICRO
222
- * GStreamer's micro version.
223
- */
224
- rb_define_const(RG_TARGET_NAMESPACE, "VERSION_MICRO", INT2FIX(GST_VERSION_MICRO));
225
-
226
- /*
227
- * Constant: BUILD_VERSION
228
- * GStreamer's build version.
229
- */
230
- rb_define_const(RG_TARGET_NAMESPACE, "BUILD_VERSION",
231
- rb_ary_new3(3,
232
- INT2FIX(GST_VERSION_MAJOR),
233
- INT2FIX(GST_VERSION_MINOR),
234
- INT2FIX(GST_VERSION_MICRO)));
235
-
236
- RG_DEF_SMETHOD_P(check_version, 3);
123
+ rb_gi_callback_register_finder(rg_gst_bus_func_callback_finder);
124
+ rb_gi_callback_register_finder(rg_gst_tag_foreach_func_callback_finder);
237
125
  }
@@ -0,0 +1,20 @@
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 BaseLoader < GObjectIntrospection::Loader
19
+ end
20
+ end
data/lib/gst/bin.rb ADDED
@@ -0,0 +1,32 @@
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 Bin
19
+ alias_method :add_element, :add
20
+ def add_elements(*elements)
21
+ elements.each do |element|
22
+ add_element(element)
23
+ end
24
+ end
25
+ alias_method :add, :add_elements
26
+
27
+ def <<(element)
28
+ add_element(element)
29
+ self
30
+ end
31
+ end
32
+ end
data/lib/gst/bus.rb ADDED
@@ -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 Bus
19
+ alias_method :add_watch_full, :add_watch
20
+ def add_watch(priority=GLib::PRIORITY_DEFAULT, &block)
21
+ add_watch_full(priority, &block)
22
+ end
23
+ end
24
+ end