summaryrefslogtreecommitdiffstats
path: root/tests/manual/qml-gstreamer-pipeline/qml-gstreamer-pipeline.qml
blob: 7c0beec2a4118b5d37fed527814008fd53112df7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

import QtQuick
import QtQuick.Controls
import QtMultimedia

ApplicationWindow {
    id: window
    width: output.width
    height: output.height
    visible: true
    title: qsTr("QML GStreamer Pipeline")

    MediaPlayer {
        id: player
        audioOutput: AudioOutput {}
        videoOutput: output

        onSourceChanged: {
            console.log(player.source)
            window.setTitle(player.source)
        }

        onMediaStatusChanged: {
            player.play()
        }
    }

    Component.onCompleted: {
        var src

        if (Qt.application.arguments.length > 1)
            src = Qt.application.arguments[0];
        else
            // src = "gstreamer-pipeline: videotestsrc"
            // src = "gstreamer-pipeline: videotestsrc is-live=true"
            src = "gstreamer-pipeline: uridecodebin uri=http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"

        player.setSource(src)
        window.setTitle(src)
        player.play()
    }

    VideoOutput {
        id: output
        visible: true
        anchors.fill: parent
    }
}