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