gstreamer 0.90.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. data/ChangeLog +1157 -0
  2. data/README +33 -0
  3. data/Rakefile +15 -0
  4. data/ext/gstreamer/Makefile +162 -0
  5. data/ext/gstreamer/depend +5 -0
  6. data/ext/gstreamer/extconf.rb +63 -0
  7. data/ext/gstreamer/gst.so +0 -0
  8. data/ext/gstreamer/misc.c +62 -0
  9. data/ext/gstreamer/misc.o +0 -0
  10. data/ext/gstreamer/rbgst-bin.c +466 -0
  11. data/ext/gstreamer/rbgst-bin.o +0 -0
  12. data/ext/gstreamer/rbgst-buffer.c +365 -0
  13. data/ext/gstreamer/rbgst-buffer.o +0 -0
  14. data/ext/gstreamer/rbgst-bus.c +92 -0
  15. data/ext/gstreamer/rbgst-bus.o +0 -0
  16. data/ext/gstreamer/rbgst-caps.c +441 -0
  17. data/ext/gstreamer/rbgst-caps.o +0 -0
  18. data/ext/gstreamer/rbgst-child-proxy.c +33 -0
  19. data/ext/gstreamer/rbgst-child-proxy.o +0 -0
  20. data/ext/gstreamer/rbgst-clock.c +108 -0
  21. data/ext/gstreamer/rbgst-clock.o +0 -0
  22. data/ext/gstreamer/rbgst-element-factory.c +255 -0
  23. data/ext/gstreamer/rbgst-element-factory.o +0 -0
  24. data/ext/gstreamer/rbgst-element.c +1053 -0
  25. data/ext/gstreamer/rbgst-element.o +0 -0
  26. data/ext/gstreamer/rbgst-event.c +351 -0
  27. data/ext/gstreamer/rbgst-event.o +0 -0
  28. data/ext/gstreamer/rbgst-ghost-pad.c +42 -0
  29. data/ext/gstreamer/rbgst-ghost-pad.o +0 -0
  30. data/ext/gstreamer/rbgst-index-factory.c +67 -0
  31. data/ext/gstreamer/rbgst-index-factory.o +0 -0
  32. data/ext/gstreamer/rbgst-message.c +784 -0
  33. data/ext/gstreamer/rbgst-message.o +0 -0
  34. data/ext/gstreamer/rbgst-mini-object.c +220 -0
  35. data/ext/gstreamer/rbgst-mini-object.o +0 -0
  36. data/ext/gstreamer/rbgst-object.c +81 -0
  37. data/ext/gstreamer/rbgst-object.o +0 -0
  38. data/ext/gstreamer/rbgst-pad-template.c +124 -0
  39. data/ext/gstreamer/rbgst-pad-template.o +0 -0
  40. data/ext/gstreamer/rbgst-pad.c +338 -0
  41. data/ext/gstreamer/rbgst-pad.o +0 -0
  42. data/ext/gstreamer/rbgst-pipeline.c +90 -0
  43. data/ext/gstreamer/rbgst-pipeline.o +0 -0
  44. data/ext/gstreamer/rbgst-plugin-feature.c +134 -0
  45. data/ext/gstreamer/rbgst-plugin-feature.o +0 -0
  46. data/ext/gstreamer/rbgst-plugin.c +164 -0
  47. data/ext/gstreamer/rbgst-plugin.o +0 -0
  48. data/ext/gstreamer/rbgst-private.c +89 -0
  49. data/ext/gstreamer/rbgst-private.h +37 -0
  50. data/ext/gstreamer/rbgst-private.o +0 -0
  51. data/ext/gstreamer/rbgst-query.c +289 -0
  52. data/ext/gstreamer/rbgst-query.o +0 -0
  53. data/ext/gstreamer/rbgst-seek.c +36 -0
  54. data/ext/gstreamer/rbgst-seek.o +0 -0
  55. data/ext/gstreamer/rbgst-static-caps.c +49 -0
  56. data/ext/gstreamer/rbgst-static-caps.o +0 -0
  57. data/ext/gstreamer/rbgst-static-pad-template.c +64 -0
  58. data/ext/gstreamer/rbgst-static-pad-template.o +0 -0
  59. data/ext/gstreamer/rbgst-structure.c +300 -0
  60. data/ext/gstreamer/rbgst-structure.o +0 -0
  61. data/ext/gstreamer/rbgst-system-clock.c +45 -0
  62. data/ext/gstreamer/rbgst-system-clock.o +0 -0
  63. data/ext/gstreamer/rbgst-type-find-factory.c +124 -0
  64. data/ext/gstreamer/rbgst-type-find-factory.o +0 -0
  65. data/ext/gstreamer/rbgst-value.c +517 -0
  66. data/ext/gstreamer/rbgst-value.o +0 -0
  67. data/ext/gstreamer/rbgst-x-overlay.c +132 -0
  68. data/ext/gstreamer/rbgst-x-overlay.o +0 -0
  69. data/ext/gstreamer/rbgst.c +279 -0
  70. data/ext/gstreamer/rbgst.h +197 -0
  71. data/ext/gstreamer/rbgst.o +0 -0
  72. data/ext/gstreamer/rbgstclockentry.c +268 -0
  73. data/ext/gstreamer/rbgstclockentry.o +0 -0
  74. data/ext/gstreamer/rbgstformat.c +159 -0
  75. data/ext/gstreamer/rbgstformat.o +0 -0
  76. data/ext/gstreamer/rbgstindex.c +314 -0
  77. data/ext/gstreamer/rbgstindex.o +0 -0
  78. data/ext/gstreamer/rbgstindexentry.c +96 -0
  79. data/ext/gstreamer/rbgstindexentry.o +0 -0
  80. data/ext/gstreamer/rbgstparse.c +66 -0
  81. data/ext/gstreamer/rbgstparse.o +0 -0
  82. data/ext/gstreamer/rbgstquerytype.c +159 -0
  83. data/ext/gstreamer/rbgstquerytype.o +0 -0
  84. data/ext/gstreamer/rbgstregistry.c +278 -0
  85. data/ext/gstreamer/rbgstregistry.o +0 -0
  86. data/ext/gstreamer/rbgsttag.c +111 -0
  87. data/ext/gstreamer/rbgsttag.o +0 -0
  88. data/ext/gstreamer/rbgsttagsetter.c +50 -0
  89. data/ext/gstreamer/rbgsttagsetter.o +0 -0
  90. data/ext/gstreamer/rbgstxml.c +189 -0
  91. data/ext/gstreamer/rbgstxml.o +0 -0
  92. data/ext/gstreamer/ruby-gstreamer.pc +3 -0
  93. data/extconf.rb +49 -0
  94. data/lib/gst.rb +19 -0
  95. data/sample/audio-player.rb +54 -0
  96. data/sample/gst-inspect.rb +417 -0
  97. data/sample/media-type.rb +55 -0
  98. data/sample/media-type2.rb +268 -0
  99. data/sample/ogg-audio-player.rb +54 -0
  100. data/sample/type-find.rb +46 -0
  101. data/sample/video-player.rb +57 -0
  102. data/sample/xml-player.rb +60 -0
  103. data/test/gst-test-utils.rb +18 -0
  104. data/test/run-test.rb +25 -0
  105. data/test/test_bin.rb +167 -0
  106. data/test/test_buffer.rb +174 -0
  107. data/test/test_caps.rb +24 -0
  108. data/test/test_clock.rb +7 -0
  109. data/test/test_element.rb +87 -0
  110. data/test/test_element_factory.rb +28 -0
  111. data/test/test_event.rb +10 -0
  112. data/test/test_index_factory.rb +7 -0
  113. data/test/test_message.rb +191 -0
  114. data/test/test_mini_object.rb +38 -0
  115. data/test/test_object.rb +10 -0
  116. data/test/test_pad.rb +68 -0
  117. data/test/test_plugin.rb +6 -0
  118. data/test/test_plugin_feature.rb +20 -0
  119. data/test/test_seek.rb +17 -0
  120. data/test/test_static_caps.rb +18 -0
  121. data/test/test_static_pad_template.rb +16 -0
  122. data/test/test_structure.rb +159 -0
  123. data/test/test_thread_handling.rb +58 -0
  124. data/test/test_type_find_factory.rb +8 -0
  125. data/test/test_value.rb +69 -0
  126. metadata +208 -0
