Dolda2000 GitWeb
/
kaka
/
cakelight.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Always return a configuration
[kaka/cakelight.git]
/
src
/
kaka
/
cakelight
/
FrameGrabber.java
diff --git
a/src/kaka/cakelight/FrameGrabber.java
b/src/kaka/cakelight/FrameGrabber.java
index
8fbb16f
..
1db5c2c
100644
(file)
--- a/
src/kaka/cakelight/FrameGrabber.java
+++ b/
src/kaka/cakelight/FrameGrabber.java
@@
-14,10
+14,10
@@
public class FrameGrabber implements Closeable {
private FrameGrabber() {
}
private FrameGrabber() {
}
- public static FrameGrabber from(Configuration config) {
+ public static FrameGrabber from(
File videoDevice,
Configuration config) {
FrameGrabber fg = new FrameGrabber();
fg.config = config;
FrameGrabber fg = new FrameGrabber();
fg.config = config;
- fg.file =
new File(config.video.device)
;
+ fg.file =
videoDevice
;
fg.bytesPerFrame = config.video.width * config.video.height * config.video.bpp;
fg.prepare();
return fg;
fg.bytesPerFrame = config.video.width * config.video.height * config.video.bpp;
fg.prepare();
return fg;
@@
-28,6
+28,7
@@
public class FrameGrabber implements Closeable {
fileStream = new FileInputStream(file);
return true;
} catch (FileNotFoundException e) {
fileStream = new FileInputStream(file);
return true;
} catch (FileNotFoundException e) {
+ // TODO: handle java.io.FileNotFoundException: /dev/video1 (Permission denied)
e.printStackTrace();
return false;
}
e.printStackTrace();
return false;
}
@@
-36,12
+37,12
@@
public class FrameGrabber implements Closeable {
/**
* Must be run in the same thread as {@link #prepare}.
*/
/**
* Must be run in the same thread as {@link #prepare}.
*/
- public Optional<Frame> grabFrame() {
+ public Optional<
Video
Frame> grabFrame() {
try {
byte[] data = new byte[bytesPerFrame];
int count = fileStream.read(data);
log("# of bytes read = " + count);
try {
byte[] data = new byte[bytesPerFrame];
int count = fileStream.read(data);
log("# of bytes read = " + count);
- return Optional.of(Frame.of(data, config));
+ return Optional.of(
Video
Frame.of(data, config));
} catch (IOException e) {
e.printStackTrace();
}
} catch (IOException e) {
e.printStackTrace();
}