summaryrefslogtreecommitdiffstats
path: root/src/plugins/videonode/imx6/qsgvivantevideonodefactory.cpp
blob: ca6550776b7fc40d88b880a1981e3751c0bfeb9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Copyright (C) 2016 Pelagicore AG
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#include "qsgvivantevideonodefactory.h"
#include "qsgvivantevideonode.h"
#include <QtGui/QGuiApplication>

QList<QVideoFrameFormat::PixelFormat> QSGVivanteVideoNodeFactory::supportedPixelFormats(
        QVideoFrame::HandleType handleType) const
{
    const bool isWebGl = QGuiApplication::platformName() == QLatin1String("webgl");
    if (!isWebGl && handleType == QVideoFrame::NoHandle)
        return QSGVivanteVideoNode::getVideoFormat2GLFormatMap().keys();
    else
        return QList<QVideoFrameFormat::PixelFormat>();
}

QSGVideoNode *QSGVivanteVideoNodeFactory::createNode(const QVideoFrameFormat &format)
{
    if (supportedPixelFormats(format.handleType()).contains(format.pixelFormat())) {
        return new QSGVivanteVideoNode(format);
    }
    return 0;
}