Merge pull request #303 from olive-editor/debugdialog

rewrote debug message handler
This commit is contained in:
itsmattkc
2019-01-12 00:56:45 +11:00
committed by GitHub
26 changed files with 301 additions and 231 deletions
+37 -21
View File
@@ -3,30 +3,46 @@
#include <QFile>
#include <QDateTime>
#include <QStandardPaths>
#include <QDir>
#ifndef QT_DEBUG
QFile debug_file;
QDebug debug_out(&debug_file);
#endif
#include "dialogs/debugdialog.h"
void setup_debug() {
#ifndef QT_DEBUG
debug_file.setFileName(QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/debug_log");
if (debug_file.open(QFile::WriteOnly)) {
QString debug_intro = "Olive Session " + QString::number(QDateTime::currentMSecsSinceEpoch());
debug_file.write(debug_intro.toUtf8());
} else {
debug_out = QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC).debug();
QString debug_info;
void debug_message_handler(QtMsgType type, const QMessageLogContext &context, const QString &msg) {
QByteArray localMsg = msg.toLocal8Bit();
switch (type) {
case QtDebugMsg:
fprintf(stderr, "[DEBUG] %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
debug_info.prepend(QString("<b>[DEBUG]</b> %1 (%2:%3, %4)<br>").arg(localMsg.constData(), context.file, QString::number(context.line), context.function));
fflush(stderr);
break;
case QtInfoMsg:
fprintf(stderr, "[INFO] %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
debug_info.prepend(QString("<b>[INFO]</b> %1 (%2:%3, %4)<br>").arg(localMsg.constData(), context.file, QString::number(context.line), context.function));
fflush(stderr);
break;
case QtWarningMsg:
fprintf(stderr, "[WARNING] %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
debug_info.prepend(QString("<font color='yellow'><b>[WARNING]</b> %1 (%2:%3, %4)</font><br>").arg(localMsg.constData(), context.file, QString::number(context.line), context.function));
fflush(stderr);
break;
case QtCriticalMsg:
fprintf(stderr, "[ERROR] %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
debug_info.prepend(QString("<font color='red'><b>[ERROR]</b> %1 (%2:%3, %4)</font><br>").arg(localMsg.constData(), context.file, QString::number(context.line), context.function));
fflush(stderr);
break;
case QtFatalMsg:
fprintf(stderr, "[FATAL] %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
debug_info.prepend(QString("<font color='red'><b>[FATAL]</b> %1 (%2:%3, %4)</font><br>").arg(localMsg.constData(), context.file, QString::number(context.line), context.function));
fflush(stderr);
abort();
}
if (debug_dialog->isVisible()) {
QMetaObject::invokeMethod(debug_dialog, "update_log", Qt::QueuedConnection);
}
#endif
}
void close_debug() {
#ifndef QT_DEBUG
if (debug_file.isOpen()) {
debug_file.putChar(10);
debug_file.putChar(10);
debug_file.close();
}
#endif
const QString &get_debug_str() {
return debug_info;
}
+3 -8
View File
@@ -3,14 +3,9 @@
#include <QDebug>
#ifndef QT_DEBUG
#define dout debug_out << "\n"
extern QDebug debug_out;
#else
#define dout qDebug()
#endif
void debug_message_handler(QtMsgType type, const QMessageLogContext &context, const QString &msg);
const QString& get_debug_str();
void setup_debug();
void close_debug();
#define dout qDebug()
#endif // DEBUG_H
+26
View File
@@ -0,0 +1,26 @@
#include "debugdialog.h"
#include <QTextEdit>
#include <QVBoxLayout>
#include "debug.h"
DebugDialog* debug_dialog = NULL;
DebugDialog::DebugDialog(QWidget *parent) : QDialog(parent) {
setWindowTitle("Debug Log");
QVBoxLayout* layout = new QVBoxLayout();
setLayout(layout);
textEdit = new QTextEdit();
layout->addWidget(textEdit);
}
void DebugDialog::update_log() {
textEdit->setHtml(get_debug_str());
}
void DebugDialog::showEvent(QShowEvent *) {
update_log();
}
+21
View File
@@ -0,0 +1,21 @@
#ifndef DEBUGDIALOG_H
#define DEBUGDIALOG_H
#include <QDialog>
class QTextEdit;
class DebugDialog : public QDialog {
Q_OBJECT
public:
DebugDialog(QWidget* parent = 0);
public slots:
void update_log();
protected:
void showEvent(QShowEvent* event);
private:
QTextEdit* textEdit;
};
extern DebugDialog* debug_dialog;
#endif // DEBUGDIALOG_H
+5 -5
View File
@@ -62,8 +62,8 @@ ExportDialog::ExportDialog(QWidget *parent) :
rangeCombobox->setCurrentIndex(0);
if (sequence->using_workarea) {
rangeCombobox->setEnabled(true);
if (sequence->enable_workarea) rangeCombobox->setCurrentIndex(1);
rangeCombobox->setEnabled(true);
if (sequence->enable_workarea) rangeCombobox->setCurrentIndex(1);
}
format_strings.resize(FORMAT_SIZE);
@@ -286,7 +286,7 @@ void ExportDialog::format_changed(int index)
default_acodec = 1;
break;
default:
dout << "[ERROR] Invalid format selection - this is a bug, please inform the developers";
qCritical() << "Invalid format selection - this is a bug, please inform the developers";
}
AVCodec* codec_info;
@@ -388,7 +388,7 @@ void ExportDialog::export_action() {
ext = "tif";
break;
default:
dout << "[ERROR] Invalid codec selection for an image sequence";
qCritical() << "Invalid codec selection for an image sequence";
QMessageBox::critical(this, "Invalid codec", "Couldn't determine output parameters for the selected codec. This is a bug, please contact the developers.", QMessageBox::Ok);
return;
}
@@ -453,7 +453,7 @@ void ExportDialog::export_action() {
}
break;
default:
dout << "[ERROR] Invalid format - this is a bug, please inform the developers";
qCritical() << "Invalid format - this is a bug, please inform the developers";
QMessageBox::critical(this, "Invalid format", "Couldn't determine output format. This is a bug, please contact the developers.", QMessageBox::Ok);
return;
}
+1 -1
View File
@@ -50,7 +50,7 @@ void ToneEffect::process_audio(double timecode_start, double timecode_end, quint
int presin = sinX;
sinX++;
if (sinX < presin) {
dout << "[WARNING] Tone effect overflowed";
qWarning() << "Tone effect overflowed";
}
}
}
+1 -1
View File
@@ -225,7 +225,7 @@ void TransformEffect::process_coords(double timecode, GLTextureCoords& coords, i
glBlendFunc(GL_DST_COLOR, GL_ONE_MINUS_SRC_ALPHA);
break;
default:
dout << "[ERROR] Invalid blend mode. This is a bug - please contact developers";
qCritical() << "Invalid blend mode. This is a bug - please contact developers";
}
// opacity
+3 -3
View File
@@ -36,7 +36,7 @@ extern "C" {
mainWindow->setWindowModified(true);
break;
default:
dout << "[INFO] Plugin requested unhandled opcode" << opcode;
qInfo() << "Plugin requested unhandled opcode" << opcode;
break;
}
}
@@ -60,7 +60,7 @@ void VSTHostWin::loadPlugin() {
modulePtr = LoadLibrary(dll_fn_w);
if(modulePtr == NULL) {
DWORD dll_err = GetLastError();
dout << "[ERROR] Failed to load VST" << dll_fn_w << "-" << dll_err;
qCritical() << "Failed to load VST" << dll_fn_w << "-" << dll_err;
QString msg_err = "Failed to load VST plugin \"" + dll_fn + "\": " + QString::number(dll_err);
if (dll_err == 193) {
#ifdef _WIN64
@@ -92,7 +92,7 @@ bool VSTHostWin::configurePluginCallbacks() {
// If incorrect, then the file either was not loaded properly, is not a
// real VST plugin, or is otherwise corrupt.
if(plugin->magic != kEffectMagic) {
dout << "[ERROR] Plugin's magic number is bad";
qCritical() << "Plugin's magic number is bad";
QMessageBox::critical(mainWindow, "VST Error", "Plugin's magic number is invalid");
return false;
}
+19 -19
View File
@@ -43,10 +43,10 @@ Config::Config()
previous_queue_size(3),
previous_queue_type(FRAME_QUEUE_TYPE_FRAMES),
upcoming_queue_size(0.5),
upcoming_queue_type(FRAME_QUEUE_TYPE_SECONDS),
loop(true),
pause_at_out_point(true),
seek_also_selects(false)
upcoming_queue_type(FRAME_QUEUE_TYPE_SECONDS),
loop(true),
pause_at_out_point(true),
seek_also_selects(false)
{}
void Config::load(QString path) {
@@ -153,20 +153,20 @@ void Config::load(QString path) {
} else if (stream.name() == "UpcomingFrameQueueType") {
stream.readNext();
upcoming_queue_type = stream.text().toInt();
} else if (stream.name() == "Loop") {
stream.readNext();
loop = (stream.text() == "1");
} else if (stream.name() == "PauseAtOutPoint") {
stream.readNext();
pause_at_out_point = (stream.text() == "1");
} else if (stream.name() == "SeekAlsoSelects") {
stream.readNext();
seek_also_selects = (stream.text() == "1");
}
} else if (stream.name() == "Loop") {
stream.readNext();
loop = (stream.text() == "1");
} else if (stream.name() == "PauseAtOutPoint") {
stream.readNext();
pause_at_out_point = (stream.text() == "1");
} else if (stream.name() == "SeekAlsoSelects") {
stream.readNext();
seek_also_selects = (stream.text() == "1");
}
}
}
if (stream.hasError()) {
dout << "[ERROR] Error parsing config XML." << stream.errorString();
qCritical() << "Error parsing config XML." << stream.errorString();
}
f.close();
@@ -176,7 +176,7 @@ void Config::load(QString path) {
void Config::save(QString path) {
QFile f(path);
if (!f.open(QIODevice::WriteOnly)) {
dout << "[ERROR] Could not save configuration";
qCritical() << "Could not save configuration";
return;
}
@@ -218,9 +218,9 @@ void Config::save(QString path) {
stream.writeTextElement("PreviousFrameQueueType", QString::number(previous_queue_type));
stream.writeTextElement("UpcomingFrameQueueSize", QString::number(upcoming_queue_size));
stream.writeTextElement("UpcomingFrameQueueType", QString::number(upcoming_queue_type));
stream.writeTextElement("Loop", QString::number(loop));
stream.writeTextElement("PauseAtOutPoint", QString::number(pause_at_out_point));
stream.writeTextElement("SeekAlsoSelects", QString::number(seek_also_selects));
stream.writeTextElement("Loop", QString::number(loop));
stream.writeTextElement("PauseAtOutPoint", QString::number(pause_at_out_point));
stream.writeTextElement("SeekAlsoSelects", QString::number(seek_also_selects));
stream.writeEndElement(); // configuration
stream.writeEndDocument(); // doc
+51 -51
View File
@@ -27,28 +27,28 @@ extern "C" {
ExportThread::ExportThread() : continueEncode(true) {
surface.create();
fmt_ctx = NULL;
video_stream = NULL;
vcodec = NULL;
vcodec_ctx = NULL;
video_frame = NULL;
sws_frame = NULL;
sws_ctx = NULL;
audio_stream = NULL;
acodec = NULL;
audio_frame = NULL;
swr_frame = NULL;
acodec_ctx = NULL;
swr_ctx = NULL;
fmt_ctx = NULL;
video_stream = NULL;
vcodec = NULL;
vcodec_ctx = NULL;
video_frame = NULL;
sws_frame = NULL;
sws_ctx = NULL;
audio_stream = NULL;
acodec = NULL;
audio_frame = NULL;
swr_frame = NULL;
acodec_ctx = NULL;
swr_ctx = NULL;
vpkt_alloc = false;
apkt_alloc = false;
vpkt_alloc = false;
apkt_alloc = false;
}
bool ExportThread::encode(AVFormatContext* ofmt_ctx, AVCodecContext* codec_ctx, AVFrame* frame, AVPacket* packet, AVStream* stream, bool rescale) {
ret = avcodec_send_frame(codec_ctx, frame);
if (ret < 0) {
dout << "[ERROR] Failed to send frame to encoder." << ret;
qCritical() << "Failed to send frame to encoder." << ret;
ed->export_error = "failed to send frame to encoder (" + QString::number(ret) + ")";
return false;
}
@@ -59,7 +59,7 @@ bool ExportThread::encode(AVFormatContext* ofmt_ctx, AVCodecContext* codec_ctx,
return true;
} else if (ret < 0) {
if (ret != AVERROR_EOF) {
dout << "[ERROR] Failed to receive packet from encoder." << ret;
qCritical() << "Failed to receive packet from encoder." << ret;
ed->export_error = "failed to receive packet from encoder (" + QString::number(ret) + ")";
}
return false;
@@ -80,7 +80,7 @@ bool ExportThread::setupVideo() {
// find video encoder
vcodec = avcodec_find_encoder((enum AVCodecID) video_codec);
if (!vcodec) {
dout << "[ERROR] Could not find video encoder";
qCritical() << "Could not find video encoder";
ed->export_error = "could not video encoder for " + QString::number(video_codec);
return false;
}
@@ -89,7 +89,7 @@ bool ExportThread::setupVideo() {
video_stream = avformat_new_stream(fmt_ctx, vcodec);
video_stream->id = 0;
if (!video_stream) {
dout << "[ERROR] Could not allocate video stream";
qCritical() << "Could not allocate video stream";
ed->export_error = "could not allocate video stream";
return false;
}
@@ -98,7 +98,7 @@ bool ExportThread::setupVideo() {
// vcodec_ctx = video_stream->codec;
vcodec_ctx = avcodec_alloc_context3(vcodec);
if (!vcodec_ctx) {
dout << "[ERROR] Could not allocate video encoding context";
qCritical() << "Could not allocate video encoding context";
ed->export_error = "could not allocate video encoding context";
return false;
}
@@ -135,7 +135,7 @@ bool ExportThread::setupVideo() {
ret = avcodec_open2(vcodec_ctx, vcodec, NULL);
if (ret < 0) {
dout << "[ERROR] Could not open output video encoder." << ret;
qCritical() << "Could not open output video encoder." << ret;
ed->export_error = "could not open output video encoder (" + QString::number(ret) + ")";
return false;
}
@@ -143,7 +143,7 @@ bool ExportThread::setupVideo() {
// copy video encoder parameters to output stream
ret = avcodec_parameters_from_context(video_stream->codecpar, vcodec_ctx);
if (ret < 0) {
dout << "[ERROR] Could not copy video encoder parameters to output stream." << ret;
qCritical() << "Could not copy video encoder parameters to output stream." << ret;
ed->export_error = "could not copy video encoder parameters to output stream (" + QString::number(ret) + ")";
return false;
}
@@ -187,7 +187,7 @@ bool ExportThread::setupAudio() {
// find encoder
acodec = avcodec_find_encoder(static_cast<AVCodecID>(audio_codec));
if (!acodec) {
dout << "[ERROR] Could not find audio encoder";
qCritical() << "Could not find audio encoder";
ed->export_error = "could not audio encoder for " + QString::number(audio_codec);
return false;
}
@@ -196,7 +196,7 @@ bool ExportThread::setupAudio() {
audio_stream = avformat_new_stream(fmt_ctx, acodec);
audio_stream->id = 1;
if (!audio_stream) {
dout << "[ERROR] Could not allocate audio stream";
qCritical() << "Could not allocate audio stream";
ed->export_error = "could not allocate audio stream";
return false;
}
@@ -205,7 +205,7 @@ bool ExportThread::setupAudio() {
// acodec_ctx = audio_stream->codec;
acodec_ctx = avcodec_alloc_context3(acodec);
if (!acodec_ctx) {
dout << "[ERROR] Could not find allocate audio encoding context";
qCritical() << "Could not find allocate audio encoding context";
ed->export_error = "could not allocate audio encoding context";
return false;
}
@@ -230,7 +230,7 @@ bool ExportThread::setupAudio() {
// open encoder
ret = avcodec_open2(acodec_ctx, acodec, NULL);
if (ret < 0) {
dout << "[ERROR] Could not open output audio encoder." << ret;
qCritical() << "Could not open output audio encoder." << ret;
ed->export_error = "could not open output audio encoder (" + QString::number(ret) + ")";
return false;
}
@@ -238,7 +238,7 @@ bool ExportThread::setupAudio() {
// copy params to output stream
ret = avcodec_parameters_from_context(audio_stream->codecpar, acodec_ctx);
if (ret < 0) {
dout << "[ERROR] Could not copy audio encoder parameters to output stream." << ret;
qCritical() << "Could not copy audio encoder parameters to output stream." << ret;
ed->export_error = "could not copy audio encoder parameters to output stream (" + QString::number(ret) + ")";
return false;
}
@@ -268,7 +268,7 @@ bool ExportThread::setupAudio() {
av_frame_make_writable(audio_frame);
ret = av_frame_get_buffer(audio_frame, 0);
if (ret < 0) {
dout << "[ERROR] Could not allocate audio buffer." << ret;
qCritical() << "Could not allocate audio buffer." << ret;
ed->export_error = "could not allocate audio buffer (" + QString::number(ret) + ")";
return false;
}
@@ -290,7 +290,7 @@ bool ExportThread::setupAudio() {
bool ExportThread::setupContainer() {
avformat_alloc_output_context2(&fmt_ctx, NULL, NULL, c_filename);
if (!fmt_ctx) {
dout << "[ERROR] Could not create output context";
qCritical() << "Could not create output context";
ed->export_error = "could not create output format context";
return false;
}
@@ -299,7 +299,7 @@ bool ExportThread::setupContainer() {
ret = avio_open(&fmt_ctx->pb, c_filename, AVIO_FLAG_WRITE);
if (ret < 0) {
dout << "[ERROR] Could not open output file." << ret;
qCritical() << "Could not open output file." << ret;
ed->export_error = "could not open output file (" + QString::number(ret) + ")";
return false;
}
@@ -311,7 +311,7 @@ void ExportThread::run() {
panel_sequence_viewer->pause();
if (!panel_sequence_viewer->viewer_widget->context()->makeCurrent(&surface)) {
dout << "[ERROR] Make current failed";
qCritical() << "Make current failed";
ed->export_error = "could not make OpenGL context current";
return;
}
@@ -330,7 +330,7 @@ void ExportThread::run() {
if (continueEncode) {
ret = avformat_write_header(fmt_ctx, NULL);
if (ret < 0) {
dout << "[ERROR] Could not write output file header." << ret;
qCritical() << "Could not write output file header." << ret;
ed->export_error = "could not write output file header (" + QString::number(ret) + ")";
continueEncode = false;
}
@@ -400,24 +400,24 @@ void ExportThread::run() {
avg_time = (total_time/frame_count);
eta = (remaining_frames*avg_time);
// dout << "[INFO] Encoded frame" << sequence->playhead << "- took" << frame_time << "ms (avg:" << avg_time << "ms, remaining:" << remaining_frames << ", ETA:" << eta << ")";
// qInfo() << "Encoded frame" << sequence->playhead << "- took" << frame_time << "ms (avg:" << avg_time << "ms, remaining:" << remaining_frames << ", ETA:" << eta << ")";
emit progress_changed(qRound(((double) (sequence->playhead-start_frame) / (double) (end_frame-start_frame)) * 100), eta);
sequence->playhead++;
frame_count++;
}
if (continueEncode) {
if (video_enabled) vpkt_alloc = true;
if (audio_enabled) apkt_alloc = true;
}
if (continueEncode) {
if (video_enabled) vpkt_alloc = true;
if (audio_enabled) apkt_alloc = true;
}
panel_sequence_viewer->viewer_widget->default_fbo = NULL;
rendering = false;
fbo.release();
if (audio_enabled && continueEncode) {
if (audio_enabled && continueEncode) {
// flush swresample
do {
swr_convert_frame(swr_ctx, swr_frame, NULL);
@@ -439,7 +439,7 @@ void ExportThread::run() {
ret = av_write_trailer(fmt_ctx);
if (ret < 0) {
dout << "[ERROR] Could not write output file trailer." << ret;
qCritical() << "Could not write output file trailer." << ret;
ed->export_error = "could not write output file trailer (" + QString::number(ret) + ")";
continueEncode = false;
}
@@ -449,19 +449,19 @@ void ExportThread::run() {
avio_closep(&fmt_ctx->pb);
if (vpkt_alloc) av_packet_unref(&video_pkt);
if (video_frame != NULL) av_frame_free(&video_frame);
if (vcodec_ctx != NULL) {
avcodec_close(vcodec_ctx);
avcodec_free_context(&vcodec_ctx);
}
if (vpkt_alloc) av_packet_unref(&video_pkt);
if (video_frame != NULL) av_frame_free(&video_frame);
if (vcodec_ctx != NULL) {
avcodec_close(vcodec_ctx);
avcodec_free_context(&vcodec_ctx);
}
if (apkt_alloc) av_packet_unref(&audio_pkt);
if (audio_frame != NULL) av_frame_free(&audio_frame);
if (acodec_ctx != NULL) {
avcodec_close(acodec_ctx);
avcodec_free_context(&acodec_ctx);
}
if (apkt_alloc) av_packet_unref(&audio_pkt);
if (audio_frame != NULL) av_frame_free(&audio_frame);
if (acodec_ctx != NULL) {
avcodec_close(acodec_ctx);
avcodec_free_context(&acodec_ctx);
}
avformat_free_context(fmt_ctx);
+10 -10
View File
@@ -209,19 +209,19 @@ bool LoadThread::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
if (QFileInfo::exists(proj_dir_test)) { // if path is relative to the project's current dir
m->url = proj_dir_test;
dout << "[INFO] Matched" << attr.value().toString() << "relative to project's current directory";
qInfo() << "Matched" << attr.value().toString() << "relative to project's current directory";
} else if (QFileInfo::exists(internal_proj_dir_test)) { // if path is relative to the last directory the project was saved in
m->url = internal_proj_dir_test;
dout << "[INFO] Matched" << attr.value().toString() << "relative to project's internal directory";
qInfo() << "Matched" << attr.value().toString() << "relative to project's internal directory";
} else if (m->url.contains('%')) {
// hack for image sequences (qt won't be able to find the URL with %, but ffmpeg may)
m->url = internal_proj_dir_test;
dout << "[INFO] Guess image sequence" << attr.value().toString() << "path to project's internal directory";
qInfo() << "Guess image sequence" << attr.value().toString() << "path to project's internal directory";
} else {
dout << "[INFO] Failed to match" << attr.value().toString() << "to file";
qInfo() << "Failed to match" << attr.value().toString() << "to file";
}
} else {
dout << "[INFO] Matched" << attr.value().toString() << "with absolute path";
qInfo() << "Matched" << attr.value().toString() << "with absolute path";
}
} else if (attr.name() == "duration") {
m->length = attr.value().toLongLong();
@@ -273,8 +273,8 @@ bool LoadThread::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
open_seq = s;
} else if (attr.name() == "workarea") {
s->using_workarea = (attr.value() == "1");
} else if (attr.name() == "workareaEnabled") {
s->enable_workarea = (attr.value() == "1");
} else if (attr.name() == "workareaEnabled") {
s->enable_workarea = (attr.value() == "1");
} else if (attr.name() == "workareaIn") {
s->workarea_in = attr.value().toLong();
} else if (attr.name() == "workareaOut") {
@@ -471,7 +471,7 @@ bool LoadThread::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
}
const EffectMeta* meta = get_meta_from_name(td.name);
if (meta == NULL) {
dout << "[WARNING] Failed to link transition with name:" << td.name;
qWarning() << "Failed to link transition with name:" << td.name;
if (td.otc != NULL) td.otc->opening_transition = -1;
if (td.ctc != NULL) td.ctc->closing_transition = -1;
} else {
@@ -514,7 +514,7 @@ void LoadThread::run() {
QFile file(project_url);
if (!file.open(QIODevice::ReadOnly)) {
dout << "[ERROR] Could not open file";
qCritical() << "Could not open file";
return;
}
@@ -623,7 +623,7 @@ void LoadThread::cancel() {
void LoadThread::error_func() {
if (xml_error) {
dout << "[ERROR] Error parsing XML." << error_str;
qCritical() << "Error parsing XML." << error_str;
QMessageBox::critical(mainWindow, "XML Parsing Error", "Couldn't load '" + project_url + "'. " + error_str, QMessageBox::Ok);
} else {
QMessageBox::critical(mainWindow, "Project Load Error", "Error loading project: " + error_str, QMessageBox::Ok);
+3 -3
View File
@@ -53,7 +53,7 @@ void PreviewGenerator::parse_media() {
for (int i=0;i<(int)fmt_ctx->nb_streams;i++) {
// Find the decoder for the video stream
if (avcodec_find_decoder(fmt_ctx->streams[i]->codecpar->codec_id) == NULL) {
dout << "[ERROR] Unsupported codec in stream" << i << "of file" << footage->name;
qCritical() << "Unsupported codec in stream" << i << "of file" << footage->name;
} else {
FootageStream ms;
ms.preview_done = false;
@@ -253,13 +253,13 @@ void PreviewGenerator::generate_waveform() {
if (read_ret < 0) {
end_of_file = true;
if (read_ret != AVERROR_EOF) dout << "[ERROR] Failed to read packet for preview generation" << read_ret;
if (read_ret != AVERROR_EOF) qCritical() << "Failed to read packet for preview generation" << read_ret;
break;
}
if (codec_ctx[packet->stream_index] != NULL) {
int send_ret = avcodec_send_packet(codec_ctx[packet->stream_index], packet);
if (send_ret < 0 && send_ret != AVERROR(EAGAIN)) {
dout << "[ERROR] Failed to send packet for preview generation - aborting" << send_ret;
qCritical() << "Failed to send packet for preview generation - aborting" << send_ret;
end_of_file = true;
break;
}
+5 -2
View File
@@ -1,6 +1,7 @@
#include "mainwindow.h"
#include <QApplication>
#include <QDebug>
#include "debug.h"
extern "C" {
#include <libavformat/avformat.h>
@@ -18,12 +19,14 @@ int main(int argc, char *argv[]) {
bool launch_fullscreen = false;
QString load_proj;
qInstallMessageHandler(debug_message_handler);
if (argc > 1) {
for (int i=1;i<argc;i++) {
if (argv[i][0] == '-') {
if (!strcmp(argv[1], "--version") || !strcmp(argv[1], "-v")) {
#ifndef GITHASH
printf("[WARNING] No Git commit information found\n");
qWarning() << "No Git commit information found";
#endif
printf("%s\n", appName.toUtf8().constData());
return 0;
+21 -14
View File
@@ -28,6 +28,7 @@
#include "dialogs/demonotice.h"
#include "dialogs/speeddialog.h"
#include "dialogs/actionsearch.h"
#include "dialogs/debugdialog.h"
#include "playback/audio.h"
#include "playback/playback.h"
@@ -93,11 +94,10 @@ void MainWindow::setup_layout(bool reset) {
MainWindow::MainWindow(QWidget *parent, const QString &an) :
QMainWindow(parent),
appName(an)
appName(an),
enable_launch_with_project(false)
{
enable_launch_with_project = false;
setup_debug();
debug_dialog = new DebugDialog(this);
mainWindow = this;
@@ -154,7 +154,7 @@ MainWindow::MainWindow(QWidget *parent, const QString &an) :
if (QFile(file_name).remove()) deleted_ars++;
}
}
if (deleted_ars > 0) dout << "[INFO] Deleted" << deleted_ars << "autorecovery" << ((deleted_ars == 1) ? "file that was" : "files that were") << "older than 7 days";
if (deleted_ars > 0) qInfo() << "Deleted" << deleted_ars << "autorecovery" << ((deleted_ars == 1) ? "file that was" : "files that were") << "older than 7 days";
// delete previews older than 30 days
QDir preview_dir = QDir(data_dir + "/previews");
@@ -168,7 +168,7 @@ MainWindow::MainWindow(QWidget *parent, const QString &an) :
if (QFile(file_name).remove()) deleted_ars++;
}
}
if (deleted_ars > 0) dout << "[INFO] Deleted" << deleted_ars << "preview" << ((deleted_ars == 1) ? "file that was" : "files that were") << "last read over 30 days ago";
if (deleted_ars > 0) qInfo() << "Deleted" << deleted_ars << "preview" << ((deleted_ars == 1) ? "file that was" : "files that were") << "last read over 30 days ago";
}
// search for open recents list
@@ -227,7 +227,6 @@ MainWindow::MainWindow(QWidget *parent, const QString &an) :
MainWindow::~MainWindow() {
free_panels();
close_debug();
}
void MainWindow::launch_with_project(const QString& s) {
@@ -327,7 +326,7 @@ void MainWindow::save_shortcuts(const QString& fn) {
shortcut_file_io.write(shortcut_file);
shortcut_file_io.close();
} else {
dout << "[ERROR] Failed to save shortcut file";
qCritical() << "Failed to save shortcut file";
}
}
@@ -336,6 +335,10 @@ void MainWindow::show_about() {
a.exec();
}
void MainWindow::show_debug_log() {
debug_dialog->show();
}
void MainWindow::delete_slot() {
if (panel_timeline->headers->hasFocus()) {
panel_timeline->headers->delete_markers();
@@ -479,7 +482,7 @@ void MainWindow::new_project() {
void MainWindow::autorecover_interval() {
if (!rendering && isWindowModified()) {
panel_project->save_project(true);
dout << "[INFO] Auto-recovery project saved";
qInfo() << "Auto-recovery project saved";
}
}
@@ -783,9 +786,9 @@ void MainWindow::setup_menus() {
edit_tool_selects_links->setCheckable(true);
edit_tool_selects_links->setData(reinterpret_cast<quintptr>(&config.edit_tool_selects_links));
seek_also_selects = tools_menu->addAction("Seek Also Selects", this, SLOT(toggle_bool_action()));
seek_also_selects->setCheckable(true);
seek_also_selects->setData(reinterpret_cast<quintptr>(&config.seek_also_selects));
seek_also_selects = tools_menu->addAction("Seek Also Selects", this, SLOT(toggle_bool_action()));
seek_also_selects->setCheckable(true);
seek_also_selects->setData(reinterpret_cast<quintptr>(&config.seek_also_selects));
seek_to_end_of_pastes = tools_menu->addAction("Seek to the End of Pastes", this, SLOT(toggle_bool_action()));
seek_to_end_of_pastes->setCheckable(true);
@@ -861,6 +864,10 @@ void MainWindow::setup_menus() {
help_menu->addSeparator();
help_menu->addAction("Debug Log", this, SLOT(show_debug_log()));
help_menu->addSeparator();
help_menu->addAction("&About...", this, SLOT(show_about()));
load_shortcuts(get_config_path() + "/shortcuts", true);
@@ -913,7 +920,7 @@ void MainWindow::closeEvent(QCloseEvent *e) {
panel_config.write(saveState(0));
panel_config.close();
} else {
dout << "[ERROR] Failed to save layout";
qCritical() << "Failed to save layout";
}
save_shortcuts(config_dir + "/shortcuts");
@@ -1131,7 +1138,7 @@ void MainWindow::toolMenu_About_To_Be_Shown() {
set_bool_action_checked(set_name_and_marker);
set_bool_action_checked(loop_action);
set_bool_action_checked(pause_at_out_point_action);
set_bool_action_checked(seek_also_selects);
set_bool_action_checked(seek_also_selects);
set_int_action_checked(no_autoscroll, config.autoscroll);
set_int_action_checked(page_autoscroll, config.autoscroll);
+2 -1
View File
@@ -43,6 +43,7 @@ private slots:
void clear_undo_stack();
void show_about();
void show_debug_log();
void delete_slot();
void select_all();
@@ -181,7 +182,7 @@ private:
QAction* set_name_and_marker;
QAction* loop_action;
QAction* pause_at_out_point_action;
QAction* seek_also_selects;
QAction* seek_also_selects;
// edit menu actions
QAction* undo_action;
+4 -2
View File
@@ -121,7 +121,8 @@ SOURCES += \
ui/embeddedfilechooser.cpp \
effects/internal/fillleftrighteffect.cpp \
effects/internal/voideffect.cpp \
dialogs/texteditdialog.cpp
dialogs/texteditdialog.cpp \
dialogs/debugdialog.cpp
HEADERS += \
mainwindow.h \
@@ -212,7 +213,8 @@ HEADERS += \
ui/embeddedfilechooser.h \
effects/internal/fillleftrighteffect.h \
effects/internal/voideffect.h \
dialogs/texteditdialog.h
dialogs/texteditdialog.h \
dialogs/debugdialog.h
FORMS +=
+7 -7
View File
@@ -45,7 +45,7 @@ EffectControls::EffectControls(QWidget *parent) :
headers->viewer = panel_sequence_viewer;
headers->snapping = false;
effects_area->parent_widget = scrollArea;
effects_area->parent_widget = scrollArea;
effects_area->keyframe_area = keyframeView;
effects_area->header = headers;
keyframeView->header = headers;
@@ -260,9 +260,9 @@ void EffectControls::open_effect(QVBoxLayout* layout, Effect* e) {
void EffectControls::setup_ui() {
QWidget* contents = new QWidget();
QHBoxLayout* hlayout = new QHBoxLayout(contents);
hlayout->setSpacing(0);
hlayout->setMargin(0);
QHBoxLayout* hlayout = new QHBoxLayout(contents);
hlayout->setSpacing(0);
hlayout->setMargin(0);
QSplitter* splitter = new QSplitter(contents);
splitter->setOrientation(Qt::Horizontal);
@@ -431,7 +431,7 @@ void EffectControls::setup_ui() {
splitter->addWidget(keyframeArea);
hlayout->addWidget(splitter);
hlayout->addWidget(splitter);
setWidget(contents);
}
@@ -540,14 +540,14 @@ bool EffectControls::is_focused() {
}
}
} else {
dout << "[WARNING] Tried to check focus of a NULL clip";
qWarning() << "Tried to check focus of a NULL clip";
}
}
return false;
}
EffectsArea::EffectsArea(QWidget* parent) :
QWidget(parent)
QWidget(parent)
{}
void EffectsArea::resizeEvent(QResizeEvent*) {
+15 -16
View File
@@ -283,7 +283,6 @@ void Project::duplicate_selected() {
bool duped = false;
ComboAction* ca = new ComboAction();
for (int j=0;j<items.size();j++) {
dout << "duplicate called";
Media* i = item_to_media(items.at(j));
if (i->get_type() == MEDIA_TYPE_SEQUENCE) {
new_sequence(ca, i->to_sequence()->copy(), false, item_to_media(items.at(j).parent()));
@@ -394,9 +393,9 @@ bool Project::is_focused() {
}
Media* Project::new_folder(QString name) {
Media* item = new Media(0);
Media* item = new Media(0);
item->set_folder();
item->set_name(name);
item->set_name(name);
return item;
}
@@ -528,7 +527,7 @@ void Project::delete_selected_media() {
// remove
if (remove) {
panel_effect_controls->clear_effects(true);
if (sequence != NULL) sequence->selections.clear();
if (sequence != NULL) sequence->selections.clear();
// remove media and parents
for (int m=0;m<parents.size();m++) {
@@ -723,7 +722,7 @@ void Project::process_file_list(QStringList& files, bool recursive, Media* repla
m->url = file;
m->name = get_file_name_from_path(files.at(i));
item->set_footage(m);
item->set_footage(m);
last_imported_media.append(item);
@@ -731,7 +730,7 @@ void Project::process_file_list(QStringList& files, bool recursive, Media* repla
if (create_undo_action) {
ca->append(new AddMediaCommand(item, parent));
} else {
parent->appendChild(item);
parent->appendChild(item);
// project_model.appendChild(parent, item);
}
}
@@ -741,13 +740,13 @@ void Project::process_file_list(QStringList& files, bool recursive, Media* repla
}
}
if (create_undo_action) {
if (imported) {
undo_stack.push(ca);
if (imported) {
undo_stack.push(ca);
for (int i=0;i<last_imported_media.size();i++) {
// generate waveform/thumbnail in another thread
start_preview_generator(last_imported_media.at(i), replace != NULL);
}
for (int i=0;i<last_imported_media.size();i++) {
// generate waveform/thumbnail in another thread
start_preview_generator(last_imported_media.at(i), replace != NULL);
}
} else {
delete ca;
}
@@ -948,8 +947,8 @@ void Project::save_folder(QXmlStreamWriter& stream, int type, bool set_ids_only,
if (s == sequence) {
stream.writeAttribute("open", "1");
}
stream.writeAttribute("workarea", QString::number(s->using_workarea));
stream.writeAttribute("workareaEnabled", QString::number(s->enable_workarea));
stream.writeAttribute("workarea", QString::number(s->using_workarea));
stream.writeAttribute("workareaEnabled", QString::number(s->enable_workarea));
stream.writeAttribute("workareaIn", QString::number(s->workarea_in));
stream.writeAttribute("workareaOut", QString::number(s->workarea_out));
@@ -1042,7 +1041,7 @@ void Project::save_project(bool autorecovery) {
QFile file(autorecovery ? autorecovery_filename : project_url);
if (!file.open(QIODevice::WriteOnly/* | QIODevice::Text*/)) {
dout << "[ERROR] Could not open file";
qCritical() << "Could not open file";
return;
}
@@ -1122,7 +1121,7 @@ void Project::save_recent_projects() {
}
f.close();
} else {
dout << "[WARNING] Could not save recent projects";
qWarning() << "Could not save recent projects";
}
}
+1 -1
View File
@@ -328,7 +328,7 @@ void Viewer::play() {
reset_all_audio();
if (is_recording_cued() && !start_recording()) {
dout << "[ERROR] Failed to record audio";
qCritical() << "Failed to record audio";
return;
}
playhead_start = seq->playhead;
+10 -10
View File
@@ -55,18 +55,18 @@ void init_audio() {
QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice());
QList<QAudioDeviceInfo> devs = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput);
dout << "[INFO] Found the following audio devices:";
qInfo() << "Found the following audio devices:";
for (int i=0;i<devs.size();i++) {
dout << " " << devs.at(i).deviceName();
}
if (info.isNull() && devs.size() > 0) {
dout << "[WARNING] Default audio returned NULL, attempting to use first device found...";
qWarning() << "Default audio returned NULL, attempting to use first device found...";
info = devs.at(0);
}
dout << "[INFO] Using audio device" << info.deviceName();
qInfo() << "Using audio device" << info.deviceName();
if (!info.isFormatSupported(audio_format)) {
qWarning() << "[WARNING] Audio format is not supported by backend, using nearest";
qWarning() << "Audio format is not supported by backend, using nearest";
audio_format = info.nearestFormat(audio_format);
}
@@ -77,7 +77,7 @@ void init_audio() {
// connect
audio_io_device = audio_output->start();
if (audio_io_device == NULL) {
dout << "[WARNING] Received NULL audio device. No compatible audio output was found.";
qWarning() << "Received NULL audio device. No compatible audio output was found.";
} else {
audio_device_set = true;
@@ -115,7 +115,7 @@ int get_buffer_offset_from_frame(double framerate, long frame) {
if (frame >= audio_ibuffer_frame) {
return qFloor(((double) (frame - audio_ibuffer_frame)/framerate)*current_audio_freq())*av_get_bytes_per_sample(AV_SAMPLE_FMT_S16)*av_get_channel_layout_nb_channels(AV_CH_LAYOUT_STEREO);
} else {
dout << "[WARNING] Invalid values passed to get_buffer_offset_from_frame";
qWarning() << "Invalid values passed to get_buffer_offset_from_frame";
return 0;
}
}
@@ -288,14 +288,14 @@ void write_wave_trailer(QFile& f) {
bool start_recording() {
if (sequence == NULL) {
dout << "[ERROR] No active sequence to record into";
qCritical() << "No active sequence to record into";
return false;
}
QString audio_path = project_url + " Audio";
QDir audio_dir(audio_path);
if (!audio_dir.exists() && !audio_dir.mkpath(".")) {
dout << "[ERROR] Failed to create audio directory";
qCritical() << "Failed to create audio directory";
return false;
}
@@ -308,7 +308,7 @@ bool start_recording() {
output_recording.setFileName(audio_filename);
if (!output_recording.open(QFile::WriteOnly)) {
dout << "[ERROR] Failed to open output file. Does Olive have permission to write to this directory?";
qCritical() << "Failed to open output file. Does Olive have permission to write to this directory?";
return false;
}
@@ -318,7 +318,7 @@ bool start_recording() {
}
QAudioDeviceInfo info = QAudioDeviceInfo::defaultInputDevice();
if (!info.isFormatSupported(audio_format)) {
dout << "[WARNING] Default format not supported, using nearest";
qWarning() << "Default format not supported, using nearest";
audio_format = info.nearestFormat(audio_format);
}
write_wave_header(output_recording, audio_format);
+18 -18
View File
@@ -168,7 +168,7 @@ void cache_audio_worker(Clip* c, bool scrubbing, QVector<Clip*>& nests) {
ret = retrieve_next_frame(c, c->frame);
if (ret >= 0) {
if ((ret = av_buffersrc_add_frame_flags(c->buffersrc_ctx, c->frame, AV_BUFFERSRC_FLAG_KEEP_REF)) < 0) {
dout << "[ERROR] Could not feed filtergraph -" << ret;
qCritical() << "Could not feed filtergraph -" << ret;
break;
}
} else {
@@ -182,7 +182,7 @@ void cache_audio_worker(Clip* c, bool scrubbing, QVector<Clip*>& nests) {
} else {
}
} else {
dout << "[WARNING] Raw audio frame data could not be retrieved." << ret;
qWarning() << "Raw audio frame data could not be retrieved." << ret;
c->reached_end = true;
}
break;
@@ -191,7 +191,7 @@ void cache_audio_worker(Clip* c, bool scrubbing, QVector<Clip*>& nests) {
if (ret < 0) {
if (ret != AVERROR_EOF) {
dout << "[ERROR] Could not pull from filtergraph";
qCritical() << "Could not pull from filtergraph";
c->reached_end = true;
break;
} else {
@@ -356,7 +356,7 @@ void cache_audio_worker(Clip* c, bool scrubbing, QVector<Clip*>& nests) {
}
} else {
// shouldn't ever get here
dout << "[ERROR] Tried to cache a non-footage/tone clip";
qCritical() << "Tried to cache a non-footage/tone clip";
return;
}
@@ -478,7 +478,7 @@ void cache_video_worker(Clip* c, long playhead) {
if (send_it) {
if ((send_ret = av_buffersrc_add_frame_flags(c->buffersrc_ctx, send_frame, AV_BUFFERSRC_FLAG_KEEP_REF)) < 0) {
dout << "[ERROR] Failed to add frame to buffer source." << send_ret;
qCritical() << "Failed to add frame to buffer source." << send_ret;
break;
}
}
@@ -488,7 +488,7 @@ void cache_video_worker(Clip* c, long playhead) {
if (read_ret == AVERROR_EOF) {
c->reached_end = true;
} else {
dout << "[ERROR] Failed to read frame." << read_ret;
qCritical() << "Failed to read frame." << read_ret;
}
break;
}
@@ -498,7 +498,7 @@ void cache_video_worker(Clip* c, long playhead) {
if (retr_ret == AVERROR_EOF) {
c->reached_end = true;
} else {
dout << "[ERROR] Failed to retrieve frame from buffersink." << retr_ret;
qCritical() << "Failed to retrieve frame from buffersink." << retr_ret;
}
av_frame_free(&frame);
break;
@@ -577,7 +577,7 @@ void reset_cache(Clip* c, long target_frame) {
av_frame_unref(c->frame);
int ret = retrieve_next_frame(c, c->frame);
if (ret < 0) {
dout << "[WARNING] Seeking terminated prematurely";
qWarning() << "Seeking terminated prematurely";
break;
}
if (c->frame->pts <= target_ts) {
@@ -635,7 +635,7 @@ void open_clip_worker(Clip* clip) {
clip->frame->nb_samples = 2048;
av_frame_make_writable(clip->frame);
if (av_frame_get_buffer(clip->frame, 0)) {
dout << "[ERROR] Could not allocate buffer for tone clip";
qCritical() << "Could not allocate buffer for tone clip";
}
clip->audio_reset = true;
}
@@ -655,7 +655,7 @@ void open_clip_worker(Clip* clip) {
if (errCode != 0) {
char err[1024];
av_strerror(errCode, err, 1024);
dout << "[ERROR] Could not open" << filename << "-" << err;
qCritical() << "Could not open" << filename << "-" << err;
return;
}
@@ -663,7 +663,7 @@ void open_clip_worker(Clip* clip) {
if (errCode < 0) {
char err[1024];
av_strerror(errCode, err, 1024);
dout << "[ERROR] Could not open" << filename << "-" << err;
qCritical() << "Could not open" << filename << "-" << err;
return;
}
@@ -709,13 +709,13 @@ void open_clip_worker(Clip* clip) {
// Open codec
if (avcodec_open2(clip->codecCtx, clip->codec, &clip->opts) < 0) {
dout << "[ERROR] Could not open codec";
qCritical() << "Could not open codec";
}
// allocate filtergraph
clip->filter_graph = avfilter_graph_alloc();
if (clip->filter_graph == NULL) {
dout << "[ERROR] Could not create filtergraph";
qCritical() << "Could not create filtergraph";
}
char filter_args[512];
@@ -807,12 +807,12 @@ void open_clip_worker(Clip* clip) {
enum AVSampleFormat sample_fmts[] = { sample_format, static_cast<AVSampleFormat>(-1) };
if (av_opt_set_int_list(clip->buffersink_ctx, "sample_fmts", sample_fmts, -1, AV_OPT_SEARCH_CHILDREN) < 0) {
dout << "[ERROR] Could not set output sample format";
qCritical() << "Could not set output sample format";
}
int64_t channel_layouts[] = { AV_CH_LAYOUT_STEREO, static_cast<AVSampleFormat>(-1) };
if (av_opt_set_int_list(clip->buffersink_ctx, "channel_layouts", channel_layouts, -1, AV_OPT_SEARCH_CHILDREN) < 0) {
dout << "[ERROR] Could not set output sample format";
qCritical() << "Could not set output sample format";
}
int target_sample_rate = current_audio_freq();
@@ -858,7 +858,7 @@ void open_clip_worker(Clip* clip) {
int sample_rates[] = { target_sample_rate, 0 };
if (av_opt_set_int_list(clip->buffersink_ctx, "sample_rates", sample_rates, 0, AV_OPT_SEARCH_CHILDREN) < 0) {
dout << "[ERROR] Could not set output sample rates";
qCritical() << "Could not set output sample rates";
}
avfilter_graph_config(clip->filter_graph, NULL);
@@ -875,7 +875,7 @@ void open_clip_worker(Clip* clip) {
clip->finished_opening = true;
dout << "[INFO] Clip opened on track" << clip->track;
qInfo() << "Clip opened on track" << clip->track;
}
void cache_clip_worker(Clip* clip, long playhead, bool reset, bool scrubbing, QVector<Clip*> nests) {
@@ -918,7 +918,7 @@ void close_clip_worker(Clip* clip) {
clip->reset();
dout << "[INFO] Clip closed on track" << clip->track;
qInfo() << "Clip closed on track" << clip->track;
}
void Cacher::run() {
+5 -5
View File
@@ -243,7 +243,7 @@ void get_clip_frame(Clip* c, long playhead) {
if (target_frame == NULL || reset) {
// reset cache
texture_failed = true;
dout << "[INFO] Frame queue couldn't keep up - either the user seeked or the system is overloaded (queue size:" << c->queue.size() << ")";
qInfo() << "Frame queue couldn't keep up - either the user seeked or the system is overloaded (queue size:" << c->queue.size() << ")";
}
if (target_frame != NULL) {
@@ -325,24 +325,24 @@ int retrieve_next_frame(Clip* c, AVFrame* f) {
if (read_ret >= 0) {
int send_ret = avcodec_send_packet(c->codecCtx, c->pkt);
if (send_ret < 0) {
dout << "[ERROR] Failed to send packet to decoder." << send_ret;
qCritical() << "Failed to send packet to decoder." << send_ret;
return send_ret;
}
} else {
if (read_ret == AVERROR_EOF) {
int send_ret = avcodec_send_packet(c->codecCtx, NULL);
if (send_ret < 0) {
dout << "[ERROR] Failed to send packet to decoder." << send_ret;
qCritical() << "Failed to send packet to decoder." << send_ret;
return send_ret;
}
} else {
dout << "[ERROR] Could not read frame." << read_ret;
qCritical() << "Could not read frame." << read_ret;
return read_ret; // skips trying to find a frame at all
}
}
}
if (receive_ret < 0) {
if (receive_ret != AVERROR_EOF) dout << "[ERROR] Failed to receive packet from decoder." << receive_ret;
if (receive_ret != AVERROR_EOF) qCritical() << "Failed to receive packet from decoder." << receive_ret;
result = receive_ret;
}
+21 -21
View File
@@ -69,7 +69,7 @@ Effect* create_effect(Clip* c, const EffectMeta* em) {
#endif
}
} else {
dout << "[ERROR] Invalid effect data";
qCritical() << "Invalid effect data";
QMessageBox::critical(mainWindow, "Invalid effect", "No candidate for effect '" + em->name + "'. This effect may be corrupt. Try reinstalling it or Olive.");
}
return NULL;
@@ -192,7 +192,7 @@ void load_shader_effects() {
for (int i=0;i<entries.size();i++) {
QFile file(effects_path + "/" + entries.at(i));
if (!file.open(QIODevice::ReadOnly)) {
dout << "[ERROR] Could not open" << entries.at(i);
qCritical() << "Could not open" << entries.at(i);
return;
}
@@ -220,7 +220,7 @@ void load_shader_effects() {
em.internal = -1;
effects.append(em);
} else {
dout << "[ERROR] Invalid effect found in" << entries.at(i);
qCritical() << "Invalid effect found in" << entries.at(i);
}
break;
}
@@ -248,12 +248,12 @@ EffectInit::EffectInit() {
}
void EffectInit::run() {
dout << "[INFO] Initializing effects...";
qInfo() << "Initializing effects...";
load_internal_effects();
load_shader_effects();
load_vst_effects();
panel_effect_controls->effects_loaded.unlock();
dout << "[INFO] Finished initializing effects";
qInfo() << "Finished initializing effects";
}
Effect::Effect(Clip* c, const EffectMeta *em) :
@@ -334,7 +334,7 @@ Effect::Effect(Clip* c, const EffectMeta *em) :
}
if (id.isEmpty()) {
dout << "[ERROR] Couldn't load field from" << em->filename << "- ID cannot be empty.";
qCritical() << "Couldn't load field from" << em->filename << "- ID cannot be empty.";
} else if (type > -1) {
EffectField* field = row->add_field(type, id);
connect(field, SIGNAL(changed()), this, SLOT(field_changed()));
@@ -453,7 +453,7 @@ Effect::Effect(Clip* c, const EffectMeta *em) :
if (script_file.open(QFile::ReadOnly)) {
script = script_file.readAll();
} else {
dout << "[ERROR] Failed to open superimpose script file for" << em->filename;
qCritical() << "Failed to open superimpose script file for" << em->filename;
enable_superimpose = false;
}
break;
@@ -465,7 +465,7 @@ Effect::Effect(Clip* c, const EffectMeta *em) :
effect_file.close();
} else {
dout << "[ERROR] Failed to open effect file" << em->filename;
qCritical() << "Failed to open effect file" << em->filename;
}
}
}
@@ -661,7 +661,7 @@ void Effect::load(QXmlStreamReader& stream) {
if (row->field(l)->id == attr.value()) {
field_number = l;
found_field_by_id = true;
dout << "[INFO] Found field by ID";
qInfo() << "Found field by ID";
break;
}
}
@@ -710,14 +710,14 @@ void Effect::load(QXmlStreamReader& stream) {
}
}
} else {
dout << "[ERROR] Too many fields for effect" << id << "row" << row_count << ". Project might be corrupt. (Got" << field_count << ", expected <" << row->fieldCount()-1 << ")";
qCritical() << "Too many fields for effect" << id << "row" << row_count << ". Project might be corrupt. (Got" << field_count << ", expected <" << row->fieldCount()-1 << ")";
}
field_count++;
}
}
} else {
dout << "[ERROR] Too many rows for effect" << id << ". Project might be corrupt. (Got" << row_count << ", expected <" << rows.size()-1 << ")";
qCritical() << "Too many rows for effect" << id << ". Project might be corrupt. (Got" << row_count << ", expected <" << rows.size()-1 << ")";
}
row_count++;
} else if (stream.isStartElement()) {
@@ -783,37 +783,37 @@ void Effect::validate_meta_path() {
void Effect::open() {
if (isOpen) {
dout << "[WARNING] Tried to open an effect that was already open";
qWarning() << "Tried to open an effect that was already open";
close();
}
if (enable_shader) {
if (QOpenGLContext::currentContext() == NULL) {
dout << "[WARNING] No current context to create a shader program for - will retry next repaint";
qWarning() << "No current context to create a shader program for - will retry next repaint";
} else {
glslProgram = new QOpenGLShaderProgram();
validate_meta_path();
bool glsl_compiled = true;
if (!vertPath.isEmpty()) {
if (glslProgram->addShaderFromSourceFile(QOpenGLShader::Vertex, meta->path + "/" + vertPath)) {
dout << "[INFO] Vertex shader added successfully";
qInfo() << "Vertex shader added successfully";
} else {
glsl_compiled = false;
dout << "[WARNING] Vertex shader could not be added";
qWarning() << "Vertex shader could not be added";
}
}
if (!fragPath.isEmpty()) {
if (glslProgram->addShaderFromSourceFile(QOpenGLShader::Fragment, meta->path + "/" + fragPath)) {
dout << "[INFO] Fragment shader added successfully";
qInfo() << "Fragment shader added successfully";
} else {
glsl_compiled = false;
dout << "[WARNING] Fragment shader could not be added";
qWarning() << "Fragment shader could not be added";
}
}
if (glsl_compiled) {
if (glslProgram->link()) {
dout << "[INFO] Shader program linked successfully";
qInfo() << "Shader program linked successfully";
} else {
dout << "[WARNING] Shader program failed to link";
qWarning() << "Shader program failed to link";
}
}
isOpen = true;
@@ -829,7 +829,7 @@ void Effect::open() {
void Effect::close() {
if (!isOpen) {
dout << "[WARNING] Tried to close an effect that was already closed";
qWarning() << "Tried to close an effect that was already closed";
}
delete_texture();
if (glslProgram != NULL) {
@@ -846,7 +846,7 @@ bool Effect::is_glsl_linked() {
void Effect::startEffect() {
if (!isOpen) {
open();
dout << "[WARNING] Tried to start a closed effect - opening";
qWarning() << "Tried to start a closed effect - opening";
}
if (enable_shader && glslProgram->isLinked()) bound = glslProgram->bind();
}
+1 -1
View File
@@ -73,7 +73,7 @@ Transition* get_transition_from_meta(Clip* c, Clip* s, const EffectMeta* em) {
case TRANSITION_INTERNAL_CUBE: return new CubeTransition(c, s, em);
}
} else {
dout << "[ERROR] Invalid transition data";
qCritical() << "Invalid transition data";
QMessageBox::critical(mainWindow, "Invalid transition", "No candidate for transition '" + em->name + "'. This transition may be corrupt. Try reinstalling it or Olive.");
}
return NULL;
+6 -6
View File
@@ -554,10 +554,10 @@ bool isLiveEditing() {
void TimelineWidget::mousePressEvent(QMouseEvent *event) {
if (sequence != NULL) {
int tool = panel_timeline->tool;
if (event->button() == Qt::MiddleButton) {
tool = TIMELINE_TOOL_HAND;
panel_timeline->creating = false;
} else if (event->button() == Qt::RightButton) {
if (event->button() == Qt::MiddleButton) {
tool = TIMELINE_TOOL_HAND;
panel_timeline->creating = false;
} else if (event->button() == Qt::RightButton) {
tool = TIMELINE_TOOL_MENU;
panel_timeline->creating = false;
}
@@ -1163,7 +1163,7 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
update_ui(true);
}
panel_timeline->hand_moving = false;
panel_timeline->hand_moving = false;
}
}
@@ -2178,7 +2178,7 @@ void draw_waveform(Clip* clip, const FootageStream* ms, long media_length, QPain
p->drawLine(clip_rect.left()+i, mid+min, clip_rect.left()+i, mid+max);
}
}/* else {
dout << "[WARNING] Tried to reach" << offset + 1 << ", limit:" << ms->audio_preview.size();
qWarning() << "Tried to reach" << offset + 1 << ", limit:" << ms->audio_preview.size();
}*/
}
}
+5 -5
View File
@@ -437,7 +437,7 @@ void ViewerWidget::process_effect(Clip* c, Effect* e, double timecode, GLTexture
if (e->enable_superimpose) {
GLuint superimpose_texture = e->process_superimpose(timecode);
if (superimpose_texture == 0) {
dout << "[WARNING] Superimpose texture was NULL, retrying...";
qWarning() << "Superimpose texture was NULL, retrying...";
texture_failed = true;
} else {
composite_texture = draw_clip(c->fbo[!fbo_switcher], superimpose_texture, false);
@@ -498,7 +498,7 @@ GLuint ViewerWidget::compose_sequence(QVector<Clip*>& nests, bool render_audio)
close_clip(c, false);
}
} else {
//dout << "[WARNING] Media '" + m->name + "' was not ready, retrying...";
//qWarning() << "Media '" + m->name + "' was not ready, retrying...";
texture_failed = true;
}
}
@@ -542,7 +542,7 @@ GLuint ViewerWidget::compose_sequence(QVector<Clip*>& nests, bool render_audio)
Clip* c = current_clips.at(i);
if (c->media != NULL && c->media->get_type() == MEDIA_TYPE_FOOTAGE && !c->finished_opening) {
dout << "[WARNING] Tried to display clip" << i << "but it's closed";
qWarning() << "Tried to display clip" << i << "but it's closed";
texture_failed = true;
} else {
if (c->track < 0) {
@@ -572,7 +572,7 @@ GLuint ViewerWidget::compose_sequence(QVector<Clip*>& nests, bool render_audio)
}
if (textureID == 0 && c->media != NULL) {
dout << "[WARNING] Texture hasn't been created yet";
qWarning() << "Texture hasn't been created yet";
texture_failed = true;
} else if (playhead >= c->get_timeline_in_with_transition()) {
glPushMatrix();
@@ -868,7 +868,7 @@ void ViewerWidget::paintGL() {
if (force_quit) break;
if (texture_failed) {
if (rendering) {
dout << "[INFO] Texture failed - looping";
qInfo() << "Texture failed - looping";
loop = true;
} else if (!viewer->playing) {
retry_timer.start();