forked from wang-bin/QtAV
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQtAV_Global.cpp
126 lines (107 loc) · 4.17 KB
/
QtAV_Global.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/******************************************************************************
QtAV: Media play library based on Qt and FFmpeg
Copyright (C) 2012-2013 Wang Bin <[email protected]>
* This file is part of QtAV
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
******************************************************************************/
#include <QtAV/QtAV_Global.h>
#include <QtCore/QObject>
#include <QtCore/QRegExp>
#include <QMessageBox>
#include "QtAV/version.h"
#include "QtAV/QtAV_Compat.h"
unsigned QtAV_Version()
{
return QTAV_VERSION;
}
QString QtAV_Version_String()
{
return QTAV_VERSION_STR;
}
QString QtAV_Version_String_Long()
{
return QTAV_VERSION_STR_LONG;
}
namespace QtAV {
void about()
{
}
void aboutFFmpeg()
{
QMessageBox::about(0, QObject::tr("About FFmpeg"), aboutFFmpeg_HTML());
}
QString aboutFFmpeg_PlainText()
{
return aboutFFmpeg_HTML().remove(QRegExp("<[^>]*>"));
}
QString aboutFFmpeg_HTML()
{
QString text = "<h3>FFmpeg/Libav</h3>\n";
struct ff_component {
const char* lib;
unsigned build_version;
unsigned rt_version;
const char *config;
const char *license;
} components[] = {
#define FF_COMPONENT(name, NAME) #name, LIB##NAME##_VERSION_INT, name##_version(), name##_configuration(), name##_license()
{ FF_COMPONENT(avcodec, AVCODEC) },
{ FF_COMPONENT(avformat, AVFORMAT) },
{ FF_COMPONENT(avutil, AVUTIL) },
{ FF_COMPONENT(swscale, SWSCALE) },
#undef FF_COMPONENT
{ 0, 0, 0, 0, 0 }
};
for (int i = 0; components[i].lib != 0; ++i) {
text += "<h4>" + QObject::tr("Build version")
+ QString(": lib%1-%2.%3.%4</h4>\n")
.arg(components[i].lib)
.arg(QTAV_VERSION_MAJOR(components[i].build_version))
.arg(QTAV_VERSION_MINOR(components[i].build_version))
.arg(QTAV_VERSION_PATCH(components[i].build_version))
;
unsigned rt_version = components[i].rt_version;
if (components[i].build_version != rt_version) {
text += "<h4 style='color:#ff0000;'>" + QString(QObject::tr("Runtime version"))
+ QString(": %1.%2.%3</h4>\n")
.arg(QTAV_VERSION_MAJOR(rt_version))
.arg(QTAV_VERSION_MINOR(rt_version))
.arg(QTAV_VERSION_PATCH(rt_version))
;
}
text += "<p>" + QString(components[i].config) + "</p>\n"
"<p>" + QString(components[i].license) + "</p>\n";
}
return text;
}
void aboutQtAV()
{
QMessageBox::about(0, QObject::tr("About QtAV"), aboutQtAV_HTML());
}
QString aboutQtAV_PlainText()
{
return aboutQtAV_HTML().remove(QRegExp("<[^>]*>"));
}
QString aboutQtAV_HTML()
{
static QString about = "<h3>QtAV " QTAV_VERSION_STR_LONG "</h3>\n"
"<p>" + QObject::tr("A media playing library base on Qt and FFmpeg.\n") + "</p>"
"<p>" + QObject::tr("Distributed under the terms of LGPLv2.1 or later.\n") + "</p>"
"<p>Copyright (C) 2012-2013 Wang Bin (aka. Lucas Wang) <a href='mailto:[email protected]'>[email protected]</a></p>\n"
"<p>" + QObject::tr("Shanghai University, Shanghai, China\n") + "</p>"
"<br>"
"<p><a href='https://github.com/wang-bin/QtAV'>https://github.com/wang-bin/QtAV</a></p>\n"
"<p><a href='https://sourceforge.net/projects/qtav'>https://sourceforge.net/projects/qtav</a></p>";
return about;
}
}