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
QFFmpeg Namespace Reference

Classes

class  AudioEncoder
 
class  AudioRenderer
 
class  AudioSourceIO
 
struct  AVAudioFormat
 
struct  AVDeleter
 
struct  AVDictionaryHolder
 
class  CancelToken
 
class  Codec
 
class  ConsumerThread
 FFmpeg thread that is used to implement a consumer pattern. More...
 
class  D3D11TextureSet
 
class  Demuxer
 
class  EncoderThread
 
class  EncodingFormatContext
 
class  EncodingInitializer
 
struct  Frame
 
class  HWAccel
 
struct  ICancelToken
 
struct  LoopOffset
 
class  MediaCodecTextureConverter
 
class  MediaCodecTextureSet
 
class  MediaDataHolder
 
class  Muxer
 
struct  Packet
 
class  PlaybackEngine
 
class  PlaybackEngineObject
 
struct  PositionWithOffset
 
struct  QVideoFrameHolder
 
class  RecordingEngine
 
class  Renderer
 
class  StreamDecoder
 
class  SubtitleRenderer
 
class  TextureConverter
 
class  TextureConverterBackend
 
class  TextureSet
 
class  TimeController
 
class  VAAPITextureSet
 
class  VideoEncoder
 
class  VideoFrameEncoder
 
class  VideoRenderer
 

Typedefs

using AVFormatContextUPtr = std::unique_ptr<AVFormatContext, AVDeleter<decltype(&avformat_close_input), &avformat_close_input>>
 
using StreamIndexes = std::array<int, 3>
 
using AVFrameUPtr = std::unique_ptr<AVFrame, AVDeleter<decltype(&av_frame_free), &av_frame_free>>
 
using AVPacketUPtr
 
using AVCodecContextUPtr
 
using AVBufferUPtr
 
using AVHWFramesConstraintsUPtr
 
using SwrContextUPtr = std::unique_ptr<SwrContext, AVDeleter<decltype(&swr_free), &swr_free>>
 
using PixelOrSampleFormat = int
 
using AVScore = int
 
using AvioWriteBufferType
 
using ApplyOptions = void (*)(const QMediaEncoderSettings &settings, AVCodecContext *codec, AVDictionary **opts)
 

Functions

static Q_LOGGING_CATEGORY (qLcDemuxer, "qt.multimedia.ffmpeg.demuxer")
 
static qint64 streamTimeToUs (const AVStream *stream, qint64 time)
 
static qint64 packetEndPos (const AVStream *stream, const Packet &packet)
 
static Q_LOGGING_CATEGORY (qLcRenderer, "qt.multimedia.ffmpeg.renderer")
 
const AVCodec * findAVDecoder (AVCodecID codecId, const std::optional< AVHWDeviceType > &deviceType, const std::optional< PixelOrSampleFormat > &format)
 
const AVCodec * findAVEncoder (AVCodecID codecId, const std::optional< AVHWDeviceType > &deviceType, const std::optional< PixelOrSampleFormat > &format)
 
const AVCodec * findAVEncoder (AVCodecID codecId, const std::function< AVScore(const AVCodec *)> &scoresGetter)
 
bool isAVFormatSupported (const AVCodec *codec, PixelOrSampleFormat format)
 
bool isHwPixelFormat (AVPixelFormat format)
 
bool isAVCodecExperimental (const AVCodec *codec)
 
void applyExperimentalCodecOptions (const AVCodec *codec, AVDictionary **opts)
 
AVPixelFormat pixelFormatForHwDevice (AVHWDeviceType deviceType)
 
AVPacketSideData * addStreamSideData (AVStream *stream, AVPacketSideData sideData)
 
const AVPacketSideData * streamSideData (const AVStream *stream, AVPacketSideDataType type)
 
SwrContextUPtr createResampleContext (const AVAudioFormat &inputFormat, const AVAudioFormat &outputFormat)
 
QVideoFrameFormat::ColorTransfer fromAvColorTransfer (AVColorTransferCharacteristic colorTrc)
 
std::optional< qint64mul (qint64 a, AVRational b)
 
std::optional< qrealmul (qreal a, AVRational b)
 
std::optional< qint64timeStampMs (qint64 ts, AVRational base)
 
std::optional< qint64timeStampUs (qint64 ts, AVRational base)
 
std::optional< float > toFloat (AVRational r)
 
QString err2str (int errnum)
 
void setAVFrameTime (AVFrame &frame, int64_t pts, const AVRational &timeBase)
 
void getAVFrameTime (const AVFrame &frame, int64_t &pts, AVRational &timeBase)
 
int64_t getAVFrameDuration (const AVFrame &frame)
 
AVFrameUPtr makeAVFrame ()
 
template<typename Format >
bool hasAVFormat (const Format *fmts, Format format)
 
template<typename Format , typename Predicate >
Format findAVFormat (const Format *fmts, const Predicate &predicate)
 
template<typename Value , typename CalculateScore >
auto findBestAVValue (const Value *values, const CalculateScore &calculateScore, Value invalidValue={})
 
