forked from wang-bin/QtAV
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
no qml. examples are wip. fix wang-bin#1381, wang-bin#1294, wang-bin#1389
- Loading branch information
Showing
46 changed files
with
215 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 1,6 @@ | ||
/****************************************************************************** | ||
QtAV Player Demo: this file is part of QtAV examples | ||
Copyright (C) 2012-2017 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2022 Wang Bin <[email protected]> | ||
* 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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 1,6 @@ | ||
/****************************************************************************** | ||
QOptions: make command line options easy. https://github.com/wang-bin/qoptions | ||
Copyright (C) 2011-2015 Wang Bin <[email protected]> | ||
Copyright (C) 2011-2022 Wang Bin <[email protected]> | ||
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); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 1,6 @@ | ||
/****************************************************************************** | ||
QtAV: Multimedia framework based on Qt and FFmpeg | ||
Copyright (C) 2012-2016 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2022 Wang Bin <[email protected]> | ||
* This file is part of QtAV (from 2013) | ||
|
@@ -22,7 22,7 @@ | |
#include "SimpleFilter.h" | ||
#include <QWidget> | ||
#include <math.h> | ||
|
||
#include <QTime> | ||
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); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 1,6 @@ | ||
/****************************************************************************** | ||
QtAV Player Demo: this file is part of QtAV examples | ||
Copyright (C) 2012-2014 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2022 Wang Bin <[email protected]> | ||
* 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); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 1,6 @@ | ||
/****************************************************************************** | ||
QtAV Player Demo: this file is part of QtAV examples | ||
Copyright (C) 2012-2015 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2022 Wang Bin <[email protected]> | ||
* 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); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 1,6 @@ | ||
/****************************************************************************** | ||
this file is part of QtAV examples | ||
Copyright (C) 2012-2015 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2022 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
|
@@ -21,7 21,7 @@ | |
#include "videoplayer.h" | ||
#include <QGraphicsView> | ||
|
||
#ifndef QT_NO_OPENGL | ||
#if !defined(QT_NO_OPENGL) && QT_VERSION < QT_VERSION_CHECK(6,0,0) | ||
#include <QtOpenGL/QGLWidget> | ||
#endif | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 1,6 @@ | ||
/****************************************************************************** | ||
VideoGroup: this file is part of QtAV examples | ||
Copyright (C) 2012-2015 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2022 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
|
@@ -20,14 20,17 @@ | |
|
||
#include "videogroup.h" | ||
#include <QApplication> | ||
#include <QDesktopWidget> | ||
#include <QEvent> | ||
#include <QFileDialog> | ||
#include <QGridLayout> | ||
#include <QtCore/QUrl> | ||
#include <QtAV/AudioOutput.h> | ||
#include <QtAVWidgets> | ||
|
||
#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) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 1,6 @@ | ||
/****************************************************************************** | ||
QtAV: Multimedia framework based on Qt and FFmpeg | ||
Copyright (C) 2012-2016 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2022 Wang Bin <[email protected]> | ||
* 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") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 1,6 @@ | ||
/****************************************************************************** | ||
QtAV: Multimedia framework based on Qt and FFmpeg | ||
Copyright (C) 2012-2017 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2022 Wang Bin <[email protected]> | ||
theoribeiro <[email protected]> | ||
* 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) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 1,6 @@ | ||
/****************************************************************************** | ||
QtAV: Multimedia framework based on Qt and FFmpeg | ||
Copyright (C) 2012-2017 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2022 Wang Bin <[email protected]> | ||
* This file is part of QtAV (from 2015) | ||
|
@@ -27,13 27,13 @@ | |
#include "QtAV/private/mkid.h" | ||
#include "QtAV/private/factory.h" | ||
#include <QtCore/QCoreApplication> | ||
#include <QtGui/QOpenGLFunctions> | ||
#include <QtGui/QOpenGLFramebufferObject> | ||
#include <QOpenGLFunctions> | ||
#include <QOpenGLFramebufferObject> | ||
#include <QtQuick/QQuickWindow> | ||
// 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 <QtGui/QOpenGLFunctions> | ||
#include <QOpenGLFunctions> | ||
#define DYGL(glFunc) QOpenGLContext::currentContext()->functions()->glFunc | ||
#else | ||
#define DYGL(glFunc) glFunc | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 1,6 @@ | ||
/****************************************************************************** | ||
QtAV: Multimedia framework based on Qt and FFmpeg | ||
Copyright (C) 2012-2016 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2022 Wang Bin <[email protected]> | ||
* This file is part of QtAV (from 2014) | ||
|
@@ -24,7 24,7 @@ | |
#include "QtAV/VideoShader.h" | ||
#include "QtAV/VideoFrame.h" | ||
#include <QtCore/QScopedPointer> | ||
#include <QtGui/QOpenGLFunctions> | ||
#include <QOpenGLFunctions> | ||
#include <QtQuick/QSGMaterial> | ||
#include <QtQuick/QSGMaterialShader> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 1,6 @@ | ||
/****************************************************************************** | ||
QtAV: Multimedia framework based on Qt and FFmpeg | ||
Copyright (C) 2012-2018 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2022 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
|
@@ -23,6 23,7 @@ | |
#include "QtAV/private/AVCompat.h" | ||
#include <QtCore/QMutex> | ||
#include <QtCore/QStringList> | ||
#include <QtCore/QIODevice> | ||
#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0) | ||
#include <QtCore/QElapsedTimer> | ||
#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()); | ||
|
Oops, something went wrong.