Skip to content

Commit

Permalink
Fix compilation ubuntu and fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristianFeldmann committed Sep 28, 2023
2 parents 22fb303 + 3805e69 commit abf14fb
Show file tree
Hide file tree
Showing 18 changed files with 428 additions and 2,781 deletions.
2,444 changes: 0 additions & 2,444 deletions YUViewLib/src/common/Expected.h

This file was deleted.

3 changes: 0 additions & 3 deletions YUViewLib/src/common/FileInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@

#pragma once

#include <ffmpeg/FFmpegLibraryFunctions.h>

#include <QList>
#include <QMetaType>
#include <QString>
Expand Down Expand Up @@ -72,5 +70,4 @@ struct InfoData
QString title{};
QList<InfoItem> items{};
};

Q_DECLARE_METATYPE(InfoData)
35 changes: 2 additions & 33 deletions YUViewLib/src/common/Functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@

#include "Functions.h"

#include <QCoreApplication>
#include <QSettings>
#include <QThread>

#ifdef Q_OS_MAC
#include <sys/sysctl.h>
#include <sys/types.h>
Expand All @@ -47,6 +43,8 @@

#include <algorithm>

#include <QThread>

namespace functions
{

Expand Down Expand Up @@ -155,35 +153,6 @@ QString formatDataSize(double size, bool isBits)
return valueString;
}

std::vector<std::filesystem::path> getDefaultLibrarySearchPaths()
{
std::vector<std::filesystem::path> paths;

QSettings settings;

const auto decoderSearchPath = settings.value("SearchPath", "").toString().toStdString();
if (!decoderSearchPath.empty())
paths.push_back(decoderSearchPath);

settings.beginGroup("Decoders");
const auto ffmpegPath = settings.value("FFmpeg.path", "").toString().toStdString();
if (!ffmpegPath.empty())
paths.push_back(ffmpegPath);
settings.endGroup();

paths.push_back(std::filesystem::current_path() / "ffmpeg");
paths.push_back(std::filesystem::current_path() / "decoder");

const auto appPath = std::filesystem::path(QCoreApplication::applicationDirPath().toStdString());
paths.push_back(appPath);
paths.push_back(appPath / "ffmpeg");
paths.push_back(appPath / "decoder");

paths.push_back({});

return paths;
}

QStringList toQStringList(const std::vector<std::string> &stringVec)
{
QStringList list;
Expand Down
3 changes: 0 additions & 3 deletions YUViewLib/src/common/Functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

#include <common/Typedef.h>

#include <filesystem>
#include <optional>

namespace functions
Expand Down Expand Up @@ -63,8 +62,6 @@ QStringList getThemeColors(QString themeName);
// compatible.
QString formatDataSize(double size, bool isBits = false);

std::vector<std::filesystem::path> getDefaultLibrarySearchPaths();

QStringList toQStringList(const std::vector<std::string> &stringVec);
std::string toLower(std::string str);

Expand Down
1 change: 1 addition & 0 deletions YUViewLib/src/common/Typedef.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ template <typename T> using vector4d = std::vector<vector3d<T>>;
template <typename T, size_t N> using array = std::array<T, N>;
template <typename T, size_t N1, size_t N2> using array2d = std::array<std::array<T, N2>, N1>;


template <typename T> int indexInVec(const std::vector<T> &vec, const T &item)
{
auto it = std::find(vec.begin(), vec.end(), item);
Expand Down
8 changes: 5 additions & 3 deletions YUViewLib/src/decoder/decoderBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ class decoderBase
bool errorInDecoder() const { return decoderState == DecoderState::Error; }
QString decoderErrorString() const { return errorString; }

virtual std::vector<InfoItem> getDecoderInfo() const = 0;
// Get the name, filename and full path to the decoder library(s) that is/are being used.
// The length of the list must be a multiple of 3 (name, libName, fullPath)
virtual QStringList getLibraryPaths() const = 0;

// Get the decoder name (everyting that is needed to identify the decoder library) and the codec
// that is being decoded. If needed, also version information (like HM 16.4)
Expand Down Expand Up @@ -180,9 +182,9 @@ class decoderBaseSingleLib : public decoderBase
decoderBaseSingleLib(bool cachingDecoder = false) : decoderBase(cachingDecoder){};
virtual ~decoderBaseSingleLib(){};

std::vector<InfoItem> getDecoderInfo() const override
QStringList getLibraryPaths() const override
{
return {{this->getDecoderName(), this->library.fileName(), this->library.fileName()}};
return QStringList() << getDecoderName() << library.fileName() << library.fileName();
}

protected:
Expand Down
8 changes: 4 additions & 4 deletions YUViewLib/src/decoder/decoderFFmpeg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ decoderFFmpeg::decoderFFmpeg(FFmpeg::AVCodecIDWrapper codecID,
{
// The libraries are only loaded on demand. This way a FFmpegLibraries instance can exist without
// loading the libraries which is slow and uses a lot of memory.
const auto result = this->ff.loadFFmpegLibraries(functions::getDefaultLibrarySearchPaths());
if (!result.success)
this->ff.loadFFmpegLibraries();
if (!this->ff.loadingSuccessfull())
return;

// Create the cofiguration parameters
Expand Down Expand Up @@ -99,8 +99,8 @@ decoderFFmpeg::decoderFFmpeg(FFmpeg::AVCodecParametersWrapper codecpar, bool cac
{
// The libraries are only loaded on demand. This way a FFmpegLibraries instance can exist without
// loading the libraries which is slow and uses a lot of memory.
const auto result = this->ff.loadFFmpegLibraries(functions::getDefaultLibrarySearchPaths());
if (!result.success)
this->ff.loadFFmpegLibraries();
if (!this->ff.loadingSuccessfull())
return;

auto codecID = this->ff.getCodecIDWrapper(codecpar.getCodecID());
Expand Down
6 changes: 3 additions & 3 deletions YUViewLib/src/decoder/decoderFFmpeg.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ class decoderFFmpeg : public decoderBase
// What statistics do we support?
void fillStatisticList(stats::StatisticsData &statisticsData) const override;

std::vector<InfoItem> getDecoderInfo() const override;
QString getDecoderName() const override { return "FFmpeg"; }
QString getCodecName() const override { return this->codecName; }
QStringList getLibraryPaths() const override { return ff.getLibPaths(); }
QString getDecoderName() const override { return "FFmpeg"; }
QString getCodecName() const override { return this->codecName; }

static QStringList getLogMessages() { return FFmpeg::FFmpegVersionHandler::getFFmpegLog(); }

Expand Down
10 changes: 0 additions & 10 deletions YUViewLib/src/ffmpeg/FFMpegLibrariesTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,6 @@
namespace FFmpeg
{

struct LibraryLoadingResult
{
explicit operator bool() const { return this->success; };
bool success{false};
std::string errorMessage;
std::string loadingLog;

void addLogLine(std::string line) { this->loadingLog.append(line + "\n"); }
};

// Some structs/enums which actual definition does not interest us.
struct AVFormatContext;
struct AVClass;
Expand Down
Loading

0 comments on commit abf14fb

Please sign in to comment.