[vlmc-devel] commit: WorkflowRenderer: Detect when something went wrong. ( Hugo Beauzée-Luyssen )
git at videolan.org
git at videolan.org
Thu May 27 22:50:43 CEST 2010
vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Thu May 27 22:44:02 2010 +0200| [462b086caedb852ada7fb70c3146efc629c90525] | committer: Hugo Beauzée-Luyssen
WorkflowRenderer: Detect when something went wrong.
> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=462b086caedb852ada7fb70c3146efc629c90525
---
src/LibVLCpp/VLCMediaPlayer.cpp | 2 +-
src/Renderer/GenericRenderer.h | 9 +++++++++
src/Renderer/WorkflowRenderer.cpp | 8 ++++++++
src/Renderer/WorkflowRenderer.h | 7 +++++++
4 files changed, 25 insertions(+), 1 deletions(-)
diff --git a/src/LibVLCpp/VLCMediaPlayer.cpp b/src/LibVLCpp/VLCMediaPlayer.cpp
index 985293b..e87b97f 100644
--- a/src/LibVLCpp/VLCMediaPlayer.cpp
+++ b/src/LibVLCpp/VLCMediaPlayer.cpp
@@ -113,7 +113,7 @@ void MediaPlayer::callbacks( const libvlc_event_t* ev
self->emit snapshotTaken( event->u.media_player_snapshot_taken.psz_filename );
break;
case libvlc_MediaPlayerEncounteredError:
- qDebug() << "libvlc_MediaPlayerEncounteredError received."
+ qDebug() << '[' << (void*)self << "] libvlc_MediaPlayerEncounteredError received."
<< "This is not looking good...";
self->emit errorEncountered();
break ;
diff --git a/src/Renderer/GenericRenderer.h b/src/Renderer/GenericRenderer.h
index 0da409d..19885bc 100644
--- a/src/Renderer/GenericRenderer.h
+++ b/src/Renderer/GenericRenderer.h
@@ -212,6 +212,15 @@ signals:
* \sa stopped();
*/
void endReached();
+
+ /**
+ * \brief Emited when something went wrong with the render.
+ *
+ * The cause may vary depending on the underlying renderer, though this will
+ * almost always be caused by a missing codec.
+ */
+ void error();
+
};
#endif // GENERICRENDERER_H
diff --git a/src/Renderer/WorkflowRenderer.cpp b/src/Renderer/WorkflowRenderer.cpp
index 0038732..79f7231 100644
--- a/src/Renderer/WorkflowRenderer.cpp
+++ b/src/Renderer/WorkflowRenderer.cpp
@@ -68,6 +68,7 @@ void WorkflowRenderer::initializeRenderer()
//Media player part: to update PreviewWidget
connect( m_mediaPlayer, SIGNAL( playing() ), this, SIGNAL( playing() ), Qt::DirectConnection );
connect( m_mediaPlayer, SIGNAL( paused() ), this, SIGNAL( paused() ), Qt::DirectConnection );
+ connect( m_mediaPlayer, SIGNAL( errorEncountered() ), this, SLOT( errorEncountered() ) );
//FIXME:: check if this doesn't require Qt::QueuedConnection
connect( m_mediaPlayer, SIGNAL( stopped() ), this, SIGNAL( endReached() ) );
}
@@ -409,3 +410,10 @@ WorkflowRenderer::mainWorkflowLenghtChanged( qint64 /*newLength*/ )
// }
// m_oldLength = newLength;
}
+
+void
+WorkflowRenderer::errorEncountered()
+{
+ stop();
+ emit error();
+}
diff --git a/src/Renderer/WorkflowRenderer.h b/src/Renderer/WorkflowRenderer.h
index 070b443..de2936d 100644
--- a/src/Renderer/WorkflowRenderer.h
+++ b/src/Renderer/WorkflowRenderer.h
@@ -304,6 +304,13 @@ class WorkflowRenderer : public GenericRenderer
*/
void mainWorkflowLenghtChanged( qint64 newLength );
+ /**
+ * \brief Used to catch an error in the rendering part
+ *
+ * Most likely, this will be called if the required codec aren't found.
+ * This will stop the render and emit the error() signal.
+ */
+ void errorEncountered();
};
#endif // WORKFLOWRENDERER_H
More information about the Vlmc-devel
mailing list