v4l2-ruby 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 424efbca7f3356490a8e5bc697d2eea26da700a6a3aeb3d77afbc47720968259
4
+ data.tar.gz: 7707c7e1b24d9efab3922bb9a45341bb46ceb7e5e3d197bef31d00d10e886a19
5
+ SHA512:
6
+ metadata.gz: e0e49bc1b9d6229994d052e88fc2be6b45b1875f2a2cbec558c98bdac3e294353ae069f29e579fcd95de33cc3862833b12f0999a6a3537864f0a0dd6cf96a1ec
7
+ data.tar.gz: 4ab1db51233f05769fcc97623f9e30c6bdda6dda492bfa87097df2fdb088f1abbdb36599c4b9d696b383b8efa8b3732f9f0f4eba50fc3bcb46d1682116b18807
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in v4l2-ruby.gemspec
6
+ gemspec
7
+ gem "rake-compiler"
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Hiroshi Kuwagata
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,59 @@
1
+ # V4L2 for Ruby
2
+ A V4L2 (Video4Linux2) interfae library for Ruby.
3
+
4
+ ## Installation
5
+
6
+ Add this line to your application's Gemfile:
7
+
8
+ ```ruby
9
+ gem 'v4l2'
10
+ ```
11
+
12
+ And then execute:
13
+
14
+ $ bundle
15
+
16
+ Or install it yourself as:
17
+
18
+ $ gem install v4l2
19
+
20
+ ## Usage
21
+
22
+ ```
23
+ #! /usr/bin/env ruby
24
+ # coding: utf-8
25
+
26
+ require './v4l2.so'
27
+ require 'json'
28
+ require 'pp'
29
+
30
+ cam = Video4Linux2::Camera.open('/dev/video0')
31
+
32
+ #pp cam.support_formats
33
+ #pp cam.frame_capabilities(:MJPEG)
34
+
35
+ p cam.name
36
+ p cam.driver
37
+ p cam.bus
38
+
39
+ if not cam.busy?
40
+ cam.image_width = 640
41
+ cam.image_height = 480
42
+ cam.framerate = 10/1r
43
+ cam.format = :MJPEG
44
+
45
+ # pp cam.controls
46
+ # camera.set_control(id, val)
47
+
48
+ cam.start
49
+
50
+ 10.times {|i| IO.binwrite("%02d.jpg" % i, cam.capture)}
51
+
52
+ cam.stop
53
+ else
54
+ printf("camera is busy\n")
55
+ end
56
+
57
+ cam.close
58
+ ```
59
+
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/extensiontask"
3
+
4
+ task :default => :spec
5
+
6
+ Rake::ExtensionTask.new("v4l2") do |ext|
7
+ ext.lib_dir = "lib/v4l2"
8
+ end