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)
81 if (
name == u
"ffmpeg")
96 return av_log_default_callback(
ptr,
level,
fmt, vl);
99 if (level < 0 || level > av_log_get_level())
106 if (
level == AV_LOG_DEBUG ||
level == AV_LOG_TRACE)
108 else if (
level == AV_LOG_VERBOSE ||
level == AV_LOG_INFO)
110 else if (
level == AV_LOG_WARNING)
112 else if (
level == AV_LOG_ERROR ||
level == AV_LOG_FATAL ||
level == AV_LOG_PANIC)
119 av_log_set_level(AV_LOG_DEBUG);
128 if (backend == u
"grabwindow")
132 if (backend == u
"eglfs")
137 if (backend == u
"x11")
139#elif defined(Q_OS_WINDOWS)
140 if (backend == u
"dxgi")
142#elif defined(Q_OS_MACOS)
143 if (backend == u
"avf")
151 if (backend == u
"grabwindow")
155 if (backend == u
"x11")
157#elif defined(Q_OS_WINDOWS)
158 if (backend == u
"gdi")
160#if QT_CONFIG(cpp_winrt)
161 if (backend == u
"uwp")
164#elif defined(Q_OS_MACOS)
165 if (backend == u
"cg")
177 qDebug() <<
"Available HW decoding frameworks:";
179 qDebug() <<
" " << av_hwdevice_get_type_name(
type);
181 qDebug() <<
"Available HW encoding frameworks:";
183 qDebug() <<
" " << av_hwdevice_get_type_name(
type);
192QMaybe<std::unique_ptr<QPlatformAudioResampler>>
196 return { std::make_unique<QFFmpegResampler>(inputFormat, outputFormat) };
213#elif defined(Q_OS_ANDROID)
215#elif QT_CONFIG(linux_v4l)
217#elif defined(Q_OS_WINDOWS)
227 static const QString screenCaptureBackend =
qgetenv(
"QT_SCREEN_CAPTURE_BACKEND").toLower();
229 if (!screenCaptureBackend.isEmpty()) {
231 return screenCapture;
233 qWarning() <<
"Not supported QT_SCREEN_CAPTURE_BACKEND:" << screenCaptureBackend;
246#if defined(Q_OS_WINDOWS)
248#elif defined(Q_OS_MACOS)
257 static const QString windowCaptureBackend =
qgetenv(
"QT_WINDOW_CAPTURE_BACKEND").toLower();
259 if (!windowCaptureBackend.isEmpty()) {
261 return windowCapture;
263 qWarning() <<
"Not supported QT_WINDOW_CAPTURE_BACKEND:" << windowCaptureBackend;
271#if defined(Q_OS_WINDOWS)
272# if QT_CONFIG(cpp_winrt)
278#elif defined(Q_OS_MACOS)
292#if defined(Q_OS_ANDROID)
322#if defined(Q_OS_ANDROID)
324#elif QT_CONFIG(linux_v4l)
326#elif defined Q_OS_DARWIN
328#elif defined(Q_OS_WINDOWS)
340#elif defined Q_OS_MACOS
342#elif defined(Q_OS_WINDOWS)
352 static bool initialized =
false;
354 return JNI_VERSION_1_6;
359 if (vm->GetEnv(&environment, JNI_VERSION_1_6))
363 if (av_jni_set_java_vm(vm,
nullptr))
369 return JNI_VERSION_1_6;
375#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()
\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