1
0
Fork 0

Add a new config setting for broken fullscreen, fix No FBO with broken audio devices.

This commit is contained in:
namedkitten 2020-04-20 13:14:09 +01:00
parent f7167ee478
commit 437bebf9a6
5 changed files with 73 additions and 19 deletions

15
.gitignore vendored
View file

@ -20,3 +20,18 @@ qmlcache*
qrc_src* qrc_src*
discord-rpc discord-rpc
*.kate-swp *.kate-swp
CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps
*_autogen
*.core
.core

View file

@ -63,7 +63,7 @@ endif(CCACHE_FOUND)
set(CMAKE_BUILD_TYPE DEBUG) set(CMAKE_BUILD_TYPE DEBUG)
SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS} -ggdb -g3 -Og") SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS} -ggdb -g3 -O3")
if(DEFINED ENV{TRAVIS}) if(DEFINED ENV{TRAVIS})
execute_process( execute_process(

View file

@ -7,6 +7,42 @@
auto mpvLogger = initLogger("mpv"); auto mpvLogger = initLogger("mpv");
static inline QVariant node_to_variant(const mpv_node *node)
{
if (!node) {
return QVariant();
}
switch (node->format) {
case MPV_FORMAT_STRING:
return QVariant(QString::fromUtf8(node->u.string));
case MPV_FORMAT_FLAG:
return QVariant(static_cast<bool>(node->u.flag));
case MPV_FORMAT_INT64:
return QVariant(static_cast<qlonglong>(node->u.int64));
case MPV_FORMAT_DOUBLE:
return QVariant(node->u.double_);
case MPV_FORMAT_NODE_ARRAY: {
mpv_node_list *list = node->u.list;
QVariantList qlist;
for (int n = 0; n < list->num; n++)
qlist.append(node_to_variant(&list->values[n]));
return QVariant(qlist);
}
case MPV_FORMAT_NODE_MAP: {
mpv_node_list *list = node->u.list;
QVariantMap qmap;
for (int n = 0; n < list->num; n++) {
qmap.insert(QString::fromUtf8(list->keys[n]),
node_to_variant(&list->values[n]));
}
return QVariant(qmap);
}
default: // MPV_FORMAT_NONE, unknown values (e.g. future extensions)
return QVariant();
}
}
namespace MPVCommon { namespace MPVCommon {
QString getStats(BackendInterface *b) { QString getStats(BackendInterface *b) {
@ -349,7 +385,7 @@ QVariant playerCommand(BackendInterface *b, const Enums::Commands& cmd, const QV
} }
default: { default: {
qDebug() << "Command not found: " << cmd; //qDebug() << "Command not found: " << cmd;
break; break;
} }
} }
@ -438,7 +474,7 @@ handle_mpv_event(BackendInterface *b, mpv_event* event)
} }
} else if (strcmp(prop->name, "pause") == 0) { } else if (strcmp(prop->name, "pause") == 0) {
mpv_node* nod = (mpv_node*)prop->data; mpv_node* nod = (mpv_node*)prop->data;
if (mpv::qt::node_to_variant(nod).toBool()) { if (node_to_variant(nod).toBool()) {
emit b->playStatusChanged(Enums::PlayStatus::Paused); emit b->playStatusChanged(Enums::PlayStatus::Paused);
// Utils::SetScreensaver(window()->winId(), true); // Utils::SetScreensaver(window()->winId(), true);
} else { } else {
@ -447,16 +483,16 @@ handle_mpv_event(BackendInterface *b, mpv_event* event)
} }
} else if (strcmp(prop->name, "track-list") == 0) { } else if (strcmp(prop->name, "track-list") == 0) {
mpv_node* nod = (mpv_node*)prop->data; mpv_node* nod = (mpv_node*)prop->data;
emit b->tracksChanged(mpv::qt::node_to_variant(nod).toList()); emit b->tracksChanged(node_to_variant(nod).toList());
} else if (strcmp(prop->name, "audio-device-list") == 0) { } else if (strcmp(prop->name, "audio-device-list") == 0) {
mpv_node* nod = (mpv_node*)prop->data; mpv_node* nod = (mpv_node*)prop->data;
emit b->audioDevicesChanged(b->getAudioDevices(mpv::qt::node_to_variant(nod))); emit b->audioDevicesChanged(b->getAudioDevices(node_to_variant(nod)));
} else if (strcmp(prop->name, "playlist") == 0) { } else if (strcmp(prop->name, "playlist") == 0) {
mpv_node* nod = (mpv_node*)prop->data; mpv_node* nod = (mpv_node*)prop->data;
emit b->playlistChanged(mpv::qt::node_to_variant(nod).toList()); emit b->playlistChanged(node_to_variant(nod).toList());
} else if (strcmp(prop->name, "chapter-list") == 0) { } else if (strcmp(prop->name, "chapter-list") == 0) {
mpv_node* nod = (mpv_node*)prop->data; mpv_node* nod = (mpv_node*)prop->data;
emit b->chaptersChanged(mpv::qt::node_to_variant(nod).toList()); emit b->chaptersChanged(node_to_variant(nod).toList());
} else if (strcmp(prop->name, "speed") == 0) { } else if (strcmp(prop->name, "speed") == 0) {
double speed = *(double*)prop->data; double speed = *(double*)prop->data;
emit b->speedChanged(speed); emit b->speedChanged(speed);
@ -492,6 +528,9 @@ handle_mpv_event(BackendInterface *b, mpv_event* event)
QVariantMap getAudioDevices(const QVariant& drivers) QVariantMap getAudioDevices(const QVariant& drivers)
{ {
QVariantMap newDrivers; QVariantMap newDrivers;
if (drivers.isNull()) {
return newDrivers;
}
QSequentialIterable iterable = drivers.value<QSequentialIterable>(); QSequentialIterable iterable = drivers.value<QSequentialIterable>();
foreach (const QVariant& v, iterable) { foreach (const QVariant& v, iterable) {

View file

@ -29,7 +29,6 @@ public slots:
virtual QVariant getProperty(const QString& name) const = 0; virtual QVariant getProperty(const QString& name) const = 0;
virtual QVariantMap getAudioDevices(const QVariant& drivers) const = 0; virtual QVariantMap getAudioDevices(const QVariant& drivers) const = 0;
signals: signals:
// All below required for Player API // All below required for Player API
virtual void playStatusChanged(const Enums::PlayStatus& status) = 0; virtual void playStatusChanged(const Enums::PlayStatus& status) = 0;

View file

@ -67,6 +67,7 @@ Window {
property double scaleFactor: 1.0 property double scaleFactor: 1.0
property int subtitlesFontSize: 18 property int subtitlesFontSize: 18
property int uiFadeTimer: 1000 property int uiFadeTimer: 1000
property bool maximizeInsteadOfFullscreen: false
} }
Settings { Settings {
@ -180,16 +181,17 @@ Window {
property int lastScreenVisibility property int lastScreenVisibility
function toggleFullscreen() { function toggleFullscreen() {
console.error("a", mainWindow.visibility, Window.FullScreen, var fs = Window.FullScreen
lastScreenVisibility) if (appearance.maximizeInsteadOfFullscreen) {
if (mainWindow.visibility != Window.FullScreen) { fs = Window.Maximized
}
if (mainWindow.visibility != fs) {
lastScreenVisibility = mainWindow.visibility lastScreenVisibility = mainWindow.visibility
mainWindow.visibility = Window.FullScreen mainWindow.visibility = fs
} else { } else {
mainWindow.visibility = lastScreenVisibility mainWindow.visibility = lastScreenVisibility
} }
console.error("b", mainWindow.visibility, Window.FullScreen,
lastScreenVisibility)
} }
Utils { Utils {
@ -349,9 +351,7 @@ Window {
} }
Action { Action {
onTriggered: { onTriggered: {
if (mainWindow.visibility == Window.FullScreen) { toggleFullscreen()
toggleFullscreen()
}
} }
shortcut: "Esc" shortcut: "Esc"
} }
@ -438,12 +438,13 @@ Window {
anchors.bottomMargin: 4 anchors.bottomMargin: 4
anchors.top: parent.top anchors.top: parent.top
font.family: appearance.fontName font.family: appearance.fontName
font.pixelSize: menuBar.height - (anchors.bottomMargin + anchors.topMargin) fontSizeMode: Text.VerticalFit
font.pixelSize: appearance.scaleFactor*(height-anchors.topMargin-anchors.bottomMargin-2)
font.bold: true font.bold: true
opacity: 1 opacity: 1
visible: controlsOverlay.controlsShowing visible: controlsOverlay.controlsShowing
&& ((!appearance.titleOnlyOnFullscreen) && ((!appearance.titleOnlyOnFullscreen)
|| (mainWindow.visibility == Window.FullScreen)) || (mainWindow.visibility == Window.FullScreen || mainWindow.visibility == Window.Maximized))
Connections { Connections {
target: player target: player
onTitleChanged: function (title) { onTitleChanged: function (title) {