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
24@interface DisplayLinkObserver : NSObject
25- (void)start;
26- (void)stop;
27- (void)displayLinkNotification:(CADisplayLink *)sender;
28@end
29#else
30#include <QuartzCore/CVDisplayLink.h>
31#endif
32
33#include <optional>
34
35QT_BEGIN_NAMESPACE
36
37class AVFDisplayLink final : public QObject
38{
39 Q_OBJECT
40public:
41 explicit AVFDisplayLink(QObject *parent = nullptr);
42 ~AVFDisplayLink() override;
43 bool isValid() const;
44 bool isActive() const;
45
46public Q_SLOTS:
47 void start();
48 void stop();
49
50Q_SIGNALS:
51 void tick(const CVTimeStamp &ts);
52
53public:
54 void displayLinkEvent(const CVTimeStamp *);
55
56protected:
57 bool event(QEvent *) override;
58
59private:
60#if defined(QT_PLATFORM_UIKIT)
61 DisplayLinkObserver *m_displayLink{};
62#else
63 CVDisplayLinkRef m_displayLink{};
64#endif
65 QMutex m_displayLinkMutex;
66 bool m_isActive{};
67 std::optional<CVTimeStamp> m_frameTimeStamp; // GUARDED_BY(m_displayLinkMutex)
68};
69
70QT_END_NAMESPACE
71
72#endif // AVFDISPLAYLINK_H