Removed commented lines + todos
[kaka/cakelight.git] / src / kaka / cakelight / VideoMode.java
index e4b9400..ca0bd53 100644 (file)
@@ -5,7 +5,7 @@ import java.io.IOException;
 import java.util.Optional;
 import java.util.function.Consumer;
 
-public class VideoMode extends Mode implements Consumer<Optional<File>> {
+public class VideoMode extends Mode {
     private Configuration config;
     private Thread thread;
     private Consumer<Frame> frameConsumer;
@@ -13,7 +13,7 @@ public class VideoMode extends Mode implements Consumer<Optional<File>> {
 
     public VideoMode() {
         deviceListener = new VideoDeviceListener();
-        deviceListener.onVideoDeviceChange(this);
+        deviceListener.onVideoDeviceChange(this::onVideoDeviceChange);
     }
 
     @Override
@@ -38,8 +38,6 @@ public class VideoMode extends Mode implements Consumer<Optional<File>> {
                         if (frameConsumer != null) frame.ifPresent(frameConsumer);
                         frame.ifPresent(VideoMode.this::onFrame);
 //                        timeIt("frame", grabber::grabFrame);
-                        // TODO: process frame
-                        // TODO: save where the LedController can access it
                     }
                 } catch (IOException e) {
                     e.printStackTrace();
@@ -54,12 +52,10 @@ public class VideoMode extends Mode implements Consumer<Optional<File>> {
     }
 
     private void onFrame(Frame frame) {
-        assert frameListener != null;
-        frameListener.accept(frame.getLedFrame());
+        updateWithFrame(frame.getLedFrame());
     }
 
-    @Override
-    public void accept(Optional<File> videoDevice) {
+    public void onVideoDeviceChange(Optional<File> videoDevice) {
         // Should only happen when this mode is active!
         if (thread != null) {
             thread.interrupt();