diff --git a/src/Backends/MPV/MPVBackend.cpp b/src/Backends/MPV/MPVBackend.cpp index d58d913..a2b9971 100644 --- a/src/Backends/MPV/MPVBackend.cpp +++ b/src/Backends/MPV/MPVBackend.cpp @@ -585,32 +585,174 @@ MPVBackend::getStats() "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; padding-botom: 0px; text-indent: 0px; } "; - stats += "File: " + getProperty("filename").toString(); + QString filename = getProperty("filename").toString(); + // File Info + stats += "File: " + filename; stats += "
"; - stats += "Format/Protocol: " + getProperty("file-format").toString() + - "
"; + QString title = getProperty("media-title").toString(); + if (title != filename) { + stats += "Title: " + title + "
"; + } + QString fileFormat = getProperty("file-format").toString(); + stats += "Format/Protocol: " + fileFormat + "
"; 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 += - "Cache: " + - a.formattedDataSize(getProperty("cache-used").toDouble()) + " (" + - Utils::createTimestamp(getProperty("demuxer-cache-duration").toInt()) + + if (demuxerSecs + demuxerCache + cacheUsed > 0) { + QString cacheStats; + cacheStats += "Total Cache: "; + cacheStats += a.formattedDataSize(demuxerCache + cacheUsed); + cacheStats += " (Demuxer: "; - ")
"; - stats += "Size: " + - a.formattedDataSize(getProperty("file-size").toInt()) + "
"; + cacheStats += a.formattedDataSize(demuxerCache); + cacheStats += ", "; + cacheStats += QString::number(demuxerSecs) + "s) "; + double cacheSpeed = getProperty("cache-speed").toDouble(); + if (cacheSpeed > 0) { + cacheStats += "Speed: "; + cacheStats += a.formattedDataSize(demuxerSecs); + cacheStats += "/s"; + } + cacheStats += "
"; + stats += cacheStats; + } + QString fileSize = + a.formattedDataSize(getProperty("file-size").toInt()).remove("-"); + stats += "Size: " + fileSize + "
"; stats += "
"; + // Video Info + QVariant videoParams = getProperty("video-params"); + if (videoParams.isNull()) { + videoParams = getProperty("video-out-params"); + } + if (!videoParams.isNull()) { + stats += "Video: " + getProperty("video-codec").toString(); + stats += "
"; + QString avsync = QString::number(getProperty("avsync").toDouble(), 'f', 3); + stats += "A-V: " + QString(avsync) + "
"; - stats += "Video: " + getProperty("video-codec").toString(); - stats += "
"; - QString avsync = QString::number(getProperty("avsync").toDouble(), 'f', 3); - stats += "A-V: " + QString(avsync) + "
"; - stats += "Dropped Frames: " + - getProperty("decoder-frame-drop-count").toString() + " (decoder) " + - getProperty("frame-drop-count").toString() + " (output)
"; + stats += "Dropped Frames: "; + 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 += "
"; - stats += "
"; + int dFPS = getProperty("display-fps").toInt(); + int eDFPS = getProperty("estimated-display-fps").toInt(); + if ((dFPS + eDFPS) > 0) { + stats += "Display FPS: "; + + if (dFPS > 0) { + stats += QString::number(dFPS); + stats += " (specified) "; + } + if (eDFPS > 0) { + stats += QString::number(eDFPS); + stats += " (estimated)"; + } + stats += "
"; + } + + int cFPS = getProperty("container-fps").toInt(); + int eVFPS = getProperty("estimated-vf-fps").toInt(); + if ((cFPS + eVFPS) > 0) { + stats += "FPS: "; + + if (cFPS > 0) { + stats += QString::number(cFPS); + stats += " (specified) "; + } + if (eVFPS > 0) { + stats += QString::number(eVFPS); + stats += " (estimated)"; + } + stats += "
"; + } + QVariantMap vPM = videoParams.toMap(); + stats += "Native Resolution: "; + stats += vPM["w"].toString() + " x " + vPM["h"].toString(); + stats += "
"; + + stats += "Window Scale: "; + stats += vPM["window-scale"].toString(); + stats += "
"; + + stats += "Aspect Ratio: "; + stats += vPM["aspect"].toString(); + stats += "
"; + + stats += "Pixel Format: "; + stats += vPM["pixelformat"].toString(); + stats += "
"; + + stats += "Primaries: "; + stats += vPM["primaries"].toString(); + stats += " Colormatrix: "; + stats += vPM["colormatrix"].toString(); + stats += "
"; + + stats += "Levels: "; + stats += vPM["colorlevels"].toString(); + double sigPeak = vPM.value("sig-peak", QVariant(0.0)).toInt(); + if (sigPeak > 0) { + stats += " (HDR Peak: " + QString::number(sigPeak) + ")"; + } + stats += "
"; + + stats += "Gamma: "; + stats += vPM["gamma"].toString(); + stats += "
"; + + int pVB = getProperty("packet-video-bitrate").toInt(); + if (pVB > 0) { + stats += "Bitrate: "; + stats += a.formattedDataSize(pVB) + "/s"; + stats += "
"; + } + + stats += "
"; + } + QVariant audioParams = getProperty("audio-params"); + if (audioParams.isNull()) { + audioParams = getProperty("audio-out-params"); + } + if (!audioParams.isNull()) { + stats += "Audio: " + getProperty("audio-codec").toString(); + stats += "
"; + QVariantMap aPM = audioParams.toMap(); + + stats += "Format: "; + stats += aPM["format"].toString(); + stats += "
"; + + stats += "Sample Rate: "; + stats += aPM["samplerate"].toString() + " Hz"; + stats += "
"; + + stats += "Channels: "; + stats += aPM["chanel-count"].toString(); + stats += "
"; + + int pAB = getProperty("packet-audio-bitrate").toInt(); + if (pAB > 0) { + stats += "Bitrate: "; + stats += a.formattedDataSize(pAB) + "/s"; + stats += "
"; + } + + stats += "
"; + } return stats; } diff --git a/src/qml/main.qml b/src/qml/main.qml index b3d991d..b5813ad 100644 --- a/src/qml/main.qml +++ b/src/qml/main.qml @@ -398,7 +398,8 @@ Window { height: parent.height width: parent.width anchors.fill: parent - //padding: mainWindow.virtualHeight / 20 + anchors.topMargin: mainWindow.virtualHeight / 20 + anchors.leftMargin: mainWindow.virtualHeight / 20 font.family: appearance.fontName textFormat: Text.RichText font.pixelSize: mainWindow.virtualHeight / 50