av_capture 1.0.0 → 1.0.1
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/README.markdown +17 -17
- data/Rakefile +2 -0
- data/lib/av_capture.rb +21 -1
- data/test/test_maccam.rb +11 -0
- metadata +13 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b453a7db7dd87d42ed5cbda0b72933aa507216c3
|
4
|
+
data.tar.gz: 95b36932ca28353b09ff82873ffa6eefe8cc3341
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e251ec7899cedb4a08e797b465dee4835d78af05cd6710985f4585bea15fb2d55fa8d767e573c6d8b2f226f0486f691d986315db547a43a59095436a13325ae0
|
7
|
+
data.tar.gz: c2ae4465ff5dee39eac94d199206ca34a2fcde4d0a3098f2170b793f45b807126fc038655a157eeb8d8eac4fcc32f1d348bf8108e6129781151182fc4fe07def
|
data/README.markdown
CHANGED
@@ -4,37 +4,37 @@
|
|
4
4
|
|
5
5
|
## DESCRIPTION:
|
6
6
|
|
7
|
-
Wraps up AVCapture and exposes it to Ruby.
|
7
|
+
Wraps up AVCapture and exposes it to Ruby. This gem only works on OS X.
|
8
8
|
|
9
9
|
## FEATURES/PROBLEMS:
|
10
10
|
|
11
|
+
* This gem only works on OS X
|
11
12
|
* Not particularly easy to use right now
|
13
|
+
* This gem only works on OS X
|
14
|
+
* This gem only works on OS X
|
15
|
+
* This gem only works on OS X
|
16
|
+
* This gem only works on OS X
|
17
|
+
* This gem only works on OS X
|
12
18
|
|
13
19
|
### SYNOPSIS:
|
14
20
|
|
15
21
|
Capture an image:
|
16
22
|
|
17
23
|
```ruby
|
18
|
-
|
19
|
-
|
24
|
+
require 'av_capture'
|
25
|
+
|
26
|
+
session = AVCapture::Session.new
|
27
|
+
dev = AVCapture.devices.find(&:video?)
|
20
28
|
|
21
29
|
p dev.name
|
22
30
|
p dev.video?
|
23
|
-
output = AVCapture::StillImageOutput.new # AVCaptureOutput subclass
|
24
|
-
session.add_input dev.as_input
|
25
|
-
session.add_output output
|
26
|
-
|
27
|
-
session.run do
|
28
|
-
connection = output.video_connection
|
29
|
-
|
30
|
-
ios = 5.times.map {
|
31
|
-
io = output.capture_on connection
|
32
|
-
sleep 0.5
|
33
|
-
io
|
34
|
-
}
|
35
31
|
|
36
|
-
|
37
|
-
|
32
|
+
session.run_with(dev) do |connection|
|
33
|
+
2.times do |i|
|
34
|
+
File.open("x_#{i}.jpg", 'wb') { |f|
|
35
|
+
f.write connection.capture
|
36
|
+
}
|
37
|
+
sleep 1
|
38
38
|
end
|
39
39
|
end
|
40
40
|
```
|
data/Rakefile
CHANGED
data/lib/av_capture.rb
CHANGED
@@ -2,7 +2,7 @@ require 'av_capture.so'
|
|
2
2
|
require 'thread'
|
3
3
|
|
4
4
|
module AVCapture
|
5
|
-
VERSION = '1.0.
|
5
|
+
VERSION = '1.0.1'
|
6
6
|
|
7
7
|
class Device
|
8
8
|
def video?
|
@@ -42,6 +42,26 @@ module AVCapture
|
|
42
42
|
end
|
43
43
|
|
44
44
|
class Session
|
45
|
+
class Capture
|
46
|
+
def initialize output, connection
|
47
|
+
@output = output
|
48
|
+
@connection = connection
|
49
|
+
end
|
50
|
+
|
51
|
+
def capture
|
52
|
+
@output.capture_on(@connection).data
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def run_with dev
|
57
|
+
output = AVCapture::StillImageOutput.new
|
58
|
+
add_input dev.as_input
|
59
|
+
add_output output
|
60
|
+
connection = output.video_connection
|
61
|
+
capture = Capture.new output, connection
|
62
|
+
run { yield capture }
|
63
|
+
end
|
64
|
+
|
45
65
|
def run
|
46
66
|
start_running!
|
47
67
|
yield
|
data/test/test_maccam.rb
CHANGED
@@ -6,6 +6,17 @@ class TestAVCapture < MiniTest::Test
|
|
6
6
|
AVCapture.devices.find(&:video?)
|
7
7
|
end
|
8
8
|
|
9
|
+
def test_simplified_api
|
10
|
+
session = AVCapture::Session.new
|
11
|
+
dev = AVCapture.devices.find(&:video?)
|
12
|
+
|
13
|
+
data = nil
|
14
|
+
session.run_with(dev) do |connection|
|
15
|
+
data = connection.capture
|
16
|
+
end
|
17
|
+
assert data
|
18
|
+
end
|
19
|
+
|
9
20
|
def test_output
|
10
21
|
sio = AVCapture::StillImageOutput.new
|
11
22
|
assert_equal 0, sio.connections.length
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: av_capture
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Patterson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '5.
|
19
|
+
version: '5.3'
|
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: '5.
|
26
|
+
version: '5.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rdoc
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,15 +44,16 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '3.
|
47
|
+
version: '3.8'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '3.
|
55
|
-
description: Wraps up AVCapture and exposes it to Ruby.
|
54
|
+
version: '3.8'
|
55
|
+
description: Wraps up AVCapture and exposes it to Ruby. This gem only works on OS
|
56
|
+
X.
|
56
57
|
email:
|
57
58
|
- tenderlove@ruby-lang.org
|
58
59
|
executables: []
|
@@ -64,6 +65,7 @@ extra_rdoc_files:
|
|
64
65
|
- README.markdown
|
65
66
|
files:
|
66
67
|
- ".autotest"
|
68
|
+
- ".gemtest"
|
67
69
|
- CHANGELOG.rdoc
|
68
70
|
- Gemfile
|
69
71
|
- Manifest.txt
|
@@ -79,9 +81,9 @@ files:
|
|
79
81
|
- ext/av_capture/still_image_output.m
|
80
82
|
- lib/av_capture.rb
|
81
83
|
- test/test_maccam.rb
|
82
|
-
- ".gemtest"
|
83
84
|
homepage: https://github.com/tenderlove/av_capture
|
84
|
-
licenses:
|
85
|
+
licenses:
|
86
|
+
- MIT
|
85
87
|
metadata: {}
|
86
88
|
post_install_message:
|
87
89
|
rdoc_options:
|
@@ -101,9 +103,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
103
|
version: '0'
|
102
104
|
requirements: []
|
103
105
|
rubyforge_project: av_capture
|
104
|
-
rubygems_version: 2.
|
106
|
+
rubygems_version: 2.2.2
|
105
107
|
signing_key:
|
106
108
|
specification_version: 4
|
107
|
-
summary: Wraps up AVCapture and exposes it to Ruby
|
109
|
+
summary: Wraps up AVCapture and exposes it to Ruby
|
108
110
|
test_files:
|
109
111
|
- test/test_maccam.rb
|