Commit abe95e2e1ad8532e833d188474775576e176a829

Authored by Charles Otto
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.
openbr/plugins/gui.cpp
... ... @@ -132,7 +132,7 @@ public:
132 132 gui->moveToThread(QApplication::instance()->thread());
133 133 // Connect our signals to the proxy's slots
134 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 138 ~Show2Transform()
... ... @@ -159,7 +159,6 @@ public:
159 159 // build label
160 160 QString newTitle;
161 161 foreach (const QString & s, keys) {
162   -
163 162 if (t.file.contains(s)) {
164 163 QString out = t.file.get<QString>(s);
165 164 newTitle = newTitle + s + ": " + out + " ";
... ... @@ -188,7 +187,8 @@ public:
188 187 void finalize(TemplateList & output)
189 188 {
190 189 (void) output;
191   - // todo: hide window?
  190 + if (gui && gui->window)
  191 + gui->window->hide();
192 192 }
193 193  
194 194 void init()
... ...
openbr/plugins/stream.cpp
... ... @@ -295,6 +295,8 @@ private:
295 295 next_idx++;
296 296  
297 297 bool res = video.read(output.data.last().last());
  298 + output.data.last().last() = output.data.last().last().clone();
  299 +
298 300 if (!res) {
299 301 video_ok = false;
300 302 return video_ok;
... ...