template<typename Format , typename CalculateScore >
std::pair< Format, AVScorefindBestAVFormat (const Format *fmts, const CalculateScore &calculateScore)
 
bool isSwPixelFormat (AVPixelFormat format)
 
bool operator== (const AVAudioFormat &lhs, const AVAudioFormat &rhs)
 
bool operator!= (const AVAudioFormat &lhs, const AVAudioFormat &rhs)
 
static Q_LOGGING_CATEGORY (qLcEncodingFormatContext, "qt.multimedia.ffmpeg.encodingformatcontext")
 
static AVBufferUPtr loadHWContext (AVHWDeviceType type)
 
static bool precheckDriver (AVHWDeviceType type)
 
static bool checkHwType (AVHWDeviceType type)
 
static const std::vector< AVHWDeviceType > & deviceTypes ()
 
static std::vector< AVHWDeviceType > deviceTypes (const char *envVarName)
 
template<typename CodecFinder >
std::pair< const AVCodec *, std::unique_ptr< HWAccel > > findCodecWithHwAccel (AVCodecID id, const std::vector< AVHWDeviceType > &deviceTypes, CodecFinder codecFinder, const std::function< bool(const HWAccel &)> &hwAccelPredicate)
 
static bool isNoConversionFormat (AVPixelFormat f)
 
AVPixelFormat getFormat (AVCodecContext *codecContext, const AVPixelFormat *suggestedFormats)
 
enum AVPixelFormat getFormat (struct AVCodecContext *s, const enum AVPixelFormat *fmt)
 
static const quint32fourccFromPixelFormat (const QVideoFrameFormat::PixelFormat format)
 
int readQIODevice (void *opaque, uint8_t *buf, int buf_size)
 
int writeQIODevice (void *opaque, AvioWriteBufferType buf, int buf_size)
 
int64_t seekQIODevice (void *opaque, int64_t offset, int whence)
 
static Q_LOGGING_CATEGORY (qLcPlaybackEngine, "qt.multimedia.ffmpeg.playbackengine")
 
template<typename Array >
Array defaultObjectsArray ()
 
static Q_LOGGING_CATEGORY (qLcFFmpegAudioEncoder, "qt.multimedia.ffmpeg.audioencoder")
 
AVSampleFormat adjustSampleFormat (const AVSampleFormat *supportedFormats, AVSampleFormat requested)
 
int adjustSampleRate (const int *supportedRates, int requested)
 
static AVScore calculateScoreByChannelsCount (int supportedChannelsNumber, int requestedChannelsNumber)
 
static AVScore calculateScoreByChannelsMask (int supportedChannelsNumber, uint64_t supportedMask, int requestedChannelsNumber, uint64_t requestedMask)
 
AVChannelLayout adjustChannelLayout (const AVChannelLayout *supportedLayouts, const AVChannelLayout &requested)
 
void applyVideoEncoderOptions (const QMediaEncoderSettings &settings, const QByteArray &codecName, AVCodecContext *codec, AVDictionary **opts)
 
void applyAudioEncoderOptions (const QMediaEncoderSettings &settings, const QByteArray &codecName, AVCodecContext *codec, AVDictionary **opts)
 
static Q_LOGGING_CATEGORY (qLcFFmpegMuxer, "qt.multimedia.ffmpeg.muxer")
 
template<typename T >
dequeueIfPossible (std::queue< T > &queue)
 
static Q_LOGGING_CATEGORY (qLcFFmpegVideoEncoder, "qt.multimedia.ffmpeg.videoencoder")
 
static void freeQVideoFrame (void *opaque, uint8_t *)
 
static AVScore calculateTargetSwFormatScore (const AVPixFmtDescriptor *sourceSwFormatDesc, AVPixelFormat fmt)
 
static auto targetSwFormatScoreCalculator (AVPixelFormat sourceFormat)
 
static bool isHwFormatAcceptedByCodec (AVPixelFormat pixFormat)
 
AVPixelFormat findTargetSWFormat (AVPixelFormat sourceSWFormat, const AVCodec *codec, const HWAccel &accel)
 
AVPixelFormat findTargetFormat (AVPixelFormat sourceFormat, AVPixelFormat sourceSWFormat, const AVCodec *codec, const HWAccel *accel)
 
std::pair< const AVCodec *, std::unique_ptr< HWAccel > > findHwEncoder (AVCodecID codecID, const QSize &resolution)
 
const AVCodec * findSwEncoder (AVCodecID codecID, AVPixelFormat sourceSWFormat)
 
AVRational adjustFrameRate (const AVRational *supportedRates, qreal requestedRate)
 adjustFrameRate get a rational frame rate be requested qreal rate. If the codec supports fixed frame rate (non-null supportedRates), the function selects the most suitable one, otherwise just makes AVRational from qreal.
 
AVRational adjustFrameTimeBase (const AVRational *supportedRates, AVRational frameRate)
 adjustFrameTimeBase gets adjusted timebase by a list of supported frame rates and an already adjusted frame rate.
 
QSize adjustVideoResolution (const AVCodec *codec, QSize requestedResolution)
 

Variables

static QAtomicInteger< PlaybackEngineObject::IdPersistentId = 0
 
