Make v4l2_reader use epoll

It no longer needs to be polled in a loop
and sends images directly to the channel

Signed-off-by: Ravago Jones <ravagojones@gmail.com>
Change-Id: I8fc3efc3fd2cd67836294d9dc47d5342cd7d5de4
diff --git a/frc971/vision/v4l2_reader.h b/frc971/vision/v4l2_reader.h
index a2b4c25..334ad81 100644
--- a/frc971/vision/v4l2_reader.h
+++ b/frc971/vision/v4l2_reader.h
@@ -5,6 +5,7 @@
 #include <string>
 
 #include "absl/types/span.h"
+#include "aos/events/epoll.h"
 #include "aos/events/event_loop.h"
 #include "aos/ftrace.h"
 #include "aos/scoped/scoped_fd.h"
@@ -62,6 +63,8 @@
   // H.264 frames.
   size_t ImageSize() const { return rows_ * cols_ * 2 /* bytes per pixel */; }
 
+  const aos::ScopedFD &fd() { return fd_; };
+
  private:
   static constexpr int kNumberBuffers = 4;
 
@@ -139,7 +142,13 @@
 // properly configured before this class is constructed.
 class RockchipV4L2Reader : public V4L2ReaderBase {
  public:
-  RockchipV4L2Reader(aos::EventLoop *event_loop, const std::string &device_name);
+  RockchipV4L2Reader(aos::EventLoop *event_loop, aos::internal::EPoll *epoll,
+                     const std::string &device_name);
+
+ private:
+  void OnImageReady();
+
+  aos::internal::EPoll *epoll_;
 };
 
 }  // namespace vision