Add function to figure out HDR type

This commit is contained in:
Adam Bissen 2023-10-07 17:25:58 -05:00
parent ae9e607a87
commit 411e6e3b55
3 changed files with 27 additions and 13 deletions

View File

@ -2,7 +2,6 @@
#include <QQmlApplicationEngine>
#include <myMediaInfo.h>
#include <QDebug>
#include <QFile>
@ -13,18 +12,13 @@ int main(int argc, char *argv[])
myMediaInfo mInfo;
//Check if HDR/DolbyVision
if (QFile::exists("Spider-Man.mkv")) {
mInfo.Open(__T("Spider-Man.mkv"));
qInfo() << mInfo.Get(MediaInfoDLL::Stream_Video, 0, __T("HDR_Format"), MediaInfoDLL::Info_Text, MediaInfoDLL::Info_Name);
enum myMediaInfo::HDR hdrType = mInfo.getHDR(__T("Cosmos.mkv"));
if (hdrType >= 0) {
qInfo() << hdrType;
} else {
qInfo() << "Doesn't exist";
qWarning() << "Could not open file.";
}
mInfo.Close();
//qInfo("Test");
//qInfo() << mInfo.Option(__T("Info_Parameters"));
//qInfo() << mInfo.Option(__T("Info_Codecs"));
QQmlApplicationEngine engine;
const QUrl url(u"qrc:/DoViGUI/Main.qml"_qs);

View File

@ -1,7 +1,25 @@
#include "myMediaInfo.h"
#include "MediaInfoDLL.h"
#include <QDebug>
myMediaInfo::myMediaInfo()
{
myMediaInfo::myMediaInfo() {
}
enum myMediaInfo::HDR myMediaInfo::getHDR(const MediaInfoDLL::String fileName) {
if (Open(fileName)) {
MediaInfoDLL::String HDRtext = Get(MediaInfoDLL::Stream_Video, 0, __T("HDR_Format"), MediaInfoDLL::Info_Text, MediaInfoDLL::Info_Name);
Close();
uint32_t position = HDRtext.find(__T("Dolby Vision"));
if (HDRtext.length()) {
return (position >= 0 && position < HDRtext.length()) ? DOVI : HDR;
} else {
return SDR;
}
}
return ERR;
}

View File

@ -7,9 +7,11 @@
class myMediaInfo : public MediaInfoDLL::MediaInfo{
// Q_OBJECT
public:
myMediaInfo();
enum HDR{ERR = -1, SDR = 0, HDR = 1, DOVI = 2};
enum HDR getHDR(const MediaInfoDLL::String fileName);
private: