gstreamer 1.2.6 → 2.0.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 (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
@@ -1,527 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2011-2013 Ruby-GNOME2 Project Team
4
- * Copyright (C) 2008 Ruby-GNOME2 Project Team
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
- static VALUE cIntRange, cFourcc, cFractionRange;
25
-
26
- static void
27
- value_list_rvalue2gvalue(VALUE value, GValue *result,
28
- G_GNUC_UNUSED gpointer user_data)
29
- {
30
- guint i, len;
31
-
32
- len = RARRAY_LEN(value);
33
- for (i = 0; i < len; i++) {
34
- GValue val = G_VALUE_INIT;
35
- rbgobj_initialize_gvalue(&val, RARRAY_PTR(value)[i]);
36
- gst_value_list_append_value(result, &val);
37
- g_value_unset(&val);
38
- }
39
- }
40
-
41
- static VALUE
42
- value_list_gvalue2rvalue(const GValue *value, G_GNUC_UNUSED gpointer user_data)
43
- {
44
- guint i, len;
45
- VALUE result;
46
-
47
- len = gst_value_list_get_size(value);
48
- result = rb_ary_new2(len);
49
- for (i = 0; i < len; i++) {
50
- rb_ary_push(result, GVAL2RVAL(gst_value_list_get_value(value, i)));
51
- }
52
-
53
- return result;
54
- }
55
-
56
-
57
- static void
58
- value_array_rvalue2gvalue(VALUE value, GValue *result,
59
- G_GNUC_UNUSED gpointer user_data)
60
- {
61
- guint i, len;
62
-
63
- len = RARRAY_LEN(value);
64
- for (i = 0; i < len; i++) {
65
- GValue val = G_VALUE_INIT;
66
- rbgobj_initialize_gvalue(&val, RARRAY_PTR(value)[i]);
67
- gst_value_array_append_value(result, &val);
68
- g_value_unset(&val);
69
- }
70
- }
71
-
72
- static VALUE
73
- value_array_gvalue2rvalue(const GValue *value, G_GNUC_UNUSED gpointer user_data)
74
- {
75
- guint i, len;
76
- VALUE result;
77
-
78
- len = gst_value_array_get_size(value);
79
- result = rb_ary_new2(len);
80
- for (i = 0; i < len; i++) {
81
- rb_ary_push(result, GVAL2RVAL(gst_value_array_get_value(value, i)));
82
- }
83
-
84
- return result;
85
- }
86
-
87
-
88
- static GValue *
89
- g_value_new(GType type)
90
- {
91
- GValue *value;
92
-
93
- value = ALLOC(GValue);
94
- MEMZERO(value, GValue, 1);
95
- g_value_init(value, type);
96
-
97
- return value;
98
- }
99
-
100
- static void
101
- g_value_free(gpointer instance)
102
- {
103
- if (instance) {
104
- g_value_unset(instance);
105
- g_free(instance);
106
- }
107
- }
108
-
109
- static VALUE
110
- g_value_to_ruby_value(const GValue *value, G_GNUC_UNUSED gpointer user_data)
111
- {
112
- VALUE klass;
113
- GType type;
114
- GValue *copied_value;
115
-
116
- type = G_VALUE_TYPE(value);
117
- klass = GTYPE2CLASS(type);
118
- copied_value = g_value_new(type);
119
- g_value_copy(value, copied_value);
120
- return Data_Wrap_Struct(klass, NULL, g_value_free, copied_value);
121
- }
122
-
123
- static VALUE
124
- g_value_type_instance_to_ruby_object(gpointer instance, gpointer user_data)
125
- {
126
- return g_value_to_ruby_value(instance, user_data);
127
- }
128
-
129
- static void
130
- g_value_type_unref(gpointer instance, G_GNUC_UNUSED gpointer user_data)
131
- {
132
- g_value_unset(instance);
133
- }
134
-
135
- #define DEF_G_VALUE_CONVERTERS(prefix, g_type, type) \
136
- static gpointer \
137
- prefix ## _robj2instance(VALUE object, \
138
- G_GNUC_UNUSED gpointer user_data) \
139
- { \
140
- gpointer instance; \
141
- \
142
- if (!RVAL2CBOOL(rb_obj_is_kind_of(object, c ## type))) { \
143
- rb_raise(rb_eTypeError, "not a Gst::" # type); \
144
- } \
145
- Data_Get_Struct(object, GValue, instance); \
146
- return instance; \
147
- } \
148
- \
149
- static VALUE \
150
- prefix ## _allocate(VALUE klass) \
151
- { \
152
- return Data_Wrap_Struct(klass, NULL, \
153
- g_value_free, g_value_new(g_type)); \
154
- }
155
-
156
- static VALUE
157
- g_value_to_s(VALUE self)
158
- {
159
- return CSTR2RVAL_FREE(g_strdup_value_contents(RVAL2GOBJ(self)));
160
- }
161
-
162
-
163
-
164
- static VALUE
165
- int_range_initialize(VALUE self, VALUE min, VALUE max)
166
- {
167
- gst_value_set_int_range(DATA_PTR(self), NUM2INT(min), NUM2INT(max));
168
- return Qnil;
169
- }
170
-
171
- static VALUE
172
- int_range_get_min(VALUE self)
173
- {
174
- return INT2NUM(gst_value_get_int_range_min(RVAL2GOBJ(self)));
175
- }
176
-
177
- static VALUE
178
- int_range_set_min(VALUE self, VALUE min)
179
- {
180
- GValue *value;
181
-
182
- value = RVAL2GOBJ(self);
183
- gst_value_set_int_range(value,
184
- NUM2INT(min),
185
- gst_value_get_int_range_max(value));
186
- return Qnil;
187
- }
188
-
189
- static VALUE
190
- int_range_get_max(VALUE self)
191
- {
192
- return INT2NUM(gst_value_get_int_range_max(RVAL2GOBJ(self)));
193
- }
194
-
195
- static VALUE
196
- int_range_set_max(VALUE self, VALUE max)
197
- {
198
- GValue *value;
199
-
200
- value = RVAL2GOBJ(self);
201
- gst_value_set_int_range(value,
202
- gst_value_get_int_range_min(value),
203
- NUM2INT(max));
204
- return Qnil;
205
- }
206
-
207
- static VALUE
208
- int_range_set(VALUE self, VALUE min, VALUE max)
209
- {
210
- gst_value_set_int_range(RVAL2GOBJ(self), NUM2INT(min), NUM2INT(max));
211
- return Qnil;
212
- }
213
-
214
- static VALUE
215
- int_range_to_a(VALUE self)
216
- {
217
- GValue *value;
218
-
219
- value = RVAL2GOBJ(self);
220
- return rb_ary_new3(2,
221
- INT2NUM(gst_value_get_int_range_min(value)),
222
- INT2NUM(gst_value_get_int_range_max(value)));
223
- }
224
-
225
- static VALUE
226
- int_range_get_superclass(G_GNUC_UNUSED gpointer user_data)
227
- {
228
- return rb_cObject;
229
- }
230
-
231
- static void
232
- int_range_rvalue2gvalue(VALUE value, GValue *result,
233
- G_GNUC_UNUSED gpointer user_data)
234
- {
235
- GValue *val;
236
-
237
- val = RVAL2GOBJ(value);
238
- gst_value_set_int_range(result,
239
- gst_value_get_int_range_min(val),
240
- gst_value_get_int_range_max(val));
241
- }
242
-
243
- DEF_G_VALUE_CONVERTERS(int_range, GST_TYPE_INT_RANGE, IntRange)
244
-
245
-
246
- static VALUE
247
- fourcc_get_superclass(G_GNUC_UNUSED gpointer user_data)
248
- {
249
- return rb_cObject;
250
- }
251
-
252
- static void
253
- fourcc_rvalue2gvalue(VALUE value, GValue *result,
254
- G_GNUC_UNUSED gpointer user_data)
255
- {
256
- gst_value_set_fourcc(result,
257
- gst_value_get_fourcc(RVAL2GOBJ(value)));
258
- }
259
-
260
- DEF_G_VALUE_CONVERTERS(fourcc, GST_TYPE_FOURCC, Fourcc)
261
-
262
- static guint32
263
- value_to_fourcc(VALUE value)
264
- {
265
- if (RVAL2CBOOL(rb_obj_is_kind_of(value, rb_cString))) {
266
- return GST_STR_FOURCC(RSTRING_PTR(value));
267
- } else {
268
- return NUM2UINT(value);
269
- }
270
- }
271
-
272
- static VALUE
273
- fourcc_initialize(VALUE self, VALUE fourcc)
274
- {
275
- gst_value_set_fourcc(DATA_PTR(self), value_to_fourcc(fourcc));
276
- return Qnil;
277
- }
278
-
279
- static VALUE
280
- fourcc_replace_bang(VALUE self, VALUE fourcc)
281
- {
282
- gst_value_set_fourcc(DATA_PTR(self), value_to_fourcc(fourcc));
283
- return Qnil;
284
- }
285
-
286
- static VALUE
287
- fourcc_to_i(VALUE self)
288
- {
289
- return UINT2NUM(gst_value_get_fourcc(DATA_PTR(self)));
290
- }
291
-
292
-
293
- static void
294
- fraction_rvalue2gvalue(VALUE value, GValue *result,
295
- G_GNUC_UNUSED gpointer user_data)
296
- {
297
- gst_value_set_fraction(result,
298
- NUM2INT(rb_funcall(value, rb_intern("numerator"), 0)),
299
- NUM2INT(rb_funcall(value, rb_intern("denominator"),
300
- 0)));
301
- }
302
-
303
- static VALUE
304
- fraction_gvalue2rvalue(const GValue *value, G_GNUC_UNUSED gpointer user_data)
305
- {
306
- return rb_funcall(Qnil, rb_intern("Rational"), 2,
307
- INT2NUM(gst_value_get_fraction_numerator(value)),
308
- INT2NUM(gst_value_get_fraction_denominator(value)));
309
- }
310
-
311
-
312
- static VALUE
313
- fraction_range_initialize(VALUE self, VALUE min, VALUE max)
314
- {
315
- GValue min_value = G_VALUE_INIT, max_value = G_VALUE_INIT;
316
-
317
- rbgobj_initialize_gvalue(&min_value, min);
318
- rbgobj_initialize_gvalue(&max_value, max);
319
- gst_value_set_fraction_range(DATA_PTR(self), &min_value, &max_value);
320
- return Qnil;
321
- }
322
-
323
- static VALUE
324
- fraction_range_get_min(VALUE self)
325
- {
326
- return GVAL2RVAL(gst_value_get_fraction_range_min(RVAL2GOBJ(self)));
327
- }
328
-
329
- static VALUE
330
- fraction_range_set_min(VALUE self, VALUE min)
331
- {
332
- GValue *value;
333
- GValue min_value = G_VALUE_INIT;
334
-
335
- value = RVAL2GOBJ(self);
336
- rbgobj_initialize_gvalue(&min_value, min);
337
- gst_value_set_fraction_range(value,
338
- &min_value,
339
- gst_value_get_fraction_range_max(value));
340
- return Qnil;
341
- }
342
-
343
- static VALUE
344
- fraction_range_get_max(VALUE self)
345
- {
346
- return GVAL2RVAL(gst_value_get_fraction_range_max(RVAL2GOBJ(self)));
347
- }
348
-
349
- static VALUE
350
- fraction_range_set_max(VALUE self, VALUE max)
351
- {
352
- GValue *value;
353
- GValue max_value = G_VALUE_INIT;
354
-
355
- value = RVAL2GOBJ(self);
356
- rbgobj_initialize_gvalue(&max_value, max);
357
- gst_value_set_fraction_range(value,
358
- gst_value_get_fraction_range_min(value),
359
- &max_value);
360
- return Qnil;
361
- }
362
-
363
- static VALUE
364
- fraction_range_set(VALUE self, VALUE min, VALUE max)
365
- {
366
- GValue min_value = G_VALUE_INIT, max_value = G_VALUE_INIT;
367
-
368
- rbgobj_initialize_gvalue(&min_value, min);
369
- rbgobj_initialize_gvalue(&max_value, max);
370
- gst_value_set_fraction_range(RVAL2GOBJ(self), &min_value, &max_value);
371
- return Qnil;
372
- }
373
-
374
- static VALUE
375
- fraction_range_to_a(VALUE self)
376
- {
377
- GValue *value;
378
-
379
- value = RVAL2GOBJ(self);
380
- return rb_ary_new3(2,
381
- GVAL2RVAL(gst_value_get_fraction_range_min(value)),
382
- GVAL2RVAL(gst_value_get_fraction_range_max(value)));
383
- }
384
-
385
- static VALUE
386
- fraction_range_get_superclass(G_GNUC_UNUSED gpointer user_data)
387
- {
388
- return rb_cObject;
389
- }
390
-
391
- static void
392
- fraction_range_rvalue2gvalue(VALUE value, GValue *result,
393
- G_GNUC_UNUSED gpointer user_data)
394
- {
395
- GValue *val;
396
-
397
- val = RVAL2GOBJ(value);
398
- gst_value_set_fraction_range(result,
399
- gst_value_get_fraction_range_min(val),
400
- gst_value_get_fraction_range_max(val));
401
- }
402
-
403
- DEF_G_VALUE_CONVERTERS(fraction_range, GST_TYPE_FRACTION_RANGE, FractionRange)
404
-
405
-
406
- void
407
- Init_gst_value(VALUE mGst)
408
- {
409
- RGConvertTable value_list_table;
410
- RGConvertTable value_array_table;
411
- RGConvertTable int_range_table;
412
- RGConvertTable fourcc_table;
413
- RGConvertTable fraction_table;
414
- RGConvertTable fraction_range_table;
415
-
416
- memset(&value_list_table, 0, sizeof(value_list_table));
417
- value_list_table.type = GST_TYPE_LIST;
418
- value_list_table.klass = Qnil;
419
- value_list_table.rvalue2gvalue = value_list_rvalue2gvalue;
420
- value_list_table.gvalue2rvalue = value_list_gvalue2rvalue;
421
-
422
- RG_DEF_CONVERSION(&value_list_table);
423
-
424
-
425
- memset(&value_array_table, 0, sizeof(value_array_table));
426
- value_array_table.type = GST_TYPE_ARRAY;
427
- value_array_table.klass = Qnil;
428
- value_array_table.rvalue2gvalue = value_array_rvalue2gvalue;
429
- value_array_table.gvalue2rvalue = value_array_gvalue2rvalue;
430
-
431
- RG_DEF_CONVERSION(&value_array_table);
432
-
433
-
434
- memset(&int_range_table, 0, sizeof(int_range_table));
435
- int_range_table.type = GST_TYPE_INT_RANGE;
436
- int_range_table.klass = Qnil;
437
- int_range_table.get_superclass = int_range_get_superclass;
438
- int_range_table.type_init_hook = NULL;
439
- int_range_table.rvalue2gvalue = int_range_rvalue2gvalue;
440
- int_range_table.gvalue2rvalue = g_value_to_ruby_value;
441
- int_range_table.initialize = NULL;
442
- int_range_table.robj2instance = int_range_robj2instance;
443
- int_range_table.instance2robj = g_value_type_instance_to_ruby_object;
444
- int_range_table.unref = g_value_type_unref;
445
-
446
- RG_DEF_CONVERSION(&int_range_table);
447
-
448
- cIntRange = G_DEF_CLASS(GST_TYPE_INT_RANGE, "IntRange", mGst);
449
-
450
- rb_define_alloc_func(cIntRange, int_range_allocate);
451
-
452
- rbg_define_method(cIntRange, "initialize", int_range_initialize, 2);
453
-
454
- rbg_define_method(cIntRange, "min", int_range_get_min, 0);
455
- rbg_define_method(cIntRange, "set_min", int_range_set_min, 1);
456
- rbg_define_method(cIntRange, "max", int_range_get_max, 0);
457
- rbg_define_method(cIntRange, "set_max", int_range_set_max, 1);
458
-
459
- rbg_define_method(cIntRange, "set", int_range_set, 2);
460
-
461
- rbg_define_method(cIntRange, "to_a", int_range_to_a, 0);
462
- rbg_define_method(cIntRange, "to_s", g_value_to_s, 0);
463
-
464
- memset(&fourcc_table, 0, sizeof(fourcc_table));
465
- fourcc_table.type = GST_TYPE_FOURCC;
466
- fourcc_table.klass = Qnil;
467
- fourcc_table.get_superclass = fourcc_get_superclass;
468
- fourcc_table.type_init_hook = NULL;
469
- fourcc_table.rvalue2gvalue = fourcc_rvalue2gvalue;
470
- fourcc_table.gvalue2rvalue = g_value_to_ruby_value;
471
- fourcc_table.initialize = NULL;
472
- fourcc_table.robj2instance = fourcc_robj2instance;
473
- fourcc_table.instance2robj = g_value_type_instance_to_ruby_object;
474
- fourcc_table.unref = g_value_type_unref;
475
-
476
- RG_DEF_CONVERSION(&fourcc_table);
477
-
478
- cFourcc = G_DEF_CLASS(GST_TYPE_FOURCC, "Fourcc", mGst);
479
-
480
- rb_define_alloc_func(cFourcc, fourcc_allocate);
481
-
482
- rbg_define_method(cFourcc, "initialize", fourcc_initialize, 1);
483
-
484
- rbg_define_method(cFourcc, "replace!", fourcc_replace_bang, 1);
485
-
486
- rbg_define_method(cFourcc, "to_i", fourcc_to_i, 0);
487
- rbg_define_method(cFourcc, "to_s", g_value_to_s, 0);
488
-
489
- memset(&fraction_table, 0, sizeof(fraction_table));
490
- fraction_table.type = GST_TYPE_FRACTION;
491
- fraction_table.klass = rb_const_get(rb_cObject, rb_intern("Rational"));
492
- fraction_table.rvalue2gvalue = fraction_rvalue2gvalue;
493
- fraction_table.gvalue2rvalue = fraction_gvalue2rvalue;
494
-
495
- RG_DEF_CONVERSION(&fraction_table);
496
-
497
-
498
- memset(&fraction_range_table, 0, sizeof(fraction_range_table));
499
- fraction_range_table.type = GST_TYPE_FRACTION_RANGE;
500
- fraction_range_table.klass = Qnil;
501
- fraction_range_table.get_superclass = fraction_range_get_superclass;
502
- fraction_range_table.type_init_hook = NULL;
503
- fraction_range_table.rvalue2gvalue = fraction_range_rvalue2gvalue;
504
- fraction_range_table.gvalue2rvalue = g_value_to_ruby_value;
505
- fraction_range_table.initialize = NULL;
506
- fraction_range_table.robj2instance = fraction_range_robj2instance;
507
- fraction_range_table.instance2robj = g_value_type_instance_to_ruby_object;
508
- fraction_range_table.unref = g_value_type_unref;
509
-
510
- RG_DEF_CONVERSION(&fraction_range_table);
511
-
512
- cFractionRange = G_DEF_CLASS(GST_TYPE_FRACTION_RANGE, "FractionRange", mGst);
513
-
514
- rb_define_alloc_func(cFractionRange, fraction_range_allocate);
515
-
516
- rbg_define_method(cFractionRange, "initialize", fraction_range_initialize, 2);
517
-
518
- rbg_define_method(cFractionRange, "min", fraction_range_get_min, 0);
519
- rbg_define_method(cFractionRange, "set_min", fraction_range_set_min, 1);
520
- rbg_define_method(cFractionRange, "max", fraction_range_get_max, 0);
521
- rbg_define_method(cFractionRange, "set_max", fraction_range_set_max, 1);
522
-
523
- rbg_define_method(cFractionRange, "set", fraction_range_set, 2);
524
-
525
- rbg_define_method(cFractionRange, "to_a", fraction_range_to_a, 0);
526
- rbg_define_method(cFractionRange, "to_s", g_value_to_s, 0);
527
- }
@@ -1,131 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2011-2012 Ruby-GNOME2 Project Team
4
- * Copyright (C) 2006 Sjoerd Simons <sjoerd@luon.net>
5
- * Copyright (C) 2005 Laurent Sansonetti <lrz@gnome.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
- #ifdef HAVE_GST_OVERLAY
24
-
25
- #include "rbgst-private.h"
26
- #include <gst/interfaces/xoverlay.h>
27
-
28
- #define RG_TARGET_NAMESPACE mXOverlay
29
- #define SELF(o) (GST_X_OVERLAY(RVAL2GOBJ(o)))
30
-
31
- static GQuark xoverlay_xid_data_quark;
32
-
33
- struct xid_callback_data
34
- {
35
- GObject *bus;
36
- gulong cb_id;
37
- gulong xid;
38
- };
39
-
40
- static void
41
- bus_sync_func_cb(GstBus *bus, GstMessage *message, gpointer user_data)
42
- {
43
- struct xid_callback_data *xid_cb_data;
44
- GstXOverlay *sink = GST_X_OVERLAY(user_data);
45
- xid_cb_data = (struct xid_callback_data *)
46
- g_object_get_qdata(G_OBJECT(sink), xoverlay_xid_data_quark);
47
-
48
- if (xid_cb_data == NULL) {
49
- return;
50
- }
51
-
52
- if (GST_MESSAGE_TYPE(message) == GST_MESSAGE_ELEMENT) {
53
- if (message->structure
54
- && GST_MESSAGE_SRC(message) == GST_OBJECT(sink)
55
- && strcmp(gst_structure_get_name(message->structure),
56
- "prepare-xwindow-id") == 0) {
57
- gst_x_overlay_set_xwindow_id(sink, xid_cb_data->xid);
58
- }
59
- }
60
- }
61
-
62
- static void
63
- xid_callback_data_destroy_cb(gpointer data)
64
- {
65
- struct xid_callback_data *xid_cb_data = (struct xid_callback_data *)data;
66
-
67
- if (g_signal_handler_is_connected(xid_cb_data->bus, xid_cb_data->cb_id)) {
68
- g_signal_handler_disconnect (xid_cb_data->bus, xid_cb_data->cb_id);
69
- }
70
- g_slice_free(struct xid_callback_data, data);
71
- }
72
-
73
- static VALUE
74
- rg_set_xwindow_id_with_buswatch(VALUE self, VALUE bus,
75
- VALUE x_window_id)
76
- {
77
- struct xid_callback_data* xid_cb_data;
78
- GObject *sink;
79
-
80
- xid_cb_data = g_slice_new(struct xid_callback_data);
81
- xid_cb_data->xid = NUM2ULL(x_window_id);
82
- xid_cb_data->bus = RVAL2GOBJ(bus);
83
-
84
- sink = RVAL2GOBJ(self);
85
- g_object_set_qdata_full(sink, xoverlay_xid_data_quark,
86
- xid_cb_data, xid_callback_data_destroy_cb);
87
-
88
- gst_bus_enable_sync_message_emission(GST_BUS(xid_cb_data->bus));
89
- xid_cb_data->cb_id =
90
- g_signal_connect_object(xid_cb_data->bus, "sync-message",
91
- G_CALLBACK(bus_sync_func_cb), sink, 0);
92
- return self;
93
- }
94
-
95
- static VALUE
96
- rg_set_xwindow_id(VALUE self, VALUE x_window_id)
97
- {
98
- gst_x_overlay_set_xwindow_id(SELF(self), NUM2ULONG(x_window_id));
99
- return self;
100
- }
101
-
102
- static VALUE
103
- rg_expose(VALUE self)
104
- {
105
- gst_x_overlay_expose(SELF(self));
106
- return self;
107
- }
108
-
109
- static VALUE
110
- rg_got_xwindow_id(VALUE self, VALUE x_window_id)
111
- {
112
- gst_x_overlay_got_xwindow_id(SELF(self), NUM2ULL(x_window_id));
113
- return self;
114
- }
115
-
116
- void
117
- Init_gst_x_overlay(VALUE mGst)
118
- {
119
- VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(GST_TYPE_X_OVERLAY, "XOverlay", mGst);
120
-
121
- xoverlay_xid_data_quark =
122
- g_quark_from_static_string("__rbgst_xoverlay_xid_data_quark__");
123
-
124
- RG_DEF_METHOD(set_xwindow_id, 1);
125
- RG_DEF_METHOD(expose, 0);
126
-
127
- RG_DEF_METHOD(got_xwindow_id, 1);
128
- RG_DEF_METHOD(set_xwindow_id_with_buswatch, 2);
129
- }
130
-
131
- #endif /* HAVE_GST_OVERLAY */