gstreamer 0.90.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,517 @@
|
|
|
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
|
+
static VALUE cIntRange, cFourcc, cFractionRange;
|
|
24
|
+
|
|
25
|
+
static RGConvertTable value_list_table = {0};
|
|
26
|
+
static RGConvertTable value_array_table = {0};
|
|
27
|
+
static RGConvertTable int_range_table = {0};
|
|
28
|
+
static RGConvertTable fourcc_table = {0};
|
|
29
|
+
static RGConvertTable fraction_table = {0};
|
|
30
|
+
static RGConvertTable fraction_range_table = {0};
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
static void
|
|
34
|
+
value_list_rvalue2gvalue(VALUE value, GValue *result)
|
|
35
|
+
{
|
|
36
|
+
guint i, len;
|
|
37
|
+
|
|
38
|
+
len = RARRAY_LEN(value);
|
|
39
|
+
for (i = 0; i < len; i++) {
|
|
40
|
+
GValue val = {0};
|
|
41
|
+
rbgobj_initialize_gvalue(&val, RARRAY_PTR(value)[i]);
|
|
42
|
+
gst_value_list_append_value(result, &val);
|
|
43
|
+
g_value_unset(&val);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
static VALUE
|
|
48
|
+
value_list_gvalue2rvalue(const GValue *value)
|
|
49
|
+
{
|
|
50
|
+
guint i, len;
|
|
51
|
+
VALUE result;
|
|
52
|
+
|
|
53
|
+
len = gst_value_list_get_size(value);
|
|
54
|
+
result = rb_ary_new2(len);
|
|
55
|
+
for (i = 0; i < len; i++) {
|
|
56
|
+
rb_ary_push(result, GVAL2RVAL(gst_value_list_get_value(value, i)));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
static void
|
|
64
|
+
value_array_rvalue2gvalue(VALUE value, GValue *result)
|
|
65
|
+
{
|
|
66
|
+
guint i, len;
|
|
67
|
+
|
|
68
|
+
len = RARRAY_LEN(value);
|
|
69
|
+
for (i = 0; i < len; i++) {
|
|
70
|
+
GValue val = {0};
|
|
71
|
+
rbgobj_initialize_gvalue(&val, RARRAY_PTR(value)[i]);
|
|
72
|
+
gst_value_array_append_value(result, &val);
|
|
73
|
+
g_value_unset(&val);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
static VALUE
|
|
78
|
+
value_array_gvalue2rvalue(const GValue *value)
|
|
79
|
+
{
|
|
80
|
+
guint i, len;
|
|
81
|
+
VALUE result;
|
|
82
|
+
|
|
83
|
+
len = gst_value_array_get_size(value);
|
|
84
|
+
result = rb_ary_new2(len);
|
|
85
|
+
for (i = 0; i < len; i++) {
|
|
86
|
+
rb_ary_push(result, GVAL2RVAL(gst_value_array_get_value(value, i)));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return result;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
static GValue *
|
|
94
|
+
g_value_new(GType type)
|
|
95
|
+
{
|
|
96
|
+
GValue *value;
|
|
97
|
+
|
|
98
|
+
value = ALLOC(GValue);
|
|
99
|
+
MEMZERO(value, GValue, 1);
|
|
100
|
+
g_value_init(value, type);
|
|
101
|
+
|
|
102
|
+
return value;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
static void
|
|
106
|
+
g_value_free(gpointer instance)
|
|
107
|
+
{
|
|
108
|
+
if (instance) {
|
|
109
|
+
g_value_unset(instance);
|
|
110
|
+
g_free(instance);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
static VALUE
|
|
115
|
+
g_value_to_ruby_value(const GValue *value)
|
|
116
|
+
{
|
|
117
|
+
VALUE klass;
|
|
118
|
+
GType type;
|
|
119
|
+
GValue *copied_value;
|
|
120
|
+
|
|
121
|
+
type = G_VALUE_TYPE(value);
|
|
122
|
+
klass = GTYPE2CLASS(type);
|
|
123
|
+
copied_value = g_value_new(type);
|
|
124
|
+
g_value_copy(value, copied_value);
|
|
125
|
+
return Data_Wrap_Struct(klass, NULL, g_value_free, copied_value);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
static VALUE
|
|
129
|
+
g_value_type_instance_to_ruby_object(gpointer instance)
|
|
130
|
+
{
|
|
131
|
+
return g_value_to_ruby_value(instance);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
static void
|
|
135
|
+
g_value_type_unref(gpointer instance)
|
|
136
|
+
{
|
|
137
|
+
g_value_unset(instance);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
#define DEF_G_VALUE_CONVERTERS(prefix, g_type, type) \
|
|
141
|
+
static gpointer \
|
|
142
|
+
prefix ## _robj2instance(VALUE object) \
|
|
143
|
+
{ \
|
|
144
|
+
gpointer instance; \
|
|
145
|
+
\
|
|
146
|
+
if (!RVAL2CBOOL(rb_obj_is_kind_of(object, c ## type))) { \
|
|
147
|
+
rb_raise(rb_eTypeError, "not a Gst::" # type); \
|
|
148
|
+
} \
|
|
149
|
+
Data_Get_Struct(object, GValue, instance); \
|
|
150
|
+
return instance; \
|
|
151
|
+
} \
|
|
152
|
+
\
|
|
153
|
+
static VALUE \
|
|
154
|
+
prefix ## _allocate(VALUE klass) \
|
|
155
|
+
{ \
|
|
156
|
+
return Data_Wrap_Struct(klass, NULL, \
|
|
157
|
+
g_value_free, g_value_new(g_type)); \
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
static VALUE
|
|
161
|
+
g_value_to_s(VALUE self)
|
|
162
|
+
{
|
|
163
|
+
return CSTR2RVAL_FREE(g_strdup_value_contents(RVAL2GOBJ(self)));
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
static VALUE
|
|
169
|
+
int_range_initialize(VALUE self, VALUE min, VALUE max)
|
|
170
|
+
{
|
|
171
|
+
gst_value_set_int_range(DATA_PTR(self), NUM2INT(min), NUM2INT(max));
|
|
172
|
+
return Qnil;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
static VALUE
|
|
176
|
+
int_range_get_min(VALUE self)
|
|
177
|
+
{
|
|
178
|
+
return INT2NUM(gst_value_get_int_range_min(RVAL2GOBJ(self)));
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
static VALUE
|
|
182
|
+
int_range_set_min(VALUE self, VALUE min)
|
|
183
|
+
{
|
|
184
|
+
GValue *value;
|
|
185
|
+
|
|
186
|
+
value = RVAL2GOBJ(self);
|
|
187
|
+
gst_value_set_int_range(value,
|
|
188
|
+
NUM2INT(min),
|
|
189
|
+
gst_value_get_int_range_max(value));
|
|
190
|
+
return Qnil;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
static VALUE
|
|
194
|
+
int_range_get_max(VALUE self)
|
|
195
|
+
{
|
|
196
|
+
return INT2NUM(gst_value_get_int_range_max(RVAL2GOBJ(self)));
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
static VALUE
|
|
200
|
+
int_range_set_max(VALUE self, VALUE max)
|
|
201
|
+
{
|
|
202
|
+
GValue *value;
|
|
203
|
+
|
|
204
|
+
value = RVAL2GOBJ(self);
|
|
205
|
+
gst_value_set_int_range(value,
|
|
206
|
+
gst_value_get_int_range_min(value),
|
|
207
|
+
NUM2INT(max));
|
|
208
|
+
return Qnil;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
static VALUE
|
|
212
|
+
int_range_set(VALUE self, VALUE min, VALUE max)
|
|
213
|
+
{
|
|
214
|
+
gst_value_set_int_range(RVAL2GOBJ(self), NUM2INT(min), NUM2INT(max));
|
|
215
|
+
return Qnil;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
static VALUE
|
|
219
|
+
int_range_to_a(VALUE self)
|
|
220
|
+
{
|
|
221
|
+
GValue *value;
|
|
222
|
+
|
|
223
|
+
value = RVAL2GOBJ(self);
|
|
224
|
+
return rb_ary_new3(2,
|
|
225
|
+
INT2NUM(gst_value_get_int_range_min(value)),
|
|
226
|
+
INT2NUM(gst_value_get_int_range_max(value)));
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
static VALUE
|
|
230
|
+
int_range_get_superclass(void)
|
|
231
|
+
{
|
|
232
|
+
return rb_cObject;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
static void
|
|
236
|
+
int_range_rvalue2gvalue(VALUE value, GValue *result)
|
|
237
|
+
{
|
|
238
|
+
GValue *val;
|
|
239
|
+
|
|
240
|
+
val = RVAL2GOBJ(value);
|
|
241
|
+
gst_value_set_int_range(result,
|
|
242
|
+
gst_value_get_int_range_min(val),
|
|
243
|
+
gst_value_get_int_range_max(val));
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
DEF_G_VALUE_CONVERTERS(int_range, GST_TYPE_INT_RANGE, IntRange)
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
static VALUE
|
|
250
|
+
fourcc_get_superclass(void)
|
|
251
|
+
{
|
|
252
|
+
return rb_cObject;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
static void
|
|
256
|
+
fourcc_rvalue2gvalue(VALUE value, GValue *result)
|
|
257
|
+
{
|
|
258
|
+
gst_value_set_fourcc(result,
|
|
259
|
+
gst_value_get_fourcc(RVAL2GOBJ(value)));
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
DEF_G_VALUE_CONVERTERS(fourcc, GST_TYPE_FOURCC, Fourcc)
|
|
263
|
+
|
|
264
|
+
static guint32
|
|
265
|
+
value_to_fourcc(VALUE value)
|
|
266
|
+
{
|
|
267
|
+
if (RVAL2CBOOL(rb_obj_is_kind_of(value, rb_cString))) {
|
|
268
|
+
return GST_STR_FOURCC(RSTRING_PTR(value));
|
|
269
|
+
} else {
|
|
270
|
+
return NUM2UINT(value);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
static VALUE
|
|
275
|
+
fourcc_initialize(VALUE self, VALUE fourcc)
|
|
276
|
+
{
|
|
277
|
+
gst_value_set_fourcc(DATA_PTR(self), value_to_fourcc(fourcc));
|
|
278
|
+
return Qnil;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
static VALUE
|
|
282
|
+
fourcc_replace_bang(VALUE self, VALUE fourcc)
|
|
283
|
+
{
|
|
284
|
+
gst_value_set_fourcc(DATA_PTR(self), value_to_fourcc(fourcc));
|
|
285
|
+
return Qnil;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
static VALUE
|
|
289
|
+
fourcc_to_i(VALUE self)
|
|
290
|
+
{
|
|
291
|
+
return UINT2NUM(gst_value_get_fourcc(DATA_PTR(self)));
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
static void
|
|
296
|
+
fraction_rvalue2gvalue(VALUE value, GValue *result)
|
|
297
|
+
{
|
|
298
|
+
gst_value_set_fraction(result,
|
|
299
|
+
NUM2INT(rb_funcall(value, rb_intern("numerator"), 0)),
|
|
300
|
+
NUM2INT(rb_funcall(value, rb_intern("denominator"),
|
|
301
|
+
0)));
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
static VALUE
|
|
305
|
+
fraction_gvalue2rvalue(const GValue *value)
|
|
306
|
+
{
|
|
307
|
+
return rb_funcall(Qnil, rb_intern("Rational"), 2,
|
|
308
|
+
INT2NUM(gst_value_get_fraction_numerator(value)),
|
|
309
|
+
INT2NUM(gst_value_get_fraction_denominator(value)));
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
static VALUE
|
|
314
|
+
fraction_range_initialize(VALUE self, VALUE min, VALUE max)
|
|
315
|
+
{
|
|
316
|
+
GValue min_value = {0}, max_value = {0};
|
|
317
|
+
|
|
318
|
+
rbgobj_initialize_gvalue(&min_value, min);
|
|
319
|
+
rbgobj_initialize_gvalue(&max_value, max);
|
|
320
|
+
gst_value_set_fraction_range(DATA_PTR(self), &min_value, &max_value);
|
|
321
|
+
return Qnil;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
static VALUE
|
|
325
|
+
fraction_range_get_min(VALUE self)
|
|
326
|
+
{
|
|
327
|
+
return GVAL2RVAL(gst_value_get_fraction_range_min(RVAL2GOBJ(self)));
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
static VALUE
|
|
331
|
+
fraction_range_set_min(VALUE self, VALUE min)
|
|
332
|
+
{
|
|
333
|
+
GValue *value;
|
|
334
|
+
GValue min_value = {0};
|
|
335
|
+
|
|
336
|
+
value = RVAL2GOBJ(self);
|
|
337
|
+
rbgobj_initialize_gvalue(&min_value, min);
|
|
338
|
+
gst_value_set_fraction_range(value,
|
|
339
|
+
&min_value,
|
|
340
|
+
gst_value_get_fraction_range_max(value));
|
|
341
|
+
return Qnil;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
static VALUE
|
|
345
|
+
fraction_range_get_max(VALUE self)
|
|
346
|
+
{
|
|
347
|
+
return GVAL2RVAL(gst_value_get_fraction_range_max(RVAL2GOBJ(self)));
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
static VALUE
|
|
351
|
+
fraction_range_set_max(VALUE self, VALUE max)
|
|
352
|
+
{
|
|
353
|
+
GValue *value;
|
|
354
|
+
GValue max_value = {0};
|
|
355
|
+
|
|
356
|
+
value = RVAL2GOBJ(self);
|
|
357
|
+
rbgobj_initialize_gvalue(&max_value, max);
|
|
358
|
+
gst_value_set_fraction_range(value,
|
|
359
|
+
gst_value_get_fraction_range_min(value),
|
|
360
|
+
&max_value);
|
|
361
|
+
return Qnil;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
static VALUE
|
|
365
|
+
fraction_range_set(VALUE self, VALUE min, VALUE max)
|
|
366
|
+
{
|
|
367
|
+
GValue min_value = {0}, max_value = {0};
|
|
368
|
+
|
|
369
|
+
rbgobj_initialize_gvalue(&min_value, min);
|
|
370
|
+
rbgobj_initialize_gvalue(&max_value, max);
|
|
371
|
+
gst_value_set_fraction_range(RVAL2GOBJ(self), &min_value, &max_value);
|
|
372
|
+
return Qnil;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
static VALUE
|
|
376
|
+
fraction_range_to_a(VALUE self)
|
|
377
|
+
{
|
|
378
|
+
GValue *value;
|
|
379
|
+
|
|
380
|
+
value = RVAL2GOBJ(self);
|
|
381
|
+
return rb_ary_new3(2,
|
|
382
|
+
GVAL2RVAL(gst_value_get_fraction_range_min(value)),
|
|
383
|
+
GVAL2RVAL(gst_value_get_fraction_range_max(value)));
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
static VALUE
|
|
387
|
+
fraction_range_get_superclass(void)
|
|
388
|
+
{
|
|
389
|
+
return rb_cObject;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
static void
|
|
393
|
+
fraction_range_rvalue2gvalue(VALUE value, GValue *result)
|
|
394
|
+
{
|
|
395
|
+
GValue *val;
|
|
396
|
+
|
|
397
|
+
val = RVAL2GOBJ(value);
|
|
398
|
+
gst_value_set_fraction_range(result,
|
|
399
|
+
gst_value_get_fraction_range_min(val),
|
|
400
|
+
gst_value_get_fraction_range_max(val));
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
DEF_G_VALUE_CONVERTERS(fraction_range, GST_TYPE_FRACTION_RANGE, FractionRange)
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
void
|
|
407
|
+
Init_gst_value(void)
|
|
408
|
+
{
|
|
409
|
+
value_list_table.type = GST_TYPE_LIST;
|
|
410
|
+
value_list_table.rvalue2gvalue = value_list_rvalue2gvalue;
|
|
411
|
+
value_list_table.gvalue2rvalue = value_list_gvalue2rvalue;
|
|
412
|
+
|
|
413
|
+
RG_DEF_CONVERSION(&value_list_table);
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
value_array_table.type = GST_TYPE_ARRAY;
|
|
417
|
+
value_array_table.rvalue2gvalue = value_array_rvalue2gvalue;
|
|
418
|
+
value_array_table.gvalue2rvalue = value_array_gvalue2rvalue;
|
|
419
|
+
|
|
420
|
+
RG_DEF_CONVERSION(&value_array_table);
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
int_range_table.type = GST_TYPE_INT_RANGE;
|
|
424
|
+
int_range_table.get_superclass = int_range_get_superclass;
|
|
425
|
+
int_range_table.type_init_hook = NULL;
|
|
426
|
+
int_range_table.rvalue2gvalue = int_range_rvalue2gvalue;
|
|
427
|
+
int_range_table.gvalue2rvalue = g_value_to_ruby_value;
|
|
428
|
+
int_range_table.initialize = NULL;
|
|
429
|
+
int_range_table.robj2instance = int_range_robj2instance;
|
|
430
|
+
int_range_table.instance2robj = g_value_type_instance_to_ruby_object;
|
|
431
|
+
int_range_table.unref = g_value_type_unref;
|
|
432
|
+
|
|
433
|
+
RG_DEF_CONVERSION(&int_range_table);
|
|
434
|
+
|
|
435
|
+
cIntRange = G_DEF_CLASS(GST_TYPE_INT_RANGE, "IntRange", mGst);
|
|
436
|
+
|
|
437
|
+
rb_define_alloc_func(cIntRange, int_range_allocate);
|
|
438
|
+
|
|
439
|
+
rb_define_method(cIntRange, "initialize", int_range_initialize, 2);
|
|
440
|
+
|
|
441
|
+
rb_define_method(cIntRange, "min", int_range_get_min, 0);
|
|
442
|
+
rb_define_method(cIntRange, "set_min", int_range_set_min, 1);
|
|
443
|
+
rb_define_method(cIntRange, "max", int_range_get_max, 0);
|
|
444
|
+
rb_define_method(cIntRange, "set_max", int_range_set_max, 1);
|
|
445
|
+
|
|
446
|
+
rb_define_method(cIntRange, "set", int_range_set, 2);
|
|
447
|
+
|
|
448
|
+
rb_define_method(cIntRange, "to_a", int_range_to_a, 0);
|
|
449
|
+
rb_define_method(cIntRange, "to_s", g_value_to_s, 0);
|
|
450
|
+
|
|
451
|
+
G_DEF_SETTERS(cIntRange);
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
fourcc_table.type = GST_TYPE_FOURCC;
|
|
455
|
+
fourcc_table.get_superclass = fourcc_get_superclass;
|
|
456
|
+
fourcc_table.type_init_hook = NULL;
|
|
457
|
+
fourcc_table.rvalue2gvalue = fourcc_rvalue2gvalue;
|
|
458
|
+
fourcc_table.gvalue2rvalue = g_value_to_ruby_value;
|
|
459
|
+
fourcc_table.initialize = NULL;
|
|
460
|
+
fourcc_table.robj2instance = fourcc_robj2instance;
|
|
461
|
+
fourcc_table.instance2robj = g_value_type_instance_to_ruby_object;
|
|
462
|
+
fourcc_table.unref = g_value_type_unref;
|
|
463
|
+
|
|
464
|
+
RG_DEF_CONVERSION(&fourcc_table);
|
|
465
|
+
|
|
466
|
+
cFourcc = G_DEF_CLASS(GST_TYPE_FOURCC, "Fourcc", mGst);
|
|
467
|
+
|
|
468
|
+
rb_define_alloc_func(cFourcc, fourcc_allocate);
|
|
469
|
+
|
|
470
|
+
rb_define_method(cFourcc, "initialize", fourcc_initialize, 1);
|
|
471
|
+
|
|
472
|
+
rb_define_method(cFourcc, "replace!", fourcc_replace_bang, 1);
|
|
473
|
+
|
|
474
|
+
rb_define_method(cFourcc, "to_i", fourcc_to_i, 0);
|
|
475
|
+
rb_define_method(cFourcc, "to_s", g_value_to_s, 0);
|
|
476
|
+
|
|
477
|
+
G_DEF_SETTERS(cFourcc);
|
|
478
|
+
|
|
479
|
+
|
|
480
|
+
fraction_table.type = GST_TYPE_FRACTION;
|
|
481
|
+
fraction_table.klass = rb_const_get(rb_cObject, rb_intern("Rational"));
|
|
482
|
+
fraction_table.rvalue2gvalue = fraction_rvalue2gvalue;
|
|
483
|
+
fraction_table.gvalue2rvalue = fraction_gvalue2rvalue;
|
|
484
|
+
|
|
485
|
+
RG_DEF_CONVERSION(&fraction_table);
|
|
486
|
+
|
|
487
|
+
|
|
488
|
+
fraction_range_table.type = GST_TYPE_FRACTION_RANGE;
|
|
489
|
+
fraction_range_table.get_superclass = fraction_range_get_superclass;
|
|
490
|
+
fraction_range_table.type_init_hook = NULL;
|
|
491
|
+
fraction_range_table.rvalue2gvalue = fraction_range_rvalue2gvalue;
|
|
492
|
+
fraction_range_table.gvalue2rvalue = g_value_to_ruby_value;
|
|
493
|
+
fraction_range_table.initialize = NULL;
|
|
494
|
+
fraction_range_table.robj2instance = fraction_range_robj2instance;
|
|
495
|
+
fraction_range_table.instance2robj = g_value_type_instance_to_ruby_object;
|
|
496
|
+
fraction_range_table.unref = g_value_type_unref;
|
|
497
|
+
|
|
498
|
+
RG_DEF_CONVERSION(&fraction_range_table);
|
|
499
|
+
|
|
500
|
+
cFractionRange = G_DEF_CLASS(GST_TYPE_FRACTION_RANGE, "FractionRange", mGst);
|
|
501
|
+
|
|
502
|
+
rb_define_alloc_func(cFractionRange, fraction_range_allocate);
|
|
503
|
+
|
|
504
|
+
rb_define_method(cFractionRange, "initialize", fraction_range_initialize, 2);
|
|
505
|
+
|
|
506
|
+
rb_define_method(cFractionRange, "min", fraction_range_get_min, 0);
|
|
507
|
+
rb_define_method(cFractionRange, "set_min", fraction_range_set_min, 1);
|
|
508
|
+
rb_define_method(cFractionRange, "max", fraction_range_get_max, 0);
|
|
509
|
+
rb_define_method(cFractionRange, "set_max", fraction_range_set_max, 1);
|
|
510
|
+
|
|
511
|
+
rb_define_method(cFractionRange, "set", fraction_range_set, 2);
|
|
512
|
+
|
|
513
|
+
rb_define_method(cFractionRange, "to_a", fraction_range_to_a, 0);
|
|
514
|
+
rb_define_method(cFractionRange, "to_s", g_value_to_s, 0);
|
|
515
|
+
|
|
516
|
+
G_DEF_SETTERS(cFractionRange);
|
|
517
|
+
}
|