Binary file
@@ -0,0 +1,132 @@
1
+ /*
2
+ * Copyright (C) 2006 Sjoerd Simons <sjoerd@luon.net>
3
+ * Copyright (C) 2005 Laurent Sansonetti <lrz@gnome.org>
4
+ *
5
+ * This file is part of Ruby/GStreamer.
6
+ *
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.
11
+ *
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
20
+ */
21
+
22
+ #ifdef HAVE_GST_OVERLAY
23
+
24
+ #include "rbgst.h"
25
+ #include <gst/interfaces/xoverlay.h>
26
+
27
+ #define SELF(o) (GST_X_OVERLAY(RVAL2GOBJ(o)))
28
+
29
+ static GQuark xoverlay_xid_data_quark;
30
+
31
+ struct xid_callback_data
32
+ {
33
+ GObject *bus;
34
+ gulong cb_id;
35
+ gulong xid;
36
+ };
37
+
38
+ static void
39
+ bus_sync_func_cb(GstBus *bus, GstMessage *message, gpointer user_data)
40
+ {
41
+ struct xid_callback_data *xid_cb_data;
42
+ GstXOverlay *sink = GST_X_OVERLAY(user_data);
43
+ xid_cb_data = (struct xid_callback_data *)
44
+ g_object_get_qdata(G_OBJECT(sink), xoverlay_xid_data_quark);
45
+
46
+ if (xid_cb_data == NULL) {
47
+ return;
48
+ }
49
+
50
+ if (GST_MESSAGE_TYPE(message) == GST_MESSAGE_ELEMENT) {
51
+ if (message->structure
52
+ && GST_MESSAGE_SRC(message) == GST_OBJECT(sink)
53
+ && strcmp(gst_structure_get_name(message->structure),
54
+ "prepare-xwindow-id") == 0) {
55
+ gst_x_overlay_set_xwindow_id(sink, xid_cb_data->xid);
56
+ }
57
+ }
58
+ }
59
+
60
+ static void
61
+ xid_callback_data_destroy_cb(gpointer data)
62
+ {
63
+ struct xid_callback_data *xid_cb_data = (struct xid_callback_data *)data;
64
+
65
+ if (g_signal_handler_is_connected(xid_cb_data->bus, xid_cb_data->cb_id)) {
66
+ g_signal_handler_disconnect (xid_cb_data->bus, xid_cb_data->cb_id);
67
+ }
68
+ g_slice_free(struct xid_callback_data, data);
69
+ }
70
+
71
+
72
+ static VALUE
73
+ rb_gst_x_overlay_set_xwindow_id_with_buswatch(VALUE self, VALUE bus,
74
+ VALUE x_window_id)
75
+ {
76
+ struct xid_callback_data* xid_cb_data;
77
+ GObject *sink;
78
+
79
+ xid_cb_data = g_slice_new(struct xid_callback_data);
80
+ xid_cb_data->xid = NUM2ULL(x_window_id);
81
+ xid_cb_data->bus = RVAL2GOBJ(bus);
82
+
83
+ sink = RVAL2GOBJ(self);
84
+ g_object_set_qdata_full(sink, xoverlay_xid_data_quark,
85
+ xid_cb_data, xid_callback_data_destroy_cb);
86
+
87
+ gst_bus_enable_sync_message_emission(GST_BUS(xid_cb_data->bus));
88
+ xid_cb_data->cb_id =
89
+ g_signal_connect_object(xid_cb_data->bus, "sync-message",
90
+ G_CALLBACK(bus_sync_func_cb), sink, 0);
91
+ return self;
92
+ }
93
+
94
+ static VALUE
95
+ rb_gst_x_overlay_set_xwindow_id(VALUE self, VALUE x_window_id)
96
+ {
97
+ gst_x_overlay_set_xwindow_id(SELF(self), NUM2ULONG(x_window_id));
98
+ return self;
99
+ }
100
+
101
+ static VALUE
102
+ rb_gst_x_overlay_expose(VALUE self)
103
+ {
104
+ gst_x_overlay_expose(SELF(self));
105
+ return self;
106
+ }
107
+
108
+ static VALUE
109
+ rb_gst_x_overlay_got_xwindow_id(VALUE self, VALUE x_window_id)
110
+ {
111
+ gst_x_overlay_got_xwindow_id(SELF(self), NUM2ULL(x_window_id));
112
+ return self;
113
+ }
114
+
115
+ void
116
+ Init_gst_x_overlay(void)
117
+ {
118
+ VALUE i = G_DEF_INTERFACE(GST_TYPE_X_OVERLAY, "XOverlay", mGst);
119
+
120
+ xoverlay_xid_data_quark =
121
+ g_quark_from_static_string("__rbgst_xoverlay_xid_data_quark__");
122
+
123
+ rb_define_method(i, "set_xwindow_id", rb_gst_x_overlay_set_xwindow_id, 1);
124
+ rb_define_method(i, "expose", rb_gst_x_overlay_expose, 0);
125
+
126
+ rb_define_method(i, "got_xwindow_id", rb_gst_x_overlay_got_xwindow_id, 1);
127
+ rb_define_method(i, "set_xwindow_id_with_buswatch", rb_gst_x_overlay_set_xwindow_id_with_buswatch, 2);
128
+
129
+ G_DEF_SETTERS(i);
130
+ }
131
+
132
+ #endif /* HAVE_GST_OVERLAY */
Binary file
@@ -0,0 +1,279 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2003, 2004 Laurent Sansonetti <lrz@gnome.org>
4
+ * Copyright (C) 2007 Ruby-GNOME2 Project Team
5
+ *
6
+ * This file is part of Ruby/GStreamer.
7
+ *
8
+ * Ruby/GStreamer is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * Ruby/GStreamer is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with Ruby/GStreamer; if not, write to the Free Software
20
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
+ */
22
+
23
+ #include "rbgst.h"
24
+
25
+ /* Module: Gst
26
+ * The GStreamer module.
27
+ */
28
+ VALUE mGst;
29
+
30
+ static void
31
+ Init_gst_classes (void)
32
+ {
33
+ extern void Init_gst_bin (void);
34
+ extern void Init_gst_buffer(void);
35
+ extern void Init_gst_bus(void);
36
+ extern void Init_gst_caps (void);
37
+ extern void Init_gst_child_proxy(void);
38
+ extern void Init_gst_clock (void);
39
+ extern void Init_gst_clock_entry (void);
40
+ extern void Init_gst_element (void);
41
+ extern void Init_gst_elementfactory (void);
42
+ extern void Init_gst_event(void);
43
+ extern void Init_gst_format (void);
44
+ extern void Init_gst_seek(void);
45
+ extern void Init_gst_structure(void);
46
+ extern void Init_gst_index (void);
47
+ extern void Init_gst_indexentry (void);
48
+ extern void Init_gst_indexfactory (void);
49
+ extern void Init_gst_message(void);
50
+ extern void Init_gst_mini_object(void);
51
+ extern void Init_gst_object (void);
52
+ extern void Init_gst_pad (void);
53
+ extern void Init_gst_pad_template(void);
54
+ extern void Init_gst_ghost_pad(void);
55
+ extern void Init_gst_parse (void);
56
+ extern void Init_gst_pipeline (void);
57
+ extern void Init_gst_plugin (void);
58
+ extern void Init_gst_plugin_feature (void);
59
+ extern void Init_gst_query(void);
60
+ extern void Init_gst_querytype (void);
61
+ extern void Init_gst_registry (void);
62
+ extern void Init_gst_registry_pool (void);
63
+ extern void Init_gst_scheduler (void);
64
+ extern void Init_gst_schedulerfactory (void);
65
+ extern void Init_gst_static_caps(void);
66
+ extern void Init_gst_static_pad_template(void);
67
+ extern void Init_gst_systemclock (void);
68
+ extern void Init_gst_tag (void);
69
+ extern void Init_gst_tag_setter (void);
70
+ extern void Init_gst_thread (void);
71
+ extern void Init_gst_typefindfactory (void);
72
+ extern void Init_gst_value(void);
73
+ extern void Init_gst_xml (void);
74
+
75
+ #if defined(HAVE_GST_OVERLAY)
76
+ extern void Init_gst_x_overlay (void);
77
+ #endif
78
+
79
+ #if defined(HAVE_MEDIA_INFO)
80
+ extern void Init_gst_mediatype (void);
81
+ #endif
82
+
83
+ Init_gst_bin ();
84
+ Init_gst_bus();
85
+ Init_gst_caps ();
86
+ Init_gst_child_proxy();
87
+ Init_gst_clock ();
88
+ Init_gst_clock_entry ();
89
+ Init_gst_element ();
90
+ Init_gst_elementfactory ();
91
+ Init_gst_seek();
92
+ Init_gst_format ();
93
+ Init_gst_structure();
94
+ Init_gst_index ();
95
+ Init_gst_indexentry ();
96
+ Init_gst_indexfactory ();
97
+ Init_gst_object ();
98
+ Init_gst_pad ();
99
+ Init_gst_pad_template();
100
+ Init_gst_ghost_pad();
101
+ Init_gst_parse ();
102
+ Init_gst_pipeline ();
103
+ Init_gst_plugin ();
104
+ Init_gst_plugin_feature();
105
+ Init_gst_querytype ();
106
+ Init_gst_registry ();
107
+ Init_gst_static_caps();
108
+ Init_gst_static_pad_template();
109
+ Init_gst_systemclock ();
110
+ Init_gst_tag ();
111
+ Init_gst_tag_setter ();
112
+ Init_gst_typefindfactory ();
113
+ Init_gst_value();
114
+ Init_gst_xml ();
115
+
116
+ Init_gst_mini_object();
117
+ Init_gst_buffer();
118
+ Init_gst_message();
119
+ Init_gst_query();
120
+ Init_gst_event();
121
+
122
+ #if defined(HAVE_GST_OVERLAY)
123
+ Init_gst_x_overlay ();
124
+ #endif
125
+
126
+ #ifdef HAVE_MEDIA_INFO
127
+ Init_gst_mediatype ();
128
+ #endif
129
+ }
130
+
131
+ /*
132
+ * Class method: init(*args)
133
+ *
134
+ * Initializes the GStreamer library (using *args), setting up internal path
135
+ * lists, registering built-in elements, and loading standard plugins.
136
+ *
137
+ * If *args are ommited, GStreamer will be initialized using arguments from the
138
+ * Ruby command line.
139
+ *
140
+ * A RuntimeError exception will be raised if GStreamer could not be initialized.
141
+ *
142
+ * Returns: always true, or an exception on failure.
143
+ */
144
+
145
+ static VALUE
146
+ rb_gst_init (int argc, VALUE * argv, VALUE self)
147
+ {
148
+ gint i, gargc;
149
+ VALUE argary;
150
+ gchar **gargv;
151
+ GError *error = NULL;
152
+ static gboolean initialized = FALSE;
153
+
154
+ if (initialized)
155
+ return Qtrue;
156
+ initialized = TRUE;
157
+
158
+ /*
159
+ * Convert arguments in a Ruby array.
160
+ * If no arguments are provided, we use the command line ones.
161
+ */
162
+ rb_scan_args (argc, argv, "01", &argary);
163
+
164
+ if (NIL_P (argary)) {
165
+ argary = rb_const_get(rb_cObject, rb_intern("ARGV"));
166
+ gargc = RARRAY_LEN(argary);
167
+ } else {
168
+ Check_Type(argary, T_ARRAY);
169
+ gargc = RARRAY_LEN(argary);
170
+ }
171
+
172
+ /*
173
+ * Fill the gargv array with the provided arguments.
174
+ */
175
+ gargv = ALLOCA_N (char *, gargc + 1);
176
+
177
+ gargv[0] = RVAL2CSTR(rb_argv0);
178
+
179
+ for (i = 0; i < gargc; i++) {
180
+ if (TYPE (RARRAY_PTR(argary)[i]) == T_STRING) {
181
+ gargv[i + 1] = RVAL2CSTR(RARRAY_PTR(argary)[i]);
182
+ } else {
183
+ gargv[i + 1] = "";
184
+ }
185
+ }
186
+ gargc++;
187
+
188
+ /*
189
+ * Now, we can initialize GStreamer.
190
+ */
191
+ if (!gst_init_check(&gargc, &gargv, &error))
192
+ RAISE_GERROR(error);
193
+
194
+ /*
195
+ * Initialize all included classes
196
+ */
197
+ Init_gst_classes ();
198
+
199
+ rbgutil_start_callback_dispatch_thread();
200
+
201
+ return Qtrue;
202
+ }
203
+
204
+ /*
205
+ * Class method: version
206
+ *
207
+ * Gets the version number of the GStreamer library, in an array
208
+ * of 3 fixnums, which represent major, minor and macro numbers.
209
+ *
210
+ * # Prints GStreamer version in a String 'major.minor.macro.nano'
211
+ * p Gst.version.join('.')
212
+ *
213
+ * Returns: an Array of 4 fixnums (major, minor, macro and nano numbers).
214
+ */
215
+ static VALUE
216
+ rb_gst_version (VALUE self)
217
+ {
218
+ guint major, minor, micro, nano;
219
+
220
+ gst_version(&major, &minor, &micro, &nano);
221
+ return rb_ary_new3(4,
222
+ INT2NUM(major), INT2NUM(minor),
223
+ INT2NUM(micro), INT2NUM(nano));
224
+ }
225
+
226
+ static VALUE
227
+ rbgst_m_check_version(VALUE self, VALUE rb_major, VALUE rb_minor, VALUE rb_micro)
228
+ {
229
+ guint major, minor, micro, nano;
230
+
231
+ gst_version(&major, &minor, &micro, &nano);
232
+ return CBOOL2RVAL(major > NUM2UINT(rb_major) ||
233
+ (major == NUM2UINT(rb_major) &&
234
+ minor > NUM2UINT(rb_minor)) ||
235
+ (major == NUM2UINT(rb_major) &&
236
+ minor == NUM2UINT(rb_minor) &&
237
+ micro >= NUM2UINT(rb_micro)));
238
+ }
239
+
240
+
241
+ void
242
+ Init_gst (void)
243
+ {
244
+ mGst = rb_define_module ("Gst");
245
+
246
+ rb_define_module_function(mGst, "init", rb_gst_init, -1);
247
+ rb_define_module_function(mGst, "version", rb_gst_version, 0);
248
+
249
+ /*
250
+ * Constant: VERSION_MAJOR
251
+ * GStreamer's major version.
252
+ */
253
+ rb_define_const(mGst, "VERSION_MAJOR", INT2FIX(GST_VERSION_MAJOR));
254
+
255
+ /*
256
+ * Constant: VERSION_MINOR
257
+ * GStreamer's minor version.
258
+ */
259
+ rb_define_const(mGst, "VERSION_MINOR", INT2FIX(GST_VERSION_MINOR));
260
+
261
+ /*
262
+ * Constant: VERSION_MICRO
263
+ * GStreamer's micro version.
264
+ */
265
+ rb_define_const(mGst, "VERSION_MICRO", INT2FIX(GST_VERSION_MICRO));
266
+
267
+
268
+ /*
269
+ * Constant: BUILD_VERSION
270
+ * GStreamer's build version.
271
+ */
272
+ rb_define_const(mGst, "BUILD_VERSION",
273
+ rb_ary_new3(3,
274
+ INT2FIX(GST_VERSION_MAJOR),
275
+ INT2FIX(GST_VERSION_MINOR),
276
+ INT2FIX(GST_VERSION_MICRO)));
277
+
278
+ rb_define_module_function(mGst, "check_version?", rbgst_m_check_version, 3);
279
+ }
@@ -0,0 +1,197 @@
1
+ /*
2
+ *
3
+ * Copyright (C) 2004 Ruby-GNOME2 Project
4
+ * Copyright (C) 2003, 2004 Laurent Sansonetti <lrz@gnome.org>
5
+ *
6
+ * This file is part of Ruby/GStreamer.
7
+ *
8
+ * Ruby/GStreamer is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * Ruby/GStreamer is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with Ruby/GStreamer; if not, write to the Free Software
20
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
+ */
22
+
23
+ #ifndef __RBGST_H_
24
+ #define __RBGST_H_
25
+
26
+ #include <ruby.h>
27
+ #include <gst/gst.h>
28
+ #include <gst/gsttypefind.h>
29
+
30
+ #include <rbglib.h>
31
+ #include <rbgobject.h>
32
+
33
+ /* Gst module */
34
+ extern VALUE mGst;
35
+
36
+ extern VALUE rb_cGstMiniObject;
37
+
38
+ #define RBGST_INITIALIZE(obj,gstobj) \
39
+ (rbgst_initialize_gstobject(obj, GST_OBJECT(gstobj)))
40
+
41
+ #define GST_EVENT_MASK(o) ((GstEventMask *) o)
42
+ #define GST_FORMAT2(o) ((GstFormat *) o)
43
+ #define GST_INDEX_ENTRY(o) ((GstIndexEntry *) o)
44
+ #define GST_QUERY_TYPE2(o) ((GstQueryType *) o)
45
+ #define GST_TYPE(o) ((GstType *) o)
46
+
47
+ #define GST_TYPE_CLOCK_ENTRY (gst_clock_entry_get_type())
48
+ #define GST_TYPE_EVENT_MASK (gst_event_mask_get_type())
49
+ #define GST_TYPE_FORMAT2 (gst_format_get_type2())
50
+ #define GST_TYPE_QUERY_TYPE2 (gst_query_type_get_type2())
51
+ #define GST_TYPE_TYPE (gst_type_get_type())
52
+
53
+ #define RVAL2GST_OBJ(obj) (GST_OBJECT(RVAL2GOBJ(obj)))
54
+ #define GST_OBJ2RVAL(obj) (GOBJ2RVAL(obj))
55
+ #define RVAL2GST_MINI_OBJ(obj) (GST_MINI_OBJECT(RVAL2GOBJ(obj)))
56
+ #define RVAL2GST_BUF(obj) (GST_BUFFER(RVAL2GOBJ(obj)))
57
+ #define RVAL2GST_MSG(obj) (GST_MESSAGE(RVAL2GOBJ(obj)))
58
+ #define RVAL2GST_ELEMENT(obj) (GST_ELEMENT(RVAL2GOBJ(obj)))
59
+ #define RVAL2GST_EVENT(obj) (GST_EVENT(RVAL2GOBJ(obj)))
60
+ #define GST_ELEMENT2RVAL(obj) (GOBJ2RVAL(obj))
61
+ #define RVAL2GST_ELEMENT_FACTORY(obj) \
62
+ (GST_ELEMENT_FACTORY(RVAL2GOBJ(obj)))
63
+ #define RVAL2GST_INDEX_FACTORY(obj) \
64
+ (GST_INDEX_FACTORY(RVAL2GOBJ(obj)))
65
+ #define RVAL2GST_TYPE_FIND_FACTORY(obj) \
66
+ (GST_TYPE_FIND_FACTORY(RVAL2GOBJ(obj)))
67
+ #define RVAL2GST_PLUGIN_FEATURE(obj) \
68
+ (GST_PLUGIN_FEATURE(RVAL2GOBJ(obj)))
69
+ #define RVAL2GST_PLUGIN(obj) (GST_PLUGIN(RVAL2GOBJ(obj)))
70
+
71
+ #define RVAL2GST_CAPS(obj) (GST_CAPS(RVAL2BOXED(obj, GST_TYPE_CAPS)))
72
+ #define GST_CAPS2RVAL(obj) (BOXED2RVAL(obj, GST_TYPE_CAPS))
73
+ #define GST_CAPS2RVAL_UNREF(obj) \
74
+ (rbgst_ruby_object_from_gst_caps_with_unref((obj)))
75
+ #define RVAL2GST_STATIC_CAPS(obj) ((GstStaticCaps *)RVAL2GPTR(obj))
76
+ #define GST_STATIC_CAPS2RVAL(obj) (GPTR2RVAL(obj, GST_TYPE_STATIC_CAPS))
77
+
78
+ #define RVAL2GST_STATE(obj) (RVAL2GENUM(obj, GST_TYPE_STATE))
79
+ #define GST_STATE2RVAL(obj) (GENUM2RVAL(obj, GST_TYPE_STATE))
80
+ #define RVAL2GST_FORMAT(obj) (RVAL2GENUM(obj, GST_TYPE_FORMAT))
81
+ #define GST_FORMAT2RVAL(obj) (GENUM2RVAL(obj, GST_TYPE_FORMAT))
82
+
83
+ #define RVAL2GST_STRUCT(obj) (GST_STRUCTURE(RVAL2BOXED(obj, GST_TYPE_STRUCTURE)))
84
+ #define GST_STRUCT2RVAL(obj) (BOXED2RVAL(obj, GST_TYPE_STRUCTURE))
85
+
86
+ #define RVAL2GST_PAD(obj) (GST_PAD(RVAL2GOBJ(obj)))
87
+ #define GST_PAD2RVAL(obj) (GOBJ2RVAL(obj))
88
+ #define GST_PAD2RVAL_UNREF(obj) (GOBJ2RVAL_UNREF(obj))
89
+
90
+ #define RVAL2GST_PAD_TEMPLATE(obj) (GST_PAD_TEMPLATE(RVAL2GOBJ(obj)))
91
+ #define GST_PAD_TEMPLATE2RVAL(obj) (GOBJ2RVAL(obj))
92
+ #define RVAL2GST_STATIC_PAD_TEMPLATE(obj) ((GstStaticPadTemplate *)(RVAL2GPTR(obj)))
93
+ #define GST_STATIC_PAD_TEMPLATE2RVAL(obj) (GPTR2RVAL(obj, GST_TYPE_STATIC_PAD_TEMPLATE))
94
+
95
+ #define RVAL2GST_BUS(obj) (GST_BUS(RVAL2GOBJ(obj)))
96
+ #define GST_BUS2RVAL(obj) (GOBJ2RVAL(obj))
97
+ #define GST_BUS2RVAL_UNREF(obj) (GOBJ2RVAL_UNREF(obj))
98
+ #define RVAL2GST_PIPELINE(obj) (GST_PIPELINE(RVAL2GOBJ(obj)))
99
+ #define RVAL2GST_CLOCK(obj) (GST_CLOCK(RVAL2GOBJ(obj)))
100
+ #define GST_CLOCK2RVAL(obj) (GOBJ2RVAL(obj))
101
+
102
+ #define RVAL2GST_BIN(obj) (GST_BIN(RVAL2GOBJ(obj)))
103
+ #define GST_BIN2RVAL(obj) (GOBJ2RVAL(obj))
104
+
105
+ #define RVAL2GST_QUERY(obj) (GST_QUERY(RVAL2GOBJ(obj)))
106
+ #define GST_QUERY2RVAL(obj) (GOBJ2RVAL(obj))
107
+
108
+
109
+
110
+ #define RGST_BIN(o) (GST_BIN(RVAL2GOBJ(o)))
111
+ #define RGST_CAPS(o) (GST_CAPS(RVAL2BOXED(o, GST_TYPE_CAPS)))
112
+ #define RGST_CLOCK_ENTRY(o) (GST_CLOCK_ENTRY(RVAL2BOXED(o, GST_TYPE_CLOCK_ENTRY)))
113
+ #define RGST_ELEMENT(o) (GST_ELEMENT(RVAL2GOBJ(o)))
114
+ #define RGST_ELEMENT_FACTORY(o) (GST_ELEMENT_FACTORY(RVAL2GOBJ(o)))
115
+ #define RGST_EVENT(o) (GST_EVENT(RVAL2BOXED(o, GST_TYPE_EVENT)))
116
+ #define RGST_EVENT_MASK(o) (GST_EVENT_MASK(RVAL2BOXED(o, GST_TYPE_EVENT_MASK)))
117
+ #define RGST_FORMAT(o) (GST_FORMAT2(RVAL2BOXED(o, GST_TYPE_FORMAT2)))
118
+ #define RGST_INDEX(o) (GST_INDEX(RVAL2GOBJ(o)))
119
+ #define RGST_INDEX_ENTRY(o) (GST_INDEX_ENTRY(RVAL2BOXED(o, GST_TYPE_INDEX_ENTRY)))
120
+ #define RGST_INDEX_FACTORY(o) (GST_INDEX_FACTORY(RVAL2GOBJ(o)))
121
+ #define RGST_OBJECT(o) (GST_OBJECT(RVAL2GOBJ(o)))
122
+ #define RGST_PAD(o) (GST_PAD(RVAL2GOBJ(o)))
123
+ #define RGST_PAD_TEMPLATE(o) (GST_PAD_TEMPLATE(RVAL2GOBJ(o)))
124
+ #define RGST_PIPELINE(o) (RVAL2GST_PIPELINE(o))
125
+ #define RGST_PLUGIN(o) (GST_PLUGIN(RVAL2GOBJ(o)))
126
+ #define RGST_PLUGIN_FEATURE(o) (GST_PLUGIN_FEATURE(RVAL2GOBJ(o)))
127
+ #define RGST_QUERY_TYPE(o) (GST_QUERY_TYPE2(RVAL2BOXED(o, GST_TYPE_QUERY_TYPE2)))
128
+ #define RGST_REGISTRY(o) (GST_REGISTRY(RVAL2GOBJ(o)))
129
+ #define RGST_SCHEDULER(o) (GST_SCHEDULER(RVAL2GOBJ(o)))
130
+ #define RGST_SCHEDULER_FACTORY(o) (GST_SCHEDULER_FACTORY(RVAL2GOBJ(o)))
131
+ #define RGST_TAG_SETTER(o) (GST_TAG_SETTER(RVAL2GOBJ(o)))
132
+ #define RGST_THREAD(o) (GST_THREAD(RVAL2GOBJ(o)))
133
+ #define RGST_TYPE_FIND_FACTORY(o) (GST_TYPE_FIND_FACTORY(RVAL2GOBJ(o)))
134
+ #define RGST_XML(o) (GST_XML(RVAL2GOBJ(o)))
135
+
136
+ #define RGST_GOBJ_NEW(o) (rbgst_new_gstobject(o))
137
+ #define GOBJ2RGST(obj) (RGST_GOBJ_NEW(obj))
138
+
139
+ #define GST_MINI_OBJ2RVAL(obj) (rbgst_mini_object_to_ruby_object(obj))
140
+
141
+ #define RGST_BIN_NEW(o) (RGST_GOBJ_NEW(GST_BIN(o)))
142
+ #define RGST_CAPS_NEW(o) (BOXED2RVAL(GST_CAPS(o), GST_TYPE_CAPS))
143
+ #define RGST_CLOCK_NEW(o) (RGST_GOBJ_NEW(GST_CLOCK(o)))
144
+ #define RGST_CLOCK_ENTRY_NEW(o) (BOXED2RVAL(GST_CLOCK_ENTRY(o), GST_TYPE_CLOCK_ENTRY))
145
+ #define RGST_ELEMENT_FACTORY_NEW(o) (RGST_GOBJ_NEW(GST_ELEMENT_FACTORY(o)))
146
+ #define RGST_ELEMENT_NEW(o) (RGST_GOBJ_NEW(GST_ELEMENT(o)))
147
+ #define RGST_EVENT_NEW(o) (BOXED2RVAL(GST_EVENT(o), GST_TYPE_EVENT))
148
+ #define RGST_EVENT_MASK_NEW(o) (BOXED2RVAL(GST_EVENT_MASK(o), GST_TYPE_EVENT_MASK))
149
+ #define RGST_FORMAT_NEW(o) (BOXED2RVAL(GST_FORMAT2(o), GST_TYPE_FORMAT2))
150
+ #define RGST_INDEX_NEW(o) (RGST_GOBJ_NEW(GST_INDEX(o)))
151
+ #define RGST_INDEX_ENTRY_NEW(o) (BOXED2RVAL(GST_INDEX_ENTRY(o), GST_TYPE_INDEX_ENTRY))
152
+ #define RGST_INDEX_FACTORY_NEW(o) (RGST_GOBJ_NEW(GST_INDEX_FACTORY(o)))
153
+ #define RGST_OBJECT_NEW(o) (RGST_GOBJ_NEW(GST_OBJECT(o)))
154
+ #define RGST_PAD_NEW(o) (RGST_GOBJ_NEW(GST_PAD(o)))
155
+ #define RGST_PAD_TEMPLATE_NEW(o) (RGST_GOBJ_NEW(GST_PAD_TEMPLATE(o)))
156
+ #define RGST_PIPELINE_NEW(o) (RGST_GOBJ_NEW(GST_PIPELINE(o)))
157
+ #define RGST_PLUGIN_NEW(o) (RGST_GOBJ_NEW(GST_PLUGIN(o)))
158
+ #define RGST_PLUGIN_FEATURE_NEW(o) (RGST_GOBJ_NEW(GST_PLUGIN_FEATURE(o)))
159
+ #define RGST_QUERY_TYPE_NEW(o) (BOXED2RVAL(GST_QUERY_TYPE2(o), GST_TYPE_QUERY_TYPE2))
160
+ #define RGST_REGISTRY_NEW(o) (RGST_GOBJ_NEW(GST_REGISTRY(o)))
161
+ #define RGST_SCHEDULER_NEW(o) (RGST_GOBJ_NEW(GST_SCHEDULER(o)))
162
+ #define RGST_SCHEDULER_FACTORY_NEW(o) (RGST_GOBJ_NEW(GST_SCHEDULER_FACTORY(o)))
163
+ #define RGST_SYSTEM_CLOCK_NEW(o) (RGST_GOBJ_NEW(GST_SYSTEM_CLOCK(o)))
164
+ #define RGST_THREAD_NEW(o) (RGST_GOBJ_NEW(GST_THREAD(o)))
165
+ #define RGST_TYPE_FIND_FACTORY_NEW(o) (RGST_GOBJ_NEW(GST_TYPE_FIND_FACTORY(o)))
166
+
167
+ #define RGST_BUS2RVAL(obj) (GOBJ2RGST(obj))
168
+ #define GST_MSG2RVAL(obj) (GOBJ2RGST(obj))
169
+
170
+ extern VALUE rbgst_ruby_object_from_gst_caps_with_unref(GstCaps *caps);
171
+
172
+ GType gst_clock_entry_get_type ();
173
+ GType gst_event_mask_get_type ();
174
+ GType gst_format_get_type2 ();
175
+ GType gst_query_type_get_type2 ();
176
+ GType gst_type_get_type ();
177
+
178
+
179
+ /* misc.c interface */
180
+ void rbgst_initialize_gstobject (VALUE obj, GstObject * gstobj);
181
+ VALUE rbgst_new_gstobject (void *);
182
+ VALUE rb_str_new_with_format (char *fmt, ...);
183
+ VALUE rb_ary_yield (VALUE arr);
184
+
185
+ /* implemented in rbgstpluginfeature.c */
186
+ gboolean is_valid_pluginfeature_type (const GType type);
187
+ VALUE instanciate_pluginfeature (GstPluginFeature * feature);
188
+
189
+ /* implemented in rbgst-structure.c */
190
+ VALUE rbgst_structure_to_hash(GstStructure *structure);
191
+ GstStructure *rbgst_hash_to_structure(VALUE hash);
192
+ GstStructure *rbgst_hash_to_structure_with_name(VALUE hash, const char *name);
193
+
194
+
195
+ #define GST_TAG_LIST_STRUCTURE_NAME "taglist"
196
+
197
+ #endif /* __RBGST_H_ */