[vlmc-devel] WorkflowFileRendererDialog: Update the preview label

Yikai Lu git at videolan.org
Sun Jul 24 11:54:47 CEST 2016


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Sun Jul 24 18:53:42 2016 +0900| [b6652a8aaa119c22c03abf8d3400b3ce85819a23] | committer: Yikai Lu

WorkflowFileRendererDialog: Update the preview label

> https://code.videolan.org/videolan/vlmc/commit/b6652a8aaa119c22c03abf8d3400b3ce85819a23
---

 src/Gui/WorkflowFileRendererDialog.cpp | 3 +++
 src/Workflow/MainWorkflow.cpp          | 9 +++++++++
 2 files changed, 12 insertions(+)

diff --git a/src/Gui/WorkflowFileRendererDialog.cpp b/src/Gui/WorkflowFileRendererDialog.cpp
index c78f1a9..8a0a923 100644
--- a/src/Gui/WorkflowFileRendererDialog.cpp
+++ b/src/Gui/WorkflowFileRendererDialog.cpp
@@ -59,6 +59,9 @@ WorkflowFileRendererDialog::setProgressBarValue( int val )
 void
 WorkflowFileRendererDialog::updatePreview( const uchar* buff )
 {
+    QImage img( buff, m_width, m_height,
+                QImage::Format_RGBA8888, []( void* buf ){ delete[] (uchar*) buf; } );
+    m_ui.previewLabel->setPixmap( QPixmap::fromImage( img ) );
 }
 
 void
diff --git a/src/Workflow/MainWorkflow.cpp b/src/Workflow/MainWorkflow.cpp
index 18c7e20..1f05c93 100644
--- a/src/Workflow/MainWorkflow.cpp
+++ b/src/Workflow/MainWorkflow.cpp
@@ -328,6 +328,15 @@ MainWorkflow::startRenderToFile( const QString &outputFileName, quint32 width, q
     dialog.setOutputFileName( outputFileName );
     connect( &cEventWatcher, &OutputEventWatcher::stopped, &dialog, &WorkflowFileRendererDialog::accept );
     connect( &dialog, &WorkflowFileRendererDialog::stop, this, [&output]{ output.stop(); } );
+    connect( m_renderer->eventWatcher(), &RendererEventWatcher::positionChanged, &dialog,
+             [this, &dialog, width, height]( qint64 pos )
+    {
+        // Update the preview per five seconds
+        if ( pos % qRound( m_multitrack->fps() * 5 ) == 0 )
+        {
+            dialog.updatePreview( m_multitrack->image( width, height ) );
+        }
+    });
 #endif
 
     connect( &cEventWatcher, &OutputEventWatcher::stopped, this, [&output]{ output.stop(); } );



More information about the Vlmc-devel mailing list