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
qffmpegthread.cpp
Go to the documentation of this file.
1// Copyright (C) 2021 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
5
6
8
9using namespace QFFmpeg;
10
11void ConsumerThread::stopAndDelete()
12{
13 {
14 QMutexLocker locker(&m_loopDataMutex);
15 m_exit = true;
16 }
17 dataReady();
18 wait();
19 delete this;
20}
21
22void ConsumerThread::dataReady()
23{
24 m_condition.wakeAll();
25}
26
27void ConsumerThread::run()
28{
29 if (!init())
30 return;
31
32 while (true) {
33
34 {
35 QMutexLocker locker(&m_loopDataMutex);
36 while (!hasData() && !m_exit)
37 m_condition.wait(&m_loopDataMutex);
38
39 if (m_exit)
40 break;
41 }
42
43 processOne();
44 }
45
46 cleanup();
47}
48
49QMutexLocker<QMutex> ConsumerThread::lockLoopData() const
50{
51 return QMutexLocker(&m_loopDataMutex);
52}
53
54QT_END_NAMESPACE