mirror of
https://github.com/wang-bin/QtAV.git
synced 2026-10-17 04:31:08 +08:00
77fd525f87
FIXME: 1. if not plugin, qmake must run twice so that QmlAV LFLAG is ok 2. player and other types
28 lines
715 B
C++
28 lines
715 B
C++
#include <QtCore/QFile>
|
|
#include <QtGui/QGuiApplication>
|
|
#include <QmlAV/QQuickItemRenderer.h>
|
|
#include <QtAV/AVPlayer.h>
|
|
|
|
#include "qtquick2applicationviewer.h"
|
|
|
|
using namespace QtAV;
|
|
int main(int argc, char *argv[])
|
|
{
|
|
QGuiApplication app(argc, argv);
|
|
|
|
QtQuick2ApplicationViewer viewer;
|
|
QString qml = "qml/QMLPlayer/main.qml";
|
|
if (!QFile(qml).exists())
|
|
qml.prepend("qrc:///");
|
|
viewer.setMainQmlFile(qml);
|
|
viewer.showExpanded();
|
|
|
|
AVPlayer player;
|
|
QQuickItemRenderer* renderer = viewer.rootObject()->findChild<QQuickItemRenderer*>("quickItemRenderer");
|
|
|
|
player.setRenderer(renderer);
|
|
if (argc > 1)
|
|
player.play(app.arguments().last());
|
|
return app.exec();
|
|
}
|