start moving core frameworks to external libraries
This commit is contained in:
@@ -22,13 +22,13 @@
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDebug>
|
||||
#include <QHash>
|
||||
|
||||
#include "codec/ffmpeg/ffmpegdecoder.h"
|
||||
#include "codec/planarfiledevice.h"
|
||||
#include "codec/oiio/oiiodecoder.h"
|
||||
#include "common/ffmpegutils.h"
|
||||
#include "common/filefunctions.h"
|
||||
#include "common/timecodefunctions.h"
|
||||
#include "conformmanager.h"
|
||||
#include "node/project/project.h"
|
||||
#include "task/taskmanager.h"
|
||||
@@ -338,7 +338,7 @@ void Decoder::UpdateLastAccessed()
|
||||
|
||||
uint qHash(Decoder::CodecStream stream, uint seed)
|
||||
{
|
||||
return qHash(stream.filename(), seed) ^ qHash(stream.stream(), seed) ^ qHash(stream.block(), seed);
|
||||
return qHash(stream.filename(), seed) ^ ::qHash(stream.stream(), seed) ^ qHash(stream.block(), seed);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -32,10 +32,10 @@ extern "C" {
|
||||
#include <stdint.h>
|
||||
|
||||
#include "codec/samplebuffer.h"
|
||||
#include "common/rational.h"
|
||||
#include "node/block/block.h"
|
||||
#include "node/project/footage/footagedescription.h"
|
||||
#include "render/cancelatom.h"
|
||||
#include "render/rendermodes.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
@@ -160,7 +160,7 @@ public:
|
||||
Renderer *renderer = nullptr;
|
||||
rational time;
|
||||
int divider = 1;
|
||||
VideoParams::Format maximum_format = VideoParams::kFormatInvalid;
|
||||
PixelFormat maximum_format = PixelFormat::INVALID;
|
||||
CancelAtom *cancelled = nullptr;
|
||||
VideoParams::ColorRange force_range = VideoParams::kColorRangeDefault;
|
||||
VideoParams::Interlacing src_interlacing = VideoParams::kInterlaceNone;
|
||||
|
||||
+9
-10
@@ -22,7 +22,6 @@
|
||||
|
||||
#include <QFile>
|
||||
|
||||
#include "common/timecodefunctions.h"
|
||||
#include "common/xmlutils.h"
|
||||
#include "ffmpeg/ffmpegencoder.h"
|
||||
#include "oiio/oiioencoder.h"
|
||||
@@ -202,8 +201,8 @@ void EncodingParams::Save(QXmlStreamWriter *writer) const
|
||||
writer->writeTextElement(QStringLiteral("format"), QString::number(format_));
|
||||
|
||||
writer->writeTextElement(QStringLiteral("range"), QString::number(has_custom_range_));
|
||||
writer->writeTextElement(QStringLiteral("customrangein"), custom_range_.in().toString());
|
||||
writer->writeTextElement(QStringLiteral("customrangeout"), custom_range_.out().toString());
|
||||
writer->writeTextElement(QStringLiteral("customrangein"), QString::fromStdString(custom_range_.in().toString()));
|
||||
writer->writeTextElement(QStringLiteral("customrangeout"), QString::fromStdString(custom_range_.out().toString()));
|
||||
|
||||
writer->writeStartElement(QStringLiteral("video"));
|
||||
|
||||
@@ -214,8 +213,8 @@ void EncodingParams::Save(QXmlStreamWriter *writer) const
|
||||
writer->writeTextElement(QStringLiteral("width"), QString::number(video_params_.width()));
|
||||
writer->writeTextElement(QStringLiteral("height"), QString::number(video_params_.height()));
|
||||
writer->writeTextElement(QStringLiteral("format"), QString::number(video_params_.format()));
|
||||
writer->writeTextElement(QStringLiteral("pixelaspect"), video_params_.pixel_aspect_ratio().toString());
|
||||
writer->writeTextElement(QStringLiteral("timebase"), video_params_.time_base().toString());
|
||||
writer->writeTextElement(QStringLiteral("pixelaspect"), QString::fromStdString(video_params_.pixel_aspect_ratio().toString()));
|
||||
writer->writeTextElement(QStringLiteral("timebase"), QString::fromStdString(video_params_.time_base().toString()));
|
||||
writer->writeTextElement(QStringLiteral("divider"), QString::number(video_params_.divider()));
|
||||
writer->writeTextElement(QStringLiteral("bitrate"), QString::number(video_bit_rate_));
|
||||
writer->writeTextElement(QStringLiteral("minbitrate"), QString::number(video_min_bit_rate_));
|
||||
@@ -381,9 +380,9 @@ bool EncodingParams::LoadV1(QXmlStreamReader *reader)
|
||||
} else if (reader->name() == QStringLiteral("range")) {
|
||||
has_custom_range_ = reader->readElementText().toInt();
|
||||
} else if (reader->name() == QStringLiteral("customrangein")) {
|
||||
custom_range_in = rational::fromString(reader->readElementText());
|
||||
custom_range_in = rational::fromString(reader->readElementText().toStdString());
|
||||
} else if (reader->name() == QStringLiteral("customrangeout")) {
|
||||
custom_range_out = rational::fromString(reader->readElementText());
|
||||
custom_range_out = rational::fromString(reader->readElementText().toStdString());
|
||||
} else if (reader->name() == QStringLiteral("video")) {
|
||||
XMLAttributeLoop(reader, attr) {
|
||||
if (attr.name() == QStringLiteral("enabled")) {
|
||||
@@ -399,11 +398,11 @@ bool EncodingParams::LoadV1(QXmlStreamReader *reader)
|
||||
} else if (reader->name() == QStringLiteral("height")) {
|
||||
video_params_.set_height(reader->readElementText().toInt());
|
||||
} else if (reader->name() == QStringLiteral("format")) {
|
||||
video_params_.set_format(static_cast<VideoParams::Format>(reader->readElementText().toInt()));
|
||||
video_params_.set_format(static_cast<PixelFormat::Format>(reader->readElementText().toInt()));
|
||||
} else if (reader->name() == QStringLiteral("pixelaspect")) {
|
||||
video_params_.set_pixel_aspect_ratio(rational::fromString(reader->readElementText()));
|
||||
video_params_.set_pixel_aspect_ratio(rational::fromString(reader->readElementText().toStdString()));
|
||||
} else if (reader->name() == QStringLiteral("timebase")) {
|
||||
video_params_.set_time_base(rational::fromString(reader->readElementText()));
|
||||
video_params_.set_time_base(rational::fromString(reader->readElementText().toStdString()));
|
||||
} else if (reader->name() == QStringLiteral("divider")) {
|
||||
video_params_.set_divider(reader->readElementText().toInt());
|
||||
} else if (reader->name() == QStringLiteral("bitrate")) {
|
||||
|
||||
+3
-4
@@ -30,7 +30,6 @@
|
||||
#include "codec/exportformat.h"
|
||||
#include "codec/frame.h"
|
||||
#include "codec/samplebuffer.h"
|
||||
#include "common/timerange.h"
|
||||
#include "node/block/subtitle/subtitle.h"
|
||||
#include "render/audioparams.h"
|
||||
#include "render/colortransform.h"
|
||||
@@ -209,9 +208,9 @@ public:
|
||||
|
||||
const EncodingParams& params() const;
|
||||
|
||||
virtual VideoParams::Format GetDesiredPixelFormat() const
|
||||
virtual PixelFormat GetDesiredPixelFormat() const
|
||||
{
|
||||
return VideoParams::kFormatInvalid;
|
||||
return PixelFormat::INVALID;
|
||||
}
|
||||
|
||||
const QString& GetError() const
|
||||
@@ -232,7 +231,7 @@ public:
|
||||
public slots:
|
||||
virtual bool Open() = 0;
|
||||
|
||||
virtual bool WriteFrame(olive::FramePtr frame, olive::rational time) = 0;
|
||||
virtual bool WriteFrame(olive::FramePtr frame, olive::core::rational time) = 0;
|
||||
virtual bool WriteAudio(const olive::SampleBuffer &audio) = 0;
|
||||
virtual bool WriteSubtitle(const SubtitleBlock *sub_block) = 0;
|
||||
|
||||
|
||||
@@ -42,7 +42,6 @@ extern "C" {
|
||||
#include "codec/planarfiledevice.h"
|
||||
#include "common/ffmpegutils.h"
|
||||
#include "common/filefunctions.h"
|
||||
#include "common/timecodefunctions.h"
|
||||
#include "render/renderer.h"
|
||||
#include "render/subtitleparams.h"
|
||||
|
||||
@@ -78,7 +77,7 @@ TexturePtr FFmpegDecoder::ProcessFrameIntoTexture(AVFramePtr f, const RetrieveVi
|
||||
{
|
||||
// Determine native format
|
||||
AVPixelFormat ideal_fmt = FFmpegUtils::GetCompatiblePixelFormat(static_cast<AVPixelFormat>(f->format));
|
||||
VideoParams::Format native_fmt = GetNativePixelFormat(ideal_fmt);
|
||||
PixelFormat native_fmt = GetNativePixelFormat(ideal_fmt);
|
||||
int native_channels = GetNativeChannelCount(ideal_fmt);
|
||||
|
||||
// Set up video params
|
||||
@@ -642,17 +641,17 @@ bool FFmpegDecoder::ConformAudioInternal(const QVector<QString> &filenames, cons
|
||||
return success;
|
||||
}
|
||||
|
||||
VideoParams::Format FFmpegDecoder::GetNativePixelFormat(AVPixelFormat pix_fmt)
|
||||
PixelFormat FFmpegDecoder::GetNativePixelFormat(AVPixelFormat pix_fmt)
|
||||
{
|
||||
switch (pix_fmt) {
|
||||
case AV_PIX_FMT_RGB24:
|
||||
case AV_PIX_FMT_RGBA:
|
||||
return VideoParams::kFormatUnsigned8;
|
||||
return PixelFormat::U8;
|
||||
case AV_PIX_FMT_RGB48:
|
||||
case AV_PIX_FMT_RGBA64:
|
||||
return VideoParams::kFormatUnsigned16;
|
||||
return PixelFormat::U16;
|
||||
default:
|
||||
return VideoParams::kFormatInvalid;
|
||||
return PixelFormat::INVALID;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ private:
|
||||
|
||||
void FreeScaler();
|
||||
|
||||
static VideoParams::Format GetNativePixelFormat(AVPixelFormat pix_fmt);
|
||||
static PixelFormat GetNativePixelFormat(AVPixelFormat pix_fmt);
|
||||
static int GetNativeChannelCount(AVPixelFormat pix_fmt);
|
||||
|
||||
static uint64_t ValidateChannelLayout(AVStream *stream);
|
||||
|
||||
@@ -29,7 +29,6 @@ extern "C" {
|
||||
#include <QFile>
|
||||
|
||||
#include "common/ffmpegutils.h"
|
||||
#include "common/timecodefunctions.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
@@ -130,7 +129,7 @@ bool FFmpegEncoder::Open()
|
||||
}
|
||||
|
||||
// This is the format we will expect frames received in Write() to be in
|
||||
VideoParams::Format native_pixel_fmt = params().video_params().format();
|
||||
PixelFormat native_pixel_fmt = params().video_params().format();
|
||||
|
||||
// This is the format we will need to convert the frame to for swscale to understand it
|
||||
video_conversion_fmt_ = FFmpegUtils::GetCompatiblePixelFormat(native_pixel_fmt);
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
|
||||
virtual bool Open() override;
|
||||
|
||||
virtual bool WriteFrame(olive::FramePtr frame, olive::rational time) override;
|
||||
virtual bool WriteFrame(olive::FramePtr frame, olive::core::rational time) override;
|
||||
|
||||
virtual bool WriteAudio(const olive::SampleBuffer &audio) override;
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
|
||||
virtual void Close() override;
|
||||
|
||||
virtual VideoParams::Format GetDesiredPixelFormat() const override
|
||||
virtual PixelFormat GetDesiredPixelFormat() const override
|
||||
{
|
||||
return video_conversion_fmt_;
|
||||
}
|
||||
@@ -91,7 +91,7 @@ private:
|
||||
AVFilterGraph *video_scale_ctx_;
|
||||
AVFilterContext *video_buffersrc_ctx_;
|
||||
AVFilterContext *video_buffersink_ctx_;
|
||||
VideoParams::Format video_conversion_fmt_;
|
||||
PixelFormat video_conversion_fmt_;
|
||||
|
||||
AVStream* audio_stream_;
|
||||
AVCodecContext* audio_codec_ctx_;
|
||||
|
||||
+2
-2
@@ -84,7 +84,7 @@ FramePtr Frame::Interlace(FramePtr top, FramePtr bottom)
|
||||
return interlaced;
|
||||
}
|
||||
|
||||
int Frame::generate_linesize_bytes(int width, VideoParams::Format format, int channel_count)
|
||||
int Frame::generate_linesize_bytes(int width, PixelFormat format, int channel_count)
|
||||
{
|
||||
// Align to 32 bytes (not sure if this is necessary?)
|
||||
return VideoParams::GetBytesPerPixel(format, channel_count) * ((width + 31) & ~31);
|
||||
@@ -146,7 +146,7 @@ void Frame::destroy()
|
||||
}
|
||||
}
|
||||
|
||||
FramePtr Frame::convert(VideoParams::Format format) const
|
||||
FramePtr Frame::convert(PixelFormat format) const
|
||||
{
|
||||
// Create new params with destination format
|
||||
VideoParams params = params_;
|
||||
|
||||
+4
-5
@@ -22,11 +22,10 @@
|
||||
#define FRAME_H
|
||||
|
||||
#include <memory>
|
||||
#include <olive/core/core.h>
|
||||
#include <QVector>
|
||||
|
||||
#include "common/define.h"
|
||||
#include "common/rational.h"
|
||||
#include "render/color.h"
|
||||
#include "render/videoparams.h"
|
||||
|
||||
namespace olive {
|
||||
@@ -53,7 +52,7 @@ public:
|
||||
|
||||
static FramePtr Interlace(FramePtr top, FramePtr bottom);
|
||||
|
||||
static int generate_linesize_bytes(int width, VideoParams::Format format, int channel_count);
|
||||
static int generate_linesize_bytes(int width, PixelFormat format, int channel_count);
|
||||
|
||||
int linesize_pixels() const
|
||||
{
|
||||
@@ -75,7 +74,7 @@ public:
|
||||
return params_.effective_height();
|
||||
}
|
||||
|
||||
VideoParams::Format format() const
|
||||
PixelFormat format() const
|
||||
{
|
||||
return params_.format();
|
||||
}
|
||||
@@ -152,7 +151,7 @@ public:
|
||||
return data_size_;
|
||||
}
|
||||
|
||||
FramePtr convert(VideoParams::Format format) const;
|
||||
FramePtr convert(PixelFormat format) const;
|
||||
|
||||
private:
|
||||
VideoParams params_;
|
||||
|
||||
@@ -205,7 +205,7 @@ bool OIIODecoder::OpenImageHandler(const QString &fn, int subimage)
|
||||
// We use RGBA frames because that tends to be the native format of GPUs
|
||||
pix_fmt_ = OIIOUtils::GetFormatFromOIIOBasetype(static_cast<OIIO::TypeDesc::BASETYPE>(spec.format.basetype));
|
||||
|
||||
if (pix_fmt_ == VideoParams::kFormatInvalid) {
|
||||
if (pix_fmt_ == PixelFormat::INVALID) {
|
||||
qWarning() << "Failed to convert OIIO::ImageDesc to native pixel format";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ private:
|
||||
|
||||
static VideoParams GetVideoParamsFromImageSpec(const OIIO::ImageSpec &spec);
|
||||
|
||||
VideoParams::Format pix_fmt_;
|
||||
PixelFormat pix_fmt_;
|
||||
OIIO::TypeDesc::BASETYPE oiio_pix_fmt_;
|
||||
|
||||
Frame buffer_;
|
||||
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
public slots:
|
||||
virtual bool Open() override;
|
||||
|
||||
virtual bool WriteFrame(olive::FramePtr frame, olive::rational time) override;
|
||||
virtual bool WriteFrame(olive::FramePtr frame, olive::core::rational time) override;
|
||||
virtual bool WriteAudio(const SampleBuffer &audio) override;
|
||||
virtual bool WriteSubtitle(const SubtitleBlock *sub_block) override;
|
||||
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
|
||||
#include "samplebuffer.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#include "common/cpuoptimize.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
Reference in New Issue
Block a user