Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qffmpegthread_p.h
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#ifndef QFFMPEGTHREAD_P_H
4#define QFFMPEGTHREAD_P_H
5
6//
7// W A R N I N G
8// -------------
9//
10// This file is not part of the Qt API. It exists purely as an
11// implementation detail. This header file may change from version to
12// version without notice, or even be removed.
13//
14// We mean it.
15//
16
17#include <private/qtmultimediaglobal_p.h>
18
19#include <qmutex.h>
20#include <qwaitcondition.h>
21#include <qthread.h>
22
24
25class QAudioSink;
26
27namespace QFFmpeg
28{
29
37class ConsumerThread : public QThread
38{
39public:
43 void stopAndDelete();
44
45protected:
46
50 virtual void init() = 0;
51
55 virtual void cleanup() = 0;
56
64 virtual void processOne() = 0;
65
71 void dataReady();
72
76 virtual bool hasData() const = 0;
77
82 QMutexLocker<QMutex> lockLoopData() const;
83
84private:
85 void run() final;
86
87 mutable QMutex m_loopDataMutex;
88 QWaitCondition m_condition;
89 bool m_exit = false;
90};
91
92}
93
95
96#endif
The QAudioSink class provides an interface for sending audio data to an audio output device.
Definition qaudiosink.h:24
FFmpeg thread that is used to implement a consumer pattern.
virtual bool hasData() const =0
Must return true when data is available for processing.
virtual void init()=0
Called on this thread when thread starts.
void stopAndDelete()
Stops the thread and deletes this object.
QMutexLocker< QMutex > lockLoopData() const
Locks the loop data mutex.
void dataReady()
Wake thread from sleep and process data until hasData() returns false.
virtual void cleanup()=0
Called on this thread before thread exits.
virtual void processOne()=0
Process one work item.
\inmodule QtCore
Definition qmutex.h:281
Combined button and popup list for selecting options.