gstreamer 0.90.6

Sign up to get free protection for your applications and to get access to all the features.
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,351 @@
1
+ /*
2
+ * Copyright (C) 2006 Sjoerd Simons <sjoerd@luon.net>
3
+ * Copyright (C) 2003, 2004 Laurent Sansonetti <lrz@gnome.org>
4
+ * Copyright (C) 2007 Ruby-GNOME2 Project Team
5
+ *
6
+ * This file is part of Ruby/GStreamer.
7
+ *
8
+ * Ruby/GStreamer is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * Ruby/GStreamer is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with Ruby/GStreamer; if not, write to the Free Software
20
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
+ */
22
+
23
+ #include "rbgst.h"
24
+ #include "rbgst-private.h"
25
+
26
+ /* Document-class: Gst::Event
27
+ * Events.
28
+ */
29
+
30
+ static RGConvertTable table = {0};
31
+
32
+ static VALUE rb_cGstEvent;
33
+ static VALUE rb_cGstEventFlushStart;
34
+ static VALUE rb_cGstEventFlushStop;
35
+ static VALUE rb_cGstEventEOS;
36
+ static VALUE rb_cGstEventNewSegment;
37
+ static VALUE rb_cGstEventTag;
38
+ static VALUE rb_cGstEventBufferSize;
39
+ static VALUE rb_cGstEventQOS;
40
+ static VALUE rb_cGstEventSeek;
41
+ static VALUE rb_cGstEventNavigation;
42
+ static VALUE rb_cGstEventLatency;
43
+
44
+ static VALUE
45
+ get_superclass(void)
46
+ {
47
+ return rb_cGstMiniObject;
48
+ }
49
+
50
+ static VALUE
51
+ instance2robj(gpointer instance)
52
+ {
53
+ VALUE klass;
54
+ GstEvent *event;
55
+
56
+ event = instance;
57
+
58
+ switch (GST_EVENT_TYPE(event)) {
59
+ case GST_EVENT_FLUSH_START:
60
+ klass = rb_cGstEventFlushStart;
61
+ break;
62
+ case GST_EVENT_FLUSH_STOP:
63
+ klass = rb_cGstEventFlushStop;
64
+ break;
65
+ case GST_EVENT_EOS:
66
+ klass = rb_cGstEventEOS;
67
+ break;
68
+ case GST_EVENT_NEWSEGMENT:
69
+ klass = rb_cGstEventNewSegment;
70
+ break;
71
+ case GST_EVENT_TAG:
72
+ klass = rb_cGstEventTag;
73
+ break;
74
+ case GST_EVENT_BUFFERSIZE:
75
+ klass = rb_cGstEventBufferSize;
76
+ break;
77
+ case GST_EVENT_QOS:
78
+ klass = rb_cGstEventQOS;
79
+ break;
80
+ case GST_EVENT_SEEK:
81
+ klass = rb_cGstEventSeek;
82
+ break;
83
+ case GST_EVENT_NAVIGATION:
84
+ klass = rb_cGstEventNavigation;
85
+ break;
86
+ case GST_EVENT_LATENCY:
87
+ klass = rb_cGstEventLatency;
88
+ break;
89
+ default:
90
+ klass = rb_cGstEvent;
91
+ break;
92
+ }
93
+
94
+ gst_mini_object_ref(instance);
95
+ return Data_Wrap_Struct(klass, NULL, _rbgst_mini_object_free, instance);
96
+ }
97
+
98
+ static VALUE
99
+ flush_start_initialize(VALUE self)
100
+ {
101
+ GstEvent *event;
102
+
103
+ event = gst_event_new_flush_start();
104
+
105
+ G_INITIALIZE(self, event);
106
+ return Qnil;
107
+ }
108
+
109
+ static VALUE
110
+ flush_stop_initialize(VALUE self)
111
+ {
112
+ GstEvent *event;
113
+
114
+ event = gst_event_new_flush_start();
115
+
116
+ G_INITIALIZE(self, event);
117
+ return Qnil;
118
+ }
119
+
120
+ static VALUE
121
+ eos_initialize(VALUE self)
122
+ {
123
+ GstEvent *event;
124
+
125
+ event = gst_event_new_eos();
126
+
127
+ G_INITIALIZE(self, event);
128
+ return Qnil;
129
+ }
130
+
131
+ static VALUE
132
+ newsegment_initialize(VALUE self, VALUE update, VALUE rate, VALUE applied_rate,
133
+ VALUE format, VALUE start, VALUE stop, VALUE position)
134
+ {
135
+ GstEvent *event;
136
+
137
+ event = gst_event_new_new_segment_full(RVAL2CBOOL(update),
138
+ NUM2DBL(rate),
139
+ NUM2DBL(applied_rate),
140
+ RVAL2GST_FORMAT(format),
141
+ NUM2LL(start),
142
+ NUM2LL(stop),
143
+ NUM2LL(position));
144
+
145
+ G_INITIALIZE(self, event);
146
+ return Qnil;
147
+ }
148
+
149
+ static VALUE
150
+ newsegment_parse(VALUE self)
151
+ {
152
+ gboolean update;
153
+ gdouble rate, applied_rate;
154
+ GstFormat format;
155
+ gint64 start, stop, position;
156
+
157
+ gst_event_parse_new_segment_full(RGST_EVENT(self), &update, &rate,
158
+ &applied_rate, &format, &start, &stop,
159
+ &position);
160
+
161
+ return rb_ary_new3(7, CBOOL2RVAL(update), DBL2NUM(update), DBL2NUM(rate),
162
+ GST_FORMAT2RVAL(format), LL2NUM(start), LL2NUM(stop),
163
+ LL2NUM(position));
164
+ }
165
+
166
+ static VALUE
167
+ tag_initialize(VALUE self, VALUE taglist)
168
+ {
169
+ GstEvent *event;
170
+ event = gst_event_new_tag(RVAL2GST_STRUCT(taglist));
171
+
172
+ G_INITIALIZE(self, event);
173
+ return Qnil;
174
+ }
175
+
176
+ static VALUE
177
+ tag_parse(VALUE self)
178
+ {
179
+ GstTagList *taglist;
180
+
181
+ gst_event_parse_tag(RGST_EVENT(self), &taglist);
182
+
183
+ return GST_STRUCT2RVAL(taglist);
184
+ }
185
+
186
+ static VALUE
187
+ buffersize_initialize(VALUE self, VALUE format, VALUE minsize, VALUE maxsize,
188
+ VALUE async)
189
+ {
190
+ GstEvent *event;
191
+
192
+ event = gst_event_new_buffer_size(RVAL2GST_FORMAT(format), NUM2LL(minsize),
193
+ NUM2LL(maxsize), RVAL2CBOOL(async));
194
+
195
+ G_INITIALIZE(self, event);
196
+ return Qnil;
197
+ }
198
+
199
+ static VALUE
200
+ buffersize_parse(VALUE self)
201
+ {
202
+ GstFormat format;
203
+ gint64 minsize;
204
+ gint64 maxsize;
205
+ gboolean async;
206
+
207
+ gst_event_parse_buffer_size(RGST_EVENT(self), &format, &minsize,
208
+ &maxsize, &async);
209
+
210
+ return rb_ary_new3(4, GST_FORMAT2RVAL(format), LL2NUM(minsize),
211
+ LL2NUM(maxsize), CBOOL2RVAL(async));
212
+ }
213
+
214
+ static VALUE
215
+ qos_initialize(VALUE self, VALUE portion, VALUE clockdiff, VALUE timestamp)
216
+ {
217
+ GstEvent *event;
218
+
219
+ event = gst_event_new_qos(NUM2DBL(portion), NUM2LL(clockdiff),
220
+ NUM2ULL(timestamp));
221
+
222
+ G_INITIALIZE(self, event);
223
+ return Qnil;
224
+ }
225
+
226
+ static VALUE
227
+ qos_parse(VALUE self)
228
+ {
229
+ gdouble proportion;
230
+ GstClockTimeDiff diff;
231
+ GstClockTime timestamp;
232
+
233
+ gst_event_parse_qos(RGST_EVENT(self), &proportion, &diff, &timestamp);
234
+
235
+ return rb_ary_new3(3, DBL2NUM(proportion), LL2NUM(diff),
236
+ ULL2NUM(timestamp));
237
+ }
238
+
239
+ static VALUE
240
+ seek_initialize(VALUE self, VALUE rate, VALUE format, VALUE flags,
241
+ VALUE start_type, VALUE start, VALUE stop_type, VALUE stop)
242
+ {
243
+ GstEvent *event;
244
+
245
+ event = gst_event_new_seek(NUM2DBL(rate),
246
+ RVAL2GST_FORMAT(format),
247
+ RVAL2GFLAGS(flags, GST_TYPE_SEEK_FLAGS),
248
+ RVAL2GENUM(start_type, GST_TYPE_SEEK_TYPE),
249
+ NUM2ULL(start),
250
+ RVAL2GENUM(stop_type, GST_TYPE_SEEK_TYPE),
251
+ NUM2ULL(stop));
252
+
253
+ G_INITIALIZE(self, event);
254
+ return Qnil;
255
+ }
256
+
257
+ static VALUE
258
+ seek_parse(VALUE self)
259
+ {
260
+ gdouble rate;
261
+ GstFormat format;
262
+ GstSeekFlags flags;
263
+ GstSeekType start_type, stop_type;
264
+ gint64 start, stop;
265
+
266
+ gst_event_parse_seek(RGST_EVENT(self), &rate, &format, &flags, &start_type,
267
+ &start, &stop_type, &stop);
268
+
269
+ return rb_ary_new3(6, DBL2NUM(rate), GST_FORMAT2RVAL(format),
270
+ GFLAGS2RVAL(start_type, GST_TYPE_SEEK_FLAGS),
271
+ LL2NUM(start),
272
+ GFLAGS2RVAL(stop_type, GST_TYPE_SEEK_FLAGS),
273
+ LL2NUM(stop));
274
+ }
275
+
276
+ static VALUE
277
+ navigation_initialize(VALUE self, VALUE structure)
278
+ {
279
+ GstEvent *event;
280
+
281
+ event = gst_event_new_navigation(RVAL2GST_STRUCT(structure));
282
+
283
+ G_INITIALIZE(self, event);
284
+ return Qnil;
285
+ }
286
+
287
+ static VALUE
288
+ latency_initialize(VALUE self, VALUE latency)
289
+ {
290
+ GstEvent *event;
291
+
292
+ event = gst_event_new_latency(NUM2ULL(latency));
293
+
294
+ G_INITIALIZE(self, event);
295
+ return Qnil;
296
+ }
297
+
298
+ static VALUE
299
+ latency_parse(VALUE self)
300
+ {
301
+ GstClockTime latency;
302
+
303
+ gst_event_parse_latency(RGST_EVENT(self), &latency);
304
+
305
+ return LL2NUM(latency);
306
+ }
307
+
308
+ static VALUE
309
+ rbgst_event_get_type(VALUE self)
310
+ {
311
+ return GENUM2RVAL(GST_EVENT_TYPE(RVAL2GST_EVENT(self)), GST_TYPE_EVENT_TYPE);
312
+ }
313
+
314
+ void
315
+ Init_gst_event (void)
316
+ {
317
+ table.type = GST_TYPE_EVENT;
318
+ table.get_superclass = get_superclass;
319
+ table.instance2robj = instance2robj;
320
+ RG_DEF_CONVERSION(&table);
321
+
322
+ rb_cGstEvent = G_DEF_CLASS(GST_TYPE_EVENT, "Event", mGst);
323
+ rb_define_method(rb_cGstEvent, "get_type", rbgst_event_get_type, 0);
324
+ G_DEF_CLASS(GST_TYPE_EVENT_TYPE, "EventType", mGst);
325
+ G_DEF_CONSTANTS(rb_cGstEvent, GST_TYPE_EVENT_TYPE, "GST_EVENT_");
326
+
327
+ #define DEFINE_EVENT(type, lctype, arguments) \
328
+ rb_cGstEvent ## type = \
329
+ rb_define_class_under(mGst, "Event" #type, rb_cGstEvent); \
330
+ rb_define_method(rb_cGstEvent ## type, "initialize", \
331
+ lctype ## _initialize, arguments)
332
+
333
+ #define DEFINE_EVENT_PARSE(type, lctype, arguments) \
334
+ DEFINE_EVENT(type, lctype, arguments); \
335
+ rb_define_method(rb_cGstEvent ## type, "parse", \
336
+ lctype ## _parse, 0)
337
+
338
+ DEFINE_EVENT(FlushStart, flush_start, 0);
339
+ DEFINE_EVENT(FlushStop, flush_stop, 0);
340
+ DEFINE_EVENT(EOS, eos, 0);
341
+ DEFINE_EVENT_PARSE(NewSegment, newsegment, 7);
342
+ DEFINE_EVENT_PARSE(Tag, tag, 1);
343
+ DEFINE_EVENT_PARSE(BufferSize, buffersize, 4);
344
+ DEFINE_EVENT_PARSE(QOS, qos, 3);
345
+ DEFINE_EVENT_PARSE(Seek, seek, 7);
346
+ DEFINE_EVENT(Navigation, navigation, 1);
347
+ DEFINE_EVENT_PARSE(Latency, latency, 1);
348
+
349
+ #undef DEFINE_EVENT_PARSE
350
+ #undef DEFINE_EVENT
351
+ }
Binary file
@@ -0,0 +1,42 @@
1
+ /*
2
+ * Copyright (C) 2006,2008 Sjoerd Simons <sjoerd@luon.net>
3
+ * Copyright (C) 2003, 2004 Laurent Sansonetti <lrz@gnome.org>
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
+
24
+ static VALUE
25
+ rb_gst_ghost_pad_new(VALUE self, VALUE name, VALUE pad)
26
+ {
27
+ GstPad *gpad;
28
+
29
+ gpad = gst_ghost_pad_new(RVAL2CSTR(name), RVAL2GST_PAD(pad));
30
+
31
+ G_INITIALIZE(self, gpad);
32
+
33
+ return Qnil;
34
+ }
35
+
36
+ void
37
+ Init_gst_ghost_pad(void)
38
+ {
39
+ VALUE c = G_DEF_CLASS(GST_TYPE_GHOST_PAD, "GhostPad", mGst);
40
+
41
+ rb_define_method(c, "initialize", rb_gst_ghost_pad_new, 2);
42
+ }
Binary file
@@ -0,0 +1,67 @@
1
+ /*
2
+ * Copyright (C) 2003, 2004 Laurent Sansonetti <lrz@gnome.org>
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
+
24
+ #define SELF(self) RVAL2GST_INDEX_FACTORY(self)
25
+
26
+ /* Class: Gst::IndexFactory
27
+ * Create indexes from a factory.
28
+ */
29
+
30
+ static VALUE
31
+ s_find(VALUE self, VALUE name)
32
+ {
33
+ return GOBJ2RVAL(gst_index_factory_find(RVAL2CSTR(name)));
34
+ }
35
+
36
+ /* Method: to_s
37
+ * Returns: a String representing the factory.
38
+ */
39
+ static VALUE
40
+ rb_gst_indexfactory_to_s (VALUE self)
41
+ {
42
+ GstIndexFactory *factory = RGST_INDEX_FACTORY (self);
43
+ return rb_str_new_with_format ("Index: %s (%s)",
44
+ GST_PLUGIN_FEATURE_NAME (factory),
45
+ factory->longdesc);
46
+ }
47
+
48
+ static VALUE
49
+ get_description(VALUE self)
50
+ {
51
+ return CSTR2RVAL(SELF(self)->longdesc);
52
+ }
53
+
54
+ void
55
+ Init_gst_indexfactory (void)
56
+ {
57
+ VALUE rb_cGstIndexFactory;
58
+
59
+ rb_cGstIndexFactory = G_DEF_CLASS(GST_TYPE_INDEX_FACTORY,
60
+ "IndexFactory", mGst);
61
+
62
+ rb_define_singleton_method(rb_cGstIndexFactory, "find", s_find, 1);
63
+
64
+ rb_define_method(rb_cGstIndexFactory, "to_s", rb_gst_indexfactory_to_s, 0);
65
+
66
+ rb_define_method(rb_cGstIndexFactory, "description", get_description, 0);
67
+ }