diff --git a/src/main.cpp b/src/main.cpp index 6f8755c..26f8bec 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,17 +1,22 @@ + +//#define LINUX_RELEASE + #include"qtheaders.h" #include "main_window.h" -//#include +#ifdef LINUX_RELEASE +#include +#endif bool blend_set = false; cv::Mat blend_image; int main(int argc, char **argv) { - /* +#ifdef LINUX_RELEASE if(chdir("/usr/share/acidcam") == 0) { std::cout << "Changed directory to: /usr/share/acidcam\n"; } - */ +#endif QApplication app(argc, argv); AC_MainWindow window; diff --git a/src/main_window.cpp b/src/main_window.cpp index 95ce2a2..8f92a9d 100644 --- a/src/main_window.cpp +++ b/src/main_window.cpp @@ -67,9 +67,9 @@ void Playback::setVideo(cv::VideoCapture cap, cv::VideoWriter wr, bool record) { } void Playback::setVector(std::vector> v) { - mutex.lock(); + mutex_add.lock(); current = v; - mutex.unlock(); + mutex_add.unlock(); } void Playback::setOptions(bool n, int c) { @@ -97,24 +97,30 @@ void Playback::run() { emit stopRecording(); return; } + + static std::vector> cur; + mutex_shown.lock(); + cur = current; + mutex_shown.unlock(); + + ac::orig_frame = frame.clone(); - if(current.size()>0) { + if(cur.size()>0) { ac::in_custom = true; - for(unsigned int i = 0; i < current.size(); ++i) { - if(i == current.size()-1) + for(unsigned int i = 0; i < cur.size(); ++i) { + if(i == cur.size()-1) ac::in_custom = false; - if(current[i].first == 0) { - ac::draw_func[current[i].second](frame); - } else if(current[i].first == 1) { - current_filterx = current[i].second; + if(cur[i].first == 0) { + ac::draw_func[cur[i].second](frame); + } else if(cur[i].first == 1) { + current_filterx = cur[i].second; ac::alphaFlame(frame); - } else if(current[i].first == 2) { - draw_plugin(frame, current[i].second); + } else if(cur[i].first == 2) { + draw_plugin(frame, cur[i].second); } } } - if(recording && writer.isOpened()) { writer.write(frame); } @@ -161,7 +167,6 @@ void Playback::Stop() { } void Playback::Release() { - mutex.lock(); stop = true; if(capture.isOpened()) capture.release(); @@ -824,8 +829,10 @@ void AC_MainWindow::frameInc() { float index = frame_index; float max_frames = video_frames; float value = (index/max_frames)*100; + unsigned int val = static_cast(value); if(frame_index <= video_frames) - frame_stream << " - " << static_cast(value) << "%"; + frame_stream << " - " << val << "%"; + progress_bar->setValue(val); } statusBar()->showMessage(frame_string); } diff --git a/src/main_window.h b/src/main_window.h index d4ef1c7..44bd1c7 100644 --- a/src/main_window.h +++ b/src/main_window.h @@ -8,7 +8,7 @@ class Playback : public QThread { Q_OBJECT private: bool stop; - QMutex mutex,mutex_shown; + QMutex mutex,mutex_shown,mutex_add; QWaitCondition condition; cv::Mat frame; int frame_rate;