Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
avfcamerautility.mm File Reference
#include "avfcamerautility_p.h"
#include "avfcameradebug_p.h"
#include <QtCore/qvector.h>
#include <QtCore/qpair.h>
#include <private/qmultimediautils_p.h>
#include "avfvideobuffer_p.h"
#include "qavfhelpers_p.h"
#include <functional>
#include <algorithm>
#include <limits>
#include <tuple>
+ Include dependency graph for avfcamerautility.mm:

Go to the source code of this file.

Functions

QT_BEGIN_NAMESPACE AVFPSRange qt_connection_framerates (AVCaptureConnection *videoConnection)
 
AVCaptureDeviceFormat * qt_convert_to_capture_device_format (AVCaptureDevice *captureDevice, const QCameraFormat &cameraFormat, const std::function< bool(uint32_t)> &cvFormatValidator)
 
QVector< AVCaptureDeviceFormat * > qt_unique_device_formats (AVCaptureDevice *captureDevice, FourCharCode filter)
 
QSize qt_device_format_resolution (AVCaptureDeviceFormat *format)
 
QSize qt_device_format_high_resolution (AVCaptureDeviceFormat *format)
 
QVector< AVFPSRangeqt_device_format_framerates (AVCaptureDeviceFormat *format)
 
QSize qt_device_format_pixel_aspect_ratio (AVCaptureDeviceFormat *format)
 
AVCaptureDeviceFormat * qt_find_best_resolution_match (AVCaptureDevice *captureDevice, const QSize &request, FourCharCode filter, bool stillImage)
 
AVCaptureDeviceFormat * qt_find_best_framerate_match (AVCaptureDevice *captureDevice, FourCharCode filter, Float64 fps)
 
AVFrameRateRange * qt_find_supported_framerate_range (AVCaptureDeviceFormat *format, Float64 fps)
 
bool qt_format_supports_framerate (AVCaptureDeviceFormat *format, qreal fps)
 
bool qt_formats_are_equal (AVCaptureDeviceFormat *f1, AVCaptureDeviceFormat *f2)
 
bool qt_set_active_format (AVCaptureDevice *captureDevice, AVCaptureDeviceFormat *format, bool preserveFps)
 
void qt_set_framerate_limits (AVCaptureConnection *videoConnection, qreal minFPS, qreal maxFPS)
 
CMTime qt_adjusted_frame_duration (AVFrameRateRange *range, qreal fps)
 
void qt_set_framerate_limits (AVCaptureDevice *captureDevice, qreal minFPS, qreal maxFPS)
 
void qt_set_framerate_limits (AVCaptureDevice *captureDevice, AVCaptureConnection *videoConnection, qreal minFPS, qreal maxFPS)
 
AVFPSRange qt_current_framerates (AVCaptureDevice *captureDevice, AVCaptureConnection *videoConnection)
 
QList< AudioValueRange > qt_supported_sample_rates_for_format (int codecId)
 
QList< AudioValueRange > qt_supported_bit_rates_for_format (int codecId)
 
std::optional< QList< UInt32 > > qt_supported_channel_counts_for_format (int codecId)
 
QList< UInt32 > qt_supported_channel_layout_tags_for_format (int codecId, int noChannels)
 

Function Documentation

◆ qt_adjusted_frame_duration()

CMTime qt_adjusted_frame_duration ( AVFrameRateRange *  range,
qreal  fps 
)

Definition at line 472 of file avfcamerautility.mm.

References Q_ASSERT, and qRealToFraction().

Referenced by qt_set_framerate_limits().

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

◆ qt_connection_framerates()

QT_BEGIN_NAMESPACE AVFPSRange qt_connection_framerates ( AVCaptureConnection *  videoConnection)

Definition at line 22 of file avfcamerautility.mm.

References Float64, and Q_ASSERT.

◆ qt_convert_to_capture_device_format()

AVCaptureDeviceFormat * qt_convert_to_capture_device_format ( AVCaptureDevice *  captureDevice,
const QCameraFormat cameraFormat,
const std::function< bool(uint32_t)> &  cvFormatValidator 
)

Definition at line 99 of file avfcamerautility.mm.

References QAVFHelpers::fromCVPixelFormat(), QSize::height(), QCameraFormat::maxFrameRate, QCameraFormat::minFrameRate, QCameraFormat::pixelFormat, QCameraFormat::resolution, and QSize::width().

+ Here is the call graph for this function:

◆ qt_current_framerates()

AVFPSRange qt_current_framerates ( AVCaptureDevice *  captureDevice,
AVCaptureConnection *  videoConnection 
)

Definition at line 560 of file avfcamerautility.mm.

References Float64, Q_ASSERT, and Q_UNUSED.

Referenced by avfVideoSettings(), and qt_set_active_format().

+ Here is the caller graph for this function:

◆ qt_device_format_framerates()

QVector< AVFPSRange > qt_device_format_framerates ( AVCaptureDeviceFormat *  format)

Definition at line 192 of file avfcamerautility.mm.

References Q_ASSERT, and QList< T >::reserve().

+ Here is the call graph for this function:

◆ qt_device_format_high_resolution()

QSize qt_device_format_high_resolution ( AVCaptureDeviceFormat *  format)

Definition at line 180 of file avfcamerautility.mm.

References Q_ASSERT.

Referenced by AVFImageCapture::applySettings(), AVFImageCapture::imageSettings(), and qt_find_best_resolution_match().

+ Here is the caller graph for this function:

◆ qt_device_format_pixel_aspect_ratio()

QSize qt_device_format_pixel_aspect_ratio ( AVCaptureDeviceFormat *  format)

Definition at line 208 of file avfcamerautility.mm.

References Q_ASSERT, Q_FUNC_INFO, qAbs(), qCDebug, and qRealToFraction().

