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*
discord-rpc
*.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_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})
execute_process(

View file

@ -7,6 +7,42 @@
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 {
QString getStats(BackendInterface *b) {
@ -349,7 +385,7 @@ QVariant playerCommand(BackendInterface *b, const Enums::Commands& cmd, const QV
}
default: {
qDebug() << "Command not found: " << cmd;
//qDebug() << "Command not found: " << cmd;
break;
}
}
@ -438,7 +474,7 @@ handle_mpv_event(BackendInterface *b, mpv_event* event)
}
} else if (strcmp(prop->name, "pause") == 0) {
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);
// Utils::SetScreensaver(window()->winId(), true);
} else {
@ -447,16 +483,16 @@ handle_mpv_event(BackendInterface *b, mpv_event* event)
}
} else if (strcmp(prop->name, "track-list") == 0) {
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) {
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) {
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) {
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) {
double speed = *(double*)prop->data;
emit b->speedChanged(speed);
@ -492,6 +528,9 @@ handle_mpv_event(BackendInterface *b, mpv_event* event)
QVariantMap getAudioDevices(const QVariant& drivers)
{
QVariantMap newDrivers;
if (drivers.isNull()) {
return newDrivers;
}
QSequentialIterable iterable = drivers.value<QSequentialIterable>();
foreach (const QVariant& v, iterable) {

View file

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

View file

@ -67,6 +67,7 @@ Window {
property double scaleFactor: 1.0
property int subtitlesFontSize: 18
property int uiFadeTimer: 1000
property bool maximizeInsteadOfFullscreen: false
}
Settings {
@ -180,16 +181,17 @@ Window {
property int lastScreenVisibility
function toggleFullscreen() {
console.error("a", mainWindow.visibility, Window.FullScreen,
lastScreenVisibility)
if (mainWindow.visibility != Window.FullScreen) {
var fs = Window.FullScreen
if (appearance.maximizeInsteadOfFullscreen) {
fs = Window.Maximized
}
if (mainWindow.visibility != fs) {
lastScreenVisibility = mainWindow.visibility
mainWindow.visibility = Window.FullScreen
mainWindow.visibility = fs
} else {
mainWindow.visibility = lastScreenVisibility
}
console.error("b", mainWindow.visibility, Window.FullScreen,
lastScreenVisibility)
}
Utils {
@ -349,10 +351,8 @@ Window {
}
Action {
onTriggered: {
if (mainWindow.visibility == Window.FullScreen) {
toggleFullscreen()
}
}
shortcut: "Esc"
}
onClicked: {
@ -438,12 +438,13 @@ Window {
anchors.bottomMargin: 4
anchors.top: parent.top
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
opacity: 1
visible: controlsOverlay.controlsShowing
&& ((!appearance.titleOnlyOnFullscreen)
|| (mainWindow.visibility == Window.FullScreen))
|| (mainWindow.visibility == Window.FullScreen || mainWindow.visibility == Window.Maximized))
Connections {
target: player
onTitleChanged: function (title) {