diff --git a/src/playback_thread.cpp b/src/playback_thread.cpp index 999fcaf..404e9fe 100644 --- a/src/playback_thread.cpp +++ b/src/playback_thread.cpp @@ -40,7 +40,13 @@ bool Playback::setVideoCamera(int device, int res, cv::VideoWriter wr, bool reco mode = MODE_CAMERA; mutex.lock(); if(capture.isOpened()) { - +#if defined(__linux__) || defined(_WIN32) + capture.open(device); + if(!capture.isOpened()) { + mutex.unlock(); + return false; + } +#endif } else { capture.open(device); if(!capture.isOpened()) { diff --git a/src/playback_thread.h b/src/playback_thread.h index 62d0ee8..6dc836a 100644 --- a/src/playback_thread.h +++ b/src/playback_thread.h @@ -30,6 +30,7 @@ private: std::vector> current; bool isPaused, isStep; VideoMode mode; + int device_num; public: Playback(QObject *parent = 0); ~Playback();