Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
avfdisplaylink_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef AVFDISPLAYLINK_H
5#define AVFDISPLAYLINK_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtCore/qobject.h>
19#include <QtCore/qmutex.h>
20
21#if defined(QT_PLATFORM_UIKIT)
22#include <CoreVideo/CVBase.h>
23#else
24#include <QuartzCore/CVDisplayLink.h>
25#endif
26
27#include <optional>
28
29QT_BEGIN_NAMESPACE
30
31class AVFDisplayLink final : public QObject
32{
33 Q_OBJECT
34public:
35 explicit AVFDisplayLink(QObject *parent = nullptr);
36 ~AVFDisplayLink() override;
37 bool isValid() const;
38 bool isActive() const;
39
40public Q_SLOTS:
41 void start();
42 void stop();
43
44Q_SIGNALS:
45 void tick(const CVTimeStamp &ts);
46
47public:
48 void displayLinkEvent(const CVTimeStamp *);
49
50protected:
51 bool event(QEvent *) override;
52
53private:
54#if defined(QT_PLATFORM_UIKIT)
55 void *m_displayLink{};
56#else
57 CVDisplayLinkRef m_displayLink{};
58#endif
59 QMutex m_displayLinkMutex;
60 bool m_isActive{};
61 std::optional<CVTimeStamp> m_frameTimeStamp; // GUARDED_BY(m_displayLinkMutex)
62};
63
64QT_END_NAMESPACE
65
66#endif // AVFDISPLAYLINK_H