added custom debug handler
This commit is contained in:
@@ -18,6 +18,8 @@ set(OLIVE_SOURCES
|
||||
${OLIVE_SOURCES}
|
||||
common/channellayout.h
|
||||
common/clamp.h
|
||||
common/debug.h
|
||||
common/debug.cpp
|
||||
common/filefunctions.h
|
||||
common/filefunctions.cpp
|
||||
common/lerp.h
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
#include "debug.h"
|
||||
|
||||
|
||||
void DebugHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
|
||||
{
|
||||
QByteArray localMsg = msg.toLocal8Bit();
|
||||
|
||||
const char* msg_type;
|
||||
switch (type) {
|
||||
case QtDebugMsg:
|
||||
msg_type = "DEBUG";
|
||||
break;
|
||||
case QtInfoMsg:
|
||||
msg_type = "INFO";
|
||||
break;
|
||||
case QtWarningMsg:
|
||||
msg_type = "WARNING";
|
||||
break;
|
||||
case QtCriticalMsg:
|
||||
msg_type = "ERROR";
|
||||
break;
|
||||
case QtFatalMsg:
|
||||
msg_type = "FATAL";
|
||||
break;
|
||||
}
|
||||
|
||||
fprintf(stderr, "[%s] %s (%s:%u)\n", msg_type, localMsg.constData(), context.function, context.line);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef DEBUG_H
|
||||
#define DEBUG_H
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
void DebugHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg);
|
||||
|
||||
#endif // DEBUG_H
|
||||
@@ -35,6 +35,7 @@ extern "C" {
|
||||
#include <QSurfaceFormat>
|
||||
|
||||
#include "core.h"
|
||||
#include "common/debug.h"
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
// Create application instance
|
||||
@@ -57,6 +58,9 @@ int main(int argc, char *argv[]) {
|
||||
QGuiApplication::setDesktopFileName("org.olivevideoeditor.Olive");
|
||||
#endif
|
||||
|
||||
// Set up debug handler
|
||||
qInstallMessageHandler(DebugHandler);
|
||||
|
||||
// Set OpenGL display profile (3.2 Core)
|
||||
QSurfaceFormat format;
|
||||
format.setVersion(3, 2);
|
||||
|
||||
@@ -59,6 +59,8 @@ void NodeOutput::set_data_type(const NodeParam::DataType &type)
|
||||
|
||||
QVariant NodeOutput::get_value(const rational& time)
|
||||
{
|
||||
mutex_.lock();
|
||||
|
||||
QVariant v;
|
||||
|
||||
if (time_ != time || !value_caching_) {
|
||||
@@ -70,6 +72,8 @@ QVariant NodeOutput::get_value(const rational& time)
|
||||
|
||||
v = value_;
|
||||
|
||||
mutex_.unlock();
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
@@ -68,6 +68,8 @@ public:
|
||||
private:
|
||||
DataType data_type_;
|
||||
|
||||
QMutex mutex_;
|
||||
|
||||
};
|
||||
|
||||
#endif // NODEOUTPUT_H
|
||||
|
||||
@@ -139,7 +139,7 @@ void RendererProcessor::InvalidateCache(const rational &start_range, const ratio
|
||||
rational start_range_adj = qMax(rational(0), start_range);
|
||||
rational end_range_adj = qMin(length_input()->get_value(0).value<rational>(), end_range);
|
||||
|
||||
qDebug() << "[RendererProcessor] Cache invalidated between"
|
||||
qDebug() << "Cache invalidated between"
|
||||
<< start_range_adj.toDouble()
|
||||
<< "and"
|
||||
<< end_range_adj.toDouble();
|
||||
@@ -359,7 +359,7 @@ void RendererProcessor::CacheNext()
|
||||
|
||||
rational cache_frame = cache_queue_.takeFirst();
|
||||
|
||||
qDebug() << "[RendererProcessor] Caching" << cache_frame.toDouble();
|
||||
qDebug() << "Caching" << cache_frame.toDouble();
|
||||
|
||||
threads_.first()->Queue(NodeDependency(texture_input_->get_connected_output(), cache_frame), true);
|
||||
|
||||
|
||||
@@ -54,13 +54,9 @@ void RendererThreadBase::run()
|
||||
|
||||
instance.SetShareContext(share_ctx_);
|
||||
|
||||
qDebug() << this << "is starting its OpenGL context";
|
||||
|
||||
// Allocate and create resources
|
||||
if (instance.Start()) {
|
||||
|
||||
qDebug() << this << "OpenGL context creation succeeded";
|
||||
|
||||
// Main loop (use Cancel() to exit it)
|
||||
ProcessLoop();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user