| 1 | // Copyright (C) 2024 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 | #include "qffmpegencoderthread_p.h" |
| 4 | #include "qmetaobject.h" |
| 5 | |
| 6 | QT_BEGIN_NAMESPACE |
| 7 | |
| 8 | namespace QFFmpeg { |
| 9 | |
| 10 | EncoderThread::EncoderThread(RecordingEngine &recordingEngine) : m_recordingEngine(recordingEngine) |
| 11 | { |
| 12 | } |
| 13 | |
| 14 | void EncoderThread::setPaused(bool paused) |
| 15 | { |
| 16 | auto guard = lockLoopData(); |
| 17 | m_paused = paused; |
| 18 | } |
| 19 | |
| 20 | void EncoderThread::setAutoStop(bool autoStop) |
| 21 | { |
| 22 | auto guard = lockLoopData(); |
| 23 | m_autoStop = autoStop; |
| 24 | } |
| 25 | |
| 26 | void EncoderThread::setEndOfSourceStream() |
| 27 | { |
| 28 | { |
| 29 | auto guard = lockLoopData(); |
| 30 | m_endOfSourceStream = true; |
| 31 | } |
| 32 | |
| 33 | emit endOfSourceStream(); |
| 34 | } |
| 35 | |
| 36 | void EncoderThread::startEncoding(bool noError) |
| 37 | { |
| 38 | Q_ASSERT(!m_encodingStarted); |
| 39 | |
| 40 | m_encodingStarted = noError; |
| 41 | m_encodingStartSemaphore.release(); |
| 42 | } |
| 43 | |
| 44 | bool EncoderThread::init() |
| 45 | { |
| 46 | m_initialized = true; |
| 47 | emit initialized(); |
| 48 | m_encodingStartSemaphore.acquire(); |
| 49 | return true; |
| 50 | } |
| 51 | |
| 52 | } // namespace QFFmpeg |
| 53 | |
| 54 | QT_END_NAMESPACE |
| 55 | |
| 56 | #include "moc_qffmpegencoderthread_p.cpp" |
| 57 |
