examples/qml: add filter example

This commit is contained in:
wang-bin
2016-06-19 10:53:59 +08:00
parent 41a4550c9a
commit 9e6b9d0800
2 changed files with 83 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
import QtQuick 2.1
import QtAV 1.7
import QtQuick.Dialogs 1.0
Rectangle {
width: 800
height: 500
color: "black"
VideoFilter {
id: negate
type: VideoFilter.AVFilter
avfilter: "negate"
}
Video {
id: video
autoPlay: true
anchors.fill: parent
subtitle.engines: ["FFmpeg"]
videoFilters: [negate]
}
Text {
color: "white"
text: "Press key 'O' to open a file"
}
Item {
anchors.fill: parent
focus: true
Keys.onPressed: {
switch (event.key) {
case Qt.Key_O:
fileDialog.open()
break
}
}
}
FileDialog {
id: fileDialog
onAccepted: video.source = fileUrl
}
}
+43
View File
@@ -0,0 +1,43 @@
import QtQuick 2.1
import QtAV 1.7
import QtQuick.Dialogs 1.0
Rectangle {
width: 800
height: 500
color: "black"
VideoFilter {
id: negate
type: VideoFilter.GLSLFilter
shader: Shader {
postProcess: "gl_FragColor.rgb = vec3(1.0-gl_FragColor.r, 1.0-gl_FragColor.g, 1.0-gl_FragColor.b);"
}
}
Video {
id: video
autoPlay: true
anchors.fill: parent
subtitle.engines: ["FFmpeg"]
videoFiltersGPU: [negate]
}
Text {
color: "white"
text: "Press key 'O' to open a file"
}
Item {
anchors.fill: parent
focus: true
Keys.onPressed: {
switch (event.key) {
case Qt.Key_O:
fileDialog.open()
break
}
}
}
FileDialog {
id: fileDialog
onAccepted: video.source = fileUrl
}
}