cleanup and disabled nonfunctional scrolling code
This commit is contained in:
+1
-1
@@ -23,7 +23,7 @@
|
||||
|
||||
#include <QVector>
|
||||
|
||||
class Transition;
|
||||
#include <project/transition.h>
|
||||
|
||||
#define CLIPBOARD_TYPE_CLIP 0
|
||||
#define CLIPBOARD_TYPE_EFFECT 1
|
||||
|
||||
+2
-2
@@ -29,8 +29,8 @@
|
||||
|
||||
#include "debug.h"
|
||||
|
||||
Config config;
|
||||
RuntimeConfig runtime_config;
|
||||
Config Olive::CurrentConfig;
|
||||
RuntimeConfig Olive::CurrentRuntimeConfig;
|
||||
|
||||
Config::Config()
|
||||
: saved_layout(false),
|
||||
|
||||
+4
-2
@@ -103,7 +103,9 @@ struct RuntimeConfig {
|
||||
QString external_translation_file;
|
||||
};
|
||||
|
||||
extern Config config;
|
||||
extern RuntimeConfig runtime_config;
|
||||
namespace Olive {
|
||||
extern Config CurrentConfig;
|
||||
extern RuntimeConfig CurrentRuntimeConfig;
|
||||
}
|
||||
|
||||
#endif // CONFIG_H
|
||||
|
||||
+25
-20
@@ -31,7 +31,6 @@
|
||||
#include "ui/renderfunctions.h"
|
||||
#include "playback/playback.h"
|
||||
#include "playback/audio.h"
|
||||
#include "dialogs/exportdialog.h"
|
||||
#include "mainwindow.h"
|
||||
#include "debug.h"
|
||||
|
||||
@@ -80,7 +79,7 @@ bool ExportThread::encode(AVFormatContext* ofmt_ctx, AVCodecContext* codec_ctx,
|
||||
ret = avcodec_send_frame(codec_ctx, frame);
|
||||
if (ret < 0) {
|
||||
qCritical() << "Failed to send frame to encoder." << ret;
|
||||
ed->export_error = tr("failed to send frame to encoder (%1)").arg(QString::number(ret));
|
||||
export_error = tr("failed to send frame to encoder (%1)").arg(QString::number(ret));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -91,7 +90,7 @@ bool ExportThread::encode(AVFormatContext* ofmt_ctx, AVCodecContext* codec_ctx,
|
||||
} else if (ret < 0) {
|
||||
if (ret != AVERROR_EOF) {
|
||||
qCritical() << "Failed to receive packet from encoder." << ret;
|
||||
ed->export_error = tr("failed to receive packet from encoder (%1)").arg(QString::number(ret));
|
||||
export_error = tr("failed to receive packet from encoder (%1)").arg(QString::number(ret));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -112,7 +111,7 @@ bool ExportThread::setupVideo() {
|
||||
vcodec = avcodec_find_encoder(static_cast<enum AVCodecID>(params.video_codec));
|
||||
if (!vcodec) {
|
||||
qCritical() << "Could not find video encoder";
|
||||
ed->export_error = tr("could not video encoder for %1").arg(QString::number(params.video_codec));
|
||||
export_error = tr("could not video encoder for %1").arg(QString::number(params.video_codec));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -121,7 +120,7 @@ bool ExportThread::setupVideo() {
|
||||
video_stream->id = 0;
|
||||
if (!video_stream) {
|
||||
qCritical() << "Could not allocate video stream";
|
||||
ed->export_error = tr("could not allocate video stream");
|
||||
export_error = tr("could not allocate video stream");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -130,7 +129,7 @@ bool ExportThread::setupVideo() {
|
||||
vcodec_ctx = avcodec_alloc_context3(vcodec);
|
||||
if (!vcodec_ctx) {
|
||||
qCritical() << "Could not allocate video encoding context";
|
||||
ed->export_error = tr("could not allocate video encoding context");
|
||||
export_error = tr("could not allocate video encoding context");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -168,7 +167,7 @@ bool ExportThread::setupVideo() {
|
||||
ret = avcodec_open2(vcodec_ctx, vcodec, &opts);
|
||||
if (ret < 0) {
|
||||
qCritical() << "Could not open output video encoder." << ret;
|
||||
ed->export_error = tr("could not open output video encoder (%1)").arg(QString::number(ret));
|
||||
export_error = tr("could not open output video encoder (%1)").arg(QString::number(ret));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -176,7 +175,7 @@ bool ExportThread::setupVideo() {
|
||||
ret = avcodec_parameters_from_context(video_stream->codecpar, vcodec_ctx);
|
||||
if (ret < 0) {
|
||||
qCritical() << "Could not copy video encoder parameters to output stream." << ret;
|
||||
ed->export_error = tr("could not copy video encoder parameters to output stream (%1)").arg(QString::number(ret));
|
||||
export_error = tr("could not copy video encoder parameters to output stream (%1)").arg(QString::number(ret));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -214,7 +213,7 @@ bool ExportThread::setupAudio() {
|
||||
acodec = avcodec_find_encoder(static_cast<AVCodecID>(params.audio_codec));
|
||||
if (!acodec) {
|
||||
qCritical() << "Could not find audio encoder";
|
||||
ed->export_error = tr("could not audio encoder for %1").arg(QString::number(params.audio_codec));
|
||||
export_error = tr("could not audio encoder for %1").arg(QString::number(params.audio_codec));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -223,7 +222,7 @@ bool ExportThread::setupAudio() {
|
||||
audio_stream->id = 1;
|
||||
if (!audio_stream) {
|
||||
qCritical() << "Could not allocate audio stream";
|
||||
ed->export_error = tr("could not allocate audio stream");
|
||||
export_error = tr("could not allocate audio stream");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -232,7 +231,7 @@ bool ExportThread::setupAudio() {
|
||||
acodec_ctx = avcodec_alloc_context3(acodec);
|
||||
if (!acodec_ctx) {
|
||||
qCritical() << "Could not find allocate audio encoding context";
|
||||
ed->export_error = tr("could not allocate audio encoding context");
|
||||
export_error = tr("could not allocate audio encoding context");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -257,7 +256,7 @@ bool ExportThread::setupAudio() {
|
||||
ret = avcodec_open2(acodec_ctx, acodec, nullptr);
|
||||
if (ret < 0) {
|
||||
qCritical() << "Could not open output audio encoder." << ret;
|
||||
ed->export_error = tr("could not open output audio encoder (%1)").arg(QString::number(ret));
|
||||
export_error = tr("could not open output audio encoder (%1)").arg(QString::number(ret));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -265,7 +264,7 @@ bool ExportThread::setupAudio() {
|
||||
ret = avcodec_parameters_from_context(audio_stream->codecpar, acodec_ctx);
|
||||
if (ret < 0) {
|
||||
qCritical() << "Could not copy audio encoder parameters to output stream." << ret;
|
||||
ed->export_error = tr("could not copy audio encoder parameters to output stream (%1)").arg(QString::number(ret));
|
||||
export_error = tr("could not copy audio encoder parameters to output stream (%1)").arg(QString::number(ret));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -295,7 +294,7 @@ bool ExportThread::setupAudio() {
|
||||
ret = av_frame_get_buffer(audio_frame, 0);
|
||||
if (ret < 0) {
|
||||
qCritical() << "Could not allocate audio buffer." << ret;
|
||||
ed->export_error = tr("could not allocate audio buffer (%1)").arg(QString::number(ret));
|
||||
export_error = tr("could not allocate audio buffer (%1)").arg(QString::number(ret));
|
||||
return false;
|
||||
}
|
||||
aframe_bytes = av_samples_get_buffer_size(nullptr, audio_frame->channels, audio_frame->nb_samples, static_cast<AVSampleFormat>(audio_frame->format), 0);
|
||||
@@ -317,7 +316,7 @@ bool ExportThread::setupContainer() {
|
||||
avformat_alloc_output_context2(&fmt_ctx, nullptr, nullptr, c_filename);
|
||||
if (!fmt_ctx) {
|
||||
qCritical() << "Could not create output context";
|
||||
ed->export_error = tr("could not create output format context");
|
||||
export_error = tr("could not create output format context");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -326,7 +325,7 @@ bool ExportThread::setupContainer() {
|
||||
ret = avio_open(&fmt_ctx->pb, c_filename, AVIO_FLAG_WRITE);
|
||||
if (ret < 0) {
|
||||
qCritical() << "Could not open output file." << ret;
|
||||
ed->export_error = tr("could not open output file (%1)").arg(QString::number(ret));
|
||||
export_error = tr("could not open output file (%1)").arg(QString::number(ret));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -352,7 +351,7 @@ void ExportThread::run() {
|
||||
ret = avformat_write_header(fmt_ctx, nullptr);
|
||||
if (ret < 0) {
|
||||
qCritical() << "Could not write output file header." << ret;
|
||||
ed->export_error = tr("could not write output file header (%1)").arg(QString::number(ret));
|
||||
export_error = tr("could not write output file header (%1)").arg(QString::number(ret));
|
||||
continueEncode = false;
|
||||
}
|
||||
}
|
||||
@@ -489,11 +488,13 @@ void ExportThread::run() {
|
||||
ret = av_write_trailer(fmt_ctx);
|
||||
if (ret < 0) {
|
||||
qCritical() << "Could not write output file trailer." << ret;
|
||||
ed->export_error = tr("could not write output file trailer (%1)").arg(QString::number(ret));
|
||||
export_error = tr("could not write output file trailer (%1)").arg(QString::number(ret));
|
||||
continueEncode = false;
|
||||
}
|
||||
|
||||
emit progress_changed(100, 0);
|
||||
if (continueEncode) {
|
||||
emit progress_changed(100, 0);
|
||||
}
|
||||
}
|
||||
|
||||
avio_closep(&fmt_ctx->pb);
|
||||
@@ -522,7 +523,11 @@ void ExportThread::run() {
|
||||
av_frame_free(&swr_frame);
|
||||
}
|
||||
|
||||
delete [] c_filename;
|
||||
delete [] c_filename;
|
||||
}
|
||||
|
||||
const QString &ExportThread::getError() {
|
||||
return export_error;
|
||||
}
|
||||
|
||||
void ExportThread::wake() {
|
||||
|
||||
+4
-3
@@ -26,7 +26,6 @@
|
||||
#include <QMutex>
|
||||
#include <QWaitCondition>
|
||||
|
||||
class ExportDialog;
|
||||
struct AVFormatContext;
|
||||
struct AVCodecContext;
|
||||
struct AVFrame;
|
||||
@@ -75,9 +74,9 @@ public:
|
||||
ExportThread(const ExportParams& iparams, const VideoCodecParams& ivparams, QObject* parent = nullptr);
|
||||
void run();
|
||||
|
||||
QOffscreenSurface surface;
|
||||
const QString& getError();
|
||||
|
||||
ExportDialog* ed;
|
||||
QOffscreenSurface surface;
|
||||
|
||||
bool continueEncode;
|
||||
signals:
|
||||
@@ -119,6 +118,8 @@ private:
|
||||
|
||||
QMutex mutex;
|
||||
QWaitCondition waitCond;
|
||||
|
||||
QString export_error;
|
||||
};
|
||||
|
||||
#endif // EXPORTTHREAD_H
|
||||
|
||||
+1
-10
@@ -31,22 +31,13 @@
|
||||
#include "io/config.h"
|
||||
#include "playback/playback.h"
|
||||
#include "io/previewgenerator.h"
|
||||
#include "dialogs/loaddialog.h"
|
||||
#include "effects/internal/voideffect.h"
|
||||
#include "debug.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QTreeWidgetItem>
|
||||
|
||||
struct TransitionData {
|
||||
int id;
|
||||
QString name;
|
||||
long length;
|
||||
Clip* otc;
|
||||
Clip* ctc;
|
||||
};
|
||||
|
||||
LoadThread::LoadThread(LoadDialog* l, bool a) : ld(l), autorecovery(a), cancelled(false) {
|
||||
LoadThread::LoadThread(bool a) : autorecovery(a), cancelled(false) {
|
||||
connect(this, SIGNAL(finished()), this, SLOT(deleteLater()));
|
||||
connect(this, SIGNAL(success()), this, SLOT(success_func()));
|
||||
connect(this, SIGNAL(error()), this, SLOT(error_func()));
|
||||
|
||||
+10
-9
@@ -28,19 +28,21 @@
|
||||
#include <QWaitCondition>
|
||||
#include <QMessageBox>
|
||||
|
||||
class Media;
|
||||
struct Footage;
|
||||
class Clip;
|
||||
struct Sequence;
|
||||
class LoadDialog;
|
||||
struct TransitionData;
|
||||
struct EffectMeta;
|
||||
#include "project/projectelements.h"
|
||||
|
||||
struct TransitionData {
|
||||
int id;
|
||||
QString name;
|
||||
long length;
|
||||
Clip* otc;
|
||||
Clip* ctc;
|
||||
};
|
||||
|
||||
class LoadThread : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
LoadThread(LoadDialog* l, bool a);
|
||||
LoadThread(bool a);
|
||||
void run();
|
||||
void cancel();
|
||||
signals:
|
||||
@@ -57,7 +59,6 @@ private slots:
|
||||
void create_effect_ui(QXmlStreamReader* stream, Clip* c, int type, const QString *effect_name, const EffectMeta* meta, long effect_length, bool effect_enabled);
|
||||
void create_dual_transition(const TransitionData* td, Clip* primary, Clip* secondary, const EffectMeta* meta);
|
||||
private:
|
||||
LoadDialog* ld;
|
||||
bool autorecovery;
|
||||
|
||||
bool load_worker(QFile& f, QXmlStreamReader& stream, int type);
|
||||
|
||||
+4
-11
@@ -36,13 +36,6 @@
|
||||
#include <QFile>
|
||||
#include <QDir>
|
||||
|
||||
extern "C" {
|
||||
#include <libavformat/avformat.h>
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libswscale/swscale.h>
|
||||
#include <libswresample/swresample.h>
|
||||
}
|
||||
|
||||
QSemaphore sem(5); // only 5 preview generators can run at one time
|
||||
|
||||
PreviewGenerator::PreviewGenerator(Media* i, Footage* m, bool r) :
|
||||
@@ -249,8 +242,8 @@ void PreviewGenerator::generate_waveform() {
|
||||
|
||||
// we only generate previews for video and audio
|
||||
// and only if the thumbnail and waveform sizes are > 0
|
||||
if ((fmt_ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && config.thumbnail_resolution > 0)
|
||||
|| (fmt_ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && config.waveform_resolution > 0)) {
|
||||
if ((fmt_ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && Olive::CurrentConfig.thumbnail_resolution > 0)
|
||||
|| (fmt_ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && Olive::CurrentConfig.waveform_resolution > 0)) {
|
||||
AVCodec* codec = avcodec_find_decoder(fmt_ctx->streams[i]->codecpar->codec_id);
|
||||
if (codec != nullptr) {
|
||||
|
||||
@@ -325,7 +318,7 @@ void PreviewGenerator::generate_waveform() {
|
||||
if (s != nullptr) {
|
||||
if (fmt_ctx->streams[packet->stream_index]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
|
||||
if (!s->preview_done) {
|
||||
int dstH = config.thumbnail_resolution;
|
||||
int dstH = Olive::CurrentConfig.thumbnail_resolution;
|
||||
int dstW = qRound(dstH * (float(temp_frame->width)/float(temp_frame->height)));
|
||||
uint8_t* data = new uint8_t[size_t(dstW*dstH*4)];
|
||||
|
||||
@@ -388,7 +381,7 @@ void PreviewGenerator::generate_waveform() {
|
||||
// `config.waveform_resolution` determines how many samples per second are stored in waveform.
|
||||
// `sample_rate` is samples per second, so `interval` is how many samples are averaged in
|
||||
// each "point" of the waveform
|
||||
int interval = qFloor((temp_frame->sample_rate/config.waveform_resolution)/4)*4;
|
||||
int interval = qFloor((temp_frame->sample_rate/Olive::CurrentConfig.waveform_resolution)/4)*4;
|
||||
|
||||
// get the amount of bytes in an audio sample
|
||||
int sample_size = av_get_bytes_per_sample(static_cast<AVSampleFormat>(swr_frame->format));
|
||||
|
||||
@@ -31,10 +31,15 @@ enum IconType {
|
||||
ICON_TYPE_ERROR
|
||||
};
|
||||
|
||||
struct Footage;
|
||||
struct FootageStream;
|
||||
struct AVFormatContext;
|
||||
class Media;
|
||||
#include "project/footage.h"
|
||||
#include "project/media.h"
|
||||
|
||||
extern "C" {
|
||||
#include <libavformat/avformat.h>
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libswscale/swscale.h>
|
||||
#include <libswresample/swresample.h>
|
||||
}
|
||||
|
||||
class PreviewGenerator : public QThread
|
||||
{
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
#include "proxygenerator.h"
|
||||
|
||||
#include "project/footage.h"
|
||||
#include "io/path.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@
|
||||
#include <QMutex>
|
||||
#include <QWaitCondition>
|
||||
|
||||
struct Footage;
|
||||
#include "project/footage.h"
|
||||
|
||||
struct ProxyInfo {
|
||||
Footage* footage;
|
||||
|
||||
Reference in New Issue
Block a user