constexpr AVScore BestAVScore = std::numeric_limits<AVScore>::max()
 
constexpr AVScore DefaultAVScore = 0
 
constexpr AVScore NotSuitableAVScore = std::numeric_limits<AVScore>::min()
 
constexpr AVScore MinAVScore = NotSuitableAVScore + 1
 
static const std::initializer_list< AVHWDeviceType > preferredHardwareAccelerators
 
static constexpr bool shouldPauseStreams = false
 
struct { 
 
   const char *   QFFmpeg::name 
 
   ApplyOptions   QFFmpeg::apply 
 
videoCodecOptionTable [] 
 
struct { 
 
   const char *   QFFmpeg::name 
 
   ApplyOptions   QFFmpeg::apply 
 
audioCodecOptionTable [] 
 

Typedef Documentation

◆ ApplyOptions

using QFFmpeg::ApplyOptions = void (*)(const QMediaEncoderSettings &settings, AVCodecContext *codec, AVDictionary **opts)

Definition at line 283 of file qffmpegencoderoptions.cpp.

◆ AVBufferUPtr

Initial value:
std::unique_ptr<AVBufferRef, AVDeleter<decltype(&av_buffer_unref), &av_buffer_unref>>

Definition at line 148 of file qffmpeg_p.h.

◆ AVCodecContextUPtr

Initial value:
std::unique_ptr<AVCodecContext,
AVDeleter<decltype(&avcodec_free_context), &avcodec_free_context>>

Definition at line 144 of file qffmpeg_p.h.

◆ AVFormatContextUPtr

using QFFmpeg::AVFormatContextUPtr = std::unique_ptr<AVFormatContext, AVDeleter<decltype(&avformat_close_input), &avformat_close_input>>

Definition at line 37 of file qffmpegmediadataholder_p.h.

◆ AVFrameUPtr

using QFFmpeg::AVFrameUPtr = std::unique_ptr<AVFrame, AVDeleter<decltype(&av_frame_free), &av_frame_free>>

Definition at line 134 of file qffmpeg_p.h.

◆ AVHWFramesConstraintsUPtr

Initial value:
std::unique_ptr<
AVHWFramesConstraints,
AVDeleter<decltype(&av_hwframe_constraints_free), &av_hwframe_constraints_free>>

Definition at line 151 of file qffmpeg_p.h.

◆ AvioWriteBufferType

Initial value:
std::conditional_t<QT_FFMPEG_AVIO_WRITE_CONST, const uint8_t *, uint8_t *>

Definition at line 29 of file qffmpegioutils_p.h.

◆ AVPacketUPtr

Initial value:
std::unique_ptr<AVPacket, AVDeleter<decltype(&av_packet_free), &av_packet_free>>

Definition at line 141 of file qffmpeg_p.h.

◆ AVScore

using QFFmpeg::AVScore = int

Definition at line 158 of file qffmpeg_p.h.

◆ PixelOrSampleFormat

Definition at line 157 of file qffmpeg_p.h.

◆ StreamIndexes

using QFFmpeg::StreamIndexes = std::array<int, 3>

Definition at line 31 of file qffmpegplaybackenginedefs_p.h.

◆ SwrContextUPtr

using QFFmpeg::SwrContextUPtr = std::unique_ptr<SwrContext, AVDeleter<decltype(&swr_free), &swr_free>>

Definition at line 155 of file qffmpeg_p.h.

Function Documentation

◆ addStreamSideData()

AVPacketSideData * QFFmpeg::addStreamSideData ( AVStream * stream,
AVPacketSideData sideData )

Definition at line 512 of file qffmpeg.cpp.

References Q_UNUSED, and qWarning.

◆ adjustChannelLayout()

AVChannelLayout QFFmpeg::adjustChannelLayout ( const AVChannelLayout * supportedLayouts,
const AVChannelLayout & requested )

Definition at line 68 of file qffmpegaudioencoderutils.cpp.

References BestAVScore, calculateScoreByChannelsCount(), calculateScoreByChannelsMask(), findBestAVValue(), layout, and NotSuitableAVScore.

Referenced by QFFmpeg::AudioEncoder::AudioEncoder().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ adjustFrameRate()

AVRational QFFmpeg::adjustFrameRate ( const AVRational * supportedRates,
qreal requestedRate )

adjustFrameRate get a rational frame rate be requested qreal rate. If the codec supports fixed frame rate (non-null supportedRates), the function selects the most suitable one, otherwise just makes AVRational from qreal.

Definition at line 160 of file qffmpegvideoencoderutils.cpp.

References findBestAVValue(), qMax(), qMin(), and qRealToFraction().

+ Here is the call graph for this function:

◆ adjustFrameTimeBase()

AVRational QFFmpeg::adjustFrameTimeBase ( const AVRational * supportedRates,
AVRational frameRate )

adjustFrameTimeBase gets adjusted timebase by a list of supported frame rates and an already adjusted frame rate.

Timebase is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented. For fixed-fps content (non-null supportedRates), timebase should be 1/framerate.

For more information, see AVStream::time_base and AVCodecContext::time_base.

The adjusted time base is supposed to be set to stream and codec context.

Definition at line 176 of file qffmpegvideoencoderutils.cpp.

References frameRate, and Q_ASSERT.

◆ adjustSampleFormat()

AVSampleFormat QFFmpeg::adjustSampleFormat ( const AVSampleFormat * supportedFormats,
AVSampleFormat requested )

Definition at line 11 of file qffmpegaudioencoderutils.cpp.

References BestAVScore, and findBestAVFormat().

Referenced by QFFmpeg::AudioEncoder::AudioEncoder().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ adjustSampleRate()

int QFFmpeg::adjustSampleRate ( const int * supportedRates,
int requested )

Definition at line 23 of file qffmpegaudioencoderutils.cpp.

References BestAVScore, and findBestAVValue().

Referenced by QFFmpeg::AudioEncoder::AudioEncoder().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ adjustVideoResolution()

QSize QFFmpeg::adjustVideoResolution ( const AVCodec * codec,
QSize requestedResolution )

Definition at line 197 of file qffmpegvideoencoderutils.cpp.

References codec, and Q_UNUSED.

◆ applyAudioEncoderOptions()

void QFFmpeg::applyAudioEncoderOptions ( const QMediaEncoderSettings & settings,
const QByteArray & codecName,
AVCodecContext * codec,
AVDictionary ** opts )

Definition at line 342 of file qffmpegencoderoptions.cpp.

References audioCodecOptionTable, QMediaRecorder::AverageBitRateEncoding, codec, QMediaRecorder::ConstantBitRateEncoding, and settings.

Referenced by QFFmpeg::AudioEncoder::open().

+ Here is the caller graph for this function:

◆ applyExperimentalCodecOptions()

void QFFmpeg::applyExperimentalCodecOptions ( const AVCodec * codec,
AVDictionary ** opts )

Definition at line 467 of file qffmpeg.cpp.

References codec, isAVCodecExperimental(), and qCWarning.

Referenced by QFFmpeg::Codec::create(), QFFmpeg::AudioEncoder::open(), and QFFmpeg::VideoFrameEncoder::open().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ applyVideoEncoderOptions()

void QFFmpeg::applyVideoEncoderOptions ( const QMediaEncoderSettings & settings,
const QByteArray & codecName,
AVCodecContext * codec,
AVDictionary ** opts )

Definition at line 327 of file qffmpegencoderoptions.cpp.

References codec, settings, and videoCodecOptionTable.

Referenced by QFFmpeg::VideoFrameEncoder::open().

+ Here is the caller graph for this function:

◆ calculateScoreByChannelsCount()

static AVScore QFFmpeg::calculateScoreByChannelsCount ( int supportedChannelsNumber,
int requestedChannelsNumber )
static

Definition at line 35 of file qffmpegaudioencoderutils.cpp.

Referenced by adjustChannelLayout(), and calculateScoreByChannelsMask().

+ Here is the caller graph for this function:

◆ calculateScoreByChannelsMask()

static AVScore QFFmpeg::calculateScoreByChannelsMask ( int supportedChannelsNumber,
uint64_t supportedMask,
int requestedChannelsNumber,
uint64_t requestedMask )
static

Definition at line 44 of file qffmpegaudioencoderutils.cpp.

References BestAVScore, calculateScoreByChannelsCount(), and qPopulationCount().

Referenced by adjustChannelLayout().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculateTargetSwFormatScore()

static AVScore QFFmpeg::calculateTargetSwFormatScore ( const AVPixFmtDescriptor * sourceSwFormatDesc,
AVPixelFormat fmt )
static

Definition at line 15 of file qffmpegvideoencoderutils.cpp.

References DefaultAVScore, fmt, and NotSuitableAVScore.

Referenced by targetSwFormatScoreCalculator().

+ Here is the caller graph for this function:

◆ checkHwType()

static bool QFFmpeg::checkHwType ( AVHWDeviceType type)
static

Definition at line 114 of file qffmpeghwaccel.cpp.

References FFmpegLogsEnabledInThread, loadHWContext(), precheckDriver(), qCDebug, QT_FFMPEG_HAS_D3D12VA, and qWarning.

Referenced by deviceTypes().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createResampleContext()

SwrContextUPtr QFFmpeg::createResampleContext ( const AVAudioFormat & inputFormat,
const AVAudioFormat & outputFormat )

Definition at line 553 of file qffmpeg.cpp.

References QFFmpeg::AVAudioFormat::channelLayout, QFFmpeg::AVAudioFormat::sampleFormat, and QFFmpeg::AVAudioFormat::sampleRate.

Referenced by QFFmpeg::AudioEncoder::open().

+ Here is the caller graph for this function:

◆ defaultObjectsArray()

template<typename Array >
Array QFFmpeg::defaultObjectsArray ( )
inline

Definition at line 27 of file qffmpegplaybackengine.cpp.

◆ dequeueIfPossible()

template<typename T >
T QFFmpeg::dequeueIfPossible ( std::queue< T > & queue)

Definition at line 42 of file qffmpegrecordingengine_p.h.

References queue.

◆ deviceTypes() [1/2]

static const std::vector< AVHWDeviceType > & QFFmpeg::deviceTypes ( )
static

Definition at line 143 of file qffmpeghwaccel.cpp.

References QSet< T >::begin(), checkHwType(), codec, QSet< T >::end(), isHwPixelFormat(), it, pixelFormatForHwDevice(), preferredHardwareAccelerators, qCDebug, QTimer::start(), and timer.

Referenced by QFFmpeg::HWAccel::decodingDeviceTypes(), deviceTypes(), QFFmpeg::HWAccel::encodingDeviceTypes(), and findCodecWithHwAccel().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deviceTypes() [2/2]

static std::vector< AVHWDeviceType > QFFmpeg::deviceTypes ( const char * envVarName)
static

Definition at line 185 of file qffmpeghwaccel.cpp.

References deviceType(), deviceTypes(), QString::fromUtf8(), qgetenv(), and qWarning.

+ Here is the call graph for this function:

◆ err2str()

QString QFFmpeg::err2str ( int errnum)
inline

Definition at line 64 of file qffmpeg_p.h.

References QString::fromLocal8Bit().

Referenced by QFFmpeg::Codec::create(), QFFmpeg::HWAccel::createFramesContext(), QFFmpeg::VideoFrameEncoder::open(), QFFmpeg::VideoEncoder::processOne(), QFFmpeg::VideoFrameEncoder::retrievePacket(), and QFFmpeg::VideoFrameEncoder::sendFrame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ findAVDecoder()

const AVCodec * QFFmpeg::findAVDecoder ( AVCodecID codecId,
const std::optional< AVHWDeviceType > & deviceType,
const std::optional< PixelOrSampleFormat > & format )

Definition at line 427 of file qffmpeg.cpp.

References codecId(), and deviceType().

Referenced by QFFmpegMediaFormatInfo::QFFmpegMediaFormatInfo(), QFFmpeg::Codec::create(), and QFFmpeg::HWAccel::findDecoderWithHwAccel().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ findAVEncoder() [1/2]

const AVCodec * QFFmpeg::findAVEncoder ( AVCodecID codecId,
const std::function< AVScore(const AVCodec *)> & scoresGetter )

Definition at line 439 of file qffmpeg.cpp.

References codecId().

+ Here is the call graph for this function:

◆ findAVEncoder() [2/2]

const AVCodec * QFFmpeg::findAVEncoder ( AVCodecID codecId,
const std::optional< AVHWDeviceType > & deviceType,
const std::optional< PixelOrSampleFormat > & format )

Definition at line 433 of file qffmpeg.cpp.

References codecId(), and deviceType().

Referenced by QFFmpeg::AudioEncoder::AudioEncoder(), QFFmpegMediaFormatInfo::QFFmpegMediaFormatInfo(), QFFmpeg::HWAccel::findEncoderWithHwAccel(), and findSwEncoder().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ findAVFormat()

template<typename Format , typename Predicate >
Format QFFmpeg::findAVFormat ( const Format * fmts,
const Predicate & predicate )

Definition at line 184 of file qffmpeg_p.h.

References BestAVScore, findBestAVFormat(), fmt, NotSuitableAVScore, and predicate.

Referenced by getFormat(), and hasAVFormat().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ findBestAVFormat()

template<typename Format , typename CalculateScore >
std::pair< Format, AVScore > QFFmpeg::findBestAVFormat ( const Format * fmts,
const CalculateScore & calculateScore )

Definition at line 210 of file qffmpeg_p.h.

References findBestAVValue().

Referenced by adjustSampleFormat(), findAVFormat(), findSwEncoder(), findTargetFormat(), findTargetSWFormat(), and getFormat().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ findBestAVValue()

template<typename Value , typename CalculateScore >
auto QFFmpeg::findBestAVValue ( const Value * values,
const CalculateScore & calculateScore,
Value invalidValue = {} )

Definition at line 193 of file qffmpeg_p.h.

Referenced by adjustChannelLayout(), adjustFrameRate(), adjustSampleRate(), and findBestAVFormat().

+ Here is the caller graph for this function:

◆ findCodecWithHwAccel()

template<typename CodecFinder >
std::pair< const AVCodec *, std::unique_ptr< HWAccel > > QFFmpeg::findCodecWithHwAccel ( AVCodecID id,
const std::vector< AVHWDeviceType > & deviceTypes,
CodecFinder codecFinder,
const std::function< bool(const HWAccel &)> & hwAccelPredicate )

Definition at line 210 of file qffmpeghwaccel.cpp.

References codec, QFFmpeg::HWAccel::create(), deviceTypes(), and qCDebug.

Referenced by QFFmpeg::HWAccel::findDecoderWithHwAccel(), and QFFmpeg::HWAccel::findEncoderWithHwAccel().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ findHwEncoder()

std::pair< const AVCodec *, std::unique_ptr< HWAccel > > QFFmpeg::findHwEncoder ( AVCodecID codecID,
const QSize & resolution )

Definition at line 126 of file qffmpegvideoencoderutils.cpp.

References QFFmpeg::HWAccel::findEncoderWithHwAccel(), QSize::height(), Q_ASSERT, and QSize::width().

+ Here is the call graph for this function:

◆ findSwEncoder()

const AVCodec * QFFmpeg::findSwEncoder ( AVCodecID codecID,
AVPixelFormat sourceSWFormat )

Definition at line 147 of file qffmpegvideoencoderutils.cpp.

References codec, findAVEncoder(), findBestAVFormat(), MinAVScore, and targetSwFormatScoreCalculator().

+ Here is the call graph for this function:

◆ findTargetFormat()

AVPixelFormat QFFmpeg::findTargetFormat ( AVPixelFormat sourceFormat,
AVPixelFormat sourceSWFormat,
const AVCodec * codec,
const HWAccel * accel )

Definition at line 95 of file qffmpegvideoencoderutils.cpp.

References codec, QFFmpeg::HWAccel::constraints(), findBestAVFormat(), findTargetSWFormat(), hasAVFormat(), QFFmpeg::HWAccel::hwFormat(), isHwFormatAcceptedByCodec(), Q_UNUSED, qWarning, and targetSwFormatScoreCalculator().

+ Here is the call graph for this function:

◆ findTargetSWFormat()

AVPixelFormat QFFmpeg::findTargetSWFormat ( AVPixelFormat sourceSWFormat,
const AVCodec * codec,
const HWAccel & accel )

Definition at line 78 of file qffmpegvideoencoderutils.cpp.

References codec, QFFmpeg::HWAccel::constraints(), findBestAVFormat(), and targetSwFormatScoreCalculator().

Referenced by findTargetFormat().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fourccFromPixelFormat()

◆ freeQVideoFrame()

static void QFFmpeg::freeQVideoFrame ( void * opaque,
uint8_t *  )
static

Definition at line 119 of file qffmpegvideoencoder.cpp.

Referenced by QFFmpeg::VideoEncoder::processOne().

+ Here is the caller graph for this function:

◆ fromAvColorTransfer()

QVideoFrameFormat::ColorTransfer QFFmpeg::fromAvColorTransfer ( AVColorTransferCharacteristic colorTrc)

◆ getAVFrameDuration()

int64_t QFFmpeg::getAVFrameDuration ( const AVFrame & frame)
inline

Definition at line 91 of file qffmpeg_p.h.

References frame, and Q_UNUSED.

Referenced by QFFmpeg::Frame::Data::Data().

+ Here is the caller graph for this function:

◆ getAVFrameTime()

void QFFmpeg::getAVFrameTime ( const AVFrame & frame,
int64_t & pts,
AVRational & timeBase )
inline

Definition at line 81 of file qffmpeg_p.h.

References frame.

Referenced by QFFmpeg::VideoFrameEncoder::sendFrame().

+ Here is the caller graph for this function:

◆ getFormat() [1/2]

AVPixelFormat QFFmpeg::getFormat ( AVCodecContext * codecContext,
const AVPixelFormat * suggestedFormats )

Definition at line 283 of file qffmpeghwaccel.cpp.

References DefaultAVScore, findAVFormat(), findBestAVFormat(), i, isAVFormatSupported(), isHwPixelFormat(), isNoConversionFormat(), NotSuitableAVScore, and qCDebug.

Referenced by QFFmpeg::Codec::create().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFormat() [2/2]

enum AVPixelFormat QFFmpeg::getFormat ( struct AVCodecContext * s,
const enum AVPixelFormat * fmt )

◆ hasAVFormat()

template<typename Format >
bool QFFmpeg::hasAVFormat ( const Format * fmts,
Format format )

Definition at line 178 of file qffmpeg_p.h.

References findAVFormat().

Referenced by findTargetFormat(), and isAVFormatSupported().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isAVCodecExperimental()

bool QFFmpeg::isAVCodecExperimental ( const AVCodec * codec)

Definition at line 462 of file qffmpeg.cpp.

References codec.

Referenced by applyExperimentalCodecOptions().

+ Here is the caller graph for this function:

◆ isAVFormatSupported()

bool QFFmpeg::isAVFormatSupported ( const AVCodec * codec,
PixelOrSampleFormat format )

Definition at line 445 of file qffmpeg.cpp.

References codec, and hasAVFormat().

Referenced by getFormat().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isHwFormatAcceptedByCodec()

static bool QFFmpeg::isHwFormatAcceptedByCodec ( AVPixelFormat pixFormat)
static

Definition at line 67 of file qffmpegvideoencoderutils.cpp.

Referenced by findTargetFormat().

+ Here is the caller graph for this function:

◆ isHwPixelFormat()

bool QFFmpeg::isHwPixelFormat ( AVPixelFormat format)

Definition at line 456 of file qffmpeg.cpp.

Referenced by QFFmpeg::VideoFrameEncoder::create(), deviceTypes(), getFormat(), and isSwPixelFormat().

+ Here is the caller graph for this function:

◆ isNoConversionFormat()

static bool QFFmpeg::isNoConversionFormat ( AVPixelFormat f)
static

Definition at line 243 of file qffmpeghwaccel.cpp.

References QFFmpegVideoBuffer::toQtPixelFormat().

Referenced by getFormat().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isSwPixelFormat()

bool QFFmpeg::isSwPixelFormat ( AVPixelFormat format)
inline

Definition at line 220 of file qffmpeg_p.h.

References isHwPixelFormat().

Referenced by QFFmpeg::VideoFrameEncoder::create().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadHWContext()

static AVBufferUPtr QFFmpeg::loadHWContext ( AVHWDeviceType type)
static

Definition at line 60 of file qffmpeghwaccel.cpp.

References qCDebug, and ret.

Referenced by checkHwType(), and QFFmpeg::HWAccel::create().

+ Here is the caller graph for this function:

◆ makeAVFrame()

AVFrameUPtr QFFmpeg::makeAVFrame ( )
inline

Definition at line 136 of file qffmpeg_p.h.

Referenced by allocHWFrame(), QAVFSampleBufferDelegate::captureOutput:didOutputSampleBuffer:fromConnection:, QFFmpegVideoBuffer::convertSWFrame(), QAndroidCamera::frameAvailable(), QFFmpegVideoBuffer::map(), QFFmpeg::AudioEncoder::processOne(), QFFmpeg::VideoEncoder::processOne(), and QFFmpeg::VideoFrameEncoder::sendFrame().

+ Here is the caller graph for this function:

◆ mul() [1/2]

std::optional< qint64 > QFFmpeg::mul ( qint64 a,
AVRational b )
inline

Definition at line 39 of file qffmpeg_p.h.

Referenced by QFFmpeg::Frame::Data::Data(), QFFmpegVideoBuffer::maxNits(), streamTimeToUs(), timeStampMs(), and timeStampUs().

+ Here is the caller graph for this function:

◆ mul() [2/2]

std::optional< qreal > QFFmpeg::mul ( qreal a,
AVRational b )
inline

Definition at line 44 of file qffmpeg_p.h.

◆ operator!=()

bool QFFmpeg::operator!= ( const AVAudioFormat & lhs,
const AVAudioFormat & rhs )
inline

Definition at line 59 of file qffmpegavaudioformat_p.h.

◆ operator==()

bool QFFmpeg::operator== ( const AVAudioFormat & lhs,
const AVAudioFormat & rhs )

◆ packetEndPos()

static qint64 QFFmpeg::packetEndPos ( const AVStream * stream,
const Packet & packet )
static

Definition at line 27 of file qffmpegdemuxer.cpp.

References QFFmpeg::Packet::avPacket(), QFFmpeg::Packet::loopOffset(), QFFmpeg::LoopOffset::pos, and streamTimeToUs().

Referenced by QFFmpeg::Demuxer::doNextStep(), and QFFmpeg::Demuxer::onPacketProcessed().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pixelFormatForHwDevice()

AVPixelFormat QFFmpeg::pixelFormatForHwDevice ( AVHWDeviceType deviceType)

Definition at line 476 of file qffmpeg.cpp.

References deviceType().

Referenced by deviceTypes(), and QFFmpeg::HWAccel::hwFormat().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ precheckDriver()

static bool QFFmpeg::precheckDriver ( AVHWDeviceType type)
static

Definition at line 76 of file qffmpeghwaccel.cpp.

References QFile::exists(), QLibrary::load(), Q_UNUSED, and QLibrary::unload().

Referenced by checkHwType().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Q_LOGGING_CATEGORY() [1/7]

static QFFmpeg::Q_LOGGING_CATEGORY ( qLcDemuxer ,
"qt.multimedia.ffmpeg.demuxer"  )
static

◆ Q_LOGGING_CATEGORY() [2/7]

static QFFmpeg::Q_LOGGING_CATEGORY ( qLcEncodingFormatContext ,
"qt.multimedia.ffmpeg.encodingformatcontext"  )
static

◆ Q_LOGGING_CATEGORY() [3/7]

static QFFmpeg::Q_LOGGING_CATEGORY ( qLcFFmpegAudioEncoder ,
"qt.multimedia.ffmpeg.audioencoder"  )
static

◆ Q_LOGGING_CATEGORY() [4/7]

static QFFmpeg::Q_LOGGING_CATEGORY ( qLcFFmpegMuxer ,
"qt.multimedia.ffmpeg.muxer"  )
static

◆ Q_LOGGING_CATEGORY() [5/7]

static QFFmpeg::Q_LOGGING_CATEGORY ( qLcFFmpegVideoEncoder ,
"qt.multimedia.ffmpeg.videoencoder"  )
static

◆ Q_LOGGING_CATEGORY() [6/7]

static QFFmpeg::Q_LOGGING_CATEGORY ( qLcPlaybackEngine ,
"qt.multimedia.ffmpeg.playbackengine"  )
static

◆ Q_LOGGING_CATEGORY() [7/7]

static QFFmpeg::Q_LOGGING_CATEGORY ( qLcRenderer ,
"qt.multimedia.ffmpeg.renderer"  )
static

◆ readQIODevice()

int QFFmpeg::readQIODevice ( void * opaque,
uint8_t * buf,
int buf_size )

Definition at line 12 of file qffmpegioutils.cpp.

References Q_ASSERT.

◆ seekQIODevice()

int64_t QFFmpeg::seekQIODevice ( void * opaque,
int64_t offset,
int whence )

Definition at line 30 of file qffmpegioutils.cpp.

References QIODevice::isSequential(), QIODevice::pos(), Q_ASSERT, QIODevice::seek(), and QIODevice::size().

Referenced by QFFmpeg::EncodingFormatContext::openAVIO().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setAVFrameTime()

void QFFmpeg::setAVFrameTime ( AVFrame & frame,
int64_t pts,
const AVRational & timeBase )
inline

Definition at line 71 of file qffmpeg_p.h.

References frame, and Q_UNUSED.

Referenced by QFFmpeg::AudioEncoder::processOne(), QFFmpeg::VideoEncoder::processOne(), and QFFmpeg::VideoFrameEncoder::sendFrame().

+ Here is the caller graph for this function:

◆ streamSideData()

const AVPacketSideData * QFFmpeg::streamSideData ( const AVStream * stream,
AVPacketSideDataType type )

Definition at line 538 of file qffmpeg.cpp.

References item, nullptr, Q_ASSERT, and QGraphicsItem::type().

+ Here is the call graph for this function:

◆ streamTimeToUs()

static qint64 QFFmpeg::streamTimeToUs ( const AVStream * stream,
qint64 time )
static

Definition at line 19 of file qffmpegdemuxer.cpp.

References mul(), Q_ASSERT, and time.

Referenced by QFFmpeg::Demuxer::doNextStep(), QFFmpeg::Demuxer::onPacketProcessed(), and packetEndPos().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ targetSwFormatScoreCalculator()

static auto QFFmpeg::targetSwFormatScoreCalculator ( AVPixelFormat sourceFormat)
static

Definition at line 61 of file qffmpegvideoencoderutils.cpp.

References calculateTargetSwFormatScore(), and fmt.

Referenced by findSwEncoder(), findTargetFormat(), and findTargetSWFormat().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ timeStampMs()

std::optional< qint64 > QFFmpeg::timeStampMs ( qint64 ts,
AVRational base )
inline

Definition at line 49 of file qffmpeg_p.h.

References base, and mul().

Referenced by QFFmpeg::VideoFrameEncoder::retrievePacket(), and QFFmpeg::Codec::toMs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ timeStampUs()

std::optional< qint64 > QFFmpeg::timeStampUs ( qint64 ts,
AVRational base )
inline

Definition at line 54 of file qffmpeg_p.h.

References base, and mul().

Referenced by QFFmpeg::Codec::toUs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toFloat()

std::optional< float > QFFmpeg::toFloat ( AVRational r)
inline

Definition at line 59 of file qffmpeg_p.h.

◆ writeQIODevice()

int QFFmpeg::writeQIODevice ( void * opaque,
AvioWriteBufferType buf,
int buf_size )

Definition at line 22 of file qffmpegioutils.cpp.

References Q_ASSERT.

Referenced by QFFmpeg::EncodingFormatContext::openAVIO().

+ Here is the caller graph for this function:

Variable Documentation

◆ apply

ApplyOptions QFFmpeg::apply

Definition at line 287 of file qffmpegencoderoptions.cpp.

◆ [struct]

const struct { ... } QFFmpeg::audioCodecOptionTable[]
Initial value:
= {
{ nullptr, nullptr }
}

Referenced by applyAudioEncoderOptions().

◆ BestAVScore

constexpr AVScore QFFmpeg::BestAVScore = std::numeric_limits<AVScore>::max()
constexpr

◆ DefaultAVScore

constexpr AVScore QFFmpeg::DefaultAVScore = 0
constexpr

Definition at line 160 of file qffmpeg_p.h.

Referenced by calculateTargetSwFormatScore(), and getFormat().

◆ MinAVScore

constexpr AVScore QFFmpeg::MinAVScore = NotSuitableAVScore + 1
constexpr

Definition at line 162 of file qffmpeg_p.h.

Referenced by findSwEncoder().

◆ name

const char* QFFmpeg::name

Definition at line 286 of file qffmpegencoderoptions.cpp.

◆ NotSuitableAVScore

constexpr AVScore QFFmpeg::NotSuitableAVScore = std::numeric_limits<AVScore>::min()
constexpr

◆ PersistentId

QAtomicInteger<PlaybackEngineObject::Id> QFFmpeg::PersistentId = 0
static

Definition at line 13 of file qffmpegplaybackengineobject.cpp.

◆ preferredHardwareAccelerators

const std::initializer_list<AVHWDeviceType> QFFmpeg::preferredHardwareAccelerators
static
Initial value:
= {
}

Definition at line 42 of file qffmpeghwaccel.cpp.

Referenced by deviceTypes().

◆ shouldPauseStreams

constexpr bool QFFmpeg::shouldPauseStreams = false
staticconstexpr

Definition at line 40 of file qffmpegplaybackengine.cpp.

◆ [struct]

const struct { ... } QFFmpeg::videoCodecOptionTable[]