Commit abe95e2e1ad8532e833d188474775576e176a829
1 parent
e41031d2
Make Show2 hide its window if finalize is called, fix a video reading problem
Make show2 hide its window if finalize is called, also change the update image signal to a blocking type to allow this to work correctly (this will actually lock the frame rate of a stream to whatever speed qt can update windows at, so maybe should be optional) After calling VideoCapture::read, make a clone of the returned matrix since it has become clear that in at least some cases, the returned matrix is an alias of some internal buffer of the VideoCapture.
Showing
2 changed files
with
5 additions
and
3 deletions
openbr/plugins/gui.cpp
| @@ -132,7 +132,7 @@ public: | @@ -132,7 +132,7 @@ public: | ||
| 132 | gui->moveToThread(QApplication::instance()->thread()); | 132 | gui->moveToThread(QApplication::instance()->thread()); |
| 133 | // Connect our signals to the proxy's slots | 133 | // Connect our signals to the proxy's slots |
| 134 | connect(this, SIGNAL(needWindow()), gui, SLOT(createWindow()), Qt::BlockingQueuedConnection); | 134 | connect(this, SIGNAL(needWindow()), gui, SLOT(createWindow()), Qt::BlockingQueuedConnection); |
| 135 | - connect(this, SIGNAL(updateImage(QPixmap)), gui,SLOT(showImage(QPixmap))); | 135 | + connect(this, SIGNAL(updateImage(QPixmap)), gui,SLOT(showImage(QPixmap)), Qt::BlockingQueuedConnection); |
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | ~Show2Transform() | 138 | ~Show2Transform() |
| @@ -159,7 +159,6 @@ public: | @@ -159,7 +159,6 @@ public: | ||
| 159 | // build label | 159 | // build label |
| 160 | QString newTitle; | 160 | QString newTitle; |
| 161 | foreach (const QString & s, keys) { | 161 | foreach (const QString & s, keys) { |
| 162 | - | ||
| 163 | if (t.file.contains(s)) { | 162 | if (t.file.contains(s)) { |
| 164 | QString out = t.file.get<QString>(s); | 163 | QString out = t.file.get<QString>(s); |
| 165 | newTitle = newTitle + s + ": " + out + " "; | 164 | newTitle = newTitle + s + ": " + out + " "; |
| @@ -188,7 +187,8 @@ public: | @@ -188,7 +187,8 @@ public: | ||
| 188 | void finalize(TemplateList & output) | 187 | void finalize(TemplateList & output) |
| 189 | { | 188 | { |
| 190 | (void) output; | 189 | (void) output; |
| 191 | - // todo: hide window? | 190 | + if (gui && gui->window) |
| 191 | + gui->window->hide(); | ||
| 192 | } | 192 | } |
| 193 | 193 | ||
| 194 | void init() | 194 | void init() |
openbr/plugins/stream.cpp
| @@ -295,6 +295,8 @@ private: | @@ -295,6 +295,8 @@ private: | ||
| 295 | next_idx++; | 295 | next_idx++; |
| 296 | 296 | ||
| 297 | bool res = video.read(output.data.last().last()); | 297 | bool res = video.read(output.data.last().last()); |
| 298 | + output.data.last().last() = output.data.last().last().clone(); | ||
| 299 | + | ||
| 298 | if (!res) { | 300 | if (!res) { |
| 299 | video_ok = false; | 301 | video_ok = false; |
| 300 | return video_ok; | 302 | return video_ok; |