various: encapsulate all code in the olive namespace to avoid name collisions

Large-scale code cleanup. Also adds a license to the top of all files that were
missing it.
This commit is contained in:
itsmattkc
2020-04-06 15:29:53 +10:00
parent 82b6ddccc8
commit 1aa87cbda6
519 changed files with 7939 additions and 158 deletions
+5 -1
View File
@@ -33,6 +33,8 @@
#include "task/index/index.h"
#include "task/taskmanager.h"
OLIVE_NAMESPACE_ENTER
Decoder::Decoder() :
open_(false),
stream_(nullptr)
@@ -142,7 +144,7 @@ bool Decoder::ProbeMedia(Footage *f, const QAtomicInt* cancelled)
QMetaObject::invokeMethod(IndexManager::instance(),
"StartIndexingStream",
Qt::QueuedConnection,
Q_ARG(StreamPtr, stream));
OLIVE_NS_ARG(StreamPtr, stream));
}
}
@@ -357,3 +359,5 @@ void Decoder::SignalIndexProgress(const int64_t &ts)
emit IndexProgress(qRound(100.0 * static_cast<double>(ts) / static_cast<double>(stream()->duration())));
}
}
OLIVE_NAMESPACE_EXIT
+9 -3
View File
@@ -21,6 +21,10 @@
#ifndef DECODER_H
#define DECODER_H
extern "C" {
#include <libswresample/swresample.h>
}
#include <QMutex>
#include <QObject>
#include <stdint.h>
@@ -32,11 +36,11 @@
#include "common/rational.h"
#include "project/item/footage/footage.h"
OLIVE_NAMESPACE_ENTER
class Decoder;
using DecoderPtr = std::shared_ptr<Decoder>;
struct SwrContext;
/**
* @brief A decoder's is the main class for bringing external media into Olive
*
@@ -276,6 +280,8 @@ private:
};
Q_DECLARE_METATYPE(Decoder::RetrieveState)
OLIVE_NAMESPACE_EXIT
Q_DECLARE_METATYPE(OLIVE_NAMESPACE::Decoder::RetrieveState)
#endif // DECODER_H
+24
View File
@@ -1,7 +1,29 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2019 Olive Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include "encoder.h"
#include "ffmpeg/ffmpegencoder.h"
OLIVE_NAMESPACE_ENTER
Encoder::Encoder(const EncodingParams &params) :
params_(params),
open_(false)
@@ -168,3 +190,5 @@ void Encoder::Close()
emit Closed();
}
OLIVE_NAMESPACE_EXIT
+26 -2
View File
@@ -1,3 +1,23 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2019 Olive Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef ENCODER_H
#define ENCODER_H
@@ -10,6 +30,8 @@
#include "render/audioparams.h"
#include "render/videoparams.h"
OLIVE_NAMESPACE_ENTER
class Encoder;
using EncoderPtr = std::shared_ptr<Encoder>;
@@ -82,8 +104,8 @@ public:
public slots:
void Open();
void WriteFrame(FramePtr frame);
virtual void WriteAudio(const AudioRenderingParams& pcm_info, const QString& pcm_filename, const TimeRange &range) = 0;
void WriteFrame(OLIVE_NAMESPACE::FramePtr frame);
virtual void WriteAudio(OLIVE_NAMESPACE::AudioRenderingParams pcm_info, const QString& pcm_filename, OLIVE_NAMESPACE::TimeRange range) = 0;
void Close();
signals:
@@ -107,4 +129,6 @@ private:
bool open_;
};
OLIVE_NAMESPACE_EXIT
#endif // ENCODER_H
+24
View File
@@ -1,5 +1,27 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2019 Olive Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include "ffmpegcommon.h"
OLIVE_NAMESPACE_ENTER
AVPixelFormat FFmpegCommon::GetCompatiblePixelFormat(const AVPixelFormat &pix_fmt)
{
AVPixelFormat possible_pix_fmts[] = {
@@ -113,3 +135,5 @@ PixelFormat::Format FFmpegCommon::GetCompatiblePixelFormat(const PixelFormat::Fo
return PixelFormat::PIX_FMT_INVALID;
}
OLIVE_NAMESPACE_EXIT
+24
View File
@@ -1,3 +1,23 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2019 Olive Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef FFMPEGABSTRACTION_H
#define FFMPEGABSTRACTION_H
@@ -8,6 +28,8 @@ extern "C" {
#include "audio/sampleformat.h"
#include "render/pixelformat.h"
OLIVE_NAMESPACE_ENTER
class FFmpegCommon {
public:
/**
@@ -36,4 +58,6 @@ public:
static AVSampleFormat GetFFmpegSampleFormat(const SampleFormat::Format &smp_fmt);
};
OLIVE_NAMESPACE_EXIT
#endif // FFMPEGABSTRACTION_H
+4
View File
@@ -42,6 +42,8 @@ extern "C" {
#include "render/diskmanager.h"
#include "render/pixelformat.h"
OLIVE_NAMESPACE_ENTER
FFmpegDecoder::FFmpegDecoder() :
fmt_ctx_(nullptr),
codec_ctx_(nullptr),
@@ -992,3 +994,5 @@ void FFmpegDecoder::ClearTimerEvent()
cache_at_zero_ = false;
cached_frames_.remove_old_frames(QDateTime::currentMSecsSinceEpoch() - clear_timer_.interval());
}
OLIVE_NAMESPACE_EXIT
+4
View File
@@ -37,6 +37,8 @@ extern "C" {
#include "ffmpegframecache.h"
#include "project/item/footage/videostream.h"
OLIVE_NAMESPACE_ENTER
/**
* @brief A Decoder derivative that wraps FFmpeg functions as on Olive decoder
*/
@@ -134,4 +136,6 @@ private slots:
};
OLIVE_NAMESPACE_EXIT
#endif // FFMPEGDECODER_H
+25 -1
View File
@@ -1,3 +1,23 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2019 Olive Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include "ffmpegencoder.h"
#include <QFile>
@@ -5,6 +25,8 @@
#include "ffmpegcommon.h"
#include "render/pixelformat.h"
OLIVE_NAMESPACE_ENTER
FFmpegEncoder::FFmpegEncoder(const EncodingParams &params) :
Encoder(params),
fmt_ctx_(nullptr),
@@ -17,7 +39,7 @@ FFmpegEncoder::FFmpegEncoder(const EncodingParams &params) :
{
}
void FFmpegEncoder::WriteAudio(const AudioRenderingParams &pcm_info, const QString &pcm_filename, const TimeRange& range)
void FFmpegEncoder::WriteAudio(AudioRenderingParams pcm_info, const QString &pcm_filename, TimeRange range)
{
QFile pcm(pcm_filename);
if (pcm.open(QFile::ReadOnly)) {
@@ -504,3 +526,5 @@ void FFmpegEncoder::Error(const QString &s)
Close();
}
OLIVE_NAMESPACE_EXIT
+25 -1
View File
@@ -1,3 +1,23 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2019 Olive Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef FFMPEGENCODER_H
#define FFMPEGENCODER_H
@@ -10,6 +30,8 @@ extern "C" {
#include "codec/encoder.h"
OLIVE_NAMESPACE_ENTER
class FFmpegEncoder : public Encoder
{
Q_OBJECT
@@ -17,7 +39,7 @@ public:
FFmpegEncoder(const EncodingParams &params);
public slots:
virtual void WriteAudio(const AudioRenderingParams& pcm_info, const QString& pcm_filename, const TimeRange &range) override;
virtual void WriteAudio(OLIVE_NAMESPACE::AudioRenderingParams pcm_info, const QString& pcm_filename, OLIVE_NAMESPACE::TimeRange range) override;
protected:
virtual bool OpenInternal() override;
@@ -66,4 +88,6 @@ private:
};
OLIVE_NAMESPACE_EXIT
#endif // FFMPEGENCODER_H
+24
View File
@@ -1,8 +1,30 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2019 Olive Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include "ffmpegframecache.h"
#include <QDateTime>
#include <QDebug>
OLIVE_NAMESPACE_ENTER
QMutex FFmpegFrameCache::pool_lock_;
QList<Frame*> FFmpegFrameCache::frame_pool_;
@@ -97,3 +119,5 @@ void FFmpegFrameCache::Release(Frame *f)
frame_pool_.append(f);
}
OLIVE_NAMESPACE_EXIT
+24
View File
@@ -1,3 +1,23 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2019 Olive Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef FFMPEGFRAMECACHE_H
#define FFMPEGFRAMECACHE_H
@@ -7,6 +27,8 @@
#include "codec/frame.h"
#include "render/videoparams.h"
OLIVE_NAMESPACE_ENTER
class FFmpegFrameCache
{
public:
@@ -53,4 +75,6 @@ private:
};
OLIVE_NAMESPACE_EXIT
#endif // FFMPEGFRAMECACHE_H
+4
View File
@@ -23,6 +23,8 @@
#include <QDebug>
#include <QtGlobal>
OLIVE_NAMESPACE_ENTER
Frame::Frame() :
timestamp_(0),
sample_aspect_ratio_(1)
@@ -147,3 +149,5 @@ int Frame::allocated_size() const
{
return data_.size();
}
OLIVE_NAMESPACE_EXIT
+5 -1
View File
@@ -29,6 +29,8 @@
#include "render/pixelformat.h"
#include "render/videoparams.h"
OLIVE_NAMESPACE_ENTER
class Frame;
using FramePtr = std::shared_ptr<Frame>;
@@ -122,6 +124,8 @@ private:
};
Q_DECLARE_METATYPE(FramePtr)
OLIVE_NAMESPACE_EXIT
Q_DECLARE_METATYPE(OLIVE_NAMESPACE::FramePtr)
#endif // FRAME_H
+4
View File
@@ -30,6 +30,8 @@
#include "config/config.h"
#include "core.h"
OLIVE_NAMESPACE_ENTER
QStringList OIIODecoder::supported_formats_;
OIIODecoder::OIIODecoder() :
@@ -347,3 +349,5 @@ void OIIODecoder::CloseImageHandle()
buffer_ = nullptr;
}
}
OLIVE_NAMESPACE_EXIT
+4
View File
@@ -27,6 +27,8 @@
#include "codec/decoder.h"
#include "render/pixelformat.h"
OLIVE_NAMESPACE_ENTER
class OIIODecoder : public Decoder
{
Q_OBJECT
@@ -78,4 +80,6 @@ private:
};
OLIVE_NAMESPACE_EXIT
#endif // OIIODECODER_H
+24
View File
@@ -1,5 +1,27 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2019 Olive Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include "samplebuffer.h"
OLIVE_NAMESPACE_ENTER
SampleBuffer::SampleBuffer() :
sample_count_per_channel_(0),
data_(nullptr)
@@ -252,3 +274,5 @@ void SampleBuffer::destroy_sample_buffer(float ***data, int nb_channels)
*data = nullptr;
}
}
OLIVE_NAMESPACE_EXIT
+25 -1
View File
@@ -1,3 +1,23 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2019 Olive Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef SAMPLEBUFFER_H
#define SAMPLEBUFFER_H
@@ -6,6 +26,8 @@
#include "common/constructors.h"
#include "render/audioparams.h"
OLIVE_NAMESPACE_ENTER
class SampleBuffer;
using SampleBufferPtr = std::shared_ptr<SampleBuffer>;
@@ -69,6 +91,8 @@ private:
};
Q_DECLARE_METATYPE(SampleBufferPtr)
OLIVE_NAMESPACE_EXIT
Q_DECLARE_METATYPE(OLIVE_NAMESPACE::SampleBufferPtr)
#endif // SAMPLEBUFFER_H
+24
View File
@@ -1,3 +1,23 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2019 Olive Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include "waveinput.h"
extern "C" {
@@ -7,6 +27,8 @@ extern "C" {
#include <QDataStream>
#include <QtMath>
OLIVE_NAMESPACE_ENTER
WaveInput::WaveInput(const QString &f) :
file_(f)
{
@@ -216,3 +238,5 @@ qint64 WaveInput::calculate_max_read() const
{
return data_size_ - (file_.pos() - data_position_ );
}
OLIVE_NAMESPACE_EXIT
+24
View File
@@ -1,3 +1,23 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2019 Olive Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef WAVEINPUT_H
#define WAVEINPUT_H
@@ -6,6 +26,8 @@
#include "common/constructors.h"
#include "render/audioparams.h"
OLIVE_NAMESPACE_ENTER
class WaveInput
{
public:
@@ -49,4 +71,6 @@ private:
quint32 data_size_;
};
OLIVE_NAMESPACE_EXIT
#endif // WAVEINPUT_H
+24
View File
@@ -1,5 +1,27 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2019 Olive Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include "waveoutput.h"
OLIVE_NAMESPACE_ENTER
const int16_t kWAVIntegerFormat = 1;
const int16_t kWAVFloatFormat = 3;
@@ -152,3 +174,5 @@ void WaveOutput::write_int(QFile *file, T integer)
file->write(bytes);
}
OLIVE_NAMESPACE_EXIT
+24
View File
@@ -1,3 +1,23 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2019 Olive Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef WAVEAUDIO_H
#define WAVEAUDIO_H
@@ -8,6 +28,8 @@
#include "common/constructors.h"
#include "render/audioparams.h"
OLIVE_NAMESPACE_ENTER
class WaveOutput
{
public:
@@ -43,4 +65,6 @@ private:
};
OLIVE_NAMESPACE_EXIT
#endif // WAVEAUDIO_H