gstreamer 0.90.6

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 (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,784 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2007 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
20
+ */
21
+
22
+ #include "rbgst.h"
23
+ #include "rbgst-private.h"
24
+ #ifdef HAVE_GST_PBUTILS
25
+ # include <gst/pbutils/missing-plugins.h>
26
+ #endif
27
+
28
+ /* Class: Gst::Message
29
+ * Lightweight objects to signal the application of pipeline events.
30
+ */
31
+
32
+ #define SELF(obj) (RVAL2GST_MSG(obj))
33
+ #define RVAL2GST_MSG_TYPE(type) RVAL2GFLAGS(type, GST_TYPE_MESSAGE_TYPE)
34
+ #define GST_MSG_TYPE2RVAL(type) GFLAGS2RVAL(type, GST_TYPE_MESSAGE_TYPE)
35
+
36
+ static RGConvertTable table = {0};
37
+ static VALUE rb_cGstMessage;
38
+ static VALUE rb_cGstMessageUnknown;
39
+ static VALUE rb_cGstMessageEos;
40
+ static VALUE rb_cGstMessageError;
41
+ static VALUE rb_cGstMessageWarning;
42
+ static VALUE rb_cGstMessageInfo;
43
+ static VALUE rb_cGstMessageTag;
44
+ static VALUE rb_cGstMessageBuffering;
45
+ static VALUE rb_cGstMessageStateChanged;
46
+ static VALUE rb_cGstMessageStateDirty;
47
+ static VALUE rb_cGstMessageStepDone;
48
+ static VALUE rb_cGstMessageClockProvide;
49
+ static VALUE rb_cGstMessageClockLost;
50
+ static VALUE rb_cGstMessageNewClock;
51
+ static VALUE rb_cGstMessageStructureChange;
52
+ static VALUE rb_cGstMessageStreamStatus;
53
+ static VALUE rb_cGstMessageApplication;
54
+ static VALUE rb_cGstMessageElement;
55
+ static VALUE rb_cGstMessageSegmentStart;
56
+ static VALUE rb_cGstMessageSegmentDone;
57
+ static VALUE rb_cGstMessageDuration;
58
+ static VALUE rb_cGstMessageLatency;
59
+ static VALUE rb_cGstMessageAsyncStart;
60
+ static VALUE rb_cGstMessageAsyncDone;
61
+ static VALUE rb_cGstMessageAny;
62
+ #ifdef HAVE_GST_PBUTILS
63
+ static VALUE rb_cGstMissingMessage;
64
+ static VALUE rb_cGstMissingURISourceMessage;
65
+ #endif
66
+
67
+ static VALUE
68
+ get_superclass(void)
69
+ {
70
+ return rb_cGstMiniObject;
71
+ }
72
+
73
+ static VALUE
74
+ instance2robj(gpointer instance)
75
+ {
76
+ VALUE klass;
77
+ GstMessage *message;
78
+
79
+ message = instance;
80
+ switch (GST_MESSAGE_TYPE(message)) {
81
+ case GST_MESSAGE_UNKNOWN:
82
+ klass = rb_cGstMessageUnknown;
83
+ break;
84
+ case GST_MESSAGE_EOS:
85
+ klass = rb_cGstMessageEos;
86
+ break;
87
+ case GST_MESSAGE_ERROR:
88
+ klass = rb_cGstMessageError;
89
+ break;
90
+ case GST_MESSAGE_WARNING:
91
+ klass = rb_cGstMessageWarning;
92
+ break;
93
+ case GST_MESSAGE_INFO:
94
+ klass = rb_cGstMessageInfo;
95
+ break;
96
+ case GST_MESSAGE_TAG:
97
+ klass = rb_cGstMessageTag;
98
+ break;
99
+ case GST_MESSAGE_BUFFERING:
100
+ klass = rb_cGstMessageBuffering;
101
+ break;
102
+ case GST_MESSAGE_STATE_CHANGED:
103
+ klass = rb_cGstMessageStateChanged;
104
+ break;
105
+ case GST_MESSAGE_STATE_DIRTY:
106
+ klass = rb_cGstMessageStateDirty;
107
+ break;
108
+ case GST_MESSAGE_STEP_DONE:
109
+ klass = rb_cGstMessageStepDone;
110
+ break;
111
+ case GST_MESSAGE_CLOCK_PROVIDE:
112
+ klass = rb_cGstMessageClockProvide;
113
+ break;
114
+ case GST_MESSAGE_CLOCK_LOST:
115
+ klass = rb_cGstMessageClockLost;
116
+ break;
117
+ case GST_MESSAGE_NEW_CLOCK:
118
+ klass = rb_cGstMessageNewClock;
119
+ break;
120
+ case GST_MESSAGE_STRUCTURE_CHANGE:
121
+ klass = rb_cGstMessageStructureChange;
122
+ break;
123
+ case GST_MESSAGE_STREAM_STATUS:
124
+ klass = rb_cGstMessageStreamStatus;
125
+ break;
126
+ case GST_MESSAGE_APPLICATION:
127
+ klass = rb_cGstMessageApplication;
128
+ break;
129
+ case GST_MESSAGE_ELEMENT:
130
+ klass = rb_cGstMessageElement;
131
+ break;
132
+ case GST_MESSAGE_SEGMENT_START:
133
+ klass = rb_cGstMessageSegmentStart;
134
+ break;
135
+ case GST_MESSAGE_SEGMENT_DONE:
136
+ klass = rb_cGstMessageSegmentDone;
137
+ break;
138
+ case GST_MESSAGE_DURATION:
139
+ klass = rb_cGstMessageDuration;
140
+ break;
141
+ case GST_MESSAGE_LATENCY:
142
+ klass = rb_cGstMessageLatency;
143
+ break;
144
+ case GST_MESSAGE_ASYNC_START:
145
+ klass = rb_cGstMessageAsyncStart;
146
+ break;
147
+ case GST_MESSAGE_ASYNC_DONE:
148
+ klass = rb_cGstMessageAsyncDone;
149
+ break;
150
+ case GST_MESSAGE_ANY:
151
+ klass = rb_cGstMessageAny;
152
+ break;
153
+ default:
154
+ klass = rb_cGstMessage;
155
+ break;
156
+ }
157
+ gst_mini_object_ref(instance);
158
+ return Data_Wrap_Struct(klass, NULL, _rbgst_mini_object_free, instance);
159
+ }
160
+
161
+
162
+ static VALUE
163
+ initialize(VALUE self, VALUE type, VALUE src, VALUE structure)
164
+ {
165
+ GstMessage *message;
166
+ message = gst_message_new_custom(RVAL2GST_MSG_TYPE(type),
167
+ RVAL2GST_OBJ(src),
168
+ RVAL2GST_STRUCT(structure));
169
+ G_INITIALIZE(self, message);
170
+ return Qnil;
171
+ }
172
+
173
+ static VALUE
174
+ get_type(VALUE self)
175
+ {
176
+ return GST_MSG_TYPE2RVAL(GST_MESSAGE_TYPE(SELF(self)));
177
+ }
178
+
179
+ static VALUE
180
+ set_type(VALUE self, VALUE type)
181
+ {
182
+ GST_MESSAGE_TYPE(SELF(self)) = RVAL2GST_MSG_TYPE(type);
183
+ return Qnil;
184
+ }
185
+
186
+ static VALUE
187
+ have_mutex_p(VALUE self)
188
+ {
189
+ return GST_MESSAGE_GET_LOCK(SELF(self)) ? Qtrue : Qfalse;
190
+ }
191
+
192
+ static VALUE
193
+ unlock(VALUE self)
194
+ {
195
+ GST_MESSAGE_UNLOCK(SELF(self));
196
+ return Qnil;
197
+ }
198
+
199
+ static VALUE
200
+ lock(VALUE self)
201
+ {
202
+ GST_MESSAGE_LOCK(SELF(self));
203
+ if (rb_block_given_p()) {
204
+ rb_ensure(rb_yield, Qnil, unlock, self);
205
+ }
206
+
207
+ return Qnil;
208
+ }
209
+
210
+ static VALUE
211
+ have_cond_p(VALUE self)
212
+ {
213
+ return GST_MESSAGE_COND(SELF(self)) ? Qtrue : Qfalse;
214
+ }
215
+
216
+ static VALUE
217
+ cond_wait(VALUE self)
218
+ {
219
+ GST_MESSAGE_WAIT(SELF(self));
220
+ return Qnil;
221
+ }
222
+
223
+ static VALUE
224
+ cond_signal(VALUE self)
225
+ {
226
+ GST_MESSAGE_SIGNAL(SELF(self));
227
+ return Qnil;
228
+ }
229
+
230
+ static VALUE
231
+ get_timestamp(VALUE self)
232
+ {
233
+ return ULL2NUM(GST_MESSAGE_TIMESTAMP(SELF(self)));
234
+ }
235
+
236
+ static VALUE
237
+ set_timestamp(VALUE self, VALUE timestamp)
238
+ {
239
+ GST_MESSAGE_TIMESTAMP(SELF(self)) = NUM2ULL(timestamp);
240
+ return Qnil;
241
+ }
242
+
243
+ static VALUE
244
+ valid_timestamp_p(VALUE self)
245
+ {
246
+ gboolean valid;
247
+ valid = GST_CLOCK_TIME_IS_VALID(GST_MESSAGE_TIMESTAMP(SELF(self)));
248
+ return CBOOL2RVAL(valid);
249
+ }
250
+
251
+ static VALUE
252
+ get_source(VALUE self)
253
+ {
254
+ return GOBJ2RVAL(GST_MESSAGE_SRC(SELF(self)));
255
+ }
256
+
257
+ static VALUE
258
+ set_source(VALUE self, VALUE source)
259
+ {
260
+ GST_MESSAGE_SRC(SELF(self)) = RVAL2GST_OBJ(source);
261
+ return Qnil;
262
+ }
263
+
264
+ static VALUE
265
+ get_structure(VALUE self)
266
+ {
267
+ return GST_STRUCT2RVAL((gpointer)gst_message_get_structure(SELF(self)));
268
+ }
269
+
270
+
271
+ static VALUE
272
+ eos_initialize(VALUE self, VALUE src)
273
+ {
274
+ G_INITIALIZE(self, gst_message_new_eos(RVAL2GST_OBJ(src)));
275
+ return Qnil;
276
+ }
277
+
278
+ #if 0
279
+ static VALUE
280
+ error_initialize(VALUE self, VALUE src, VALUE error, VALUE debug)
281
+ {
282
+ G_INITIALIZE(self, gst_message_new_error(RVAL2GST_OBJ(src),
283
+ RVAL2GERROR(error), /* FIXME */
284
+ RVAL2CSTR(debug)));
285
+ return Qnil;
286
+ }
287
+ #endif
288
+
289
+ static VALUE
290
+ error_parse(VALUE self)
291
+ {
292
+ VALUE result;
293
+ GError *error;
294
+ gchar *debug;
295
+
296
+ gst_message_parse_error(SELF(self), &error, &debug);
297
+ result = rb_ary_new3(2, GERROR2RVAL(error), CSTR2RVAL_FREE(debug));
298
+ return result;
299
+ }
300
+
301
+ #if 0
302
+ static VALUE
303
+ warning_initialize(VALUE self, VALUE src, VALUE error, VALUE debug)
304
+ {
305
+ G_INITIALIZE(self, gst_message_new_warning(RVAL2GST_OBJ(src),
306
+ RVAL2GERROR(error), /* FIXME */
307
+ RVAL2CSTR(debug)));
308
+ return Qnil;
309
+ }
310
+ #endif
311
+
312
+ static VALUE
313
+ warning_parse(VALUE self)
314
+ {
315
+ VALUE result;
316
+ GError *error;
317
+ gchar *debug;
318
+
319
+ gst_message_parse_warning(SELF(self), &error, &debug);
320
+ result = rb_ary_new3(2, GERROR2RVAL(error), CSTR2RVAL_FREE(debug));
321
+ return result;
322
+ }
323
+
324
+ #if 0
325
+ static VALUE
326
+ info_initialize(VALUE self, VALUE src, VALUE error, VALUE debug)
327
+ {
328
+ G_INITIALIZE(self, gst_message_new_info(RVAL2GST_OBJ(src),
329
+ RVAL2GERROR(error), /* FIXME */
330
+ RVAL2CSTR(debug)));
331
+ return Qnil;
332
+ }
333
+ #endif
334
+
335
+ static VALUE
336
+ info_parse(VALUE self)
337
+ {
338
+ VALUE result;
339
+ GError *error;
340
+ gchar *debug;
341
+
342
+ gst_message_parse_info(SELF(self), &error, &debug);
343
+ result = rb_ary_new3(2, GERROR2RVAL(error), CSTR2RVAL_FREE(debug));
344
+ return result;
345
+ }
346
+
347
+ #if 0
348
+ static VALUE
349
+ tag_initialize(VALUE self, VALUE src, VALUE tag_list)
350
+ {
351
+ G_INITIALIZE(self, gst_message_new_tag(RVAL2GST_OBJ(src),
352
+ RVAL2GST_TAG_LIST(tag_list))); /* FIXME */
353
+ return Qnil;
354
+ }
355
+ #endif
356
+
357
+ static gboolean
358
+ foreach_pair(GQuark field_id, const GValue *value, gpointer user_data)
359
+ {
360
+ rb_hash_aset(*(VALUE*)user_data, CSTR2RVAL(g_quark_to_string(field_id)),
361
+ GVAL2RVAL(value));
362
+ return TRUE;
363
+ }
364
+
365
+ static VALUE
366
+ tag_parse(VALUE self)
367
+ {
368
+ VALUE value = rb_hash_new();
369
+ GstTagList *tag_list;
370
+
371
+ gst_message_parse_tag(SELF(self), &tag_list);
372
+ gst_structure_foreach(tag_list, foreach_pair, &value);
373
+ gst_tag_list_free(tag_list);
374
+ return value;
375
+ }
376
+
377
+ static VALUE
378
+ buffering_initialize(VALUE self, VALUE src, VALUE percent)
379
+ {
380
+ G_INITIALIZE(self, gst_message_new_buffering(RVAL2GST_OBJ(src),
381
+ NUM2INT(percent)));
382
+ return Qnil;
383
+ }
384
+
385
+ static VALUE
386
+ buffering_parse(VALUE self)
387
+ {
388
+ gint percent;
389
+
390
+ gst_message_parse_buffering(SELF(self), &percent);
391
+ return INT2NUM(percent);
392
+ }
393
+
394
+ static VALUE
395
+ state_changed_initialize(VALUE self, VALUE src, VALUE old_state,
396
+ VALUE new_state, VALUE pending)
397
+ {
398
+ G_INITIALIZE(self, gst_message_new_state_changed(RVAL2GST_OBJ(src),
399
+ RVAL2GST_STATE(old_state),
400
+ RVAL2GST_STATE(new_state),
401
+ RVAL2GST_STATE(pending)));
402
+ return Qnil;
403
+ }
404
+
405
+ static VALUE
406
+ state_changed_parse(VALUE self)
407
+ {
408
+ GstState old_state, new_state, pending_state;
409
+
410
+ gst_message_parse_state_changed(SELF(self),
411
+ &old_state, &new_state, &pending_state);
412
+ return rb_ary_new3(3,
413
+ GST_STATE2RVAL(old_state),
414
+ GST_STATE2RVAL(new_state),
415
+ GST_STATE2RVAL(pending_state));
416
+ }
417
+
418
+ static VALUE
419
+ state_dirty_initialize(VALUE self, VALUE src)
420
+ {
421
+ G_INITIALIZE(self, gst_message_new_state_dirty(RVAL2GST_OBJ(src)));
422
+ return Qnil;
423
+ }
424
+
425
+ static VALUE
426
+ clock_provide_initialize(VALUE self, VALUE src, VALUE clock, VALUE ready)
427
+ {
428
+ G_INITIALIZE(self, gst_message_new_clock_provide(RVAL2GST_OBJ(src),
429
+ RVAL2GST_CLOCK(clock),
430
+ RVAL2CBOOL(ready)));
431
+ return Qnil;
432
+ }
433
+
434
+ static VALUE
435
+ clock_provide_parse(VALUE self)
436
+ {
437
+ GstClock *clock;
438
+ gboolean ready;
439
+
440
+ gst_message_parse_clock_provide(SELF(self), &clock, &ready);
441
+ return rb_ary_new3(2, GOBJ2RVAL(clock), CBOOL2RVAL(ready));
442
+ }
443
+
444
+ static VALUE
445
+ clock_lost_initialize(VALUE self, VALUE src, VALUE clock)
446
+ {
447
+ G_INITIALIZE(self, gst_message_new_clock_lost(RVAL2GST_OBJ(src),
448
+ RVAL2GST_CLOCK(clock)));
449
+ return Qnil;
450
+ }
451
+
452
+ static VALUE
453
+ clock_lost_parse(VALUE self)
454
+ {
455
+ GstClock *clock;
456
+
457
+ gst_message_parse_clock_lost(SELF(self), &clock);
458
+ return GOBJ2RVAL(clock);
459
+ }
460
+
461
+ static VALUE
462
+ new_clock_initialize(VALUE self, VALUE src, VALUE clock)
463
+ {
464
+ G_INITIALIZE(self, gst_message_new_new_clock(RVAL2GST_OBJ(src),
465
+ RVAL2GST_CLOCK(clock)));
466
+ return Qnil;
467
+ }
468
+
469
+ static VALUE
470
+ new_clock_parse(VALUE self)
471
+ {
472
+ GstClock *clock;
473
+
474
+ gst_message_parse_new_clock(SELF(self), &clock);
475
+ return GOBJ2RVAL(clock);
476
+ }
477
+
478
+ static VALUE
479
+ application_initialize(VALUE self, VALUE src, VALUE structure)
480
+ {
481
+ G_INITIALIZE(self, gst_message_new_application(RVAL2GST_OBJ(src),
482
+ RVAL2GST_STRUCT(structure)));
483
+ return Qnil;
484
+ }
485
+
486
+ static VALUE
487
+ element_initialize(VALUE self, VALUE src, VALUE structure)
488
+ {
489
+ G_INITIALIZE(self, gst_message_new_element(RVAL2GST_OBJ(src),
490
+ RVAL2GST_STRUCT(structure)));
491
+ return Qnil;
492
+ }
493
+
494
+ #ifdef HAVE_GST_PBUTILS
495
+ static VALUE
496
+ missing_message_get_installer_detail(VALUE self)
497
+ {
498
+ gchar *detail;
499
+ detail = gst_missing_plugin_message_get_installer_detail(SELF(self));
500
+ return CSTR2RVAL_FREE(detail);
501
+ }
502
+
503
+ static VALUE
504
+ missing_message_get_description(VALUE self)
505
+ {
506
+ gchar *description;
507
+ description = gst_missing_plugin_message_get_description(SELF(self));
508
+ return CSTR2RVAL_FREE(description);
509
+ }
510
+
511
+ static VALUE
512
+ missing_uri_source_message_initialize(VALUE self, VALUE element, VALUE protocol)
513
+ {
514
+ GstMessage *message;
515
+
516
+ message = gst_missing_uri_source_message_new(RVAL2GST_ELEMENT(element),
517
+ RVAL2CSTR(protocol));
518
+ G_INITIALIZE(self, message);
519
+ return Qnil;
520
+ }
521
+ #endif /* HAVE_GST_PBUTILS */
522
+
523
+ static VALUE
524
+ segment_start_initialize(VALUE self, VALUE src, VALUE format, VALUE position)
525
+ {
526
+ G_INITIALIZE(self, gst_message_new_segment_start(RVAL2GST_OBJ(src),
527
+ RVAL2GST_FORMAT(format),
528
+ NUM2LL(position)));
529
+ return Qnil;
530
+ }
531
+
532
+ static VALUE
533
+ segment_start_parse(VALUE self)
534
+ {
535
+ GstFormat format;
536
+ gint64 position;
537
+
538
+ gst_message_parse_segment_start(SELF(self), &format, &position);
539
+ return rb_ary_new3(2, GST_FORMAT2RVAL(format), LL2NUM(position));
540
+ }
541
+
542
+ static VALUE
543
+ segment_done_initialize(VALUE self, VALUE src, VALUE format, VALUE position)
544
+ {
545
+ G_INITIALIZE(self, gst_message_new_segment_done(RVAL2GST_OBJ(src),
546
+ RVAL2GST_FORMAT(format),
547
+ NUM2LL(position)));
548
+ return Qnil;
549
+ }
550
+
551
+ static VALUE
552
+ segment_done_parse(VALUE self)
553
+ {
554
+ GstFormat format;
555
+ gint64 position;
556
+
557
+ gst_message_parse_segment_done(SELF(self), &format, &position);
558
+ return rb_ary_new3(2, GST_FORMAT2RVAL(format), LL2NUM(position));
559
+ }
560
+
561
+ static VALUE
562
+ duration_initialize(VALUE self, VALUE src, VALUE format, VALUE duration)
563
+ {
564
+ G_INITIALIZE(self, gst_message_new_duration(RVAL2GST_OBJ(src),
565
+ RVAL2GST_FORMAT(format),
566
+ NUM2LL(duration)));
567
+ return Qnil;
568
+ }
569
+
570
+ static VALUE
571
+ duration_parse(VALUE self)
572
+ {
573
+ GstFormat format;
574
+ gint64 duration;
575
+
576
+ gst_message_parse_duration(SELF(self), &format, &duration);
577
+ return rb_ary_new3(2, GST_FORMAT2RVAL(format), LL2NUM(duration));
578
+ }
579
+
580
+ static VALUE
581
+ async_start_initialize(VALUE self, VALUE src, VALUE new_base_time)
582
+ {
583
+ G_INITIALIZE(self, gst_message_new_async_start(RVAL2GST_OBJ(src),
584
+ RVAL2CBOOL(new_base_time)));
585
+ return Qnil;
586
+ }
587
+
588
+ static VALUE
589
+ async_start_parse(VALUE self)
590
+ {
591
+ gboolean new_base_time;
592
+
593
+ gst_message_parse_async_start(SELF(self), &new_base_time);
594
+ return CBOOL2RVAL(new_base_time);
595
+ }
596
+
597
+ static VALUE
598
+ async_done_initialize(VALUE self, VALUE src)
599
+ {
600
+ G_INITIALIZE(self, gst_message_new_async_done(RVAL2GST_OBJ(src)));
601
+ return Qnil;
602
+ }
603
+
604
+ static VALUE
605
+ latency_initialize(VALUE self, VALUE src)
606
+ {
607
+ G_INITIALIZE(self, gst_message_new_latency(RVAL2GST_OBJ(src)));
608
+ return Qnil;
609
+ }
610
+
611
+
612
+ static VALUE
613
+ type_name(VALUE self)
614
+ {
615
+ return CSTR2RVAL(gst_message_type_get_name(RVAL2GST_MSG_TYPE(self)));
616
+ }
617
+
618
+
619
+ void
620
+ Init_gst_message(void)
621
+ {
622
+ VALUE rb_cGstMessageType;
623
+
624
+ table.type = GST_TYPE_MESSAGE;
625
+ table.get_superclass = get_superclass;
626
+ table.instance2robj = instance2robj;
627
+ RG_DEF_CONVERSION(&table);
628
+
629
+ rb_cGstMessage = G_DEF_CLASS(GST_TYPE_MESSAGE, "Message", mGst);
630
+
631
+ #define DEFINE_MESSAGE(type) \
632
+ rb_cGstMessage ## type = \
633
+ rb_define_class_under(mGst, "Message" #type, rb_cGstMessage)
634
+
635
+ DEFINE_MESSAGE(Unknown);
636
+ DEFINE_MESSAGE(Eos);
637
+ DEFINE_MESSAGE(Error);
638
+ DEFINE_MESSAGE(Warning);
639
+ DEFINE_MESSAGE(Info);
640
+ DEFINE_MESSAGE(Tag);
641
+ DEFINE_MESSAGE(Buffering);
642
+ DEFINE_MESSAGE(StateChanged);
643
+ DEFINE_MESSAGE(StateDirty);
644
+ DEFINE_MESSAGE(StepDone);
645
+ DEFINE_MESSAGE(ClockProvide);
646
+ DEFINE_MESSAGE(ClockLost);
647
+ DEFINE_MESSAGE(NewClock);
648
+ DEFINE_MESSAGE(StructureChange);
649
+ DEFINE_MESSAGE(StreamStatus);
650
+ DEFINE_MESSAGE(Application);
651
+ DEFINE_MESSAGE(Element);
652
+ DEFINE_MESSAGE(SegmentStart);
653
+ DEFINE_MESSAGE(SegmentDone);
654
+ DEFINE_MESSAGE(Duration);
655
+ DEFINE_MESSAGE(Latency);
656
+ DEFINE_MESSAGE(AsyncStart);
657
+ DEFINE_MESSAGE(AsyncDone);
658
+ DEFINE_MESSAGE(Any);
659
+
660
+ #undef DEFINE_MESSAGE
661
+
662
+ rb_cGstMessageType = G_DEF_CLASS(GST_TYPE_MESSAGE_TYPE,
663
+ "Type", rb_cGstMessage);
664
+ G_DEF_CONSTANTS(rb_cGstMessage, GST_TYPE_MESSAGE_TYPE, "GST_MESSAGE_");
665
+
666
+ rb_define_method(rb_cGstMessage, "initialize", initialize, 3);
667
+
668
+ rb_define_method(rb_cGstMessage, "type", get_type, 0);
669
+ rb_define_method(rb_cGstMessage, "set_type", set_type, 1);
670
+
671
+ rb_define_method(rb_cGstMessage, "have_mutex?", have_mutex_p, 0);
672
+ rb_define_method(rb_cGstMessage, "lock", lock, 0);
673
+ rb_define_method(rb_cGstMessage, "unlock", unlock, 0);
674
+ rb_define_method(rb_cGstMessage, "have_cond?", have_cond_p, 0);
675
+ rb_define_method(rb_cGstMessage, "wait", cond_wait, 0);
676
+ rb_define_method(rb_cGstMessage, "signal", cond_signal, 0);
677
+
678
+ rb_define_method(rb_cGstMessage, "timestamp", get_timestamp, 0);
679
+ rb_define_method(rb_cGstMessage, "set_timestamp", set_timestamp, 1);
680
+ rb_define_method(rb_cGstMessage, "valid_timestamp?", valid_timestamp_p, 0);
681
+
682
+ rb_define_method(rb_cGstMessage, "source", get_source, 0);
683
+ rb_define_method(rb_cGstMessage, "set_source", set_source, 1);
684
+ rb_define_alias(rb_cGstMessage, "src", "source");
685
+ rb_define_alias(rb_cGstMessage, "set_src", "set_source");
686
+
687
+ rb_define_method(rb_cGstMessage, "structure", get_structure, 0);
688
+
689
+
690
+ rb_define_method(rb_cGstMessageEos, "initialize", eos_initialize, 1);
691
+
692
+ #if 0
693
+ rb_define_method(rb_cGstMessageError, "initialize", error_initialize, 3);
694
+ #endif
695
+ rb_define_method(rb_cGstMessageError, "parse", error_parse, 0);
696
+
697
+ #if 0
698
+ rb_define_method(rb_cGstMessageWarning, "initialize", warning_initialize, 3);
699
+ #endif
700
+ rb_define_method(rb_cGstMessageWarning, "parse", warning_parse, 0);
701
+
702
+ #if 0
703
+ rb_define_method(rb_cGstMessageInfo, "initialize", info_initialize, 3);
704
+ #endif
705
+ rb_define_method(rb_cGstMessageInfo, "parse", info_parse, 0);
706
+
707
+ #if 0
708
+ rb_define_method(rb_cGstMessageTag, "initialize", tag_initialize, 2);
709
+ #endif
710
+ rb_define_method(rb_cGstMessageTag, "parse", tag_parse, 0);
711
+
712
+ rb_define_method(rb_cGstMessageBuffering, "initialize",
713
+ buffering_initialize, 2);
714
+ rb_define_method(rb_cGstMessageBuffering, "parse", buffering_parse, 0);
715
+
716
+ rb_define_method(rb_cGstMessageStateChanged, "initialize",
717
+ state_changed_initialize, 4);
718
+ rb_define_method(rb_cGstMessageStateChanged, "parse",
719
+ state_changed_parse, 0);
720
+
721
+ rb_define_method(rb_cGstMessageStateDirty, "initialize",
722
+ state_dirty_initialize, 1);
723
+
724
+ rb_define_method(rb_cGstMessageClockProvide, "initialize",
725
+ clock_provide_initialize, 3);
726
+ rb_define_method(rb_cGstMessageClockProvide, "parse",
727
+ clock_provide_parse, 0);
728
+
729
+ rb_define_method(rb_cGstMessageClockLost, "initialize",
730
+ clock_lost_initialize, 2);
731
+ rb_define_method(rb_cGstMessageClockLost, "parse", clock_lost_parse, 0);
732
+
733
+ rb_define_method(rb_cGstMessageNewClock, "initialize",
734
+ new_clock_initialize, 2);
735
+ rb_define_method(rb_cGstMessageNewClock, "parse", new_clock_parse, 0);
736
+
737
+ rb_define_method(rb_cGstMessageApplication, "initialize",
738
+ application_initialize, 2);
739
+
740
+ rb_define_method(rb_cGstMessageElement, "initialize",
741
+ element_initialize, 2);
742
+ #ifdef HAVE_GST_PBUTILS
743
+ rb_cGstMissingMessage =
744
+ rb_define_class_under(mGst, "MissingMessage", rb_cGstMessage);
745
+ rb_define_method(rb_cGstMissingMessage, "installer_detail",
746
+ missing_message_get_installer_detail, 0);
747
+ rb_define_method(rb_cGstMissingMessage, "description",
748
+ missing_message_get_description, 0);
749
+
750
+ rb_cGstMissingURISourceMessage =
751
+ rb_define_class_under(mGst, "MissingURISourceMessage",
752
+ rb_cGstMissingMessage);
753
+ rb_define_method(rb_cGstMissingURISourceMessage, "initialize",
754
+ missing_uri_source_message_initialize, 2);
755
+ #endif
756
+
757
+ rb_define_method(rb_cGstMessageSegmentStart, "initialize",
758
+ segment_start_initialize, 3);
759
+ rb_define_method(rb_cGstMessageSegmentStart, "parse",
760
+ segment_start_parse, 0);
761
+
762
+ rb_define_method(rb_cGstMessageSegmentDone, "initialize",
763
+ segment_done_initialize, 3);
764
+ rb_define_method(rb_cGstMessageSegmentDone, "parse", segment_done_parse, 0);
765
+
766
+ rb_define_method(rb_cGstMessageDuration, "initialize",
767
+ duration_initialize, 3);
768
+ rb_define_method(rb_cGstMessageDuration, "parse", duration_parse, 0);
769
+
770
+ rb_define_method(rb_cGstMessageAsyncStart, "initialize",
771
+ async_start_initialize, 2);
772
+ rb_define_method(rb_cGstMessageAsyncStart, "parse", async_start_parse, 0);
773
+
774
+ rb_define_method(rb_cGstMessageAsyncDone, "initialize",
775
+ async_done_initialize, 1);
776
+
777
+ rb_define_method(rb_cGstMessageLatency, "initialize", latency_initialize, 1);
778
+
779
+
780
+ rb_define_method(rb_cGstMessageType, "name", type_name, 0);
781
+
782
+
783
+ G_DEF_SETTERS(rb_cGstMessage);
784
+ }