Skip to content

Commit

Permalink
test: add play from qrc
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-bin committed Dec 8, 2014
1 parent ea1551e commit 2bc3df6
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 0 deletions.
37 changes: 37 additions & 0 deletions tests/qrc/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/******************************************************************************
Simple Player: this file is part of QtAV examples
Copyright (C) 2014 Wang Bin <[email protected]>
* 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 <http://www.gnu.org/licenses/>.
******************************************************************************/
#include <QApplication>

#include <QtAV/AVPlayer.h>
#include <QtAV/GLWidgetRenderer2.h>

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() + " [email protected]");
QtAV::AVPlayer player;
player.setRenderer(&renderer);

player.play("qrc:/test.mp4");

return a.exec();
}
5 changes: 5 additions & 0 deletions tests/qrc/media.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/">
<file>test.mp4</file>
</qresource>
</RCC>
17 changes: 17 additions & 0 deletions tests/qrc/qrc.pro
Original file line number Diff line number Diff line change
@@ -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!")
}
1 change: 1 addition & 0 deletions tests/tests.pro
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ SUBDIRS += \
extract \
qiodevice \
subtitle \
qrc \
playerthread

0 comments on commit 2bc3df6

Please sign in to comment.