motion-capture 1.1.3 → 1.2.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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/project/motion-capture.rb +21 -12
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: da930dcedd39084cf112b4158a95329b90bc7975
4
- data.tar.gz: 4be16787b1329e780c73cbd46a22de3d0c5523cf
3
+ metadata.gz: 2956f2573f93435ada9bf744cf6cad5d06a5feca
4
+ data.tar.gz: f6ac8e6a3b44d8831d5009e9c9163ec1ae448e24
5
5
  SHA512:
6
- metadata.gz: d66d8296c08c1fadef2cf0b1ff1ae89e7805d2b0b893a1bfb59f841cef24380b5ef7596ab824cbac56d805d73d82cd187e65cf5312c67cbdb6c2a6572a72efd5
7
- data.tar.gz: 8ab1f3dcec551a40362a48fd3d89ffb715fb81d96e37808bc1ea39d012b663f65435dac4a0e2e126354d5ef31106e09c3e7784ebd22cf75c72830817578de7a4
6
+ metadata.gz: 3bce0990179d37591924d0de90037835a165633aacf973f97c99b7617d320c0876666585bb621f71361322669ebec67fdec0066c17264fa57c61c44b91533572
7
+ data.tar.gz: 82e1a672f57a7a3217a9ce27bf3182f9537d12fa7a584ab81b24fa6eea8e4e31a0a55708c901ea70f55aa02e9c3eae7d4627fe31b06fe73f7b3d238c21214827
@@ -12,10 +12,14 @@ module Motion; class Capture
12
12
  @error_callback = block
13
13
  end
14
14
 
15
- def start!
15
+ def start!(preset = AVCaptureSessionPresetPhoto)
16
16
  use_camera(options.fetch(:device, :default))
17
17
 
18
+ set_preset(preset)
19
+
18
20
  add_ouput(still_image_output)
21
+
22
+ session.startRunning
19
23
  end
20
24
 
21
25
  def stop!
@@ -24,13 +28,14 @@ module Motion; class Capture
24
28
  remove_outputs
25
29
  remove_inputs
26
30
 
27
- @still_image_output = nil
28
- @session = nil
29
- @capture_preview_view = nil
31
+ @still_image_output = nil
32
+ @still_image_connection = nil
33
+ @session = nil
34
+ @capture_preview_view = nil
30
35
  end
31
36
 
32
37
  def running?
33
- session && session.running?
38
+ @session && session.running?
34
39
  end
35
40
 
36
41
  def capture(&block)
@@ -109,6 +114,14 @@ module Motion; class Capture
109
114
  end
110
115
  end
111
116
 
117
+ def can_set_preset?(preset)
118
+ session.canSetSessionPreset(preset)
119
+ end
120
+
121
+ def set_preset(preset)
122
+ session.sessionPreset = preset if can_set_preset? preset
123
+ end
124
+
112
125
  def set_flash(mode = :auto)
113
126
  configure_with_lock do
114
127
  device.flashMode = FLASH_MODES[mode] if FLASH_MODES.keys.include? mode
@@ -176,11 +189,11 @@ module Motion; class Capture
176
189
  end
177
190
 
178
191
  def add_input(input)
179
- session.addInput(input)
192
+ session.addInput(input) if session.canAddInput(input)
180
193
  end
181
194
 
182
195
  def add_ouput(output)
183
- session.addOutput(output)
196
+ session.addOutput(output) if session.canAddOutput(output)
184
197
  end
185
198
 
186
199
  def default_camera
@@ -223,11 +236,7 @@ module Motion; class Capture
223
236
  end
224
237
 
225
238
  def session
226
- @session ||= AVCaptureSession.alloc.init.tap do |session|
227
- session.sessionPreset = AVCaptureSessionPresetMedium
228
-
229
- session.startRunning
230
- end
239
+ @session ||= AVCaptureSession.alloc.init
231
240
  end
232
241
 
233
242
  def still_image_output
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion-capture
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Devon Blandin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-28 00:00:00.000000000 Z
11
+ date: 2013-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake