From 2bc3df634ee75d695c5856248c434238861db1f2 Mon Sep 17 00:00:00 2001 From: wang-bin Date: Mon, 8 Dec 2014 16:14:17 +0800 Subject: [PATCH] test: add play from qrc --- tests/qrc/main.cpp | 37 +++++++++++++++++++++++++++++++++++++ tests/qrc/media.qrc | 5 +++++ tests/qrc/qrc.pro | 17 +++++++++++++++++ tests/tests.pro | 1 + 4 files changed, 60 insertions(+) create mode 100644 tests/qrc/main.cpp create mode 100644 tests/qrc/media.qrc create mode 100644 tests/qrc/qrc.pro diff --git a/tests/qrc/main.cpp b/tests/qrc/main.cpp new file mode 100644 index 000000000..484a5daad --- /dev/null +++ b/tests/qrc/main.cpp @@ -0,0 +1,37 @@ +/****************************************************************************** + Simple Player: this file is part of QtAV examples + Copyright (C) 2014 Wang Bin + +* This file is part of QtAV + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +******************************************************************************/ +#include + +#include +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + QtAV::GLWidgetRenderer2 renderer; + renderer.show(); + renderer.setWindowTitle("Play video from qrc--QtAV " + QtAV_Version_String_Long() + " wbsecg1@gmail.com"); + QtAV::AVPlayer player; + player.setRenderer(&renderer); + + player.play("qrc:/test.mp4"); + + return a.exec(); +} diff --git a/tests/qrc/media.qrc b/tests/qrc/media.qrc new file mode 100644 index 000000000..e6f461840 --- /dev/null +++ b/tests/qrc/media.qrc @@ -0,0 +1,5 @@ + + + test.mp4 + + diff --git a/tests/qrc/qrc.pro b/tests/qrc/qrc.pro new file mode 100644 index 000000000..85ccffdcf --- /dev/null +++ b/tests/qrc/qrc.pro @@ -0,0 +1,17 @@ +TEMPLATE = app +QT += opengl +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets +CONFIG -= app_bundle + +STATICLINK = 0 +PROJECTROOT = $$PWD/../.. +include($$PROJECTROOT/src/libQtAV.pri) +preparePaths($$OUT_PWD/../../out) + +SOURCES += main.cpp + +exists(test.mp4) { + RESOURCES += media.qrc +} else { + warning("put test.mp4 in this directory!") +} diff --git a/tests/tests.pro b/tests/tests.pro index 93a29960e..0f112ab5d 100644 --- a/tests/tests.pro +++ b/tests/tests.pro @@ -6,4 +6,5 @@ SUBDIRS += \ extract \ qiodevice \ subtitle \ + qrc \ playerthread