Rename mediaInfo. Start work on handbrake process
This commit is contained in:
parent
eeaec187cb
commit
081e541b5c
@ -17,8 +17,9 @@ qt_add_qml_module(appDoViGUI
|
|||||||
VERSION 1.0
|
VERSION 1.0
|
||||||
QML_FILES Main.qml
|
QML_FILES Main.qml
|
||||||
SOURCES MediaInfoDLL.h
|
SOURCES MediaInfoDLL.h
|
||||||
SOURCES myMediaInfo.h myMediaInfo.cpp
|
SOURCES QMediaInfo.h QMediaInfo.cpp
|
||||||
RESOURCES MediaInfo.dll
|
RESOURCES MediaInfo.dll
|
||||||
|
SOURCES QHandbrake.h QHandbrake.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
|
# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
|
||||||
|
@ -56,6 +56,20 @@ Window {
|
|||||||
wrapMode: TextEdit.Wrap
|
wrapMode: TextEdit.Wrap
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
id: btnStartEncode
|
||||||
|
anchors.topMargin: 25
|
||||||
|
anchors.leftMargin: 25
|
||||||
|
anchors.top: hdrType.bottom
|
||||||
|
anchors.left: parent.left
|
||||||
|
text: "Start Encode"
|
||||||
|
font.pixelSize: 14
|
||||||
|
onClicked: handbrake.startEncode()
|
||||||
|
flat: false
|
||||||
|
height: font.pixelSize + 10
|
||||||
|
width: 100
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
FileDialog {
|
FileDialog {
|
||||||
|
30
DoViGUI/QHandbrake.cpp
Normal file
30
DoViGUI/QHandbrake.cpp
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#include "QHandbrake.h"
|
||||||
|
#include <QFile>
|
||||||
|
#include <QProcess>
|
||||||
|
|
||||||
|
QHandbrake::QHandbrake(QObject *parent)
|
||||||
|
: QObject{parent}
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t QHandbrake::setPath(QString pathIn)
|
||||||
|
{
|
||||||
|
if (QFile::exists(pathIn)) {
|
||||||
|
exePath = pathIn;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t QHandbrake::startEncode()
|
||||||
|
{
|
||||||
|
//HandBrakeCLI -i "../%TITLE%/%TITLE% - 4k.mkv" -o "../%TITLE%/temp/handbrake.mkv" -f av_mkv -m -e x265_10bit --encoder-preset slower -q 20 --encoder-profile auto --all-audio -E copy --audio-copy-mask aac,eac3,dts,ac3,truehd,dtshd,mp3 --crop-mode auto --auto-anamorphic --all-subtitles > "../%TITLE%/temp/log.txt"
|
||||||
|
QStringList arguments;
|
||||||
|
arguments << "-i" << "Cosmos.mkv" << "-o" << "test.mkv" << "-f" << "av_mkv" << "-m" << "-e" << "x265_10bit" << "--encoder-preset" << "slower" << "-q" << "20" << "--encoder-profile" << "auto" << "--all-audio" << "-E" << "copy" << "--audio-copy-mask" << "aac,eac3,dts,ac3,truehd,dtshd,mp3" << "--crop-mode" << "auto" << "--auto-anamorphic" << "--all-subtitles";
|
||||||
|
|
||||||
|
QProcess *myProcess = new QProcess(parent());
|
||||||
|
myProcess->start(exePath, arguments);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
22
DoViGUI/QHandbrake.h
Normal file
22
DoViGUI/QHandbrake.h
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#ifndef QHANDBRAKE_H
|
||||||
|
#define QHANDBRAKE_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
class QHandbrake : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit QHandbrake(QObject *parent = nullptr);
|
||||||
|
uint8_t setPath(QString pathIn);
|
||||||
|
Q_INVOKABLE uint8_t startEncode();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString exePath = "";
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // QHANDBRAKE_H
|
@ -1,14 +1,13 @@
|
|||||||
#include "myMediaInfo.h"
|
#include "QMediaInfo.h"
|
||||||
#include "MediaInfoDLL.h"
|
#include "MediaInfoDLL.h"
|
||||||
#include "qvariant.h"
|
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
myMediaInfo::myMediaInfo(QObject *parent){}
|
QMediaInfo::QMediaInfo(QObject *parent){}
|
||||||
|
|
||||||
enum myMediaInfo::HDR_Type myMediaInfo::getHDRType(const MediaInfoDLL::String fileName) {
|
enum QMediaInfo::HDR_Type QMediaInfo::getHDRType(const MediaInfoDLL::String fileName) {
|
||||||
if (Open(fileName)) {
|
if (Open(fileName)) {
|
||||||
MediaInfoDLL::String HDRtext = Get(MediaInfoDLL::Stream_Video, 0, __T("HDR_Format"), MediaInfoDLL::Info_Text, MediaInfoDLL::Info_Name);
|
MediaInfoDLL::String HDRtext = Get(MediaInfoDLL::Stream_Video, 0, __T("HDR_Format"), MediaInfoDLL::Info_Text, MediaInfoDLL::Info_Name);
|
||||||
Close();
|
Close();
|
||||||
@ -24,6 +23,6 @@ enum myMediaInfo::HDR_Type myMediaInfo::getHDRType(const MediaInfoDLL::String fi
|
|||||||
return ERR;
|
return ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum myMediaInfo::HDR_Type myMediaInfo::getHDRType(const QString fileName) {
|
enum QMediaInfo::HDR_Type QMediaInfo::getHDRType(const QString fileName) {
|
||||||
return getHDRType(fileName.toStdWString());
|
return getHDRType(fileName.toStdWString());
|
||||||
}
|
}
|
@ -1,15 +1,15 @@
|
|||||||
#ifndef MYMEDIAINFO_H
|
#ifndef QMEDIAINFO_H
|
||||||
#define MYMEDIAINFO_H
|
#define QMEDIAINFO_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
//#include "qvariant.h"
|
//#include "qvariant.h"
|
||||||
#include <MediaInfoDLL.h>
|
#include <MediaInfoDLL.h>
|
||||||
|
|
||||||
class myMediaInfo : public QObject, public MediaInfoDLL::MediaInfo {
|
class QMediaInfo : public QObject, public MediaInfoDLL::MediaInfo {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
myMediaInfo(QObject* parent = nullptr);
|
QMediaInfo(QObject* parent = nullptr);
|
||||||
enum HDR_Type{ERR = -1, SDR = 0, HDR = 1, DOVI = 2};
|
enum HDR_Type{ERR = -1, SDR = 0, HDR = 1, DOVI = 2};
|
||||||
Q_ENUM(HDR_Type)
|
Q_ENUM(HDR_Type)
|
||||||
|
|
||||||
@ -21,4 +21,4 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // MYMEDIAINFO_H
|
#endif // QMEDIAINFO_H
|
@ -1,6 +1,7 @@
|
|||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
#include <QQmlApplicationEngine>
|
#include <QQmlApplicationEngine>
|
||||||
#include <myMediaInfo.h>
|
#include <QMediaInfo.h>
|
||||||
|
#include <QHandbrake.h>
|
||||||
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QQmlContext>
|
#include <QQmlContext>
|
||||||
@ -10,19 +11,29 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
QGuiApplication app(argc, argv);
|
QGuiApplication app(argc, argv);
|
||||||
|
|
||||||
myMediaInfo mInfo(&app);
|
QMediaInfo mInfo(&app);
|
||||||
|
|
||||||
//Check if HDR/DolbyVision
|
// //Check if HDR/DolbyVision
|
||||||
enum myMediaInfo::HDR_Type hdrType = mInfo.getHDRType(__T("Cosmos.mkv"));
|
// enum QMediaInfo::HDR_Type hdrType = mInfo.getHDRType(__T("Cosmos.mkv"));
|
||||||
if (hdrType >= 0) {
|
// if (hdrType >= 0) {
|
||||||
qInfo() << hdrType;
|
// qInfo() << hdrType;
|
||||||
} else {
|
// } else {
|
||||||
qWarning() << "Could not open file.";
|
// qWarning() << "Could not open file.";
|
||||||
|
// }
|
||||||
|
|
||||||
|
QHandbrake handbrake;
|
||||||
|
if (handbrake.setPath("J:\\Video\\VideoTools\\HandBrakeCLI.exe") ==1 ) {
|
||||||
|
qInfo() << "Success";
|
||||||
|
//handbrake.startEncode();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
qInfo() << "fail";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QQmlApplicationEngine engine;
|
QQmlApplicationEngine engine;
|
||||||
engine.rootContext()->setContextProperty("mediaInfo", &mInfo);
|
engine.rootContext()->setContextProperty("mediaInfo", &mInfo);
|
||||||
|
engine.rootContext()->setContextProperty("handbrake", &handbrake);
|
||||||
|
|
||||||
const QUrl url(u"qrc:/DoViGUI/Main.qml"_qs);
|
const QUrl url(u"qrc:/DoViGUI/Main.qml"_qs);
|
||||||
QObject::connect(&engine, &QQmlApplicationEngine::objectCreationFailed,
|
QObject::connect(&engine, &QQmlApplicationEngine::objectCreationFailed,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user