Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Fix audiothumb job threading issue and error in argument

parent 3ffc3a7e
......@@ -156,7 +156,7 @@ QVariant AbstractProjectItem::getData(DataType type) const
jobIds = pCore->jobManager()->getFinishedJobsIds(clipId());
}
if (jobIds.size() > 0) {
data = QVariant(pCore->jobManager()->getJobType(jobIds[0]));
data = QVariant::fromValue(pCore->jobManager()->getJobStatus(jobIds[0]));
} else {
data = QVariant::fromValue(JobManagerStatus::NoJob);
}
......
......@@ -492,12 +492,12 @@ public:
}
QString jobText = index.data(AbstractProjectItem::JobMessage).toString();
if (!jobText.isEmpty()) {
QRectF txtBounding = painter->boundingRect(r2, Qt::AlignRight | Qt::AlignVCenter, " " + jobText + " ");
//QRectF txtBounding = painter->boundingRect(r2, Qt::AlignRight | Qt::AlignVCenter, " " + jobText + " ");
painter->setPen(Qt::NoPen);
painter->setBrush(option.palette.highlight());
painter->drawRoundedRect(txtBounding, 2, 2);
//painter->drawRoundedRect(txtBounding, 2, 2);
painter->setPen(option.palette.highlightedText().color());
painter->drawText(txtBounding, Qt::AlignCenter, jobText);
painter->drawText(r2, Qt::AlignCenter, jobText);
}
}
} else {
......@@ -2610,7 +2610,7 @@ void Bin::slotGotFilterJobResults(const QString &id, int startPos, int track, co
ctl->updateEffect(newEffect, effect.attribute(QStringLiteral("kdenlive_ix")).toInt());
emit requestClipShow(currentItem);
// TODO use undo / redo for bin clip edit effect
// /*
//
EditEffectCommand *command = new EditEffectCommand(this, clip->track(), clip->startPos(), effect, newEffect, clip->selectedEffectIndex(),
true, true);
m_commandStack->push(command);
......
......@@ -125,7 +125,6 @@ bool AudioThumbJob::computeWithFFMPEG()
#else
args << QStringLiteral("/dev/stdout");
#endif
args << QStringLiteral("-filter_complex:a");
bool isFFmpeg = KdenliveSettings::ffmpegpath().contains(QLatin1String("ffmpeg"));
args << QStringLiteral("-filter_complex:a");
if (m_channels == 1) {
......@@ -147,11 +146,11 @@ bool AudioThumbJob::computeWithFFMPEG()
<< QStringLiteral("-f") << QStringLiteral("data") << channelFiles[size_t(i)]->fileName();
}
}
m_ffmpegProcess.start(KdenliveSettings::ffmpegpath(), args);
connect(&m_ffmpegProcess, &QProcess::readyReadStandardOutput, this, &AudioThumbJob::updateFfmpegProgress);
m_ffmpegProcess.waitForFinished(-1);
if (m_ffmpegProcess.exitStatus() != QProcess::CrashExit) {
QProcess ffmpegProcess;
ffmpegProcess.start(KdenliveSettings::ffmpegpath(), args);
connect(&ffmpegProcess, &QProcess::readyReadStandardOutput, this, &AudioThumbJob::updateFfmpegProgress);
ffmpegProcess.waitForFinished(-1);
if (ffmpegProcess.exitStatus() != QProcess::CrashExit) {
int dataSize = 0;
std::vector<const qint16 *> rawChannels;
std::vector<QByteArray> sourceChannels;
......@@ -206,24 +205,25 @@ bool AudioThumbJob::computeWithFFMPEG()
m_done = true;
return true;
}
QString err = ffmpegProcess.readAllStandardError();
m_errorMessage += err;
m_errorMessage.append(i18n("Failed to create FFmpeg audio thumbnails, we now try to use MLT"));
return false;
}
void AudioThumbJob::updateFfmpegProgress()
{
QString result = m_ffmpegProcess.readAllStandardOutput();
QProcess *ffmpegProcess = qobject_cast<QProcess *>(QObject::sender());
QString result = ffmpegProcess->readAllStandardOutput();
const QStringList lines = result.split(QLatin1Char('\n'));
for (const QString &data : lines) {
if (data.startsWith(QStringLiteral("out_time_ms"))) {
long ms = data.section(QLatin1Char('='), 1).toLong();
emit jobProgress(ms / m_binClip->duration().ms() * 80.);
emit jobProgress((int) (ms / m_binClip->duration().ms() / 10));
} else {
m_logDetails += data + QStringLiteral("\n");
}
}
QString err = m_ffmpegProcess.readAllStandardError();
m_errorMessage += err;
}
bool AudioThumbJob::startJob()
......
......@@ -69,5 +69,4 @@ private:
bool m_done{false}, m_successful{false};
int m_channels, m_frequency, m_lengthInFrames, m_audioStream;
QVariantList m_audioLevels;
QProcess m_ffmpegProcess;
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment