bool VideoSurface_ForQQuickItem::start(const QVideoSurfaceFormat& format)
{
    if (!supportedPixelFormats(format.handleType()).contains(format.pixelFormat())) {
        qDebug() << format.handleType() << " " << format.pixelFormat() << " - format is not supported.";
        return false;
    }
    return QAbstractVideoSurface::start(format);
}
Ejemplo n.º 2
0
bool QVideoSurfaceRasterPainter::isFormatSupported(
        const QVideoSurfaceFormat &format, QVideoSurfaceFormat *) const
{
    return format.handleType() == QAbstractVideoBuffer::NoHandle
            && m_imagePixelFormats.contains(format.pixelFormat())
            && !format.frameSize().isEmpty();
}
Ejemplo n.º 3
0
bool VideoWidgetSurface::isFormatSupported(const QVideoSurfaceFormat &format, QVideoSurfaceFormat *similar) const
{
    Q_UNUSED(similar);

    const QImage::Format imageFormat = QVideoFrame::imageFormatFromPixelFormat(format.pixelFormat());
    const QSize size = format.frameSize();

    return imageFormat != QImage::Format_Invalid && !size.isEmpty() && format.handleType() == QAbstractVideoBuffer::NoHandle;
}
Ejemplo n.º 4
0
QAbstractVideoSurface::Error QVideoSurfaceRasterPainter::start(const QVideoSurfaceFormat &format)
{
    m_frame = QVideoFrame();
    m_imageFormat = QVideoFrame::imageFormatFromPixelFormat(format.pixelFormat());
    m_imageSize = format.frameSize();
    m_scanLineDirection = format.scanLineDirection();

    return format.handleType() == QAbstractVideoBuffer::NoHandle
            && m_imageFormat != QImage::Format_Invalid
            && !m_imageSize.isEmpty()
            ? QAbstractVideoSurface::NoError
            : QAbstractVideoSurface::UnsupportedFormatError;
}
QDebug operator<<(QDebug dbg, const QVideoSurfaceFormat &f)
{
    dbg.nospace() << "QVideoSurfaceFormat(" << f.pixelFormat();
    dbg.nospace() << ", " << f.frameSize();
    dbg.nospace() << ", viewport=" << f.viewport();
    dbg.nospace() << ", pixelAspectRatio=" << f.pixelAspectRatio();
    dbg.nospace() << ", handleType=" << f.handleType();
    dbg.nospace() << ", yCbCrColorSpace=" << f.yCbCrColorSpace();
    dbg.nospace() << ")";

    foreach(const QByteArray& propertyName, f.propertyNames())
        dbg << "\n    " << propertyName.data() << " = " << f.property(propertyName.data());

    return dbg.space();
}
Ejemplo n.º 6
0
void tst_QVideoSurfaceFormat::constructNull()
{
    QVideoSurfaceFormat format;

    QVERIFY(!format.isValid());
    QCOMPARE(format.handleType(), QAbstractVideoBuffer::NoHandle);
    QCOMPARE(format.pixelFormat(), QVideoFrame::Format_Invalid);
    QCOMPARE(format.frameSize(), QSize());
    QCOMPARE(format.frameWidth(), -1);
    QCOMPARE(format.frameHeight(), -1);
    QCOMPARE(format.viewport(), QRect());
    QCOMPARE(format.scanLineDirection(), QVideoSurfaceFormat::TopToBottom);
    QCOMPARE(format.frameRate(), 0.0);
    QCOMPARE(format.pixelAspectRatio(), QSize(1, 1));
    QCOMPARE(format.yCbCrColorSpace(), QVideoSurfaceFormat::YCbCr_Undefined);
}
Ejemplo n.º 7
0
/*!
    \since 1.2
*/
bool QEglImageTextureSurface::start(const QVideoSurfaceFormat &format)
{
#ifdef DEBUG_OMAPFB_SURFACE
    qDebug() << Q_FUNC_INFO << format;
#endif

    m_fallbackSurfaceActive = false;
    if (format.handleType() != EGLImageTextureHandle) {
        qWarning() << Q_FUNC_INFO << "Non EGLImageTextureHandle based format requested, fallback to QPainterVideoSurface";
        connect(m_fallbackSurface, SIGNAL(activeChanged(bool)),
                this, SIGNAL(activeChanged(bool)));
        connect(m_fallbackSurface, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat)),
                this, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat)));
        connect(m_fallbackSurface, SIGNAL(supportedFormatsChanged()),
                this, SIGNAL(supportedFormatsChanged()));
        connect(m_fallbackSurface, SIGNAL(nativeResolutionChanged(QSize)),
                this, SIGNAL(nativeResolutionChanged(QSize)));
        connect(m_fallbackSurface, SIGNAL(frameChanged()),
                this, SIGNAL(frameChanged()));

        if (m_fallbackSurface->start(format)) {
            m_fallbackSurfaceActive = true;
            QAbstractVideoSurface::start(format);
        } else {
            qWarning() << Q_FUNC_INFO << "failed to start video surface:" << m_fallbackSurface->error();
            setError(m_fallbackSurface->error());

            disconnect(m_fallbackSurface, SIGNAL(activeChanged(bool)),
                       this, SIGNAL(activeChanged(bool)));
            disconnect(m_fallbackSurface, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat)),
                       this, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat)));
            disconnect(m_fallbackSurface, SIGNAL(supportedFormatsChanged()),
                       this, SIGNAL(supportedFormatsChanged()));
            disconnect(m_fallbackSurface, SIGNAL(nativeResolutionChanged(QSize)),
                       this, SIGNAL(nativeResolutionChanged(QSize)));
            disconnect(m_fallbackSurface, SIGNAL(frameChanged()),
                       this, SIGNAL(frameChanged()));
        }

        return m_fallbackSurfaceActive;
    }
Ejemplo n.º 8
0
bool QAbstractVideoSurface::isFormatSupported(const QVideoSurfaceFormat &format) const
{
    return supportedPixelFormats(format.handleType()).contains(format.pixelFormat());
}