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/ext/gstreamer/misc.c DELETED
@@ -1,63 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
- * Copyright (C) 2003, 2004 Laurent Sansonetti <lrz@gnome.org>
5
- *
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.
10
- *
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.
15
- *
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
20
- */
21
-
22
- #include "rbgst-private.h"
23
-
24
- VALUE
25
- rb_str_new_with_format (char *fmt, ...)
26
- {
27
- char buf[1000];
28
- va_list ap;
29
-
30
- va_start (ap, fmt);
31
- vsnprintf (buf, sizeof buf, fmt, ap);
32
- va_end (ap);
33
- return CSTR2RVAL (buf);
34
- }
35
-
36
- VALUE
37
- rb_ary_yield (VALUE arr)
38
- {
39
- if (rb_block_given_p () == Qfalse)
40
- rb_raise (rb_eArgError, "No block given");
41
- rb_ary_each (arr);
42
- return Qnil;
43
- }
44
-
45
- VALUE
46
- rbgst_new_gstobject (void *o)
47
- {
48
- GType gtype = G_OBJECT_TYPE (o);
49
- const gchar *gtypename = g_type_name (gtype);
50
- if (strncmp (gtypename, "Gst", 3) == 0)
51
- gtypename += 3;
52
- if (!rb_const_defined_at (mGst, rb_intern (gtypename)))
53
- G_DEF_CLASS (gtype, gtypename, mGst);
54
- return GOBJ2RVAL (o);
55
- }
56
-
57
- void
58
- rbgst_initialize_gstobject(VALUE obj, GstObject *gstobj)
59
- {
60
- gstobj = gst_object_ref (gstobj);
61
- gst_object_sink (gstobj);
62
- G_INITIALIZE (obj, gstobj);
63
- }
@@ -1,456 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
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>
6
- *
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.
11
- *
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.
16
- *
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
21
- */
22
-
23
- #include "rbgst-private.h"
24
-
25
- #define RG_TARGET_NAMESPACE cBin
26
- #define SELF(self) RVAL2GST_BIN(self)
27
-
28
- /* Class: Gst::Bin
29
- * Base container element.
30
- */
31
-
32
- /*
33
- * Class method: new(name=nil)
34
- * name: a name for the bin.
35
- *
36
- * Constructs a new Gst::Bin object.
37
- *
38
- * If element name is ommited (or nil), then the bin will receive a guaranteed
39
- * unique name, consisting of the "bin" string and a number.
40
- * If name is given, it will be given the name supplied.
41
- *
42
- * Returns: a newly allocated Gst::Bin object.
43
- */
44
- static VALUE
45
- rg_initialize(int argc, VALUE *argv, VALUE self)
46
- {
47
- GstElement *bin;
48
- VALUE name;
49
-
50
- rb_scan_args(argc, argv, "01", &name);
51
-
52
- bin = gst_bin_new(RVAL2CSTR_ACCEPT_NIL(name));
53
- if (bin)
54
- RBGST_INITIALIZE(self, bin);
55
- return Qnil;
56
- }
57
-
58
- /*
59
- * Method: size
60
- *
61
- * Returns: the number of elements in the container.
62
- */
63
- static VALUE
64
- rg_size(VALUE self)
65
- {
66
- return INT2NUM(GST_BIN_NUMCHILDREN(SELF(self)));
67
- }
68
-
69
- /*
70
- * Method: children(interface=nil)
71
- * interface: an interface (Ruby class).
72
- *
73
- * Returns: If interface is nil, an array of all
74
- * Gst::Element objects in the container. Otherwise, an
75
- * array of Gst::Element objects in the container that
76
- * implements the interface.
77
- */
78
- static VALUE
79
- rg_children(int argc, VALUE *argv, VALUE self)
80
- {
81
- VALUE children, iface;
82
-
83
- rb_scan_args(argc, argv, "01", &iface);
84
-
85
- if (NIL_P(iface)) {
86
- const GList *node;
87
- children = rb_ary_new();
88
- for (node = GST_BIN_CHILDREN(SELF(self));
89
- node;
90
- node = g_list_next(node)) {
91
- rb_ary_push(children, GST_ELEMENT2RVAL(node->data));
92
- }
93
- } else {
94
- GstIterator *iter;
95
- iter = gst_bin_iterate_all_by_interface(SELF(self),
96
- CLASS2GTYPE(iface));
97
- children = _rbgst_collect_elements(iter);
98
- }
99
-
100
- return children;
101
- }
102
-
103
- /*
104
- * Method: children_recurse()
105
- *
106
- * Returns: an array of all Gst::Element objects in the container and child
107
- * bins.
108
- */
109
- static VALUE
110
- rg_children_recurse(VALUE self)
111
- {
112
- GstIterator *iter;
113
- VALUE children;
114
-
115
- iter = gst_bin_iterate_recurse(SELF(self));
116
- children = _rbgst_collect_elements(iter);
117
-
118
- return children;
119
- }
120
-
121
- static VALUE
122
- rg_children_cookie(VALUE self)
123
- {
124
- return UINT2NUM(GST_BIN_CHILDREN_COOKIE(SELF(self)));
125
- }
126
-
127
- static VALUE
128
- rg_child_bus(VALUE self)
129
- {
130
- return GST_BUS2RVAL(SELF(self)->child_bus);
131
- }
132
-
133
- static VALUE
134
- rg_messages(VALUE self)
135
- {
136
- GList *node;
137
- VALUE messages;
138
-
139
- messages = rb_ary_new();
140
- for (node = SELF(self)->messages; node; node = g_list_next(node)) {
141
- rb_ary_push(messages, GST_MSG2RVAL(node->data));
142
- }
143
-
144
- return messages;
145
- }
146
-
147
- static VALUE
148
- rg_polling_p(VALUE self)
149
- {
150
- return CBOOL2RVAL(SELF(self)->polling);
151
- }
152
-
153
- static VALUE
154
- rg_clock_dirty_p(VALUE self)
155
- {
156
- return CBOOL2RVAL(SELF(self)->clock_dirty);
157
- }
158
-
159
- /*
160
- * Method: provided_clock
161
- *
162
- * Gets the current clock of the (scheduler of the) bin,
163
- * as a Gst::Clock object.
164
- *
165
- * Returns: a Gst::Clock object, or nil.
166
- */
167
- static VALUE
168
- rg_provided_clock(VALUE self)
169
- {
170
- return GST_CLOCK2RVAL(SELF(self)->provided_clock);
171
- }
172
-
173
- /*
174
- * Method: provided_clock=(clock)
175
- * clock: a Gst::Clock.
176
- *
177
- * Forces the bin to use the given clock. Use nil to force it
178
- * to use no clock at all.
179
- *
180
- * Returns: self.
181
- */
182
- static VALUE
183
- rg_set_provided_clock(VALUE self, VALUE clock)
184
- {
185
- GstBin *bin;
186
-
187
- bin = SELF(self);
188
- if (bin->provided_clock)
189
- g_object_unref(bin->provided_clock);
190
-
191
- bin->provided_clock = RVAL2GST_CLOCK(clock);
192
- if (bin->provided_clock)
193
- g_object_ref(bin->provided_clock);
194
-
195
- return self;
196
- }
197
-
198
- static VALUE
199
- rg_clock_provider(VALUE self)
200
- {
201
- return GST_ELEMENT2RVAL(SELF(self)->clock_provider);
202
- }
203
-
204
- /*
205
- * Method: <<(element)
206
- * element: a Gst::Element object.
207
- *
208
- * Adds a Gst::Element object to the bin.
209
- *
210
- * Returns: self.
211
- */
212
- static VALUE
213
- rg_operator_add(VALUE self, VALUE element)
214
- {
215
- VALUE klass = GTYPE2CLASS(GST_TYPE_ELEMENT);
216
-
217
- if (!RVAL2CBOOL(rb_obj_is_kind_of(element, klass))) {
218
- rb_raise(rb_eTypeError, "Gst::Element expected");
219
- }
220
- gst_bin_add(SELF(self), RVAL2GST_ELEMENT(element));
221
- G_CHILD_ADD(self, element);
222
- return self;
223
- }
224
-
225
- /*
226
- * Method: add(*elements)
227
- * elements: a list of Gst::Element objects.
228
- *
229
- * Adds one or more Gst::Element objects to the bin.
230
- *
231
- * Returns: nil.
232
- */
233
- static VALUE
234
- rg_add(int argc, VALUE *argv, VALUE self)
235
- {
236
- int i;
237
-
238
- for (i = 0; i < argc; i++) {
239
- rg_operator_add(self, argv[i]);
240
- }
241
- return Qnil;
242
- }
243
-
244
- /*
245
- * Method: remove(*elements)
246
- * elements: a list of Gst::Element objects.
247
- *
248
- * Removes one or more Gst::Element objects from the bin, unparenting
249
- * as well.
250
- *
251
- * Returns: nil.
252
- */
253
- static VALUE
254
- rg_remove(int argc, VALUE *argv, VALUE self)
255
- {
256
- int i;
257
- GstBin *bin;
258
-
259
- bin = SELF(self);
260
- for (i = 0; i < argc; i++) {
261
- G_CHILD_REMOVE(self, argv[i]);
262
- gst_bin_remove(bin, RVAL2GST_ELEMENT(argv[i]));
263
- }
264
- return Qnil;
265
- }
266
-
267
- /*
268
- * Method: clear
269
- *
270
- * Removes all Gst::Element objects in the bin.
271
- *
272
- * Returns: nil.
273
- */
274
- static VALUE
275
- rg_clear(VALUE self)
276
- {
277
- GstBin *bin;
278
- GList *node, *children;
279
-
280
- bin = SELF(self);
281
- children = g_list_copy(GST_BIN_CHILDREN(bin));
282
- for (node = children; node; node = g_list_next(node)) {
283
- gst_bin_remove(bin, node->data);
284
- }
285
- g_list_free(children);
286
- return Qnil;
287
- }
288
-
289
- /*
290
- * Method: each(interface=nil) {|element| ...}
291
- *
292
- * Calls the block for each element in the bin, passing a reference to
293
- * the Gst::Element as parameter. If the interface isn't nil,
294
- * iterated elements should implement the interface.
295
- *
296
- * Returns: always nil.
297
- */
298
- static VALUE
299
- rg_each(int argc, VALUE *argv, VALUE self)
300
- {
301
- return rb_ary_yield(rg_children(argc, argv, self));
302
- }
303
-
304
- /*
305
- * Method: each_recurse() {|element| ...}
306
- *
307
- * Calls the block for each element in the bin and its child bins, passing a
308
- * reference to the Gst::Element as parameter.
309
- *
310
- * Returns: always nil.
311
- */
312
- static VALUE
313
- rg_each_recurse(VALUE self)
314
- {
315
- return rb_ary_yield(rg_children_recurse(self));
316
- }
317
-
318
- /*
319
- * Method: get_child(index)
320
- * Method: get_child(name, recurse=false)
321
- * Method: get_child(interface)
322
- * index: an index.
323
- * name: a name.
324
- * recurse: search recursively.
325
- * interface: an interface (Ruby class).
326
- *
327
- * 1st: Gets the index-th element.
328
- *
329
- * 2nd: Gets the element with the given name from the
330
- * bin, as a reference to a Gst::Element object. If the
331
- * element is not found and recurse is true, a recursion is
332
- * performed on the parent bin.
333
- *
334
- * 3nd: Looks for the first element inside the bin that implements the
335
- * given interface. If such an element is found, it returns the element.
336
- * If you want all elements that implement the interface, use
337
- * Gst::Bin#get_all_by_interface. The method recurses bins inside bins.
338
- *
339
- * Returns: a Gst::Element reference, or nil if the bin does not contain
340
- * an element with the given name nor implementing the interface.
341
- */
342
- static VALUE
343
- rg_get_child(int argc, VALUE *argv, VALUE self)
344
- {
345
- VALUE index_or_name_or_interface, recurse;
346
- GstElement *element = NULL;
347
-
348
- rb_scan_args(argc, argv, "11", &index_or_name_or_interface, &recurse);
349
-
350
- if (RVAL2CBOOL(rb_obj_is_kind_of(index_or_name_or_interface, rb_cInteger))) {
351
- int index;
352
- GList *node;
353
- index = NUM2INT(index_or_name_or_interface);
354
- node = g_list_nth(GST_BIN_CHILDREN(SELF(self)), index);
355
- if (node)
356
- element = node->data;
357
- } else if (RVAL2CBOOL(rb_obj_is_kind_of(index_or_name_or_interface,
358
- rb_cString))) {
359
- char *name;
360
- name = RVAL2CSTR(index_or_name_or_interface);
361
-
362
- if (RVAL2CBOOL(recurse)) {
363
- element = gst_bin_get_by_name_recurse_up(SELF(self), name);
364
- } else {
365
- element = gst_bin_get_by_name(SELF(self), name);
366
- }
367
- } else {
368
- GType iface;
369
- iface = CLASS2GTYPE(index_or_name_or_interface);
370
- element = gst_bin_get_by_interface(SELF(self), iface);
371
- }
372
-
373
- return GST_ELEMENT2RVAL(element);
374
- }
375
-
376
- static VALUE
377
- rg_sinks(VALUE self)
378
- {
379
- return _rbgst_collect_elements(gst_bin_iterate_sinks(SELF(self)));
380
- }
381
-
382
- static VALUE
383
- rg_sources(VALUE self)
384
- {
385
- return _rbgst_collect_elements(gst_bin_iterate_sources(SELF(self)));
386
- }
387
-
388
- #ifdef GST_DEBUG_BIN_TO_DOT_FILE
389
- static VALUE
390
- rg_to_dot_file(VALUE self, VALUE details, VALUE filename)
391
- {
392
- GST_DEBUG_BIN_TO_DOT_FILE(SELF(self), NUM2INT(details), RVAL2CSTR(filename));
393
- return Qnil;
394
- }
395
-
396
- static VALUE
397
- rg_to_dot_file_with_ts(VALUE self, VALUE details, VALUE filename)
398
- {
399
- GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS(SELF(self),
400
- NUM2INT(details),
401
- RVAL2CSTR(filename));
402
- return Qnil;
403
- }
404
- #endif
405
-
406
- void
407
- Init_gst_bin (VALUE mGst)
408
- {
409
- VALUE RG_TARGET_NAMESPACE;
410
-
411
- RG_TARGET_NAMESPACE = G_DEF_CLASS(GST_TYPE_BIN, "Bin", mGst);
412
-
413
- rb_include_module(RG_TARGET_NAMESPACE, rb_mEnumerable);
414
-
415
- RG_DEF_METHOD(initialize, -1);
416
-
417
- RG_DEF_METHOD(size, 0);
418
- RG_DEF_ALIAS("length", "size");
419
-
420
- RG_DEF_METHOD(children, -1);
421
- RG_DEF_METHOD(each, -1);
422
-
423
- RG_DEF_METHOD(children_recurse, 0);
424
- RG_DEF_METHOD(each_recurse, 0);
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);
434
-
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);
439
-
440
- RG_DEF_METHOD(get_child, -1);
441
-
442
- RG_DEF_METHOD(sinks, 0);
443
- RG_DEF_METHOD(sources, 0);
444
-
445
- #ifdef GST_DEBUG_BIN_TO_DOT_FILE
446
- RG_DEF_METHOD(to_dot_file, 2);
447
- RG_DEF_METHOD(to_dot_file_with_ts, 2);
448
- #endif
449
-
450
- G_DEF_CLASS(GST_TYPE_BIN_FLAGS, "Flags", RG_TARGET_NAMESPACE);
451
- G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GST_TYPE_BIN_FLAGS, "GST_BIN_");
452
- #ifdef GST_DEBUG_BIN_TO_DOT_FILE
453
- G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GST_TYPE_DEBUG_GRAPH_DETAILS,
454
- "GST_DEBUG_GRAPH_");
455
- #endif
456
- }