1
0
Fork 0

Minor changes.

This commit is contained in:
Kitteh 2018-10-21 13:00:25 +01:00
parent de9bd47082
commit 08e9fcf55a
4 changed files with 11 additions and 28 deletions

View file

@ -140,7 +140,6 @@ public:
// See render_gl.h on what OpenGL environment mpv expects, and
// other API details.
mpv_render_context_render(obj->mpv_gl, params);
obj->window()->resetOpenGLState();
#else
QOpenGLFramebufferObject *fbo = framebufferObject();
@ -169,24 +168,22 @@ MpvObject::MpvObject(QQuickItem * parent)
throw std::runtime_error("could not create mpv context");
mpv_set_option_string(mpv, "terminal", "yes");
//mpv_set_option_string(mpv, "msg-level", "all=v");
mpv_set_option_string(mpv, "msg-level", "all=v");
if (mpv_initialize(mpv) < 0)
throw std::runtime_error("could not initialize mpv context");
#ifndef USE_RENDER
mpv::qt::set_option_variant(mpv, "vo", "opengl-cb");
#else
mpv::qt::set_option_variant(mpv, "vo", "libmpv");
#endif
// Enable default bindings, because we're lazy. Normally, a player using
// mpv as backend would implement its own key bindings.
mpv_set_option_string(mpv, "input-default-bindings", "yes");
// mpv_set_option_string(mpv, "input-default-bindings", "yes");
// Enable keyboard input on the X11 window. For the messy details, see
// --input-vo-keyboard on the manpage.
mpv_set_option_string(mpv, "input-vo-keyboard", "yes");
// mpv_set_option_string(mpv, "input-vo-keyboard", "yes");
// Fix?
mpv::qt::set_option_variant(mpv, "ytdl", "yes");
@ -194,8 +191,6 @@ MpvObject::MpvObject(QQuickItem * parent)
mpv_set_option_string(mpv, "input-default-bindings", "yes");
mpv_set_option_string(mpv, "input-vo-keyboard", "yes");
mpv::qt::set_option_variant(mpv, "idle", "once");
mpv::qt::set_option_variant(mpv, "hwdec", "off");
mpv::qt::set_option_variant(mpv, "slang", "en");
@ -229,6 +224,8 @@ mpv_gl = (mpv_opengl_cb_context *)mpv_get_sub_api(mpv, MPV_SUB_API_OPENGL_CB);
mpv_opengl_cb_set_update_callback(mpv_gl, MpvObject::on_update, (void *)this);
#endif
mpv::qt::set_option_variant(mpv, "idle", "once");
connect(this, &MpvObject::onUpdate, this, &MpvObject::doUpdate,
Qt::QueuedConnection);
}
@ -261,19 +258,6 @@ void MpvObject::doUpdate()
}
QVariant MpvObject::getThumbnailFile(const QString &name) const
{
QProcess process;
process.start("youtube-dl --get-thumbnail " + name);
process.waitForFinished(-1);
return process.readAllStandardOutput();
}
QVariant MpvObject::getProperty(const QString &name) const
{
return mpv::qt::get_property_variant(mpv, name);

View file

@ -55,7 +55,6 @@ public slots:
void setProperty(const QString& name, const QVariant& value);
void setOption(const QString& name, const QVariant& value);
QVariant getProperty(const QString& name) const;
QVariant getThumbnailFile(const QString& name) const;
signals:

View file

@ -133,7 +133,6 @@ Window {
id: notoFont
source: "fonts/NotoSans.ttf"
}
Component.onCompleted: { startPlayer() }
function startPlayer() {
var args = Qt.application.arguments
@ -145,7 +144,7 @@ Window {
for (argNo = 1; argNo < len; argNo++) {
var argument = args[argNo]
if (argument.indexOf("KittehPlayer") !== -1) { continue; }
/* if (argument.startsWith("--")) {
if (argument.startsWith("--")) {
argument = argument.substr(2)
if (argument.length > 0) {
var splitArg = argument.split(/=(.+)/)
@ -158,9 +157,9 @@ Window {
renderer.setOption(splitArg[0], splitArg[1])
}
}
} else { */
} else {
renderer.command(["loadfile", argument, "append-play"])
//}
}
}
}
}
@ -693,5 +692,6 @@ Window {
updateControls()
}
}
Component.onCompleted: { startPlayer() }
}
}