diff options
-rw-r--r-- | elements/gstqtvideosink/gstqtvideosinksurface.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/elements/gstqtvideosink/gstqtvideosinksurface.cpp b/elements/gstqtvideosink/gstqtvideosinksurface.cpp index 0b686ae..b59230e 100644 --- a/elements/gstqtvideosink/gstqtvideosinksurface.cpp +++ b/elements/gstqtvideosink/gstqtvideosinksurface.cpp @@ -223,11 +223,12 @@ void GstQtVideoSinkSurface::paint(QPainter *painter, int x, int y, int width, in //TODO add properties for modifying clipRect - if (m_formatDirty) { + if (m_formatDirty || !m_painter) { //if either pixelFormat or frameSize have changed, we need to reset the painter //and/or change painter, in case the current one does not handle the requested format if (format.pixelFormat() != m_bufferFormat.pixelFormat() - || format.frameSize() != m_bufferFormat.frameSize()) + || format.frameSize() != m_bufferFormat.frameSize() + || !m_painter) { changePainter(format); } @@ -419,8 +420,10 @@ bool GstQtVideoSinkSurface::event(QEvent *event) m_buffer = NULL; } - m_painter->cleanup(); - destroyPainter(); + if (m_painter) { + m_painter->cleanup(); + destroyPainter(); + } g_signal_emit(m_sink, GstQtVideoSink::s_signals[GstQtVideoSink::UPDATE_SIGNAL], 0); |