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
@@ -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 "openglbackend.h"
#include <QEventLoop>
@@ -5,6 +25,8 @@
#include "openglrenderfunctions.h"
OLIVE_NAMESPACE_ENTER
OpenGLBackend::OpenGLBackend(QObject *parent) :
VideoRenderBackend(parent),
proxy_(nullptr)
@@ -83,3 +105,5 @@ void OpenGLBackend::ParamsChangedEvent()
proxy_->SetParameters(params());
}
}
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 OPENGLBACKEND_H
#define OPENGLBACKEND_H
@@ -8,6 +28,8 @@
#include "opengltexture.h"
#include "openglworker.h"
OLIVE_NAMESPACE_ENTER
class OpenGLBackend : public VideoRenderBackend
{
Q_OBJECT
@@ -32,4 +54,6 @@ private:
};
OLIVE_NAMESPACE_EXIT
#endif // OPENGLBACKEND_H
@@ -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 "openglcolorprocessor.h"
#include <QOpenGLContext>
@@ -5,6 +25,8 @@
#include "openglrenderfunctions.h"
OLIVE_NAMESPACE_ENTER
void OpenGLColorProcessor::Enable(QOpenGLContext *context, bool alpha_is_associated)
{
if (IsEnabled()) {
@@ -75,3 +97,5 @@ OpenGLColorProcessorPtr OpenGLColorProcessor::Create(OCIO::ConstConfigRcPtr conf
{
return std::make_shared<OpenGLColorProcessor>(config, source_space, display, view, look);
}
OLIVE_NAMESPACE_EXIT
@@ -1,9 +1,31 @@
/***
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 OPENGLCOLORPROCESSOR_H
#define OPENGLCOLORPROCESSOR_H
#include "openglshader.h"
#include "render/colorprocessor.h"
OLIVE_NAMESPACE_ENTER
class OpenGLColorProcessor;
using OpenGLColorProcessorPtr = std::shared_ptr<OpenGLColorProcessor>;
@@ -48,4 +70,6 @@ private slots:
};
OLIVE_NAMESPACE_EXIT
#endif // OPENGLCOLORPROCESSOR_H
@@ -23,6 +23,8 @@
#include <QDebug>
#include <QOpenGLExtraFunctions>
OLIVE_NAMESPACE_ENTER
OpenGLFramebuffer::OpenGLFramebuffer() :
context_(nullptr),
buffer_(0),
@@ -147,3 +149,5 @@ const GLuint &OpenGLFramebuffer::buffer() const
{
return buffer_;
}
OLIVE_NAMESPACE_EXIT
@@ -26,6 +26,8 @@
#include "common/constructors.h"
#include "opengltexture.h"
OLIVE_NAMESPACE_ENTER
class OpenGLFramebuffer : public QObject
{
Q_OBJECT
@@ -33,8 +35,6 @@ public:
OpenGLFramebuffer();
virtual ~OpenGLFramebuffer() override;
DISABLE_COPY_MOVE(OpenGLFramebuffer)
void Create(QOpenGLContext *ctx);
bool IsCreated() const;
@@ -61,4 +61,6 @@ private:
OpenGLTexture* texture_;
};
OLIVE_NAMESPACE_EXIT
#endif // OPENGLFRAMEBUFFER_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 "openglproxy.h"
#include <QThread>
@@ -11,6 +31,8 @@
#include "render/colormanager.h"
#include "render/pixelformat.h"
OLIVE_NAMESPACE_ENTER
OpenGLProxy::OpenGLProxy(QObject *parent) :
QObject(parent),
ctx_(nullptr),
@@ -457,3 +479,5 @@ void OpenGLProxy::FinishInit()
buffer_.Create(ctx_);
}
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 OPENGLPROXY_H
#define OPENGLPROXY_H
@@ -9,6 +29,8 @@
#include "openglshadercache.h"
#include "opengltexturecache.h"
OLIVE_NAMESPACE_ENTER
class OpenGLProxy : public QObject {
Q_OBJECT
public:
@@ -79,4 +101,6 @@ private slots:
};
OLIVE_NAMESPACE_EXIT
#endif // OPENGLPROXY_H
@@ -24,6 +24,8 @@
#include <QOpenGLVertexArrayObject>
#include <QOpenGLBuffer>
OLIVE_NAMESPACE_ENTER
const GLfloat blit_vertices[] = {
-1.0f, -1.0f, 0.0f,
1.0f, -1.0f, 0.0f,
@@ -216,3 +218,5 @@ void OpenGLRenderFunctions::OCIOBlit(OpenGLShader *pipeline,
xf->glBindTexture(GL_TEXTURE_3D, 0);
xf->glActiveTexture(GL_TEXTURE0);
}
OLIVE_NAMESPACE_EXIT
@@ -28,6 +28,8 @@
#include "openglshader.h"
#include "render/pixelformat.h"
OLIVE_NAMESPACE_ENTER
class OpenGLRenderFunctions {
public:
/**
@@ -61,4 +63,6 @@ public:
};
OLIVE_NAMESPACE_EXIT
#endif // OPENGLFUNCTIONS_H
+23 -5
View File
@@ -1,11 +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 "openglshader.h"
#include <QOpenGLExtraFunctions>
OpenGLShader::OpenGLShader()
{
}
OLIVE_NAMESPACE_ENTER
OpenGLShaderPtr OpenGLShader::Create()
{
@@ -235,3 +251,5 @@ QString OpenGLShader::CodeAlphaAssociate(const QString &function_name)
" return vec4(col.rgb * col.a, col.a);\n"
"}\n").arg(function_name);
}
OLIVE_NAMESPACE_EXIT
+27 -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 OPENGLSHADER_H
#define OPENGLSHADER_H
@@ -7,6 +27,10 @@
#include <OpenColorIO/OpenColorIO.h>
namespace OCIO = OCIO_NAMESPACE::v1;
#include "common/define.h"
OLIVE_NAMESPACE_ENTER
class OpenGLShader;
using OpenGLShaderPtr = std::shared_ptr<OpenGLShader>;
@@ -15,7 +39,7 @@ using OpenGLShaderPtr = std::shared_ptr<OpenGLShader>;
*/
class OpenGLShader : public QOpenGLShaderProgram {
public:
OpenGLShader();
OpenGLShader() = default;
static OpenGLShaderPtr Create();
@@ -36,4 +60,6 @@ public:
};
OLIVE_NAMESPACE_EXIT
#endif // OPENGLSHADER_H
@@ -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 OPENGLSHADERCACHE_H
#define OPENGLSHADERCACHE_H
@@ -6,6 +26,10 @@
#include "openglshader.h"
#include "render/backend/rendercache.h"
OLIVE_NAMESPACE_ENTER
using OpenGLShaderCache = RenderCache<QString, OpenGLShaderPtr>;
OLIVE_NAMESPACE_EXIT
#endif // OPENGLSHADERCACHE_H
@@ -26,6 +26,8 @@
#include "openglrenderfunctions.h"
#include "render/pixelformat.h"
OLIVE_NAMESPACE_ENTER
OpenGLTexture::OpenGLTexture() :
created_ctx_(nullptr),
texture_(0),
@@ -168,3 +170,5 @@ void OpenGLTexture::CreateInternal(QOpenGLContext* create_ctx, GLuint* tex, cons
// Release texture
f->glBindTexture(GL_TEXTURE_2D, 0);
}
OLIVE_NAMESPACE_EXIT
+6 -1
View File
@@ -28,6 +28,8 @@
#include "common/constructors.h"
#include "render/pixelformat.h"
OLIVE_NAMESPACE_ENTER
/**
* @brief A class wrapper around an OpenGL texture
*/
@@ -78,6 +80,9 @@ private:
};
using OpenGLTexturePtr = std::shared_ptr<OpenGLTexture>;
Q_DECLARE_METATYPE(OpenGLTexturePtr)
OLIVE_NAMESPACE_EXIT
Q_DECLARE_METATYPE(OLIVE_NAMESPACE::OpenGLTexturePtr)
#endif // OPENGLTEXTURE_H
@@ -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 "opengltexturecache.h"
OLIVE_NAMESPACE_ENTER
OpenGLTextureCache::~OpenGLTextureCache()
{
foreach (Reference* ref, existing_references_) {
@@ -78,3 +100,5 @@ void OpenGLTextureCache::Reference::ParentKilled()
{
parent_ = 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 OPENGLTEXTURECACHE_H
#define OPENGLTEXTURECACHE_H
@@ -7,6 +27,8 @@
#include "opengltexture.h"
#include "render/videoparams.h"
OLIVE_NAMESPACE_ENTER
class OpenGLTextureCache
{
public:
@@ -48,6 +70,8 @@ private:
};
Q_DECLARE_METATYPE(OpenGLTextureCache::ReferencePtr)
OLIVE_NAMESPACE_EXIT
Q_DECLARE_METATYPE(OLIVE_NAMESPACE::OpenGLTextureCache::ReferencePtr)
#endif // OPENGLTEXTURECACHE_H
@@ -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 "openglworker.h"
#include "common/clamp.h"
@@ -9,6 +29,8 @@
#include "render/colormanager.h"
#include "render/pixelformat.h"
OLIVE_NAMESPACE_ENTER
OpenGLWorker::OpenGLWorker(VideoRenderFrameCache *frame_cache, DecoderCache* decoder_cache, QObject *parent) :
VideoRenderWorker(frame_cache, decoder_cache, parent)
{
@@ -28,3 +50,5 @@ void OpenGLWorker::TextureToBuffer(const QVariant &tex_in, void *buffer)
{
emit RequestTextureToBuffer(tex_in, buffer);
}
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 OPENGLPROCESSOR_H
#define OPENGLPROCESSOR_H
@@ -9,6 +29,8 @@
#include "openglshadercache.h"
#include "opengltexturecache.h"
OLIVE_NAMESPACE_ENTER
class OpenGLWorker : public VideoRenderWorker {
Q_OBJECT
public:
@@ -31,4 +53,6 @@ protected:
};
OLIVE_NAMESPACE_EXIT
#endif // OPENGLPROCESSOR_H