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 <andy.nichols@theqtcompany.com>
This commit is contained in:
Laszlo Agocs
2014-12-19 14:38:18 +01:00
committed by Laszlo Agocs
parent 03593d86b8
commit bf8f6c88c9
2 changed files with 15 additions and 23 deletions

View File

@@ -39,11 +39,12 @@
#include <QtMultimedia/qmediaobject.h> #include <QtMultimedia/qmediaobject.h>
#include <QtMultimedia/qmediaservice.h> #include <QtMultimedia/qmediaservice.h>
#include <private/qmediapluginloader_p.h> #include <private/qmediapluginloader_p.h>
#include <QtCore/qloggingcategory.h>
//#define DEBUG_VIDEOITEM
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
Q_LOGGING_CATEGORY(qLcVideo, "qt.multimedia.video")
/*! /*!
\qmltype VideoOutput \qmltype VideoOutput
\instantiates QDeclarativeVideoOutput \instantiates QDeclarativeVideoOutput
@@ -154,9 +155,7 @@ QDeclarativeVideoOutput::~QDeclarativeVideoOutput()
void QDeclarativeVideoOutput::setSource(QObject *source) void QDeclarativeVideoOutput::setSource(QObject *source)
{ {
#ifdef DEBUG_VIDEOITEM qCDebug(qLcVideo) << "source is" << source;
qDebug() << Q_FUNC_INFO << source;
#endif
if (source == m_source.data()) if (source == m_source.data())
return; return;
@@ -273,9 +272,7 @@ void QDeclarativeVideoOutput::_q_updateMediaObject()
if (m_source) if (m_source)
mediaObject = qobject_cast<QMediaObject*>(m_source.data()->property("mediaObject").value<QObject*>()); mediaObject = qobject_cast<QMediaObject*>(m_source.data()->property("mediaObject").value<QObject*>());
#ifdef DEBUG_VIDEOITEM qCDebug(qLcVideo) << "media object is" << mediaObject;
qDebug() << Q_FUNC_INFO << mediaObject;
#endif
if (m_mediaObject.data() == mediaObject) if (m_mediaObject.data() == mediaObject)
return; return;

View File

@@ -36,6 +36,7 @@
#include "qdeclarativevideooutput_p.h" #include "qdeclarativevideooutput_p.h"
#include <QtMultimedia/qvideorenderercontrol.h> #include <QtMultimedia/qvideorenderercontrol.h>
#include <QtMultimedia/qmediaservice.h> #include <QtMultimedia/qmediaservice.h>
#include <QtCore/qloggingcategory.h>
#include <private/qmediapluginloader_p.h> #include <private/qmediapluginloader_p.h>
#include <private/qsgvideonode_p.h> #include <private/qsgvideonode_p.h>
@@ -43,6 +44,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
Q_DECLARE_LOGGING_CATEGORY(qLcVideo)
Q_GLOBAL_STATIC_WITH_ARGS(QMediaPluginLoader, videoNodeFactoryLoader, Q_GLOBAL_STATIC_WITH_ARGS(QMediaPluginLoader, videoNodeFactoryLoader,
(QSGVideoNodeFactoryInterface_iid, QLatin1String("video/videonode"), Qt::CaseInsensitive)) (QSGVideoNodeFactoryInterface_iid, QLatin1String("video/videonode"), Qt::CaseInsensitive))
@@ -66,9 +69,7 @@ QDeclarativeVideoRendererBackend::QDeclarativeVideoRendererBackend(QDeclarativeV
m_videoNodeFactories.prepend(plugin); m_videoNodeFactories.prepend(plugin);
else else
m_videoNodeFactories.append(plugin); m_videoNodeFactories.append(plugin);
#ifdef DEBUG_VIDEOITEM qCDebug(qLcVideo) << "found videonode plugin" << key << plugin;
qDebug() << "found videonode plugin" << key << plugin;
#endif
} }
} }
@@ -217,17 +218,13 @@ QSGNode *QDeclarativeVideoRendererBackend::updatePaintNode(QSGNode *oldNode,
if (m_frameChanged) { if (m_frameChanged) {
if (videoNode && videoNode->pixelFormat() != m_frame.pixelFormat()) { if (videoNode && videoNode->pixelFormat() != m_frame.pixelFormat()) {
#ifdef DEBUG_VIDEOITEM qCDebug(qLcVideo) << "updatePaintNode: deleting old video node because frame format changed";
qDebug() << "updatePaintNode: deleting old video node because frame format changed...";
#endif
delete videoNode; delete videoNode;
videoNode = 0; videoNode = 0;
} }
if (!m_frame.isValid()) { if (!m_frame.isValid()) {
#ifdef DEBUG_VIDEOITEM qCDebug(qLcVideo) << "updatePaintNode: no frames yet";
qDebug() << "updatePaintNode: no frames yet... aborting...";
#endif
m_frameChanged = false; m_frameChanged = false;
return 0; return 0;
} }
@@ -236,9 +233,9 @@ QSGNode *QDeclarativeVideoRendererBackend::updatePaintNode(QSGNode *oldNode,
foreach (QSGVideoNodeFactoryInterface* factory, m_videoNodeFactories) { foreach (QSGVideoNodeFactoryInterface* factory, m_videoNodeFactories) {
videoNode = factory->createNode(m_surface->surfaceFormat()); videoNode = factory->createNode(m_surface->surfaceFormat());
if (videoNode) { if (videoNode) {
#ifdef DEBUG_VIDEOITEM qCDebug(qLcVideo) << "updatePaintNode: Video node created. Handle type:" << m_frame.handleType()
qDebug() << "using video node from factory" << factory; << " Supported formats for the handle by this node:"
#endif << factory->supportedPixelFormats(m_frame.handleType());
break; break;
} }
} }
@@ -327,9 +324,7 @@ QList<QVideoFrame::PixelFormat> QSGVideoItemSurface::supportedPixelFormats(
bool QSGVideoItemSurface::start(const QVideoSurfaceFormat &format) bool QSGVideoItemSurface::start(const QVideoSurfaceFormat &format)
{ {
#ifdef DEBUG_VIDEOITEM qCDebug(qLcVideo) << "Video surface format:" << format << "all supported formats:" << supportedPixelFormats(format.handleType());
qDebug() << Q_FUNC_INFO << format << supportedPixelFormats(format.handleType());
#endif
if (!supportedPixelFormats(format.handleType()).contains(format.pixelFormat())) if (!supportedPixelFormats(format.handleType()).contains(format.pixelFormat()))
return false; return false;