summaryrefslogtreecommitdiffstats
path: root/tests/manual/mediaframeinputs/previewrunner.h
blob: a5dc6224ff641e032c48d8f39274490f4ba60f73 (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
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

#ifndef PREVIEWRUNNER_H
#define PREVIEWRUNNER_H

#include <QMediaPlayer>
#include <QAudioOutput>
#include <QVideoWidget>

class PreviewRunner : public QObject
{
    Q_OBJECT
public:
    PreviewRunner();

    void run(const QUrl &mediaLocation);

protected:
    bool eventFilter(QObject *watched, QEvent *event) override;

private slots:
    void handlePlaybackStateChanged(QMediaPlayer::PlaybackState state);

    void handleError(QMediaPlayer::Error error, QString description);

    void updateTitle();

signals:
    void finished();

private:
    QVideoWidget m_preview;
    QAudioOutput m_audioOutput;
    QMediaPlayer m_player;
};

#endif // PREVIEWRUNNER_H