--- a/src/multimedia/qxvideosurface_maemo5.cpp Fri Sep 17 08:34:34 2010 +0300
+++ b/src/multimedia/qxvideosurface_maemo5.cpp Mon Oct 04 01:37:06 2010 +0300
@@ -46,6 +46,8 @@
#include "qxvideosurface_maemo5_p.h"
+//#define DEBUG_XV_SURFACE
+
struct XvFormatRgb
{
QVideoFrame::PixelFormat pixelFormat;
@@ -162,6 +164,10 @@
if (id == m_winId)
return;
+#ifdef DEBUG_XV_SURFACE
+ qDebug() << "QXVideoSurface::setWinId" << id;
+#endif
+
if (m_image)
XFree(m_image);
@@ -173,6 +179,7 @@
if (m_portId != 0)
XvUngrabPort(QX11Info::display(), m_portId, 0);
+ QList<QVideoFrame::PixelFormat> prevFormats = m_supportedPixelFormats;
m_supportedPixelFormats.clear();
m_formatIds.clear();
@@ -195,7 +202,12 @@
QAbstractVideoSurface::stop();
}
- emit supportedFormatsChanged();
+ if (m_supportedPixelFormats != prevFormats) {
+#ifdef DEBUG_XV_SURFACE
+ qDebug() << "QXVideoSurface: supportedFormatsChanged";
+#endif
+ emit supportedFormatsChanged();
+ }
}
QRect QXVideoSurface::displayRect() const
@@ -258,7 +270,9 @@
bool QXVideoSurface::start(const QVideoSurfaceFormat &format)
{
- //qDebug() << "QXVideoSurface::start" << format;
+#ifdef DEBUG_XV_SURFACE
+ qDebug() << "QXVideoSurface::start" << format;
+#endif
m_lastFrame = QVideoFrame();
@@ -296,7 +310,7 @@
m_shminfo.readOnly = False;
if (!XShmAttach(QX11Info::display(), &m_shminfo)) {
- //qDebug() << "XShmAttach failed";
+ qWarning() << "XShmAttach failed" << format;
return false;
}
@@ -431,7 +445,10 @@
}
}
XvFreeAdaptorInfo(adaptors);
- }
+ }
+
+ if (!portFound)
+ qWarning() << "QXVideoSurface::findPort: failed to find XVideo port";
return portFound;
}
@@ -472,4 +489,9 @@
}
XFree(imageFormats);
}
+
+#ifdef DEBUG_XV_SURFACE
+ qDebug() << "Supported pixel formats:" << m_supportedPixelFormats;
+#endif
+
}