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
@@ -1,446 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2011-2012 Ruby-GNOME2 Project Team
4
- * Copyright (C) 2008 Ruby-GNOME2 Project Team
5
- * Copyright (C) 2003, 2004 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
- #include "rbgst-private.h"
24
-
25
- #define RG_TARGET_NAMESPACE cCaps
26
- #define SELF(self) (RVAL2GST_CAPS(self))
27
-
28
- /* Class: Gst::Caps
29
- * Capabilities of pads.
30
- */
31
-
32
- VALUE
33
- rbgst_ruby_object_from_gst_caps_with_unref(GstCaps *caps)
34
- {
35
- VALUE rb_caps;
36
-
37
- rb_caps = GST_CAPS2RVAL(caps);
38
- if (caps)
39
- gst_caps_unref(caps);
40
- return rb_caps;
41
- }
42
-
43
- /*
44
- * Method: new(*structures)
45
- * structures: a list of Hash objects.
46
- *
47
- * Creates a new Gst::Caps object and adds all given structures to it. If no
48
- * structures are given, the caps will be empty. If you want a caps that is
49
- * compatible with any media format, just create an empty caps, then call
50
- * Gst::Caps#set_any.
51
- *
52
- * Returns: a newly allocated Gst::Caps object.
53
- */
54
- static VALUE
55
- rg_initialize (int argc, VALUE * argv, VALUE self)
56
- {
57
- GstCaps *caps;
58
- int i;
59
-
60
- caps = gst_caps_new_any ();
61
- if (caps != NULL) {
62
- for (i = 0; i < argc; i++) {
63
- GstStructure *structure;
64
- structure = RVAL2GST_STRUCT(argv[i]);
65
- gst_caps_append_structure (caps, gst_structure_copy (structure));
66
- }
67
- G_INITIALIZE (self, caps);
68
- gst_caps_unref (caps);
69
- }
70
- return Qnil;
71
- }
72
-
73
- /*
74
- * Method: set_any(set)
75
- * set: true or false.
76
- *
77
- * Sets whether the caps should be compatible with any media format.
78
- *
79
- * Returns: self.
80
- */
81
- static VALUE
82
- rg_set_any (VALUE self, VALUE set)
83
- {
84
- if (RVAL2CBOOL(set)) {
85
- RGST_CAPS(self)->flags |= GST_CAPS_FLAGS_ANY;
86
- } else {
87
- RGST_CAPS(self)->flags &= ~GST_CAPS_FLAGS_ANY;
88
- }
89
- return self;
90
- }
91
-
92
- /*
93
- * Method: append(caps)
94
- * caps: a Gst::Caps to append.
95
- *
96
- * Appends the structures contained in caps to self.
97
- *
98
- * Returns: self.
99
- */
100
- static VALUE
101
- rg_append (VALUE self, VALUE caps)
102
- {
103
- gst_caps_append (RGST_CAPS (self), RGST_CAPS (caps));
104
- return self;
105
- }
106
-
107
- /*
108
- * Method: append_structure(structure)
109
- * structure: the Hash object to append.
110
- *
111
- * Append the given structure to self.
112
- *
113
- * Returns: self.
114
- */
115
- static VALUE
116
- rg_append_structure (VALUE self, VALUE structure)
117
- {
118
- gst_caps_append_structure (RGST_CAPS (self), RVAL2GST_STRUCT(structure));
119
- return self;
120
- }
121
-
122
- /* Method: size
123
- * Returns: the number of structures contained in the caps.
124
- */
125
- static VALUE
126
- rg_size (VALUE self)
127
- {
128
- return INT2FIX (gst_caps_get_size (RGST_CAPS (self)));
129
- }
130
-
131
- /*
132
- * Method: get_structure(index)
133
- * index: the index of a structure.
134
- *
135
- * Finds the structure in the caps that has the given index, and
136
- returns it.
137
- *
138
- * Returns: a Hash object corresponding to index, or nil if not found.
139
- */
140
- static VALUE
141
- rg_get_structure (VALUE self, VALUE index)
142
- {
143
- GstStructure *structure = gst_caps_get_structure (RGST_CAPS (self),
144
- FIX2INT (index));
145
-
146
- return GST_STRUCT2RVAL(structure);
147
- }
148
-
149
- static VALUE
150
- rg_set_simple (VALUE self, VALUE field, VALUE value)
151
- {
152
- /*
153
- * TODO
154
- */
155
- return self;
156
- }
157
-
158
- /* Method: any?
159
- * Returns: whether the caps represents any media format.
160
- */
161
- static VALUE
162
- rg_any_p (VALUE self)
163
- {
164
- return CBOOL2RVAL (gst_caps_is_any (RGST_CAPS (self)));
165
- }
166
-
167
- /* Method: empty?
168
- * Returns: whether the caps represents no media formats.
169
- */
170
- static VALUE
171
- rg_empty_p (VALUE self)
172
- {
173
- return CBOOL2RVAL (gst_caps_is_empty (RGST_CAPS (self)));
174
- }
175
-
176
- /* Method: simple?
177
- * Returns: whether the caps contains multiple structure.
178
- */
179
- static VALUE
180
- rg_simple_p (VALUE self)
181
- {
182
- return CBOOL2RVAL(GST_CAPS_IS_SIMPLE(RGST_CAPS (self)));
183
- }
184
-
185
- /*
186
- * Method: fixed?
187
- *
188
- * Fixed caps describes exactly one format, that is, they have exactly one
189
- * structure, and each field in the structure describes a fixed type.
190
- * Examples of non-fixed types are ranges and lists.
191
- *
192
- * Returns: whether the caps is fixed.
193
- */
194
- static VALUE
195
- rg_fixed_p (VALUE self)
196
- {
197
- return CBOOL2RVAL (gst_caps_is_fixed (RGST_CAPS (self)));
198
- }
199
-
200
- /*
201
- * Method: equal?(caps)
202
- * caps: another Gst::Caps.
203
- *
204
- * Returns: whether the given caps represent the same set of caps than
205
- self.
206
- */
207
- static VALUE
208
- rg_equal_p (VALUE self, VALUE caps)
209
- {
210
- return CBOOL2RVAL (gst_caps_is_equal (RGST_CAPS (self), RGST_CAPS (caps)));
211
- }
212
-
213
- /*
214
- * Method: equal_fixed?(caps)
215
- * caps: another Gst::Caps.
216
- *
217
- * Returns: whether the given fixed caps represent the same set of caps
218
- than self
219
- * (self must be fixed as well).
220
- */
221
- static VALUE
222
- rg_equal_fixed_p (VALUE self, VALUE caps)
223
- {
224
- return CBOOL2RVAL (gst_caps_is_equal_fixed (RGST_CAPS (self), RGST_CAPS
225
- (caps)));
226
- }
227
-
228
- /*
229
- * Method: always_compatible?(caps)
230
- * caps: another Gst::Caps.
231
- *
232
- * A given caps structure is always compatible with another if every
233
- media format that is
234
- * in the first is also contained in the second.
235
- *
236
- * Returns: whether self is compatible with the given caps.
237
- */
238
- static VALUE
239
- rg_always_compatible_p (VALUE self, VALUE caps)
240
- {
241
- return CBOOL2RVAL (gst_caps_is_always_compatible (RGST_CAPS (self),
242
- RGST_CAPS (caps)));
243
- }
244
-
245
- /*
246
- * Method: subset?(caps)
247
- * caps: another Gst::Caps.
248
- *
249
- * Checks if all caps represented by self are also represented by the
250
- given caps.
251
- * This method does not work reliably if optional properties for caps
252
- are included
253
- * on one caps and omitted on the other.
254
- *
255
- * Returns: whether self is a subset of the given caps.
256
- */
257
- static VALUE
258
- rg_subset_p (VALUE self, VALUE caps)
259
- {
260
- return CBOOL2RVAL (gst_caps_is_subset (RGST_CAPS (self), RGST_CAPS (caps)));
261
- }
262
-
263
- /*
264
- * Method: intersect(caps)
265
- * caps: another Gst::Caps.
266
- *
267
- * Creates a new Gst::Caps that contains all the formats that are
268
- common to both
269
- * self and the given caps.
270
- *
271
- * Returns: a new Gst::Caps object.
272
- */
273
- static VALUE
274
- rg_intersect (VALUE self, VALUE caps)
275
- {
276
- return RGST_CAPS_NEW (gst_caps_intersect (RGST_CAPS (self), RGST_CAPS
277
- (caps)));
278
- }
279
-
280
- /*
281
- * Method: union(caps)
282
- * caps: another Gst::Caps.
283
- *
284
- * Creates a new Gst::Caps that contains all the formats that are in
285
- either
286
- * self and the given caps.
287
- *
288
- * Returns: a new Gst::Caps object.
289
- */
290
- static VALUE
291
- rg_union (VALUE self, VALUE caps)
292
- {
293
- return RGST_CAPS_NEW (gst_caps_union (RGST_CAPS (self), RGST_CAPS (caps)));
294
- }
295
-
296
- /*
297
- * Method: normalize
298
- *
299
- * Creates a new Gst::Caps that represents the same set of formats as self,
300
- * but contains no lists. Each list is expanded into separate structures
301
- * (as Hash objects).
302
- *
303
- * Returns: a new Gst::Caps object.
304
- */
305
- static VALUE
306
- rg_normalize (VALUE self)
307
- {
308
- return RGST_CAPS_NEW (gst_caps_normalize (RGST_CAPS (self)));
309
- }
310
-
311
- /*
312
- * Method: simplify!
313
- *
314
- * Modifies the current caps inplace into a representation that represents
315
- * the same set of formats as self, but in a simpler form.
316
- * Component structures that are indentical are merged. Component
317
- structures
318
- * that have ranges or lists that can be merged are also merged.
319
- *
320
- * Returns: whether the caps could be simplified.
321
- */
322
- static VALUE
323
- rg_simplify_bang (VALUE self)
324
- {
325
- return CBOOL2RVAL (gst_caps_do_simplify (SELF (self)));
326
- }
327
-
328
- /*
329
- * Method: replace(caps)
330
- * caps: another Gst::Caps.
331
- *
332
- * Replaces the current caps inplace with the given caps.
333
- *
334
- * Returns: self.
335
- */
336
- static VALUE
337
- rg_replace_bang (VALUE self, VALUE caps)
338
- {
339
- GstCaps *current = RGST_CAPS (self);
340
-
341
- gst_caps_replace (&current, RGST_CAPS (caps));
342
- return self;
343
- }
344
-
345
- /* Method: to_string
346
- * Returns: a string representation of the current caps.
347
- */
348
- static VALUE
349
- rg_to_s (VALUE self)
350
- {
351
- return CSTR2RVAL (gst_caps_to_string (RGST_CAPS (self)));
352
- }
353
-
354
- /*
355
- * Class method: from_string(string)
356
- * string: a string to convert to a Gst::Caps.
357
- *
358
- * Converts a caps from a string representation.
359
- *
360
- * Returns: a newly allocated Gst::Caps.
361
- */
362
- static VALUE
363
- rg_s_parse (G_GNUC_UNUSED VALUE self, VALUE string)
364
- {
365
- return RGST_CAPS_NEW (gst_caps_from_string (RVAL2CSTR (string)));
366
- }
367
-
368
- /*
369
- * Method: subtract(caps)
370
- * caps: another Gst::Caps.
371
- *
372
- * Subtracts the given subtrahend caps from the minuend (self).
373
- * This method does not work reliably if optional properties for caps
374
- are included
375
- * on one caps and omitted on the other.
376
- *
377
- * Returns: the resulting caps, as a new Gst::Caps object.
378
- */
379
- static VALUE
380
- rg_subtract (VALUE self, VALUE caps)
381
- {
382
- return RGST_CAPS_NEW (gst_caps_subtract (RGST_CAPS (self), RGST_CAPS
383
- (caps)));
384
- }
385
-
386
- static VALUE
387
- rg_each(VALUE self)
388
- {
389
- int i, size;
390
- GstCaps *caps;
391
-
392
- caps = SELF(self);
393
- size = gst_caps_get_size(caps);
394
-
395
- for (i = 0; i < size; i++) {
396
- rb_yield(GST_STRUCT2RVAL(gst_caps_get_structure(caps, i)));
397
- }
398
-
399
- return Qnil;
400
- }
401
-
402
- void
403
- Init_gst_caps (VALUE mGst)
404
- {
405
- VALUE RG_TARGET_NAMESPACE;
406
-
407
- RG_TARGET_NAMESPACE = G_DEF_CLASS (GST_TYPE_CAPS, "Caps", mGst);
408
-
409
- rb_include_module(RG_TARGET_NAMESPACE, rb_mEnumerable);
410
-
411
- RG_DEF_SMETHOD(parse, 1);
412
-
413
- RG_DEF_METHOD(initialize, -1);
414
- RG_DEF_METHOD(set_any, 1);
415
- RG_DEF_METHOD(append, 1);
416
- RG_DEF_METHOD(append_structure, 1);
417
- RG_DEF_METHOD(size, 0);
418
- RG_DEF_ALIAS("length", "size");
419
- RG_DEF_METHOD(get_structure, 1);
420
- RG_DEF_ALIAS("[]", "get_structure");
421
- RG_DEF_METHOD(set_simple, 2);
422
- RG_DEF_METHOD_P(any, 0);
423
- RG_DEF_METHOD_P(empty, 0);
424
- RG_DEF_METHOD_P(simple, 0);
425
- RG_DEF_ALIAS("chained?", "simple?");
426
- RG_DEF_METHOD_P(fixed, 0);
427
- RG_DEF_METHOD_P(equal, 1);
428
- RG_DEF_ALIAS("==", "equal?");
429
- RG_DEF_METHOD_P(equal_fixed, 1);
430
- RG_DEF_METHOD_P(always_compatible, 1);
431
- RG_DEF_METHOD_P(subset, 1);
432
- RG_DEF_METHOD(intersect, 1);
433
- RG_DEF_METHOD(union, 1);
434
- RG_DEF_METHOD(normalize, 0);
435
- RG_DEF_METHOD_BANG(simplify, 0);
436
- RG_DEF_METHOD_BANG(replace, 1);
437
- RG_DEF_METHOD(to_s, 0);
438
- RG_DEF_METHOD(subtract, 1);
439
-
440
- RG_DEF_METHOD(each, 0);
441
-
442
- /* TODO:
443
- gst_caps_structure_fixate_field_nearest_int ()
444
- gst_caps_structure_fixate_field_nearest_double () */
445
-
446
- }
@@ -1,34 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2011-2012 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
- /* need to implement */
25
- #define RG_TARGET_NAMESPACE cChildProxy
26
- #define SELF(self) RVAL2GST_CHILD_PROXY(self)
27
-
28
- void
29
- Init_gst_child_proxy(VALUE mGst)
30
- {
31
- VALUE RG_TARGET_NAMESPACE;
32
-
33
- RG_TARGET_NAMESPACE = G_DEF_CLASS(GST_TYPE_CHILD_PROXY, "ChildProxy", mGst);
34
- }
@@ -1,108 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
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>
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 cClock
26
- #define SELF(obj) (RVAL2GST_CLOCK(obj))
27
-
28
- /* Class: Gst::Clock
29
- * Abstract class for global clocks.
30
- */
31
-
32
- /* Method: resolution
33
- * Returns: the accuracy of the clock.
34
- */
35
- static VALUE
36
- rg_resolution(VALUE self)
37
- {
38
- return ULL2NUM(gst_clock_get_resolution(SELF(self)));
39
- }
40
-
41
- /*
42
- * Method: set_resolution(resolution)
43
- * resolution: the accuracy of the clock.
44
- *
45
- * Sets the accuracy of the clock.
46
- *
47
- * Returns: self.
48
- */
49
- static VALUE
50
- rg_set_resolution(VALUE self, VALUE resolution)
51
- {
52
- return ULL2NUM(gst_clock_set_resolution(SELF(self), NUM2ULL(resolution)));
53
- }
54
-
55
- /* Method: time
56
- * Returns: the time of the clock (in nanoseconds).
57
- */
58
- static VALUE
59
- rg_time(VALUE self)
60
- {
61
- return ULL2NUM(gst_clock_get_time(SELF(self)));
62
- }
63
-
64
- /*
65
- * Method: ==(clock)
66
- * clock: a Gst::Clock object.
67
- *
68
- * Returns: true if two Gst::Clock objects are synchronized on the same time,
69
- * false otherwise.
70
- */
71
- static VALUE
72
- rg_operator_equal_p(VALUE self, VALUE other_clock)
73
- {
74
- if (NIL_P(other_clock))
75
- return Qfalse;
76
- else {
77
- GstClock *c1 = SELF(self);
78
- GstClock *c2 = SELF(other_clock);
79
-
80
- return CBOOL2RVAL(GST_CLOCK_DIFF(c1, c2) == 0);
81
- }
82
- }
83
-
84
- void
85
- Init_gst_clock (VALUE mGst)
86
- {
87
- VALUE RG_TARGET_NAMESPACE, rb_mGstClockTime;
88
-
89
- RG_TARGET_NAMESPACE = G_DEF_CLASS(GST_TYPE_CLOCK, "Clock", mGst);
90
-
91
- rb_define_const(mGst, "SECOND", LL2NUM(GST_SECOND));
92
- rb_define_const(mGst, "MSECOND", LL2NUM(GST_MSECOND));
93
- rb_define_const(mGst, "USECOND", LL2NUM(GST_USECOND));
94
- rb_define_const(mGst, "NSECOND", LL2NUM(GST_NSECOND));
95
-
96
- rb_mGstClockTime = rb_define_module_under(mGst, "ClockTime");
97
- rb_define_const(rb_mGstClockTime, "NONE", ULL2NUM(GST_CLOCK_TIME_NONE));
98
-
99
- G_DEF_CLASS(GST_TYPE_CLOCK_FLAGS, "Flags", RG_TARGET_NAMESPACE);
100
- G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GST_TYPE_CLOCK_FLAGS, "GST_CLOCK_");
101
- G_DEF_CLASS(GST_TYPE_CLOCK_RETURN, "Return", RG_TARGET_NAMESPACE);
102
- G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GST_TYPE_CLOCK_RETURN, "GST_CLOCK_");
103
-
104
- RG_DEF_METHOD(resolution, 0);
105
- RG_DEF_METHOD(set_resolution, 1);
106
- RG_DEF_METHOD(time, 0);
107
- RG_DEF_METHOD_OPERATOR("==", equal_p, 1);
108
- }