File indexing completed on 2025-01-05 03:53:05

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2021-07-24
0007  * Description : a MJPEG frame generator.
0008  *
0009  * SPDX-FileCopyrightText: 2021-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  *
0011  * SPDX-License-Identifier: GPL-2.0-or-later
0012  *
0013  * ============================================================ */
0014 
0015 #include "mjpegframethread.h"
0016 
0017 // Local includes
0018 
0019 #include "mjpegframetask.h"
0020 
0021 namespace DigikamGenericMjpegStreamPlugin
0022 {
0023 
0024 MjpegFrameThread::MjpegFrameThread(QObject* const parent)
0025     : ActionThreadBase(parent)
0026 {
0027 }
0028 
0029 MjpegFrameThread::~MjpegFrameThread()
0030 {
0031     // cancel the thread
0032 
0033     cancel();
0034 
0035     // wait for the thread to finish
0036 
0037     wait();
0038 }
0039 
0040 void MjpegFrameThread::createFrameJob(const MjpegStreamSettings& set)
0041 {
0042     ActionJobCollection collection;
0043 
0044     MjpegFrameTask* const t = new MjpegFrameTask(set);
0045 
0046     connect(t, SIGNAL(signalFrameChanged(QByteArray)),
0047             this, SIGNAL(signalFrameChanged(QByteArray)));
0048 
0049     collection.insert(t, 0);
0050 
0051     appendJobs(collection);
0052 }
0053 
0054 } // namespace DigikamGenericMjpegStreamPlugin
0055 
0056 #include "moc_mjpegframethread.cpp"