Update app to support linux.

This commit is contained in:
Adam Bissen 2023-12-23 11:29:36 +00:00
parent 081e541b5c
commit dc43da0e0e
5 changed files with 23 additions and 8 deletions

View File

@ -76,9 +76,10 @@ Window {
id: videoFileDialog
fileMode: FileDialog.OpenFile
nameFilters: ["Video files (*.mkv *.mp4)", "All files (*)"]
onAccepted: { const reg = /^file:\/\/\// //Remove "file:/// at start of URL
var fileName = videoFileDialog.selectedFile.toString().replace(reg, "")
txtVideoFile.text = fileName
onAccepted: {
//Remove "file:/// at start of URL
var fileName = mediaInfo.fixFileName(videoFileDialog.selectedFile.toString());
txtVideoFile.text = fileName;
switch (mediaInfo.getHDRType(fileName)) {
case 0:

View File

@ -3,11 +3,9 @@
#include <QDebug>
QMediaInfo::QMediaInfo(QObject *parent){}
enum QMediaInfo::HDR_Type QMediaInfo::getHDRType(const MediaInfoDLL::String fileName) {
enum QMediaInfo::HDR_Type QMediaInfo::getHDRType(MediaInfoDLL::String fileName) {
if (Open(fileName)) {
MediaInfoDLL::String HDRtext = Get(MediaInfoDLL::Stream_Video, 0, __T("HDR_Format"), MediaInfoDLL::Info_Text, MediaInfoDLL::Info_Name);
Close();
@ -24,5 +22,17 @@ enum QMediaInfo::HDR_Type QMediaInfo::getHDRType(const MediaInfoDLL::String file
}
enum QMediaInfo::HDR_Type QMediaInfo::getHDRType(const QString fileName) {
#ifdef linux
return getHDRType(fileName.toStdString());
#else
return getHDRType(fileName.toStdWString());
#endif
}
QString QMediaInfo::fixFileName(QString fileName) {
#ifdef linux
return fileName.remove(0, 7);
#else
return fileName.remove(0, 8);
#endif
}

View File

@ -11,10 +11,11 @@ class QMediaInfo : public QObject, public MediaInfoDLL::MediaInfo {
public:
QMediaInfo(QObject* parent = nullptr);
enum HDR_Type{ERR = -1, SDR = 0, HDR = 1, DOVI = 2};
Q_ENUM(HDR_Type)
enum HDR_Type getHDRType(const MediaInfoDLL::String fileName);
Q_ENUM(HDR_Type)
Q_INVOKABLE enum HDR_Type getHDRType(QString fileName);
Q_INVOKABLE QString fixFileName(QString fileName);
private:

View File

@ -26,6 +26,9 @@ int main(int argc, char *argv[])
qInfo() << "Success";
//handbrake.startEncode();
}
else if (handbrake.setPath("/usr/bin/HandBrakeCLI")) {
qInfo() << "Succes Linux";
}
else {
qInfo() << "fail";
}

BIN
MediaInfo.dll Normal file

Binary file not shown.