gstreamer 0.90.6
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +1157 -0
- data/README +33 -0
- data/Rakefile +15 -0
- data/ext/gstreamer/Makefile +162 -0
- data/ext/gstreamer/depend +5 -0
- data/ext/gstreamer/extconf.rb +63 -0
- data/ext/gstreamer/gst.so +0 -0
- data/ext/gstreamer/misc.c +62 -0
- data/ext/gstreamer/misc.o +0 -0
- data/ext/gstreamer/rbgst-bin.c +466 -0
- data/ext/gstreamer/rbgst-bin.o +0 -0
- data/ext/gstreamer/rbgst-buffer.c +365 -0
- data/ext/gstreamer/rbgst-buffer.o +0 -0
- data/ext/gstreamer/rbgst-bus.c +92 -0
- data/ext/gstreamer/rbgst-bus.o +0 -0
- data/ext/gstreamer/rbgst-caps.c +441 -0
- data/ext/gstreamer/rbgst-caps.o +0 -0
- data/ext/gstreamer/rbgst-child-proxy.c +33 -0
- data/ext/gstreamer/rbgst-child-proxy.o +0 -0
- data/ext/gstreamer/rbgst-clock.c +108 -0
- data/ext/gstreamer/rbgst-clock.o +0 -0
- data/ext/gstreamer/rbgst-element-factory.c +255 -0
- data/ext/gstreamer/rbgst-element-factory.o +0 -0
- data/ext/gstreamer/rbgst-element.c +1053 -0
- data/ext/gstreamer/rbgst-element.o +0 -0
- data/ext/gstreamer/rbgst-event.c +351 -0
- data/ext/gstreamer/rbgst-event.o +0 -0
- data/ext/gstreamer/rbgst-ghost-pad.c +42 -0
- data/ext/gstreamer/rbgst-ghost-pad.o +0 -0
- data/ext/gstreamer/rbgst-index-factory.c +67 -0
- data/ext/gstreamer/rbgst-index-factory.o +0 -0
- data/ext/gstreamer/rbgst-message.c +784 -0
- data/ext/gstreamer/rbgst-message.o +0 -0
- data/ext/gstreamer/rbgst-mini-object.c +220 -0
- data/ext/gstreamer/rbgst-mini-object.o +0 -0
- data/ext/gstreamer/rbgst-object.c +81 -0
- data/ext/gstreamer/rbgst-object.o +0 -0
- data/ext/gstreamer/rbgst-pad-template.c +124 -0
- data/ext/gstreamer/rbgst-pad-template.o +0 -0
- data/ext/gstreamer/rbgst-pad.c +338 -0
- data/ext/gstreamer/rbgst-pad.o +0 -0
- data/ext/gstreamer/rbgst-pipeline.c +90 -0
- data/ext/gstreamer/rbgst-pipeline.o +0 -0
- data/ext/gstreamer/rbgst-plugin-feature.c +134 -0
- data/ext/gstreamer/rbgst-plugin-feature.o +0 -0
- data/ext/gstreamer/rbgst-plugin.c +164 -0
- data/ext/gstreamer/rbgst-plugin.o +0 -0
- data/ext/gstreamer/rbgst-private.c +89 -0
- data/ext/gstreamer/rbgst-private.h +37 -0
- data/ext/gstreamer/rbgst-private.o +0 -0
- data/ext/gstreamer/rbgst-query.c +289 -0
- data/ext/gstreamer/rbgst-query.o +0 -0
- data/ext/gstreamer/rbgst-seek.c +36 -0
- data/ext/gstreamer/rbgst-seek.o +0 -0
- data/ext/gstreamer/rbgst-static-caps.c +49 -0
- data/ext/gstreamer/rbgst-static-caps.o +0 -0
- data/ext/gstreamer/rbgst-static-pad-template.c +64 -0
- data/ext/gstreamer/rbgst-static-pad-template.o +0 -0
- data/ext/gstreamer/rbgst-structure.c +300 -0
- data/ext/gstreamer/rbgst-structure.o +0 -0
- data/ext/gstreamer/rbgst-system-clock.c +45 -0
- data/ext/gstreamer/rbgst-system-clock.o +0 -0
- data/ext/gstreamer/rbgst-type-find-factory.c +124 -0
- data/ext/gstreamer/rbgst-type-find-factory.o +0 -0
- data/ext/gstreamer/rbgst-value.c +517 -0
- data/ext/gstreamer/rbgst-value.o +0 -0
- data/ext/gstreamer/rbgst-x-overlay.c +132 -0
- data/ext/gstreamer/rbgst-x-overlay.o +0 -0
- data/ext/gstreamer/rbgst.c +279 -0
- data/ext/gstreamer/rbgst.h +197 -0
- data/ext/gstreamer/rbgst.o +0 -0
- data/ext/gstreamer/rbgstclockentry.c +268 -0
- data/ext/gstreamer/rbgstclockentry.o +0 -0
- data/ext/gstreamer/rbgstformat.c +159 -0
- data/ext/gstreamer/rbgstformat.o +0 -0
- data/ext/gstreamer/rbgstindex.c +314 -0
- data/ext/gstreamer/rbgstindex.o +0 -0
- data/ext/gstreamer/rbgstindexentry.c +96 -0
- data/ext/gstreamer/rbgstindexentry.o +0 -0
- data/ext/gstreamer/rbgstparse.c +66 -0
- data/ext/gstreamer/rbgstparse.o +0 -0
- data/ext/gstreamer/rbgstquerytype.c +159 -0
- data/ext/gstreamer/rbgstquerytype.o +0 -0
- data/ext/gstreamer/rbgstregistry.c +278 -0
- data/ext/gstreamer/rbgstregistry.o +0 -0
- data/ext/gstreamer/rbgsttag.c +111 -0
- data/ext/gstreamer/rbgsttag.o +0 -0
- data/ext/gstreamer/rbgsttagsetter.c +50 -0
- data/ext/gstreamer/rbgsttagsetter.o +0 -0
- data/ext/gstreamer/rbgstxml.c +189 -0
- data/ext/gstreamer/rbgstxml.o +0 -0
- data/ext/gstreamer/ruby-gstreamer.pc +3 -0
- data/extconf.rb +49 -0
- data/lib/gst.rb +19 -0
- data/sample/audio-player.rb +54 -0
- data/sample/gst-inspect.rb +417 -0
- data/sample/media-type.rb +55 -0
- data/sample/media-type2.rb +268 -0
- data/sample/ogg-audio-player.rb +54 -0
- data/sample/type-find.rb +46 -0
- data/sample/video-player.rb +57 -0
- data/sample/xml-player.rb +60 -0
- data/test/gst-test-utils.rb +18 -0
- data/test/run-test.rb +25 -0
- data/test/test_bin.rb +167 -0
- data/test/test_buffer.rb +174 -0
- data/test/test_caps.rb +24 -0
- data/test/test_clock.rb +7 -0
- data/test/test_element.rb +87 -0
- data/test/test_element_factory.rb +28 -0
- data/test/test_event.rb +10 -0
- data/test/test_index_factory.rb +7 -0
- data/test/test_message.rb +191 -0
- data/test/test_mini_object.rb +38 -0
- data/test/test_object.rb +10 -0
- data/test/test_pad.rb +68 -0
- data/test/test_plugin.rb +6 -0
- data/test/test_plugin_feature.rb +20 -0
- data/test/test_seek.rb +17 -0
- data/test/test_static_caps.rb +18 -0
- data/test/test_static_pad_template.rb +16 -0
- data/test/test_structure.rb +159 -0
- data/test/test_thread_handling.rb +58 -0
- data/test/test_type_find_factory.rb +8 -0
- data/test/test_value.rb +69 -0
- metadata +208 -0
Binary file
|
@@ -0,0 +1,300 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) 2008 Ruby-GNOME2 Project Team
|
3
|
+
*
|
4
|
+
* This file is part of Ruby/GStreamer.
|
5
|
+
*
|
6
|
+
* Ruby/GStreamer is free software; you can redistribute it and/or
|
7
|
+
* modify it under the terms of the GNU Lesser General Public
|
8
|
+
* License as published by the Free Software Foundation; either
|
9
|
+
* version 2.1 of the License, or (at your option) any later version.
|
10
|
+
*
|
11
|
+
* Ruby/GStreamer is distributed in the hope that it will be useful,
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
+
* Lesser General Public License for more details.
|
15
|
+
*
|
16
|
+
* You should have received a copy of the GNU Lesser General Public
|
17
|
+
* License along with Ruby/GStreamer; if not, write to the Free Software
|
18
|
+
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
19
|
+
*/
|
20
|
+
|
21
|
+
#include "rbgst.h"
|
22
|
+
|
23
|
+
#define SELF(obj) (RVAL2GST_STRUCT(obj))
|
24
|
+
|
25
|
+
static VALUE
|
26
|
+
s_parse(VALUE self, VALUE string)
|
27
|
+
{
|
28
|
+
GstStructure *structure;
|
29
|
+
gchar *end;
|
30
|
+
|
31
|
+
structure = gst_structure_from_string(RVAL2CSTR(string), &end);
|
32
|
+
|
33
|
+
return rb_ary_new3(2, GST_STRUCT2RVAL(structure), CSTR2RVAL(end));
|
34
|
+
}
|
35
|
+
|
36
|
+
static VALUE
|
37
|
+
initialize(int argc, VALUE *argv, VALUE self)
|
38
|
+
{
|
39
|
+
VALUE name, fields;
|
40
|
+
GstStructure *structure;
|
41
|
+
|
42
|
+
rb_scan_args(argc, argv, "11", &name, &fields);
|
43
|
+
|
44
|
+
structure = gst_structure_empty_new(RVAL2CSTR(name));
|
45
|
+
if (!NIL_P(fields)) {
|
46
|
+
/* set fields */
|
47
|
+
}
|
48
|
+
|
49
|
+
G_INITIALIZE(self, structure);
|
50
|
+
|
51
|
+
return Qnil;
|
52
|
+
}
|
53
|
+
|
54
|
+
static VALUE
|
55
|
+
get_name(VALUE self)
|
56
|
+
{
|
57
|
+
return CSTR2RVAL(gst_structure_get_name(SELF(self)));
|
58
|
+
}
|
59
|
+
|
60
|
+
static VALUE
|
61
|
+
set_name(VALUE self, VALUE name)
|
62
|
+
{
|
63
|
+
gst_structure_set_name(SELF(self), RVAL2CSTR(name));
|
64
|
+
return Qnil;
|
65
|
+
}
|
66
|
+
|
67
|
+
static VALUE
|
68
|
+
has_name_p(VALUE self, VALUE name)
|
69
|
+
{
|
70
|
+
return CBOOL2RVAL(gst_structure_has_name(SELF(self), RVAL2CSTR(name)));
|
71
|
+
}
|
72
|
+
|
73
|
+
static VALUE
|
74
|
+
get_value(VALUE self, VALUE name)
|
75
|
+
{
|
76
|
+
return GVAL2RVAL(gst_structure_get_value(SELF(self), RVAL2CSTR(name)));
|
77
|
+
}
|
78
|
+
|
79
|
+
static VALUE
|
80
|
+
set_value(VALUE self, VALUE name, VALUE rb_value)
|
81
|
+
{
|
82
|
+
GValue value = {0};
|
83
|
+
|
84
|
+
rbgobj_initialize_gvalue(&value, rb_value);
|
85
|
+
gst_structure_set_value(SELF(self), RVAL2CSTR(name), &value);
|
86
|
+
g_value_unset(&value);
|
87
|
+
|
88
|
+
return Qnil;
|
89
|
+
}
|
90
|
+
|
91
|
+
static VALUE
|
92
|
+
remove_fields(int argc, VALUE *argv, VALUE self)
|
93
|
+
{
|
94
|
+
int i;
|
95
|
+
VALUE name, rest;
|
96
|
+
GstStructure *structure;
|
97
|
+
|
98
|
+
rb_scan_args(argc, argv, "1*", &name, &rest);
|
99
|
+
|
100
|
+
structure = SELF(self);
|
101
|
+
for (i = 0; i < argc; i++) {
|
102
|
+
name = argv[i];
|
103
|
+
|
104
|
+
gst_structure_remove_field(structure, RVAL2CSTR(name));
|
105
|
+
}
|
106
|
+
|
107
|
+
return Qnil;
|
108
|
+
}
|
109
|
+
|
110
|
+
static VALUE
|
111
|
+
remove_all_fields(VALUE self)
|
112
|
+
{
|
113
|
+
gst_structure_remove_all_fields(SELF(self));
|
114
|
+
return Qnil;
|
115
|
+
}
|
116
|
+
|
117
|
+
typedef struct _EachCallbackInfo
|
118
|
+
{
|
119
|
+
int state;
|
120
|
+
VALUE proc;
|
121
|
+
} EachCallbackInfo;
|
122
|
+
|
123
|
+
typedef struct _EachCallbackData
|
124
|
+
{
|
125
|
+
VALUE proc;
|
126
|
+
VALUE key;
|
127
|
+
VALUE value;
|
128
|
+
} EachCallbackData;
|
129
|
+
|
130
|
+
typedef struct _RValueToGValueData
|
131
|
+
{
|
132
|
+
VALUE rvalue;
|
133
|
+
GValue *gvalue;
|
134
|
+
} RValueToGValueData;
|
135
|
+
|
136
|
+
static VALUE
|
137
|
+
invoke_proc_func(VALUE user_data)
|
138
|
+
{
|
139
|
+
EachCallbackData *data = (EachCallbackData *)user_data;
|
140
|
+
|
141
|
+
return rb_funcall(data->proc,
|
142
|
+
rb_intern("call"),
|
143
|
+
2,
|
144
|
+
data->key,
|
145
|
+
data->value);
|
146
|
+
}
|
147
|
+
|
148
|
+
static VALUE
|
149
|
+
invoke_proc(GQuark field_id, const GValue *value,
|
150
|
+
EachCallbackInfo *info)
|
151
|
+
{
|
152
|
+
EachCallbackData data;
|
153
|
+
|
154
|
+
data.proc = info->proc;
|
155
|
+
data.key = rb_str_new2(g_quark_to_string(field_id));
|
156
|
+
data.value = GVAL2RVAL(value);
|
157
|
+
return rb_protect(invoke_proc_func, (VALUE)(&data), &(info->state));
|
158
|
+
}
|
159
|
+
|
160
|
+
static gboolean
|
161
|
+
foreach_cb(GQuark field_id, const GValue *value, gpointer user_data)
|
162
|
+
{
|
163
|
+
EachCallbackInfo *info = user_data;
|
164
|
+
|
165
|
+
invoke_proc(field_id, value, info);
|
166
|
+
|
167
|
+
return info->state == 0;
|
168
|
+
}
|
169
|
+
|
170
|
+
static VALUE
|
171
|
+
foreach(VALUE self)
|
172
|
+
{
|
173
|
+
EachCallbackInfo info;
|
174
|
+
|
175
|
+
info.state = 0;
|
176
|
+
info.proc = rb_block_proc();
|
177
|
+
|
178
|
+
if (!gst_structure_foreach(SELF(self), foreach_cb, &info))
|
179
|
+
rb_jump_tag(info.state);
|
180
|
+
|
181
|
+
return Qnil;
|
182
|
+
}
|
183
|
+
|
184
|
+
static VALUE
|
185
|
+
invoke_rvalue_to_gvalue(VALUE user_data)
|
186
|
+
{
|
187
|
+
RValueToGValueData *data = (RValueToGValueData *)user_data;
|
188
|
+
|
189
|
+
g_value_unset(data->gvalue);
|
190
|
+
rbgobj_initialize_gvalue(data->gvalue, data->rvalue);
|
191
|
+
|
192
|
+
return Qnil;
|
193
|
+
}
|
194
|
+
|
195
|
+
static gboolean
|
196
|
+
map_in_place_cb(GQuark field_id, GValue *value, gpointer user_data)
|
197
|
+
{
|
198
|
+
EachCallbackInfo *info = user_data;
|
199
|
+
VALUE result;
|
200
|
+
|
201
|
+
result = invoke_proc(field_id, value, info);
|
202
|
+
if (info->state == 0) {
|
203
|
+
RValueToGValueData convert_data;
|
204
|
+
convert_data.rvalue = result;
|
205
|
+
convert_data.gvalue = value;
|
206
|
+
rb_protect(invoke_rvalue_to_gvalue,
|
207
|
+
(VALUE)(&convert_data), &(info->state));
|
208
|
+
}
|
209
|
+
|
210
|
+
return info->state == 0;
|
211
|
+
}
|
212
|
+
|
213
|
+
static VALUE
|
214
|
+
map_in_place(VALUE self)
|
215
|
+
{
|
216
|
+
EachCallbackInfo info;
|
217
|
+
|
218
|
+
info.state = 0;
|
219
|
+
info.proc = rb_block_proc();
|
220
|
+
|
221
|
+
if (!gst_structure_map_in_place(SELF(self), map_in_place_cb, &info))
|
222
|
+
rb_jump_tag(info.state);
|
223
|
+
|
224
|
+
return Qnil;
|
225
|
+
}
|
226
|
+
|
227
|
+
static VALUE
|
228
|
+
n_fields(VALUE self)
|
229
|
+
{
|
230
|
+
return INT2NUM(gst_structure_n_fields(SELF(self)));
|
231
|
+
}
|
232
|
+
|
233
|
+
static VALUE
|
234
|
+
empty_p(VALUE self)
|
235
|
+
{
|
236
|
+
return CBOOL2RVAL(gst_structure_n_fields(SELF(self)) == 0);
|
237
|
+
}
|
238
|
+
|
239
|
+
static VALUE
|
240
|
+
nth_field_name(VALUE self, VALUE index)
|
241
|
+
{
|
242
|
+
return CSTR2RVAL(gst_structure_nth_field_name(SELF(self), NUM2INT(index)));
|
243
|
+
}
|
244
|
+
|
245
|
+
static VALUE
|
246
|
+
has_field_p(VALUE self, VALUE name)
|
247
|
+
{
|
248
|
+
return CBOOL2RVAL(gst_structure_has_field(SELF(self), RVAL2CSTR(name)));
|
249
|
+
}
|
250
|
+
|
251
|
+
static VALUE
|
252
|
+
to_s(VALUE self)
|
253
|
+
{
|
254
|
+
return CSTR2RVAL_FREE(gst_structure_to_string(SELF(self)));
|
255
|
+
}
|
256
|
+
|
257
|
+
void
|
258
|
+
Init_gst_structure(void)
|
259
|
+
{
|
260
|
+
VALUE rb_cGstStructure;
|
261
|
+
|
262
|
+
rb_cGstStructure = G_DEF_CLASS(GST_TYPE_STRUCTURE, "Structure", mGst);
|
263
|
+
|
264
|
+
rb_include_module(rb_cGstStructure, rb_mEnumerable);
|
265
|
+
|
266
|
+
rb_define_singleton_method(rb_cGstStructure, "parse", s_parse, 1);
|
267
|
+
|
268
|
+
rb_define_method(rb_cGstStructure, "initialize", initialize, -1);
|
269
|
+
|
270
|
+
rb_define_method(rb_cGstStructure, "name", get_name, 0);
|
271
|
+
rb_define_method(rb_cGstStructure, "set_name", set_name, 1);
|
272
|
+
rb_define_method(rb_cGstStructure, "has_name?", has_name_p, 1);
|
273
|
+
rb_define_alias(rb_cGstStructure, "have_name?", "has_name?");
|
274
|
+
|
275
|
+
rb_define_method(rb_cGstStructure, "[]", get_value, 1);
|
276
|
+
rb_define_method(rb_cGstStructure, "[]=", set_value, 2);
|
277
|
+
|
278
|
+
rb_define_method(rb_cGstStructure, "remove", remove_fields, -1);
|
279
|
+
rb_define_alias(rb_cGstStructure, "delete", "remove");
|
280
|
+
rb_define_method(rb_cGstStructure, "remove_all", remove_all_fields, 0);
|
281
|
+
rb_define_alias(rb_cGstStructure, "clear", "remove_all");
|
282
|
+
|
283
|
+
rb_define_method(rb_cGstStructure, "each", foreach, 0);
|
284
|
+
|
285
|
+
rb_define_method(rb_cGstStructure, "map!", map_in_place, 0);
|
286
|
+
rb_define_alias(rb_cGstStructure, "collect!", "map!");
|
287
|
+
|
288
|
+
rb_define_method(rb_cGstStructure, "size", n_fields, 0);
|
289
|
+
rb_define_alias(rb_cGstStructure, "length", "size");
|
290
|
+
rb_define_method(rb_cGstStructure, "empty?", empty_p, 0);
|
291
|
+
|
292
|
+
rb_define_method(rb_cGstStructure, "nth_field_name", nth_field_name, 1);
|
293
|
+
|
294
|
+
rb_define_method(rb_cGstStructure, "has_field?", has_field_p, 1);
|
295
|
+
rb_define_alias(rb_cGstStructure, "have_field?", "has_field?");
|
296
|
+
|
297
|
+
rb_define_method(rb_cGstStructure, "to_s", to_s, 0);
|
298
|
+
|
299
|
+
G_DEF_SETTERS(rb_cGstStructure);
|
300
|
+
}
|
Binary file
|
@@ -0,0 +1,45 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) 2003, 2004 Laurent Sansonetti <lrz@gnome.org>
|
3
|
+
*
|
4
|
+
* This file is part of Ruby/GStreamer.
|
5
|
+
*
|
6
|
+
* Ruby/GStreamer is free software; you can redistribute it and/or
|
7
|
+
* modify it under the terms of the GNU Lesser General Public
|
8
|
+
* License as published by the Free Software Foundation; either
|
9
|
+
* version 2.1 of the License, or (at your option) any later version.
|
10
|
+
*
|
11
|
+
* Ruby/GStreamer is distributed in the hope that it will be useful,
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
+
* Lesser General Public License for more details.
|
15
|
+
*
|
16
|
+
* You should have received a copy of the GNU Lesser General Public
|
17
|
+
* License along with Ruby/GStreamer; if not, write to the Free Software
|
18
|
+
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
19
|
+
*/
|
20
|
+
|
21
|
+
#include "rbgst.h"
|
22
|
+
|
23
|
+
/* Class: Gst::SystemClock
|
24
|
+
* The Gst::SystemClock class is an implementation of Gst::Clock
|
25
|
+
* using the system time.
|
26
|
+
*/
|
27
|
+
|
28
|
+
/*
|
29
|
+
* Class method: obtain
|
30
|
+
*
|
31
|
+
* Returns: a handle to the default system clock, as a reference
|
32
|
+
* to a Gst::SystemClock object.
|
33
|
+
*/
|
34
|
+
static VALUE
|
35
|
+
rb_gst_systemclock_obtain (self)
|
36
|
+
{
|
37
|
+
return RGST_SYSTEM_CLOCK_NEW (gst_system_clock_obtain ());
|
38
|
+
}
|
39
|
+
|
40
|
+
void
|
41
|
+
Init_gst_systemclock (void)
|
42
|
+
{
|
43
|
+
VALUE c = G_DEF_CLASS (GST_TYPE_SYSTEM_CLOCK, "SystemClock", mGst);
|
44
|
+
rb_define_singleton_method (c, "obtain", rb_gst_systemclock_obtain, 0);
|
45
|
+
}
|
Binary file
|
@@ -0,0 +1,124 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
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
|
+
|
25
|
+
#define SELF(self) RVAL2GST_TYPE_FIND_FACTORY(self)
|
26
|
+
|
27
|
+
/* Class: Gst::TypeFindFactory
|
28
|
+
* Information about registered type find functions.
|
29
|
+
*/
|
30
|
+
|
31
|
+
/*
|
32
|
+
* Class method: list
|
33
|
+
*
|
34
|
+
* Gets the list of all registered type find factories.
|
35
|
+
*
|
36
|
+
* Returns: an Array of Gst::TypeFindFactory objects.
|
37
|
+
*/
|
38
|
+
static VALUE
|
39
|
+
rb_gst_type_find_factory_get_list (void)
|
40
|
+
{
|
41
|
+
GList *list;
|
42
|
+
GList *orig;
|
43
|
+
VALUE arr;
|
44
|
+
|
45
|
+
arr = rb_ary_new ();
|
46
|
+
orig = gst_type_find_factory_get_list();
|
47
|
+
for (list = orig; list != NULL; list = g_list_next (list)) {
|
48
|
+
GstTypeFindFactory *tff = GST_TYPE_FIND_FACTORY (list->data);
|
49
|
+
rb_ary_push (arr, RGST_TYPE_FIND_FACTORY_NEW (tff));
|
50
|
+
}
|
51
|
+
if (orig != NULL) {
|
52
|
+
g_list_free (orig);
|
53
|
+
}
|
54
|
+
return arr;
|
55
|
+
}
|
56
|
+
|
57
|
+
/*
|
58
|
+
* Method: extensions
|
59
|
+
*
|
60
|
+
* Gets the extensions associated with a type find factory.
|
61
|
+
*
|
62
|
+
* Returns: an Array of String objects, or nil if no extensions are
|
63
|
+
* associated with the type find factory.
|
64
|
+
*/
|
65
|
+
static VALUE
|
66
|
+
rb_gst_type_find_factory_get_extensions(VALUE self)
|
67
|
+
{
|
68
|
+
VALUE ary;
|
69
|
+
gchar **extensions;
|
70
|
+
|
71
|
+
ary = rb_ary_new ();
|
72
|
+
extensions = gst_type_find_factory_get_extensions(SELF(self));
|
73
|
+
|
74
|
+
if (!extensions)
|
75
|
+
return ary;
|
76
|
+
|
77
|
+
while (*extensions) {
|
78
|
+
rb_ary_push(ary, CSTR2RVAL(*extensions));
|
79
|
+
extensions++;
|
80
|
+
}
|
81
|
+
|
82
|
+
return ary;
|
83
|
+
}
|
84
|
+
|
85
|
+
/*
|
86
|
+
* Method: caps
|
87
|
+
*
|
88
|
+
* Gets the caps associated with a type find factory.
|
89
|
+
*
|
90
|
+
* Returns: the Gst::Caps object associated with this factory.
|
91
|
+
*/
|
92
|
+
static VALUE
|
93
|
+
rb_gst_type_find_factory_get_caps (VALUE self)
|
94
|
+
{
|
95
|
+
return RGST_CAPS_NEW (gst_type_find_factory_get_caps (RGST_TYPE_FIND_FACTORY (self)));
|
96
|
+
}
|
97
|
+
|
98
|
+
#if 0 /* requires Gst::TypeFind */
|
99
|
+
static VALUE
|
100
|
+
rb_gst_type_find_factory_call_function (VALUE self, VALUE find)
|
101
|
+
{
|
102
|
+
gst_type_find_factory_call_function(RGST_TYPE_FIND_FACTORY (self), );
|
103
|
+
return Qnil;
|
104
|
+
}
|
105
|
+
#endif
|
106
|
+
|
107
|
+
static VALUE
|
108
|
+
rb_gst_type_find_factory_to_s (VALUE self)
|
109
|
+
{
|
110
|
+
GstTypeFindFactory *factory = RGST_TYPE_FIND_FACTORY (self);
|
111
|
+
return rb_str_new_with_format ("TypeFind: %s", GST_PLUGIN_FEATURE_NAME (factory));
|
112
|
+
}
|
113
|
+
|
114
|
+
void
|
115
|
+
Init_gst_typefindfactory (void)
|
116
|
+
{
|
117
|
+
VALUE c = G_DEF_CLASS (GST_TYPE_TYPE_FIND_FACTORY, "TypeFindFactory", mGst);
|
118
|
+
|
119
|
+
rb_define_singleton_method(c, "list", rb_gst_type_find_factory_get_list, 0);
|
120
|
+
rb_define_method(c, "extensions", rb_gst_type_find_factory_get_extensions, 0);
|
121
|
+
rb_define_method(c, "caps", rb_gst_type_find_factory_get_caps, 0);
|
122
|
+
/*rb_define_method(c, "call_function", rb_gst_type_find_factory_call_function, 1);*/
|
123
|
+
rb_define_method(c, "to_s", rb_gst_type_find_factory_to_s, 0);
|
124
|
+
}
|