gstreamer 1.0.3 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. data/Rakefile +201 -3
  2. data/ext/gstreamer/extconf.rb +10 -10
  3. data/ext/gstreamer/misc.c +16 -15
  4. data/ext/gstreamer/rbgst-bin.c +75 -83
  5. data/ext/gstreamer/rbgst-buffer.c +91 -91
  6. data/ext/gstreamer/rbgst-bus.c +21 -21
  7. data/ext/gstreamer/rbgst-caps.c +98 -91
  8. data/ext/gstreamer/rbgst-child-proxy.c +19 -18
  9. data/ext/gstreamer/rbgst-clock.c +34 -32
  10. data/ext/gstreamer/rbgst-element-factory.c +79 -85
  11. data/ext/gstreamer/rbgst-element.c +245 -210
  12. data/ext/gstreamer/rbgst-event.c +18 -18
  13. data/ext/gstreamer/rbgst-ghost-pad.c +24 -21
  14. data/ext/gstreamer/rbgst-index-factory.c +31 -29
  15. data/ext/gstreamer/rbgst-install-plugins-context.c +86 -0
  16. data/ext/gstreamer/rbgst-install-plugins-return.c +45 -0
  17. data/ext/gstreamer/rbgst-install-plugins.c +45 -111
  18. data/ext/gstreamer/rbgst-message.c +15 -16
  19. data/ext/gstreamer/rbgst-mini-object.c +37 -37
  20. data/ext/gstreamer/rbgst-object.c +29 -26
  21. data/ext/gstreamer/rbgst-pad-template.c +36 -35
  22. data/ext/gstreamer/rbgst-pad.c +96 -96
  23. data/ext/gstreamer/rbgst-pipeline.c +32 -31
  24. data/ext/gstreamer/rbgst-plugin-feature.c +47 -48
  25. data/ext/gstreamer/rbgst-plugin.c +62 -64
  26. data/ext/gstreamer/rbgst-private.c +14 -15
  27. data/ext/gstreamer/rbgst-private.h +76 -16
  28. data/ext/gstreamer/rbgst-query.c +22 -20
  29. data/ext/gstreamer/rbgst-seek.c +22 -19
  30. data/ext/gstreamer/rbgst-static-caps.c +26 -24
  31. data/ext/gstreamer/rbgst-static-pad-template.c +27 -26
  32. data/ext/gstreamer/rbgst-structure.c +61 -59
  33. data/ext/gstreamer/rbgst-system-clock.c +23 -20
  34. data/ext/gstreamer/rbgst-type-find-factory.c +44 -43
  35. data/ext/gstreamer/rbgst-value.c +40 -28
  36. data/ext/gstreamer/rbgst-x-overlay.c +32 -31
  37. data/ext/gstreamer/rbgst.c +78 -128
  38. data/ext/gstreamer/rbgst.h +16 -16
  39. data/ext/gstreamer/rbgstclockentry.c +46 -43
  40. data/ext/gstreamer/rbgstformat.c +64 -61
  41. data/ext/gstreamer/rbgstindex.c +67 -64
  42. data/ext/gstreamer/rbgstindexentry.c +31 -28
  43. data/ext/gstreamer/rbgstparse.c +32 -29
  44. data/ext/gstreamer/rbgstquerytype.c +64 -61
  45. data/ext/gstreamer/rbgstregistry.c +79 -76
  46. data/ext/gstreamer/rbgsttag.c +34 -32
  47. data/ext/gstreamer/rbgsttagsetter.c +22 -19
  48. data/ext/gstreamer/rbgstxml.c +78 -75
  49. data/lib/gst.rb +15 -1
  50. data/test/test_buffer.rb +5 -2
  51. data/test/test_element.rb +7 -9
  52. data/test/test_value.rb +2 -2
  53. metadata +11 -11
  54. data/ChangeLog +0 -1202
  55. data/test/test_clock.rb +0 -7
@@ -1,26 +1,28 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
1
2
  /*
2
- * Copyright (C) 2003, 2004 Laurent Sansonetti <lrz@gnome.org>
3
- * Copyright (C) 2008 Ruby-GNOME2 Project Team
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
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
20
21
  */
21
22
 
