Guest User

Untitled

a guest
Aug 21st, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. from PySide2.QtWidgets import QApplication
  2. from PySide2.QtQml import qmlRegisterType
  3. from PySide2.QtQuick import QQuickView
  4. from PySide2.QtMultimedia import QAbstractVideoFilter, QVideoFilterRunnable
  5. from PySide2.QtCore import QUrl
  6.  
  7. class ExampleFilterRunnable(QVideoFilterRunnable):
  8. def run(self, frame, surfaceFormat, flags):
  9. return frame
  10.  
  11. class ExampleFilter(QAbstractVideoFilter):
  12. def createFilterRunnable(self):
  13. return ExampleFilterRunnable()
  14.  
  15.  
  16. app = QApplication([])
  17. qmlRegisterType(ExampleFilter, "ExampleFilter", 1, 0, "ExampleFilter")
  18. view = QQuickView()
  19. url = QUrl("example.qml")
  20.  
  21. view.setSource(url)
  22. view.setResizeMode(view.SizeRootObjectToView)
  23. view.show()
  24. app.exec_()
  25.  
  26. import QtQuick 2.0
  27. import QtQuick.Controls 2.3
  28. import QtMultimedia 5.8
  29. import ExampleFilter 1.0
  30.  
  31. Rectangle {
  32. id: rectangle
  33. width: 800
  34. height: 600
  35. color: "black"
  36.  
  37. ExampleFilter {
  38. id: filter
  39. }
  40.  
  41. MediaPlayer {
  42. id: player
  43. source: "https://archive.org/download/Mario1_500/Mario1_500_LQ.avi"
  44. autoPlay: true
  45. }
  46.  
  47. VideoOutput {
  48. id: videoOutput
  49. source: player
  50. filters: [filter]
  51. anchors.fill: parent
  52. }
  53. }
Add Comment
Please, Sign In to add comment