3#ifndef QFFMPEGENCODERTHREAD_P_H
4#define QFFMPEGENCODERTHREAD_P_H
10#include "private/qmediainputencoderinterface_p.h"
28 void setSource(QObject *source) { m_source = source; }
53 return QScopeGuard([
this, locker = ConsumerThread::lockLoopData()]()
mutable {
57 if (m_canPushFrame.exchange(canPush, std::memory_order_relaxed) != canPush)
58 emit canPushFrameChanged();
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
FFmpeg thread that is used to implement a consumer pattern.
void dataReady()
Wake thread from sleep and process data until hasData() returns false.
void setEndOfSourceStream()
QSemaphore m_encodingStartSemaphore
void setPaused(bool paused)
bool isInitialized() const
void setSource(QObject *source)
void setAutoStop(bool autoStop)
void startEncoding(bool noError)
QPointer< QObject > m_source
bool init() override
Called on this thread when thread starts.
bool canPushFrame() const override
RecordingEngine & m_recordingEngine
bool isEndOfSourceStream() const
void updateCanPushFrame()
virtual bool checkIfCanPushFrame() const =0
void resetEndOfSourceStream()
std::atomic_bool m_canPushFrame
AVFormatContext * avFormatContext()
const AVCodec * findAVEncoder(AVCodecID codecId, const std::function< AVScore(const AVCodec *)> &scoresGetter)
const AVChannelLayout * getCodecChannelLayouts(const AVCodec *codec)
const int * getCodecSampleRates(const AVCodec *codec)
AVSampleFormat adjustSampleFormat(const AVSampleFormat *supportedFormats, AVSampleFormat requested)
bool findAndOpenAVEncoder(AVCodecID codecId, const std::function< AVScore(const AVCodec *)> &scoresGetter, const std::function< bool(const AVCodec *)> &codecOpener)
const AVSampleFormat * getCodecSampleFormats(const AVCodec *codec)
Q_STATIC_LOGGING_CATEGORY(qLcEncodingFormatContext, "qt.multimedia.ffmpeg.encodingformatcontext")
bool operator!=(const AVAudioFormat &lhs, const AVAudioFormat &rhs)
int adjustSampleRate(const int *supportedRates, int requested)
void applyExperimentalCodecOptions(const AVCodec *codec, AVDictionary **opts)
#define QT_FFMPEG_HAS_AV_CHANNEL_LAYOUT
constexpr AVScore DefaultAVScore
#define QT_BEGIN_NAMESPACE