Merge remote-tracking branch 'origin/5.4' into dev
Change-Id: Ie44084828edf50050c695ac4dcc1cb532651499c
This commit is contained in:
@@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
static jclass g_qtCameraListenerClass = 0;
|
static const char QtCameraListenerClassName[] = "org/qtproject/qt5/android/multimedia/QtCameraListener";
|
||||||
static QMutex g_cameraMapMutex;
|
static QMutex g_cameraMapMutex;
|
||||||
typedef QMap<int, AndroidCamera *> CameraMap;
|
typedef QMap<int, AndroidCamera *> CameraMap;
|
||||||
Q_GLOBAL_STATIC(CameraMap, g_cameraMap)
|
Q_GLOBAL_STATIC(CameraMap, g_cameraMap)
|
||||||
@@ -720,7 +720,7 @@ bool AndroidCameraPrivate::init(int cameraId)
|
|||||||
if (exceptionCheckAndClear(env) || !m_camera.isValid())
|
if (exceptionCheckAndClear(env) || !m_camera.isValid())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_cameraListener = QJNIObjectPrivate(g_qtCameraListenerClass, "(I)V", m_cameraId);
|
m_cameraListener = QJNIObjectPrivate(QtCameraListenerClassName, "(I)V", m_cameraId);
|
||||||
m_info = QJNIObjectPrivate("android/hardware/Camera$CameraInfo");
|
m_info = QJNIObjectPrivate("android/hardware/Camera$CameraInfo");
|
||||||
m_camera.callStaticMethod<void>("android/hardware/Camera",
|
m_camera.callStaticMethod<void>("android/hardware/Camera",
|
||||||
"getCameraInfo",
|
"getCameraInfo",
|
||||||
@@ -1392,24 +1392,22 @@ QStringList AndroidCameraPrivate::callParametersStringListMethod(const QByteArra
|
|||||||
return stringList;
|
return stringList;
|
||||||
}
|
}
|
||||||
|
|
||||||
static JNINativeMethod methods[] = {
|
|
||||||
{"notifyAutoFocusComplete", "(IZ)V", (void *)notifyAutoFocusComplete},
|
|
||||||
{"notifyPictureExposed", "(I)V", (void *)notifyPictureExposed},
|
|
||||||
{"notifyPictureCaptured", "(I[B)V", (void *)notifyPictureCaptured},
|
|
||||||
{"notifyFrameFetched", "(I[B)V", (void *)notifyFrameFetched}
|
|
||||||
};
|
|
||||||
|
|
||||||
bool AndroidCamera::initJNI(JNIEnv *env)
|
bool AndroidCamera::initJNI(JNIEnv *env)
|
||||||
{
|
{
|
||||||
jclass clazz = env->FindClass("org/qtproject/qt5/android/multimedia/QtCameraListener");
|
jclass clazz = QJNIEnvironmentPrivate::findClass(QtCameraListenerClassName,
|
||||||
|
env);
|
||||||
|
|
||||||
if (!exceptionCheckAndClear(env) && clazz) {
|
static const JNINativeMethod methods[] = {
|
||||||
g_qtCameraListenerClass = static_cast<jclass>(env->NewGlobalRef(clazz));
|
{"notifyAutoFocusComplete", "(IZ)V", (void *)notifyAutoFocusComplete},
|
||||||
if (env->RegisterNatives(g_qtCameraListenerClass,
|
{"notifyPictureExposed", "(I)V", (void *)notifyPictureExposed},
|
||||||
methods,
|
{"notifyPictureCaptured", "(I[B)V", (void *)notifyPictureCaptured},
|
||||||
sizeof(methods) / sizeof(methods[0])) < 0) {
|
{"notifyFrameFetched", "(I[B)V", (void *)notifyFrameFetched}
|
||||||
return false;
|
};
|
||||||
}
|
|
||||||
|
if (clazz && env->RegisterNatives(clazz,
|
||||||
|
methods,
|
||||||
|
sizeof(methods) / sizeof(methods[0])) != JNI_OK) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
#include "androidsurfacetexture.h"
|
#include "androidsurfacetexture.h"
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
|
|
||||||
static jclass mediaPlayerClass = Q_NULLPTR;
|
static const char QtAndroidMediaPlayerClassName[] = "org/qtproject/qt5/android/multimedia/QtAndroidMediaPlayer";
|
||||||
typedef QMap<jlong, AndroidMediaPlayer *> MediaPlayerMap;
|
typedef QMap<jlong, AndroidMediaPlayer *> MediaPlayerMap;
|
||||||
Q_GLOBAL_STATIC(MediaPlayerMap, mediaPlayers)
|
Q_GLOBAL_STATIC(MediaPlayerMap, mediaPlayers)
|
||||||
|
|
||||||
@@ -50,10 +50,10 @@ AndroidMediaPlayer::AndroidMediaPlayer()
|
|||||||
{
|
{
|
||||||
|
|
||||||
const jlong id = reinterpret_cast<jlong>(this);
|
const jlong id = reinterpret_cast<jlong>(this);
|
||||||
mMediaPlayer = QJNIObjectPrivate(mediaPlayerClass,
|
mMediaPlayer = QJNIObjectPrivate(QtAndroidMediaPlayerClassName,
|
||||||
"(Landroid/app/Activity;J)V",
|
"(Landroid/app/Activity;J)V",
|
||||||
QtAndroidPrivate::activity(),
|
QtAndroidPrivate::activity(),
|
||||||
id);
|
id);
|
||||||
(*mediaPlayers)[id] = this;
|
(*mediaPlayers)[id] = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,26 +233,23 @@ static void onVideoSizeChangedNative(JNIEnv *env,
|
|||||||
|
|
||||||
bool AndroidMediaPlayer::initJNI(JNIEnv *env)
|
bool AndroidMediaPlayer::initJNI(JNIEnv *env)
|
||||||
{
|
{
|
||||||
jclass jClass = env->FindClass("org/qtproject/qt5/android/multimedia/QtAndroidMediaPlayer");
|
jclass clazz = QJNIEnvironmentPrivate::findClass(QtAndroidMediaPlayerClassName,
|
||||||
|
env);
|
||||||
|
|
||||||
if (jClass) {
|
static const JNINativeMethod methods[] = {
|
||||||
mediaPlayerClass = static_cast<jclass>(env->NewGlobalRef(jClass));
|
{"onErrorNative", "(IIJ)V", reinterpret_cast<void *>(onErrorNative)},
|
||||||
|
{"onBufferingUpdateNative", "(IJ)V", reinterpret_cast<void *>(onBufferingUpdateNative)},
|
||||||
|
{"onProgressUpdateNative", "(IJ)V", reinterpret_cast<void *>(onProgressUpdateNative)},
|
||||||
|
{"onDurationChangedNative", "(IJ)V", reinterpret_cast<void *>(onDurationChangedNative)},
|
||||||
|
{"onInfoNative", "(IIJ)V", reinterpret_cast<void *>(onInfoNative)},
|
||||||
|
{"onVideoSizeChangedNative", "(IIJ)V", reinterpret_cast<void *>(onVideoSizeChangedNative)},
|
||||||
|
{"onStateChangedNative", "(IJ)V", reinterpret_cast<void *>(onStateChangedNative)}
|
||||||
|
};
|
||||||
|
|
||||||
JNINativeMethod methods[] = {
|
if (clazz && env->RegisterNatives(clazz,
|
||||||
{"onErrorNative", "(IIJ)V", reinterpret_cast<void *>(onErrorNative)},
|
methods,
|
||||||
{"onBufferingUpdateNative", "(IJ)V", reinterpret_cast<void *>(onBufferingUpdateNative)},
|
sizeof(methods) / sizeof(methods[0])) != JNI_OK) {
|
||||||
{"onProgressUpdateNative", "(IJ)V", reinterpret_cast<void *>(onProgressUpdateNative)},
|
|
||||||
{"onDurationChangedNative", "(IJ)V", reinterpret_cast<void *>(onDurationChangedNative)},
|
|
||||||
{"onInfoNative", "(IIJ)V", reinterpret_cast<void *>(onInfoNative)},
|
|
||||||
{"onVideoSizeChangedNative", "(IIJ)V", reinterpret_cast<void *>(onVideoSizeChangedNative)},
|
|
||||||
{"onStateChangedNative", "(IJ)V", reinterpret_cast<void *>(onStateChangedNative)}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (env->RegisterNatives(mediaPlayerClass,
|
|
||||||
methods,
|
|
||||||
sizeof(methods) / sizeof(methods[0])) < 0) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ AndroidCamcorderProfile::AndroidCamcorderProfile(const QJNIObjectPrivate &camcor
|
|||||||
m_camcorderProfile = camcorderProfile;
|
m_camcorderProfile = camcorderProfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
static jclass g_qtMediaRecorderListenerClass = 0;
|
static const char QtMediaRecorderListenerClassName[] = "org/qtproject/qt5/android/multimedia/QtMediaRecorderListener";
|
||||||
typedef QMap<jlong, AndroidMediaRecorder*> MediaRecorderMap;
|
typedef QMap<jlong, AndroidMediaRecorder*> MediaRecorderMap;
|
||||||
Q_GLOBAL_STATIC(MediaRecorderMap, mediaRecorders)
|
Q_GLOBAL_STATIC(MediaRecorderMap, mediaRecorders)
|
||||||
|
|
||||||
@@ -137,7 +137,7 @@ AndroidMediaRecorder::AndroidMediaRecorder()
|
|||||||
{
|
{
|
||||||
m_mediaRecorder = QJNIObjectPrivate("android/media/MediaRecorder");
|
m_mediaRecorder = QJNIObjectPrivate("android/media/MediaRecorder");
|
||||||
if (m_mediaRecorder.isValid()) {
|
if (m_mediaRecorder.isValid()) {
|
||||||
QJNIObjectPrivate listener(g_qtMediaRecorderListenerClass, "(J)V", m_id);
|
QJNIObjectPrivate listener(QtMediaRecorderListenerClassName, "(J)V", m_id);
|
||||||
m_mediaRecorder.callMethod<void>("setOnErrorListener",
|
m_mediaRecorder.callMethod<void>("setOnErrorListener",
|
||||||
"(Landroid/media/MediaRecorder$OnErrorListener;)V",
|
"(Landroid/media/MediaRecorder$OnErrorListener;)V",
|
||||||
listener.object());
|
listener.object());
|
||||||
@@ -339,24 +339,20 @@ void AndroidMediaRecorder::setOutputFile(const QString &path)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static JNINativeMethod methods[] = {
|
|
||||||
{"notifyError", "(JII)V", (void *)notifyError},
|
|
||||||
{"notifyInfo", "(JII)V", (void *)notifyInfo}
|
|
||||||
};
|
|
||||||
|
|
||||||
bool AndroidMediaRecorder::initJNI(JNIEnv *env)
|
bool AndroidMediaRecorder::initJNI(JNIEnv *env)
|
||||||
{
|
{
|
||||||
jclass clazz = env->FindClass("org/qtproject/qt5/android/multimedia/QtMediaRecorderListener");
|
jclass clazz = QJNIEnvironmentPrivate::findClass(QtMediaRecorderListenerClassName,
|
||||||
if (env->ExceptionCheck())
|
env);
|
||||||
env->ExceptionClear();
|
|
||||||
|
|
||||||
if (clazz) {
|
static const JNINativeMethod methods[] = {
|
||||||
g_qtMediaRecorderListenerClass = static_cast<jclass>(env->NewGlobalRef(clazz));
|
{"notifyError", "(JII)V", (void *)notifyError},
|
||||||
if (env->RegisterNatives(g_qtMediaRecorderListenerClass,
|
{"notifyInfo", "(JII)V", (void *)notifyInfo}
|
||||||
methods,
|
};
|
||||||
sizeof(methods) / sizeof(methods[0])) < 0) {
|
|
||||||
|
if (clazz && env->RegisterNatives(clazz,
|
||||||
|
methods,
|
||||||
|
sizeof(methods) / sizeof(methods[0])) != JNI_OK) {
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
static jclass g_qtSurfaceTextureListenerClass = 0;
|
static const char QtSurfaceTextureListenerClassName[] = "org/qtproject/qt5/android/multimedia/QtSurfaceTextureListener";
|
||||||
static QMap<int, AndroidSurfaceTexture*> g_objectMap;
|
static QMap<int, AndroidSurfaceTexture*> g_objectMap;
|
||||||
|
|
||||||
// native method for QtSurfaceTexture.java
|
// native method for QtSurfaceTexture.java
|
||||||
@@ -70,7 +70,7 @@ AndroidSurfaceTexture::AndroidSurfaceTexture(unsigned int texName)
|
|||||||
if (m_surfaceTexture.isValid())
|
if (m_surfaceTexture.isValid())
|
||||||
g_objectMap.insert(int(texName), this);
|
g_objectMap.insert(int(texName), this);
|
||||||
|
|
||||||
QJNIObjectPrivate listener(g_qtSurfaceTextureListenerClass, "(I)V", jint(texName));
|
QJNIObjectPrivate listener(QtSurfaceTextureListenerClassName, "(I)V", jint(texName));
|
||||||
m_surfaceTexture.callMethod<void>("setOnFrameAvailableListener",
|
m_surfaceTexture.callMethod<void>("setOnFrameAvailableListener",
|
||||||
"(Landroid/graphics/SurfaceTexture$OnFrameAvailableListener;)V",
|
"(Landroid/graphics/SurfaceTexture$OnFrameAvailableListener;)V",
|
||||||
listener.object());
|
listener.object());
|
||||||
@@ -144,27 +144,23 @@ jobject AndroidSurfaceTexture::surfaceHolder()
|
|||||||
return m_surfaceHolder.object();
|
return m_surfaceHolder.object();
|
||||||
}
|
}
|
||||||
|
|
||||||
static JNINativeMethod methods[] = {
|
|
||||||
{"notifyFrameAvailable", "(I)V", (void *)notifyFrameAvailable}
|
|
||||||
};
|
|
||||||
|
|
||||||
bool AndroidSurfaceTexture::initJNI(JNIEnv *env)
|
bool AndroidSurfaceTexture::initJNI(JNIEnv *env)
|
||||||
{
|
{
|
||||||
// SurfaceTexture is available since API 11.
|
// SurfaceTexture is available since API 11.
|
||||||
if (QtAndroidPrivate::androidSdkVersion() < 11)
|
if (QtAndroidPrivate::androidSdkVersion() < 11)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
jclass clazz = env->FindClass("org/qtproject/qt5/android/multimedia/QtSurfaceTextureListener");
|
jclass clazz = QJNIEnvironmentPrivate::findClass(QtSurfaceTextureListenerClassName,
|
||||||
if (env->ExceptionCheck())
|
env);
|
||||||
env->ExceptionClear();
|
|
||||||
|
|
||||||
if (clazz) {
|
static const JNINativeMethod methods[] = {
|
||||||
g_qtSurfaceTextureListenerClass = static_cast<jclass>(env->NewGlobalRef(clazz));
|
{"notifyFrameAvailable", "(I)V", (void *)notifyFrameAvailable}
|
||||||
if (env->RegisterNatives(g_qtSurfaceTextureListenerClass,
|
};
|
||||||
methods,
|
|
||||||
sizeof(methods) / sizeof(methods[0])) < 0) {
|
if (clazz && env->RegisterNatives(clazz,
|
||||||
return false;
|
methods,
|
||||||
}
|
sizeof(methods) / sizeof(methods[0])) != JNI_OK) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ void MmRendererPlayerVideoRendererControl::setSurface(QAbstractVideoSurface *sur
|
|||||||
m_surface = QPointer<QAbstractVideoSurface>(surface);
|
m_surface = QPointer<QAbstractVideoSurface>(surface);
|
||||||
if (QOpenGLContext::currentContext())
|
if (QOpenGLContext::currentContext())
|
||||||
m_windowGrabber->checkForEglImageExtension();
|
m_windowGrabber->checkForEglImageExtension();
|
||||||
else
|
else if (m_surface)
|
||||||
m_surface->setProperty("_q_GLThreadCallback", QVariant::fromValue<QObject*>(this));
|
m_surface->setProperty("_q_GLThreadCallback", QVariant::fromValue<QObject*>(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -242,14 +242,19 @@ void MFPlayerSession::handleSourceError(long hr)
|
|||||||
|
|
||||||
void MFPlayerSession::handleMediaSourceReady()
|
void MFPlayerSession::handleMediaSourceReady()
|
||||||
{
|
{
|
||||||
if (QMediaPlayer::LoadingMedia != m_status || !m_sourceResolver)
|
if (QMediaPlayer::LoadingMedia != m_status || !m_sourceResolver || m_sourceResolver != sender())
|
||||||
return;
|
return;
|
||||||
#ifdef DEBUG_MEDIAFOUNDATION
|
#ifdef DEBUG_MEDIAFOUNDATION
|
||||||
qDebug() << "handleMediaSourceReady";
|
qDebug() << "handleMediaSourceReady";
|
||||||
#endif
|
#endif
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
IMFPresentationDescriptor* sourcePD;
|
|
||||||
IMFMediaSource* mediaSource = m_sourceResolver->mediaSource();
|
IMFMediaSource* mediaSource = m_sourceResolver->mediaSource();
|
||||||
|
|
||||||
|
DWORD dwCharacteristics = 0;
|
||||||
|
mediaSource->GetCharacteristics(&dwCharacteristics);
|
||||||
|
emit seekableUpdate(MFMEDIASOURCE_CAN_SEEK & dwCharacteristics);
|
||||||
|
|
||||||
|
IMFPresentationDescriptor* sourcePD;
|
||||||
hr = mediaSource->CreatePresentationDescriptor(&sourcePD);
|
hr = mediaSource->CreatePresentationDescriptor(&sourcePD);
|
||||||
if (SUCCEEDED(hr)) {
|
if (SUCCEEDED(hr)) {
|
||||||
m_duration = 0;
|
m_duration = 0;
|
||||||
@@ -1630,10 +1635,6 @@ void MFPlayerSession::handleSessionEvent(IMFMediaEvent *sessionEvent)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD dwCharacteristics = 0;
|
|
||||||
m_sourceResolver->mediaSource()->GetCharacteristics(&dwCharacteristics);
|
|
||||||
emit seekableUpdate(MFMEDIASOURCE_CAN_SEEK & dwCharacteristics);
|
|
||||||
|
|
||||||
// Topology is resolved and successfuly set, this happens only after loading a new media.
|
// Topology is resolved and successfuly set, this happens only after loading a new media.
|
||||||
// Make sure we always start the media from the beginning
|
// Make sure we always start the media from the beginning
|
||||||
m_varStart.vt = VT_I8;
|
m_varStart.vt = VT_I8;
|
||||||
|
|||||||
Reference in New Issue
Block a user