1
0
Fork 0

[UI+Backend] Add alot of stuff to stats view.

This commit is contained in:
NamedKitten 2018-12-23 14:30:58 +00:00
parent 2a0477bd34
commit f63b72ba55
2 changed files with 162 additions and 19 deletions

View file

@ -585,32 +585,174 @@ MPVBackend::getStats()
"margin-bottom: 0px; padding-bottom: 0px; padding-top: 0px; padding-left: " "margin-bottom: 0px; padding-bottom: 0px; padding-top: 0px; padding-left: "
"0px; } b span p br { margin-bottom: 0px; margin-top: 0px; padding-top: " "0px; } b span p br { margin-bottom: 0px; margin-top: 0px; padding-top: "
"0px; padding-botom: 0px; text-indent: 0px; } </style>"; "0px; padding-botom: 0px; text-indent: 0px; } </style>";
stats += "<b>File:</b> " + getProperty("filename").toString(); QString filename = getProperty("filename").toString();
// File Info
stats += "<b>File:</b> " + filename;
stats += "<blockquote>"; stats += "<blockquote>";
stats += "<b>Format/Protocol:</b> " + getProperty("file-format").toString() + QString title = getProperty("media-title").toString();
"<br>"; if (title != filename) {
stats += "<b>Title:</b> " + title + "<br>";
}
QString fileFormat = getProperty("file-format").toString();
stats += "<b>Format/Protocol:</b> " + fileFormat + "<br>";
QLocale a; QLocale a;
// a.formattedDataSize(
double cacheUsed = getProperty("cache-used").toDouble();
// Utils::createTimestamp(
int demuxerSecs = getProperty("demuxer-cache-duration").toInt();
QVariantMap demuxerState = getProperty("demuxer-cache-state").toMap();
int demuxerCache = demuxerState.value("fw-bytes", QVariant(0)).toInt();
stats += if (demuxerSecs + demuxerCache + cacheUsed > 0) {
"<b>Cache:</b> " + QString cacheStats;
a.formattedDataSize(getProperty("cache-used").toDouble()) + " (" + cacheStats += "<b>Total Cache:</b> ";
Utils::createTimestamp(getProperty("demuxer-cache-duration").toInt()) + cacheStats += a.formattedDataSize(demuxerCache + cacheUsed);
cacheStats += " (<b>Demuxer:</b> ";
")<br>"; cacheStats += a.formattedDataSize(demuxerCache);
stats += "<b>Size:</b> " + cacheStats += ", ";
a.formattedDataSize(getProperty("file-size").toInt()) + "<br>"; cacheStats += QString::number(demuxerSecs) + "s) ";
double cacheSpeed = getProperty("cache-speed").toDouble();
if (cacheSpeed > 0) {
cacheStats += "<b>Speed:</b> ";
cacheStats += a.formattedDataSize(demuxerSecs);
cacheStats += "/s";
}
cacheStats += "<br>";
stats += cacheStats;
}
QString fileSize =
a.formattedDataSize(getProperty("file-size").toInt()).remove("-");
stats += "<b>Size:</b> " + fileSize + "<br>";
stats += "</blockquote>"; stats += "</blockquote>";
// Video Info
QVariant videoParams = getProperty("video-params");
if (videoParams.isNull()) {
videoParams = getProperty("video-out-params");
}
if (!videoParams.isNull()) {
stats += "<b>Video:</b> " + getProperty("video-codec").toString(); stats += "<b>Video:</b> " + getProperty("video-codec").toString();
stats += "<blockquote>"; stats += "<blockquote>";
QString avsync = QString::number(getProperty("avsync").toDouble(), 'f', 3); QString avsync = QString::number(getProperty("avsync").toDouble(), 'f', 3);
stats += "<b>A-V:</b> " + QString(avsync) + "<br>"; stats += "<b>A-V:</b> " + QString(avsync) + "<br>";
stats += "<b>Dropped Frames:</b> " +
getProperty("decoder-frame-drop-count").toString() + " (decoder) " + stats += "<b>Dropped Frames:</b> ";
getProperty("frame-drop-count").toString() + " (output)<br>"; int dFDC = getProperty("decoder-frame-drop-count").toInt();
if (dFDC > 0) {
stats += QString::number(dFDC) + " (decoder) ";
}
int fDC = getProperty("frame-drop-count").toInt();
if (fDC > 0) {
stats += QString::number(fDC) + " (output)";
}
stats += "<br>";
int dFPS = getProperty("display-fps").toInt();
int eDFPS = getProperty("estimated-display-fps").toInt();
if ((dFPS + eDFPS) > 0) {
stats += "<b>Display FPS:</b> ";
if (dFPS > 0) {
stats += QString::number(dFPS);
stats += " (specified) ";
}
if (eDFPS > 0) {
stats += QString::number(eDFPS);
stats += " (estimated)";
}
stats += "<br>";
}
int cFPS = getProperty("container-fps").toInt();
int eVFPS = getProperty("estimated-vf-fps").toInt();
if ((cFPS + eVFPS) > 0) {
stats += "<b>FPS:</b> ";
if (cFPS > 0) {
stats += QString::number(cFPS);
stats += " (specified) ";
}
if (eVFPS > 0) {
stats += QString::number(eVFPS);
stats += " (estimated)";
}
stats += "<br>";
}
QVariantMap vPM = videoParams.toMap();
stats += "<b>Native Resolution:</b> ";
stats += vPM["w"].toString() + " x " + vPM["h"].toString();
stats += "<br>";
stats += "<b>Window Scale:</b> ";
stats += vPM["window-scale"].toString();
stats += "<br>";
stats += "<b>Aspect Ratio:</b> ";
stats += vPM["aspect"].toString();
stats += "<br>";
stats += "<b>Pixel Format:</b> ";
stats += vPM["pixelformat"].toString();
stats += "<br>";
stats += "<b>Primaries:</b> ";
stats += vPM["primaries"].toString();
stats += " <b>Colormatrix:</b> ";
stats += vPM["colormatrix"].toString();
stats += "<br>";
stats += "<b>Levels:</b> ";
stats += vPM["colorlevels"].toString();
double sigPeak = vPM.value("sig-peak", QVariant(0.0)).toInt();
if (sigPeak > 0) {
stats += " (HDR Peak: " + QString::number(sigPeak) + ")";
}
stats += "<br>";
stats += "<b>Gamma:</b> ";
stats += vPM["gamma"].toString();
stats += "<br>";
int pVB = getProperty("packet-video-bitrate").toInt();
if (pVB > 0) {
stats += "<b>Bitrate:</b> ";
stats += a.formattedDataSize(pVB) + "/s";
stats += "<br>";
}
stats += "</blockquote>"; stats += "</blockquote>";
}
QVariant audioParams = getProperty("audio-params");
if (audioParams.isNull()) {
audioParams = getProperty("audio-out-params");
}
if (!audioParams.isNull()) {
stats += "<b>Audio:</b> " + getProperty("audio-codec").toString();
stats += "<blockquote>";
QVariantMap aPM = audioParams.toMap();
stats += "<b>Format:</b> ";
stats += aPM["format"].toString();
stats += "<br>";
stats += "<b>Sample Rate:</b> ";
stats += aPM["samplerate"].toString() + " Hz";
stats += "<br>";
stats += "<b>Channels:</b> ";
stats += aPM["chanel-count"].toString();
stats += "<br>";
int pAB = getProperty("packet-audio-bitrate").toInt();
if (pAB > 0) {
stats += "<b>Bitrate:</b> ";
stats += a.formattedDataSize(pAB) + "/s";
stats += "<br>";
}
stats += "</blockquote>";
}
return stats; return stats;
} }

View file

@ -398,7 +398,8 @@ Window {
height: parent.height height: parent.height
width: parent.width width: parent.width
anchors.fill: parent anchors.fill: parent
//padding: mainWindow.virtualHeight / 20 anchors.topMargin: mainWindow.virtualHeight / 20
anchors.leftMargin: mainWindow.virtualHeight / 20
font.family: appearance.fontName font.family: appearance.fontName
textFormat: Text.RichText textFormat: Text.RichText
font.pixelSize: mainWindow.virtualHeight / 50 font.pixelSize: mainWindow.virtualHeight / 50