+ Here is the call graph for this function:

◆ qt_device_format_resolution()

QSize qt_device_format_resolution ( AVCaptureDeviceFormat *  format)

Definition at line 171 of file avfcamerautility.mm.

Referenced by AVFImageCapture::imageSettings(), qt_find_best_resolution_match(), and qt_unique_device_formats().

+ Here is the caller graph for this function:

◆ qt_find_best_framerate_match()

AVCaptureDeviceFormat * qt_find_best_framerate_match ( AVCaptureDevice *  captureDevice,
FourCharCode  filter,
Float64  fps 
)

Definition at line 301 of file avfcamerautility.mm.

References QList< T >::begin(), QList< T >::end(), epsilon, QList< T >::erase(), Float64, i, match(), Q_ASSERT, qAbs(), qt_unique_device_formats(), and QList< T >::size().

Referenced by avfVideoSettings().

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

◆ qt_find_best_resolution_match()

AVCaptureDeviceFormat * qt_find_best_resolution_match ( AVCaptureDevice *  captureDevice,
const QSize request,
FourCharCode  filter,
bool  stillImage 
)

Definition at line 234 of file avfcamerautility.mm.

References area(), QList< T >::first(), i, QSize::isNull(), QSize::isValid(), next, Q_ASSERT, qAbs(), qt_device_format_high_resolution(), qt_device_format_resolution(), qt_unique_device_formats(), request, QList< T >::reserve(), and QList< T >::size().

Referenced by AVFImageCapture::applySettings(), and avfVideoSettings().

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

◆ qt_find_supported_framerate_range()

AVFrameRateRange * qt_find_supported_framerate_range ( AVCaptureDeviceFormat *  format,
Float64  fps 
)

Definition at line 346 of file avfcamerautility.mm.

References e, epsilon, Float64, i, match(), Q_ASSERT, and qAbs().

Referenced by qt_set_framerate_limits().

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

◆ qt_format_supports_framerate()

bool qt_format_supports_framerate ( AVCaptureDeviceFormat *  format,
qreal  fps 
)

Definition at line 378 of file avfcamerautility.mm.

References epsilon.

Referenced by avfVideoSettings().

+ Here is the caller graph for this function:

◆ qt_formats_are_equal()

bool qt_formats_are_equal ( AVCaptureDeviceFormat *  f1,
AVCaptureDeviceFormat *  f2 
)

Definition at line 391 of file avfcamerautility.mm.

Referenced by qt_set_active_format().

+ Here is the caller graph for this function:

◆ qt_set_active_format()

bool qt_set_active_format ( AVCaptureDevice *  captureDevice,
AVCaptureDeviceFormat *  format,
bool  preserveFps 
)

Definition at line 402 of file avfcamerautility.mm.

References lock, qt_current_framerates(), qt_formats_are_equal(), qt_set_framerate_limits(), and qWarning.

Referenced by AVFImageCapture::applySettings(), and avfVideoSettings().

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

◆ qt_set_framerate_limits() [1/3]

void qt_set_framerate_limits ( AVCaptureConnection *  videoConnection,
qreal  minFPS,
qreal  maxFPS 
)

Definition at line 441 of file avfcamerautility.mm.

References Q_ASSERT, Q_FUNC_INFO, and qCDebug.

Referenced by avfVideoSettings(), qt_set_active_format(), and qt_set_framerate_limits().

+ Here is the caller graph for this function:

◆ qt_set_framerate_limits() [2/3]

void qt_set_framerate_limits ( AVCaptureDevice *  captureDevice,
AVCaptureConnection *  videoConnection,
qreal  minFPS,
qreal  maxFPS 
)

Definition at line 552 of file avfcamerautility.mm.

References Q_ASSERT, Q_UNUSED, and qt_set_framerate_limits().

+ Here is the call graph for this function:

◆ qt_set_framerate_limits() [3/3]

void qt_set_framerate_limits ( AVCaptureDevice *  captureDevice,
qreal  minFPS,
qreal  maxFPS 
)

Definition at line 491 of file avfcamerautility.mm.

References lock, Q_ASSERT, Q_FUNC_INFO, qCDebug, qt_adjusted_frame_duration(), and qt_find_supported_framerate_range().

+ Here is the call graph for this function:

◆ qt_supported_bit_rates_for_format()

QList< AudioValueRange > qt_supported_bit_rates_for_format ( int  codecId)

Definition at line 612 of file avfcamerautility.mm.

References codecId(), and i.

Referenced by avfAudioSettings().

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

◆ qt_supported_channel_counts_for_format()

std::optional< QList< UInt32 > > qt_supported_channel_counts_for_format ( int  codecId)

Definition at line 643 of file avfcamerautility.mm.

References codecId(), and i.

Referenced by avfAudioSettings().

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

◆ qt_supported_channel_layout_tags_for_format()

QList< UInt32 > qt_supported_channel_layout_tags_for_format ( int  codecId,
int  noChannels 
)

Definition at line 680 of file avfcamerautility.mm.

References codecId(), and i.

Referenced by avfAudioSettings().

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

◆ qt_supported_sample_rates_for_format()

QList< AudioValueRange > qt_supported_sample_rates_for_format ( int  codecId)

Definition at line 581 of file avfcamerautility.mm.

References codecId(), and i.

Referenced by avfAudioSettings().

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

◆ qt_unique_device_formats()

QVector< AVCaptureDeviceFormat * > qt_unique_device_formats ( AVCaptureDevice *  captureDevice,
FourCharCode  filter 
)

Definition at line 127 of file avfcamerautility.mm.

References codec, i, QSize::isNull(), QSize::isValid(), Q_ASSERT, and qt_device_format_resolution().

Referenced by qt_find_best_framerate_match(), and qt_find_best_resolution_match().

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