summaryrefslogtreecommitdiffstats
path: root/DOCS
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-01-06 17:35:10 +0100
committerwm4 <wm4@nowhere>2015-01-06 17:35:10 +0100
commitc3db52a0bf0895d29c6d877da63684fdecdc9a86 (patch)
tree26e0b7bed2cc9059f698db4bfadf16c23632e2e1 /DOCS
parentb5529707f5dfb8073a13bb376fe64010186b60cf (diff)
downloadmpv-c3db52a0bf0895d29c6d877da63684fdecdc9a86.tar.bz2
mpv-c3db52a0bf0895d29c6d877da63684fdecdc9a86.tar.xz
DOCS/client_api_examples: qml: add test for gamma control
Provides a dumb test for the functionality added in the previous commit.
Diffstat (limited to 'DOCS')
-rw-r--r--DOCS/client_api_examples/qml/main.qml33
-rw-r--r--DOCS/client_api_examples/qml/mpvrenderer.cpp6
-rw-r--r--DOCS/client_api_examples/qml/mpvrenderer.h1
3 files changed, 29 insertions, 11 deletions
diff --git a/DOCS/client_api_examples/qml/main.qml b/DOCS/client_api_examples/qml/main.qml
index 4c07351d32..672f8680b1 100644
--- a/DOCS/client_api_examples/qml/main.qml
+++ b/DOCS/client_api_examples/qml/main.qml
@@ -41,18 +41,31 @@ Item {
Click to load ../../../test.mkv"
}
- CheckBox {
- id: checkbox
- anchors.margins: 10
- // Heavily filtered means good, right?
- text: "Make video looks like on a Smart TV"
- onClicked: {
- if (checkbox.checked) {
- renderer.command(["vo_cmdline", "lscale=sharpen3:lparam1=1.0"])
- } else {
- renderer.command(["vo_cmdline", ""])
+ // Don't take these controls too seriously. They're for testing.
+ Column {
+ CheckBox {
+ id: checkbox
+ anchors.margins: 10
+ // Heavily filtered means good, right?
+ text: "Make video look like on a Smart TV"
+ onClicked: {
+ if (checkbox.checked) {
+ renderer.command(["vo_cmdline", "lscale=sharpen3:lparam1=5.0"])
+ } else {
+ renderer.command(["vo_cmdline", ""])
+ }
}
}
+ Slider {
+ id: slider
+ anchors.margins: 10
+ anchors.left: checkbox.left
+ anchors.right: checkbox.right
+ minimumValue: -100
+ maximumValue: 100
+ value: 0
+ onValueChanged: renderer.setProperty("gamma", slider.value | 0)
+ }
}
}
}
diff --git a/DOCS/client_api_examples/qml/mpvrenderer.cpp b/DOCS/client_api_examples/qml/mpvrenderer.cpp
index 07ee360eb3..f24ae42ed3 100644
--- a/DOCS/client_api_examples/qml/mpvrenderer.cpp
+++ b/DOCS/client_api_examples/qml/mpvrenderer.cpp
@@ -100,10 +100,14 @@ void MpvObject::doUpdate()
void MpvObject::command(const QVariant& params)
{
- //mpv_command_string(mpv, s.toUtf8().data());
mpv::qt::command_variant(mpv, params);
}
+void MpvObject::setProperty(const QString& name, const QVariant& value)
+{
+ mpv::qt::set_property_variant(mpv, name, value);
+}
+
QQuickFramebufferObject::Renderer *MpvObject::createRenderer() const
{
window()->setPersistentOpenGLContext(true);
diff --git a/DOCS/client_api_examples/qml/mpvrenderer.h b/DOCS/client_api_examples/qml/mpvrenderer.h
index ec7e5c4279..9a65ae5350 100644
--- a/DOCS/client_api_examples/qml/mpvrenderer.h
+++ b/DOCS/client_api_examples/qml/mpvrenderer.h
@@ -24,6 +24,7 @@ public:
virtual Renderer *createRenderer() const;
public slots:
void command(const QVariant& params);
+ void setProperty(const QString& name, const QVariant& value);
signals:
void onUpdate();
private slots: