From 8bf1eba206f4579074784af5aeb5559f76f8d0fa Mon Sep 17 00:00:00 2001 From: MPR Date: Sat, 8 Nov 2014 18:13:15 +0000 Subject: [PATCH] modify read access to not start if captureStart is not called --- inc/V4l2ReadCapture.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/inc/V4l2ReadCapture.h b/inc/V4l2ReadCapture.h index 795154e..9fb287d 100644 --- a/inc/V4l2ReadCapture.h +++ b/inc/V4l2ReadCapture.h @@ -22,13 +22,16 @@ class V4l2ReadCapture : public V4l2Capture static V4l2ReadCapture* createNew(V4L2DeviceParameters params); protected: - V4l2ReadCapture(V4L2DeviceParameters params) : V4l2Capture(params) {}; + V4l2ReadCapture(V4L2DeviceParameters params) : V4l2Capture(params), m_counter(0) {}; public: - virtual bool captureStart() { return true; }; + virtual bool captureStart() { m_counter=1; return true; }; virtual size_t read(char* buffer, size_t bufferSize); - virtual bool captureStop() { return true; }; - virtual bool isReady() { return m_fd != -1; }; + virtual bool captureStop() { m_counter=0; return true; }; + virtual bool isReady() { return ((m_fd != -1) && (m_counter>0)); }; + + protected: + int m_counter; }; #endif \ No newline at end of file