22
- #include "rbgst.h"
23
+ #include "rbgst-private.h"
23
24
 
25
+ #define RG_TARGET_NAMESPACE cCaps
24
26
  #define SELF(self) (RVAL2GST_CAPS(self))
25
27
 
26
28
  /* Class: Gst::Caps
@@ -50,32 +52,40 @@ rbgst_ruby_object_from_gst_caps_with_unref(GstCaps *caps)
50
52
  * Returns: a newly allocated Gst::Caps object.
51
53
  */
52
54
  static VALUE
53
- rb_gst_caps_new (int argc, VALUE * argv, VALUE self)
55
+ rg_initialize (int argc, VALUE * argv, VALUE self)
54
56
  {
55
57
  GstCaps *caps;
56
58
  int i;
57
59
 
58
60
  caps = gst_caps_new_any ();
59
61
  if (caps != NULL) {
60
- for (i = 0; i < argc; i++)
61
- gst_caps_append_structure (caps, RVAL2GST_STRUCT(argv[i]));
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
+ }
62
67
  G_INITIALIZE (self, caps);
68
+ gst_caps_unref (caps);
63
69
  }
64
70
  return Qnil;
65
71
  }
66
72
 
67
73
  /*
68
- * Method: set_any(state)
69
- * state: true or false.
74
+ * Method: set_any(set)
75
+ * set: true or false.
70
76
  *
71
77
  * Sets whether the caps should be compatible with any media format.
72
78
  *
73
79
  * Returns: self.
74
80
  */
75
81
  static VALUE
76
- rb_gst_caps_set_any (VALUE self, VALUE state)
82
+ rg_set_any (VALUE self, VALUE set)
77
83
  {
78
- RGST_CAPS (self)->flags = GST_CAPS_FLAGS_ANY;
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
+ }
79
89
  return self;
80
90
  }
81
91
 
@@ -88,7 +98,7 @@ rb_gst_caps_set_any (VALUE self, VALUE state)
88
98
  * Returns: self.
89
99
  */
90
100
  static VALUE
