Skip to content

Commit

Permalink
move some internal used macros
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-bin committed Oct 31, 2014
1 parent 0d796ce commit 8c0f490
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 24 deletions.
23 changes: 2 additions & 21 deletions src/QtAV/QtAV_Global.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,41 +73,22 @@ Q_AV_EXPORT void setFFmpegLogHandler(void(*)(void *, int, const char *, va_list)

} //namespace QtAV

// TODO: internal use. move to a private header
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
#define QStringLiteral(X) QString::fromUtf8(X)
#endif //QT_VERSION
/*
* msvc sucks! can not deal with (defined QTAV_HAVE_##FEATURE && QTAV_HAVE_##FEATURE)
*/
// TODO: internal use. move to a private header
#define QTAV_HAVE(FEATURE) (defined QTAV_HAVE_##FEATURE && QTAV_HAVE_##FEATURE)

//TODO: always inline
/* --gnu option of the RVCT compiler also defines __GNUC__ */
#if defined(Q_CC_GNU) && !defined(Q_CC_RVCT)
#define GCC_VERSION_AT_LEAST(major, minor, patch) \
(__GNUC__ > major || (__GNUC__ == major && (__GNUC_MINOR__ > minor \
|| (__GNUC_MINOR__ == minor && __GNUC_PATCHLEVEL__ >= patch))))
#else
/* Define this for !GCC compilers, just so we can write things like GCC_VERSION_AT_LEAST(4, 1, 0). */
#define GCC_VERSION_AT_LEAST(major, minor, patch) 0
#endif

#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) || defined(QT_WIDGETS_LIB)
#ifndef QTAV_HAVE_WIDGETS
#define QTAV_HAVE_WIDGETS 1
#endif //QTAV_HAVE_WIDGETS
#endif

#ifndef Q_DECL_OVERRIDE
#define Q_DECL_OVERRIDE
#endif
#ifndef Q_DECL_FINAL
#define Q_DECL_FINAL
#endif

#ifndef Q_FUNC_INFO
#define Q_FUNC_INFO __FUNCTION__
#endif

#endif // QTAV_GLOBAL_H

12 changes: 12 additions & 0 deletions src/QtAV/private/AVCompat.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,18 @@ extern "C"

void ffmpeg_version_print();


//TODO: always inline
/* --gnu option of the RVCT compiler also defines __GNUC__ */
#if defined(Q_CC_GNU) && !defined(Q_CC_RVCT)
#define GCC_VERSION_AT_LEAST(major, minor, patch) \
(__GNUC__ > major || (__GNUC__ == major && (__GNUC_MINOR__ > minor \
|| (__GNUC_MINOR__ == minor && __GNUC_PATCHLEVEL__ >= patch))))
#else
/* Define this for !GCC compilers, just so we can write things like GCC_VERSION_AT_LEAST(4, 1, 0). */
#define GCC_VERSION_AT_LEAST(major, minor, patch) 0
#endif

/*TODO: libav
avutil: error.h
*/
Expand Down
2 changes: 0 additions & 2 deletions src/QtAV/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@

/* the following are compile time version */
/* C++11 requires a space between literal and identifier */
static const char* const qtav_version_string = TOSTR(QTAV_MAJOR) "." TOSTR(QTAV_MINOR) "." TOSTR(QTAV_PATCH) "(" __DATE__ ", " __TIME__ ")";
#define QTAV_VERSION_STR TOSTR(QTAV_MAJOR) "." TOSTR(QTAV_MINOR) "." TOSTR(QTAV_PATCH)
#define QTAV_VERSION_STR_LONG QTAV_VERSION_STR "(" __DATE__ ", " __TIME__ ")"

#endif // QTAV_VERSION_H
11 changes: 10 additions & 1 deletion src/QtAV_Global.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@
******************************************************************************/

#include "QtAV/QtAV_Global.h"
// TODO: move to an internal header
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) || defined(QT_WIDGETS_LIB)
#ifndef QTAV_HAVE_WIDGETS
#define QTAV_HAVE_WIDGETS 1
#endif //QTAV_HAVE_WIDGETS
#endif

#include <QtCore/QObject>
#include <QtCore/QRegExp>
#if QTAV_HAVE(WIDGETS)
Expand All @@ -43,6 +50,8 @@ QString QtAV_Version_String()
return QTAV_VERSION_STR;
}

#define QTAV_VERSION_STR_LONG QTAV_VERSION_STR "(" __DATE__ ", " __TIME__ ")"

QString QtAV_Version_String_Long()
{
return QTAV_VERSION_STR_LONG;
Expand Down Expand Up @@ -178,7 +187,7 @@ QString aboutQtAV_HTML()
"<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-2014 Wang Bin (aka. Lucas Wang) <a href='mailto:[email protected]'>[email protected]</a></p>\n"
"<p>" + QObject::tr("Shanghai University->S3 Graphics, Shanghai, China") + "</p>\n"
"<p>" + QObject::tr("Shanghai University->S3 Graphics->Deepin, Shanghai, China") + "</p>\n"
"<p>" + QObject::tr("Donate") + ": <a href='http://wang-bin.github.io/QtAV#donate'>http://wang-bin.github.io/QtAV#donate</a></p>\n"
"<p>" + QObject::tr("Source") + ": <a href='https://github.com/wang-bin/QtAV'>https://github.com/wang-bin/QtAV</a></p>\n"
"<p>" + QObject::tr("Web Site") + ": <a href='http://wang-bin.github.io/QtAV'>http://wang-bin.github.io/QtAV</a></p>";
Expand Down
8 changes: 8 additions & 0 deletions src/output/video/VideoRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@
#include <QtAV/private/VideoRenderer_p.h>
#include <QtAV/Filter.h>
#include <QtCore/QCoreApplication>

// TODO: move to an internal header
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) || defined(QT_WIDGETS_LIB)
#ifndef QTAV_HAVE_WIDGETS
#define QTAV_HAVE_WIDGETS 1
#endif //QTAV_HAVE_WIDGETS
#endif

#if QTAV_HAVE(WIDGETS)
#include <QWidget>
#include <QGraphicsItem>
Expand Down
8 changes: 8 additions & 0 deletions src/output/video/VideoRendererTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@
#include <cstdio>
#include <cstdlib>
#include "QtAV/prepost.h"

// TODO: move to an internal header
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) || defined(QT_WIDGETS_LIB)
#ifndef QTAV_HAVE_WIDGETS
#define QTAV_HAVE_WIDGETS 1
#endif //QTAV_HAVE_WIDGETS
#endif

#if QTAV_HAVE(WIDGETS)
#include "QtAV/WidgetRenderer.h"
#include "QtAV/GraphicsItemRenderer.h"
Expand Down
5 changes: 5 additions & 0 deletions src/utils/Logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@
#ifndef Q_NORETURN
#define Q_NORETURN
#endif

#ifndef Q_FUNC_INFO
#define Q_FUNC_INFO __FUNCTION__
#endif

namespace QtAV {
namespace Internal {

Expand Down

0 comments on commit 8c0f490

Please sign in to comment.