4#ifndef QFFMPEGRECORDINGENGINEUTILS_P_H
5#define QFFMPEGRECORDINGENGINEUTILS_P_H
23class QMediaInputEncoderInterface;
24class QPlatformVideoSource;
38 auto result =
std::move(queue.front());
47template <
typename Encoder,
typename Source>
50 Q_ASSERT(!encoder->source());
51 encoder->setSource(source);
53 if constexpr (
std::is_same_v<Source, QPlatformVideoSource>) {
54 QObject::connect(source, &Source::newVideoFrame, encoder, &Encoder::addFrame,
55 Qt::DirectConnection);
57 QObject::connect(source, &Source::activeChanged, encoder, [=]() {
58 if (!source->isActive())
59 encoder->setEndOfSourceStream();
62 QObject::connect(source, &Source::newAudioBuffer, encoder, &Encoder::addBuffer,
63 Qt::DirectConnection);
71 setEncoderUpdateConnection(source, encoder);
72 setEncoderInterface(source, encoder);
bool init() override
Called on this thread when thread starts.
AudioEncoder(RecordingEngine &recordingEngine, const QAudioFormat &sourceFormat, const QMediaEncoderSettings &settings)
void addBuffer(const QAudioBuffer &buffer)
void cleanup() override
Called on this thread before thread exits.
bool hasData() const override
Must return true when data is available for processing.
void processOne() override
Process one work item.
bool checkIfCanPushFrame() const override
Q_STATIC_LOGGING_CATEGORY(qLCAndroidVideoDevices, "qt.multimedia.ffmpeg.android.videoDevices")
QT_MANGLE_NAMESPACE(QMacScreenCaptureStreamDelegate) QMacScreenCaptureStreamDelegate
void setEncoderInterface(QObject *source, QMediaInputEncoderInterface *)
void setEncoderUpdateConnection(QObject *source, EncoderThread *encoder)
T dequeueIfPossible(std::queue< T > &queue)
void disconnectEncoderFromSource(EncoderThread *encoder)
void connectEncoderToSource(Encoder *encoder, Source *source)
bool findAndOpenAVEncoder(AVCodecID codecId, const std::function< AVScore(const Codec &)> &scoresGetter, const std::function< bool(const Codec &)> &codecOpener)
constexpr qint64 VideoFrameTimeBase
static constexpr bool audioEncoderExtendedTracing
Combined button and popup list for selecting options.