diff --git a/QtAV.pro b/QtAV.pro index 8da5e56d3..a463edd0b 100644 --- a/QtAV.pro +++ b/QtAV.pro @@ -10,7 +10,7 @@ libqtav.file = src/libQtAV.pro libqtavwidgets.depends = libqtav examples.depends += libqtavwidgets #TODO: enable widgets based examples } -greaterThan(QT_MAJOR_VERSION, 4) { +isEqual(QT_MAJOR_VERSION, 5) { # qtHaveModule does not exist in Qt5.0 isEqual(QT_MINOR_VERSION, 0)|qtHaveModule(quick) { SUBDIRS += libqmlav diff --git a/examples/common/Config.cpp b/examples/common/Config.cpp index 12509d54e..8da4ecb03 100644 --- a/examples/common/Config.cpp +++ b/examples/common/Config.cpp @@ -1,6 +1,6 @@ /****************************************************************************** QtAV Player Demo: this file is part of QtAV examples - Copyright (C) 2012-2017 Wang Bin + Copyright (C) 2012-2022 Wang Bin * This file is part of QtAV (from 2014) @@ -305,7 +305,11 @@ void Config::reload() settings.beginGroup(QString::fromLatin1("decoder")); settings.beginGroup(QString::fromLatin1("video")); QString decs_default(QString::fromLatin1("HW FFmpeg")); // HW is ignored +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + setDecoderPriorityNames(settings.value(QString::fromLatin1("priority"), decs_default).toString().split(QString::fromLatin1(" "), Qt::SkipEmptyParts)); +#else setDecoderPriorityNames(settings.value(QString::fromLatin1("priority"), decs_default).toString().split(QString::fromLatin1(" "), QString::SkipEmptyParts)); +#endif setZeroCopy(settings.value(QString::fromLatin1("zeroCopy"), true).toBool()); settings.endGroup(); //video settings.endGroup(); //decoder diff --git a/examples/common/qoptions.cpp b/examples/common/qoptions.cpp index 213956c5c..e3c6e60c6 100644 --- a/examples/common/qoptions.cpp +++ b/examples/common/qoptions.cpp @@ -1,6 +1,6 @@ /****************************************************************************** QOptions: make command line options easy. https://github.com/wang-bin/qoptions - Copyright (C) 2011-2015 Wang Bin + Copyright (C) 2011-2022 Wang Bin 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 @@ -241,7 +241,7 @@ bool QOptions::parse(int argc, const char *const*argv) QString sname = it_list->shortName(); int sname_len = sname.length(); //usally is 1 //TODO: startsWith(-height,-h) Not endsWith, -oabco - if (it->midRef(1).compare(sname) == 0) { + if (it->mid(1).compare(sname) == 0) { if (it_list->type() == QOption::NoToken) { it_list->setValue(true); it = args.erase(it); diff --git a/examples/filters/SimpleFilter.cpp b/examples/filters/SimpleFilter.cpp index ef96c4ddd..210490f6b 100644 --- a/examples/filters/SimpleFilter.cpp +++ b/examples/filters/SimpleFilter.cpp @@ -1,6 +1,6 @@ /****************************************************************************** QtAV: Multimedia framework based on Qt and FFmpeg - Copyright (C) 2012-2016 Wang Bin + Copyright (C) 2012-2022 Wang Bin * This file is part of QtAV (from 2013) @@ -22,7 +22,7 @@ #include "SimpleFilter.h" #include #include - +#include namespace QtAV { SimpleFilter::SimpleFilter(QObject *parent): @@ -124,10 +124,10 @@ void SimpleFilter::process(Statistics *statistics, VideoFrame *frame) int i16 = (t+i) & 15; ctx->pen.setColor(QColor::fromHsv((15-i16)*16, 255, 255)); if (mCanRot) - ctx->drawPlainText(QPointF(x-fm.width(mText)/2-ctx->rect.x(), y-sin_tbl[i16]*h/400), mText.mid(i, 1)); + ctx->drawPlainText(QPointF(x-fm.boundingRect(mText).width()/2-ctx->rect.x(), y-sin_tbl[i16]*h/400), mText.mid(i, 1)); else ctx->drawPlainText(QPointF(x, y-sin_tbl[i16]*h/400), mText.mid(i, 1)); - x += fm.width(mText[i]); + x += fm.boundingRect(mText[i]).width(); } } else { qreal c = fabs(sin((float)t)); @@ -142,7 +142,7 @@ void SimpleFilter::process(Statistics *statistics, VideoFrame *frame) return; if (mCanRot) { QFontMetrics fm(ctx->font); - ctx->drawPlainText(QRectF(-fm.width(mText)/2, ctx->rect.y(), ctx->rect.width(), ctx->rect.height()), Qt::TextWordWrap, mText); + ctx->drawPlainText(QRectF(-fm.boundingRect(mText).width()/2, ctx->rect.y(), ctx->rect.width(), ctx->rect.height()), Qt::TextWordWrap, mText); } else { ctx->drawPlainText(ctx->rect, Qt::TextWordWrap, mText); } diff --git a/examples/filters/SimpleFilter.h b/examples/filters/SimpleFilter.h index 0db3031dd..02e33a74f 100644 --- a/examples/filters/SimpleFilter.h +++ b/examples/filters/SimpleFilter.h @@ -23,7 +23,7 @@ #define QTAV_EXAMPLE_SIMPLEFILTER_H #include -#include +#include #include namespace QtAV { @@ -52,7 +52,7 @@ class SimpleFilter : public VideoFilter private: bool mCanRot; bool mWave; - QTime mTime; + QElapsedTimer mTime; qreal mStartValue; QString mText; QMatrix4x4 mMat; diff --git a/examples/player/TVView.cpp b/examples/player/TVView.cpp index 811e5ed6c..f207d23dc 100644 --- a/examples/player/TVView.cpp +++ b/examples/player/TVView.cpp @@ -1,6 +1,6 @@ /****************************************************************************** QtAV Player Demo: this file is part of QtAV examples - Copyright (C) 2012-2014 Wang Bin + Copyright (C) 2012-2022 Wang Bin * This file is part of QtAV @@ -60,7 +60,9 @@ void TVView::load() if (!tv_file.open(QIODevice::ReadOnly)) return; QTextStream ts(&tv_file); +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) ts.setCodec("UTF-8"); +#endif QTreeWidgetItem *nodeItem = new QTreeWidgetItem(mpView); nodeItem->setData(0, Qt::DisplayRole, QString()); mpView->addTopLevelItem(nodeItem); diff --git a/examples/player/main.cpp b/examples/player/main.cpp index 73187f569..7c5b90a95 100644 --- a/examples/player/main.cpp +++ b/examples/player/main.cpp @@ -1,6 +1,6 @@ /****************************************************************************** QtAV Player Demo: this file is part of QtAV examples - Copyright (C) 2012-2015 Wang Bin + Copyright (C) 2012-2022 Wang Bin * This file is part of QtAV @@ -144,15 +144,33 @@ int main(int argc, char *argv[]) QString aos(op.value().toString()); QStringList ao; if (aos.contains(QString::fromLatin1(";"))) - ao = aos.split(QString::fromLatin1(";"), QString::SkipEmptyParts); + ao = aos.split(QString::fromLatin1(";"), +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + Qt::SkipEmptyParts +#else + QString::SkipEmptyParts +#endif + ); else - ao = aos.split(QString::fromLatin1(","), QString::SkipEmptyParts); + ao = aos.split(QString::fromLatin1(","), +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + Qt::SkipEmptyParts +#else + QString::SkipEmptyParts +#endif + ); window.setAudioBackends(ao); } op = options.option(QString::fromLatin1("vd")); if (op.isSet()) { - QStringList vd = op.value().toString().split(QString::fromLatin1(";"), QString::SkipEmptyParts); + QStringList vd = op.value().toString().split(QString::fromLatin1(";"), +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + Qt::SkipEmptyParts +#else + QString::SkipEmptyParts +#endif + ); if (!vd.isEmpty()) window.setVideoDecoderNames(vd); } diff --git a/examples/player/player.pro b/examples/player/player.pro index 61a1ed7d2..5bc7af68d 100644 --- a/examples/player/player.pro +++ b/examples/player/player.pro @@ -1,6 +1,7 @@ TARGET = Player TEMPLATE = app contains(QT_CONFIG, opengl): QT += opengl +greaterThan(QT_MAJOR_VERSION, 5): QT += opengl QT += sql svg greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TRANSLATIONS = res/player_zh_CN.ts res/player.ts diff --git a/examples/videographicsitem/videoplayer.cpp b/examples/videographicsitem/videoplayer.cpp index f41745ba6..ce705496c 100644 --- a/examples/videographicsitem/videoplayer.cpp +++ b/examples/videographicsitem/videoplayer.cpp @@ -1,6 +1,6 @@ /****************************************************************************** this file is part of QtAV examples - Copyright (C) 2012-2015 Wang Bin + Copyright (C) 2012-2022 Wang Bin * This file is part of QtAV @@ -21,7 +21,7 @@ #include "videoplayer.h" #include -#ifndef QT_NO_OPENGL +#if !defined(QT_NO_OPENGL) && QT_VERSION < QT_VERSION_CHECK(6,0,0) #include #endif diff --git a/examples/videogroup/videogroup.cpp b/examples/videogroup/videogroup.cpp index 6abf86a8a..2bc16ee14 100644 --- a/examples/videogroup/videogroup.cpp +++ b/examples/videogroup/videogroup.cpp @@ -1,6 +1,6 @@ /****************************************************************************** VideoGroup: this file is part of QtAV examples - Copyright (C) 2012-2015 Wang Bin + Copyright (C) 2012-2022 Wang Bin * This file is part of QtAV @@ -20,14 +20,17 @@ #include "videogroup.h" #include -#include #include #include #include #include #include #include - +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) +#define DESKTOP_RECT() qApp->desktop()->rect() +#else +#define DESKTOP_RECT() qApp->primaryScreen()->availableGeometry() +#endif using namespace QtAV; VideoGroup::VideoGroup(QObject *parent) : @@ -114,7 +117,7 @@ void VideoGroup::setSingleWindow(bool s) if (view) return; view = new QWidget; - view->resize(qApp->desktop()->size()); + view->resize(DESKTOP_RECT().size()); QGridLayout *layout = new QGridLayout; layout->setSizeConstraint(QLayout::SetMaximumSize); layout->setSpacing(1); @@ -227,14 +230,14 @@ void VideoGroup::addRenderer() wf |= Qt::FramelessWindowHint; } renderer->widget()->setWindowFlags(wf); - int w = view ? view->frameGeometry().width()/c : qApp->desktop()->width()/c; - int h = view ? view->frameGeometry().height()/r : qApp->desktop()->height()/r; + int w = view ? view->frameGeometry().width()/c : DESKTOP_RECT().width()/c; + int h = view ? view->frameGeometry().height()/r : DESKTOP_RECT().height()/r; renderer->widget()->resize(w, h); mpPlayer->addVideoRenderer(renderer); int i = (mRenderers.size()-1)/cols(); int j = (mRenderers.size()-1)%cols(); if (view) { - view->resize(qApp->desktop()->size()); + view->resize(DESKTOP_RECT().size()); ((QGridLayout*)view->layout())->addWidget(renderer->widget(), i, j); view->show(); } else { @@ -268,8 +271,8 @@ void VideoGroup::updateROI() } return; } - int W = view ? view->frameGeometry().width() : qApp->desktop()->width(); - int H = view ? view->frameGeometry().height() : qApp->desktop()->height(); + int W = view ? view->frameGeometry().width() : DESKTOP_RECT().width(); + int H = view ? view->frameGeometry().height() : DESKTOP_RECT().height(); int w = W / c; int h = H / r; for (int i = 0; i < mRenderers.size(); ++i) { diff --git a/examples/window/window.pro b/examples/window/window.pro index e148cf681..2a080b803 100644 --- a/examples/window/window.pro +++ b/examples/window/window.pro @@ -1,6 +1,7 @@ TEMPLATE = app CONFIG -= app_bundle QT = core gui +greaterThan(QT_MAJOR_VERSION, 5): QT += opengl PROJECTROOT = $$PWD/../.. include($$PROJECTROOT/src/libQtAV.pri) preparePaths($$OUT_PWD/../../out) diff --git a/qml/MediaMetaData.cpp b/qml/MediaMetaData.cpp index 4e87b6fae..abde2af86 100644 --- a/qml/MediaMetaData.cpp +++ b/qml/MediaMetaData.cpp @@ -1,6 +1,6 @@ /****************************************************************************** QtAV: Multimedia framework based on Qt and FFmpeg - Copyright (C) 2012-2016 Wang Bin + Copyright (C) 2012-2022 Wang Bin * This file is part of QtAV (from 2014) @@ -76,8 +76,8 @@ void MediaMetaData::setValuesFromStatistics(const QtAV::Statistics &st) setValue(TrackNumber, it.value().toInt()); continue; } - setValue(TrackNumber, it.value().leftRef(slash).string()->toInt()); //QStringRef.toInt(): Qt5.2 - setValue(TrackCount, it.value().midRef(slash+1).string()->toInt()); + setValue(TrackNumber, it.value().left(slash).string()->toInt()); //QStringRef.toInt(): Qt5.2 + setValue(TrackCount, it.value().mid(slash+1).string()->toInt()); continue; } if (keyName == QLatin1String("date") diff --git a/qml/QQuickItemRenderer.cpp b/qml/QQuickItemRenderer.cpp index c6f129d51..27a554ed7 100644 --- a/qml/QQuickItemRenderer.cpp +++ b/qml/QQuickItemRenderer.cpp @@ -1,6 +1,6 @@ /****************************************************************************** QtAV: Multimedia framework based on Qt and FFmpeg - Copyright (C) 2012-2017 Wang Bin + Copyright (C) 2012-2022 Wang Bin theoribeiro * This file is part of QtAV (from 2013) @@ -112,9 +112,17 @@ bool QQuickItemRenderer::event(QEvent *e) return true; } +#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) +void QQuickItemRenderer::geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) +#else void QQuickItemRenderer::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) +#endif { - QQuickItem::geometryChanged(newGeometry, oldGeometry); //geometry will be updated +#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) + QQuickItem::geometryChange(newGeometry, oldGeometry); +#else + QQuickItem::geometryChanged(newGeometry, oldGeometry); +#endif DPTR_D(QQuickItemRenderer); resizeRenderer(newGeometry.size().toSize()); if (d.fill_mode == PreserveAspectCrop) { diff --git a/qml/QuickFBORenderer.cpp b/qml/QuickFBORenderer.cpp index b8bbe94f4..02177ebb1 100644 --- a/qml/QuickFBORenderer.cpp +++ b/qml/QuickFBORenderer.cpp @@ -1,6 +1,6 @@ /****************************************************************************** QtAV: Multimedia framework based on Qt and FFmpeg - Copyright (C) 2012-2017 Wang Bin + Copyright (C) 2012-2022 Wang Bin * This file is part of QtAV (from 2015) @@ -27,13 +27,13 @@ #include "QtAV/private/mkid.h" #include "QtAV/private/factory.h" #include -#include -#include +#include +#include #include // for dynamicgl. qglfunctions before qt5.3 does not have portable gl functions // use qt gl func if possible to avoid linking to opengl directly #if QT_VERSION >= QT_VERSION_CHECK(5, 3, 0) -#include +#include #define DYGL(glFunc) QOpenGLContext::currentContext()->functions()->glFunc #else #define DYGL(glFunc) glFunc diff --git a/qml/SGVideoNode.cpp b/qml/SGVideoNode.cpp index 3f2a07d72..b503d3c1f 100644 --- a/qml/SGVideoNode.cpp +++ b/qml/SGVideoNode.cpp @@ -1,6 +1,6 @@ /****************************************************************************** QtAV: Multimedia framework based on Qt and FFmpeg - Copyright (C) 2012-2016 Wang Bin + Copyright (C) 2012-2022 Wang Bin * This file is part of QtAV (from 2014) @@ -24,7 +24,7 @@ #include "QtAV/VideoShader.h" #include "QtAV/VideoFrame.h" #include -#include +#include #include #include diff --git a/src/AVDemuxer.cpp b/src/AVDemuxer.cpp index 432c4f04f..e81ef79fa 100644 --- a/src/AVDemuxer.cpp +++ b/src/AVDemuxer.cpp @@ -1,6 +1,6 @@ /****************************************************************************** QtAV: Multimedia framework based on Qt and FFmpeg - Copyright (C) 2012-2018 Wang Bin + Copyright (C) 2012-2022 Wang Bin * This file is part of QtAV @@ -23,6 +23,7 @@ #include "QtAV/private/AVCompat.h" #include #include +#include #if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0) #include #else @@ -366,10 +367,18 @@ static void getFFmpegInputFormats(QStringList* formats, QStringList* extensions) av_register_all(); // MUST register all input/output formats while ((i = av_iformat_next(i))) { #endif + +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + if (i->extensions) + e << QString::fromLatin1(i->extensions).split(QLatin1Char(','), Qt::SkipEmptyParts); + if (i->name) + f << QString::fromLatin1(i->name).split(QLatin1Char(','), Qt::SkipEmptyParts); +#else if (i->extensions) e << QString::fromLatin1(i->extensions).split(QLatin1Char(','), QString::SkipEmptyParts); if (i->name) f << QString::fromLatin1(i->name).split(QLatin1Char(','), QString::SkipEmptyParts); +#endif } foreach (const QString& v, e) { exts.append(v.trimmed()); diff --git a/src/AVMuxer.cpp b/src/AVMuxer.cpp index b601afd8b..8ee692cc0 100644 --- a/src/AVMuxer.cpp +++ b/src/AVMuxer.cpp @@ -1,6 +1,6 @@ /****************************************************************************** QtAV: Multimedia framework based on Qt and FFmpeg - Copyright (C) 2012-2018 Wang Bin + Copyright (C) 2012-2022 Wang Bin * This file is part of QtAV (from 2015) @@ -198,10 +198,17 @@ static void getFFmpegOutputFormats(QStringList* formats, QStringList* extensions AVOutputFormat *o = NULL; while ((o = av_oformat_next(o))) { #endif +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + if (o->extensions) + e << QString::fromLatin1(o->extensions).split(QLatin1Char(','), Qt::SkipEmptyParts); + if (o->name) + f << QString::fromLatin1(o->name).split(QLatin1Char(','), Qt::SkipEmptyParts); +#else if (o->extensions) e << QString::fromLatin1(o->extensions).split(QLatin1Char(','), QString::SkipEmptyParts); if (o->name) f << QString::fromLatin1(o->name).split(QLatin1Char(','), QString::SkipEmptyParts); +#endif } foreach (const QString& v, e) { exts.append(v.trimmed()); @@ -528,15 +535,15 @@ void AVMuxer::Private::applyOptionsForDict() if (options.contains(QStringLiteral("avformat"))) opt = options.value(QStringLiteral("avformat")); Internal::setOptionsToDict(opt, &dict); - - if (opt.type() == QVariant::Map) { + const auto type = opt.type(); + if (type == QVariant::Map) { QVariantMap avformat_dict(opt.toMap()); if (avformat_dict.contains(QStringLiteral("format_whitelist"))) { const QString fmts(avformat_dict[QStringLiteral("format_whitelist")].toString()); if (!fmts.contains(QLatin1Char(',')) && !fmts.isEmpty()) format_forced = fmts; // reset when media changed } - } else if (opt.type() == QVariant::Hash) { + } else if (type == QVariant::Hash) { QVariantHash avformat_dict(opt.toHash()); if (avformat_dict.contains(QStringLiteral("format_whitelist"))) { const QString fmts(avformat_dict[QStringLiteral("format_whitelist")].toString()); diff --git a/src/AVPlayerPrivate.cpp b/src/AVPlayerPrivate.cpp index fc6676910..79eeff186 100644 --- a/src/AVPlayerPrivate.cpp +++ b/src/AVPlayerPrivate.cpp @@ -1,6 +1,6 @@ /****************************************************************************** QtAV: Multimedia framework based on Qt and FFmpeg - Copyright (C) 2012-2017 Wang Bin + Copyright (C) 2012-2022 Wang Bin * This file is part of QtAV (from 2014) @@ -28,6 +28,7 @@ #include "QtAV/MediaIO.h" #include "QtAV/VideoCapture.h" #include "QtAV/private/AVCompat.h" +#include #if AV_MODULE_CHECK(LIBAVFORMAT, 55, 18, 0, 39, 100) extern "C" { #include @@ -243,7 +244,7 @@ void AVPlayer::Private::initBaseStatistics() return; } statistics.bit_rate = fmt_ctx->bit_rate; - statistics.format = QString().sprintf("%s - %s", fmt_ctx->iformat->name, fmt_ctx->iformat->long_name); + statistics.format = QString().asprintf("%s - %s", fmt_ctx->iformat->name, fmt_ctx->iformat->long_name); //AV_TIME_BASE_Q: msvc error C2143 //fmt_ctx->duration may be AV_NOPTS_VALUE. AVDemuxer.duration deals with this case AVDictionaryEntry *tag = NULL; diff --git a/src/Packet.cpp b/src/Packet.cpp index 8908502bc..826ea8a15 100644 --- a/src/Packet.cpp +++ b/src/Packet.cpp @@ -1,6 +1,6 @@ /****************************************************************************** QtAV: Multimedia framework based on Qt and FFmpeg - Copyright (C) 2012-2016 Wang Bin + Copyright (C) 2012-2022 Wang Bin * This file is part of QtAV @@ -222,7 +222,7 @@ void Packet::skip(int bytes) #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug dbg, const Packet &pkt) { - dbg.nospace() << "QtAV::Packet.data " << hex << (qptrdiff)pkt.data.constData() << "+" << dec << pkt.data.size(); + dbg.nospace() << "QtAV::Packet.data " << Qt::hex << (qptrdiff)pkt.data.constData() << "+" << Qt::dec << pkt.data.size(); dbg.nospace() << ", dts: " << pkt.dts; dbg.nospace() << ", pts: " << pkt.pts; dbg.nospace() << ", duration: " << pkt.duration; diff --git a/src/QtAV/GeometryRenderer.h b/src/QtAV/GeometryRenderer.h index 53032b091..8d7580d80 100644 --- a/src/QtAV/GeometryRenderer.h +++ b/src/QtAV/GeometryRenderer.h @@ -1,6 +1,6 @@ /****************************************************************************** QtAV: Multimedia framework based on Qt and FFmpeg - Copyright (C) 2012-2017 Wang Bin + Copyright (C) 2012-2022 Wang Bin * This file is part of QtAV (from 2016) @@ -23,10 +23,10 @@ #include #define QT_VAO (QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)) #if QT_VAO -#include +#include #endif //QT_VAO # if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) -#include +#include #else #include typedef QGLBuffer QOpenGLBuffer; diff --git a/src/QtAV/OpenGLRendererBase.h b/src/QtAV/OpenGLRendererBase.h index 74fd40833..d5b7ac191 100644 --- a/src/QtAV/OpenGLRendererBase.h +++ b/src/QtAV/OpenGLRendererBase.h @@ -1,6 +1,6 @@ /****************************************************************************** QtAV: Multimedia framework based on Qt and FFmpeg - Copyright (C) 2012-2016 Wang Bin + Copyright (C) 2012-2022 Wang Bin * This file is part of QtAV (from 2014) @@ -24,7 +24,7 @@ #include #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) -#include +#include #elif QT_VERSION >= QT_VERSION_CHECK(4, 8, 0) #include #define QOpenGLFunctions QGLFunctions diff --git a/src/QtAV/OpenGLVideo.h b/src/QtAV/OpenGLVideo.h index 2b992879f..1f763f6b7 100644 --- a/src/QtAV/OpenGLVideo.h +++ b/src/QtAV/OpenGLVideo.h @@ -1,6 +1,6 @@ /****************************************************************************** QtAV: Multimedia framework based on Qt and FFmpeg - Copyright (C) 2012-2018 Wang Bin + Copyright (C) 2012-2022 Wang Bin * This file is part of QtAV (from 2014) @@ -28,7 +28,7 @@ #include #include #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) -#include +#include #else #include #define QOpenGLContext QGLContext diff --git a/src/QtAV/OpenGLWindowRenderer.h b/src/QtAV/OpenGLWindowRenderer.h index 11e73a3a3..a1e04a01a 100644 --- a/src/QtAV/OpenGLWindowRenderer.h +++ b/src/QtAV/OpenGLWindowRenderer.h @@ -1,6 +1,6 @@ /****************************************************************************** QtAV: Multimedia framework based on Qt and FFmpeg - Copyright (C) 2014-2016 Wang Bin + Copyright (C) 2014-2022 Wang Bin * This file is part of QtAV @@ -22,7 +22,7 @@ #ifndef QTAV_OPENGLWINDOWRENDERER_H #define QTAV_OPENGLWINDOWRENDERER_H #ifndef QT_NO_OPENGL -#include +#include #include namespace QtAV { diff --git a/src/QtAV/QtAV.h b/src/QtAV/QtAV.h index ef78eedf1..bcd59f720 100644 --- a/src/QtAV/QtAV.h +++ b/src/QtAV/QtAV.h @@ -1,6 +1,6 @@ /****************************************************************************** QtAV: Multimedia framework based on Qt and FFmpeg - Copyright (C) 2012-2017 Wang Bin + Copyright (C) 2012-2022 Wang Bin * This file is part of QtAV @@ -46,7 +46,7 @@ #include #include -#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0) && !defined(QT_NO_OPENGL)) || defined(QT_OPENGL_LIB) +#if (QT_VERSION == QT_VERSION_CHECK(5,0,0) && !defined(QT_NO_OPENGL)) || (QT_VERSION >= QT_VERSION_CHECK(6,0,0) && defined(QT_OPENGL_LIB)) #include #include #include @@ -65,7 +65,7 @@ #include //The following renderer headers can be removed #include -#if QT_VERSION >= QT_VERSION_CHECK(5,4,0) +#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0) && QT_VERSION < QT_VERSION_CHECK(6,0,0)) || (QT_VERSION >= QT_VERSION_CHECK(6,0,0) && defined(QT_OPENGL_LIB)) #include #endif #include diff --git a/src/QtAV/VideoShader.h b/src/QtAV/VideoShader.h index 11fc4e4a9..4ab5120ff 100644 --- a/src/QtAV/VideoShader.h +++ b/src/QtAV/VideoShader.h @@ -1,6 +1,6 @@ /****************************************************************************** QtAV: Multimedia framework based on Qt and FFmpeg - Copyright (C) 2012-2016 Wang Bin + Copyright (C) 2012-2022 Wang Bin * This file is part of QtAV (from 2014) @@ -25,8 +25,8 @@ #include #include #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) -#include -#include +#include +#include #else #include #include diff --git a/src/QtAV/private/QPainterRenderer_p.h b/src/QtAV/private/QPainterRenderer_p.h index 8cb387466..1e37fd725 100644 --- a/src/QtAV/private/QPainterRenderer_p.h +++ b/src/QtAV/private/QPainterRenderer_p.h @@ -1,7 +1,7 @@ /****************************************************************************** QtAV: Multimedia framework based on Qt and FFmpeg - Copyright (C) 2012-2016 Wang Bin - + Copyright (C) 2012-2022 Wang Bin + * This file is part of QtAV This library is free software; you can redistribute it and/or @@ -47,14 +47,14 @@ class Q_AV_PRIVATE_EXPORT QPainterRendererPrivate : public VideoRendererPrivate painter->setRenderHint(QPainter::Antialiasing, false); painter->setRenderHint(QPainter::TextAntialiasing, false); painter->setRenderHint(QPainter::SmoothPixmapTransform, false); - painter->setRenderHint(QPainter::HighQualityAntialiasing, false); + painter->setRenderHint(QPainter::Antialiasing, false); break; case VideoRenderer::QualityBest: default: painter->setRenderHint(QPainter::Antialiasing, true); painter->setRenderHint(QPainter::TextAntialiasing, true); painter->setRenderHint(QPainter::SmoothPixmapTransform, true); - painter->setRenderHint(QPainter::HighQualityAntialiasing, true); + painter->setRenderHint(QPainter::Antialiasing, true); break; } } diff --git a/src/QtAV/private/VideoShader_p.h b/src/QtAV/private/VideoShader_p.h index 757aca22d..243ac39c1 100644 --- a/src/QtAV/private/VideoShader_p.h +++ b/src/QtAV/private/VideoShader_p.h @@ -1,6 +1,6 @@ /****************************************************************************** QtAV: Multimedia framework based on Qt and FFmpeg - Copyright (C) 2012-2016 Wang Bin + Copyright (C) 2012-2022 Wang Bin * This file is part of QtAV (from 2014) @@ -27,9 +27,9 @@ #include "ColorTransform.h" #include #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) -#include -#include -#include +#include +#include +#include #else #if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0) #include diff --git a/src/QtAV_Global.cpp b/src/QtAV_Global.cpp index 4268c45d5..c3374faaf 100644 --- a/src/QtAV_Global.cpp +++ b/src/QtAV_Global.cpp @@ -1,6 +1,6 @@ /****************************************************************************** QtAV: Multimedia framework based on Qt and FFmpeg - Copyright (C) 2012-2019 Wang Bin + Copyright (C) 2012-2022 Wang Bin * This file is part of QtAV @@ -22,7 +22,12 @@ #include "QtAV/QtAV_Global.h" #include #include +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +#include +using QRegExp = QRegularExpression; +#else #include +#endif #include "QtAV/version.h" #include "QtAV/private/AVCompat.h" #include "utils/internal.h" @@ -85,14 +90,13 @@ static unsigned get_qt_version() { static const depend_component* get_depend_component(const depend_component* info = 0) { // DO NOT use QStringLiteral here because the install script use strings to search "Qt-" in the library. QStringLiteral will place it in .ro and strings can not find it - static const QByteArray qt_license(QLibraryInfo::licensee().prepend(QLatin1String("Qt-" QT_VERSION_STR " licensee: ")).toUtf8()); #if QT_VERSION >= QT_VERSION_CHECK(5, 3, 0) static const char* qt_build_info = get_qt_version() >= QT_VERSION_CHECK(5, 3, 0) ? QLibraryInfo::build() : ""; #else static const char* qt_build_info = ""; #endif static const depend_component components[] = { - { "Qt", QT_VERSION, get_qt_version(), qt_build_info, qt_license.constData() }, + { "Qt", QT_VERSION, get_qt_version(), qt_build_info, "" }, //TODO: auto check loaded libraries #define FF_COMPONENT(name, NAME) #name, LIB##NAME##_VERSION_INT, name##_version(), name##_configuration(), name##_license() { FF_COMPONENT(avutil, AVUTIL) }, @@ -259,7 +263,7 @@ static void qtav_ffmpeg_log_callback(void* ctx, int level,const char* fmt, va_li if (level > Internal::gAVLogLevel) return; AVClass *c = ctx ? *(AVClass**)ctx : 0; - QString qmsg = QString().sprintf("[FFmpeg:%s] ", c ? c->item_name(ctx) : "?") + QString().vsprintf(fmt, vl); + QString qmsg = QString().asprintf("[FFmpeg:%s] ", c ? c->item_name(ctx) : "?") + QString().vasprintf(fmt, vl); qmsg = qmsg.trimmed(); if (level > AV_LOG_WARNING) qDebug() << qPrintable(qmsg); @@ -465,6 +469,6 @@ namespace { public: ResourceLoader() { initResources(); } }; - + ResourceLoader QtAV_QRCLoader; } diff --git a/src/VideoFrameExtractor.cpp b/src/VideoFrameExtractor.cpp index 8e4a843e7..60a1540f3 100644 --- a/src/VideoFrameExtractor.cpp +++ b/src/VideoFrameExtractor.cpp @@ -1,6 +1,6 @@ /****************************************************************************** QtAV: Multimedia framework based on Qt and FFmpeg - Copyright (C) 2012-2016 Wang Bin + Copyright (C) 2012-2022 Wang Bin * This file is part of QtAV (from 2014) @@ -260,7 +260,7 @@ class VideoFrameExtractorPrivate : public DPtrPrivate } if (!pkt.isValid()) { qWarning("VideoFrameExtractor failed to get a packet at %lld", value); - err = QString().sprintf("failed to get a packet at %lld",value); + err = QString().asprintf("failed to get a packet at %lld",value); return false; } decoder->flush(); //must flush otherwise old frames will be decoded at the beginning @@ -350,7 +350,7 @@ class VideoFrameExtractorPrivate : public DPtrPrivate if (diff > range && t > pts) { qWarning("out pts out of range. diff=%lld, range=%d", diff, range); frame = VideoFrame(); - err = QString().sprintf("out pts out of range. diff=%lld, range=%d", diff, range); + err = QString().asprintf("out pts out of range. diff=%lld, range=%d", diff, range); return false; } } @@ -538,9 +538,9 @@ void VideoFrameExtractor::extractInternal(qint64 pos) extractOk = d.extractInPrecision(pos, precision(), err, isAborted); if (!extractOk) { if (isAborted) - Q_EMIT aborted(QString().sprintf("Abort at position %lld: %s",pos,err.toLatin1().constData())); + Q_EMIT aborted(QString().asprintf("Abort at position %lld: %s",pos,err.toLatin1().constData())); else - Q_EMIT error(QString().sprintf("Cannot extract frame at position %lld: %s",pos,err.toLatin1().constData())); + Q_EMIT error(QString().asprintf("Cannot extract frame at position %lld: %s",pos,err.toLatin1().constData())); return; } Q_EMIT frameExtracted(d.frame); diff --git a/src/codec/video/VideoDecoder.cpp b/src/codec/video/VideoDecoder.cpp index a78940c99..6ca4a391b 100644 --- a/src/codec/video/VideoDecoder.cpp +++ b/src/codec/video/VideoDecoder.cpp @@ -1,6 +1,6 @@ /****************************************************************************** QtAV: Multimedia framework based on Qt and FFmpeg - Copyright (C) 2012-2018 Wang Bin + Copyright (C) 2012-2022 Wang Bin * This file is part of QtAV @@ -85,7 +85,12 @@ static void VideoDecoder_RegisterAll() QVector VideoDecoder::registered() { VideoDecoder_RegisterAll(); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + const auto ids = VideoDecoderFactory::Instance().registeredIds(); + return {ids.begin(), ids.end()}; +#else return QVector::fromStdVector(VideoDecoderFactory::Instance().registeredIds()); +#endif } QStringList VideoDecoder::supportedCodecs() diff --git a/src/filter/GLSLFilter.cpp b/src/filter/GLSLFilter.cpp index 737b05ed0..b3387b4fe 100644 --- a/src/filter/GLSLFilter.cpp +++ b/src/filter/GLSLFilter.cpp @@ -1,6 +1,6 @@ /****************************************************************************** QtAV: Multimedia framework based on Qt and FFmpeg - Copyright (C) 2012-2016 Wang Bin + Copyright (C) 2012-2022 Wang Bin * This file is part of QtAV (from 2016) @@ -24,7 +24,7 @@ #include "QtAV/VideoFrame.h" #include "opengl/OpenGLHelper.h" #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) -#include +#include #else #include #endif diff --git a/src/libQtAV.pro b/src/libQtAV.pro index 8361f628c..c6cbcc374 100644 --- a/src/libQtAV.pro +++ b/src/libQtAV.pro @@ -3,6 +3,7 @@ MODULE_INCNAME = QtAV # for mac framework. also used in install_sdk.pro TARGET = QtAV QT += core gui #CONFIG *= ltcg +greaterThan(QT_MAJOR_VERSION, 5): QT += opengl greaterThan(QT_MAJOR_VERSION, 4) { contains(QT_CONFIG, opengl) { CONFIG *= config_opengl diff --git a/src/opengl/OpenGLHelper.cpp b/src/opengl/OpenGLHelper.cpp index 4aafd69d2..0a39da4ac 100644 --- a/src/opengl/OpenGLHelper.cpp +++ b/src/opengl/OpenGLHelper.cpp @@ -1,6 +1,6 @@ /****************************************************************************** QtAV: Multimedia framework based on Qt and FFmpeg - Copyright (C) 2012-2016 Wang Bin + Copyright (C) 2012-2022 Wang Bin * This file is part of QtAV @@ -22,8 +22,13 @@ #include "OpenGLHelper.h" #include //strstr #include -#include #include +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +#include +using QRegExp = QRegularExpression; +#else +#include +#endif #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0) #include @@ -32,7 +37,7 @@ #include #endif #ifdef QT_OPENGL_DYNAMIC -#include +#include #endif #if QTAV_HAVE(EGL_CAPI) // && QTAV_HAVE(QT_EGL) //make sure no crash if no egl library #define EGL_CAPI_NS diff --git a/src/opengl/OpenGLTypes.cpp b/src/opengl/OpenGLTypes.cpp index 76ef09b62..58578e325 100644 --- a/src/opengl/OpenGLTypes.cpp +++ b/src/opengl/OpenGLTypes.cpp @@ -1,6 +1,6 @@ /****************************************************************************** QtAV: Multimedia framework based on Qt and FFmpeg - Copyright (C) 2012-2016 Wang Bin + Copyright (C) 2012-2022 Wang Bin * This file is part of QtAV (from 2016) @@ -20,7 +20,11 @@ ******************************************************************************/ #include "QtAV/OpenGLTypes.h" #include "opengl/OpenGLHelper.h" +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +#include +#else #include +#endif #include #include #include "utils/Logger.h" @@ -275,12 +279,21 @@ QVector ParseUniforms(const QByteArray &text, GLuint programId = 0) line = line.trimmed(); if (!line.startsWith(QStringLiteral("uniform "))) continue; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + auto rx = QRegularExpression(exp_array).match(line); + if (!rx.hasMatch()) { + rx = QRegularExpression(exp).match(line); + if (!rx.hasMatch()) + continue; + } +#else QRegExp rx(exp_array); if (rx.indexIn(line) < 0) { rx = QRegExp(exp); if (rx.indexIn(line) < 0) continue; } +#endif Uniform u; const QStringList x = rx.capturedTexts(); //qDebug() << x; diff --git a/src/opengl/SubImagesRenderer.h b/src/opengl/SubImagesRenderer.h index 1c1b6f0f3..aa9a5e44f 100644 --- a/src/opengl/SubImagesRenderer.h +++ b/src/opengl/SubImagesRenderer.h @@ -1,6 +1,6 @@ /****************************************************************************** QtAV: Multimedia framework based on Qt and FFmpeg - Copyright (C) 2012-2016 Wang Bin + Copyright (C) 2012-2022 Wang Bin * This file is part of QtAV (from 2016) @@ -25,8 +25,8 @@ #include #include "opengl/OpenGLHelper.h" #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) -#include -#include +#include +#include #else #include #include diff --git a/src/opengl/VideoShader.cpp b/src/opengl/VideoShader.cpp index 987d3198e..fbdc0a620 100644 --- a/src/opengl/VideoShader.cpp +++ b/src/opengl/VideoShader.cpp @@ -1,6 +1,6 @@ /****************************************************************************** QtAV: Multimedia framework based on Qt and FFmpeg - Copyright (C) 2012-2016 Wang Bin + Copyright (C) 2012-2022 Wang Bin * This file is part of QtAV (from 2014) @@ -26,7 +26,6 @@ #include #include #include -#include #include #include "utils/Logger.h" diff --git a/src/opengl/gl_api.h b/src/opengl/gl_api.h index 6b0f0b627..da6b1cbc4 100644 --- a/src/opengl/gl_api.h +++ b/src/opengl/gl_api.h @@ -1,6 +1,6 @@ /****************************************************************************** QtAV: Media play library based on Qt and FFmpeg - Copyright (C) 2012-2016 Wang Bin + Copyright (C) 2012-2022 Wang Bin * This file is part of QtAV (from 2016) @@ -24,10 +24,10 @@ #ifndef QT_NO_OPENGL #include # if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) -#include -#include -#include -#include +#include +#include +#include +#include # elif defined(QT_OPENGL_LIB) # if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0) #include diff --git a/src/output/video/QPainterRenderer.cpp b/src/output/video/QPainterRenderer.cpp index 9cf008bb8..656a921a7 100644 --- a/src/output/video/QPainterRenderer.cpp +++ b/src/output/video/QPainterRenderer.cpp @@ -1,6 +1,6 @@ /****************************************************************************** QtAV: Multimedia framework based on Qt and FFmpeg - Copyright (C) 2012-2017 Wang Bin + Copyright (C) 2012-2022 Wang Bin * This file is part of QtAV @@ -79,7 +79,7 @@ void QPainterRenderer::drawBackground() const QRegion bgRegion(backgroundRegion()); if (bgRegion.isEmpty()) return; -#if 0 +#if 1 d.painter->save(); d.painter->setClipRegion(bgRegion); d.painter->fillRect(QRect(QPoint(), rendererSize()), backgroundColor()); diff --git a/src/subtitle/Subtitle.cpp b/src/subtitle/Subtitle.cpp index c447211a5..1d3a67e4b 100644 --- a/src/subtitle/Subtitle.cpp +++ b/src/subtitle/Subtitle.cpp @@ -1,6 +1,6 @@ /****************************************************************************** QtAV: Multimedia framework based on Qt and FFmpeg - Copyright (C) 2012-2016 Wang Bin + Copyright (C) 2012-2022 Wang Bin * This file is part of QtAV (from 2014) @@ -28,12 +28,19 @@ #include #include #include -#include #include #include +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) #include +#endif #include #include +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +#include +using QRegExp = QRegularExpression; +#else +#include +#endif #include "subtitle/CharsetDetector.h" #include "utils/Logger.h" @@ -724,15 +731,23 @@ QStringList Subtitle::Private::find() foreach (const QString& suf, sfx) { if (list.isEmpty()) break; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + auto rx = QRegularExpression::fromWildcard(QStringLiteral("*.") + suf); +#else QRegExp rx(QStringLiteral("*.") + suf); rx.setPatternSyntax(QRegExp::Wildcard); +#endif QFileInfoList::iterator it = list.begin(); while (it != list.end()) { if (!it->fileName().startsWith(name) && !it->fileName().startsWith(base_name)) {// why it happens? it = list.erase(it); continue; } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + if (!rx.match(it->fileName()).hasMatch()) { +#else if (!rx.exactMatch(it->fileName())) { +#endif ++it; continue; } @@ -761,6 +776,7 @@ QByteArray Subtitle::Private::readFromFile(const QString &path) } QTextStream ts(&f); ts.setAutoDetectUnicode(true); +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) if (!codec.isEmpty()) { if (codec.toLower() == "system") { ts.setCodec(QTextCodec::codecForLocale()); @@ -777,6 +793,7 @@ QByteArray Subtitle::Private::readFromFile(const QString &path) ts.setCodec(QTextCodec::codecForName(codec)); } } +#endif return ts.readAll().toUtf8(); } diff --git a/src/subtitle/SubtitleProcessorFFmpeg.cpp b/src/subtitle/SubtitleProcessorFFmpeg.cpp index 83e53e7c0..8d4a94154 100644 --- a/src/subtitle/SubtitleProcessorFFmpeg.cpp +++ b/src/subtitle/SubtitleProcessorFFmpeg.cpp @@ -1,6 +1,6 @@ /****************************************************************************** QtAV: Multimedia framework based on Qt and FFmpeg - Copyright (C) 2012-2018 Wang Bin + Copyright (C) 2012-2022 Wang Bin * This file is part of QtAV (from 2014) @@ -26,6 +26,7 @@ #include "QtAV/private/AVCompat.h" #include "PlainText.h" #include "utils/Logger.h" +#include namespace QtAV { diff --git a/src/utils/Logger.cpp b/src/utils/Logger.cpp index 93ec169d4..4b08218da 100644 --- a/src/utils/Logger.cpp +++ b/src/utils/Logger.cpp @@ -1,6 +1,6 @@ /****************************************************************************** QtAV: Multimedia framework based on Qt and FFmpeg - Copyright (C) 2012-2016 Wang Bin + Copyright (C) 2012-2022 Wang Bin * This file is part of QtAV (from 2013) @@ -49,7 +49,7 @@ static void log_helper(QtMsgType msgType, const QMessageLogger *qlog, const char QString qmsg(gQtAVLogTag); QString formated; if (msg) { - formated = QString().vsprintf(msg, ap); + formated = QString().vasprintf(msg, ap); } // repeate check if (last_type == msgType && last_msg == formated) { diff --git a/widgets/QtAVWidgets/GLWidgetRenderer2.h b/widgets/QtAVWidgets/GLWidgetRenderer2.h index c4029d47a..ef282d03b 100644 --- a/widgets/QtAVWidgets/GLWidgetRenderer2.h +++ b/widgets/QtAVWidgets/GLWidgetRenderer2.h @@ -1,6 +1,6 @@ /****************************************************************************** QtAV: Multimedia framework based on Qt and FFmpeg - Copyright (C) 2012-2016 Wang Bin + Copyright (C) 2012-2022 Wang Bin * This file is part of QtAV (from 2014) @@ -22,7 +22,7 @@ #ifndef QTAV_GLWIDGETRENDERER2_H #define QTAV_GLWIDGETRENDERER2_H -#ifndef QT_NO_OPENGL +#if !defined(QT_NO_OPENGL) && QT_VERSION < QT_VERSION_CHECK(6,0,0) #include #include #include diff --git a/widgets/QtAVWidgets/OpenGLWidgetRenderer.h b/widgets/QtAVWidgets/OpenGLWidgetRenderer.h index fcfb7d281..dffc65548 100644 --- a/widgets/QtAVWidgets/OpenGLWidgetRenderer.h +++ b/widgets/QtAVWidgets/OpenGLWidgetRenderer.h @@ -1,6 +1,6 @@ /****************************************************************************** QtAV: Multimedia framework based on Qt and FFmpeg - Copyright (C) 2012-2016 Wang Bin + Copyright (C) 2012-2022 Wang Bin * This file is part of QtAV (from 2014) @@ -24,7 +24,7 @@ #include #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) -#include +#include #else #include #endif //QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) @@ -54,7 +54,7 @@ class Q_AVWIDGETS_EXPORT OpenGLWidgetRenderer : public QOpenGLWidget, public Ope Q_PROPERTY(QSize videoFrameSize READ videoFrameSize NOTIFY videoFrameSizeChanged) Q_ENUMS(Quality) public: - explicit OpenGLWidgetRenderer(QWidget* parent = 0, Qt::WindowFlags f = 0); + explicit OpenGLWidgetRenderer(QWidget* parent = 0, Qt::WindowFlags f = Qt::Widget); virtual VideoRendererId id() const Q_DECL_OVERRIDE; virtual QWidget* widget() Q_DECL_OVERRIDE { return this; } Q_SIGNALS: diff --git a/widgets/QtAVWidgets/QOpenGLWidget.h b/widgets/QtAVWidgets/QOpenGLWidget.h index 8dc07edaf..e6364120b 100644 --- a/widgets/QtAVWidgets/QOpenGLWidget.h +++ b/widgets/QtAVWidgets/QOpenGLWidget.h @@ -1,6 +1,6 @@ /****************************************************************************** QtAV: Multimedia framework based on Qt and FFmpeg - Copyright (C) 2012-2016 Wang Bin + Copyright (C) 2012-2022 Wang Bin * This file is part of QtAV (from 2015) @@ -26,8 +26,8 @@ #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) #error "Qt5 is required!" #endif -#include -#include +#include +#include #include #include diff --git a/widgets/QtAVWidgets/WidgetRenderer.h b/widgets/QtAVWidgets/WidgetRenderer.h index 0441ab465..492761b6c 100644 --- a/widgets/QtAVWidgets/WidgetRenderer.h +++ b/widgets/QtAVWidgets/WidgetRenderer.h @@ -1,6 +1,6 @@ /****************************************************************************** QtAV: Multimedia framework based on Qt and FFmpeg - Copyright (C) 2012-2016 Wang Bin + Copyright (C) 2012-2022 Wang Bin * This file is part of QtAV @@ -49,7 +49,7 @@ class Q_AVWIDGETS_EXPORT WidgetRenderer : public QWidget, public QPainterRendere Q_PROPERTY(QSize videoFrameSize READ videoFrameSize NOTIFY videoFrameSizeChanged) Q_ENUMS(Quality) public: - explicit WidgetRenderer(QWidget *parent = 0, Qt::WindowFlags f = 0); + explicit WidgetRenderer(QWidget *parent = 0, Qt::WindowFlags f = Qt::Widget); virtual VideoRendererId id() const Q_DECL_OVERRIDE; virtual QWidget* widget() Q_DECL_OVERRIDE { return this; } Q_SIGNALS: diff --git a/widgets/libQtAVWidgets.pro b/widgets/libQtAVWidgets.pro index 599aa90ac..5a3d0b175 100644 --- a/widgets/libQtAVWidgets.pro +++ b/widgets/libQtAVWidgets.pro @@ -3,6 +3,7 @@ MODULE_INCNAME = QtAVWidgets # for mac framework. also used in install_sdk.pro TARGET = QtAVWidgets QT += gui config_gl: QT += opengl +greaterThan(QT_MAJOR_VERSION, 5): QT += openglwidgets greaterThan(QT_MAJOR_VERSION, 4) { # qtHaveModule does not exist in Qt5.0 qtHaveModule(widgets) { @@ -74,7 +75,7 @@ contains(QT_CONFIG, opengl):greaterThan(QT_MAJOR_VERSION, 4) { } } -config_gl { +lessThan(QT_MAJOR_VERSION, 6):config_gl { DEFINES *= QTAV_HAVE_GL=1 SOURCES += GLWidgetRenderer2.cpp SDK_HEADERS += QtAVWidgets/GLWidgetRenderer2.h