gstreamer 1.0.3 → 1.1.0
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/Rakefile +201 -3
- data/ext/gstreamer/extconf.rb +10 -10
- data/ext/gstreamer/misc.c +16 -15
- data/ext/gstreamer/rbgst-bin.c +75 -83
- data/ext/gstreamer/rbgst-buffer.c +91 -91
- data/ext/gstreamer/rbgst-bus.c +21 -21
- data/ext/gstreamer/rbgst-caps.c +98 -91
- data/ext/gstreamer/rbgst-child-proxy.c +19 -18
- data/ext/gstreamer/rbgst-clock.c +34 -32
- data/ext/gstreamer/rbgst-element-factory.c +79 -85
- data/ext/gstreamer/rbgst-element.c +245 -210
- data/ext/gstreamer/rbgst-event.c +18 -18
- data/ext/gstreamer/rbgst-ghost-pad.c +24 -21
- data/ext/gstreamer/rbgst-index-factory.c +31 -29
- data/ext/gstreamer/rbgst-install-plugins-context.c +86 -0
- data/ext/gstreamer/rbgst-install-plugins-return.c +45 -0
- data/ext/gstreamer/rbgst-install-plugins.c +45 -111
- data/ext/gstreamer/rbgst-message.c +15 -16
- data/ext/gstreamer/rbgst-mini-object.c +37 -37
- data/ext/gstreamer/rbgst-object.c +29 -26
- data/ext/gstreamer/rbgst-pad-template.c +36 -35
- data/ext/gstreamer/rbgst-pad.c +96 -96
- data/ext/gstreamer/rbgst-pipeline.c +32 -31
- data/ext/gstreamer/rbgst-plugin-feature.c +47 -48
- data/ext/gstreamer/rbgst-plugin.c +62 -64
- data/ext/gstreamer/rbgst-private.c +14 -15
- data/ext/gstreamer/rbgst-private.h +76 -16
- data/ext/gstreamer/rbgst-query.c +22 -20
- data/ext/gstreamer/rbgst-seek.c +22 -19
- data/ext/gstreamer/rbgst-static-caps.c +26 -24
- data/ext/gstreamer/rbgst-static-pad-template.c +27 -26
- data/ext/gstreamer/rbgst-structure.c +61 -59
- data/ext/gstreamer/rbgst-system-clock.c +23 -20
- data/ext/gstreamer/rbgst-type-find-factory.c +44 -43
- data/ext/gstreamer/rbgst-value.c +40 -28
- data/ext/gstreamer/rbgst-x-overlay.c +32 -31
- data/ext/gstreamer/rbgst.c +78 -128
- data/ext/gstreamer/rbgst.h +16 -16
- data/ext/gstreamer/rbgstclockentry.c +46 -43
- data/ext/gstreamer/rbgstformat.c +64 -61
- data/ext/gstreamer/rbgstindex.c +67 -64
- data/ext/gstreamer/rbgstindexentry.c +31 -28
- data/ext/gstreamer/rbgstparse.c +32 -29
- data/ext/gstreamer/rbgstquerytype.c +64 -61
- data/ext/gstreamer/rbgstregistry.c +79 -76
- data/ext/gstreamer/rbgsttag.c +34 -32
- data/ext/gstreamer/rbgsttagsetter.c +22 -19
- data/ext/gstreamer/rbgstxml.c +78 -75
- data/lib/gst.rb +15 -1
- data/test/test_buffer.rb +5 -2
- data/test/test_element.rb +7 -9
- data/test/test_value.rb +2 -2
- metadata +11 -11
- data/ChangeLog +0 -1202
- data/test/test_clock.rb +0 -7
@@ -1,27 +1,28 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
*
|
4
|
-
*
|
5
|
-
*
|
6
|
-
*
|
7
|
-
*
|
8
|
-
*
|
9
|
-
*
|
10
|
-
* License
|
11
|
-
*
|
12
|
-
*
|
13
|
-
*
|
14
|
-
*
|
15
|
-
*
|
16
|
-
*
|
17
|
-
*
|
18
|
-
*
|
19
|
-
*
|
20
|
-
*
|
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
21
|
*/
|
22
22
|
|
23
|
-
#include "rbgst.h"
|
23
|
+
#include "rbgst-private.h"
|
24
24
|
|
25
|
+
#define RG_TARGET_NAMESPACE cElementFactory
|
25
26
|
#define SELF(self) RVAL2GST_ELEMENT_FACTORY(self)
|
26
27
|
|
27
28
|
/* Class: Gst::ElementFactory
|
@@ -39,16 +40,16 @@
|
|
39
40
|
* unique name, consisting of the element factory name and a number.
|
40
41
|
* If name is given, it will be given the name supplied.
|
41
42
|
*
|
42
|
-
*
|
43
|
-
*
|
44
|
-
*
|
45
|
-
*
|
46
|
-
*
|
43
|
+
* # Creates a 'mad' GStreamer element, named 'foo':
|
44
|
+
* elem1 = Gst::ElementFactory.make("mad", "foo")
|
45
|
+
*
|
46
|
+
* # This line does exactly the same thing:
|
47
|
+
* elem2 = Gst::ElementFactory.find("mad").create("foo")
|
47
48
|
*
|
48
49
|
* Returns: a newly created object based on Gst::Element.
|
49
50
|
*/
|
50
51
|
static VALUE
|
51
|
-
|
52
|
+
rg_s_make(int argc, VALUE *argv, VALUE self)
|
52
53
|
{
|
53
54
|
GstElement *element;
|
54
55
|
VALUE fname, ename;
|
@@ -57,7 +58,7 @@ rb_gst_elementfactory_make(int argc, VALUE *argv, VALUE self)
|
|
57
58
|
rb_scan_args(argc, argv, "11", &fname, &ename);
|
58
59
|
|
59
60
|
element = gst_element_factory_make(RVAL2CSTR(fname),
|
60
|
-
|
61
|
+
RVAL2CSTR_ACCEPT_NIL(ename));
|
61
62
|
|
62
63
|
if (element == NULL)
|
63
64
|
return Qnil;
|
@@ -78,12 +79,12 @@ rb_gst_elementfactory_make(int argc, VALUE *argv, VALUE self)
|
|
78
79
|
* Returns: a Gst::ElementFactory object if found, nil otherwise.
|
79
80
|
*/
|
80
81
|
static VALUE
|
81
|
-
|
82
|
+
rg_s_find (VALUE self, VALUE factory_name)
|
82
83
|
{
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
84
|
+
GstElementFactory *factory = gst_element_factory_find (RVAL2CSTR (factory_name));
|
85
|
+
return factory != NULL
|
86
|
+
? RGST_ELEMENT_FACTORY_NEW (factory)
|
87
|
+
: Qnil;
|
87
88
|
}
|
88
89
|
|
89
90
|
/*
|
@@ -99,7 +100,7 @@ rb_gst_elementfactory_find (VALUE self, VALUE factory_name)
|
|
99
100
|
* Returns: a newly created object based on Gst::Element.
|
100
101
|
*/
|
101
102
|
static VALUE
|
102
|
-
|
103
|
+
rg_create(int argc, VALUE *argv, VALUE self)
|
103
104
|
{
|
104
105
|
GstElement *element;
|
105
106
|
VALUE name;
|
@@ -111,12 +112,12 @@ create(int argc, VALUE *argv, VALUE self)
|
|
111
112
|
}
|
112
113
|
|
113
114
|
static VALUE
|
114
|
-
|
115
|
+
rg_to_s (VALUE self)
|
115
116
|
{
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
117
|
+
GstElementFactory *factory = RGST_ELEMENT_FACTORY (self);
|
118
|
+
return rb_str_new_with_format ("Element: %s (%s)",
|
119
|
+
GST_PLUGIN_FEATURE_NAME(factory),
|
120
|
+
factory->details.longname);
|
120
121
|
}
|
121
122
|
|
122
123
|
/*
|
@@ -127,7 +128,7 @@ rb_gst_elementfactory_to_s (VALUE self)
|
|
127
128
|
* Returns: an array of Gst::PadTemplate objects.
|
128
129
|
*/
|
129
130
|
static VALUE
|
130
|
-
|
131
|
+
rg_pad_templates (VALUE self)
|
131
132
|
{
|
132
133
|
GstElementFactory *factory;
|
133
134
|
const GList *list;
|
@@ -153,9 +154,9 @@ rb_gst_elementfactory_get_pad_templates (VALUE self)
|
|
153
154
|
* Returns: always nil.
|
154
155
|
*/
|
155
156
|
static VALUE
|
156
|
-
|
157
|
+
rg_each_pad_template (VALUE self)
|
157
158
|
{
|
158
|
-
|
159
|
+
return rb_ary_yield (rg_pad_templates (self));
|
159
160
|
}
|
160
161
|
|
161
162
|
/*
|
@@ -174,82 +175,75 @@ rb_gst_elementfactory_each_pad_template (VALUE self)
|
|
174
175
|
*
|
175
176
|
* Here is an example.
|
176
177
|
*
|
177
|
-
*
|
178
|
-
*
|
179
|
-
*
|
180
|
-
*
|
178
|
+
* # Prints all details related to the 'mad' element:
|
179
|
+
* Gst::ElementFactory.find("mad").details do |k, v|
|
180
|
+
* p "#{k}: #{v}"
|
181
|
+
* end
|
181
182
|
*
|
182
183
|
* Returns: a Hash.
|
183
184
|
*/
|
184
185
|
static VALUE
|
185
|
-
|
186
|
+
rg_details (VALUE self)
|
186
187
|
{
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
188
|
+
GstElementFactory *factory;
|
189
|
+
VALUE hash;
|
190
|
+
|
191
|
+
factory = RGST_ELEMENT_FACTORY (self);
|
192
|
+
|
193
|
+
hash = rb_hash_new();
|
194
|
+
|
195
|
+
rb_hash_aset (hash, CSTR2RVAL ("longname"), CSTR2RVAL (factory->details.longname));
|
196
|
+
rb_hash_aset (hash, CSTR2RVAL ("klass"), CSTR2RVAL (factory->details.klass));
|
197
|
+
rb_hash_aset (hash, CSTR2RVAL ("description"), CSTR2RVAL (factory->details.description));
|
198
|
+
rb_hash_aset (hash, CSTR2RVAL ("author"), CSTR2RVAL (factory->details.author));
|
199
|
+
|
200
|
+
return hash;
|
200
201
|
}
|
201
202
|
|
202
203
|
static VALUE
|
203
|
-
|
204
|
+
rg_long_name(VALUE self)
|
204
205
|
{
|
205
206
|
return CSTR2RVAL(gst_element_factory_get_longname(SELF(self)));
|
206
207
|
}
|
207
208
|
|
208
209
|
static VALUE
|
209
|
-
|
210
|
+
rg_klass(VALUE self)
|
210
211
|
{
|
211
212
|
return CSTR2RVAL(gst_element_factory_get_klass(SELF(self)));
|
212
213
|
}
|
213
214
|
|
214
215
|
static VALUE
|
215
|
-
|
216
|
+
rg_description(VALUE self)
|
216
217
|
{
|
217
218
|
return CSTR2RVAL(gst_element_factory_get_description(SELF(self)));
|
218
219
|
}
|
219
220
|
|
220
221
|
static VALUE
|
221
|
-
|
222
|
+
rg_author(VALUE self)
|
222
223
|
{
|
223
224
|
return CSTR2RVAL(gst_element_factory_get_author(SELF(self)));
|
224
225
|
}
|
225
226
|
|
226
|
-
|
227
227
|
void
|
228
|
-
Init_gst_elementfactory (
|
228
|
+
Init_gst_elementfactory (VALUE mGst)
|
229
229
|
{
|
230
|
-
VALUE
|
230
|
+
VALUE RG_TARGET_NAMESPACE;
|
231
231
|
|
232
|
-
|
232
|
+
RG_TARGET_NAMESPACE = G_DEF_CLASS(GST_TYPE_ELEMENT_FACTORY,
|
233
233
|
"ElementFactory",
|
234
234
|
mGst);
|
235
235
|
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
rb_gst_elementfactory_each_pad_template, 0);
|
250
|
-
|
251
|
-
rb_define_method(rb_cGstElementFactory, "long_name", get_long_name, 0);
|
252
|
-
rb_define_method(rb_cGstElementFactory, "klass", get_klass, 0);
|
253
|
-
rb_define_method(rb_cGstElementFactory, "description", get_description, 0);
|
254
|
-
rb_define_method(rb_cGstElementFactory, "author", get_author, 0);
|
236
|
+
RG_DEF_SMETHOD(make, -1);
|
237
|
+
RG_DEF_SMETHOD(find, 1);
|
238
|
+
|
239
|
+
RG_DEF_METHOD(create, -1);
|
240
|
+
RG_DEF_METHOD(details, 0);
|
241
|
+
RG_DEF_METHOD(to_s, 0);
|
242
|
+
RG_DEF_METHOD(pad_templates, 0);
|
243
|
+
RG_DEF_METHOD(each_pad_template, 0);
|
244
|
+
|
245
|
+
RG_DEF_METHOD(long_name, 0);
|
246
|
+
RG_DEF_METHOD(klass, 0);
|
247
|
+
RG_DEF_METHOD(description, 0);
|
248
|
+
RG_DEF_METHOD(author, 0);
|
255
249
|
}
|
@@ -1,39 +1,42 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
*
|
4
|
-
*
|
5
|
-
*
|
6
|
-
*
|
7
|
-
*
|
8
|
-
*
|
9
|
-
*
|
10
|
-
*
|
11
|
-
* License
|
12
|
-
*
|
13
|
-
*
|
14
|
-
*
|
15
|
-
*
|
16
|
-
*
|
17
|
-
*
|
18
|
-
*
|
19
|
-
*
|
20
|
-
*
|
21
|
-
*
|
3
|
+
* Copyright (C) 2011-2012 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2007, 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
22
|
*/
|
23
23
|
|
24
|
-
#include "rbgst.h"
|
25
24
|
#include "rbgst-private.h"
|
26
25
|
|
27
|
-
#ifdef
|
28
|
-
#
|
29
|
-
#
|
30
|
-
#
|
31
|
-
#
|
32
|
-
#
|
26
|
+
#ifdef G_OS_WIN32
|
27
|
+
# ifdef HAVE_IO_H
|
28
|
+
# include <io.h>
|
29
|
+
# define pipe(phandles) _pipe(phandles, 128, _O_BINARY)
|
30
|
+
# endif
|
31
|
+
#else
|
32
|
+
# ifdef HAVE_UNISTD_H
|
33
|
+
# include <unistd.h>
|
34
|
+
# endif
|
33
35
|
#endif
|
34
36
|
#include <fcntl.h>
|
35
37
|
#include <errno.h>
|
36
38
|
|
39
|
+
#define RG_TARGET_NAMESPACE cElement
|
37
40
|
#define SELF(self) RVAL2GST_ELEMENT(self)
|
38
41
|
|
39
42
|
#define GST_STATE_CHANGE_RETURN2RVAL(object) \
|
@@ -66,17 +69,20 @@ typedef struct _SendEventData {
|
|
66
69
|
|
67
70
|
typedef struct _ThreadData {
|
68
71
|
GstElement *element;
|
69
|
-
|
72
|
+
gint notify_write_fd;
|
73
|
+
gint notify_read_fd;
|
74
|
+
gint errno_on_write;
|
75
|
+
const gchar *context;
|
70
76
|
union {
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
77
|
+
SetStateData set_state_data;
|
78
|
+
GetStateData get_state_data;
|
79
|
+
QueryData query_data;
|
80
|
+
SendEventData send_event_data;
|
75
81
|
} data;
|
76
82
|
} ThreadData;
|
77
83
|
|
78
|
-
static RGConvertTable table
|
79
|
-
static VALUE
|
84
|
+
static RGConvertTable table;
|
85
|
+
static VALUE RG_TARGET_NAMESPACE;
|
80
86
|
static ID id_gtype;
|
81
87
|
static GThreadPool *set_state_thread_pool;
|
82
88
|
static GThreadPool *get_state_thread_pool;
|
@@ -101,7 +107,6 @@ instance2robj(gpointer instance)
|
|
101
107
|
return rbgst_object_instance2robj(instance);
|
102
108
|
}
|
103
109
|
|
104
|
-
|
105
110
|
/* Class: Gst::Element
|
106
111
|
* Base class for all pipeline elements.
|
107
112
|
*/
|
@@ -110,13 +115,14 @@ static void
|
|
110
115
|
do_in_thread(GThreadPool *pool, ThreadData *data)
|
111
116
|
{
|
112
117
|
int notify_fds[2];
|
113
|
-
char buf[NOTIFY_MESSAGE_SIZE];
|
114
118
|
GError *error = NULL;
|
115
119
|
|
116
120
|
if (pipe(notify_fds) != 0)
|
117
121
|
rb_sys_fail("failed to create a pipe to synchronize threaded operation");
|
118
122
|
|
119
|
-
data->
|
123
|
+
data->errno_on_write = 0;
|
124
|
+
data->notify_read_fd = notify_fds[0];
|
125
|
+
data->notify_write_fd = notify_fds[1];
|
120
126
|
g_thread_pool_push(pool, data, &error);
|
121
127
|
if (error) {
|
122
128
|
close(notify_fds[0]);
|
@@ -126,15 +132,56 @@ do_in_thread(GThreadPool *pool, ThreadData *data)
|
|
126
132
|
|
127
133
|
rb_thread_wait_fd(notify_fds[0]);
|
128
134
|
|
129
|
-
|
135
|
+
#define BUFFER_SIZE 512
|
136
|
+
if (data->errno_on_write == 0) {
|
137
|
+
char buf[NOTIFY_MESSAGE_SIZE];
|
138
|
+
ssize_t read_size;
|
139
|
+
int saved_errno = 0;
|
140
|
+
read_size = read(notify_fds[0], buf, NOTIFY_MESSAGE_SIZE);
|
141
|
+
if (read_size != NOTIFY_MESSAGE_SIZE) {
|
142
|
+
saved_errno = errno;
|
143
|
+
}
|
130
144
|
|
145
|
+
close(notify_fds[0]);
|
146
|
+
close(notify_fds[1]);
|
131
147
|
|
132
|
-
|
133
|
-
|
148
|
+
if (saved_errno != 0) {
|
149
|
+
char buffer[BUFFER_SIZE];
|
150
|
+
snprintf(buffer, BUFFER_SIZE - 1,
|
151
|
+
"failed to read notify pipe on %s", data->context);
|
152
|
+
errno = saved_errno;
|
153
|
+
rb_sys_fail(buffer);
|
154
|
+
}
|
155
|
+
} else {
|
156
|
+
char buffer[BUFFER_SIZE];
|
157
|
+
snprintf(buffer, BUFFER_SIZE - 1,
|
158
|
+
"failed to write notify pipe on %s", data->context);
|
159
|
+
errno = data->errno_on_write;
|
160
|
+
rb_sys_fail(buffer);
|
161
|
+
}
|
162
|
+
#undef BUFFER_SIZE
|
134
163
|
}
|
135
164
|
|
136
165
|
static void
|
137
|
-
|
166
|
+
notify(ThreadData *thread_data)
|
167
|
+
{
|
168
|
+
ssize_t written_size;
|
169
|
+
|
170
|
+
written_size = write(thread_data->notify_write_fd,
|
171
|
+
NOTIFY_MESSAGE, NOTIFY_MESSAGE_SIZE);
|
172
|
+
if (written_size != NOTIFY_MESSAGE_SIZE) {
|
173
|
+
int read_fd = thread_data->notify_read_fd;
|
174
|
+
int write_fd = thread_data->notify_write_fd;
|
175
|
+
thread_data->errno_on_write = errno;
|
176
|
+
thread_data->notify_read_fd = -1;
|
177
|
+
thread_data->notify_write_fd = -1;
|
178
|
+
close(write_fd);
|
179
|
+
close(read_fd);
|
180
|
+
}
|
181
|
+
}
|
182
|
+
|
183
|
+
static void
|
184
|
+
set_state_in_thread(gpointer data, G_GNUC_UNUSED gpointer user_data)
|
138
185
|
{
|
139
186
|
ThreadData *thread_data = (ThreadData *)data;
|
140
187
|
SetStateData *set_state_data;
|
@@ -142,27 +189,25 @@ set_state_in_thread(gpointer data, gpointer user_data)
|
|
142
189
|
set_state_data = &(thread_data->data.set_state_data);
|
143
190
|
set_state_data->result = gst_element_set_state(thread_data->element,
|
144
191
|
set_state_data->state);
|
145
|
-
|
192
|
+
notify(thread_data);
|
146
193
|
}
|
147
194
|
|
148
195
|
static VALUE
|
149
196
|
rb_gst_element_set_state_internal(VALUE self, GstState state)
|
150
197
|
{
|
151
198
|
VALUE result;
|
152
|
-
ThreadData
|
199
|
+
ThreadData thread_data;
|
153
200
|
SetStateData *set_state_data;
|
154
201
|
|
155
|
-
thread_data =
|
156
|
-
thread_data
|
157
|
-
set_state_data = &(thread_data
|
202
|
+
thread_data.element = SELF(self);
|
203
|
+
thread_data.context = "set_state";
|
204
|
+
set_state_data = &(thread_data.data.set_state_data);
|
158
205
|
set_state_data->state = state;
|
159
206
|
|
160
|
-
do_in_thread(set_state_thread_pool, thread_data);
|
207
|
+
do_in_thread(set_state_thread_pool, &thread_data);
|
161
208
|
|
162
209
|
result = GST_STATE_CHANGE_RETURN2RVAL(set_state_data->result);
|
163
210
|
|
164
|
-
g_slice_free(ThreadData, thread_data);
|
165
|
-
|
166
211
|
return result;
|
167
212
|
}
|
168
213
|
|
@@ -179,53 +224,51 @@ rb_gst_element_set_state_internal(VALUE self, GstState state)
|
|
179
224
|
* Returns: a code (see Gst::Element::StateChangeReturn).
|
180
225
|
*/
|
181
226
|
static VALUE
|
182
|
-
|
227
|
+
rg_set_state(VALUE self, VALUE state)
|
183
228
|
{
|
184
229
|
return rb_gst_element_set_state_internal(self,
|
185
|
-
|
230
|
+
RVAL2GENUM(state, GST_TYPE_STATE));
|
186
231
|
}
|
187
232
|
|
188
233
|
static void
|
189
|
-
get_state_in_thread(gpointer data, gpointer user_data)
|
234
|
+
get_state_in_thread(gpointer data, G_GNUC_UNUSED gpointer user_data)
|
190
235
|
{
|
191
236
|
ThreadData *thread_data = (ThreadData *)data;
|
192
237
|
GetStateData *get_state_data;
|
193
238
|
|
194
239
|
get_state_data = &(thread_data->data.get_state_data);
|
195
240
|
get_state_data->result = gst_element_get_state(thread_data->element,
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
241
|
+
&(get_state_data->state),
|
242
|
+
&(get_state_data->pending),
|
243
|
+
get_state_data->timeout);
|
244
|
+
notify(thread_data);
|
200
245
|
}
|
201
246
|
|
202
247
|
/* Method: get_state(timeout=nil)
|
203
248
|
*/
|
204
249
|
static VALUE
|
205
|
-
|
250
|
+
rg_get_state(int argc, VALUE *argv, VALUE self)
|
206
251
|
{
|
207
252
|
VALUE result, timeout;
|
208
|
-
ThreadData
|
253
|
+
ThreadData thread_data;
|
209
254
|
GetStateData *get_state_data;
|
210
255
|
|
211
256
|
rb_scan_args(argc, argv, "01", &timeout);
|
212
257
|
|
213
|
-
thread_data =
|
214
|
-
thread_data
|
215
|
-
get_state_data = &(thread_data
|
258
|
+
thread_data.element = SELF(self);
|
259
|
+
thread_data.context = "get_state";
|
260
|
+
get_state_data = &(thread_data.data.get_state_data);
|
216
261
|
if (NIL_P(timeout))
|
217
|
-
|
262
|
+
get_state_data->timeout = GST_CLOCK_TIME_NONE;
|
218
263
|
else
|
219
|
-
|
264
|
+
get_state_data->timeout = NUM2ULL(timeout);
|
220
265
|
|
221
|
-
do_in_thread(get_state_thread_pool, thread_data);
|
266
|
+
do_in_thread(get_state_thread_pool, &thread_data);
|
222
267
|
|
223
268
|
result = rb_ary_new3(3,
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
g_slice_free(ThreadData, thread_data);
|
269
|
+
GST_STATE_CHANGE_RETURN2RVAL(get_state_data->result),
|
270
|
+
GST_STATE2RVAL(get_state_data->state),
|
271
|
+
GST_STATE2RVAL(get_state_data->pending));
|
229
272
|
|
230
273
|
return result;
|
231
274
|
}
|
@@ -238,7 +281,7 @@ rb_gst_element_get_state(int argc, VALUE *argv, VALUE self)
|
|
238
281
|
* Returns: a code (see Gst::Element::StateChangeReturn).
|
239
282
|
*/
|
240
283
|
static VALUE
|
241
|
-
|
284
|
+
rg_stop(VALUE self)
|
242
285
|
{
|
243
286
|
return rb_gst_element_set_state_internal(self, GST_STATE_NULL);
|
244
287
|
}
|
@@ -251,7 +294,7 @@ rb_gst_element_stop(VALUE self)
|
|
251
294
|
* Returns: a code (see Gst::Element::StateChangeReturn).
|
252
295
|
*/
|
253
296
|
static VALUE
|
254
|
-
|
297
|
+
rg_ready(VALUE self)
|
255
298
|
{
|
256
299
|
return rb_gst_element_set_state_internal(self, GST_STATE_READY);
|
257
300
|
}
|
@@ -264,7 +307,7 @@ rb_gst_element_ready(VALUE self)
|
|
264
307
|
* Returns: a code (see Gst::Element::StateChangedReturn).
|
265
308
|
*/
|
266
309
|
static VALUE
|
267
|
-
|
310
|
+
rg_pause(VALUE self)
|
268
311
|
{
|
269
312
|
return rb_gst_element_set_state_internal(self, GST_STATE_PAUSED);
|
270
313
|
}
|
@@ -277,7 +320,7 @@ rb_gst_element_pause(VALUE self)
|
|
277
320
|
* Returns: a code (see Gst::Element::StateChangedReturn).
|
278
321
|
*/
|
279
322
|
static VALUE
|
280
|
-
|
323
|
+
rg_play(VALUE self)
|
281
324
|
{
|
282
325
|
return rb_gst_element_set_state_internal(self, GST_STATE_PLAYING);
|
283
326
|
}
|
@@ -295,7 +338,7 @@ rb_gst_element_play(VALUE self)
|
|
295
338
|
* Returns: the destination element, or nil if the link failed.
|
296
339
|
*/
|
297
340
|
static VALUE
|
298
|
-
|
341
|
+
rg_link(VALUE self, VALUE other_element)
|
299
342
|
{
|
300
343
|
GstElement *element1, *element2;
|
301
344
|
|
@@ -315,7 +358,7 @@ rb_gst_element_link(VALUE self, VALUE other_element)
|
|
315
358
|
*
|
316
359
|
*/
|
317
360
|
static VALUE
|
318
|
-
|
361
|
+
rg_unlink(VALUE self, VALUE other_element)
|
319
362
|
{
|
320
363
|
GstElement *element1, *element2;
|
321
364
|
|
@@ -340,11 +383,11 @@ rb_gst_element_unlink(VALUE self, VALUE other_element)
|
|
340
383
|
* Returns: the destination element, or nil if the link failed.
|
341
384
|
*/
|
342
385
|
static VALUE
|
343
|
-
|
386
|
+
rg_link_filtered(VALUE self, VALUE other_element, VALUE rcaps)
|
344
387
|
{
|
345
388
|
GstElement *element1, *element2;
|
346
389
|
GstCaps *caps;
|
347
|
-
|
390
|
+
|
348
391
|
element1 = SELF(self);
|
349
392
|
element2 = SELF(other_element);
|
350
393
|
caps = RGST_CAPS(rcaps);
|
@@ -357,7 +400,7 @@ rb_gst_element_link_filtered(VALUE self, VALUE other_element, VALUE rcaps)
|
|
357
400
|
* Returns: true if the element requires a clock, false otherwise.
|
358
401
|
*/
|
359
402
|
static VALUE
|
360
|
-
|
403
|
+
rg_requires_clock_p(VALUE self)
|
361
404
|
{
|
362
405
|
return CBOOL2RVAL(gst_element_requires_clock(SELF(self)));
|
363
406
|
}
|
@@ -366,7 +409,7 @@ rb_gst_element_requires_clock(VALUE self)
|
|
366
409
|
* Returns: true if the element provides a clock, false otherwise.
|
367
410
|
*/
|
368
411
|
static VALUE
|
369
|
-
|
412
|
+
rg_provides_clock_p(VALUE self)
|
370
413
|
{
|
371
414
|
return CBOOL2RVAL(gst_element_provides_clock(SELF(self)));
|
372
415
|
}
|
@@ -376,7 +419,7 @@ rb_gst_element_provides_clock(VALUE self)
|
|
376
419
|
* if this element does not provide a clock.
|
377
420
|
*/
|
378
421
|
static VALUE
|
379
|
-
|
422
|
+
rg_clock(VALUE self)
|
380
423
|
{
|
381
424
|
GstClock *clock;
|
382
425
|
|
@@ -394,7 +437,7 @@ rb_gst_element_get_clock(VALUE self)
|
|
394
437
|
* Returns: self.
|
395
438
|
*/
|
396
439
|
static VALUE
|
397
|
-
|
440
|
+
rg_set_clock(VALUE self, VALUE clock)
|
398
441
|
{
|
399
442
|
gst_element_set_clock(SELF(self), RVAL2GST_CLOCK(clock));
|
400
443
|
return self;
|
@@ -419,19 +462,19 @@ rb_gst_element_each_pad_body(VALUE user_data)
|
|
419
462
|
|
420
463
|
while (!done) {
|
421
464
|
switch (gst_iterator_next(data->iterator, (gpointer)&pad)) {
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
465
|
+
case GST_ITERATOR_OK:
|
466
|
+
data->callback(GST_PAD2RVAL(pad), data->user_data);
|
467
|
+
gst_object_unref(pad);
|
468
|
+
break;
|
469
|
+
case GST_ITERATOR_RESYNC:
|
470
|
+
gst_iterator_resync(data->iterator);
|
471
|
+
break;
|
472
|
+
case GST_ITERATOR_ERROR:
|
473
|
+
rb_raise(rb_eIndexError, "Pad iteration failed");
|
474
|
+
break;
|
475
|
+
case GST_ITERATOR_DONE:
|
476
|
+
done = TRUE;
|
477
|
+
break;
|
435
478
|
}
|
436
479
|
}
|
437
480
|
|
@@ -449,8 +492,8 @@ rb_gst_element_each_pad_ensure(VALUE user_data)
|
|
449
492
|
|
450
493
|
static VALUE
|
451
494
|
rb_gst_element_each_pad_with_callback(VALUE self,
|
452
|
-
|
453
|
-
|
495
|
+
EachPadCallback callback,
|
496
|
+
VALUE user_data)
|
454
497
|
{
|
455
498
|
EachPadData data;
|
456
499
|
|
@@ -459,7 +502,7 @@ rb_gst_element_each_pad_with_callback(VALUE self,
|
|
459
502
|
data.user_data = user_data;
|
460
503
|
data.iterator = gst_element_iterate_pads(SELF(self));
|
461
504
|
return rb_ensure(rb_gst_element_each_pad_body, (VALUE)(&data),
|
462
|
-
|
505
|
+
rb_gst_element_each_pad_ensure, (VALUE)(&data));
|
463
506
|
}
|
464
507
|
|
465
508
|
/*
|
@@ -473,7 +516,7 @@ rb_gst_element_each_pad_with_callback(VALUE self,
|
|
473
516
|
* Returns: always nil.
|
474
517
|
*/
|
475
518
|
static VALUE
|
476
|
-
|
519
|
+
rg_each_pad(VALUE self)
|
477
520
|
{
|
478
521
|
rb_gst_element_each_pad_with_callback(self, (EachPadCallback)rb_yield, Qnil);
|
479
522
|
return Qnil;
|
@@ -486,7 +529,7 @@ collect_pad(VALUE pad, VALUE pads)
|
|
486
529
|
}
|
487
530
|
|
488
531
|
static VALUE
|
489
|
-
|
532
|
+
rg_pads(VALUE self)
|
490
533
|
{
|
491
534
|
VALUE pads;
|
492
535
|
|
@@ -504,7 +547,7 @@ rb_gst_element_get_pads(VALUE self)
|
|
504
547
|
* Returns: a Gst::Pad object, or nil if the pad cannot be found.
|
505
548
|
*/
|
506
549
|
static VALUE
|
507
|
-
|
550
|
+
rg_get_pad(VALUE self, VALUE pad_name)
|
508
551
|
{
|
509
552
|
GstPad *pad = gst_element_get_pad(SELF(self),
|
510
553
|
RVAL2CSTR(pad_name));
|
@@ -524,13 +567,13 @@ rb_gst_element_get_pad(VALUE self, VALUE pad_name)
|
|
524
567
|
* Returns: true on success, false on failure.
|
525
568
|
*/
|
526
569
|
static VALUE
|
527
|
-
|
528
|
-
|
570
|
+
rg_link_pads(VALUE self, VALUE source_pad_name,
|
571
|
+
VALUE other_element, VALUE destination_pad_name)
|
529
572
|
{
|
530
573
|
return CBOOL2RVAL(gst_element_link_pads(SELF(self),
|
531
|
-
|
532
|
-
|
533
|
-
|
574
|
+
RVAL2CSTR(source_pad_name),
|
575
|
+
SELF(other_element),
|
576
|
+
RVAL2CSTR(destination_pad_name)));
|
534
577
|
}
|
535
578
|
|
536
579
|
/*
|
@@ -543,13 +586,13 @@ rb_gst_element_link_pads(VALUE self, VALUE source_pad_name,
|
|
543
586
|
* Returns: self.
|
544
587
|
*/
|
545
588
|
static VALUE
|
546
|
-
|
547
|
-
|
589
|
+
rg_unlink_pads(VALUE self, VALUE source_pad_name,
|
590
|
+
VALUE other_element, VALUE destination_pad_name)
|
548
591
|
{
|
549
592
|
gst_element_unlink_pads(SELF(self),
|
550
|
-
|
551
|
-
|
552
|
-
|
593
|
+
RVAL2CSTR(source_pad_name),
|
594
|
+
SELF(other_element),
|
595
|
+
RVAL2CSTR(destination_pad_name));
|
553
596
|
return self;
|
554
597
|
}
|
555
598
|
|
@@ -557,21 +600,21 @@ rb_gst_element_unlink_pads(VALUE self, VALUE source_pad_name,
|
|
557
600
|
* Returns: true if the element can be indexed, false otherwise.
|
558
601
|
*/
|
559
602
|
static VALUE
|
560
|
-
|
603
|
+
rg_indexable_p(VALUE self)
|
561
604
|
{
|
562
605
|
return CBOOL2RVAL(gst_element_is_indexable(SELF(self)));
|
563
606
|
}
|
564
607
|
|
565
608
|
static void
|
566
|
-
query_in_thread(gpointer data, gpointer user_data)
|
609
|
+
query_in_thread(gpointer data, G_GNUC_UNUSED gpointer user_data)
|
567
610
|
{
|
568
611
|
ThreadData *thread_data = (ThreadData *)data;
|
569
612
|
QueryData *query_data;
|
570
613
|
|
571
614
|
query_data = &(thread_data->data.query_data);
|
572
615
|
query_data->result = gst_element_query(thread_data->element,
|
573
|
-
|
574
|
-
|
616
|
+
query_data->query);
|
617
|
+
notify(thread_data);
|
575
618
|
}
|
576
619
|
|
577
620
|
/*
|
@@ -583,36 +626,34 @@ query_in_thread(gpointer data, gpointer user_data)
|
|
583
626
|
* Returns: true if the query is performed, false otherwise.
|
584
627
|
*/
|
585
628
|
static VALUE
|
586
|
-
|
629
|
+
rg_query(VALUE self, VALUE query)
|
587
630
|
{
|
588
631
|
VALUE result;
|
589
|
-
ThreadData
|
632
|
+
ThreadData thread_data;
|
590
633
|
QueryData *query_data;
|
591
634
|
|
592
|
-
thread_data =
|
593
|
-
thread_data
|
594
|
-
query_data = &(thread_data
|
635
|
+
thread_data.element = SELF(self);
|
636
|
+
thread_data.context = "query";
|
637
|
+
query_data = &(thread_data.data.query_data);
|
595
638
|
query_data->query = RVAL2GST_QUERY(query);
|
596
639
|
|
597
|
-
do_in_thread(query_thread_pool, thread_data);
|
640
|
+
do_in_thread(query_thread_pool, &thread_data);
|
598
641
|
|
599
642
|
result = CBOOL2RVAL(query_data->result);
|
600
643
|
|
601
|
-
g_slice_free(ThreadData, thread_data);
|
602
|
-
|
603
644
|
return result;
|
604
645
|
}
|
605
646
|
|
606
647
|
static void
|
607
|
-
send_event_in_thread(gpointer data, gpointer user_data)
|
648
|
+
send_event_in_thread(gpointer data, G_GNUC_UNUSED gpointer user_data)
|
608
649
|
{
|
609
650
|
ThreadData *thread_data = (ThreadData *)data;
|
610
651
|
SendEventData *send_event_data;
|
611
652
|
|
612
653
|
send_event_data = &(thread_data->data.send_event_data);
|
613
654
|
send_event_data->result = gst_element_send_event(thread_data->element,
|
614
|
-
|
615
|
-
|
655
|
+
send_event_data->event);
|
656
|
+
notify(thread_data);
|
616
657
|
}
|
617
658
|
/*
|
618
659
|
* Method: send_event(event)
|
@@ -626,24 +667,22 @@ send_event_in_thread(gpointer data, gpointer user_data)
|
|
626
667
|
* otherwise.
|
627
668
|
*/
|
628
669
|
static VALUE
|
629
|
-
|
670
|
+
rg_send_event(VALUE self, VALUE event)
|
630
671
|
{
|
631
672
|
VALUE result;
|
632
|
-
ThreadData
|
673
|
+
ThreadData thread_data;
|
633
674
|
SendEventData *send_event_data;
|
634
675
|
|
635
|
-
thread_data =
|
636
|
-
thread_data
|
637
|
-
send_event_data = &(thread_data
|
676
|
+
thread_data.element = SELF(self);
|
677
|
+
thread_data.context = "send_event";
|
678
|
+
send_event_data = &(thread_data.data.send_event_data);
|
638
679
|
send_event_data->event = RVAL2GST_EVENT(event);
|
639
680
|
|
640
681
|
gst_event_ref(send_event_data->event);
|
641
|
-
do_in_thread(send_event_thread_pool, thread_data);
|
682
|
+
do_in_thread(send_event_thread_pool, &thread_data);
|
642
683
|
|
643
684
|
result = CBOOL2RVAL(send_event_data->result);
|
644
685
|
|
645
|
-
g_slice_free(ThreadData, thread_data);
|
646
|
-
|
647
686
|
return result;
|
648
687
|
}
|
649
688
|
|
@@ -656,7 +695,7 @@ rb_gst_element_send_event(VALUE self, VALUE event)
|
|
656
695
|
* element base time in Gst::Element::STATE_PAUSED, or -1 otherwise.
|
657
696
|
*/
|
658
697
|
static VALUE
|
659
|
-
|
698
|
+
rg_base_time(VALUE self)
|
660
699
|
{
|
661
700
|
return ULL2NUM(gst_element_get_base_time(SELF(self)));
|
662
701
|
}
|
@@ -673,7 +712,7 @@ rb_gst_element_get_base_time(VALUE self)
|
|
673
712
|
* Returns: self.
|
674
713
|
*/
|
675
714
|
static VALUE
|
676
|
-
|
715
|
+
rg_set_base_time(VALUE self, VALUE time)
|
677
716
|
{
|
678
717
|
gst_element_set_base_time(SELF(self), NUM2ULL(time));
|
679
718
|
return Qnil;
|
@@ -687,7 +726,7 @@ rb_gst_element_set_base_time(VALUE self, VALUE time)
|
|
687
726
|
* Returns: a Gst::Index or nil when no index was set on the element.
|
688
727
|
*/
|
689
728
|
static VALUE
|
690
|
-
|
729
|
+
rg_index(VALUE self)
|
691
730
|
{
|
692
731
|
GstIndex *index = gst_element_get_index(SELF(self));
|
693
732
|
|
@@ -704,7 +743,7 @@ rb_gst_element_get_index(VALUE self)
|
|
704
743
|
* Returns: self.
|
705
744
|
*/
|
706
745
|
static VALUE
|
707
|
-
|
746
|
+
rg_set_index(VALUE self, VALUE index)
|
708
747
|
{
|
709
748
|
gst_element_set_index(SELF(self), RGST_INDEX(index));
|
710
749
|
return self;
|
@@ -720,7 +759,7 @@ rb_gst_element_set_index(VALUE self, VALUE index)
|
|
720
759
|
* Returns: the requested Gst::Pad if found, otherwise nil.
|
721
760
|
*/
|
722
761
|
static VALUE
|
723
|
-
|
762
|
+
rg_get_static_pad(VALUE self, VALUE name)
|
724
763
|
{
|
725
764
|
GstPad *pad =
|
726
765
|
gst_element_get_static_pad(SELF(self), RVAL2CSTR(name));
|
@@ -737,7 +776,7 @@ rb_gst_element_get_static_pad(VALUE self, VALUE name)
|
|
737
776
|
* Returns: the requested Gst::Pad if found, otherwise nil.
|
738
777
|
*/
|
739
778
|
static VALUE
|
740
|
-
|
779
|
+
rg_get_request_pad(VALUE self, VALUE name)
|
741
780
|
{
|
742
781
|
GstPad *pad =
|
743
782
|
gst_element_get_request_pad(SELF(self), RVAL2CSTR(name));
|
@@ -754,7 +793,7 @@ rb_gst_element_get_request_pad(VALUE self, VALUE name)
|
|
754
793
|
* Returns: self.
|
755
794
|
*/
|
756
795
|
static VALUE
|
757
|
-
|
796
|
+
rg_release_request_pad(VALUE self, VALUE pad)
|
758
797
|
{
|
759
798
|
gst_element_release_request_pad(SELF(self), RGST_PAD(pad));
|
760
799
|
return self;
|
@@ -770,7 +809,7 @@ rb_gst_element_release_request_pad(VALUE self, VALUE pad)
|
|
770
809
|
* Returns: self.
|
771
810
|
*/
|
772
811
|
static VALUE
|
773
|
-
|
812
|
+
rg_add_pad(VALUE self, VALUE pad)
|
774
813
|
{
|
775
814
|
gst_element_add_pad(SELF(self), RGST_PAD(pad));
|
776
815
|
G_CHILD_ADD(self, pad);
|
@@ -786,7 +825,7 @@ rb_gst_element_add_pad(VALUE self, VALUE pad)
|
|
786
825
|
* Returns: self.
|
787
826
|
*/
|
788
827
|
static VALUE
|
789
|
-
|
828
|
+
rg_remove_pad(VALUE self, VALUE pad)
|
790
829
|
{
|
791
830
|
gst_element_remove_pad(SELF(self), RGST_PAD(pad));
|
792
831
|
return self;
|
@@ -801,7 +840,7 @@ rb_gst_element_remove_pad(VALUE self, VALUE pad)
|
|
801
840
|
* Returns: the Gst::PadTemplate with the given name, or nil if none was found.
|
802
841
|
*/
|
803
842
|
static VALUE
|
804
|
-
|
843
|
+
rg_s_get_pad_template(VALUE self, VALUE name)
|
805
844
|
{
|
806
845
|
GstElementClass *element_class;
|
807
846
|
GstPadTemplate *template;
|
@@ -820,7 +859,7 @@ rb_gst_element_get_pad_template(VALUE self, VALUE name)
|
|
820
859
|
* Returns: an Array of Gst::PadTemplate objects.
|
821
860
|
*/
|
822
861
|
static VALUE
|
823
|
-
|
862
|
+
rg_s_pad_templates(VALUE self)
|
824
863
|
{
|
825
864
|
GstElementClass *element_class;
|
826
865
|
GList *list, *node;
|
@@ -846,9 +885,9 @@ rb_gst_element_get_pad_templates(VALUE self)
|
|
846
885
|
* Returns: always nil.
|
847
886
|
*/
|
848
887
|
static VALUE
|
849
|
-
|
888
|
+
rg_s_each_pad_template(VALUE self)
|
850
889
|
{
|
851
|
-
return rb_ary_yield(
|
890
|
+
return rb_ary_yield(rg_s_pad_templates(self));
|
852
891
|
}
|
853
892
|
|
854
893
|
/*
|
@@ -861,7 +900,7 @@ rb_gst_element_each_pad_template(VALUE self)
|
|
861
900
|
* Returns: true if the event was handled.
|
862
901
|
*/
|
863
902
|
static VALUE
|
864
|
-
|
903
|
+
rg_seek(VALUE self, VALUE rate, VALUE format, VALUE flags,
|
865
904
|
VALUE cur_type, VALUE cur, VALUE stop_type, VALUE stop)
|
866
905
|
{
|
867
906
|
return CBOOL2RVAL(gst_element_seek(SELF(self),
|
@@ -885,7 +924,7 @@ rb_gst_element_seek(VALUE self, VALUE rate, VALUE format, VALUE flags,
|
|
885
924
|
* Returns: true if the element's state is locked.
|
886
925
|
*/
|
887
926
|
static VALUE
|
888
|
-
|
927
|
+
rg_locked_state_p(VALUE self)
|
889
928
|
{
|
890
929
|
return CBOOL2RVAL(gst_element_is_locked_state(SELF(self)));
|
891
930
|
}
|
@@ -900,7 +939,7 @@ rb_gst_element_is_locked_state(VALUE self)
|
|
900
939
|
* Returns: self.
|
901
940
|
*/
|
902
941
|
static VALUE
|
903
|
-
|
942
|
+
rg_set_locked_state(VALUE self, VALUE state)
|
904
943
|
{
|
905
944
|
gst_element_set_locked_state(SELF(self), RVAL2CBOOL(state));
|
906
945
|
return self;
|
@@ -915,7 +954,7 @@ rb_gst_element_set_locked_state(VALUE self, VALUE state)
|
|
915
954
|
* Returns: true if the element's state could be synced to the parent's state.
|
916
955
|
*/
|
917
956
|
static VALUE
|
918
|
-
|
957
|
+
rg_sync_state_with_parent(VALUE self)
|
919
958
|
{
|
920
959
|
return
|
921
960
|
CBOOL2RVAL(gst_element_sync_state_with_parent(SELF(self)));
|
@@ -934,14 +973,14 @@ rb_gst_element_sync_state_with_parent(VALUE self)
|
|
934
973
|
* Returns: self.
|
935
974
|
*/
|
936
975
|
static VALUE
|
937
|
-
|
976
|
+
rg_no_more_pads(VALUE self)
|
938
977
|
{
|
939
978
|
gst_element_no_more_pads(SELF(self));
|
940
979
|
return self;
|
941
980
|
}
|
942
981
|
|
943
|
-
static VALUE
|
944
|
-
rb_gst_element_found_tag_sig(guint
|
982
|
+
static VALUE
|
983
|
+
rb_gst_element_found_tag_sig(G_GNUC_UNUSED guint n, const GValue *values)
|
945
984
|
{
|
946
985
|
GstElement *element, *source;
|
947
986
|
GstTagList *tag_list;
|
@@ -963,13 +1002,15 @@ initialize_thread_pool(GThreadPool **pool, GFunc function)
|
|
963
1002
|
|
964
1003
|
*pool = g_thread_pool_new(function, NULL, -1, FALSE, &error);
|
965
1004
|
if (error)
|
966
|
-
|
1005
|
+
RAISE_GERROR(error);
|
967
1006
|
}
|
968
1007
|
|
969
1008
|
void
|
970
|
-
Init_gst_element(
|
1009
|
+
Init_gst_element(VALUE mGst)
|
971
1010
|
{
|
1011
|
+
memset(&table, 0, sizeof(table));
|
972
1012
|
table.type = GST_TYPE_ELEMENT;
|
1013
|
+
table.klass = Qnil;
|
973
1014
|
table.instance2robj = instance2robj;
|
974
1015
|
RG_DEF_CONVERSION(&table);
|
975
1016
|
|
@@ -980,59 +1021,53 @@ Init_gst_element(void)
|
|
980
1021
|
initialize_thread_pool(&query_thread_pool, query_in_thread);
|
981
1022
|
initialize_thread_pool(&send_event_thread_pool, send_event_in_thread);
|
982
1023
|
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
1);
|
1031
|
-
rb_define_method(rb_cGstElement, "sync_state_with_parent",
|
1032
|
-
rb_gst_element_sync_state_with_parent, 0);
|
1033
|
-
rb_define_method(rb_cGstElement, "no_more_pads", rb_gst_element_no_more_pads, 0);
|
1034
|
-
|
1035
|
-
G_DEF_SETTERS(rb_cGstElement);
|
1024
|
+
RG_TARGET_NAMESPACE = G_DEF_CLASS(GST_TYPE_ELEMENT, "Element", mGst);
|
1025
|
+
|
1026
|
+
RG_DEF_SMETHOD(get_pad_template, 1);
|
1027
|
+
RG_DEF_SMETHOD(pad_templates, 0);
|
1028
|
+
RG_DEF_SMETHOD(each_pad_template, 0);
|
1029
|
+
|
1030
|
+
RG_DEF_METHOD(set_state, 1);
|
1031
|
+
RG_DEF_METHOD(get_state, -1);
|
1032
|
+
RG_DEF_METHOD(stop, 0);
|
1033
|
+
RG_DEF_METHOD(ready, 0);
|
1034
|
+
RG_DEF_METHOD(pause, 0);
|
1035
|
+
RG_DEF_METHOD(play, 0);
|
1036
|
+
RG_DEF_METHOD(link, 1);
|
1037
|
+
RG_DEF_ALIAS(">>", "link");
|
1038
|
+
RG_DEF_METHOD(unlink, 1);
|
1039
|
+
RG_DEF_METHOD(link_filtered, 2);
|
1040
|
+
RG_DEF_METHOD_P(provides_clock, 0);
|
1041
|
+
RG_DEF_ALIAS("provide_clock?", "provides_clock?");
|
1042
|
+
RG_DEF_METHOD_P(requires_clock, 0);
|
1043
|
+
RG_DEF_ALIAS("require_clock?", "requires_clock?");
|
1044
|
+
RG_DEF_METHOD(clock, 0);
|
1045
|
+
RG_DEF_METHOD(set_clock, 1);
|
1046
|
+
RG_DEF_METHOD(base_time, 0);
|
1047
|
+
RG_DEF_METHOD(set_base_time, 1);
|
1048
|
+
RG_DEF_METHOD(each_pad, 0);
|
1049
|
+
RG_DEF_METHOD(pads, 0);
|
1050
|
+
RG_DEF_METHOD(get_pad, 1);
|
1051
|
+
RG_DEF_ALIAS("[]", "get_pad");
|
1052
|
+
RG_DEF_METHOD(get_static_pad, 1);
|
1053
|
+
RG_DEF_METHOD(get_request_pad, 1);
|
1054
|
+
RG_DEF_METHOD(release_request_pad, 1);
|
1055
|
+
RG_DEF_METHOD(link_pads, 3);
|
1056
|
+
RG_DEF_METHOD(unlink_pads, 3);
|
1057
|
+
RG_DEF_METHOD(add_pad, 1);
|
1058
|
+
RG_DEF_METHOD(remove_pad, 1);
|
1059
|
+
RG_DEF_METHOD_P(indexable, 0);
|
1060
|
+
RG_DEF_METHOD(query, 1);
|
1061
|
+
RG_DEF_METHOD(send_event, 1);
|
1062
|
+
RG_DEF_METHOD(seek, 7);
|
1063
|
+
RG_DEF_METHOD(index, 0);
|
1064
|
+
RG_DEF_METHOD(set_index, 1);
|
1065
|
+
RG_DEF_METHOD_P(locked_state, 0);
|
1066
|
+
RG_DEF_METHOD(set_locked_state, 1);
|
1067
|
+
RG_DEF_METHOD(sync_state_with_parent, 0);
|
1068
|
+
RG_DEF_METHOD(no_more_pads, 0);
|
1069
|
+
|
1070
|
+
G_DEF_SETTERS(RG_TARGET_NAMESPACE);
|
1036
1071
|
|
1037
1072
|
G_DEF_CLASS(GST_TYPE_STATE, "State", mGst);
|
1038
1073
|
G_DEF_CONSTANTS(mGst, GST_TYPE_STATE, "GST_");
|
@@ -1040,14 +1075,14 @@ Init_gst_element(void)
|
|
1040
1075
|
G_DEF_CONSTANTS(mGst, GST_TYPE_STATE_CHANGE_RETURN, "GST_");
|
1041
1076
|
G_DEF_CLASS(GST_TYPE_STATE_CHANGE, "StateChange", mGst);
|
1042
1077
|
G_DEF_CONSTANTS(mGst, GST_TYPE_STATE_CHANGE, "GST_");
|
1043
|
-
G_DEF_CLASS(GST_TYPE_ELEMENT_FLAGS, "Flags",
|
1044
|
-
G_DEF_CONSTANTS(
|
1078
|
+
G_DEF_CLASS(GST_TYPE_ELEMENT_FLAGS, "Flags", RG_TARGET_NAMESPACE);
|
1079
|
+
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GST_TYPE_ELEMENT_FLAGS, "GST_ELEMENT_");
|
1045
1080
|
|
1046
1081
|
/*
|
1047
1082
|
* TODO:
|
1048
1083
|
* gst_element_clock_wait()
|
1049
1084
|
*/
|
1050
1085
|
|
1051
|
-
G_DEF_SIGNAL_FUNC(
|
1086
|
+
G_DEF_SIGNAL_FUNC(RG_TARGET_NAMESPACE, "found-tag",
|
1052
1087
|
(GValToRValSignalFunc)rb_gst_element_found_tag_sig);
|
1053
1088
|
}
|