91
- rb_gst_caps_append (VALUE self, VALUE caps)
101
+ rg_append (VALUE self, VALUE caps)
92
102
  {
93
103
  gst_caps_append (RGST_CAPS (self), RGST_CAPS (caps));
94
104
  return self;
@@ -103,7 +113,7 @@ rb_gst_caps_append (VALUE self, VALUE caps)
103
113
  * Returns: self.
104
114
  */
105
115
  static VALUE
106
- rb_gst_caps_append_structure (VALUE self, VALUE structure)
116
+ rg_append_structure (VALUE self, VALUE structure)
107
117
  {
108
118
  gst_caps_append_structure (RGST_CAPS (self), RVAL2GST_STRUCT(structure));
109
119
  return self;
@@ -113,7 +123,7 @@ rb_gst_caps_append_structure (VALUE self, VALUE structure)
113
123
  * Returns: the number of structures contained in the caps.
114
124
  */
115
125
  static VALUE
116
- rb_gst_caps_get_size (VALUE self)
126
+ rg_size (VALUE self)
117
127
  {
118
128
  return INT2FIX (gst_caps_get_size (RGST_CAPS (self)));
119
129
  }
@@ -128,7 +138,7 @@ returns it.
128
138
  * Returns: a Hash object corresponding to index, or nil if not found.
129
139
  */
130
140
  static VALUE
131
- rb_gst_caps_get_structure (VALUE self, VALUE index)
141
+ rg_get_structure (VALUE self, VALUE index)
132
142
  {
133
143
  GstStructure *structure = gst_caps_get_structure (RGST_CAPS (self),
134
144
  FIX2INT (index));
@@ -137,7 +147,7 @@ rb_gst_caps_get_structure (VALUE self, VALUE index)
137
147
  }
138
148
 
139
149
  static VALUE
140
- rb_gst_caps_set_simple (VALUE self, VALUE field, VALUE value)
150
+ rg_set_simple (VALUE self, VALUE field, VALUE value)
141
151
  {
142
152
  /*
143
153
  * TODO
@@ -149,7 +159,7 @@ rb_gst_caps_set_simple (VALUE self, VALUE field, VALUE value)
149
159
  * Returns: whether the caps represents any media format.
150
160
  */
151
161
  static VALUE
152
- rb_gst_caps_is_any (VALUE self)
162
+ rg_any_p (VALUE self)
153
163
  {
154
164
  return CBOOL2RVAL (gst_caps_is_any (RGST_CAPS (self)));
155
165
  }
@@ -158,7 +168,7 @@ rb_gst_caps_is_any (VALUE self)
158
168
  * Returns: whether the caps represents no media formats.
159
169
  */
160
170
  static VALUE
161
- rb_gst_caps_is_empty (VALUE self)
171
+ rg_empty_p (VALUE self)
162
172
  {
163
173
  return CBOOL2RVAL (gst_caps_is_empty (RGST_CAPS (self)));
164
174
  }
@@ -167,7 +177,7 @@ rb_gst_caps_is_empty (VALUE self)
167
177
  * Returns: whether the caps contains multiple structure.
168
178
  */
169
179
  static VALUE
170
- rb_gst_caps_is_simple (VALUE self)
180
+ rg_simple_p (VALUE self)
171
181
  {
172
182
  return CBOOL2RVAL(GST_CAPS_IS_SIMPLE(RGST_CAPS (self)));
173
183
  }
@@ -182,7 +192,7 @@ rb_gst_caps_is_simple (VALUE self)
182
192
  * Returns: whether the caps is fixed.
183
193
  */
184
194
  static VALUE
185
- rb_gst_caps_is_fixed (VALUE self)
195
+ rg_fixed_p (VALUE self)
186
196
  {
187
197
  return CBOOL2RVAL (gst_caps_is_fixed (RGST_CAPS (self)));
188
198
  }
@@ -195,7 +205,7 @@ rb_gst_caps_is_fixed (VALUE self)
195
205
  self.
196
206
  */
197
207
  static VALUE
198
- rb_gst_caps_is_equal (VALUE self, VALUE caps)
208
+ rg_equal_p (VALUE self, VALUE caps)
199
209
  {
200
210
  return CBOOL2RVAL (gst_caps_is_equal (RGST_CAPS (self), RGST_CAPS (caps)));
201
211
  }
@@ -209,7 +219,7 @@ than self
209
219
  * (self must be fixed as well).
210
220
  */
211
221
  static VALUE
212
- rb_gst_caps_is_equal_fixed (VALUE self, VALUE caps)
222
+ rg_equal_fixed_p (VALUE self, VALUE caps)
213
223
  {
214
224
  return CBOOL2RVAL (gst_caps_is_equal_fixed (RGST_CAPS (self), RGST_CAPS
215
225
  (caps)));
@@ -226,7 +236,7 @@ media format that is
226
236
  * Returns: whether self is compatible with the given caps.
227
237
  */
228
238
  static VALUE
229
- rb_gst_caps_is_always_compatible (VALUE self, VALUE caps)
239
+ rg_always_compatible_p (VALUE self, VALUE caps)
230
240
  {
231
241
  return CBOOL2RVAL (gst_caps_is_always_compatible (RGST_CAPS (self),
232
242
  RGST_CAPS (caps)));
@@ -245,7 +255,7 @@ are included
245
255
  * Returns: whether self is a subset of the given caps.
246
256
  */
247
257
  static VALUE
248
- rb_gst_caps_is_subset (VALUE self, VALUE caps)
258
+ rg_subset_p (VALUE self, VALUE caps)
249
259
  {
250
260
  return CBOOL2RVAL (gst_caps_is_subset (RGST_CAPS (self), RGST_CAPS (caps)));
251
261
  }
@@ -261,7 +271,7 @@ common to both
261
271
  * Returns: a new Gst::Caps object.
262
272
  */
263
273
  static VALUE
264
- rb_gst_caps_intersect (VALUE self, VALUE caps)
274
+ rg_intersect (VALUE self, VALUE caps)
265
275
  {
266
276
  return RGST_CAPS_NEW (gst_caps_intersect (RGST_CAPS (self), RGST_CAPS
267
277
  (caps)));
@@ -278,7 +288,7 @@ either
278
288
  * Returns: a new Gst::Caps object.
279
289
  */
280
290
  static VALUE
281
- rb_gst_caps_union (VALUE self, VALUE caps)
291
+ rg_union (VALUE self, VALUE caps)
282
292
  {
283
293
  return RGST_CAPS_NEW (gst_caps_union (RGST_CAPS (self), RGST_CAPS (caps)));
284
294
  }
@@ -293,7 +303,7 @@ rb_gst_caps_union (VALUE self, VALUE caps)
293
303
  * Returns: a new Gst::Caps object.
294
304
  */
295
305
  static VALUE
296
- rb_gst_caps_normalize (VALUE self)
306
+ rg_normalize (VALUE self)
297
307
  {
298
308
  return RGST_CAPS_NEW (gst_caps_normalize (RGST_CAPS (self)));
299
309
  }
@@ -310,9 +320,9 @@ structures
310
320
  * Returns: whether the caps could be simplified.
311
321
  */
312
322
  static VALUE
313
- rb_gst_caps_do_simplify (VALUE self)
323
+ rg_simplify_bang (VALUE self)
314
324
  {
315
- return CBOOL2RVAL (gst_caps_do_simplify (RGST_CAPS (self)));
325
+ return CBOOL2RVAL (gst_caps_do_simplify (SELF (self)));
316
326
  }
317
327
 
318
328
  /*
@@ -324,7 +334,7 @@ rb_gst_caps_do_simplify (VALUE self)
324
334
  * Returns: self.
325
335
  */
326
336
  static VALUE
327
- rb_gst_caps_replace (VALUE self, VALUE caps)
337
+ rg_replace_bang (VALUE self, VALUE caps)
328
338
  {
329
339
  GstCaps *current = RGST_CAPS (self);
330
340
 
@@ -336,7 +346,7 @@ rb_gst_caps_replace (VALUE self, VALUE caps)
336
346
  * Returns: a string representation of the current caps.
337
347
  */
338
348
  static VALUE
339
- rb_gst_caps_to_string (VALUE self)
349
+ rg_to_s (VALUE self)
340
350
  {
341
351
  return CSTR2RVAL (gst_caps_to_string (RGST_CAPS (self)));
342
352
  }
@@ -350,7 +360,7 @@ rb_gst_caps_to_string (VALUE self)
350
360
  * Returns: a newly allocated Gst::Caps.
351
361
  */
352
362
  static VALUE
353
- rb_gst_caps_from_string (VALUE self, VALUE string)
363
+ rg_s_parse (G_GNUC_UNUSED VALUE self, VALUE string)
354
364
  {
355
365
  return RGST_CAPS_NEW (gst_caps_from_string (RVAL2CSTR (string)));
356
366
  }
@@ -367,14 +377,14 @@ are included
367
377
  * Returns: the resulting caps, as a new Gst::Caps object.
368
378
  */
369
379
  static VALUE
370
- rb_gst_caps_subtract (VALUE self, VALUE caps)
380
+ rg_subtract (VALUE self, VALUE caps)
371
381
  {
372
382
  return RGST_CAPS_NEW (gst_caps_subtract (RGST_CAPS (self), RGST_CAPS
373
383
  (caps)));
374
384
  }
375
385
 
376
386
  static VALUE
377
- each(VALUE self)
387
+ rg_each(VALUE self)
378
388
  {
379
389
  int i, size;
380
390
  GstCaps *caps;
@@ -390,49 +400,46 @@ each(VALUE self)
390
400
  }
391
401
 
392
402
  void
393
- Init_gst_caps (void)
403
+ Init_gst_caps (VALUE mGst)
394
404
  {
395
- VALUE cGstCaps;
396
-
397
- cGstCaps = G_DEF_CLASS (GST_TYPE_CAPS, "Caps", mGst);
398
-
399
- rb_include_module(cGstCaps, rb_mEnumerable);
400
-
401
- rb_define_singleton_method(cGstCaps, "parse",
402
- rb_gst_caps_from_string, 1);
403
-
404
- rb_define_method(cGstCaps, "initialize", rb_gst_caps_new, -1);
405
- rb_define_method(cGstCaps, "set_any", rb_gst_caps_set_any, 1);
406
- rb_define_method(cGstCaps, "append", rb_gst_caps_append, 1);
407
- rb_define_method(cGstCaps, "append_structure",
408
- rb_gst_caps_append_structure, 1);
409
- rb_define_method(cGstCaps, "size", rb_gst_caps_get_size, 0);
410
- rb_define_alias(cGstCaps, "length", "size");
411
- rb_define_method(cGstCaps, "get_structure", rb_gst_caps_get_structure, 1);
412
- rb_define_alias(cGstCaps, "[]", "get_structure");
413
- rb_define_method(cGstCaps, "set_simple", rb_gst_caps_set_simple, 2);
414
- rb_define_method(cGstCaps, "any?", rb_gst_caps_is_any, 0);
415
- rb_define_method(cGstCaps, "empty?", rb_gst_caps_is_empty, 0);
416
- rb_define_method(cGstCaps, "simple?", rb_gst_caps_is_simple, 0);
417
- rb_define_alias(cGstCaps, "chained?", "simple?");
418
- rb_define_method(cGstCaps, "fixed?", rb_gst_caps_is_fixed, 0);
419
- rb_define_method(cGstCaps, "equal?", rb_gst_caps_is_equal, 1);
420
- rb_define_alias(cGstCaps, "==", "equal?");
421
- rb_define_method(cGstCaps, "equal_fixed?", rb_gst_caps_is_equal_fixed, 1);
422
- rb_define_method(cGstCaps, "always_compatible?",
423
- rb_gst_caps_is_always_compatible, 1);
424
- rb_define_method(cGstCaps, "subset?", rb_gst_caps_is_subset, 1);
425
- rb_define_method(cGstCaps, "intersect", rb_gst_caps_intersect, 1);
426
- rb_define_method(cGstCaps, "union", rb_gst_caps_union, 1);
427
- rb_define_method(cGstCaps, "normalize", rb_gst_caps_normalize, 0);
428
- rb_define_method(cGstCaps, "simplify!", rb_gst_caps_do_simplify, 0);
429
- rb_define_method(cGstCaps, "replace!", rb_gst_caps_replace, 1);
430
- rb_define_method(cGstCaps, "to_s", rb_gst_caps_to_string, 0);
431
- rb_define_method(cGstCaps, "subtract", rb_gst_caps_subtract, 1);
432
-
433
- rb_define_method(cGstCaps, "each", each, 0);
434
-
435
- G_DEF_SETTERS(cGstCaps);
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
+ G_DEF_SETTERS(RG_TARGET_NAMESPACE);
436
443
 
437
444
  /* TODO:
438
445
  gst_caps_structure_fixate_field_nearest_int ()
@@ -1,33 +1,34 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
1
2
  /*
2
- * Copyright (C) 2008 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2011-2012 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2008 Ruby-GNOME2 Project Team
3
5
  *
4
- * This file is part of Ruby/GStreamer.
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.
5
10
  *
6
- * Ruby/GStreamer 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.
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.
10
15
  *
11
- * Ruby/GStreamer 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 Ruby/GStreamer; if not, write to the Free Software
18
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
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
19
20
  */
20
21
 
21
- #include "rbgst.h"
22
22
  #include "rbgst-private.h"
23
23
 
24
24
  /* need to implement */
25
+ #define RG_TARGET_NAMESPACE cChildProxy
25
26
  #define SELF(self) RVAL2GST_CHILD_PROXY(self)
26
27
 
27
28
  void
28
- Init_gst_child_proxy(void)
29
+ Init_gst_child_proxy(VALUE mGst)
29
30
  {
30
- VALUE rb_mGstChildProxy;
31
+ VALUE RG_TARGET_NAMESPACE;
31
32
 
32
- rb_mGstChildProxy = G_DEF_CLASS(GST_TYPE_CHILD_PROXY, "ChildProxy", mGst);
33
+ RG_TARGET_NAMESPACE = G_DEF_CLASS(GST_TYPE_CHILD_PROXY, "ChildProxy", mGst);
33
34
  }
@@ -1,26 +1,28 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
1
2
  /*
2
- * Copyright (C) 2003, 2004 Laurent Sansonetti <lrz@gnome.org>
3
- * Copyright (C) 2007 Ruby-GNOME2 Project Team
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>
4
6
  *
5
- * This file is part of Ruby/GStreamer.
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.
6
11
  *
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.
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.
11
16
  *
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
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
20
21
  */
21
22
 
22
- #include "rbgst.h"
23
+ #include "rbgst-private.h"
23
24
 
25
+ #define RG_TARGET_NAMESPACE cClock
24
26
  #define SELF(obj) (RVAL2GST_CLOCK(obj))
25
27
 
26
28
  /* Class: Gst::Clock
@@ -31,7 +33,7 @@
31
33
  * Returns: the accuracy of the clock.
32
34
  */
33
35
  static VALUE
34
- get_resolution(VALUE self)
36
+ rg_resolution(VALUE self)
35
37
  {
36
38
  return ULL2NUM(gst_clock_get_resolution(SELF(self)));
37
39
  }
@@ -45,7 +47,7 @@ get_resolution(VALUE self)
45
47
  * Returns: self.
46
48
  */
47
49
  static VALUE
48
- set_resolution(VALUE self, VALUE resolution)
50
+ rg_set_resolution(VALUE self, VALUE resolution)
49
51
  {
50
52
  return ULL2NUM(gst_clock_set_resolution(SELF(self), NUM2ULL(resolution)));
51
53
  }
@@ -54,7 +56,7 @@ set_resolution(VALUE self, VALUE resolution)
54
56
  * Returns: the time of the clock (in nanoseconds).
55
57
  */
56
58
  static VALUE
57
- get_time(VALUE self)
59
+ rg_time(VALUE self)
58
60
  {
59
61
  return ULL2NUM(gst_clock_get_time(SELF(self)));
60
62
  }
@@ -67,7 +69,7 @@ get_time(VALUE self)
67
69
  * false otherwise.
68
70
  */
69
71
  static VALUE
70
- equal_p(VALUE self, VALUE other_clock)
72
+ rg_operator_equal_p(VALUE self, VALUE other_clock)
71
73
  {
72
74
  if (NIL_P(other_clock))
73
75
  return Qfalse;
@@ -80,11 +82,11 @@ equal_p(VALUE self, VALUE other_clock)
80
82
  }
81
83
 
82
84
  void
83
- Init_gst_clock (void)
85
+ Init_gst_clock (VALUE mGst)
84
86
  {
85
- VALUE rb_cGstClock, rb_mGstClockTime;
87
+ VALUE RG_TARGET_NAMESPACE, rb_mGstClockTime;
86
88
 
87
- rb_cGstClock = G_DEF_CLASS(GST_TYPE_CLOCK, "Clock", mGst);
89
+ RG_TARGET_NAMESPACE = G_DEF_CLASS(GST_TYPE_CLOCK, "Clock", mGst);
88
90
 
89
91
  rb_define_const(mGst, "SECOND", LL2NUM(GST_SECOND));
90
92
  rb_define_const(mGst, "MSECOND", LL2NUM(GST_MSECOND));
@@ -94,15 +96,15 @@ Init_gst_clock (void)
94
96
  rb_mGstClockTime = rb_define_module_under(mGst, "ClockTime");
95
97
  rb_define_const(rb_mGstClockTime, "NONE", ULL2NUM(GST_CLOCK_TIME_NONE));
96
98
 
97
- G_DEF_CLASS(GST_TYPE_CLOCK_FLAGS, "Flags", rb_cGstClock);
98
- G_DEF_CONSTANTS(rb_cGstClock, GST_TYPE_CLOCK_FLAGS, "GST_CLOCK_");
99
- G_DEF_CLASS(GST_TYPE_CLOCK_RETURN, "Return", rb_cGstClock);
100
- G_DEF_CONSTANTS(rb_cGstClock, GST_TYPE_CLOCK_RETURN, "GST_CLOCK_");
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_");
101
103
 
102
- rb_define_method(rb_cGstClock, "resolution", get_resolution, 0);
103
- rb_define_method(rb_cGstClock, "set_resolution", set_resolution, 1);
104
- rb_define_method(rb_cGstClock, "time", get_time, 0);
105
- rb_define_method(rb_cGstClock, "==", equal_p, 1);
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);
106
108
 
107
- G_DEF_SETTERS(rb_cGstClock);
109
+ G_DEF_SETTERS(RG_TARGET_NAMESPACE);
108
110
  }