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,336 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
- * Copyright (C) 2008 Ruby-GNOME2 Project Team
5
- * Copyright (C) 2006, 2008 Sjoerd Simons <sjoerd@luon.net>
6
- * Copyright (C) 2003, 2004 Laurent Sansonetti <lrz@gnome.org>
7
- *
8
- * This library 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
- * This library 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 this library; if not, write to the Free Software
20
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21
- * MA 02110-1301 USA
22
- */
23
-
24
- #include "rbgst-private.h"
25
-
26
- #define RG_TARGET_NAMESPACE cPad
27
- #define SELF(self) RVAL2GST_PAD(self)
28
-
29
- static VALUE RG_TARGET_NAMESPACE;
30
-
31
- /* Class: Gst::Pad
32
- * The link between Gst::Element objects.
33
- */
34
-
35
- /* Method: name
36
- * Returns: the pad's name.
37
- */
38
-
39
- static VALUE
40
- rg_name (VALUE self)
41
- {
42
- GstPad *pad = RGST_PAD (self);
43
- return CSTR2RVAL (gst_pad_get_name (pad));
44
- }
45
-
46
- /* Method: direction
47
- * Returns: the pad's direction (see Gst::Pad::Direction).
48
- */
49
-
50
- static VALUE
51
- rg_direction (VALUE self)
52
- {
53
- GstPad *pad = RGST_PAD (self);
54
- return GENUM2RVAL (GST_PAD_DIRECTION(pad), GST_TYPE_PAD_DIRECTION);
55
- }
56
-
57
- /* Method: pad_template
58
- * Returns: the Gst::PadTemplate object of this pad.
59
- */
60
- static VALUE
61
- rg_pad_template(VALUE self)
62
- {
63
- GstPadTemplate *templ = gst_pad_get_pad_template (RGST_PAD (self));
64
- if (templ != NULL) {
65
- gst_object_ref (GST_OBJECT (templ));
66
- return RGST_PAD_TEMPLATE_NEW (templ);
67
- }
68
- return Qnil;
69
- }
70
-
71
- /*
72
- * Method: provides_query_types?
73
- *
74
- * Checks if the pad supports query types not handled by
75
- * the default query types dispatcher.
76
- *
77
- * Returns: true if supported, false otherwise.
78
- */
79
- static VALUE
80
- rg_provides_query_types_p (VALUE self)
81
- {
82
- GstPad *pad = RGST_PAD (self);
83
- return CBOOL2RVAL (GST_PAD_QUERYTYPEFUNC (pad) != gst_pad_get_query_types_default);
84
- }
85
-
86
- /*
87
- * Method: query_types
88
- *
89
- * Gets a list of supported queries that can be performed on the pad.
90
- *
91
- * Returns: an array of Gst::QueryType objects.
92
- */
93
- static VALUE
94
- rg_query_types (VALUE self)
95
- {
96
- const GstQueryType *types;
97
- VALUE arr;
98
-
99
- arr = rb_ary_new ();
100
- types = gst_pad_get_query_types (RGST_PAD (self));
101
-
102
- while (types && *types) {
103
- rb_ary_push (arr, RGST_QUERY_TYPE_NEW ((GstQueryType *)types));
104
- types++;
105
- }
106
- return arr;
107
- }
108
-
109
- /*
110
- * Method: each_query_type { |query_type| ... }
111
- *
112
- * Calls the block for each supported query from the pad, passing
113
- * a reference to the Gst::QueryType object as parameter.
114
- *
115
- * Returns: always nil.
116
- */
117
- static VALUE
118
- rg_each_query_type (VALUE self)
119
- {
120
- return rb_ary_yield (rg_query_types (self));
121
- }
122
-
123
- static VALUE
124
- rg_linked_p(VALUE self)
125
- {
126
- return CBOOL2RVAL(gst_pad_is_linked(SELF(self)));
127
- }
128
-
129
- static GstPadLinkReturn
130
- rb_gst_pad_link_raw(VALUE self, VALUE other_pad)
131
- {
132
- GstPad *src_pad;
133
- GstPad *sink_pad;
134
-
135
- src_pad = SELF(self);
136
- if (!RVAL2CBOOL(rb_obj_is_kind_of(other_pad, RG_TARGET_NAMESPACE))) {
137
- rb_raise(rb_eTypeError, "Not a Gst::Pad");
138
- }
139
-
140
- sink_pad = RVAL2GST_PAD(other_pad);
141
- return gst_pad_link(src_pad, sink_pad);
142
- }
143
-
144
- /*
145
- * Method: link(other_pad)
146
- * other_pad: a Gst::Pad.
147
- *
148
- * Links the current pad (source) to an other pad (sink).
149
- *
150
- * Returns: a Gst::Pad::LinkReturn
151
- */
152
- static VALUE
153
- rg_link(VALUE self, VALUE other_pad)
154
- {
155
- return GENUM2RVAL(rb_gst_pad_link_raw(self, other_pad),
156
- GST_TYPE_PAD_LINK_RETURN);
157
- }
158
-
159
- /*
160
- * Method: >> other_pad
161
- * other_pad: a Gst::Pad.
162
- *
163
- * Links the current pad (source) to an other pad (sink).
164
- *
165
- * Returns: the destination pad, or nil if the link failed.
166
- * (I can't understand why the return value is
167
- * useful. Because I can't write like the
168
- * following:
169
- * element1["src"] >> element2["sink"] >> element2["src"] >> element3["sink"]
170
- * I need to write like the following:
171
- * element1["src"] >> element2["sink"]
172
- * element2["src"] >> element3["sink"]
173
- * Return values aren't used in this case.)
174
- */
175
- static VALUE
176
- rg_operator_link_shift(VALUE self, VALUE other_pad)
177
- {
178
- if (rb_gst_pad_link_raw(self, other_pad) == GST_PAD_LINK_OK)
179
- return other_pad;
180
- else
181
- return Qnil;
182
- }
183
-
184
- /*
185
- * Method: unlink(other_pad)
186
- * other_pad: a Gst::Pad.
187
- *
188
- * Unlinks the current pad (source) from an other pad (sink).
189
- *
190
- * Returns: true if the pads were unlinked and false if the pads weren't linked.
191
- */
192
- static VALUE
193
- rg_unlink(VALUE self, VALUE other_pad)
194
- {
195
- GstPad *src_pad;
196
- GstPad *sink_pad;
197
-
198
- src_pad = SELF(self);
199
- if (!CBOOL2RVAL(rb_obj_is_kind_of(other_pad, RG_TARGET_NAMESPACE))) {
200
- rb_raise(rb_eTypeError, "Not a Gst::Pad");
201
- }
202
- sink_pad = RVAL2GST_PAD(other_pad);
203
-
204
- return CBOOL2RVAL(gst_pad_unlink(src_pad, sink_pad));
205
- }
206
-
207
- /*
208
- * Method: query(query)
209
- * query: a query (see Gst::Query).
210
- *
211
- * Performs a query on the pad.
212
- *
213
- * Returns: the query result value, or nil if the query could not be performed.
214
- */
215
- /*
216
- * Method: query
217
- */
218
- static VALUE
219
- rg_query(VALUE self, VALUE query)
220
- {
221
- return CBOOL2RVAL(gst_pad_query(SELF(self), RVAL2GST_QUERY(query)));
222
- }
223
-
224
- /*
225
- * Method: send_event(event)
226
- * event: a Gst::Event.
227
- *
228
- * Sends an event to the pad, through a Gst::Event object.
229
- *
230
- * Returns: true if the request event was successfully handled, false
231
- * otherwise.
232
- */
233
- static VALUE
234
- rg_send_event (VALUE self, VALUE event)
235
- {
236
- return CBOOL2RVAL (gst_pad_send_event (RGST_PAD (self),
237
- RGST_EVENT (event)));
238
- }
239
-
240
- /*
241
- * Method: caps
242
- *
243
- * Gets the capabilities of the pad element.
244
- *
245
- * Returns: a Gst::Caps object.
246
- */
247
- static VALUE
248
- rg_caps(VALUE self)
249
- {
250
- return GST_CAPS2RVAL_UNREF(gst_pad_get_caps(SELF(self)));
251
- }
252
-
253
- /*
254
- * Method: negotiated_caps
255
- *
256
- * Gets the capabilities of the pad element.
257
- *
258
- * Returns: a Gst::Caps object.
259
- */
260
- static VALUE
261
- rg_negotiated_caps(VALUE self)
262
- {
263
- return GST_CAPS2RVAL_UNREF(gst_pad_get_negotiated_caps(SELF(self)));
264
- }
265
-
266
- /*
267
- * Method: set_caps
268
- *
269
- * Sets the capabilities of the pad element.
270
- *
271
- * Returns: true if the setting succeeded
272
- */
273
- static VALUE
274
- rg_set_caps(VALUE self, VALUE caps)
275
- {
276
- return CBOOL2RVAL(gst_pad_set_caps(SELF(self), RVAL2GST_CAPS(caps)));
277
- }
278
-
279
- /*
280
- * Method: set_active
281
- *
282
- * Sets the active state of the pad.
283
- *
284
- * Returns: true if the setting succeeded
285
- */
286
- static VALUE
287
- rg_set_active(VALUE self, VALUE active)
288
- {
289
- return CBOOL2RVAL(gst_pad_set_active(SELF(self), RVAL2CBOOL(active)));
290
- }
291
-
292
- /*
293
- * Method: peer
294
- *
295
- * Get the peer of a pad
296
- *
297
- * Returns: Returns the peer pad or Qnil if there is none
298
- */
299
- static VALUE
300
- rg_peer(VALUE self)
301
- {
302
- return GST_PAD2RVAL_UNREF(gst_pad_get_peer(SELF(self)));
303
- }
304
-
305
- void
306
- Init_gst_pad (VALUE mGst)
307
- {
308
- RG_TARGET_NAMESPACE = G_DEF_CLASS (GST_TYPE_PAD, "Pad", mGst);
309
-
310
- RG_DEF_METHOD(direction, 0);
311
- RG_DEF_METHOD(name, 0);
312
- RG_DEF_METHOD(pad_template, 0);
313
- RG_DEF_METHOD_P(provides_query_types, 0);
314
- RG_DEF_METHOD(query_types, 0);
315
- RG_DEF_METHOD(each_query_type, 0);
316
- RG_DEF_METHOD_P(linked, 0);
317
- RG_DEF_METHOD(link, 1);
318
- RG_DEF_METHOD_OPERATOR(">>", link_shift, 1);
319
- RG_DEF_METHOD(unlink, 1);
320
- RG_DEF_METHOD(query, 1);
321
- RG_DEF_METHOD(send_event, 1);
322
- RG_DEF_METHOD(caps, 0);
323
- RG_DEF_METHOD(negotiated_caps, 0);
324
- RG_DEF_METHOD(set_caps, 1);
325
- RG_DEF_METHOD(set_active, 1);
326
- RG_DEF_METHOD(peer, 0);
327
-
328
- G_DEF_CLASS(GST_TYPE_PAD_LINK_RETURN, "LinkReturn", RG_TARGET_NAMESPACE);
329
- G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GST_TYPE_PAD_LINK_RETURN, "GST_PAD_");
330
- G_DEF_CLASS(GST_TYPE_PAD_DIRECTION, "Direction", RG_TARGET_NAMESPACE);
331
- G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GST_TYPE_PAD_DIRECTION, "GST_PAD_");
332
- G_DEF_CLASS(GST_TYPE_PAD_FLAGS, "Flags", RG_TARGET_NAMESPACE);
333
- G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GST_TYPE_PAD_FLAGS, "GST_PAD_");
334
- G_DEF_CLASS(GST_TYPE_PAD_PRESENCE, "Presence", RG_TARGET_NAMESPACE);
335
- G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GST_TYPE_PAD_PRESENCE, "GST_PAD_");
336
- }
@@ -1,91 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2011-2012 Ruby-GNOME2 Project Team
4
- * Copyright (C) 2008 Sjoerd Simons <sjoerd@luon.net>
5
- * Copyright (C) 2003, 2004 Laurent Sansonetti <lrz@gnome.org>
6
- *
7
- * This library is free software; you can redistribute it and/or
8
- * modify it under the terms of the GNU Lesser General Public
9
- * License as published by the Free Software Foundation; either
10
- * version 2.1 of the License, or (at your option) any later version.
11
- *
12
- * This library is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
- * Lesser General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU Lesser General Public
18
- * License along with this library; if not, write to the Free Software
19
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20
- * MA 02110-1301 USA
21
- */
22
-
23
- #include "rbgst-private.h"
24
-
25
- #define RG_TARGET_NAMESPACE cPipeline
26
- #define SELF(obj) (RVAL2GST_PIPELINE(obj))
27
-
28
- /* Class: Gst::Pipeline
29
- * In almost all cases, you'll want to use a Gst::Pipeline when creating a
30
- * filter graph. The Gst::Pipeline will manage all the scheduling issues,
31
- * including threading, as well as provide simple interfaces to common
32
- * functions, like 'Play'.
33
- */
34
-
35
- /*
36
- * Class method: new(name=nil)
37
- * name: a name for the pipeline.
38
- *
39
- * Constructs a new Gst::Pipeline object.
40
- *
41
- * If element name is ommited (or nil), then the pipeline will receive a guaranteed
42
- * unique name, consisting of the "pipeline" string and a number.
43
- * If name is given, it will be given the name supplied.
44
- *
45
- * Returns: a newly constructed Gst::Pipeline.
46
- */
47
- static VALUE
48
- rg_initialize (int argc, VALUE *argv, VALUE self)
49
- {
50
- GstElement *bin;
51
- VALUE name;
52
-
53
- rb_scan_args (argc, argv, "01", &name);
54
-
55
- bin = gst_pipeline_new (RVAL2CSTR_ACCEPT_NIL(name));
56
- if (bin != NULL)
57
- RBGST_INITIALIZE (self, bin);
58
- return Qnil;
59
- }
60
-
61
- static VALUE
62
- rg_bus(VALUE self)
63
- {
64
- GstBus *bus;
65
- VALUE ret;
66
-
67
- bus = gst_pipeline_get_bus(SELF(self));
68
- if (bus == NULL)
69
- return Qnil;
70
-
71
- ret = GST_BUS2RVAL_UNREF(bus);
72
-
73
- /* Make the bus a child of the pipeline as their (minimum) livetimes are
74
- * bound together.. A pipeline can potentially change it's bus though, but
75
- * we have no way to catch that case */
76
- G_CHILD_ADD(self, ret);
77
-
78
- return ret;
79
- }
80
-
81
- void
82
- Init_gst_pipeline(VALUE mGst)
83
- {
84
- VALUE RG_TARGET_NAMESPACE;
85
-
86
- RG_TARGET_NAMESPACE = G_DEF_CLASS(GST_TYPE_PIPELINE, "Pipeline", mGst);
87
-
88
- RG_DEF_METHOD(initialize, -1);
89
-
90
- RG_DEF_METHOD(bus, 0);
91
- }
@@ -1,131 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2011-2012 Ruby-GNOME2 Project Team
4
- * Copyright (C) 2007 Ruby-GNOME2 Project Team
5
- * Copyright (C) 2003, 2004 Laurent Sansonetti <lrz@gnome.org>
6
- *
7
- * This library is free software; you can redistribute it and/or
8
- * modify it under the terms of the GNU Lesser General Public
9
- * License as published by the Free Software Foundation; either
10
- * version 2.1 of the License, or (at your option) any later version.
11
- *
12
- * This library is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
- * Lesser General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU Lesser General Public
18
- * License along with this library; if not, write to the Free Software
19
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20
- * MA 02110-1301 USA
21
- */
22
-
23
- #include "rbgst-private.h"
24
-
25
- #define RG_TARGET_NAMESPACE cPluginFeature
26
- #define SELF(self) RVAL2GST_PLUGIN_FEATURE(self)
27
-
28
- #define RVAL2GST_RANK(rank) RVAL2GENUM(rank, GST_TYPE_RANK)
29
- #define GST_RANK2RVAL(rank) GENUM2RVAL(rank, GST_TYPE_RANK)
30
-
31
- /* Class: Gst::PluginFeature
32
- * This is a base class for anything that can be added to a Gst::Plugin.
33
- */
34
-
35
- /* Method: name
36
- * Returns: the name of the feature.
37
- */
38
- static VALUE
39
- rg_name (VALUE self)
40
- {
41
- GstPluginFeature *feature = RGST_PLUGIN_FEATURE (self);
42
- return CSTR2RVAL (GST_PLUGIN_FEATURE_NAME (feature));
43
- }
44
-
45
- gboolean
46
- is_valid_pluginfeature_type (const GType type)
47
- {
48
- return type == GST_TYPE_ELEMENT_FACTORY ||
49
- type == GST_TYPE_INDEX_FACTORY;
50
- }
51
-
52
- VALUE
53
- instanciate_pluginfeature (GstPluginFeature *feature)
54
- {
55
-
56
- if (GST_IS_ELEMENT_FACTORY (feature))
57
- return RGST_ELEMENT_FACTORY_NEW (feature);
58
- else if (GST_IS_INDEX_FACTORY (feature))
59
- return RGST_INDEX_FACTORY_NEW (feature);
60
- else if (GST_IS_TYPE_FIND_FACTORY (feature))
61
- return RGST_TYPE_FIND_FACTORY_NEW (feature);
62
- else
63
- rb_raise(rb_eArgError,
64
- "Invalid plugin feature of type ``%s''",
65
- g_type_name (G_OBJECT_TYPE (feature)));
66
- return Qnil;
67
- }
68
-
69
- static VALUE
70
- rg_load_bang(VALUE self)
71
- {
72
- GstPluginFeature *original, *feature;
73
-
74
- original = SELF(self);
75
- feature = gst_plugin_feature_load(original);
76
- if (feature) {
77
- if (feature != original)
78
- G_INITIALIZE(self, feature);
79
- gst_object_unref(original);
80
- return Qtrue;
81
- } else {
82
- return Qfalse;
83
- }
84
- }
85
-
86
- static VALUE
87
- rg_loaded_p(VALUE self)
88
- {
89
- return CBOOL2RVAL(SELF(self)->loaded);
90
- }
91
-
92
- static VALUE
93
- rg_rank(VALUE self)
94
- {
95
- return GST_RANK2RVAL(gst_plugin_feature_get_rank(SELF(self)));
96
- }
97
-
98
- static VALUE
99
- rg_set_rank(VALUE self, VALUE rank)
100
- {
101
- gst_plugin_feature_set_rank(SELF(self), RVAL2GST_RANK(rank));
102
- return Qnil;
103
- }
104
-
105
- static VALUE
106
- rg_plugin_name(VALUE self)
107
- {
108
- return CSTR2RVAL(SELF(self)->plugin_name);
109
- }
110
-
111
- void
112
- Init_gst_plugin_feature (VALUE mGst)
113
- {
114
- VALUE RG_TARGET_NAMESPACE;
115
-
116
- RG_TARGET_NAMESPACE = G_DEF_CLASS(GST_TYPE_PLUGIN_FEATURE,
117
- "PluginFeature", mGst);
118
-
119
- G_DEF_CLASS(GST_TYPE_RANK, "Rank", mGst);
120
- G_DEF_CONSTANTS(mGst, GST_TYPE_RANK, "GST_");
121
-
122
- RG_DEF_METHOD(name, 0);
123
-
124
- RG_DEF_METHOD_BANG(load, 0);
125
- RG_DEF_METHOD_P(loaded, 0);
126
-
127
- RG_DEF_METHOD(rank, 0);
128
- RG_DEF_METHOD(set_rank, 1);
129
-
130
- RG_DEF_METHOD(plugin_name, 0);
131
- }
@@ -1,162 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
- * Copyright (C) 2007 Ruby-GNOME2 Project Team
5
- * Copyright (C) 2003, 2004 Laurent Sansonetti <lrz@gnome.org>
6
- *
7
- * This library is free software; you can redistribute it and/or
8
- * modify it under the terms of the GNU Lesser General Public
9
- * License as published by the Free Software Foundation; either
10
- * version 2.1 of the License, or (at your option) any later version.
11
- *
12
- * This library is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
- * Lesser General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU Lesser General Public
18
- * License along with this library; if not, write to the Free Software
19
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20
- * MA 02110-1301 USA
21
- */
22
-
23
- #include "rbgst-private.h"
24
-
25
- #define RG_TARGET_NAMESPACE cPlugin
26
- #define SELF(self) RVAL2GST_PLUGIN(self)
27
-
28
- /* Class: Gst::Plugin
29
- * Dynamically loadable Elements
30
- */
31
-
32
- /* Method: loaded?
33
- * Returns: true if the plugin is loaded into memory, false otherwise.
34
- */
35
- static VALUE
36
- rg_loaded_p (VALUE self)
37
- {
38
- GstPlugin *plugin = RGST_PLUGIN (self);
39
- return CBOOL2RVAL (gst_plugin_is_loaded (plugin));
40
- }
41
-
42
- /* Method: filename
43
- * Returns: the filename where this plugin comes from.
44
- */
45
- static VALUE
46
- rg_filename (VALUE self)
47
- {
48
- return CSTR2RVAL (gst_plugin_get_filename (RGST_PLUGIN (self)));
49
- }
50
-
51
- /* Method: description
52
- * Returns: a long description of the plugin.
53
- */
54
- static VALUE
55
- rg_description (VALUE self)
56
- {
57
- return CSTR2RVAL (gst_plugin_get_description (RGST_PLUGIN (self)));
58
- }
59
-
60
- /* Method: package
61
- * Returns: the name of the package this plugin belongs to.
62
- */
63
- static VALUE
64
- rg_package (VALUE self)
65
- {
66
- return CSTR2RVAL (gst_plugin_get_package (RGST_PLUGIN (self)));
67
- }
68
-
69
- /* Method: license
70
- * Returns: the effective license of the plugin.
71
- */
72
- static VALUE
73
- rg_license (VALUE self)
74
- {
75
- return CSTR2RVAL (gst_plugin_get_license (RGST_PLUGIN (self)));
76
- }
77
-
78
- static VALUE
79
- rg_source (VALUE self)
80
- {
81
- return CSTR2RVAL(gst_plugin_get_source(SELF(self)));
82
- }
83
-
84
- /* Method: origin
85
- * Returns: the URL to the provider of the plugin.
86
- */
87
- static VALUE
88
- rg_origin (VALUE self)
89
- {
90
- return CSTR2RVAL (gst_plugin_get_origin ( RGST_PLUGIN (self)));
91
- }
92
-
93
- /* Method: name
94
- * Returns: the unique name of the plugin.
95
- */
96
- static VALUE
97
- rg_name (VALUE self)
98
- {
99
- return CSTR2RVAL (gst_plugin_get_name (RGST_PLUGIN (self)));
100
- }
101
-
102
- /* Method: minor_version
103
- * Returns: the minor version of the core this plugin was compiled for.
104
- */
105
- static VALUE
106
- rg_minor_version (VALUE self)
107
- {
108
- return INT2FIX (RGST_PLUGIN (self)->desc.minor_version);
109
- }
110
-
111
- /* Method: major_version
112
- * Returns: the major version of the core this plugin was compiled for.
113
- */
114
- static VALUE
115
- rg_major_version (VALUE self)
116
- {
117
- return INT2FIX (RGST_PLUGIN (self)->desc.major_version);
118
- }
119
-
120
- /* Method: version
121
- * Returns: the version of the plugin (note: as a string).
122
- */
123
- static VALUE
124
- rg_version (VALUE self)
125
- {
126
- return CSTR2RVAL (RGST_PLUGIN (self)->desc.version);
127
- }
128
-
129
- /* Method: ==(plugin)
130
- * Returns: true if two Gst::Plugin objects are refered by the same file,
131
- * false otherwise.
132
- */
133
- static VALUE
134
- rg_operator_is_equal (VALUE self, VALUE other_plugin)
135
- {
136
- return NIL_P (other_plugin)
137
- ? Qfalse
138
- : rb_equal (rg_filename (self),
139
- rg_filename (other_plugin));
140
- }
141
-
142
- void
143
- Init_gst_plugin (VALUE mGst)
144
- {
145
- VALUE RG_TARGET_NAMESPACE;
146
-
147
- RG_TARGET_NAMESPACE = G_DEF_CLASS(GST_TYPE_PLUGIN, "Plugin", mGst);
148
-
149
- RG_DEF_METHOD_P(loaded, 0);
150
- RG_DEF_METHOD_OPERATOR("==", is_equal, 1);
151
-
152
- RG_DEF_METHOD(filename, 0);
153
- RG_DEF_METHOD(major_version, 0);
154
- RG_DEF_METHOD(minor_version, 0);
155
- RG_DEF_METHOD(name, 0);
156
- RG_DEF_METHOD(description, 0);
157
- RG_DEF_METHOD(version, 0);
158
- RG_DEF_METHOD(license, 0);
159
- RG_DEF_METHOD(source, 0);
160
- RG_DEF_METHOD(package, 0);
161
- RG_DEF_METHOD(origin, 0);
162
- }