v4l2-ruby 0.9.2 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/v4l2/v4l2.c +43 -14
- data/lib/v4l2/version.rb +1 -1
- data/v4l2-ruby.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d31f555fce10530df57c6d98af41f9ad8008f666dd997a74d511ae8e41e0fec
|
4
|
+
data.tar.gz: 812507ef8f3c6fa913d2b1e1513111b630850481e21cc93a3a9d8126f6f61f22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03b24506c311f989e117ef35926f93c5f2c00c593fec3810a44dc7d6c72619ae395aaf2a5dbce3ac9458526877807b40ce46194c39eeca192d4067e522bc18ad
|
7
|
+
data.tar.gz: 9a1f9fe2899bf1e1ee40cd3305b4ff54f36c6341387fc342f435cf4b570ecc82d137f31c5ae45ae59f31ec8d1930bb86c7f5de5e03f68dc7ae70857ea276b40e
|
data/ext/v4l2/v4l2.c
CHANGED
@@ -297,27 +297,49 @@ rb_camera_get_controls(VALUE self)
|
|
297
297
|
}
|
298
298
|
|
299
299
|
static VALUE
|
300
|
-
get_framerate_list(camera_t* cam,
|
300
|
+
get_framerate_list(camera_t* cam,
|
301
|
+
uint32_t fmt, struct v4l2_frmsize_discrete* size)
|
301
302
|
{
|
302
303
|
VALUE ret;
|
303
304
|
int i;
|
304
|
-
|
305
305
|
int err;
|
306
306
|
struct v4l2_frmivalenum intval;
|
307
307
|
VALUE rate;
|
308
|
+
int num;
|
309
|
+
int deno;
|
308
310
|
|
309
311
|
ret = rb_ary_new();
|
310
312
|
|
311
313
|
for (i = 0; ; i++) {
|
312
|
-
err = camera_get_frame_rate(cam,
|
314
|
+
err = camera_get_frame_rate(cam, fmt,
|
313
315
|
size->width, size->height, i, &intval);
|
314
316
|
if (err) break;
|
315
317
|
|
316
|
-
|
318
|
+
switch (intval.type) {
|
319
|
+
case V4L2_FRMIVAL_TYPE_DISCRETE:
|
317
320
|
rate = rb_rational_new(INT2FIX(intval.discrete.denominator),
|
318
321
|
INT2FIX(intval.discrete.numerator));
|
319
322
|
|
320
323
|
rb_ary_push(ret, rate);
|
324
|
+
break;
|
325
|
+
|
326
|
+
case V4L2_FRMIVAL_TYPE_CONTINUOUS:
|
327
|
+
case V4L2_FRMIVAL_TYPE_STEPWISE:
|
328
|
+
num = intval.stepwise.max.numerator;
|
329
|
+
deno = intval.stepwise.max.denominator;
|
330
|
+
|
331
|
+
while (num <= intval.stepwise.min.numerator) {
|
332
|
+
while (deno <= intval.stepwise.min.denominator) {
|
333
|
+
rate = rb_rational_new(INT2FIX(deno), INT2FIX(num));
|
334
|
+
rb_ary_push(ret, rate);
|
335
|
+
|
336
|
+
deno += intval.stepwise.step.denominator;
|
337
|
+
}
|
338
|
+
|
339
|
+
num += intval.stepwise.step.numerator;
|
340
|
+
deno = intval.stepwise.max.denominator;
|
341
|
+
}
|
342
|
+
break;
|
321
343
|
}
|
322
344
|
}
|
323
345
|
|
@@ -403,7 +425,8 @@ rb_camera_get_support_formats(VALUE self)
|
|
403
425
|
}
|
404
426
|
|
405
427
|
static void
|
406
|
-
make_dummy_capabilities(camera_t* ptr, VALUE ary,
|
428
|
+
make_dummy_capabilities(camera_t* ptr, VALUE ary,
|
429
|
+
uint32_t fmt, int max_width, int max_height)
|
407
430
|
{
|
408
431
|
struct v4l2_frmsize_discrete dsize;
|
409
432
|
VALUE capa;
|
@@ -419,7 +442,7 @@ make_dummy_capabilities(camera_t* ptr, VALUE ary, int max_width, int max_height)
|
|
419
442
|
capa = rb_obj_alloc(frame_cap_klass);
|
420
443
|
rb_ivar_set(capa, id_iv_width, INT2NUM(dsize.width));
|
421
444
|
rb_ivar_set(capa, id_iv_height, INT2NUM(dsize.height));
|
422
|
-
rb_ivar_set(capa, id_iv_rate, get_framerate_list(ptr, &dsize));
|
445
|
+
rb_ivar_set(capa, id_iv_rate, get_framerate_list(ptr, fmt, &dsize));
|
423
446
|
|
424
447
|
rb_ary_push(ary, capa);
|
425
448
|
|
@@ -428,7 +451,7 @@ make_dummy_capabilities(camera_t* ptr, VALUE ary, int max_width, int max_height)
|
|
428
451
|
capa = rb_obj_alloc(frame_cap_klass);
|
429
452
|
rb_ivar_set(capa, id_iv_width, INT2NUM(dsize.width));
|
430
453
|
rb_ivar_set(capa, id_iv_height, INT2NUM(dsize.height));
|
431
|
-
rb_ivar_set(capa, id_iv_rate, get_framerate_list(ptr, &dsize));
|
454
|
+
rb_ivar_set(capa, id_iv_rate, get_framerate_list(ptr, fmt, &dsize));
|
432
455
|
|
433
456
|
rb_ary_push(ary, capa);
|
434
457
|
}
|
@@ -446,7 +469,7 @@ make_dummy_capabilities(camera_t* ptr, VALUE ary, int max_width, int max_height)
|
|
446
469
|
capa = rb_obj_alloc(frame_cap_klass);
|
447
470
|
rb_ivar_set(capa, id_iv_width, INT2NUM(dsize.width));
|
448
471
|
rb_ivar_set(capa, id_iv_height, INT2NUM(dsize.height));
|
449
|
-
rb_ivar_set(capa, id_iv_rate, get_framerate_list(ptr, &dsize));
|
472
|
+
rb_ivar_set(capa, id_iv_rate, get_framerate_list(ptr, fmt, &dsize));
|
450
473
|
|
451
474
|
rb_ary_push(ary, capa);
|
452
475
|
|
@@ -455,7 +478,7 @@ make_dummy_capabilities(camera_t* ptr, VALUE ary, int max_width, int max_height)
|
|
455
478
|
capa = rb_obj_alloc(frame_cap_klass);
|
456
479
|
rb_ivar_set(capa, id_iv_width, INT2NUM(dsize.width));
|
457
480
|
rb_ivar_set(capa, id_iv_height, INT2NUM(dsize.height));
|
458
|
-
rb_ivar_set(capa, id_iv_rate, get_framerate_list(ptr, &dsize));
|
481
|
+
rb_ivar_set(capa, id_iv_rate, get_framerate_list(ptr, fmt, &dsize));
|
459
482
|
|
460
483
|
rb_ary_push(ary, capa);
|
461
484
|
}
|
@@ -463,12 +486,13 @@ make_dummy_capabilities(camera_t* ptr, VALUE ary, int max_width, int max_height)
|
|
463
486
|
}
|
464
487
|
|
465
488
|
static VALUE
|
466
|
-
rb_camera_get_frame_capabilities(VALUE self, VALUE
|
489
|
+
rb_camera_get_frame_capabilities(VALUE self, VALUE _fmt)
|
467
490
|
{
|
468
491
|
VALUE ret;
|
469
492
|
camera_t* ptr;
|
470
493
|
int i;
|
471
494
|
int j;
|
495
|
+
uint32_t fmt;
|
472
496
|
|
473
497
|
int err;
|
474
498
|
struct v4l2_frmsizeenum size;
|
@@ -477,26 +501,31 @@ rb_camera_get_frame_capabilities(VALUE self, VALUE fmt)
|
|
477
501
|
VALUE list;
|
478
502
|
VALUE rate;
|
479
503
|
|
480
|
-
Check_Type(
|
504
|
+
Check_Type(_fmt, T_SYMBOL);
|
481
505
|
|
482
506
|
Data_Get_Struct(self, camera_t, ptr);
|
483
507
|
|
484
508
|
ret = rb_ary_new();
|
509
|
+
fmt = to_pixfmt(_fmt);
|
485
510
|
|
486
511
|
for (i = 0; ;i++){
|
487
|
-
err = camera_get_frame_size(ptr,
|
512
|
+
err = camera_get_frame_size(ptr, fmt, i, &size);
|
488
513
|
if (err) break;
|
489
514
|
|
490
515
|
if (size.type == V4L2_FRMSIZE_TYPE_DISCRETE) {
|
491
516
|
capa = rb_obj_alloc(frame_cap_klass);
|
517
|
+
list = get_framerate_list(ptr, fmt, &size.discrete);
|
518
|
+
|
492
519
|
rb_ivar_set(capa, id_iv_width, INT2NUM(size.discrete.width));
|
493
520
|
rb_ivar_set(capa, id_iv_height, INT2NUM(size.discrete.height));
|
494
|
-
rb_ivar_set(capa, id_iv_rate,
|
521
|
+
rb_ivar_set(capa, id_iv_rate, list);
|
495
522
|
|
496
523
|
rb_ary_push(ret, capa);
|
497
524
|
|
498
525
|
} else if (size.type == V4L2_FRMSIZE_TYPE_STEPWISE) {
|
499
|
-
make_dummy_capabilities(ptr,
|
526
|
+
make_dummy_capabilities(ptr,
|
527
|
+
ret,
|
528
|
+
fmt,
|
500
529
|
size.stepwise.max_width,
|
501
530
|
size.stepwise.max_height);
|
502
531
|
break;
|
data/lib/v4l2/version.rb
CHANGED
data/v4l2-ruby.gemspec
CHANGED
@@ -36,7 +36,7 @@ Gem::Specification.new do |spec|
|
|
36
36
|
|
37
37
|
spec.required_ruby_version = ">= 2.4.0"
|
38
38
|
|
39
|
-
spec.add_development_dependency "bundler", "~>
|
39
|
+
spec.add_development_dependency "bundler", "~> 2.0.0"
|
40
40
|
spec.add_development_dependency "rake", "~> 10.0"
|
41
41
|
spec.add_development_dependency "rake-compiler", "~> 1.0.7"
|
42
42
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: v4l2-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hiroshi Kuwagata
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06-
|
11
|
+
date: 2019-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 2.0.0
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 2.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|