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,365 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) 2007 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_BUF(obj))
|
24
|
+
#define RVAL2GST_FLAGS(flags) \
|
25
|
+
(RVAL2GFLAGS(flags, GST_TYPE_BUFFER_FLAG))
|
26
|
+
#define GST_FLAGS2RVAL(flags) \
|
27
|
+
(GFLAGS2RVAL(flags, GST_TYPE_BUFFER_FLAG))
|
28
|
+
#define RVAL2GST_COPY_FLAGS(flags) \
|
29
|
+
(RVAL2GFLAGS(flags, GST_TYPE_BUFFER_COPY_FLAGS))
|
30
|
+
#define GST_COPY_FLAGS2RVAL(flags) \
|
31
|
+
(GFLAGS2RVAL(flags, GST_TYPE_BUFFER_COPY_FLAGS))
|
32
|
+
|
33
|
+
static VALUE
|
34
|
+
initialize(int argc, VALUE *argv, VALUE self)
|
35
|
+
{
|
36
|
+
VALUE size;
|
37
|
+
GstBuffer *buffer;
|
38
|
+
|
39
|
+
rb_scan_args(argc, argv, "01", &size);
|
40
|
+
|
41
|
+
if (NIL_P(size))
|
42
|
+
buffer = gst_buffer_new();
|
43
|
+
else
|
44
|
+
buffer = gst_buffer_new_and_alloc(NUM2UINT(size));
|
45
|
+
|
46
|
+
G_INITIALIZE(self, buffer);
|
47
|
+
|
48
|
+
return Qnil;
|
49
|
+
}
|
50
|
+
|
51
|
+
static VALUE
|
52
|
+
get_flags(VALUE self)
|
53
|
+
{
|
54
|
+
return GST_FLAGS2RVAL(GST_BUFFER_FLAGS(SELF(self)));
|
55
|
+
}
|
56
|
+
|
57
|
+
static VALUE
|
58
|
+
set_flags(VALUE self, VALUE flag)
|
59
|
+
{
|
60
|
+
GST_BUFFER_FLAGS(SELF(self)) = RVAL2GST_FLAGS(flag);
|
61
|
+
return Qnil;
|
62
|
+
}
|
63
|
+
|
64
|
+
static VALUE
|
65
|
+
raise_flag(VALUE self, VALUE flag)
|
66
|
+
{
|
67
|
+
GST_MINI_OBJECT_FLAG_SET(SELF(self), RVAL2GST_FLAGS(flag));
|
68
|
+
return Qnil;
|
69
|
+
}
|
70
|
+
|
71
|
+
static VALUE
|
72
|
+
lower_flag(VALUE self, VALUE flag)
|
73
|
+
{
|
74
|
+
GST_MINI_OBJECT_FLAG_UNSET(SELF(self), RVAL2GST_FLAGS(flag));
|
75
|
+
return Qnil;
|
76
|
+
}
|
77
|
+
|
78
|
+
static VALUE
|
79
|
+
flag_raised_p(VALUE self, VALUE flag)
|
80
|
+
{
|
81
|
+
return CBOOL2RVAL(GST_MINI_OBJECT_FLAG_IS_SET(SELF(self),
|
82
|
+
RVAL2GST_FLAGS(flag)));
|
83
|
+
}
|
84
|
+
|
85
|
+
static VALUE
|
86
|
+
get_data(VALUE self)
|
87
|
+
{
|
88
|
+
GstBuffer *buffer;
|
89
|
+
guint size;
|
90
|
+
|
91
|
+
buffer = SELF(self);
|
92
|
+
size = GST_BUFFER_SIZE(buffer);
|
93
|
+
|
94
|
+
if (size == 0)
|
95
|
+
return Qnil;
|
96
|
+
else
|
97
|
+
return rb_str_new((char *)GST_BUFFER_DATA(buffer), size);
|
98
|
+
}
|
99
|
+
|
100
|
+
static VALUE
|
101
|
+
set_data(VALUE self, VALUE data)
|
102
|
+
{
|
103
|
+
GstBuffer *buffer;
|
104
|
+
buffer = SELF(self);
|
105
|
+
|
106
|
+
rb_ivar_set(self, rb_intern("data"), data);
|
107
|
+
if (NIL_P(data)) {
|
108
|
+
gst_buffer_set_data(buffer, NULL, 0);
|
109
|
+
} else {
|
110
|
+
gst_buffer_set_data(buffer,
|
111
|
+
(guint8 *)RVAL2CSTR(data),
|
112
|
+
RSTRING_LEN(data));
|
113
|
+
}
|
114
|
+
return Qnil;
|
115
|
+
}
|
116
|
+
|
117
|
+
static VALUE
|
118
|
+
get_size(VALUE self)
|
119
|
+
{
|
120
|
+
return UINT2NUM(GST_BUFFER_SIZE(SELF(self)));
|
121
|
+
}
|
122
|
+
|
123
|
+
static VALUE
|
124
|
+
set_size(VALUE self, VALUE size)
|
125
|
+
{
|
126
|
+
GST_BUFFER_SIZE(SELF(self)) = NUM2UINT(size);
|
127
|
+
return Qnil;
|
128
|
+
}
|
129
|
+
|
130
|
+
static VALUE
|
131
|
+
get_timestamp(VALUE self)
|
132
|
+
{
|
133
|
+
return ULL2NUM(GST_BUFFER_TIMESTAMP(SELF(self)));
|
134
|
+
}
|
135
|
+
|
136
|
+
static VALUE
|
137
|
+
set_timestamp(VALUE self, VALUE timestamp)
|
138
|
+
{
|
139
|
+
GST_BUFFER_TIMESTAMP(SELF(self)) = NUM2ULL(timestamp);
|
140
|
+
return Qnil;
|
141
|
+
}
|
142
|
+
|
143
|
+
static VALUE
|
144
|
+
valid_timestamp_p(VALUE self)
|
145
|
+
{
|
146
|
+
return CBOOL2RVAL(GST_BUFFER_TIMESTAMP_IS_VALID(SELF(self)));
|
147
|
+
}
|
148
|
+
|
149
|
+
static VALUE
|
150
|
+
get_duration(VALUE self)
|
151
|
+
{
|
152
|
+
return ULL2NUM(GST_BUFFER_DURATION(SELF(self)));
|
153
|
+
}
|
154
|
+
|
155
|
+
static VALUE
|
156
|
+
set_duration(VALUE self, VALUE duration)
|
157
|
+
{
|
158
|
+
GST_BUFFER_DURATION(SELF(self)) = NUM2ULL(duration);
|
159
|
+
return Qnil;
|
160
|
+
}
|
161
|
+
|
162
|
+
static VALUE
|
163
|
+
valid_duration_p(VALUE self)
|
164
|
+
{
|
165
|
+
return CBOOL2RVAL(GST_BUFFER_DURATION_IS_VALID(SELF(self)));
|
166
|
+
}
|
167
|
+
|
168
|
+
static VALUE
|
169
|
+
get_caps(VALUE self)
|
170
|
+
{
|
171
|
+
return GST_CAPS2RVAL(GST_BUFFER_CAPS(SELF(self)));
|
172
|
+
}
|
173
|
+
|
174
|
+
static VALUE
|
175
|
+
set_caps(VALUE self, VALUE caps)
|
176
|
+
{
|
177
|
+
gst_buffer_set_caps(SELF(self), RVAL2GST_CAPS(caps));
|
178
|
+
return Qnil;
|
179
|
+
}
|
180
|
+
|
181
|
+
static VALUE
|
182
|
+
get_offset(VALUE self)
|
183
|
+
{
|
184
|
+
return ULL2NUM(GST_BUFFER_OFFSET(SELF(self)));
|
185
|
+
}
|
186
|
+
|
187
|
+
static VALUE
|
188
|
+
set_offset(VALUE self, VALUE offset)
|
189
|
+
{
|
190
|
+
GST_BUFFER_OFFSET(SELF(self)) = NUM2ULL(offset);
|
191
|
+
return Qnil;
|
192
|
+
}
|
193
|
+
|
194
|
+
static VALUE
|
195
|
+
valid_offset_p(VALUE self)
|
196
|
+
{
|
197
|
+
return CBOOL2RVAL(GST_BUFFER_OFFSET_IS_VALID(SELF(self)));
|
198
|
+
}
|
199
|
+
|
200
|
+
static VALUE
|
201
|
+
get_offset_end(VALUE self)
|
202
|
+
{
|
203
|
+
return ULL2NUM(GST_BUFFER_OFFSET_END(SELF(self)));
|
204
|
+
}
|
205
|
+
|
206
|
+
static VALUE
|
207
|
+
set_offset_end(VALUE self, VALUE offset_end)
|
208
|
+
{
|
209
|
+
GST_BUFFER_OFFSET_END(SELF(self)) = NUM2ULL(offset_end);
|
210
|
+
return Qnil;
|
211
|
+
}
|
212
|
+
|
213
|
+
static VALUE
|
214
|
+
valid_offset_end_p(VALUE self)
|
215
|
+
{
|
216
|
+
return CBOOL2RVAL(GST_BUFFER_OFFSET_END_IS_VALID(SELF(self)));
|
217
|
+
}
|
218
|
+
|
219
|
+
static VALUE
|
220
|
+
discontinuity_p(VALUE self)
|
221
|
+
{
|
222
|
+
return CBOOL2RVAL(GST_BUFFER_IS_DISCONT(SELF(self)));
|
223
|
+
}
|
224
|
+
|
225
|
+
static VALUE
|
226
|
+
copy_metadata(int argc, VALUE *argv, VALUE self)
|
227
|
+
{
|
228
|
+
VALUE arg1, arg2, copied_dest;
|
229
|
+
GstBuffer *dest;
|
230
|
+
GstBufferCopyFlags flags;
|
231
|
+
|
232
|
+
rb_scan_args(argc, argv, "11", &arg1, &arg2);
|
233
|
+
if (argc == 1) {
|
234
|
+
dest = gst_buffer_new();
|
235
|
+
flags = RVAL2GST_COPY_FLAGS(arg1);
|
236
|
+
} else {
|
237
|
+
dest = SELF(arg1);
|
238
|
+
flags = RVAL2GST_COPY_FLAGS(arg2);
|
239
|
+
}
|
240
|
+
|
241
|
+
gst_buffer_copy_metadata(dest, SELF(self), flags);
|
242
|
+
copied_dest = GOBJ2RVAL(dest);
|
243
|
+
if (argc == 1)
|
244
|
+
gst_buffer_unref(dest);
|
245
|
+
|
246
|
+
return copied_dest;
|
247
|
+
}
|
248
|
+
|
249
|
+
static VALUE
|
250
|
+
metadata_writable_p(VALUE self)
|
251
|
+
{
|
252
|
+
return CBOOL2RVAL(gst_buffer_is_metadata_writable(SELF(self)));
|
253
|
+
}
|
254
|
+
|
255
|
+
static VALUE
|
256
|
+
metadata_writable_bang(VALUE self)
|
257
|
+
{
|
258
|
+
GstBuffer *orig_buffer, *buffer;
|
259
|
+
VALUE rb_buffer;
|
260
|
+
|
261
|
+
orig_buffer = SELF(self);
|
262
|
+
buffer = gst_buffer_make_metadata_writable(orig_buffer);
|
263
|
+
rb_buffer = GOBJ2RVAL(buffer);
|
264
|
+
DATA_PTR(self) = buffer;
|
265
|
+
if (buffer != orig_buffer)
|
266
|
+
gst_buffer_unref(orig_buffer);
|
267
|
+
return rb_buffer;
|
268
|
+
}
|
269
|
+
|
270
|
+
static VALUE
|
271
|
+
create_sub(VALUE self, VALUE offset, VALUE size)
|
272
|
+
{
|
273
|
+
GstBuffer *buffer;
|
274
|
+
VALUE rb_buffer;
|
275
|
+
|
276
|
+
buffer = gst_buffer_create_sub(SELF(self), NUM2UINT(offset), NUM2UINT(size));
|
277
|
+
rb_buffer = GOBJ2RVAL(buffer);
|
278
|
+
return rb_buffer;
|
279
|
+
}
|
280
|
+
|
281
|
+
static VALUE
|
282
|
+
span(VALUE self, VALUE offset, VALUE other, VALUE length)
|
283
|
+
{
|
284
|
+
return GOBJ2RVAL(gst_buffer_span(SELF(self), NUM2UINT(offset),
|
285
|
+
SELF(other), NUM2UINT(length)));
|
286
|
+
}
|
287
|
+
|
288
|
+
static VALUE
|
289
|
+
span_p(VALUE self, VALUE other)
|
290
|
+
{
|
291
|
+
return CBOOL2RVAL(gst_buffer_is_span_fast(SELF(self), SELF(other)));
|
292
|
+
}
|
293
|
+
|
294
|
+
void
|
295
|
+
Init_gst_buffer(void)
|
296
|
+
{
|
297
|
+
VALUE rb_cGstBuffer, rb_cGstBufferCopyFlags;
|
298
|
+
|
299
|
+
rb_cGstBuffer = G_DEF_CLASS(GST_TYPE_BUFFER, "Buffer", mGst);
|
300
|
+
|
301
|
+
rb_define_const(rb_cGstBuffer, "OFFSET_NONE",
|
302
|
+
ULL2NUM(GST_BUFFER_OFFSET_NONE));
|
303
|
+
|
304
|
+
G_DEF_CLASS(GST_TYPE_BUFFER_FLAG, "Flags", rb_cGstBuffer);
|
305
|
+
G_DEF_CONSTANTS(rb_cGstBuffer, GST_TYPE_BUFFER_FLAG, "GST_BUFFER_");
|
306
|
+
|
307
|
+
rb_cGstBufferCopyFlags = G_DEF_CLASS(GST_TYPE_BUFFER_COPY_FLAGS,
|
308
|
+
"CopyFlags", rb_cGstBuffer);
|
309
|
+
G_DEF_CONSTANTS(rb_cGstBuffer, GST_TYPE_BUFFER_COPY_FLAGS, "GST_BUFFER_");
|
310
|
+
rb_define_const(rb_cGstBufferCopyFlags, "ALL",
|
311
|
+
GST_COPY_FLAGS2RVAL(GST_BUFFER_COPY_ALL));
|
312
|
+
rb_define_const(rb_cGstBuffer, "COPY_ALL",
|
313
|
+
GST_COPY_FLAGS2RVAL(GST_BUFFER_COPY_ALL));
|
314
|
+
|
315
|
+
rb_define_method(rb_cGstBuffer, "initialize", initialize, -1);
|
316
|
+
|
317
|
+
rb_define_method(rb_cGstBuffer, "flags", get_flags, 0);
|
318
|
+
rb_define_method(rb_cGstBuffer, "set_flags", set_flags, 1);
|
319
|
+
rb_define_method(rb_cGstBuffer, "raise_flag", raise_flag, 1);
|
320
|
+
rb_define_method(rb_cGstBuffer, "lower_flag", lower_flag, 1);
|
321
|
+
rb_define_method(rb_cGstBuffer, "flag_raised?", flag_raised_p, 1);
|
322
|
+
|
323
|
+
rb_define_method(rb_cGstBuffer, "data", get_data, 0);
|
324
|
+
rb_define_method(rb_cGstBuffer, "set_data", set_data, 1);
|
325
|
+
|
326
|
+
rb_define_method(rb_cGstBuffer, "size", get_size, 0);
|
327
|
+
rb_define_method(rb_cGstBuffer, "set_size", set_size, 1);
|
328
|
+
rb_define_alias(rb_cGstBuffer, "length", "size");
|
329
|
+
rb_define_alias(rb_cGstBuffer, "set_length", "set_size");
|
330
|
+
|
331
|
+
rb_define_method(rb_cGstBuffer, "timestamp", get_timestamp, 0);
|
332
|
+
rb_define_method(rb_cGstBuffer, "set_timestamp", set_timestamp, 1);
|
333
|
+
rb_define_method(rb_cGstBuffer, "valid_timestamp?", valid_timestamp_p, 0);
|
334
|
+
|
335
|
+
rb_define_method(rb_cGstBuffer, "duration", get_duration, 0);
|
336
|
+
rb_define_method(rb_cGstBuffer, "set_duration", set_duration, 1);
|
337
|
+
rb_define_method(rb_cGstBuffer, "valid_duration?", valid_duration_p, 0);
|
338
|
+
|
339
|
+
rb_define_method(rb_cGstBuffer, "caps", get_caps, 0);
|
340
|
+
rb_define_method(rb_cGstBuffer, "set_caps", set_caps, 1);
|
341
|
+
|
342
|
+
rb_define_method(rb_cGstBuffer, "offset", get_offset, 0);
|
343
|
+
rb_define_method(rb_cGstBuffer, "set_offset", set_offset, 1);
|
344
|
+
rb_define_method(rb_cGstBuffer, "valid_offset?", valid_offset_p, 0);
|
345
|
+
|
346
|
+
rb_define_method(rb_cGstBuffer, "offset_end", get_offset_end, 0);
|
347
|
+
rb_define_method(rb_cGstBuffer, "set_offset_end", set_offset_end, 1);
|
348
|
+
rb_define_method(rb_cGstBuffer, "valid_offset_end?", valid_offset_end_p, 0);
|
349
|
+
|
350
|
+
rb_define_method(rb_cGstBuffer, "discontinuity?", discontinuity_p, 0);
|
351
|
+
|
352
|
+
rb_define_method(rb_cGstBuffer, "copy_metadata", copy_metadata, -1);
|
353
|
+
|
354
|
+
rb_define_method(rb_cGstBuffer, "metadata_writable?",
|
355
|
+
metadata_writable_p, 0);
|
356
|
+
rb_define_method(rb_cGstBuffer, "metadata_writable!",
|
357
|
+
metadata_writable_bang, 0);
|
358
|
+
|
359
|
+
rb_define_method(rb_cGstBuffer, "create_sub", create_sub, 2);
|
360
|
+
|
361
|
+
rb_define_method(rb_cGstBuffer, "span", span, 3);
|
362
|
+
rb_define_method(rb_cGstBuffer, "span?", span_p, 1);
|
363
|
+
|
364
|
+
G_DEF_SETTERS(rb_cGstBuffer);
|
365
|
+
}
|
Binary file
|
@@ -0,0 +1,92 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
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
|
+
/* Class: Gst::Bus
|
25
|
+
* Asynchronous message bus subsystem.
|
26
|
+
*/
|
27
|
+
|
28
|
+
#define SELF(obj) (RVAL2GST_BUS(obj))
|
29
|
+
|
30
|
+
static ID id_call;
|
31
|
+
|
32
|
+
typedef struct _callback_info_t
|
33
|
+
{
|
34
|
+
VALUE bus;
|
35
|
+
VALUE callback;
|
36
|
+
guint id;
|
37
|
+
} callback_info_t;
|
38
|
+
|
39
|
+
static gboolean
|
40
|
+
invoke_watch_func(GstBus *bus, GstMessage *message, gpointer data)
|
41
|
+
{
|
42
|
+
callback_info_t *info = data;
|
43
|
+
|
44
|
+
return RVAL2CBOOL(rb_funcall(info->callback, id_call, 2,
|
45
|
+
RGST_BUS2RVAL(bus),
|
46
|
+
GST_MSG2RVAL(message)));
|
47
|
+
}
|
48
|
+
|
49
|
+
static void
|
50
|
+
destroy_watch_func(gpointer data)
|
51
|
+
{
|
52
|
+
callback_info_t *info = data;
|
53
|
+
|
54
|
+
G_CHILD_REMOVE(info->bus, info->callback);
|
55
|
+
g_free(info);
|
56
|
+
}
|
57
|
+
|
58
|
+
static VALUE
|
59
|
+
rb_gst_bus_add_watch(int argc, VALUE *argv, VALUE self)
|
60
|
+
{
|
61
|
+
VALUE rb_priority, block, rb_id;
|
62
|
+
gint priority;
|
63
|
+
callback_info_t *info;
|
64
|
+
|
65
|
+
rb_scan_args(argc, argv, "01&", &rb_priority, &block);
|
66
|
+
|
67
|
+
priority = NIL_P(rb_priority) ? G_PRIORITY_DEFAULT : INT2NUM(rb_priority);
|
68
|
+
info = g_new(callback_info_t, 1);
|
69
|
+
info->bus = self;
|
70
|
+
info->callback = block;
|
71
|
+
info->id = gst_bus_add_watch_full(SELF(self),
|
72
|
+
priority,
|
73
|
+
invoke_watch_func,
|
74
|
+
(gpointer)info,
|
75
|
+
destroy_watch_func);
|
76
|
+
rb_id = UINT2NUM(info->id);
|
77
|
+
G_CHILD_ADD(self, block);
|
78
|
+
return rb_id;
|
79
|
+
}
|
80
|
+
|
81
|
+
|
82
|
+
void
|
83
|
+
Init_gst_bus (void)
|
84
|
+
{
|
85
|
+
VALUE rb_cGstBus;
|
86
|
+
|
87
|
+
id_call = rb_intern("call");
|
88
|
+
|
89
|
+
rb_cGstBus = G_DEF_CLASS(GST_TYPE_BUS, "Bus", mGst);
|
90
|
+
|
91
|
+
rb_define_method(rb_cGstBus, "add_watch", rb_gst_bus_add_watch, -1);
|
92
|
+
}
|