DOCS/client_api_examples: qml: add test for gamma control

Provides a dumb test for the functionality added in the previous commit.
This commit is contained in:
wm4 2015-01-06 17:35:10 +01:00
parent b5529707f5
commit c3db52a0bf
3 changed files with 29 additions and 11 deletions

View File

@ -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)
}
}
}
}

View File

@ -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);

View File

@ -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: