rahulch

Untitled

Sep 26th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QML 1.32 KB | None | 0 0
  1. import QtQuick 2.3
  2. import QtQuick.Controls 2.12
  3. import QtQuick.Layouts 1.11
  4. import QtQuick.Window 2.12
  5. import QtMultimedia 5.8
  6. import QtQml 2.12
  7. import QtGraphicalEffects 1.12
  8.  
  9. import video.filter 1.0
  10.  
  11. Rectangle {
  12.     anchors.centerIn: parent
  13.     color: "black"
  14.     property bool isCameraInput: peopleidentificationmainwindow.isCameraInput
  15.  
  16.     MediaPlayer {
  17.         id: player
  18.         source: "file://" + peopleidentificationmainwindow.videoFilePath
  19.         autoPlay: true
  20.     }
  21.  
  22.     Camera {
  23.         id: inputCamera
  24.         flash.mode: Camera.FlashRedEyeReduction
  25.         captureMode: Camera.CaptureViewfinder
  26.         viewfinder {
  27.             resolution: "1920x1080"
  28.         }
  29.     }
  30.  
  31.     Loader {
  32.         id: videoInputSourceLoader
  33.         sourceComponent: undefined
  34.     }
  35.  
  36.     onIsCameraInputChanged: {
  37.         console.log("isCameraInput = ", isCameraInput);
  38.         videoInputSourceLoader.sourceComponent = isCameraInput ? inputCamera : player;
  39.         console.log("sourceComponent = ", videoInputSourceLoader.sourceComponent);
  40.     }
  41.  
  42.     VideoFilter {
  43.         id: filter
  44.     }
  45.  
  46.     VideoOutput {
  47.         id: videoOutput
  48.         source: isCameraInput ? inputCamera : player
  49.         anchors.centerIn: parent
  50.         fillMode: VideoOutput.PreserveAspectFit
  51.         filters: [ filter ]
  52.     }
  53. }
Add Comment
Please, Sign In to add comment