rays-video 0.2.0 → 0.3.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.
- checksums.yaml +4 -4
- data/.doc/ext/rays-video/video.cpp +68 -57
- data/.github/workflows/release-gem.yml +2 -49
- data/.github/workflows/tag.yml +5 -28
- data/.github/workflows/test.yml +1 -37
- data/ChangeLog.md +15 -0
- data/Gemfile.lock +26 -0
- data/README.md +24 -2
- data/VERSION +1 -1
- data/ext/rays-video/extconf.rb +2 -1
- data/ext/rays-video/video.cpp +72 -60
- data/include/rays/video.h +19 -15
- data/lib/rays/video.rb +4 -0
- data/rays-video.gemspec +5 -5
- data/src/ios/video.mm +1 -632
- data/src/ios/video_audio_in.mm +1 -251
- data/src/osx/video.mm +283 -57
- data/src/osx/video_audio_in.mm +2 -1
- data/src/sdl/video.cpp +19 -13
- data/src/video.cpp +202 -85
- data/src/video.h +7 -5
- data/src/win32/video.cpp +19 -13
- data/test/test_video.rb +164 -27
- metadata +12 -13
- data/.github/workflows/utils.rb +0 -127
- data/src/ios/video_audio_in.h +0 -22
data/ext/rays-video/video.cpp
CHANGED
|
@@ -9,7 +9,7 @@ RUCY_DEFINE_VALUE_FROM_TO(RAYS_VIDEO_EXPORT, Rays::Video)
|
|
|
9
9
|
|
|
10
10
|
#define THIS to<Rays::Video*>(self)
|
|
11
11
|
|
|
12
|
-
#define CHECK
|
|
12
|
+
#define CHECK RUCY_CHECK_OBJ(Rays::Video, self)
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
static
|
|
@@ -22,7 +22,7 @@ RUCY_END
|
|
|
22
22
|
static
|
|
23
23
|
RUCY_DEF4(initialize, width, height, fps, pixel_density)
|
|
24
24
|
{
|
|
25
|
-
|
|
25
|
+
RUCY_CHECK_PTR(Rays::Video, self);
|
|
26
26
|
|
|
27
27
|
float fps_ = to<float>(fps);
|
|
28
28
|
*THIS = Rays::Video(
|
|
@@ -36,35 +36,35 @@ RUCY_END
|
|
|
36
36
|
static
|
|
37
37
|
RUCY_DEF1(initialize_copy, obj)
|
|
38
38
|
{
|
|
39
|
-
|
|
39
|
+
RUCY_CHECK_PTR(Rays::Video, self);
|
|
40
40
|
|
|
41
41
|
*THIS = to<Rays::Video&>(obj).dup();
|
|
42
42
|
}
|
|
43
43
|
RUCY_END
|
|
44
44
|
|
|
45
45
|
static
|
|
46
|
-
|
|
46
|
+
RUCY_DEF0(play)
|
|
47
47
|
{
|
|
48
48
|
CHECK;
|
|
49
|
-
THIS->
|
|
49
|
+
THIS->play();
|
|
50
50
|
return self;
|
|
51
51
|
}
|
|
52
52
|
RUCY_END
|
|
53
53
|
|
|
54
54
|
static
|
|
55
|
-
|
|
55
|
+
RUCY_DEF0(pause)
|
|
56
56
|
{
|
|
57
57
|
CHECK;
|
|
58
|
-
THIS->
|
|
58
|
+
THIS->pause();
|
|
59
59
|
return self;
|
|
60
60
|
}
|
|
61
61
|
RUCY_END
|
|
62
62
|
|
|
63
63
|
static
|
|
64
|
-
|
|
64
|
+
RUCY_DEF0(stop)
|
|
65
65
|
{
|
|
66
66
|
CHECK;
|
|
67
|
-
THIS->
|
|
67
|
+
THIS->stop();
|
|
68
68
|
return self;
|
|
69
69
|
}
|
|
70
70
|
RUCY_END
|
|
@@ -94,6 +94,14 @@ RUCY_DEF0(height)
|
|
|
94
94
|
}
|
|
95
95
|
RUCY_END
|
|
96
96
|
|
|
97
|
+
static
|
|
98
|
+
RUCY_DEF0(pixel_density)
|
|
99
|
+
{
|
|
100
|
+
CHECK;
|
|
101
|
+
return value(THIS->pixel_density());
|
|
102
|
+
}
|
|
103
|
+
RUCY_END
|
|
104
|
+
|
|
97
105
|
static
|
|
98
106
|
RUCY_DEF0(fps)
|
|
99
107
|
{
|
|
@@ -103,114 +111,115 @@ RUCY_DEF0(fps)
|
|
|
103
111
|
RUCY_END
|
|
104
112
|
|
|
105
113
|
static
|
|
106
|
-
|
|
114
|
+
RUCY_DEF1(set_position, position)
|
|
107
115
|
{
|
|
108
116
|
CHECK;
|
|
109
|
-
|
|
117
|
+
THIS->set_position(to<size_t>(position));
|
|
118
|
+
return position;
|
|
110
119
|
}
|
|
111
120
|
RUCY_END
|
|
112
121
|
|
|
113
122
|
static
|
|
114
|
-
RUCY_DEF0(
|
|
123
|
+
RUCY_DEF0(get_position)
|
|
115
124
|
{
|
|
116
125
|
CHECK;
|
|
117
|
-
return value(THIS->
|
|
126
|
+
return value(THIS->position());
|
|
118
127
|
}
|
|
119
128
|
RUCY_END
|
|
120
129
|
|
|
121
130
|
static
|
|
122
|
-
|
|
131
|
+
RUCY_DEF1(set_time_scale, scale)
|
|
123
132
|
{
|
|
124
133
|
CHECK;
|
|
125
|
-
|
|
134
|
+
THIS->set_time_scale(to<float>(scale));
|
|
135
|
+
return scale;
|
|
126
136
|
}
|
|
127
137
|
RUCY_END
|
|
128
138
|
|
|
129
139
|
static
|
|
130
|
-
|
|
140
|
+
RUCY_DEF0(get_time_scale)
|
|
131
141
|
{
|
|
132
142
|
CHECK;
|
|
133
|
-
THIS->
|
|
134
|
-
return position;
|
|
143
|
+
return value(THIS->time_scale());
|
|
135
144
|
}
|
|
136
145
|
RUCY_END
|
|
137
146
|
|
|
138
147
|
static
|
|
139
|
-
|
|
148
|
+
RUCY_DEF2(insert, index, image)
|
|
140
149
|
{
|
|
141
150
|
CHECK;
|
|
142
|
-
|
|
151
|
+
THIS->insert(to<size_t>(index), to<const Rays::Image&>(image));
|
|
152
|
+
return self;
|
|
143
153
|
}
|
|
144
154
|
RUCY_END
|
|
145
155
|
|
|
146
156
|
static
|
|
147
|
-
|
|
157
|
+
RUCY_DEF1(append, image)
|
|
148
158
|
{
|
|
149
159
|
CHECK;
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
ret = yield(value(*it));
|
|
153
|
-
return ret;
|
|
160
|
+
THIS->append(to<const Rays::Image&>(image));
|
|
161
|
+
return self;
|
|
154
162
|
}
|
|
155
163
|
RUCY_END
|
|
156
164
|
|
|
157
165
|
static
|
|
158
|
-
|
|
166
|
+
RUCY_DEF1(remove, index)
|
|
159
167
|
{
|
|
160
168
|
CHECK;
|
|
161
|
-
|
|
169
|
+
THIS->remove(to<size_t>(index));
|
|
170
|
+
return self;
|
|
162
171
|
}
|
|
163
172
|
RUCY_END
|
|
164
173
|
|
|
165
174
|
static
|
|
166
|
-
|
|
175
|
+
RUCY_DEF2(set_at, index, image)
|
|
167
176
|
{
|
|
168
177
|
CHECK;
|
|
169
|
-
|
|
178
|
+
THIS->set(to<size_t>(index), to<const Rays::Image&>(image));
|
|
179
|
+
return image;
|
|
170
180
|
}
|
|
171
181
|
RUCY_END
|
|
172
182
|
|
|
173
183
|
static
|
|
174
|
-
|
|
184
|
+
RUCY_DEF1(get_at, index)
|
|
175
185
|
{
|
|
176
186
|
CHECK;
|
|
177
|
-
THIS->
|
|
178
|
-
return self;
|
|
187
|
+
return value(THIS->get(to<size_t>(index)));
|
|
179
188
|
}
|
|
180
189
|
RUCY_END
|
|
181
190
|
|
|
182
191
|
static
|
|
183
|
-
RUCY_DEF0(
|
|
192
|
+
RUCY_DEF0(size)
|
|
184
193
|
{
|
|
185
194
|
CHECK;
|
|
186
|
-
THIS->
|
|
187
|
-
return self;
|
|
195
|
+
return value(THIS->size());
|
|
188
196
|
}
|
|
189
197
|
RUCY_END
|
|
190
198
|
|
|
191
199
|
static
|
|
192
|
-
RUCY_DEF0(
|
|
200
|
+
RUCY_DEF0(empty)
|
|
193
201
|
{
|
|
194
202
|
CHECK;
|
|
195
|
-
THIS->
|
|
196
|
-
return self;
|
|
203
|
+
return value(THIS->empty());
|
|
197
204
|
}
|
|
198
205
|
RUCY_END
|
|
199
206
|
|
|
200
207
|
static
|
|
201
|
-
|
|
208
|
+
RUCY_DEF0(each)
|
|
202
209
|
{
|
|
203
210
|
CHECK;
|
|
204
|
-
|
|
205
|
-
|
|
211
|
+
Value ret;
|
|
212
|
+
for (auto it = THIS->begin(), end = THIS->end(); it != end; ++it)
|
|
213
|
+
ret = yield(value(*it));
|
|
214
|
+
return ret;
|
|
206
215
|
}
|
|
207
216
|
RUCY_END
|
|
208
217
|
|
|
209
218
|
static
|
|
210
|
-
RUCY_DEF0(
|
|
219
|
+
RUCY_DEF0(to_image)
|
|
211
220
|
{
|
|
212
221
|
CHECK;
|
|
213
|
-
return value(
|
|
222
|
+
return value((Rays::Image) *THIS);
|
|
214
223
|
}
|
|
215
224
|
RUCY_END
|
|
216
225
|
|
|
@@ -224,10 +233,12 @@ RUCY_END
|
|
|
224
233
|
static
|
|
225
234
|
RUCY_DEF0(exts)
|
|
226
235
|
{
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
236
|
+
const auto& exts = Rays::get_video_exts();
|
|
237
|
+
|
|
238
|
+
Value list = array(NULL, exts.size());
|
|
239
|
+
for (const auto& ext : exts)
|
|
240
|
+
list.push(ext.c_str());
|
|
241
|
+
return list;
|
|
231
242
|
}
|
|
232
243
|
RUCY_END
|
|
233
244
|
|
|
@@ -243,26 +254,27 @@ Init_rays_video ()
|
|
|
243
254
|
cVideo.define_alloc_func(alloc);
|
|
244
255
|
cVideo.define_private_method("initialize!", initialize);
|
|
245
256
|
cVideo.define_private_method("initialize_copy", initialize_copy);
|
|
246
|
-
cVideo.define_method("insert!", insert);
|
|
247
|
-
cVideo.define_method("append!", append);
|
|
248
|
-
cVideo.define_method("remove!", remove);
|
|
249
|
-
cVideo.define_method("save", save);
|
|
250
|
-
cVideo.define_method("width", width);
|
|
251
|
-
cVideo.define_method("height", height);
|
|
252
|
-
cVideo.define_method("fps", fps);
|
|
253
|
-
cVideo.define_method("pixel_density", pixel_density);
|
|
254
|
-
cVideo.define_method("size", size);
|
|
255
|
-
cVideo.define_method("empty?", empty);
|
|
256
|
-
cVideo.define_method("position=", set_position);
|
|
257
|
-
cVideo.define_method("position", get_position);
|
|
258
257
|
cVideo.define_method("play", play);
|
|
259
258
|
cVideo.define_method("pause", pause);
|
|
260
259
|
cVideo.define_method("stop", stop);
|
|
260
|
+
cVideo.define_method("save", save);
|
|
261
|
+
cVideo.define_method("width", width);
|
|
262
|
+
cVideo.define_method("height", height);
|
|
263
|
+
cVideo.define_method("pixel_density", pixel_density);
|
|
264
|
+
cVideo.define_method("fps", fps);
|
|
265
|
+
cVideo.define_method("position=", set_position);
|
|
266
|
+
cVideo.define_method("position", get_position);
|
|
261
267
|
cVideo.define_method("time_scale=", set_time_scale);
|
|
262
268
|
cVideo.define_method("time_scale", get_time_scale);
|
|
269
|
+
cVideo.define_method("insert!", insert);
|
|
270
|
+
cVideo.define_method("append!", append);
|
|
271
|
+
cVideo.define_method("remove!", remove);
|
|
272
|
+
cVideo.define_method("[]=", set_at);
|
|
273
|
+
cVideo.define_method("[]", get_at);
|
|
274
|
+
cVideo.define_method("size", size);
|
|
275
|
+
cVideo.define_method("empty?", empty);
|
|
263
276
|
cVideo.define_method("each!", each);
|
|
264
277
|
cVideo.define_method("to_image", to_image);
|
|
265
|
-
cVideo.define_method("[]", at);
|
|
266
278
|
cVideo.define_module_function("load", load);
|
|
267
279
|
cVideo.define_module_function("exts", exts);
|
|
268
280
|
}
|
data/include/rays/video.h
CHANGED
|
@@ -38,40 +38,44 @@ namespace Rays
|
|
|
38
38
|
|
|
39
39
|
This dup () const;
|
|
40
40
|
|
|
41
|
-
void insert (size_t index, const Image& image);
|
|
42
|
-
|
|
43
|
-
void append (const Image& image);
|
|
44
|
-
|
|
45
|
-
void remove (size_t index);
|
|
46
|
-
|
|
47
41
|
void play ();
|
|
48
42
|
|
|
49
43
|
void pause ();
|
|
50
44
|
|
|
51
45
|
void stop ();
|
|
52
46
|
|
|
53
|
-
void set_time_scale (float scale);
|
|
54
|
-
|
|
55
|
-
float time_scale () const;
|
|
56
|
-
|
|
57
47
|
void save (const char* path);
|
|
58
48
|
|
|
59
49
|
coord width () const;
|
|
60
50
|
|
|
61
51
|
coord height () const;
|
|
62
52
|
|
|
63
|
-
float fps () const;
|
|
64
|
-
|
|
65
53
|
float pixel_density () const;
|
|
66
54
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
bool empty () const;
|
|
55
|
+
float fps () const;
|
|
70
56
|
|
|
71
57
|
void set_position (size_t index);
|
|
72
58
|
|
|
73
59
|
size_t position () const;
|
|
74
60
|
|
|
61
|
+
void set_time_scale (float scale);
|
|
62
|
+
|
|
63
|
+
float time_scale () const;
|
|
64
|
+
|
|
65
|
+
void insert (size_t index, const Image& image);
|
|
66
|
+
|
|
67
|
+
void append (const Image& image);
|
|
68
|
+
|
|
69
|
+
void remove (size_t index);
|
|
70
|
+
|
|
71
|
+
void set (size_t index, const Image& image);
|
|
72
|
+
|
|
73
|
+
Image get (size_t index) const;
|
|
74
|
+
|
|
75
|
+
size_t size () const;
|
|
76
|
+
|
|
77
|
+
bool empty () const;
|
|
78
|
+
|
|
75
79
|
const_iterator begin () const;
|
|
76
80
|
|
|
77
81
|
const_iterator end () const;
|
data/lib/rays/video.rb
CHANGED
data/rays-video.gemspec
CHANGED
|
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
|
|
|
11
11
|
|
|
12
12
|
ext = RaysVideo::Extension
|
|
13
13
|
name = ext.name true
|
|
14
|
-
rdocs = glob.call
|
|
14
|
+
rdocs = glob.call(*%w[README .doc/ext/**/*.cpp])
|
|
15
15
|
|
|
16
16
|
s.name = name
|
|
17
17
|
s.version = ext.version
|
|
@@ -25,10 +25,10 @@ Gem::Specification.new do |s|
|
|
|
25
25
|
s.platform = Gem::Platform::RUBY
|
|
26
26
|
s.required_ruby_version = '>= 3.0.0'
|
|
27
27
|
|
|
28
|
-
s.add_dependency 'xot', '~> 0.
|
|
29
|
-
s.add_dependency 'rucy', '~> 0.
|
|
30
|
-
s.add_dependency 'beeps', '~> 0.
|
|
31
|
-
s.add_dependency 'rays', '~> 0.
|
|
28
|
+
s.add_dependency 'xot', '~> 0.5.0'
|
|
29
|
+
s.add_dependency 'rucy', '~> 0.5.0'
|
|
30
|
+
s.add_dependency 'beeps', '~> 0.5.0'
|
|
31
|
+
s.add_dependency 'rays', '~> 0.5.0'
|
|
32
32
|
|
|
33
33
|
s.files = `git ls-files`.split $/
|
|
34
34
|
s.executables = s.files.grep(%r{^bin/}) {|f| File.basename f}
|