From bf8f6c88c95a59977af81f33a3437e7b8bb08e19 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 19 Dec 2014 14:38:18 +0100 Subject: Migrate to categorized logging in Quick 2 video output Enable qt.multimedia.video to get the logs. Also enhance the printing when creating the video node implementation. It is essential to have an easy way to figure out what handle and formats the node in use supports. Change-Id: Idf3a9f076ba03b5e613c19f2347204c841850b45 Reviewed-by: Andy Nichols --- .../qdeclarativevideooutput.cpp | 13 +++++------ .../qdeclarativevideooutput_render.cpp | 25 +++++++++------------- 2 files changed, 15 insertions(+), 23 deletions(-) diff --git a/src/qtmultimediaquicktools/qdeclarativevideooutput.cpp b/src/qtmultimediaquicktools/qdeclarativevideooutput.cpp index d7aab6915..9a9256868 100644 --- a/src/qtmultimediaquicktools/qdeclarativevideooutput.cpp +++ b/src/qtmultimediaquicktools/qdeclarativevideooutput.cpp @@ -39,11 +39,12 @@ #include #include #include - -//#define DEBUG_VIDEOITEM +#include QT_BEGIN_NAMESPACE +Q_LOGGING_CATEGORY(qLcVideo, "qt.multimedia.video") + /*! \qmltype VideoOutput \instantiates QDeclarativeVideoOutput @@ -154,9 +155,7 @@ QDeclarativeVideoOutput::~QDeclarativeVideoOutput() void QDeclarativeVideoOutput::setSource(QObject *source) { -#ifdef DEBUG_VIDEOITEM - qDebug() << Q_FUNC_INFO << source; -#endif + qCDebug(qLcVideo) << "source is" << source; if (source == m_source.data()) return; @@ -273,9 +272,7 @@ void QDeclarativeVideoOutput::_q_updateMediaObject() if (m_source) mediaObject = qobject_cast(m_source.data()->property("mediaObject").value()); -#ifdef DEBUG_VIDEOITEM - qDebug() << Q_FUNC_INFO << mediaObject; -#endif + qCDebug(qLcVideo) << "media object is" << mediaObject; if (m_mediaObject.data() == mediaObject) return; diff --git a/src/qtmultimediaquicktools/qdeclarativevideooutput_render.cpp b/src/qtmultimediaquicktools/qdeclarativevideooutput_render.cpp index 608aae5d1..657ef1767 100644 --- a/src/qtmultimediaquicktools/qdeclarativevideooutput_render.cpp +++ b/src/qtmultimediaquicktools/qdeclarativevideooutput_render.cpp @@ -36,6 +36,7 @@ #include "qdeclarativevideooutput_p.h" #include #include +#include #include #include @@ -43,6 +44,8 @@ QT_BEGIN_NAMESPACE +Q_DECLARE_LOGGING_CATEGORY(qLcVideo) + Q_GLOBAL_STATIC_WITH_ARGS(QMediaPluginLoader, videoNodeFactoryLoader, (QSGVideoNodeFactoryInterface_iid, QLatin1String("video/videonode"), Qt::CaseInsensitive)) @@ -66,9 +69,7 @@ QDeclarativeVideoRendererBackend::QDeclarativeVideoRendererBackend(QDeclarativeV m_videoNodeFactories.prepend(plugin); else m_videoNodeFactories.append(plugin); -#ifdef DEBUG_VIDEOITEM - qDebug() << "found videonode plugin" << key << plugin; -#endif + qCDebug(qLcVideo) << "found videonode plugin" << key << plugin; } } @@ -217,17 +218,13 @@ QSGNode *QDeclarativeVideoRendererBackend::updatePaintNode(QSGNode *oldNode, if (m_frameChanged) { if (videoNode && videoNode->pixelFormat() != m_frame.pixelFormat()) { -#ifdef DEBUG_VIDEOITEM - qDebug() << "updatePaintNode: deleting old video node because frame format changed..."; -#endif + qCDebug(qLcVideo) << "updatePaintNode: deleting old video node because frame format changed"; delete videoNode; videoNode = 0; } if (!m_frame.isValid()) { -#ifdef DEBUG_VIDEOITEM - qDebug() << "updatePaintNode: no frames yet... aborting..."; -#endif + qCDebug(qLcVideo) << "updatePaintNode: no frames yet"; m_frameChanged = false; return 0; } @@ -236,9 +233,9 @@ QSGNode *QDeclarativeVideoRendererBackend::updatePaintNode(QSGNode *oldNode, foreach (QSGVideoNodeFactoryInterface* factory, m_videoNodeFactories) { videoNode = factory->createNode(m_surface->surfaceFormat()); if (videoNode) { -#ifdef DEBUG_VIDEOITEM - qDebug() << "using video node from factory" << factory; -#endif + qCDebug(qLcVideo) << "updatePaintNode: Video node created. Handle type:" << m_frame.handleType() + << " Supported formats for the handle by this node:" + << factory->supportedPixelFormats(m_frame.handleType()); break; } } @@ -327,9 +324,7 @@ QList QSGVideoItemSurface::supportedPixelFormats( bool QSGVideoItemSurface::start(const QVideoSurfaceFormat &format) { -#ifdef DEBUG_VIDEOITEM - qDebug() << Q_FUNC_INFO << format << supportedPixelFormats(format.handleType()); -#endif + qCDebug(qLcVideo) << "Video surface format:" << format << "all supported formats:" << supportedPixelFormats(format.handleType()); if (!supportedPixelFormats(format.handleType()).contains(format.pixelFormat())) return false; -- cgit v1.2.3