Commit 80e81db5 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Reindent make it more easy to read code

parent 6a374fe3
......@@ -57,12 +57,15 @@ int main(int argc, char **argv)
locale = QString(args.at(0)).section(QLatin1Char(':'), 1);
args.removeFirst();
}
if (args.at(0).startsWith(QLatin1String("in=")))
if (args.at(0).startsWith(QLatin1String("in="))) {
in = args.takeFirst().section(QLatin1Char('='), -1).toInt();
if (args.at(0).startsWith(QLatin1String("out=")))
}
if (args.at(0).startsWith(QLatin1String("out="))) {
out = args.takeFirst().section(QLatin1Char('='), -1).toInt();
if (args.at(0).startsWith(QLatin1String("preargs=")))
}
if (args.at(0).startsWith(QLatin1String("preargs="))) {
preargs = args.takeFirst().section(QLatin1Char('='), 1).split(QLatin1Char(' '), QString::SkipEmptyParts);
}
QString render = args.takeFirst();
QString profile = args.takeFirst();
......@@ -72,8 +75,9 @@ int main(int argc, char **argv)
QUrl srcurl = QUrl::fromEncoded(srcString);
QString src = srcurl.path();
// The QUrl path() strips the consumer: protocol, so re-add it if necessary
if (srcString.startsWith("consumer:"))
if (srcString.startsWith("consumer:")) {
src.prepend(QLatin1String("consumer:"));
}
QUrl desturl = QUrl::fromEncoded(args.takeFirst().toUtf8());
QString dest = desturl.path();
bool dualpass = false;
......@@ -82,7 +86,7 @@ int main(int argc, char **argv)
int vprepos = args.indexOf(QRegExp(QLatin1String("vpre=.*")));
if (vprepos >= 0) {
vpre=args.at(vprepos);
vpre = args.at(vprepos);
}
QStringList vprelist = vpre.remove(QStringLiteral("vpre=")).split(QLatin1Char(','));
if (vprelist.size() > 0) {
......@@ -94,7 +98,9 @@ int main(int argc, char **argv)
dualpass = true;
doerase = false;
args.replace(args.indexOf(QStringLiteral("pass=2")), QStringLiteral("pass=1"));
if (args.contains(QStringLiteral("vcodec=libx264"))) args << QStringLiteral("passlogfile=%1").arg(dest + QStringLiteral(".log"));
if (args.contains(QStringLiteral("vcodec=libx264"))) {
args << QStringLiteral("passlogfile=%1").arg(dest + QStringLiteral(".log"));
}
} else {
args.removeAll(QStringLiteral("pass=1"));
doerase = erase;
......@@ -108,20 +114,25 @@ int main(int argc, char **argv)
}
}
qDebug() << "//STARTING RENDERING: " << erase << ',' << usekuiserver << ',' << render << ',' << profile << ',' << rendermodule << ',' << player << ',' << src << ',' << dest << ',' << preargs << ',' << args << ',' << in << ',' << out ;
qDebug() << "//STARTING RENDERING: " << erase << ',' << usekuiserver << ',' << render << ',' << profile << ',' << rendermodule << ',' << player << ',' << src << ',' << dest << ',' << preargs << ',' << args << ',' << in << ',' << out;
RenderJob *job = new RenderJob(doerase, usekuiserver, pid, render, profile, rendermodule, player, src, dest, preargs, args, in, out);
if (!locale.isEmpty()) job->setLocale(locale);
if (!locale.isEmpty()) {
job->setLocale(locale);
}
job->start();
RenderJob *dualjob = Q_NULLPTR;
if (dualpass) {
if (vprelist.size()>1)
args.replaceInStrings(QRegExp(QLatin1String("^vpre=.*")),QStringLiteral("vpre=%1").arg(vprelist.at(1)));
if (vprelist.size() > 1) {
args.replaceInStrings(QRegExp(QLatin1String("^vpre=.*")), QStringLiteral("vpre=%1").arg(vprelist.at(1)));
}
args.replace(args.indexOf(QStringLiteral("pass=1")), QStringLiteral("pass=2"));
dualjob = new RenderJob(erase, usekuiserver, pid, render, profile, rendermodule, player, src, dest, preargs, args, in, out);
QObject::connect(job, &RenderJob::renderingFinished, dualjob, &RenderJob::start);
}
app.exec();
if (dualjob) delete dualjob;
if (dualjob) {
delete dualjob;
}
} else {
fprintf(stderr, "Kdenlive video renderer for MLT.\nUsage: "
"kdenlive_render [-erase] [-kuiserver] [-locale:LOCALE] [in=pos] [out=pos] [render] [profile] [rendermodule] [player] [src] [dest] [[arg1] [arg2] ...]\n"
......
......@@ -17,7 +17,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#include "renderjob.h"
#include <QtDBus>
......@@ -30,13 +29,13 @@ class SleepThread : QThread
{
public:
void run() Q_DECL_OVERRIDE {}
static void msleep(unsigned long msecs) {
static void msleep(unsigned long msecs)
{
QThread::msleep(msecs);
}
};
RenderJob::RenderJob(bool erase, bool usekuiserver, int pid, const QString& renderer, const QString& profile, const QString& rendermodule, const QString& player, const QString& scenelist, const QString& dest, const QStringList& preargs, const QStringList& args, int in, int out) :
RenderJob::RenderJob(bool erase, bool usekuiserver, int pid, const QString &renderer, const QString &profile, const QString &rendermodule, const QString &player, const QString &scenelist, const QString &dest, const QStringList &preargs, const QStringList &args, int in, int out) :
QObject(),
m_scenelist(scenelist),
m_dest(dest),
......@@ -61,8 +60,12 @@ RenderJob::RenderJob(bool erase, bool usekuiserver, int pid, const QString& rend
qputenv("MLT_NO_VDPAU", "1");
m_args << scenelist;
if (in != -1) m_args << QStringLiteral("in=") + QString::number(in);
if (out != -1) m_args << QStringLiteral("out=") + QString::number(out);
if (in != -1) {
m_args << QStringLiteral("in=") + QString::number(in);
}
if (out != -1) {
m_args << QStringLiteral("out=") + QString::number(out);
}
m_args << preargs;
if (scenelist.startsWith(QLatin1String("consumer:"))) {
......@@ -75,11 +78,13 @@ RenderJob::RenderJob(bool erase, bool usekuiserver, int pid, const QString& rend
m_dualpass = args.contains(QStringLiteral("pass=1"));
// Create a log of every render process.
if (!m_logfile.open(QIODevice::WriteOnly|QIODevice::Text)) qWarning() << "Unable to log to " << m_logfile.fileName();
else m_logstream.setDevice(&m_logfile);
if (!m_logfile.open(QIODevice::WriteOnly | QIODevice::Text)) {
qWarning() << "Unable to log to " << m_logfile.fileName();
} else {
m_logstream.setDevice(&m_logfile);
}
}
RenderJob::~RenderJob()
{
delete m_renderProcess;
......@@ -91,9 +96,11 @@ void RenderJob::setLocale(const QString &locale)
qputenv("LC_NUMERIC", locale.toUtf8().constData());
}
void RenderJob::slotAbort(const QString& url)
void RenderJob::slotAbort(const QString &url)
{
if (m_dest == url) slotAbort();
if (m_dest == url) {
slotAbort();
}
}
void RenderJob::slotAbort()
......@@ -106,8 +113,12 @@ void RenderJob::slotAbort()
m_dbusargs.append(QString());
m_kdenliveinterface->callWithArgumentList(QDBus::NoBlock, QStringLiteral("setRenderingFinished"), m_dbusargs);
}
if (m_jobUiserver) m_jobUiserver->call(QStringLiteral("terminate"), QString());
if (m_erase) QFile(m_scenelist).remove();
if (m_jobUiserver) {
m_jobUiserver->call(QStringLiteral("terminate"), QString());
}
if (m_erase) {
QFile(m_scenelist).remove();
}
QFile(m_dest).remove();
m_logstream << "Job aborted by user" << endl;
m_logstream.flush();
......@@ -123,7 +134,9 @@ void RenderJob::receivedStderr()
} else {
m_logstream << "melt: " << result << endl;
int pro = result.section(QLatin1Char(' '), -1).toInt();
if (pro <= m_progress || pro <= 0 || pro > 100) return;
if (pro <= m_progress || pro <= 0 || pro > 100) {
return;
}
m_progress = pro;
if (m_args.contains(QStringLiteral("pass=1"))) {
m_progress /= 2.0;
......@@ -138,10 +151,14 @@ void RenderJob::receivedStderr()
if (m_jobUiserver) {
m_jobUiserver->call(QStringLiteral("setPercent"), (uint) m_progress);
int seconds = m_startTime.secsTo(QTime::currentTime());
if (seconds == m_seconds) return;
if (seconds < 0) seconds += 24*60*60;
if (seconds == m_seconds) {
return;
}
if (seconds < 0) {
seconds += 24 * 60 * 60;
}
m_jobUiserver->call(QStringLiteral("setDescriptionField"), (uint) 0,
QString(), tr("Remaining time: ") + QTime(0, 0, 0).addSecs((int) (seconds * (100 - m_progress) / m_progress)).toString(QStringLiteral("hh:mm:ss")));
QString(), tr("Remaining time: ") + QTime(0, 0, 0).addSecs((int)(seconds * (100 - m_progress) / m_progress)).toString(QStringLiteral("hh:mm:ss")));
//m_jobUiserver->call("setSpeed", (frame - m_frame) / (seconds - m_seconds));
m_frame = frame;
m_seconds = seconds;
......@@ -151,7 +168,7 @@ void RenderJob::receivedStderr()
void RenderJob::start()
{
QDBusConnectionInterface* interface = QDBusConnection::sessionBus().interface();
QDBusConnectionInterface *interface = QDBusConnection::sessionBus().interface();
if (interface && m_usekuiserver) {
if (!interface->isServiceRegistered(QStringLiteral("org.kde.JobViewServer"))) {
qWarning() << "No org.kde.JobViewServer registered, trying to start kuiserver";
......@@ -169,7 +186,7 @@ void RenderJob::start()
if (interface->isServiceRegistered(QStringLiteral("org.kde.JobViewServer"))) {
QDBusInterface kuiserver(QStringLiteral("org.kde.JobViewServer"), QStringLiteral("/JobViewServer"), QStringLiteral("org.kde.JobViewServer"));
QDBusReply<QDBusObjectPath> objectPath = kuiserver.asyncCall(QStringLiteral("requestView"),QLatin1String("kdenlive"), QLatin1String("kdenlive"), 0x0001);
QDBusReply<QDBusObjectPath> objectPath = kuiserver.asyncCall(QStringLiteral("requestView"), QLatin1String("kdenlive"), QLatin1String("kdenlive"), 0x0001);
QString reply = ((QDBusObjectPath) objectPath).path();
// Use of the KDE JobViewServer is an ugly hack, it is not reliable
......@@ -177,8 +194,9 @@ void RenderJob::start()
m_jobUiserver = new QDBusInterface(QStringLiteral("org.kde.JobViewServer"), reply, dbusView);
if (m_jobUiserver && m_jobUiserver->isValid()) {
m_startTime = QTime::currentTime();
if (!m_args.contains(QStringLiteral("pass=2")))
if (!m_args.contains(QStringLiteral("pass=2"))) {
m_jobUiserver->call(QStringLiteral("setPercent"), (uint) 0);
}
m_jobUiserver->call(QStringLiteral("setInfoMessage"), tr("Rendering %1").arg(QFileInfo(m_dest).fileName()));
QDBusConnection::sessionBus().connect(QStringLiteral("org.kde.JobViewServer"), reply, dbusView, QStringLiteral("cancelRequested"), this, SLOT(slotAbort()));
......@@ -200,25 +218,27 @@ void RenderJob::start()
m_logstream << "Started render process: " << m_prog << ' ' << m_args.join(QStringLiteral(" ")) << endl;
}
void RenderJob::initKdenliveDbusInterface()
{
QString kdenliveId;
QDBusConnection connection = QDBusConnection::sessionBus();
QDBusConnectionInterface* ibus = connection.interface();
QDBusConnectionInterface *ibus = connection.interface();
kdenliveId = QStringLiteral("org.kde.kdenlive-%1").arg(m_pid);
if (!ibus->isServiceRegistered(kdenliveId)) {
kdenliveId.clear();
const QStringList services = ibus->registeredServiceNames();
foreach(const QString & service, services) {
if (!service.startsWith(QLatin1String("org.kde.kdenlive")))
foreach (const QString &service, services) {
if (!service.startsWith(QLatin1String("org.kde.kdenlive"))) {
continue;
}
kdenliveId = service;
break;
}
}
m_dbusargs.clear();
if (kdenliveId.isEmpty()) return;
if (kdenliveId.isEmpty()) {
return;
}
m_kdenliveinterface = new QDBusInterface(kdenliveId,
QStringLiteral("/kdenlive/MainWindow_1"),
QStringLiteral("org.kde.kdenlive.rendering"),
......@@ -228,26 +248,26 @@ void RenderJob::initKdenliveDbusInterface()
if (m_kdenliveinterface) {
m_dbusargs.append(m_dest);
m_dbusargs.append((int) 0);
if (!m_args.contains(QStringLiteral("pass=2")))
if (!m_args.contains(QStringLiteral("pass=2"))) {
m_kdenliveinterface->callWithArgumentList(QDBus::NoBlock, QStringLiteral("setRenderingProgress"), m_dbusargs);
}
connect(m_kdenliveinterface, SIGNAL(abortRenderJob(QString)),
this, SLOT(slotAbort(QString)));
}
}
void RenderJob::slotCheckProcess(QProcess::ProcessState state)
{
if (state == QProcess::NotRunning) slotIsOver(m_renderProcess->exitStatus());
if (state == QProcess::NotRunning) {
slotIsOver(m_renderProcess->exitStatus());
}
}
void RenderJob::slotIsOver(QProcess::ExitStatus status, bool isWritable)
{
if (m_jobUiserver) {
m_jobUiserver->call(QStringLiteral("setDescriptionField"), (uint) 1,
tr("Rendered file"), m_dest);
tr("Rendered file"), m_dest);
//m_jobUiserver->call(QStringLiteral("terminate"), QString());
}
if (!isWritable) {
......@@ -261,7 +281,9 @@ void RenderJob::slotIsOver(QProcess::ExitStatus status, bool isWritable)
m_logstream << error << endl;
qApp->quit();
}
if (m_erase) QFile(m_scenelist).remove();
if (m_erase) {
QFile(m_scenelist).remove();
}
if (status == QProcess::CrashExit || m_renderProcess->error() != QProcess::UnknownError || m_renderProcess->exitCode() != 0) {
// rendering crashed
if (m_kdenliveinterface) {
......@@ -295,8 +317,8 @@ void RenderJob::slotIsOver(QProcess::ExitStatus status, bool isWritable)
emit renderingFinished();
deleteLater();
} else {
m_logfile.remove();
qApp->quit();
m_logfile.remove();
qApp->quit();
}
}
}
......@@ -17,7 +17,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#ifndef RENDERJOB_H
#define RENDERJOB_H
......@@ -34,7 +33,7 @@ class RenderJob : public QObject
Q_OBJECT
public:
RenderJob(bool erase, bool usekuiserver, int pid, const QString& renderer, const QString& profile, const QString& rendermodule, const QString& player, const QString& scenelist, const QString& dest, const QStringList& preargs, const QStringList& args, int in = -1, int out = -1);
RenderJob(bool erase, bool usekuiserver, int pid, const QString &renderer, const QString &profile, const QString &rendermodule, const QString &player, const QString &scenelist, const QString &dest, const QStringList &preargs, const QStringList &args, int in = -1, int out = -1);
~RenderJob();
void setLocale(const QString &locale);
......@@ -45,7 +44,7 @@ private slots:
void slotIsOver(QProcess::ExitStatus status, bool isWritable = true);
void receivedStderr();
void slotAbort();
void slotAbort(const QString& url);
void slotAbort(const QString &url);
void slotCheckProcess(QProcess::ProcessState state);
private:
......@@ -54,8 +53,8 @@ private:
int m_progress;
QString m_prog;
QString m_player;
QDBusInterface* m_jobUiserver;
QDBusInterface* m_kdenliveinterface;
QDBusInterface *m_jobUiserver;
QDBusInterface *m_kdenliveinterface;
bool m_usekuiserver;
/** @brief Used to create a temporary file for logging. */
QFile m_logfile;
......@@ -65,7 +64,7 @@ private:
/** @brief The process id of the Kdenlive instance, used to get the dbus service. */
int m_pid;
bool m_dualpass;
QProcess* m_renderProcess;
QProcess *m_renderProcess;
QString m_errorMessage;
QList<QVariant> m_dbusargs;
QTime m_startTime;
......
......@@ -33,21 +33,18 @@
#include <mlt++/Mlt.h>
#include "iecscale.h"
// Code borrowed from Shotcut's audiospectum by Brian Matherly <code@brianmatherly.com> (GPL)
static const int WINDOW_SIZE = 8000; // 6 Hz FFT bins at 48kHz
struct band
{
struct band {
float low; // Low frequency
float high; // High frequency
const char* label;
const char *label;
};
// Preferred frequencies from ISO R 266-1997 / ANSI S1.6-1984
static const band BAND_TAB[] =
{
static const band BAND_TAB[] = {
// Low Preferred High Band
// Freq Center Freq Label Num
{ 1.12, 1.25, 1.41, "1.25" }, // 1
......@@ -99,12 +96,11 @@ static const int FIRST_AUDIBLE_BAND_INDEX = 12;
static const int LAST_AUDIBLE_BAND_INDEX = 42;
static const int AUDIBLE_BAND_COUNT = LAST_AUDIBLE_BAND_INDEX - FIRST_AUDIBLE_BAND_INDEX + 1;
EqualizerWidget::EqualizerWidget(QWidget *parent) : QWidget(parent)
{
QGridLayout *box = new QGridLayout(this);
QStringList labels;
labels << i18n("Master") << "50Hz" << "100Hz"<<"156Hz"<<"220Hz"<<"311Hz"<<"440Hz"<<"622Hz"<<"880Hz"<<"1.25kHz"<<"1.75kHz"<<"2.5kHz"<<"3.5kHz"<<"5kHz"<<"10kHz"<<"20kHz";
labels << i18n("Master") << "50Hz" << "100Hz" << "156Hz" << "220Hz" << "311Hz" << "440Hz" << "622Hz" << "880Hz" << "1.25kHz" << "1.75kHz" << "2.5kHz" << "3.5kHz" << "5kHz" << "10kHz" << "20kHz";
for (int i = 0; i < 16; i++) {
QSlider *sl = new QSlider(Qt::Vertical, this);
sl->setObjectName(QString::number(i));
......@@ -127,18 +123,20 @@ AudioGraphWidget::AudioGraphWidget(QWidget *parent) : QWidget(parent)
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
}
void AudioGraphWidget::showAudio(const QVector<double>&bands)
void AudioGraphWidget::showAudio(const QVector<double> &bands)
{
m_levels = bands;
update();
}
void AudioGraphWidget::drawDbLabels(QPainter& p, const QRect &rect)
void AudioGraphWidget::drawDbLabels(QPainter &p, const QRect &rect)
{
int dbLabelCount = m_dbLabels.size();
int textHeight = fontMetrics().ascent();
if (dbLabelCount == 0) return;
if (dbLabelCount == 0) {
return;
}
int maxWidth = fontMetrics().width(QStringLiteral("-50"));
// dB scale is vertical along the left side
......@@ -166,12 +164,14 @@ void AudioGraphWidget::drawDbLabels(QPainter& p, const QRect &rect)
}
}
void AudioGraphWidget::drawChanLabels(QPainter& p, const QRect &rect, int barWidth)
void AudioGraphWidget::drawChanLabels(QPainter &p, const QRect &rect, int barWidth)
{
int chanLabelCount = m_freqLabels.size();
int stride = 1;
if (chanLabelCount == 0) return;
if (chanLabelCount == 0) {
return;
}
p.setPen(palette().text().color().rgb());
......@@ -184,13 +184,13 @@ void AudioGraphWidget::drawChanLabels(QPainter& p, const QRect &rect, int barWid
chanLabelWidth = width > chanLabelWidth ? width : chanLabelWidth;
}
int length = rect.width();
while( chanLabelWidth * chanLabelCount / stride > length ) {
while (chanLabelWidth * chanLabelCount / stride > length) {
stride++;
}
int prevX = 0;
int y = rect.bottom();
for (int i = 0; i < chanLabelCount; i+= stride) {
for (int i = 0; i < chanLabelCount; i += stride) {
QString label = m_freqLabels.at(i);
int x = rect.left() + (2 * i) + i * barWidth + barWidth / 2 - fontMetrics().width(label) / 2;
if (x > prevX) {
......@@ -200,7 +200,7 @@ void AudioGraphWidget::drawChanLabels(QPainter& p, const QRect &rect, int barWid
}
}
void AudioGraphWidget::resizeEvent ( QResizeEvent * event )
void AudioGraphWidget::resizeEvent(QResizeEvent *event)
{
drawBackground();
QWidget::resizeEvent(event);
......@@ -209,9 +209,13 @@ void AudioGraphWidget::resizeEvent ( QResizeEvent * event )
void AudioGraphWidget::drawBackground()
{
QSize size(width(), height());
if (!size.isValid()) return;
if (!size.isValid()) {
return;
}
m_pixmap = QPixmap(size);
if (m_pixmap.isNull()) return;
if (m_pixmap.isNull()) {
return;
}
m_pixmap.fill(palette().base().color());
QPainter p(&m_pixmap);
QRect rect(0, 0, width() - 3, height());
......@@ -220,8 +224,9 @@ void AudioGraphWidget::drawBackground()
int offset = fontMetrics().width(QStringLiteral("888")) + 2;
rect.adjust(offset, 0, 0, 0);
int barWidth = (rect.width() - (2 * (AUDIBLE_BAND_COUNT - 1))) / AUDIBLE_BAND_COUNT;
if (barWidth > 0)
if (barWidth > 0) {
drawChanLabels(p, rect, barWidth);
}
rect.adjust(0, 0, 0, -fontMetrics().height());
m_rect = rect;
}
......@@ -231,7 +236,9 @@ void AudioGraphWidget::paintEvent(QPaintEvent *pe)
QPainter p(this);
p.setClipRect(pe->rect());
p.drawPixmap(0, 0, m_pixmap);
if (m_levels.isEmpty()) return;
if (m_levels.isEmpty()) {
return;
}
int chanCount = m_levels.size();
int height = m_rect.height();
int barWidth = (m_rect.width() - (2 * (AUDIBLE_BAND_COUNT - 1))) / AUDIBLE_BAND_COUNT;
......@@ -243,9 +250,9 @@ void AudioGraphWidget::paintEvent(QPaintEvent *pe)
}
AudioGraphSpectrum::AudioGraphSpectrum(MonitorManager *manager, QWidget *parent) : QWidget(parent)
, m_manager(manager)
, m_filter(0)
, m_graphWidget(0)
, m_manager(manager)
, m_filter(0)
, m_graphWidget(0)
{
QVBoxLayout *lay = new QVBoxLayout(this);
m_graphWidget = new AudioGraphWidget(this);
......@@ -287,22 +294,25 @@ AudioGraphSpectrum::~AudioGraphSpectrum()
void AudioGraphSpectrum::refreshPixmap()
{
if (m_graphWidget)
if (m_graphWidget) {
m_graphWidget->drawBackground();
}
}
void AudioGraphSpectrum::processSpectrum(const SharedFrame&frame)
void AudioGraphSpectrum::processSpectrum(const SharedFrame &frame)
{
if (!isVisible()) return;
if (!isVisible()) {
return;
}
mlt_audio_format format = mlt_audio_s16;
int channels = frame.get_audio_channels();
int frequency = frame.get_audio_frequency();
int samples = frame.get_audio_samples();
Mlt::Frame mFrame = frame.clone(true, false, false);
m_filter->process(mFrame);
mFrame.get_audio( format, frequency, channels, samples );
mFrame.get_audio(format, frequency, channels, samples);
QVector<double> bands(AUDIBLE_BAND_COUNT);
float* bins = (float*)m_filter->get_data("bins");
float *bins = (float *)m_filter->get_data("bins");
int bin_count = m_filter->get_int("bin_count");
double bin_width = m_filter->get_double("bin_width");
......@@ -329,7 +339,7 @@ void AudioGraphSpectrum::processSpectrum(const SharedFrame&frame)
break;
}
bands[band] = bins[bin];
} else if (bands[band] < bins[bin] ) {
} else if (bands[band] < bins[bin]) {
// Pick the highest bin level within this band to represent the
// whole band.
bands[band] = bins[bin];
......@@ -340,10 +350,10 @@ void AudioGraphSpectrum::processSpectrum(const SharedFrame&frame)
// band. Convert to dB.
for (band = 0; band < bands.size(); band++) {
double mag = bands[band];
double dB = mag > 0.0 ? 20 * log10( mag ) : -1000.0;
double dB = mag > 0.0 ? 20 * log10(mag) : -1000.0;
bands[band] = dB;
}
// Update the audio signal widget
QMetaObject::invokeMethod(m_graphWidget, "showAudio", Qt::QueuedConnection, Q_ARG(const QVector<double>&, bands));
QMetaObject::invokeMethod(m_graphWidget, "showAudio", Qt::QueuedConnection, Q_ARG(const QVector<double> &, bands));
}
......@@ -34,7 +34,8 @@
#include <QVector>
#include <QPixmap>
namespace Mlt {
namespace Mlt
{
class Filter;
}
......@@ -56,11 +57,11 @@ public:
void drawBackground();
public slots:
void showAudio(const QVector<double>&bands);
void showAudio(const QVector<double> &bands);
protected:
void paintEvent(QPaintEvent *pe);
void resizeEvent(QResizeEvent * event);