Skip to content

Commit

Permalink
examples/qml: add filter example
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-bin committed Jun 19, 2016
1 parent 41a4550 commit 9e6b9d0
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
40 changes: 40 additions & 0 deletions examples/qml/filter.qml
Original file line number Diff line number Diff line change
@@ -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 changes: 43 additions & 0 deletions examples/qml/glslfilter.qml
Original file line number Diff line number Diff line change
@@ -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
}
}

0 comments on commit 9e6b9d0

Please sign in to comment.