diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 42aaa323e..d48fb359e 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -30,6 +30,7 @@ add_subdirectory(common) add_subdirectory(config) add_subdirectory(decoder) add_subdirectory(dialog) +add_subdirectory(encoder) add_subdirectory(node) add_subdirectory(panel) add_subdirectory(project) diff --git a/app/decoder/decoder.h b/app/decoder/decoder.h index 3e0d8ef3e..53fbc5026 100644 --- a/app/decoder/decoder.h +++ b/app/decoder/decoder.h @@ -57,7 +57,7 @@ public: Decoder(Stream* fs); // Necessary for subclassing, it's empty - virtual ~Decoder(); + virtual ~Decoder() override; DISABLE_COPY_MOVE(Decoder) diff --git a/app/encoder/CMakeLists.txt b/app/encoder/CMakeLists.txt new file mode 100644 index 000000000..fc7aee057 --- /dev/null +++ b/app/encoder/CMakeLists.txt @@ -0,0 +1,24 @@ +# 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 . + +#add_subdirectory(oiio) + +set(OLIVE_SOURCES + ${OLIVE_SOURCES} + encoder/encoder.h + encoder/encoder.cpp + PARENT_SCOPE +) diff --git a/app/encoder/encoder.cpp b/app/encoder/encoder.cpp new file mode 100644 index 000000000..69217ef7a --- /dev/null +++ b/app/encoder/encoder.cpp @@ -0,0 +1,31 @@ +#include "encoder.h" + +Encoder::Encoder(const EncodingParams ¶ms) : + params_(params) +{ +} + +EncodingParams::EncodingParams() : + video_enabled_(false), + audio_enabled_(false) +{ +} + +void EncodingParams::SetFilename(const QString &filename) +{ + filename_ = filename; +} + +void EncodingParams::EnableVideo(const VideoParams &video_params, const QString &vcodec) +{ + video_enabled_ = true; + video_params_ = video_params; + video_codec_ = vcodec; +} + +void EncodingParams::EnableAudio(const AudioParams &audio_params, const QString &acodec) +{ + audio_enabled_ = true; + audio_params_ = audio_params; + audio_codec_ = acodec; +} diff --git a/app/encoder/encoder.h b/app/encoder/encoder.h new file mode 100644 index 000000000..62f9d78eb --- /dev/null +++ b/app/encoder/encoder.h @@ -0,0 +1,49 @@ +#ifndef ENCODER_H +#define ENCODER_H + +#include +#include + +#include "common/constructors.h" +#include "render/audioparams.h" +#include "render/videoparams.h" + +class Encoder; +using EncoderPtr = std::shared_ptr; + +class EncodingParams { +public: + EncodingParams(); + + void SetFilename(const QString& filename); + void EnableVideo(const VideoParams& video_params, const QString& vcodec); + void EnableAudio(const AudioParams& audio_params, const QString& acodec); + +private: + QString filename_; + + QString video_codec_; + bool video_enabled_; + VideoParams video_params_; + + QString audio_codec_; + bool audio_enabled_; + AudioParams audio_params_; +}; + +class Encoder +{ +public: + Encoder(const EncodingParams& params); + + DISABLE_COPY_MOVE(Encoder) + + virtual bool Open() = 0; + + virtual void Close() = 0; + +private: + EncodingParams params_; +}; + +#endif // ENCODER_H