4#include <QtMultimedia/private/qplatformmediaplugin_p.h>
20#include <VideoToolbox/VideoToolbox.h>
30#elif defined(Q_OS_WINDOWS)
44# include <libavutil/log.h>
45# include <libavcodec/jni.h>
49#if QT_CONFIG(linux_v4l)
54#if QT_CONFIG(cpp_winrt)
63#if QT_CONFIG(pipewire)
85 if (
name == u
"ffmpeg")
100 return av_log_default_callback(
ptr,
level,
fmt, vl);
103 if (level < 0 || level > av_log_get_level())
110 if (
level == AV_LOG_DEBUG ||
level == AV_LOG_TRACE)
112 else if (
level == AV_LOG_VERBOSE ||
level == AV_LOG_INFO)
114 else if (
level == AV_LOG_WARNING)
116 else if (
level == AV_LOG_ERROR ||
level == AV_LOG_FATAL ||
level == AV_LOG_PANIC)
123 av_log_set_level(AV_LOG_DEBUG);
132 if (backend == u
"grabwindow")
136 if (backend == u
"eglfs")
141 if (backend == u
"x11")
143#elif defined(Q_OS_WINDOWS)
144 if (backend == u
"dxgi")
146#elif defined(Q_OS_MACOS)
147 if (backend == u
"avf")
155 if (backend == u
"grabwindow")
159 if (backend == u
"x11")
161#elif defined(Q_OS_WINDOWS)
162 if (backend == u
"gdi")
164#if QT_CONFIG(cpp_winrt)
165 if (backend == u
"uwp")
168#elif defined(Q_OS_MACOS)
169 if (backend == u
"cg")
181 qDebug() <<
"Available HW decoding frameworks:";
183 qDebug() <<
" " << av_hwdevice_get_type_name(
type);
185 qDebug() <<
"Available HW encoding frameworks:";
187 qDebug() <<
" " << av_hwdevice_get_type_name(
type);
196QMaybe<std::unique_ptr<QPlatformAudioResampler>>
200 return { std::make_unique<QFFmpegResampler>(inputFormat, outputFormat) };
217#elif defined(Q_OS_ANDROID)
219#elif QT_CONFIG(linux_v4l)
221#elif defined(Q_OS_WINDOWS)
231 static const QString screenCaptureBackend =
qgetenv(
"QT_SCREEN_CAPTURE_BACKEND").toLower();
233 if (!screenCaptureBackend.isEmpty()) {
235 return screenCapture;
237 qWarning() <<
"Not supported QT_SCREEN_CAPTURE_BACKEND:" << screenCaptureBackend;
245#if QT_CONFIG(pipewire)
255#if defined(Q_OS_WINDOWS)
257#elif defined(Q_OS_MACOS)
266 static const QString windowCaptureBackend =
qgetenv(
"QT_WINDOW_CAPTURE_BACKEND").toLower();
268 if (!windowCaptureBackend.isEmpty()) {
270 return windowCapture;
272 qWarning() <<
"Not supported QT_WINDOW_CAPTURE_BACKEND:" << windowCaptureBackend;
280#if defined(Q_OS_WINDOWS)
281# if QT_CONFIG(cpp_winrt)
287#elif defined(Q_OS_MACOS)
301#if defined(Q_OS_ANDROID)
331#if defined(Q_OS_ANDROID)
333#elif QT_CONFIG(linux_v4l)
335#elif defined Q_OS_DARWIN
337#elif defined(Q_OS_WINDOWS)
349#elif defined Q_OS_MACOS
351#elif defined(Q_OS_WINDOWS)
361 static bool initialized =
false;
363 return JNI_VERSION_1_6;
368 if (vm->GetEnv(&environment, JNI_VERSION_1_6))
372 if (av_jni_set_java_vm(vm,
nullptr))
378 return JNI_VERSION_1_6;
384#include "qffmpegmediaintegration.moc"
static bool registerNativeMethods()
The QAudioDecoder class implements decoding audio.
The QCamera class provides interface for system camera devices.
static bool isSupported()
static bool isSupported()
static const std::vector< AVHWDeviceType > & decodingDeviceTypes()
static const std::vector< AVHWDeviceType > & encodingDeviceTypes()
static bool isSupported()
\macro QT_RESTRICTED_CAST_FROM_ASCII
static QString vasprintf(const char *format, va_list ap) Q_ATTRIBUTE_FORMAT_PRINTF(1
The QVideoFrame class represents a frame of video data.
The QVideoSink class represents a generic sink for video data.
static bool isSupported()
Combined button and popup list for selecting options.
QVideoFrame convertFrame(QVideoFrame &src, const QVideoFrameFormat &dstFormat)
QT_END_NAMESPACE JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved)
static ControlElement< T > * ptr(QWidget *widget)
GLenum GLuint GLint level
GLuint GLsizei const GLchar * message
GLsizei GLenum GLboolean sink
GLenum GLenum GLenum input
#define QStringLiteral(str)
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
Q_CORE_EXPORT bool qEnvironmentVariableIsSet(const char *varName) noexcept
QVideoFrameFormat::PixelFormat fmt