Adapt to changes in tagparser

This commit is contained in:
Martchus 2021-01-30 21:57:09 +01:00
parent 06fd8c58d7
commit 670a9a1c91
12 changed files with 92 additions and 100 deletions

View File

@ -177,9 +177,9 @@ printDiagMsg:
}
}
void printProperty(const char *propName, const char *value, const char *suffix, Indentation indentation)
void printProperty(const char *propName, std::string_view value, const char *suffix, Indentation indentation)
{
if (!*value) {
if (value.empty()) {
return;
}
const auto propLen(strlen(propName));
@ -613,53 +613,54 @@ FieldDenotations parseFieldDenotations(const Argument &fieldsArg, bool readOnly)
}
template <class ConcreteTag, TagType tagTypeMask = ConcreteTag::tagType>
std::pair<std::vector<const TagValue *>, bool> valuesForNativeField(const char *idString, std::size_t idStringSize, const Tag *tag, TagType tagType)
std::pair<std::vector<const TagValue *>, bool> valuesForNativeField(std::string_view idString, const Tag *tag, TagType tagType)
{
auto res = make_pair<std::vector<const TagValue *>, bool>({}, false);
if (!(tagType & tagTypeMask)) {
return res;
}
res.first = static_cast<const ConcreteTag *>(tag)->values(ConcreteTag::FieldType::fieldIdFromString(idString, idStringSize));
res.first = static_cast<const ConcreteTag *>(tag)->values(ConcreteTag::FieldType::fieldIdFromString(idString));
res.second = true;
return res;
}
template <class ConcreteTag, TagType tagTypeMask = ConcreteTag::tagType>
bool setValuesForNativeField(const char *idString, std::size_t idStringSize, Tag *tag, TagType tagType, const std::vector<TagValue> &values)
bool setValuesForNativeField(std::string_view idString, Tag *tag, TagType tagType, const std::vector<TagValue> &values)
{
if (!(tagType & tagTypeMask)) {
return false;
}
return static_cast<ConcreteTag *>(tag)->setValues(ConcreteTag::FieldType::fieldIdFromString(idString, idStringSize), values);
return static_cast<ConcreteTag *>(tag)->setValues(ConcreteTag::FieldType::fieldIdFromString(idString), values);
}
inline FieldId::FieldId(const char *nativeField, std::size_t nativeFieldSize, const GetValuesForNativeFieldType &valuesForNativeField,
const SetValuesForNativeFieldType &setValuesForNativeField)
inline FieldId::FieldId(
std::string_view nativeField, const GetValuesForNativeFieldType &valuesForNativeField, const SetValuesForNativeFieldType &setValuesForNativeField)
: m_knownField(KnownField::Invalid)
, m_nativeField(nativeField, nativeFieldSize)
, m_nativeField(nativeField)
, m_valuesForNativeField(valuesForNativeField)
, m_setValuesForNativeField(setValuesForNativeField)
{
}
/// \remarks This wrapper is required because specifying c'tor template args is not possible.
template <class ConcreteTag, TagType tagTypeMask> FieldId FieldId::fromNativeField(const char *nativeFieldId, std::size_t nativeFieldIdSize)
template <class ConcreteTag, TagType tagTypeMask> FieldId FieldId::fromNativeField(std::string_view nativeFieldId)
{
return FieldId(nativeFieldId, nativeFieldIdSize, bind(&valuesForNativeField<ConcreteTag, tagTypeMask>, nativeFieldId, nativeFieldIdSize, _1, _2),
bind(&setValuesForNativeField<ConcreteTag, tagTypeMask>, nativeFieldId, nativeFieldIdSize, _1, _2, _3));
return FieldId(nativeFieldId, bind(&valuesForNativeField<ConcreteTag, tagTypeMask>, nativeFieldId, _1, _2),
bind(&setValuesForNativeField<ConcreteTag, tagTypeMask>, nativeFieldId, _1, _2, _3));
}
FieldId FieldId::fromTagDenotation(const char *denotation, size_t denotationSize)
{
// check for native, format-specific denotation
if (!strncmp(denotation, "mkv:", 4)) {
return FieldId::fromNativeField<MatroskaTag>(denotation + 4, denotationSize - 4);
return FieldId::fromNativeField<MatroskaTag>(std::string_view(denotation + 4, denotationSize - 4));
} else if (!strncmp(denotation, "mp4:", 4)) {
return FieldId::fromNativeField<Mp4Tag>(denotation + 4, denotationSize - 4);
return FieldId::fromNativeField<Mp4Tag>(std::string_view(denotation + 4, denotationSize - 4));
} else if (!strncmp(denotation, "vorbis:", 7)) {
return FieldId::fromNativeField<VorbisComment, TagType::VorbisComment | TagType::OggVorbisComment>(denotation + 7, denotationSize - 7);
return FieldId::fromNativeField<VorbisComment, TagType::VorbisComment | TagType::OggVorbisComment>(
std::string_view(denotation + 7, denotationSize - 7));
} else if (!strncmp(denotation, "id3:", 7)) {
return FieldId::fromNativeField<Id3v2Tag>(denotation + 4, denotationSize - 4);
return FieldId::fromNativeField<Id3v2Tag>(std::string_view(denotation + 4, denotationSize - 4));
} else if (!strncmp(denotation, "generic:", 8)) {
// allow prefix 'generic:' for consistency
denotation += 8, denotationSize -= 8;

View File

@ -62,10 +62,9 @@ public:
private:
using GetValuesForNativeFieldType = std::function<std::pair<std::vector<const TagValue *>, bool>(const Tag *, TagType)>;
using SetValuesForNativeFieldType = std::function<bool(Tag *, TagType, const std::vector<TagValue> &)>;
FieldId(const char *nativeField, std::size_t nativeFieldSize, const GetValuesForNativeFieldType &valuesForNativeField,
FieldId(std::string_view nativeField, const GetValuesForNativeFieldType &valuesForNativeField,
const SetValuesForNativeFieldType &setValuesForNativeField);
template <class ConcreteTag, TagType tagTypeMask = ConcreteTag::tagType>
static FieldId fromNativeField(const char *nativeFieldId, std::size_t nativeFieldIdSize);
template <class ConcreteTag, TagType tagTypeMask = ConcreteTag::tagType> static FieldId fromNativeField(std::string_view nativeFieldId);
KnownField m_knownField;
std::string m_denotation;
@ -245,14 +244,9 @@ constexpr bool isDigit(char c)
std::string incremented(const std::string &str, unsigned int toIncrement = 1);
void printDiagMessages(const TagParser::Diagnostics &diag, const char *head = nullptr, bool beVerbose = false);
void printProperty(const char *propName, const char *value, const char *suffix = nullptr, CppUtilities::Indentation indentation = 4);
void printProperty(const char *propName, std::string_view value, const char *suffix = nullptr, CppUtilities::Indentation indentation = 4);
void printProperty(const char *propName, ElementPosition elementPosition, const char *suffix = nullptr, CppUtilities::Indentation indentation = 4);
inline void printProperty(const char *propName, const std::string &value, const char *suffix = nullptr, CppUtilities::Indentation indentation = 4)
{
printProperty(propName, value.data(), suffix, indentation);
}
extern CppUtilities::TimeSpanOutputFormat timeSpanOutputFormat;
inline void printProperty(

View File

@ -42,7 +42,7 @@ struct TargetInfo : ReflectiveRapidJSON::JsonSerializable<TargetInfo> {
struct TagInfo : ReflectiveRapidJSON::JsonSerializable<TagInfo> {
TagInfo(const TagParser::Tag &tag, RAPIDJSON_NAMESPACE::Document::AllocatorType &allocator);
const char *format = nullptr;
std::string_view format;
TargetInfo target;
std::unordered_map<std::string, std::vector<TagValue>> fields;
};
@ -52,7 +52,7 @@ struct FileInfo : ReflectiveRapidJSON::JsonSerializable<FileInfo> {
std::string fileName;
std::size_t size;
const char *mimeType;
std::string_view mimeType;
std::vector<TagInfo> tags;
std::string formatSummary;
CppUtilities::TimeSpan duration;

View File

@ -159,7 +159,7 @@ void displayFileInfo(const ArgumentOccurrence &, const Argument &filesArg, const
cout << "Technical information for \"" << file << "\":\n";
cout << " - " << TextAttribute::Bold << "Container format: " << fileInfo.containerFormatName() << Phrases::End;
printProperty("Size", dataSizeToString(fileInfo.size()));
if (const char *const mimeType = fileInfo.mimeType()) {
if (const auto mimeType = fileInfo.mimeType(); !mimeType.empty()) {
printProperty("Mime-type", mimeType);
}
const auto duration = fileInfo.duration();
@ -202,9 +202,9 @@ void displayFileInfo(const ArgumentOccurrence &, const Argument &filesArg, const
if (const auto &language = track->locale().fullOrSomeAbbreviatedName(); !language.empty()) {
printProperty("Language", language);
}
const char *fmtName = track->formatName(), *fmtAbbr = track->formatAbbreviation();
const auto fmtName = track->formatName(), fmtAbbr = track->formatAbbreviation();
printProperty("Format", fmtName);
if (strcmp(fmtName, fmtAbbr)) {
if (fmtName != fmtAbbr) {
printProperty("Abbreviation", fmtAbbr);
}
printProperty("Extensions", track->format().extensionName());
@ -223,13 +223,13 @@ void displayFileInfo(const ArgumentOccurrence &, const Argument &filesArg, const
if (track->pixelAspectRatio().isValid()) {
printProperty("Pixel Aspect Ratio", track->pixelAspectRatio().toString());
}
if (track->channelConfigString()) {
printProperty("Channel config", track->channelConfigString());
if (const auto cc = track->channelConfigString(); !cc.empty()) {
printProperty("Channel config", cc);
} else {
printProperty("Channel count", track->channelCount());
}
if (track->extensionChannelConfigString()) {
printProperty("Extension channel config", track->extensionChannelConfigString());
if (const auto ecc = track->extensionChannelConfigString(); !ecc.empty()) {
printProperty("Extension channel config", ecc);
}
if (track->bitrate() > 0.0) {
printProperty("Bitrate", bitrateToString(track->bitrate()));
@ -823,7 +823,7 @@ void extractField(
continue;
}
for (const TagValue *value : valuesForField.first) {
values.emplace_back(value, joinStrings({ tag->typeName(), numberToString(values.size()) }, "-", true));
values.emplace_back(value, joinStrings({ std::string(tag->typeName()), numberToString(values.size()) }, "-", true));
}
} catch (const ConversionException &e) {
diag.emplace_back(DiagLevel::Critical,

View File

@ -89,8 +89,9 @@ EnterTargetDialog::~EnterTargetDialog()
void EnterTargetDialog::updateLevelNamePlaceholderText(int i)
{
const char *levelName = i >= 0 ? tagTargetLevelName(containerTargetLevel(m_currentContainerFormat, static_cast<std::uint32_t>(i))) : nullptr;
m_ui->levelNameLineEdit->setPlaceholderText(levelName ? QString::fromUtf8(levelName) : QString());
const auto levelName
= i >= 0 ? tagTargetLevelName(containerTargetLevel(m_currentContainerFormat, static_cast<std::uint32_t>(i))) : std::string_view();
m_ui->levelNameLineEdit->setPlaceholderText(QString::fromUtf8(levelName.data(), levelName.size()));
}
TagParser::TagTarget EnterTargetDialog::target() const

View File

@ -49,6 +49,11 @@ QStandardItem *defaultItem(const QString &text)
return item;
}
QStandardItem *defaultItem(std::string_view text)
{
return defaultItem(QString::fromUtf8(text.data(), text.size()));
}
class ItemHelper {
public:
ItemHelper(QStandardItem *item)
@ -64,15 +69,10 @@ public:
}
}
void appendRow(const QString &label, const char *text)
{
appendRow(label, QString::fromUtf8(text));
}
void appendRow(const QString &label, const string &text)
void appendRow(const QString &label, std::string_view text)
{
if (!text.empty()) {
appendRow(label, text.data());
appendRow(label, QString::fromUtf8(text.data(), text.size()));
}
}
@ -297,10 +297,7 @@ void FileInfoModel::updateCache()
rootHelper.appendRow(tr("Duration"), duration);
rootHelper.appendRow(tr("Overall avg. bitrate"), bitrateToString(m_file->overallAverageBitrate()));
}
const char *const mimeType = m_file->mimeType();
if (*mimeType) {
rootHelper.appendRow(tr("Mime-type"), mimeType);
}
rootHelper.appendRow(tr("Mime-type"), m_file->mimeType());
// 3 columns
setItem(0, 2, new QStandardItem);
@ -308,17 +305,18 @@ void FileInfoModel::updateCache()
int currentRow;
// add container item (last top-level-item which is always present)
auto *containerItem = defaultItem(tr("Container"));
auto *const containerItem = defaultItem(tr("Container"));
ItemHelper containerHelper(containerItem);
setItem(currentRow = rowCount(), containerItem);
// -> add container name
QString containerName;
const char *const subversion = m_file->containerFormatSubversion();
if (*subversion) {
containerName = QString::fromUtf8(m_file->containerFormatName()) % QChar(' ') % QString::fromUtf8(m_file->containerFormatSubversion());
const auto containerFormatName = m_file->containerFormatName();
if (const auto subversion = m_file->containerFormatSubversion(); !subversion.empty()) {
containerName = QString::fromUtf8(containerFormatName.data(), containerFormatName.size()) % QChar(' ')
% QString::fromUtf8(subversion.data(), subversion.size());
} else {
containerName = QString::fromUtf8(m_file->containerFormatName());
containerName = QString::fromUtf8(containerFormatName.data(), containerFormatName.size());
}
setItem(currentRow, 1, defaultItem(containerName));
@ -388,9 +386,9 @@ void FileInfoModel::updateCache()
trackHelper.appendRow(tr("Number"), track->trackNumber());
trackHelper.appendRow(tr("Name"), track->name());
trackHelper.appendRow(tr("Type"), track->mediaTypeName());
const char *fmtName = track->formatName(), *fmtAbbr = track->formatAbbreviation();
const auto fmtName = track->formatName(), fmtAbbr = track->formatAbbreviation();
trackHelper.appendRow(tr("Format"), fmtName);
if (track->format() != GeneralMediaFormat::Unknown && strcmp(fmtName, fmtAbbr)) { // format name and abbreviation differ
if (track->format() != GeneralMediaFormat::Unknown && fmtName != fmtAbbr) {
trackHelper.appendRow(tr("Abbreviation"), fmtAbbr);
}
if (track->version() > 0) {
@ -403,9 +401,9 @@ void FileInfoModel::updateCache()
trackHelper.appendRow(tr("Version"), QString::number(track->version()));
}
}
fmtName = track->format().extensionName();
if (*fmtName) {
trackHelper.appendRow(tr("Extension"), fmtName);
const auto fmtName2 = track->format().extensionName();
if (!fmtName.empty()) {
trackHelper.appendRow(tr("Extension"), fmtName2);
}
if (!track->formatId().empty()) {
trackHelper.appendRow(tr("Format/codec ID"), track->formatId());
@ -464,11 +462,11 @@ void FileInfoModel::updateCache()
if (!track->resolution().isNull()) {
trackHelper.appendRow(tr("Resolution"), track->resolution());
}
if (track->channelConfigString()) {
if (const auto cc = track->channelConfigString(); !cc.empty()) {
const auto ecc = track->extensionChannelConfigString();
trackHelper.appendRow(tr("Channel config"),
track->extensionChannelConfigString() ? QString::fromUtf8(track->extensionChannelConfigString()) % QStringLiteral(" / ")
% QString::fromUtf8(track->channelConfigString())
: QString::fromUtf8(track->channelConfigString()));
!ecc.empty() ? QString::fromUtf8(ecc.data(), ecc.size()) % QStringLiteral(" / ") % QString::fromUtf8(cc.data(), cc.size())
: QString::fromUtf8(cc.data(), cc.size()));
} else {
trackHelper.appendRow(tr("Channel count"), track->channelCount());
}

View File

@ -421,7 +421,8 @@ void PicturePreviewSelection::addOfSelectedType(const QString &path)
fileInfo.parseContainerFormat(diag);
// TODO: show diagnostic messages
auto mimeType = QString::fromUtf8(fileInfo.mimeType());
const auto detectedMimeType = fileInfo.mimeType();
auto mimeType = QString::fromUtf8(detectedMimeType.data(), detectedMimeType.size());
bool ok;
mimeType = QInputDialog::getText(
this, tr("Enter/confirm MIME type"), tr("Confirm or enter the MIME type of the selected file."), QLineEdit::Normal, mimeType, &ok);

View File

@ -199,7 +199,8 @@ QString TagEdit::generateLabel() const
QStringList tagNames;
tagNames.reserve(m_tags.size());
for (const Tag *const tag : m_tags) {
tagNames << QString::fromUtf8(tag->typeName());
const auto typeName = tag->typeName();
tagNames << QString::fromUtf8(typeName.data(), typeName.size());
if (!differentTargets && !(target == tag->target())) {
differentTargets = true;
}

View File

@ -919,7 +919,9 @@ void TagFieldEdit::handleRestoreButtonClicked()
QMenu menu;
int i = 0;
for (auto *const tag : tags()) {
const auto *const action = menu.addAction(tr("restore to value from %1 (%2)").arg(tag->typeName()).arg(++i));
const auto typeName = tag->typeName();
const auto *const action
= menu.addAction(tr("restore to value from %1 (%2)").arg(QString::fromUtf8(typeName.data(), typeName.size())).arg(++i));
connect(action, &QAction::triggered, [this, tag] {
setLocked(false);
updateValue(tag, PreviousValueHandling::Clear);

View File

@ -61,16 +61,6 @@ using namespace Utility;
namespace HtmlInfo {
inline QString qstr(const char *cstr)
{
return QString::fromUtf8(cstr);
}
inline QString qstr(const string &stdstr)
{
return QString::fromUtf8(stdstr.data(), static_cast<int>(stdstr.size()));
}
class RowMaker {
public:
RowMaker(QXmlStreamWriter &writer)
@ -283,10 +273,10 @@ template <> void mkElementContent(QXmlStreamWriter &writer, EbmlElement *element
writer.writeCharacters(QStringLiteral(", denoted type: 0x"));
writer.writeCharacters(QString::number(seekId, 16));
if (seekId <= numeric_limits<std::uint32_t>::max()) {
const char *const seekIdName = matroskaIdName(static_cast<std::uint32_t>(seekId));
if (*seekIdName) {
const auto seekIdName = matroskaIdName(static_cast<std::uint32_t>(seekId));
if (!seekIdName.empty()) {
writer.writeCharacters(QStringLiteral(" \""));
writer.writeCharacters(QString::fromLatin1(seekIdName));
writer.writeCharacters(QString::fromLatin1(seekIdName.data(), seekIdName.size()));
writer.writeCharacters(QStringLiteral("\""));
}
}
@ -538,10 +528,10 @@ public:
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Name"), qstr(track->name()));
}
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Type"), qstr(track->mediaTypeName()));
const char *fmtName = track->formatName(), *fmtAbbr = track->formatAbbreviation();
auto fmtName = track->formatName(), fmtAbbr = track->formatAbbreviation();
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Format"),
QCoreApplication::translate("HtmlInfo", "The unabbreviated name of the track's format."), qstr(fmtName));
if (track->format() != GeneralMediaFormat::Unknown && strcmp(fmtName, fmtAbbr)) { // format name and abbreviation differ
if (track->format() != GeneralMediaFormat::Unknown && fmtName != fmtAbbr) {
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Abbreviation"),
QCoreApplication::translate("HtmlInfo", "The abbreviated name of the track's format."), qstr(fmtAbbr));
}
@ -559,7 +549,7 @@ public:
}
}
fmtName = track->format().extensionName();
if (*fmtName) {
if (!fmtName.empty()) {
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Extension"), QCoreApplication::translate("HtmlInfo", "Used format extensions."),
qstr(fmtName));
}
@ -631,15 +621,13 @@ public:
if (!track->resolution().isNull()) {
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Resolution"), qstr(track->resolution().toString()));
}
if (track->channelConfigString()) {
if (track->extensionChannelConfigString()) {
if (const auto cc = track->channelConfigString(); !cc.empty()) {
if (const auto ecc = track->extensionChannelConfigString(); !ecc.empty()) {
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Channel config"),
QCoreApplication::translate("HtmlInfo", "Channel configuration"),
QStringLiteral("%1 / %2").arg(
QString::fromUtf8(track->extensionChannelConfigString()), QString::fromUtf8(track->channelConfigString())));
QCoreApplication::translate("HtmlInfo", "Channel configuration"), QStringLiteral("%1 / %2").arg(qstr(ecc), qstr(cc)));
} else {
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Channel config"),
QCoreApplication::translate("HtmlInfo", "Channel configuration"), QString::fromUtf8(track->channelConfigString()));
QCoreApplication::translate("HtmlInfo", "Channel configuration"), qstr(cc));
}
} else if (track->channelCount()) {
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Channel count"), QString::number(track->channelCount()));
@ -650,8 +638,8 @@ public:
if (track->fps()) {
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Frames per second"), QString::number(track->fps()));
}
if (track->chromaFormat()) {
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Chroma format"), qstr(track->chromaFormat()));
if (auto cf = track->chromaFormat(); !cf.empty()) {
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Chroma format"), qstr(cf));
}
QStringList labels;
if (track->isInterlaced()) {
@ -918,14 +906,14 @@ public:
m_rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Duration"), qstr(duration.toString(TimeSpanOutputFormat::WithMeasures)));
m_rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Overall avg. bitrate"), qstr(bitrateToString(m_file.overallAverageBitrate())));
}
const char *const mimeType = m_file.mimeType();
if (*mimeType) {
const auto mimeType = m_file.mimeType();
if (!mimeType.empty()) {
m_rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Mime-type"), qstr(mimeType));
}
m_rowMaker.startRow(QCoreApplication::translate("HtmlInfo", "Container"));
m_writer.writeCharacters(qstr(m_file.containerFormatName()));
const char *const subversion = m_file.containerFormatSubversion();
if (*subversion) {
const auto subversion = m_file.containerFormatSubversion();
if (!subversion.empty()) {
mkSpace();
m_writer.writeCharacters(qstr(subversion));
}
@ -996,7 +984,7 @@ public:
startExtendedTableSection(moreId);
for (const Tag *tag : tags) {
RowMaker rowMaker(m_writer);
rowMaker.startSubTab(tag->typeName());
rowMaker.startSubTab(qstr(tag->typeName()));
if (!tag->version().empty()) {
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Version"), qstr(tag->version()));
}

View File

@ -40,6 +40,11 @@ constexpr int trQuandity(quint64 quandity)
return quandity > std::numeric_limits<int>::max() ? std::numeric_limits<int>::max() : static_cast<int>(quandity);
}
inline QString qstr(std::string_view stdstr)
{
return QString::fromUtf8(stdstr.data(), static_cast<int>(stdstr.size()));
}
} // namespace Utility
#endif // UTILITYFEATURES_H

View File

@ -25,6 +25,7 @@ using namespace CppUtilities;
using namespace QtUtilities;
using namespace Utility;
using namespace TagParser;
using namespace Utility;
namespace RenamingUtility {
@ -177,9 +178,9 @@ TAGEDITOR_JS_VALUE TagEditorObject::parseFileInfo(const QString &fileName)
fileInfoObject.setProperty(QStringLiteral("diagMessages"), diagObj);
// add MIME-type, suitable suffix and technical summary
fileInfoObject.setProperty(QStringLiteral("mimeType"), QString::fromUtf8(fileInfo.mimeType()) TAGEDITOR_JS_READONLY);
fileInfoObject.setProperty(QStringLiteral("suitableSuffix"), QString::fromUtf8(fileInfo.containerFormatAbbreviation()) TAGEDITOR_JS_READONLY);
fileInfoObject.setProperty(QStringLiteral("technicalSummary"), QString::fromUtf8(fileInfo.technicalSummary().data()) TAGEDITOR_JS_READONLY);
fileInfoObject.setProperty(QStringLiteral("mimeType"), qstr(fileInfo.mimeType()) TAGEDITOR_JS_READONLY);
fileInfoObject.setProperty(QStringLiteral("suitableSuffix"), qstr(fileInfo.containerFormatAbbreviation()) TAGEDITOR_JS_READONLY);
fileInfoObject.setProperty(QStringLiteral("technicalSummary"), qstr(fileInfo.technicalSummary()) TAGEDITOR_JS_READONLY);
fileInfoObject.setProperty(QStringLiteral("hasAudioTracks"), fileInfo.hasTracksOfType(MediaType::Audio) TAGEDITOR_JS_READONLY);
fileInfoObject.setProperty(QStringLiteral("hasVideoTracks"), fileInfo.hasTracksOfType(MediaType::Video) TAGEDITOR_JS_READONLY);
@ -205,9 +206,9 @@ TAGEDITOR_JS_VALUE TagEditorObject::parseFileInfo(const QString &fileName)
for (auto trackIterator = tracks.cbegin(), end = tracks.cend(); trackIterator != end; ++trackIterator, ++trackIndex) {
const AbstractTrack &track = **trackIterator;
auto trackObject = m_engine->newObject();
trackObject.setProperty(QStringLiteral("mediaType"), QString::fromUtf8(track.mediaTypeName()));
trackObject.setProperty(QStringLiteral("format"), QString::fromUtf8(track.formatName()));
trackObject.setProperty(QStringLiteral("formatAbbreviation"), QString::fromUtf8(track.formatAbbreviation()));
trackObject.setProperty(QStringLiteral("mediaType"), qstr(track.mediaTypeName()));
trackObject.setProperty(QStringLiteral("format"), qstr(track.formatName()));
trackObject.setProperty(QStringLiteral("formatAbbreviation"), qstr(track.formatAbbreviation()));
trackObject.setProperty(QStringLiteral("version"), QString::number(track.version()));
trackObject.setProperty(QStringLiteral("language"), QString::fromStdString(track.locale().someAbbreviatedName()));
trackObject.setProperty(QStringLiteral("description"), QString::fromStdString(track.description()));