diff --git a/examples/multimediawidgets/camera/camera.cpp b/examples/multimediawidgets/camera/camera.cpp index 9c1f2902..2b7a96f8 100644 --- a/examples/multimediawidgets/camera/camera.cpp +++ b/examples/multimediawidgets/camera/camera.cpp @@ -136,6 +136,8 @@ void Camera::setCamera(const QByteArray &cameraDevice) connect(imageCapture, SIGNAL(readyForCaptureChanged(bool)), this, SLOT(readyForCapture(bool))); connect(imageCapture, SIGNAL(imageCaptured(int,QImage)), this, SLOT(processCapturedImage(int,QImage))); connect(imageCapture, SIGNAL(imageSaved(int,QString)), this, SLOT(imageSaved(int,QString))); + connect(imageCapture, SIGNAL(error(int,QCameraImageCapture::Error,QString)), this, + SLOT(displayCaptureError(int,QCameraImageCapture::Error,QString))); connect(camera, SIGNAL(lockStatusChanged(QCamera::LockStatus, QCamera::LockChangeReason)), this, SLOT(updateLockStatus(QCamera::LockStatus, QCamera::LockChangeReason))); @@ -320,6 +322,14 @@ void Camera::takeImage() imageCapture->capture(); } +void Camera::displayCaptureError(int id, const QCameraImageCapture::Error error, const QString &errorString) +{ + Q_UNUSED(id); + Q_UNUSED(error); + QMessageBox::warning(this, tr("Image Capture Error"), errorString); + isCapturingImage = false; +} + void Camera::startCamera() { camera->start(); diff --git a/examples/multimediawidgets/camera/camera.h b/examples/multimediawidgets/camera/camera.h index 9203216b..52f03cbd 100644 --- a/examples/multimediawidgets/camera/camera.h +++ b/examples/multimediawidgets/camera/camera.h @@ -72,6 +72,7 @@ private slots: void toggleLock(); void takeImage(); + void displayCaptureError(int, QCameraImageCapture::Error, const QString &errorString); void configureCaptureSettings(); void configureVideoSettings(); diff --git a/examples/multimediawidgets/camera/camera.ui b/examples/multimediawidgets/camera/camera.ui index ea790fab..8a5ee519 100644 --- a/examples/multimediawidgets/camera/camera.ui +++ b/examples/multimediawidgets/camera/camera.ui @@ -138,6 +138,9 @@ + + false + Capture Photo @@ -245,7 +248,7 @@ 0 0 668 - 29 + 25 diff --git a/src/imports/audioengine/qaudioengine_openal_p.h b/src/imports/audioengine/qaudioengine_openal_p.h index 31f6d415..98eab67b 100644 --- a/src/imports/audioengine/qaudioengine_openal_p.h +++ b/src/imports/audioengine/qaudioengine_openal_p.h @@ -58,8 +58,6 @@ #include "qsoundsource_p.h" #include "qsoundbuffer_p.h" -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QSoundBufferPrivateAL : public QSoundBuffer @@ -168,6 +166,4 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif diff --git a/src/imports/audioengine/qaudioengine_p.h b/src/imports/audioengine/qaudioengine_p.h index efbe5766..7293807c 100644 --- a/src/imports/audioengine/qaudioengine_p.h +++ b/src/imports/audioengine/qaudioengine_p.h @@ -47,8 +47,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QSoundSource; @@ -105,6 +103,4 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif diff --git a/src/imports/audioengine/qdeclarative_attenuationmodel_p.h b/src/imports/audioengine/qdeclarative_attenuationmodel_p.h index 341fbc23..8041e79e 100644 --- a/src/imports/audioengine/qdeclarative_attenuationmodel_p.h +++ b/src/imports/audioengine/qdeclarative_attenuationmodel_p.h @@ -46,8 +46,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QDeclarativeAttenuationModel : public QObject, public QQmlParserStatus @@ -133,6 +131,4 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif diff --git a/src/imports/audioengine/qdeclarative_audiocategory_p.h b/src/imports/audioengine/qdeclarative_audiocategory_p.h index 84641769..72e3aff7 100644 --- a/src/imports/audioengine/qdeclarative_audiocategory_p.h +++ b/src/imports/audioengine/qdeclarative_audiocategory_p.h @@ -45,8 +45,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QDeclarativeAudioCategory : public QObject, public QQmlParserStatus @@ -89,6 +87,4 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif diff --git a/src/imports/audioengine/qdeclarative_audioengine_p.h b/src/imports/audioengine/qdeclarative_audioengine_p.h index d6e7dc79..a9f1e236 100644 --- a/src/imports/audioengine/qdeclarative_audioengine_p.h +++ b/src/imports/audioengine/qdeclarative_audioengine_p.h @@ -50,8 +50,6 @@ #include #include "qaudioengine_p.h" -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QDeclarativeSoundInstance; @@ -163,6 +161,4 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif diff --git a/src/imports/audioengine/qdeclarative_audiolistener_p.h b/src/imports/audioengine/qdeclarative_audiolistener_p.h index 8bd1ae71..d4f65c28 100644 --- a/src/imports/audioengine/qdeclarative_audiolistener_p.h +++ b/src/imports/audioengine/qdeclarative_audiolistener_p.h @@ -45,8 +45,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QDeclarativeAudioEngine; @@ -97,6 +95,4 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif diff --git a/src/imports/audioengine/qdeclarative_audiosample_p.h b/src/imports/audioengine/qdeclarative_audiosample_p.h index 586fce74..27579a72 100644 --- a/src/imports/audioengine/qdeclarative_audiosample_p.h +++ b/src/imports/audioengine/qdeclarative_audiosample_p.h @@ -45,8 +45,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QSoundBuffer; @@ -106,6 +104,4 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif diff --git a/src/imports/audioengine/qdeclarative_playvariation_p.h b/src/imports/audioengine/qdeclarative_playvariation_p.h index 6dbdac9c..a23492c2 100644 --- a/src/imports/audioengine/qdeclarative_playvariation_p.h +++ b/src/imports/audioengine/qdeclarative_playvariation_p.h @@ -45,8 +45,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QDeclarativeAudioSample; @@ -106,6 +104,4 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif diff --git a/src/imports/audioengine/qdeclarative_sound_p.h b/src/imports/audioengine/qdeclarative_sound_p.h index e0fc8167..fd164f43 100644 --- a/src/imports/audioengine/qdeclarative_sound_p.h +++ b/src/imports/audioengine/qdeclarative_sound_p.h @@ -47,8 +47,6 @@ #include #include "qdeclarative_playvariation_p.h" -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QDeclarativeAudioCategory; @@ -171,6 +169,4 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif diff --git a/src/imports/audioengine/qdeclarative_soundinstance_p.h b/src/imports/audioengine/qdeclarative_soundinstance_p.h index 4b194966..375cc1c9 100644 --- a/src/imports/audioengine/qdeclarative_soundinstance_p.h +++ b/src/imports/audioengine/qdeclarative_soundinstance_p.h @@ -46,8 +46,6 @@ #include #include "qsoundinstance_p.h" -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QDeclarativeSound; @@ -150,6 +148,4 @@ private Q_SLOTS: QT_END_NAMESPACE -QT_END_HEADER - #endif diff --git a/src/imports/audioengine/qsoundbuffer_p.h b/src/imports/audioengine/qsoundbuffer_p.h index 5d23a600..4ef255ba 100644 --- a/src/imports/audioengine/qsoundbuffer_p.h +++ b/src/imports/audioengine/qsoundbuffer_p.h @@ -44,8 +44,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QSoundBuffer : public QObject @@ -65,6 +63,4 @@ protected: QT_END_NAMESPACE -QT_END_HEADER - #endif // QSOUNDBUFFER_P_H diff --git a/src/imports/audioengine/qsoundinstance_p.h b/src/imports/audioengine/qsoundinstance_p.h index 9099f513..7ba220d2 100644 --- a/src/imports/audioengine/qsoundinstance_p.h +++ b/src/imports/audioengine/qsoundinstance_p.h @@ -46,8 +46,6 @@ #include #include "qsoundsource_p.h" -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QDeclarativeSound; @@ -134,6 +132,4 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif // QSOUNDINSTANCE_P_H diff --git a/src/imports/audioengine/qsoundsource_p.h b/src/imports/audioengine/qsoundsource_p.h index 5b8bb58f..1e0db6da 100644 --- a/src/imports/audioengine/qsoundsource_p.h +++ b/src/imports/audioengine/qsoundsource_p.h @@ -45,8 +45,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QSoundBuffer; @@ -93,6 +91,4 @@ protected: QT_END_NAMESPACE -QT_END_HEADER - #endif diff --git a/src/imports/multimedia/qdeclarativeaudio_p.h b/src/imports/multimedia/qdeclarativeaudio_p.h index 79228d70..b8a75c65 100644 --- a/src/imports/multimedia/qdeclarativeaudio_p.h +++ b/src/imports/multimedia/qdeclarativeaudio_p.h @@ -59,8 +59,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QTimerEvent; @@ -271,6 +269,4 @@ QT_END_NAMESPACE QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeAudio)) -QT_END_HEADER - #endif diff --git a/src/imports/multimedia/qdeclarativecamera_p.h b/src/imports/multimedia/qdeclarativecamera_p.h index c96ba3f9..8638c423 100644 --- a/src/imports/multimedia/qdeclarativecamera_p.h +++ b/src/imports/multimedia/qdeclarativecamera_p.h @@ -65,8 +65,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QDeclarativeCameraExposure; @@ -312,6 +310,4 @@ QT_END_NAMESPACE QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeCamera)) -QT_END_HEADER - #endif diff --git a/src/imports/multimedia/qdeclarativecameracapture_p.h b/src/imports/multimedia/qdeclarativecameracapture_p.h index 4ab30ee4..8bab446e 100644 --- a/src/imports/multimedia/qdeclarativecameracapture_p.h +++ b/src/imports/multimedia/qdeclarativecameracapture_p.h @@ -59,8 +59,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QDeclarativeCamera; @@ -125,6 +123,4 @@ QT_END_NAMESPACE QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeCameraCapture)) -QT_END_HEADER - #endif diff --git a/src/imports/multimedia/qdeclarativecameraexposure_p.h b/src/imports/multimedia/qdeclarativecameraexposure_p.h index e8ad8fb7..6908a965 100644 --- a/src/imports/multimedia/qdeclarativecameraexposure_p.h +++ b/src/imports/multimedia/qdeclarativecameraexposure_p.h @@ -57,8 +57,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QDeclarativeCamera; @@ -142,6 +140,4 @@ QT_END_NAMESPACE QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeCameraExposure)) -QT_END_HEADER - #endif diff --git a/src/imports/multimedia/qdeclarativecameraflash_p.h b/src/imports/multimedia/qdeclarativecameraflash_p.h index 6009d90c..e3919a41 100644 --- a/src/imports/multimedia/qdeclarativecameraflash_p.h +++ b/src/imports/multimedia/qdeclarativecameraflash_p.h @@ -56,8 +56,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QDeclarativeCamera; @@ -91,6 +89,4 @@ QT_END_NAMESPACE QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeCameraFlash)) -QT_END_HEADER - #endif diff --git a/src/imports/multimedia/qdeclarativecamerafocus_p.h b/src/imports/multimedia/qdeclarativecamerafocus_p.h index a6060e5b..3287b930 100644 --- a/src/imports/multimedia/qdeclarativecamerafocus_p.h +++ b/src/imports/multimedia/qdeclarativecamerafocus_p.h @@ -58,8 +58,6 @@ #include #include "qdeclarativecamera_p.h" -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class FocusZonesModel; @@ -131,6 +129,4 @@ QT_END_NAMESPACE QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeCameraFocus)) -QT_END_HEADER - #endif diff --git a/src/imports/multimedia/qdeclarativecameraimageprocessing_p.h b/src/imports/multimedia/qdeclarativecameraimageprocessing_p.h index 40655d5c..f5759f92 100644 --- a/src/imports/multimedia/qdeclarativecameraimageprocessing_p.h +++ b/src/imports/multimedia/qdeclarativecameraimageprocessing_p.h @@ -56,8 +56,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QDeclarativeCamera; @@ -127,6 +125,4 @@ QT_END_NAMESPACE QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeCameraImageProcessing)) -QT_END_HEADER - #endif diff --git a/src/imports/multimedia/qdeclarativecamerapreviewprovider_p.h b/src/imports/multimedia/qdeclarativecamerapreviewprovider_p.h index b0b4d53c..07a37b2b 100644 --- a/src/imports/multimedia/qdeclarativecamerapreviewprovider_p.h +++ b/src/imports/multimedia/qdeclarativecamerapreviewprovider_p.h @@ -55,8 +55,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QDeclarativeCameraPreviewProvider : public QQuickImageProvider @@ -71,6 +69,4 @@ public: QT_END_NAMESPACE -QT_END_HEADER - #endif diff --git a/src/imports/multimedia/qdeclarativecamerarecorder_p.h b/src/imports/multimedia/qdeclarativecamerarecorder_p.h index dce349ad..3a1bc11b 100644 --- a/src/imports/multimedia/qdeclarativecamerarecorder_p.h +++ b/src/imports/multimedia/qdeclarativecamerarecorder_p.h @@ -57,8 +57,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QDeclarativeCamera; @@ -227,6 +225,4 @@ QT_END_NAMESPACE QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeCameraRecorder)) -QT_END_HEADER - #endif diff --git a/src/imports/multimedia/qdeclarativemediametadata_p.h b/src/imports/multimedia/qdeclarativemediametadata_p.h index 4fa00c30..5b7c4699 100644 --- a/src/imports/multimedia/qdeclarativemediametadata_p.h +++ b/src/imports/multimedia/qdeclarativemediametadata_p.h @@ -56,8 +56,6 @@ #include #include "qmediaobject.h" -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QDeclarativeMediaMetaData : public QObject @@ -179,6 +177,4 @@ QT_END_NAMESPACE QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeMediaMetaData)) -QT_END_HEADER - #endif diff --git a/src/imports/multimedia/qdeclarativeradio_p.h b/src/imports/multimedia/qdeclarativeradio_p.h index 2f747434..b5d8fab8 100644 --- a/src/imports/multimedia/qdeclarativeradio_p.h +++ b/src/imports/multimedia/qdeclarativeradio_p.h @@ -56,8 +56,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QDeclarativeRadioData; @@ -202,6 +200,4 @@ QT_END_NAMESPACE QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeRadio)) -QT_END_HEADER - #endif // QDECLARATIVERADIO_P_H diff --git a/src/imports/multimedia/qdeclarativeradiodata_p.h b/src/imports/multimedia/qdeclarativeradiodata_p.h index 51a98672..e4d3dbfa 100644 --- a/src/imports/multimedia/qdeclarativeradiodata_p.h +++ b/src/imports/multimedia/qdeclarativeradiodata_p.h @@ -57,8 +57,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QDeclarativeRadioData : public QObject @@ -191,6 +189,4 @@ QT_END_NAMESPACE QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeRadioData)) -QT_END_HEADER - #endif // QDECLARATIVERADIODATA_P_H diff --git a/src/imports/multimedia/qdeclarativetorch_p.h b/src/imports/multimedia/qdeclarativetorch_p.h index ef9c3610..7866bad8 100644 --- a/src/imports/multimedia/qdeclarativetorch_p.h +++ b/src/imports/multimedia/qdeclarativetorch_p.h @@ -49,8 +49,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QDeclarativeTorch : public QObject @@ -88,6 +86,4 @@ QT_END_NAMESPACE QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeTorch)) -QT_END_HEADER - #endif // QDECLARATIVETORCH_P_H diff --git a/src/multimedia/audio/audio.pri b/src/multimedia/audio/audio.pri index 73a9d651..f0706e3a 100644 --- a/src/multimedia/audio/audio.pri +++ b/src/multimedia/audio/audio.pri @@ -39,7 +39,8 @@ SOURCES += \ audio/qaudiodecoder.cpp \ audio/qaudiohelpers.cpp -mac { +mac:!ios { + PRIVATE_HEADERS += audio/qaudioinput_mac_p.h \ audio/qaudiooutput_mac_p.h \ audio/qaudiodeviceinfo_mac_p.h \ @@ -49,7 +50,6 @@ mac { audio/qaudiooutput_mac_p.cpp \ audio/qaudioinput_mac_p.cpp \ audio/qaudio_mac.cpp - LIBS += -framework ApplicationServices -framework CoreAudio -framework AudioUnit -framework AudioToolbox } diff --git a/src/multimedia/audio/qaudio.h b/src/multimedia/audio/qaudio.h index 0b70f1e0..ae23ea56 100644 --- a/src/multimedia/audio/qaudio.h +++ b/src/multimedia/audio/qaudio.h @@ -48,8 +48,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE //QTM_SYNC_HEADER_EXPORT QAudio @@ -75,6 +73,4 @@ Q_DECLARE_METATYPE(QAudio::Error) Q_DECLARE_METATYPE(QAudio::State) Q_DECLARE_METATYPE(QAudio::Mode) -QT_END_HEADER - #endif // QAUDIO_H diff --git a/src/multimedia/audio/qaudio_mac_p.h b/src/multimedia/audio/qaudio_mac_p.h index 06b16b49..5a22bbf4 100644 --- a/src/multimedia/audio/qaudio_mac_p.h +++ b/src/multimedia/audio/qaudio_mac_p.h @@ -61,8 +61,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE extern QAudioFormat toQAudioFormat(const AudioStreamBasicDescription& streamFormat); @@ -132,8 +130,6 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif // QAUDIO_MAC_P_H diff --git a/src/multimedia/audio/qaudiobuffer.h b/src/multimedia/audio/qaudiobuffer.h index 881cfb67..5f61da4a 100644 --- a/src/multimedia/audio/qaudiobuffer.h +++ b/src/multimedia/audio/qaudiobuffer.h @@ -50,8 +50,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QAbstractAudioBuffer; @@ -152,6 +150,4 @@ QT_END_NAMESPACE Q_DECLARE_METATYPE(QAudioBuffer) -QT_END_HEADER - #endif // QAUDIOBUFFER_H diff --git a/src/multimedia/audio/qaudiobuffer_p.h b/src/multimedia/audio/qaudiobuffer_p.h index ebae2c70..fd096fc2 100644 --- a/src/multimedia/audio/qaudiobuffer_p.h +++ b/src/multimedia/audio/qaudiobuffer_p.h @@ -47,8 +47,6 @@ #include "qaudioformat.h" -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE // Required for QDoc workaround @@ -86,6 +84,4 @@ public: QT_END_NAMESPACE -QT_END_HEADER - #endif // QAUDIOBUFFER_P_H diff --git a/src/multimedia/audio/qaudiodecoder.h b/src/multimedia/audio/qaudiodecoder.h index 96080b3a..4becf707 100644 --- a/src/multimedia/audio/qaudiodecoder.h +++ b/src/multimedia/audio/qaudiodecoder.h @@ -47,8 +47,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QAudioDecoderPrivate; @@ -142,6 +140,4 @@ Q_DECLARE_METATYPE(QAudioDecoder::Error) Q_MEDIA_ENUM_DEBUG(QAudioDecoder, State) Q_MEDIA_ENUM_DEBUG(QAudioDecoder, Error) -QT_END_HEADER - #endif // QAUDIODECODER_H diff --git a/src/multimedia/audio/qaudiodevicefactory.cpp b/src/multimedia/audio/qaudiodevicefactory.cpp index 11990732..76f12279 100644 --- a/src/multimedia/audio/qaudiodevicefactory.cpp +++ b/src/multimedia/audio/qaudiodevicefactory.cpp @@ -52,7 +52,7 @@ #include "qaudiodeviceinfo_win32_p.h" #include "qaudiooutput_win32_p.h" #include "qaudioinput_win32_p.h" -#elif defined(Q_OS_MAC) +#elif defined(Q_OS_MAC) && !defined(Q_OS_IOS) #include "qaudiodeviceinfo_mac_p.h" #include "qaudiooutput_mac_p.h" #include "qaudioinput_mac_p.h" @@ -137,7 +137,7 @@ QList QAudioDeviceFactory::availableDevices(QAudio::Mode mode) { QList devices; #ifndef QT_NO_AUDIO_BACKEND -#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA)) +#if (defined(Q_OS_WIN) || (defined(Q_OS_MAC) && !defined(Q_OS_IOS)) || defined(HAS_ALSA)) foreach (const QByteArray &handle, QAudioDeviceInfoInternal::availableDevices(mode)) devices << QAudioDeviceInfo(QLatin1String("builtin"), handle, mode); #endif @@ -170,7 +170,7 @@ QAudioDeviceInfo QAudioDeviceFactory::defaultInputDevice() #endif #ifndef QT_NO_AUDIO_BACKEND -#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA)) +#if (defined(Q_OS_WIN) || (defined(Q_OS_MAC) && !defined(Q_OS_IOS)) || defined(HAS_ALSA)) return QAudioDeviceInfo(QLatin1String("builtin"), QAudioDeviceInfoInternal::defaultInputDevice(), QAudio::AudioInput); #endif #endif @@ -190,7 +190,7 @@ QAudioDeviceInfo QAudioDeviceFactory::defaultOutputDevice() #endif #ifndef QT_NO_AUDIO_BACKEND -#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA)) +#if (defined(Q_OS_WIN) || (defined(Q_OS_MAC) && !defined(Q_OS_IOS)) || defined(HAS_ALSA)) return QAudioDeviceInfo(QLatin1String("builtin"), QAudioDeviceInfoInternal::defaultOutputDevice(), QAudio::AudioOutput); #endif #endif @@ -202,7 +202,7 @@ QAbstractAudioDeviceInfo* QAudioDeviceFactory::audioDeviceInfo(const QString &re QAbstractAudioDeviceInfo *rc = 0; #ifndef QT_NO_AUDIO_BACKEND -#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA)) +#if (defined(Q_OS_WIN) || (defined(Q_OS_MAC) && !defined(Q_OS_IOS)) || defined(HAS_ALSA)) if (realm == QLatin1String("builtin")) return new QAudioDeviceInfoInternal(handle, mode); #endif @@ -234,7 +234,7 @@ QAbstractAudioInput* QAudioDeviceFactory::createInputDevice(QAudioDeviceInfo con if (deviceInfo.isNull()) return new QNullInputDevice(); #ifndef QT_NO_AUDIO_BACKEND -#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA)) +#if (defined(Q_OS_WIN) || (defined(Q_OS_MAC) && !defined(Q_OS_IOS)) || defined(HAS_ALSA)) if (deviceInfo.realm() == QLatin1String("builtin")) { QAbstractAudioInput* p = new QAudioInputPrivate(deviceInfo.handle()); if (p) p->setFormat(format); @@ -261,7 +261,7 @@ QAbstractAudioOutput* QAudioDeviceFactory::createOutputDevice(QAudioDeviceInfo c if (deviceInfo.isNull()) return new QNullOutputDevice(); #ifndef QT_NO_AUDIO_BACKEND -#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA)) +#if (defined(Q_OS_WIN) || (defined(Q_OS_MAC) && !defined(Q_OS_IOS)) || defined(HAS_ALSA)) if (deviceInfo.realm() == QLatin1String("builtin")) { QAbstractAudioOutput* p = new QAudioOutputPrivate(deviceInfo.handle()); if (p) p->setFormat(format); diff --git a/src/multimedia/audio/qaudiodevicefactory_p.h b/src/multimedia/audio/qaudiodevicefactory_p.h index bec3bd2b..823115cd 100644 --- a/src/multimedia/audio/qaudiodevicefactory_p.h +++ b/src/multimedia/audio/qaudiodevicefactory_p.h @@ -61,8 +61,6 @@ #include "qaudiodeviceinfo.h" -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -92,7 +90,5 @@ public: QT_END_NAMESPACE -QT_END_HEADER - #endif // QAUDIODEVICEFACTORY_P_H diff --git a/src/multimedia/audio/qaudiodeviceinfo.h b/src/multimedia/audio/qaudiodeviceinfo.h index 485c1e56..6b80f1c4 100644 --- a/src/multimedia/audio/qaudiodeviceinfo.h +++ b/src/multimedia/audio/qaudiodeviceinfo.h @@ -55,8 +55,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -110,6 +108,4 @@ QT_END_NAMESPACE Q_DECLARE_METATYPE(QAudioDeviceInfo) -QT_END_HEADER - #endif // QAUDIODEVICEINFO_H diff --git a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h index a0fcb835..466bcdec 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h +++ b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h @@ -65,8 +65,6 @@ #include "qaudiodeviceinfo.h" #include "qaudiosystem.h" -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -120,8 +118,6 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif diff --git a/src/multimedia/audio/qaudiodeviceinfo_mac_p.h b/src/multimedia/audio/qaudiodeviceinfo_mac_p.h index 98598dbd..2afb2128 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_mac_p.h +++ b/src/multimedia/audio/qaudiodeviceinfo_mac_p.h @@ -58,8 +58,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -92,6 +90,4 @@ public: QT_END_NAMESPACE -QT_END_HEADER - #endif // QDEVICEINFO_MAC_P_H diff --git a/src/multimedia/audio/qaudiodeviceinfo_win32_p.h b/src/multimedia/audio/qaudiodeviceinfo_win32_p.h index bb57945f..6744518c 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_win32_p.h +++ b/src/multimedia/audio/qaudiodeviceinfo_win32_p.h @@ -63,8 +63,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -112,7 +110,5 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif diff --git a/src/multimedia/audio/qaudioformat.h b/src/multimedia/audio/qaudioformat.h index 830113e7..555c5f95 100644 --- a/src/multimedia/audio/qaudioformat.h +++ b/src/multimedia/audio/qaudioformat.h @@ -49,8 +49,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QAudioFormatPrivate; @@ -117,6 +115,4 @@ Q_DECLARE_METATYPE(QAudioFormat) Q_DECLARE_METATYPE(QAudioFormat::SampleType) Q_DECLARE_METATYPE(QAudioFormat::Endian) -QT_END_HEADER - #endif // QAUDIOFORMAT_H diff --git a/src/multimedia/audio/qaudioinput.h b/src/multimedia/audio/qaudioinput.h index a115ef7c..7234edca 100644 --- a/src/multimedia/audio/qaudioinput.h +++ b/src/multimedia/audio/qaudioinput.h @@ -53,8 +53,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -110,6 +108,4 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif // QAUDIOINPUT_H diff --git a/src/multimedia/audio/qaudioinput_alsa_p.h b/src/multimedia/audio/qaudioinput_alsa_p.h index d1c98feb..0455ba90 100644 --- a/src/multimedia/audio/qaudioinput_alsa_p.h +++ b/src/multimedia/audio/qaudioinput_alsa_p.h @@ -67,8 +67,6 @@ #include "qaudiodeviceinfo.h" #include "qaudiosystem.h" -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -186,7 +184,5 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif diff --git a/src/multimedia/audio/qaudioinput_mac_p.h b/src/multimedia/audio/qaudioinput_mac_p.h index a746035f..7faaa698 100644 --- a/src/multimedia/audio/qaudioinput_mac_p.h +++ b/src/multimedia/audio/qaudioinput_mac_p.h @@ -68,8 +68,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -172,6 +170,4 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif // QAUDIOINPUT_MAC_P_H diff --git a/src/multimedia/audio/qaudioinput_win32_p.cpp b/src/multimedia/audio/qaudioinput_win32_p.cpp index ef071a69..6db34adf 100644 --- a/src/multimedia/audio/qaudioinput_win32_p.cpp +++ b/src/multimedia/audio/qaudioinput_win32_p.cpp @@ -85,7 +85,7 @@ QAudioInputPrivate::~QAudioInputPrivate() } void QT_WIN_CALLBACK QAudioInputPrivate::waveInProc( HWAVEIN hWaveIn, UINT uMsg, - DWORD dwInstance, DWORD dwParam1, DWORD dwParam2 ) + DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2 ) { Q_UNUSED(dwParam1) Q_UNUSED(dwParam2) @@ -197,7 +197,7 @@ void QAudioInputPrivate::setVolume(qreal volume) controlDetails.cMultipleItems = 0; controlDetails.cbDetails = sizeof(MIXERCONTROLDETAILS_UNSIGNED); controlDetails.paDetails = &controlDetailsUnsigned; - mixerSetControlDetails((HMIXEROBJ)mixerID, &controlDetails, MIXER_SETCONTROLDETAILSF_VALUE); + mixerSetControlDetails(mixerID, &controlDetails, MIXER_SETCONTROLDETAILSF_VALUE); } } } @@ -221,7 +221,7 @@ qreal QAudioInputPrivate::volume() const controlDetails.paDetails = &detailsUnsigned; memset(controlDetails.paDetails, 0, controlDetails.cbDetails); - MMRESULT result = mixerGetControlDetails((HMIXEROBJ)mixerID, &controlDetails, MIXER_GETCONTROLDETAILSF_VALUE); + MMRESULT result = mixerGetControlDetails(mixerID, &controlDetails, MIXER_GETCONTROLDETAILSF_VALUE); if (result != MMSYSERR_NOERROR) continue; if (controlDetails.cbDetails < sizeof(MIXERCONTROLDETAILS_UNSIGNED)) @@ -431,14 +431,16 @@ void QAudioInputPrivate::initMixer() return; // Get the Mixer ID from the Sound Device ID - if (mixerGetID((HMIXEROBJ)inputDevice, &mixerID, MIXER_OBJECTF_WAVEIN) != MMSYSERR_NOERROR) + UINT mixerIntID = 0; + if (mixerGetID((HMIXEROBJ)(quintptr(inputDevice)), &mixerIntID, MIXER_OBJECTF_WAVEIN) != MMSYSERR_NOERROR) return; + mixerID = (HMIXEROBJ)mixerIntID; // Get the Destination (Recording) Line Infomation MIXERLINE mixerLine; mixerLine.cbStruct = sizeof(MIXERLINE); mixerLine.dwComponentType = MIXERLINE_COMPONENTTYPE_DST_WAVEIN; - if (mixerGetLineInfo((HMIXEROBJ)mixerID, &mixerLine, MIXER_GETLINEINFOF_COMPONENTTYPE) != MMSYSERR_NOERROR) + if (mixerGetLineInfo(mixerID, &mixerLine, MIXER_GETLINEINFOF_COMPONENTTYPE) != MMSYSERR_NOERROR) return; // Set all the Destination (Recording) Line Controls @@ -448,7 +450,7 @@ void QAudioInputPrivate::initMixer() mixerLineControls.cControls = mixerLine.cControls; mixerLineControls.cbmxctrl = sizeof(MIXERCONTROL); mixerLineControls.pamxctrl = new MIXERCONTROL[mixerLineControls.cControls]; - if (mixerGetLineControls((HMIXEROBJ)mixerID, &mixerLineControls, MIXER_GETLINECONTROLSF_ALL) != MMSYSERR_NOERROR) + if (mixerGetLineControls(mixerID, &mixerLineControls, MIXER_GETLINECONTROLSF_ALL) != MMSYSERR_NOERROR) closeMixer(); } } diff --git a/src/multimedia/audio/qaudioinput_win32_p.h b/src/multimedia/audio/qaudioinput_win32_p.h index 4c4b0447..a51d1bbe 100644 --- a/src/multimedia/audio/qaudioinput_win32_p.h +++ b/src/multimedia/audio/qaudioinput_win32_p.h @@ -69,8 +69,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -141,7 +139,7 @@ private: QMutex mutex; static void QT_WIN_CALLBACK waveInProc( HWAVEIN hWaveIn, UINT uMsg, - DWORD dwInstance, DWORD dwParam1, DWORD dwParam2 ); + DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2 ); WAVEHDR* allocateBlocks(int size, int count); void freeBlocks(WAVEHDR* blockArray); @@ -150,7 +148,7 @@ private: void initMixer(); void closeMixer(); - UINT mixerID; + HMIXEROBJ mixerID; MIXERLINECONTROLS mixerLineControls; private slots: @@ -178,7 +176,5 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif diff --git a/src/multimedia/audio/qaudiooutput.h b/src/multimedia/audio/qaudiooutput.h index 0991896b..010192f1 100644 --- a/src/multimedia/audio/qaudiooutput.h +++ b/src/multimedia/audio/qaudiooutput.h @@ -53,8 +53,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -113,6 +111,4 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif // QAUDIOOUTPUT_H diff --git a/src/multimedia/audio/qaudiooutput_alsa_p.h b/src/multimedia/audio/qaudiooutput_alsa_p.h index 24398207..3bcb94ff 100644 --- a/src/multimedia/audio/qaudiooutput_alsa_p.h +++ b/src/multimedia/audio/qaudiooutput_alsa_p.h @@ -66,8 +66,6 @@ #include "qaudiodeviceinfo.h" #include "qaudiosystem.h" -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -171,7 +169,5 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif diff --git a/src/multimedia/audio/qaudiooutput_mac_p.h b/src/multimedia/audio/qaudiooutput_mac_p.h index c871ac55..89e54fd1 100644 --- a/src/multimedia/audio/qaudiooutput_mac_p.h +++ b/src/multimedia/audio/qaudiooutput_mac_p.h @@ -68,8 +68,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -171,6 +169,4 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif diff --git a/src/multimedia/audio/qaudiooutput_win32_p.cpp b/src/multimedia/audio/qaudiooutput_win32_p.cpp index d9d0bf6b..4d13d434 100644 --- a/src/multimedia/audio/qaudiooutput_win32_p.cpp +++ b/src/multimedia/audio/qaudiooutput_win32_p.cpp @@ -131,7 +131,7 @@ QAudioOutputPrivate::~QAudioOutputPrivate() } void CALLBACK QAudioOutputPrivate::waveOutProc( HWAVEOUT hWaveOut, UINT uMsg, - DWORD dwInstance, DWORD dwParam1, DWORD dwParam2 ) + DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2 ) { Q_UNUSED(dwParam1) Q_UNUSED(dwParam2) diff --git a/src/multimedia/audio/qaudiooutput_win32_p.h b/src/multimedia/audio/qaudiooutput_win32_p.h index 032bc38d..cdff1282 100644 --- a/src/multimedia/audio/qaudiooutput_win32_p.h +++ b/src/multimedia/audio/qaudiooutput_win32_p.h @@ -76,8 +76,6 @@ # endif #endif -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -134,7 +132,7 @@ private: int intervalTime; qreal volumeCache; static void QT_WIN_CALLBACK waveOutProc( HWAVEOUT hWaveOut, UINT uMsg, - DWORD dwInstance, DWORD dwParam1, DWORD dwParam2 ); + DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2 ); QMutex mutex; @@ -170,7 +168,5 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif diff --git a/src/multimedia/audio/qaudioprobe.h b/src/multimedia/audio/qaudioprobe.h index 9a773173..fc181e9e 100644 --- a/src/multimedia/audio/qaudioprobe.h +++ b/src/multimedia/audio/qaudioprobe.h @@ -45,8 +45,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QMediaObject; @@ -75,6 +73,4 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif // QAUDIOPROBE_H diff --git a/src/multimedia/audio/qaudiosystem.h b/src/multimedia/audio/qaudiosystem.h index 7030249c..e4636ade 100644 --- a/src/multimedia/audio/qaudiosystem.h +++ b/src/multimedia/audio/qaudiosystem.h @@ -49,8 +49,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE // Required for QDoc workaround @@ -140,6 +138,4 @@ Q_SIGNALS: QT_END_NAMESPACE -QT_END_HEADER - #endif // QAUDIOSYSTEM_H diff --git a/src/multimedia/audio/qaudiosystemplugin.h b/src/multimedia/audio/qaudiosystemplugin.h index a440963b..e01d1686 100644 --- a/src/multimedia/audio/qaudiosystemplugin.h +++ b/src/multimedia/audio/qaudiosystemplugin.h @@ -53,8 +53,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE // Required for QDoc workaround @@ -93,6 +91,4 @@ public: QT_END_NAMESPACE -QT_END_HEADER - #endif // QAUDIOSYSTEMPLUGIN_H diff --git a/src/multimedia/audio/qsamplecache_p.h b/src/multimedia/audio/qsamplecache_p.h index 86e7cffe..679e996a 100644 --- a/src/multimedia/audio/qsamplecache_p.h +++ b/src/multimedia/audio/qsamplecache_p.h @@ -62,8 +62,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QIODevice; @@ -165,6 +163,4 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif // QSAMPLECACHE_P_H diff --git a/src/multimedia/audio/qsound.h b/src/multimedia/audio/qsound.h index 16c0c545..e23c0ae2 100644 --- a/src/multimedia/audio/qsound.h +++ b/src/multimedia/audio/qsound.h @@ -45,8 +45,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QSoundEffect; @@ -85,7 +83,5 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif // QSOUND_H diff --git a/src/multimedia/audio/qsoundeffect.h b/src/multimedia/audio/qsoundeffect.h index 8176fb91..a6ac8b41 100644 --- a/src/multimedia/audio/qsoundeffect.h +++ b/src/multimedia/audio/qsoundeffect.h @@ -48,8 +48,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -132,7 +130,5 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif // QSOUNDEFFECT_H diff --git a/src/multimedia/audio/qsoundeffect_pulse_p.h b/src/multimedia/audio/qsoundeffect_pulse_p.h index 5320c9ce..e43bd2fd 100644 --- a/src/multimedia/audio/qsoundeffect_pulse_p.h +++ b/src/multimedia/audio/qsoundeffect_pulse_p.h @@ -62,8 +62,6 @@ #include #include "qsamplecache_p.h" -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QSoundEffectRef; @@ -169,6 +167,4 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif // QSOUNDEFFECT_PULSE_H diff --git a/src/multimedia/audio/qsoundeffect_qaudio_p.h b/src/multimedia/audio/qsoundeffect_qaudio_p.h index c7f3a8da..8dfd7826 100644 --- a/src/multimedia/audio/qsoundeffect_qaudio_p.h +++ b/src/multimedia/audio/qsoundeffect_qaudio_p.h @@ -59,8 +59,6 @@ #include "qsamplecache_p.h" #include "qsoundeffect.h" -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QSoundEffectPrivate; @@ -151,6 +149,4 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif // QSOUNDEFFECT_QAUDIO_H diff --git a/src/multimedia/audio/qwavedecoder_p.h b/src/multimedia/audio/qwavedecoder_p.h index 28a92d0b..c21d8cb5 100644 --- a/src/multimedia/audio/qwavedecoder_p.h +++ b/src/multimedia/audio/qwavedecoder_p.h @@ -57,8 +57,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -134,6 +132,4 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif // WAVEDECODER_H diff --git a/src/multimedia/camera/qcamera.h b/src/multimedia/camera/qcamera.h index d55e81e0..6a29b2c8 100644 --- a/src/multimedia/camera/qcamera.h +++ b/src/multimedia/camera/qcamera.h @@ -58,8 +58,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -234,6 +232,4 @@ Q_MEDIA_ENUM_DEBUG(QCamera, LockType) Q_MEDIA_ENUM_DEBUG(QCamera, LockStatus) Q_MEDIA_ENUM_DEBUG(QCamera, LockChangeReason) -QT_END_HEADER - #endif // QCAMERA_H diff --git a/src/multimedia/camera/qcameraexposure.h b/src/multimedia/camera/qcameraexposure.h index 4459fb59..ba8e25cb 100644 --- a/src/multimedia/camera/qcameraexposure.h +++ b/src/multimedia/camera/qcameraexposure.h @@ -45,8 +45,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -183,6 +181,4 @@ Q_MEDIA_ENUM_DEBUG(QCameraExposure, ExposureMode) Q_MEDIA_ENUM_DEBUG(QCameraExposure, FlashMode) Q_MEDIA_ENUM_DEBUG(QCameraExposure, MeteringMode) -QT_END_HEADER - #endif // QCAMERAEXPOSURE_H diff --git a/src/multimedia/camera/qcamerafocus.h b/src/multimedia/camera/qcamerafocus.h index a8bfc261..675ae2ea 100644 --- a/src/multimedia/camera/qcamerafocus.h +++ b/src/multimedia/camera/qcamerafocus.h @@ -52,8 +52,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -176,6 +174,4 @@ Q_DECLARE_METATYPE(QCameraFocus::FocusPointMode) Q_MEDIA_ENUM_DEBUG(QCameraFocus, FocusMode) Q_MEDIA_ENUM_DEBUG(QCameraFocus, FocusPointMode) -QT_END_HEADER - #endif // QCAMERAFOCUS_H diff --git a/src/multimedia/camera/qcameraimagecapture.h b/src/multimedia/camera/qcameraimagecapture.h index 17e2e0f7..1ebcfec8 100644 --- a/src/multimedia/camera/qcameraimagecapture.h +++ b/src/multimedia/camera/qcameraimagecapture.h @@ -49,8 +49,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QSize; @@ -161,7 +159,5 @@ Q_DECLARE_METATYPE(QCameraImageCapture::CaptureDestinations) Q_MEDIA_ENUM_DEBUG(QCameraImageCapture, Error) Q_MEDIA_ENUM_DEBUG(QCameraImageCapture, CaptureDestination) -QT_END_HEADER - #endif diff --git a/src/multimedia/camera/qcameraimageprocessing.h b/src/multimedia/camera/qcameraimageprocessing.h index 3768377d..ffb088f3 100644 --- a/src/multimedia/camera/qcameraimageprocessing.h +++ b/src/multimedia/camera/qcameraimageprocessing.h @@ -53,8 +53,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -116,6 +114,4 @@ Q_DECLARE_METATYPE(QCameraImageProcessing::WhiteBalanceMode) Q_MEDIA_ENUM_DEBUG(QCameraImageProcessing, WhiteBalanceMode) -QT_END_HEADER - #endif // QCAMERAIMAGEPROCESSING_H diff --git a/src/multimedia/controls/qaudiodecodercontrol.h b/src/multimedia/controls/qaudiodecodercontrol.h index 332a3e5b..44154ca2 100644 --- a/src/multimedia/controls/qaudiodecodercontrol.h +++ b/src/multimedia/controls/qaudiodecodercontrol.h @@ -49,8 +49,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QIODevice; @@ -104,6 +102,4 @@ Q_MEDIA_DECLARE_CONTROL(QAudioDecoderControl, QAudioDecoderControl_iid) QT_END_NAMESPACE -QT_END_HEADER - #endif // QAUDIODECODERCONTROL_H diff --git a/src/multimedia/controls/qaudioencodersettingscontrol.h b/src/multimedia/controls/qaudioencodersettingscontrol.h index f8bae2be..ba913f5d 100644 --- a/src/multimedia/controls/qaudioencodersettingscontrol.h +++ b/src/multimedia/controls/qaudioencodersettingscontrol.h @@ -47,8 +47,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QStringList; @@ -85,7 +83,5 @@ Q_MEDIA_DECLARE_CONTROL(QAudioEncoderSettingsControl, QAudioEncoderSettingsContr QT_END_NAMESPACE -QT_END_HEADER - #endif // QAUDIOENCODERSETTINGSCONTROL_H diff --git a/src/multimedia/controls/qaudioinputselectorcontrol.h b/src/multimedia/controls/qaudioinputselectorcontrol.h index b3eeed32..d75e7231 100644 --- a/src/multimedia/controls/qaudioinputselectorcontrol.h +++ b/src/multimedia/controls/qaudioinputselectorcontrol.h @@ -45,8 +45,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -80,7 +78,5 @@ Q_MEDIA_DECLARE_CONTROL(QAudioInputSelectorControl, QAudioInputSelectorControl_i QT_END_NAMESPACE -QT_END_HEADER - #endif // QAUDIOINPUTSELECTORCONTROL_H diff --git a/src/multimedia/controls/qaudiooutputselectorcontrol.h b/src/multimedia/controls/qaudiooutputselectorcontrol.h index 61c52cb2..38e2d61f 100644 --- a/src/multimedia/controls/qaudiooutputselectorcontrol.h +++ b/src/multimedia/controls/qaudiooutputselectorcontrol.h @@ -45,8 +45,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -80,7 +78,5 @@ Q_MEDIA_DECLARE_CONTROL(QAudioOutputSelectorControl, QAudioOutputSelectorControl QT_END_NAMESPACE -QT_END_HEADER - #endif // QAUDIOOUTPUTSELECTORCONTROL_H diff --git a/src/multimedia/controls/qcameracapturebufferformatcontrol.h b/src/multimedia/controls/qcameracapturebufferformatcontrol.h index 4aa09eb9..3b0d1f29 100644 --- a/src/multimedia/controls/qcameracapturebufferformatcontrol.h +++ b/src/multimedia/controls/qcameracapturebufferformatcontrol.h @@ -45,8 +45,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE // Required for QDoc workaround @@ -74,8 +72,6 @@ Q_MEDIA_DECLARE_CONTROL(QCameraCaptureBufferFormatControl, QCameraCaptureBufferF QT_END_NAMESPACE -QT_END_HEADER - #endif diff --git a/src/multimedia/controls/qcameracapturedestinationcontrol.h b/src/multimedia/controls/qcameracapturedestinationcontrol.h index 7efe846c..8f5d6835 100644 --- a/src/multimedia/controls/qcameracapturedestinationcontrol.h +++ b/src/multimedia/controls/qcameracapturedestinationcontrol.h @@ -45,8 +45,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE // Required for QDoc workaround @@ -74,8 +72,6 @@ Q_MEDIA_DECLARE_CONTROL(QCameraCaptureDestinationControl, QCameraCaptureDestinat QT_END_NAMESPACE -QT_END_HEADER - #endif diff --git a/src/multimedia/controls/qcameracontrol.h b/src/multimedia/controls/qcameracontrol.h index 15b4f57c..3bd96fca 100644 --- a/src/multimedia/controls/qcameracontrol.h +++ b/src/multimedia/controls/qcameracontrol.h @@ -47,8 +47,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE // Required for QDoc workaround @@ -94,8 +92,6 @@ Q_MEDIA_DECLARE_CONTROL(QCameraControl, QCameraControl_iid) QT_END_NAMESPACE -QT_END_HEADER - #endif // QCAMERACONTROL_H diff --git a/src/multimedia/controls/qcameraexposurecontrol.h b/src/multimedia/controls/qcameraexposurecontrol.h index 617e65db..2b6d226c 100644 --- a/src/multimedia/controls/qcameraexposurecontrol.h +++ b/src/multimedia/controls/qcameraexposurecontrol.h @@ -49,8 +49,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE // Required for QDoc workaround @@ -103,8 +101,6 @@ Q_DECLARE_METATYPE(QCameraExposureControl::ExposureParameter) Q_MEDIA_ENUM_DEBUG(QCameraExposureControl, ExposureParameter) -QT_END_HEADER - #endif // QCAMERAEXPOSURECONTROL_H diff --git a/src/multimedia/controls/qcamerafeedbackcontrol.h b/src/multimedia/controls/qcamerafeedbackcontrol.h index 55dfd5b4..2860a304 100644 --- a/src/multimedia/controls/qcamerafeedbackcontrol.h +++ b/src/multimedia/controls/qcamerafeedbackcontrol.h @@ -50,8 +50,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE // Required for QDoc workaround @@ -96,7 +94,5 @@ Q_MEDIA_DECLARE_CONTROL(QCameraFeedbackControl, QCameraFeedbackControl_iid) QT_END_NAMESPACE -QT_END_HEADER - #endif // QCAMERAFEEDBACKCONTROL_H diff --git a/src/multimedia/controls/qcameraflashcontrol.h b/src/multimedia/controls/qcameraflashcontrol.h index aad5318c..c09c434f 100644 --- a/src/multimedia/controls/qcameraflashcontrol.h +++ b/src/multimedia/controls/qcameraflashcontrol.h @@ -48,8 +48,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE // Required for QDoc workaround @@ -80,8 +78,6 @@ Q_MEDIA_DECLARE_CONTROL(QCameraFlashControl, QCameraFlashControl_iid) QT_END_NAMESPACE -QT_END_HEADER - #endif // QCAMERAFLASHCONTROL_H diff --git a/src/multimedia/controls/qcamerafocuscontrol.h b/src/multimedia/controls/qcamerafocuscontrol.h index 394ca5c8..d06643ed 100644 --- a/src/multimedia/controls/qcamerafocuscontrol.h +++ b/src/multimedia/controls/qcamerafocuscontrol.h @@ -47,8 +47,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE // Required for QDoc workaround @@ -89,8 +87,6 @@ Q_MEDIA_DECLARE_CONTROL(QCameraFocusControl, QCameraFocusControl_iid) QT_END_NAMESPACE -QT_END_HEADER - #endif // QCAMERAFOCUSCONTROL_H diff --git a/src/multimedia/controls/qcameraimagecapturecontrol.h b/src/multimedia/controls/qcameraimagecapturecontrol.h index 6d2e3f29..f13bd2bf 100644 --- a/src/multimedia/controls/qcameraimagecapturecontrol.h +++ b/src/multimedia/controls/qcameraimagecapturecontrol.h @@ -45,8 +45,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QImage; @@ -92,8 +90,6 @@ Q_MEDIA_DECLARE_CONTROL(QCameraImageCaptureControl, QCameraImageCaptureControl_i QT_END_NAMESPACE -QT_END_HEADER - #endif // QCAMERAIMAGECAPTURECONTROL_H diff --git a/src/multimedia/controls/qcameraimageprocessingcontrol.h b/src/multimedia/controls/qcameraimageprocessingcontrol.h index 4ce4e7f0..befe7dc4 100644 --- a/src/multimedia/controls/qcameraimageprocessingcontrol.h +++ b/src/multimedia/controls/qcameraimageprocessingcontrol.h @@ -48,8 +48,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE // Required for QDoc workaround @@ -97,7 +95,5 @@ Q_DECLARE_METATYPE(QCameraImageProcessingControl::ProcessingParameter) Q_MEDIA_ENUM_DEBUG(QCameraImageProcessingControl, ProcessingParameter) -QT_END_HEADER - #endif diff --git a/src/multimedia/controls/qcameralockscontrol.h b/src/multimedia/controls/qcameralockscontrol.h index 82147048..33edeb09 100644 --- a/src/multimedia/controls/qcameralockscontrol.h +++ b/src/multimedia/controls/qcameralockscontrol.h @@ -47,8 +47,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE // Required for QDoc workaround @@ -79,8 +77,6 @@ Q_MEDIA_DECLARE_CONTROL(QCameraLocksControl, QCameraLocksControl_iid) QT_END_NAMESPACE -QT_END_HEADER - #endif // QCAMERALOCKSCONTROL_H diff --git a/src/multimedia/controls/qcameraviewfindersettingscontrol.h b/src/multimedia/controls/qcameraviewfindersettingscontrol.h index 49edbbbe..8654d402 100644 --- a/src/multimedia/controls/qcameraviewfindersettingscontrol.h +++ b/src/multimedia/controls/qcameraviewfindersettingscontrol.h @@ -46,8 +46,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE // Required for QDoc workaround @@ -81,6 +79,4 @@ Q_MEDIA_DECLARE_CONTROL(QCameraViewfinderSettingsControl, QCameraViewfinderSetti QT_END_NAMESPACE -QT_END_HEADER - #endif // QCAMERAVIEWFINDERSETTINGSCONTROL_H diff --git a/src/multimedia/controls/qcamerazoomcontrol.h b/src/multimedia/controls/qcamerazoomcontrol.h index 4af0ef9b..56f7d395 100644 --- a/src/multimedia/controls/qcamerazoomcontrol.h +++ b/src/multimedia/controls/qcamerazoomcontrol.h @@ -45,8 +45,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE // Required for QDoc workaround @@ -87,6 +85,4 @@ Q_MEDIA_DECLARE_CONTROL(QCameraZoomControl, QCameraZoomControl_iid) QT_END_NAMESPACE -QT_END_HEADER - #endif // QCAMERAZOOMCONTROL_H diff --git a/src/multimedia/controls/qimageencodercontrol.h b/src/multimedia/controls/qimageencodercontrol.h index 649e39dc..1ed76fb3 100644 --- a/src/multimedia/controls/qimageencodercontrol.h +++ b/src/multimedia/controls/qimageencodercontrol.h @@ -48,8 +48,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QByteArray; @@ -86,7 +84,5 @@ Q_MEDIA_DECLARE_CONTROL(QImageEncoderControl, QImageEncoderControl_iid) QT_END_NAMESPACE -QT_END_HEADER - #endif diff --git a/src/multimedia/controls/qmediaaudioprobecontrol.h b/src/multimedia/controls/qmediaaudioprobecontrol.h index aced90b7..247c9763 100644 --- a/src/multimedia/controls/qmediaaudioprobecontrol.h +++ b/src/multimedia/controls/qmediaaudioprobecontrol.h @@ -44,8 +44,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QAudioBuffer; @@ -68,7 +66,5 @@ Q_MEDIA_DECLARE_CONTROL(QMediaAudioProbeControl, QMediaAudioProbeControl_iid) QT_END_NAMESPACE -QT_END_HEADER - #endif // QMEDIAAUDIOPROBECONTROL_H diff --git a/src/multimedia/controls/qmediaavailabilitycontrol.h b/src/multimedia/controls/qmediaavailabilitycontrol.h index 8889f342..a396de67 100644 --- a/src/multimedia/controls/qmediaavailabilitycontrol.h +++ b/src/multimedia/controls/qmediaavailabilitycontrol.h @@ -46,8 +46,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE // Required for QDoc workaround @@ -74,6 +72,4 @@ Q_MEDIA_DECLARE_CONTROL(QMediaAvailabilityControl, QMediaAvailabilityControl_iid QT_END_NAMESPACE -QT_END_HEADER - #endif // QMEDIAAVAILABILITYCONTROL_H diff --git a/src/multimedia/controls/qmediacontainercontrol.h b/src/multimedia/controls/qmediacontainercontrol.h index 7b9d0ba2..4708cc1a 100644 --- a/src/multimedia/controls/qmediacontainercontrol.h +++ b/src/multimedia/controls/qmediacontainercontrol.h @@ -45,8 +45,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE // Required for QDoc workaround @@ -74,7 +72,5 @@ Q_MEDIA_DECLARE_CONTROL(QMediaContainerControl, QMediaContainerControl_iid) QT_END_NAMESPACE -QT_END_HEADER - #endif // QMEDIACONTAINERCONTROL_H diff --git a/src/multimedia/controls/qmediagaplessplaybackcontrol.h b/src/multimedia/controls/qmediagaplessplaybackcontrol.h index 78a8f270..577286d1 100644 --- a/src/multimedia/controls/qmediagaplessplaybackcontrol.h +++ b/src/multimedia/controls/qmediagaplessplaybackcontrol.h @@ -44,8 +44,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE // Required for QDoc workaround @@ -78,6 +76,4 @@ Q_MEDIA_DECLARE_CONTROL(QMediaGaplessPlaybackControl, QMediaGaplessPlaybackContr QT_END_NAMESPACE -QT_END_HEADER - #endif // QMEDIAGAPLESSPLAYBACKCONTROL_H diff --git a/src/multimedia/controls/qmedianetworkaccesscontrol.h b/src/multimedia/controls/qmedianetworkaccesscontrol.h index 219d2701..23a28f18 100644 --- a/src/multimedia/controls/qmedianetworkaccesscontrol.h +++ b/src/multimedia/controls/qmedianetworkaccesscontrol.h @@ -48,8 +48,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE // Required for QDoc workaround @@ -77,7 +75,5 @@ Q_MEDIA_DECLARE_CONTROL(QMediaNetworkAccessControl, QMediaNetworkAccessControl_i QT_END_NAMESPACE -QT_END_HEADER - #endif diff --git a/src/multimedia/controls/qmediaplayercontrol.h b/src/multimedia/controls/qmediaplayercontrol.h index 4b7dd105..aed51833 100644 --- a/src/multimedia/controls/qmediaplayercontrol.h +++ b/src/multimedia/controls/qmediaplayercontrol.h @@ -48,8 +48,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -122,8 +120,6 @@ Q_MEDIA_DECLARE_CONTROL(QMediaPlayerControl, QMediaPlayerControl_iid) QT_END_NAMESPACE -QT_END_HEADER - #endif // QMEDIAPLAYERCONTROL_H diff --git a/src/multimedia/controls/qmediaplaylistcontrol_p.h b/src/multimedia/controls/qmediaplaylistcontrol_p.h index cfaf7122..2bbfa783 100644 --- a/src/multimedia/controls/qmediaplaylistcontrol_p.h +++ b/src/multimedia/controls/qmediaplaylistcontrol_p.h @@ -59,8 +59,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -102,7 +100,5 @@ Q_MEDIA_DECLARE_CONTROL(QMediaPlaylistControl, QMediaPlaylistControl_iid) QT_END_NAMESPACE -QT_END_HEADER - #endif // QMEDIAPLAYLISTCONTROL_P_H diff --git a/src/multimedia/controls/qmediaplaylistsourcecontrol_p.h b/src/multimedia/controls/qmediaplaylistsourcecontrol_p.h index 1cb4f47b..ae5f83c2 100644 --- a/src/multimedia/controls/qmediaplaylistsourcecontrol_p.h +++ b/src/multimedia/controls/qmediaplaylistsourcecontrol_p.h @@ -56,8 +56,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -85,7 +83,5 @@ Q_MEDIA_DECLARE_CONTROL(QMediaPlaylistSourceControl, QMediaPlaylistSourceControl QT_END_NAMESPACE -QT_END_HEADER - #endif // QMEDIAPLAYLISTCONTROL_P_H diff --git a/src/multimedia/controls/qmediarecordercontrol.h b/src/multimedia/controls/qmediarecordercontrol.h index 7b047889..3ed16172 100644 --- a/src/multimedia/controls/qmediarecordercontrol.h +++ b/src/multimedia/controls/qmediarecordercontrol.h @@ -45,8 +45,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QUrl; @@ -100,7 +98,5 @@ Q_MEDIA_DECLARE_CONTROL(QMediaRecorderControl, QMediaRecorderControl_iid) QT_END_NAMESPACE -QT_END_HEADER - #endif diff --git a/src/multimedia/controls/qmediastreamscontrol.h b/src/multimedia/controls/qmediastreamscontrol.h index e10a32b4..4316d1af 100644 --- a/src/multimedia/controls/qmediastreamscontrol.h +++ b/src/multimedia/controls/qmediastreamscontrol.h @@ -48,8 +48,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE // Required for QDoc workaround @@ -89,7 +87,5 @@ Q_DECLARE_METATYPE(QMediaStreamsControl::StreamType) Q_MEDIA_ENUM_DEBUG(QMediaStreamsControl, StreamType) -QT_END_HEADER - #endif // QMEDIASTREAMSCONTROL_H diff --git a/src/multimedia/controls/qmediavideoprobecontrol.h b/src/multimedia/controls/qmediavideoprobecontrol.h index 10e1f5ea..1435cdb1 100644 --- a/src/multimedia/controls/qmediavideoprobecontrol.h +++ b/src/multimedia/controls/qmediavideoprobecontrol.h @@ -46,8 +46,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QVideoFrame; @@ -70,7 +68,5 @@ Q_MEDIA_DECLARE_CONTROL(QMediaVideoProbeControl, QMediaVideoProbeControl_iid) QT_END_NAMESPACE -QT_END_HEADER - #endif // QMEDIAVIDEOPROBECONTROL_H diff --git a/src/multimedia/controls/qmetadatareadercontrol.h b/src/multimedia/controls/qmetadatareadercontrol.h index fd9f3163..6e34b2d5 100644 --- a/src/multimedia/controls/qmetadatareadercontrol.h +++ b/src/multimedia/controls/qmetadatareadercontrol.h @@ -50,8 +50,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE // Required for QDoc workaround @@ -83,7 +81,5 @@ Q_MEDIA_DECLARE_CONTROL(QMetaDataReaderControl, QMetaDataReaderControl_iid) QT_END_NAMESPACE -QT_END_HEADER - #endif // QMETADATAPROVIDER_H diff --git a/src/multimedia/controls/qmetadatawritercontrol.h b/src/multimedia/controls/qmetadatawritercontrol.h index cb3f8daf..1c25d892 100644 --- a/src/multimedia/controls/qmetadatawritercontrol.h +++ b/src/multimedia/controls/qmetadatawritercontrol.h @@ -50,8 +50,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE // Required for QDoc workaround @@ -86,7 +84,5 @@ Q_MEDIA_DECLARE_CONTROL(QMetaDataWriterControl, QMetaDataWriterControl_iid) QT_END_NAMESPACE -QT_END_HEADER - #endif diff --git a/src/multimedia/controls/qradiodatacontrol.h b/src/multimedia/controls/qradiodatacontrol.h index 87e9af86..f28254b4 100644 --- a/src/multimedia/controls/qradiodatacontrol.h +++ b/src/multimedia/controls/qradiodatacontrol.h @@ -45,8 +45,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE // Required for QDoc workaround @@ -88,7 +86,5 @@ Q_MEDIA_DECLARE_CONTROL(QRadioDataControl, QRadioDataControl_iid) QT_END_NAMESPACE -QT_END_HEADER - #endif // QRADIODATACONTROL_H diff --git a/src/multimedia/controls/qradiotunercontrol.h b/src/multimedia/controls/qradiotunercontrol.h index 43aaf534..1ec60615 100644 --- a/src/multimedia/controls/qradiotunercontrol.h +++ b/src/multimedia/controls/qradiotunercontrol.h @@ -45,8 +45,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE // Required for QDoc workaround @@ -119,7 +117,5 @@ Q_MEDIA_DECLARE_CONTROL(QRadioTunerControl, QRadioTunerControl_iid) QT_END_NAMESPACE -QT_END_HEADER - #endif // QRADIOTUNERCONTROL_H diff --git a/src/multimedia/controls/qvideodeviceselectorcontrol.h b/src/multimedia/controls/qvideodeviceselectorcontrol.h index bdc0455c..2447cde5 100644 --- a/src/multimedia/controls/qvideodeviceselectorcontrol.h +++ b/src/multimedia/controls/qvideodeviceselectorcontrol.h @@ -44,8 +44,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE // Required for QDoc workaround @@ -83,6 +81,4 @@ Q_MEDIA_DECLARE_CONTROL(QVideoDeviceSelectorControl, QVideoDeviceSelectorControl QT_END_NAMESPACE -QT_END_HEADER - #endif // QVIDEODEVICESELECTORCONTROL_H diff --git a/src/multimedia/controls/qvideoencodersettingscontrol.h b/src/multimedia/controls/qvideoencodersettingscontrol.h index 4846d803..ea1ff12b 100644 --- a/src/multimedia/controls/qvideoencodersettingscontrol.h +++ b/src/multimedia/controls/qvideoencodersettingscontrol.h @@ -48,8 +48,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QByteArray; @@ -89,7 +87,5 @@ Q_MEDIA_DECLARE_CONTROL(QVideoEncoderSettingsControl, QVideoEncoderSettingsContr QT_END_NAMESPACE -QT_END_HEADER - #endif diff --git a/src/multimedia/controls/qvideorenderercontrol.h b/src/multimedia/controls/qvideorenderercontrol.h index d88a8114..8f7ea33e 100644 --- a/src/multimedia/controls/qvideorenderercontrol.h +++ b/src/multimedia/controls/qvideorenderercontrol.h @@ -44,8 +44,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QAbstractVideoSurface; @@ -68,7 +66,5 @@ Q_MEDIA_DECLARE_CONTROL(QVideoRendererControl, QVideoRendererControl_iid) QT_END_NAMESPACE -QT_END_HEADER - #endif // QVIDEORENDERERCONTROL_H diff --git a/src/multimedia/controls/qvideowindowcontrol.h b/src/multimedia/controls/qvideowindowcontrol.h index 62981233..2a867e77 100644 --- a/src/multimedia/controls/qvideowindowcontrol.h +++ b/src/multimedia/controls/qvideowindowcontrol.h @@ -47,8 +47,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE // Required for QDoc workaround @@ -106,7 +104,5 @@ Q_MEDIA_DECLARE_CONTROL(QVideoWindowControl, QVideoWindowControl_iid) QT_END_NAMESPACE -QT_END_HEADER - #endif diff --git a/src/multimedia/doc/qtmultimedia.qdocconf b/src/multimedia/doc/qtmultimedia.qdocconf index e501deb2..7d26cb5c 100644 --- a/src/multimedia/doc/qtmultimedia.qdocconf +++ b/src/multimedia/doc/qtmultimedia.qdocconf @@ -29,7 +29,7 @@ qhp.qtmultimedia.subprojects.qmltypes.indexTitle = Qt Multimedia QML Types qhp.qtmultimedia.subprojects.qmltypes.selectors = fake:qmlclass qhp.qtmultimedia.subprojects.qmltypes.sortPages = true -exampledirs += ../../../examples \ +exampledirs += ../../../examples/multimedia \ snippets headerdirs += ../.. @@ -38,6 +38,6 @@ imagedirs += src/images \ sourcedirs += ../.. -excludedirs += +excludedirs += ../../multimediawidgets -depends += qtcore qtdoc qtquick qtqml +depends += qtcore qtdoc qtquick qtqml qtmultimediawidgets diff --git a/src/multimedia/doc/src/blackberry.qdoc b/src/multimedia/doc/src/blackberry.qdoc index ca35745a..0983aea1 100644 --- a/src/multimedia/doc/src/blackberry.qdoc +++ b/src/multimedia/doc/src/blackberry.qdoc @@ -46,6 +46,8 @@ The Qt Multimedia BlackBerry backend uses mmrenderer for media playback. For the positional audio classes in the \l {Positional Audio} {QtAudioEngine} QML module, OpenAL is used as on all other platforms. +For recording videos and taking photos, the camapi library is used. + \section1 Supported Features Playback of audio and video with QMediaPlayer and related classes is supported. @@ -64,6 +66,12 @@ no effect. The \l {Positional Audio} {QtAudioEngine} QML module is fully supported, as it is based on OpenAL which is available in BB10. +The \l {camera} {QCamera} support includes recording of videos and taking photos. The viewfinder +is available through QCameraViewfinder and the VideoOutput QML element. + +Note: To use the camera on BB10, your application needs the 'access_shared', 'use_camera' and 'record_audio' +permissions set in the bar-descriptor.xml file. + \section1 Unsupported Features Low-latency output and input of raw audio samples with QAudioOutput, QAudioInput and related classes is @@ -74,5 +82,5 @@ QMediaPlayer does not support QIODevice-based streaming sources. However, stream an HTTP URL as the source does work. In addition, QMediaPlayer does not yet provide metadata like the artist and album of the current track. -Camera, radio and audio and video recording are not yet supported. +Radio and audio recording are not yet supported. */ diff --git a/src/multimedia/doc/src/qtmultimedia-index.qdoc b/src/multimedia/doc/src/qtmultimedia-index.qdoc index 60e4cfbb..7dfa0257 100644 --- a/src/multimedia/doc/src/qtmultimedia-index.qdoc +++ b/src/multimedia/doc/src/qtmultimedia-index.qdoc @@ -32,6 +32,8 @@ Qt Multimedia is an essential module that provides a rich set of QML types and C++ classes to handle multimedia content. It also provides necessary APIs to access the camera and radio functionality. + The \l{Qt Multimedia Widgets} module provides widget based multimedia classes. + \section1 Getting started The QML types can be imported into your applciation using the following import statement in your \c {.qml} file. diff --git a/src/multimedia/multimedia.pro b/src/multimedia/multimedia.pro index 9dbea399..2a1c6afb 100644 --- a/src/multimedia/multimedia.pro +++ b/src/multimedia/multimedia.pro @@ -51,6 +51,11 @@ include(radio/radio.pri) include(recording/recording.pri) include(video/video.pri) +ANDROID_JAR_DEPENDENCIES = \ + jar/QtMultimedia.jar:org.qtproject.qt5.android.multimedia.QtAndroidMediaPlayer +ANDROID_LIB_DEPENDENCIES = \ + plugins/mediaservice/libandroidmediaplayer.so + mac { LIBS += -framework AppKit -framework QuartzCore -framework QTKit } diff --git a/src/multimedia/playback/playlistfileparser_p.h b/src/multimedia/playback/playlistfileparser_p.h index 6031df7f..1dcfbf1f 100644 --- a/src/multimedia/playback/playlistfileparser_p.h +++ b/src/multimedia/playback/playlistfileparser_p.h @@ -56,8 +56,6 @@ #include #include "qtmultimediadefs.h" -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QPlaylistFileParserPrivate; @@ -108,6 +106,4 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif // PLAYLISTFILEPARSER_P_H diff --git a/src/multimedia/playback/qmediacontent.h b/src/multimedia/playback/qmediacontent.h index a1a1ba5d..2c66264a 100644 --- a/src/multimedia/playback/qmediacontent.h +++ b/src/multimedia/playback/qmediacontent.h @@ -49,8 +49,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QMediaPlaylist; @@ -90,6 +88,4 @@ QT_END_NAMESPACE Q_DECLARE_METATYPE(QMediaContent) -QT_END_HEADER - #endif // QMEDIACONTENT_H diff --git a/src/multimedia/playback/qmedianetworkplaylistprovider_p.h b/src/multimedia/playback/qmedianetworkplaylistprovider_p.h index d8800ce7..58ba1cec 100644 --- a/src/multimedia/playback/qmedianetworkplaylistprovider_p.h +++ b/src/multimedia/playback/qmedianetworkplaylistprovider_p.h @@ -55,8 +55,6 @@ #include "qmediaplaylistprovider_p.h" -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -95,7 +93,5 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif // QMEDIANETWORKPAYLISTSOURCE_P_H diff --git a/src/multimedia/playback/qmediaplayer.h b/src/multimedia/playback/qmediaplayer.h index 3233b1d1..3195ae06 100644 --- a/src/multimedia/playback/qmediaplayer.h +++ b/src/multimedia/playback/qmediaplayer.h @@ -48,8 +48,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -226,6 +224,4 @@ Q_MEDIA_ENUM_DEBUG(QMediaPlayer, State) Q_MEDIA_ENUM_DEBUG(QMediaPlayer, MediaStatus) Q_MEDIA_ENUM_DEBUG(QMediaPlayer, Error) -QT_END_HEADER - #endif // QMEDIAPLAYER_H diff --git a/src/multimedia/playback/qmediaplaylist.h b/src/multimedia/playback/qmediaplaylist.h index aa10c97c..3cea6ebf 100644 --- a/src/multimedia/playback/qmediaplaylist.h +++ b/src/multimedia/playback/qmediaplaylist.h @@ -50,8 +50,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -148,6 +146,4 @@ Q_DECLARE_METATYPE(QMediaPlaylist::Error) Q_MEDIA_ENUM_DEBUG(QMediaPlaylist, PlaybackMode) Q_MEDIA_ENUM_DEBUG(QMediaPlaylist, Error) -QT_END_HEADER - #endif // QMEDIAPLAYLIST_H diff --git a/src/multimedia/playback/qmediaplaylist_p.h b/src/multimedia/playback/qmediaplaylist_p.h index 7de5383e..fb9d6bb8 100644 --- a/src/multimedia/playback/qmediaplaylist_p.h +++ b/src/multimedia/playback/qmediaplaylist_p.h @@ -66,8 +66,6 @@ # pragma Q_MOC_EXPAND_MACROS #endif -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -169,7 +167,5 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif // QMEDIAPLAYLIST_P_H diff --git a/src/multimedia/playback/qmediaplaylistioplugin_p.h b/src/multimedia/playback/qmediaplaylistioplugin_p.h index eb44ec44..433c8213 100644 --- a/src/multimedia/playback/qmediaplaylistioplugin_p.h +++ b/src/multimedia/playback/qmediaplaylistioplugin_p.h @@ -60,8 +60,6 @@ #include "qmediacontent.h" -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QString; @@ -126,7 +124,5 @@ public: QT_END_NAMESPACE -QT_END_HEADER - #endif // QMEDIAPLAYLISTIOPLUGIN_P_H diff --git a/src/multimedia/playback/qmediaplaylistnavigator_p.h b/src/multimedia/playback/qmediaplaylistnavigator_p.h index 0da1130d..4d6c9d3c 100644 --- a/src/multimedia/playback/qmediaplaylistnavigator_p.h +++ b/src/multimedia/playback/qmediaplaylistnavigator_p.h @@ -57,8 +57,6 @@ #include "qmediaplaylist.h" #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -118,7 +116,5 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif // QMEDIAPLAYLISTNAVIGATOR_P_H diff --git a/src/multimedia/playback/qmediaplaylistprovider_p.h b/src/multimedia/playback/qmediaplaylistprovider_p.h index 106c008a..6a950dfe 100644 --- a/src/multimedia/playback/qmediaplaylistprovider_p.h +++ b/src/multimedia/playback/qmediaplaylistprovider_p.h @@ -56,8 +56,6 @@ #include "qmediacontent.h" #include "qmediaplaylist.h" -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -120,8 +118,6 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif // QMEDIAPLAYLISTSOURCE_P_H diff --git a/src/multimedia/playback/qmediaresource.h b/src/multimedia/playback/qmediaresource.h index 438056f8..d271b911 100644 --- a/src/multimedia/playback/qmediaresource.h +++ b/src/multimedia/playback/qmediaresource.h @@ -48,8 +48,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE // Class forward declaration required for QDoc bug @@ -128,6 +126,4 @@ QT_END_NAMESPACE Q_DECLARE_METATYPE(QMediaResource) Q_DECLARE_METATYPE(QMediaResourceList) -QT_END_HEADER - #endif diff --git a/src/multimedia/qmediabindableinterface.h b/src/multimedia/qmediabindableinterface.h index fc914347..4e4316eb 100644 --- a/src/multimedia/qmediabindableinterface.h +++ b/src/multimedia/qmediabindableinterface.h @@ -44,8 +44,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -69,7 +67,5 @@ Q_DECLARE_INTERFACE(QMediaBindableInterface, QMediaBindableInterface_iid) QT_END_NAMESPACE -QT_END_HEADER - #endif // QMEDIABINDABLEINTERFACE_H diff --git a/src/multimedia/qmediacontrol.h b/src/multimedia/qmediacontrol.h index 3122917f..a4b3c7d3 100644 --- a/src/multimedia/qmediacontrol.h +++ b/src/multimedia/qmediacontrol.h @@ -49,8 +49,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -79,7 +77,5 @@ template const char *qmediacontrol_iid() { return 0; } QT_END_NAMESPACE -QT_END_HEADER - #endif // QABSTRACTMEDIACONTROL_H diff --git a/src/multimedia/qmediacontrol_p.h b/src/multimedia/qmediacontrol_p.h index fab88999..14eaf121 100644 --- a/src/multimedia/qmediacontrol_p.h +++ b/src/multimedia/qmediacontrol_p.h @@ -55,8 +55,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -72,7 +70,5 @@ public: QT_END_NAMESPACE -QT_END_HEADER - #endif diff --git a/src/multimedia/qmediaenumdebug.h b/src/multimedia/qmediaenumdebug.h index 4cb266a0..ee1c87f1 100644 --- a/src/multimedia/qmediaenumdebug.h +++ b/src/multimedia/qmediaenumdebug.h @@ -55,7 +55,6 @@ #include #include -QT_BEGIN_HEADER QT_BEGIN_NAMESPACE #ifndef QT_NO_DEBUG_STREAM @@ -75,7 +74,6 @@ inline QDebug operator<<(QDebug dbg, Class::Enum value) \ #endif //QT_NO_DEBUG_STREAM QT_END_NAMESPACE -QT_END_HEADER #endif diff --git a/src/multimedia/qmediametadata.h b/src/multimedia/qmediametadata.h index 00e3088e..b1d7213a 100644 --- a/src/multimedia/qmediametadata.h +++ b/src/multimedia/qmediametadata.h @@ -48,8 +48,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE // Class forward declaration required for QDoc bug @@ -289,6 +287,4 @@ namespace QMediaMetaData { QT_END_NAMESPACE -QT_END_HEADER - #endif // QMEDIAMETADATA_H diff --git a/src/multimedia/qmediaobject.h b/src/multimedia/qmediaobject.h index 64d71b93..34189a27 100644 --- a/src/multimedia/qmediaobject.h +++ b/src/multimedia/qmediaobject.h @@ -48,8 +48,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -110,7 +108,5 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif // QABSTRACTMEDIAOBJECT_H diff --git a/src/multimedia/qmediaobject_p.h b/src/multimedia/qmediaobject_p.h index 64c3868c..c3640010 100644 --- a/src/multimedia/qmediaobject_p.h +++ b/src/multimedia/qmediaobject_p.h @@ -59,8 +59,6 @@ #include "qmediaobject.h" -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -95,7 +93,5 @@ public: QT_END_NAMESPACE -QT_END_HEADER - #endif diff --git a/src/multimedia/qmediapluginloader_p.h b/src/multimedia/qmediapluginloader_p.h index c2064236..e49e11b4 100644 --- a/src/multimedia/qmediapluginloader_p.h +++ b/src/multimedia/qmediapluginloader_p.h @@ -61,8 +61,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QFactoryLoader; @@ -92,7 +90,5 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif // QMEDIAPLUGINLOADER_H diff --git a/src/multimedia/qmediaresourcepolicy_p.h b/src/multimedia/qmediaresourcepolicy_p.h index a305b65e..3b8cc103 100644 --- a/src/multimedia/qmediaresourcepolicy_p.h +++ b/src/multimedia/qmediaresourcepolicy_p.h @@ -45,8 +45,6 @@ #include #include "qtmultimediadefs.h" -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class Q_MULTIMEDIA_EXPORT QMediaResourcePolicy @@ -68,6 +66,4 @@ T* QMediaResourcePolicy::createResourceSet() QT_END_NAMESPACE -QT_END_HEADER - #endif // QMEDIARESOURCEPOLICY_H diff --git a/src/multimedia/qmediaresourcepolicyplugin_p.h b/src/multimedia/qmediaresourcepolicyplugin_p.h index 5ed80fb8..0309f9ef 100644 --- a/src/multimedia/qmediaresourcepolicyplugin_p.h +++ b/src/multimedia/qmediaresourcepolicyplugin_p.h @@ -45,8 +45,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE struct Q_MULTIMEDIA_EXPORT QMediaResourceSetFactoryInterface @@ -71,6 +69,4 @@ public: QT_END_NAMESPACE -QT_END_HEADER - #endif // QRESOURCEPOLICYPLUGIN_P_H diff --git a/src/multimedia/qmediaresourceset_p.h b/src/multimedia/qmediaresourceset_p.h index b217718d..9d84155c 100644 --- a/src/multimedia/qmediaresourceset_p.h +++ b/src/multimedia/qmediaresourceset_p.h @@ -44,8 +44,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE #define QMediaPlayerResourceSetInterface_iid \ @@ -78,6 +76,4 @@ protected: QT_END_NAMESPACE -QT_END_HEADER - #endif // QMEDIARESOURCESET_P_H diff --git a/src/multimedia/qmediaservice.h b/src/multimedia/qmediaservice.h index 6d797482..8230f498 100644 --- a/src/multimedia/qmediaservice.h +++ b/src/multimedia/qmediaservice.h @@ -48,8 +48,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -88,8 +86,6 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif // QABSTRACTMEDIASERVICE_H diff --git a/src/multimedia/qmediaservice_p.h b/src/multimedia/qmediaservice_p.h index c1f405d4..ab2ae4e8 100644 --- a/src/multimedia/qmediaservice_p.h +++ b/src/multimedia/qmediaservice_p.h @@ -53,8 +53,6 @@ // We mean it. // -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -71,8 +69,6 @@ public: QT_END_NAMESPACE -QT_END_HEADER - #endif diff --git a/src/multimedia/qmediaserviceprovider_p.h b/src/multimedia/qmediaserviceprovider_p.h index aa0bcdc0..df4d5d81 100644 --- a/src/multimedia/qmediaserviceprovider_p.h +++ b/src/multimedia/qmediaserviceprovider_p.h @@ -48,8 +48,6 @@ #include "qmultimedia.h" #include "qmediaserviceproviderplugin.h" -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -78,7 +76,5 @@ public: QT_END_NAMESPACE -QT_END_HEADER - #endif // QMEDIASERVICEPROVIDER_H diff --git a/src/multimedia/qmediaserviceproviderplugin.h b/src/multimedia/qmediaserviceproviderplugin.h index 628e0f8f..fa3b8823 100644 --- a/src/multimedia/qmediaserviceproviderplugin.h +++ b/src/multimedia/qmediaserviceproviderplugin.h @@ -51,8 +51,6 @@ # pragma Q_MOC_EXPAND_MACROS #endif -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE // Required for QDoc workaround @@ -227,6 +225,4 @@ public: QT_END_NAMESPACE -QT_END_HEADER - #endif // QMEDIASERVICEPROVIDERPLUGIN_H diff --git a/src/multimedia/qmediatimerange.h b/src/multimedia/qmediatimerange.h index f32e8da6..24b653d9 100644 --- a/src/multimedia/qmediatimerange.h +++ b/src/multimedia/qmediatimerange.h @@ -46,8 +46,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -132,7 +130,5 @@ Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, const QMediaTimeRange &); QT_END_NAMESPACE -QT_END_HEADER - #endif // QMEDIATIMERANGE_H diff --git a/src/multimedia/qmultimedia.h b/src/multimedia/qmultimedia.h index 474da5e5..22028be6 100644 --- a/src/multimedia/qmultimedia.h +++ b/src/multimedia/qmultimedia.h @@ -49,8 +49,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE namespace QMultimedia @@ -97,7 +95,5 @@ Q_DECLARE_METATYPE(QMultimedia::SupportEstimate) Q_DECLARE_METATYPE(QMultimedia::EncodingMode) Q_DECLARE_METATYPE(QMultimedia::EncodingQuality) -QT_END_HEADER - #endif diff --git a/src/multimedia/qtmultimediadefs.h b/src/multimedia/qtmultimediadefs.h index 41c505ae..a82777c9 100644 --- a/src/multimedia/qtmultimediadefs.h +++ b/src/multimedia/qtmultimediadefs.h @@ -55,7 +55,6 @@ #include -QT_BEGIN_HEADER QT_BEGIN_NAMESPACE #ifndef QT_STATIC @@ -69,8 +68,6 @@ QT_BEGIN_NAMESPACE #endif QT_END_NAMESPACE -QT_END_HEADER - #endif // QMULTIMEDIA_P_H diff --git a/src/multimedia/qtmultimediaquicktools_headers/qsgvideonode_p.h b/src/multimedia/qtmultimediaquicktools_headers/qsgvideonode_p.h index f16e811e..4590e2f9 100644 --- a/src/multimedia/qtmultimediaquicktools_headers/qsgvideonode_p.h +++ b/src/multimedia/qtmultimediaquicktools_headers/qsgvideonode_p.h @@ -49,8 +49,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE const QLatin1String QSGVideoNodeFactoryPluginKey("sgvideonodes"); @@ -92,6 +90,4 @@ public: QT_END_NAMESPACE -QT_END_HEADER - #endif // QSGVIDEONODE_H diff --git a/src/multimedia/qtmultimediaquicktools_headers/qtmultimediaquickdefs_p.h b/src/multimedia/qtmultimediaquicktools_headers/qtmultimediaquickdefs_p.h index 34109608..54ec2eda 100644 --- a/src/multimedia/qtmultimediaquicktools_headers/qtmultimediaquickdefs_p.h +++ b/src/multimedia/qtmultimediaquicktools_headers/qtmultimediaquickdefs_p.h @@ -55,8 +55,6 @@ #include -QT_BEGIN_HEADER - #ifndef QT_STATIC # if defined(QT_BUILD_QTMM_QUICK_LIB) # define Q_MULTIMEDIAQUICK_EXPORT Q_DECL_EXPORT @@ -67,8 +65,6 @@ QT_BEGIN_HEADER # define Q_MULTIMEDIAQUICK_EXPORT #endif -QT_END_HEADER - #endif // QMULTIMEDIAQUICKDEFS_P_H diff --git a/src/multimedia/radio/qradiodata.h b/src/multimedia/radio/qradiodata.h index cd41f80b..1324ee0e 100644 --- a/src/multimedia/radio/qradiodata.h +++ b/src/multimedia/radio/qradiodata.h @@ -48,8 +48,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -135,6 +133,4 @@ Q_DECLARE_METATYPE(QRadioData::ProgramType) Q_MEDIA_ENUM_DEBUG(QRadioData, Error) Q_MEDIA_ENUM_DEBUG(QRadioData, ProgramType) -QT_END_HEADER - #endif // QRADIOPLAYER_H diff --git a/src/multimedia/radio/qradiotuner.h b/src/multimedia/radio/qradiotuner.h index 68658f70..a2f6e9a8 100644 --- a/src/multimedia/radio/qradiotuner.h +++ b/src/multimedia/radio/qradiotuner.h @@ -49,8 +49,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QRadioData; @@ -163,6 +161,4 @@ Q_MEDIA_ENUM_DEBUG(QRadioTuner, Error) Q_MEDIA_ENUM_DEBUG(QRadioTuner, StereoMode) Q_MEDIA_ENUM_DEBUG(QRadioTuner, SearchMode) -QT_END_HEADER - #endif // QRADIOPLAYER_H diff --git a/src/multimedia/recording/qaudiorecorder.h b/src/multimedia/recording/qaudiorecorder.h index 818d5732..d5ab75d1 100644 --- a/src/multimedia/recording/qaudiorecorder.h +++ b/src/multimedia/recording/qaudiorecorder.h @@ -49,8 +49,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QString; @@ -89,6 +87,4 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif // QAUDIORECORDER_H diff --git a/src/multimedia/recording/qmediaencodersettings.h b/src/multimedia/recording/qmediaencodersettings.h index 6820260a..f76c4457 100644 --- a/src/multimedia/recording/qmediaencodersettings.h +++ b/src/multimedia/recording/qmediaencodersettings.h @@ -49,8 +49,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -180,7 +178,5 @@ Q_DECLARE_METATYPE(QAudioEncoderSettings) Q_DECLARE_METATYPE(QVideoEncoderSettings) Q_DECLARE_METATYPE(QImageEncoderSettings) -QT_END_HEADER - #endif diff --git a/src/multimedia/recording/qmediarecorder.h b/src/multimedia/recording/qmediarecorder.h index 659ef1ee..9c7ef700 100644 --- a/src/multimedia/recording/qmediarecorder.h +++ b/src/multimedia/recording/qmediarecorder.h @@ -50,8 +50,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QUrl; @@ -224,6 +222,4 @@ Q_MEDIA_ENUM_DEBUG(QMediaRecorder, State) Q_MEDIA_ENUM_DEBUG(QMediaRecorder, Status) Q_MEDIA_ENUM_DEBUG(QMediaRecorder, Error) -QT_END_HEADER - #endif // QMEDIARECORDER_H diff --git a/src/multimedia/video/qabstractvideobuffer.h b/src/multimedia/video/qabstractvideobuffer.h index fa1b4055..1be90ff9 100644 --- a/src/multimedia/video/qabstractvideobuffer.h +++ b/src/multimedia/video/qabstractvideobuffer.h @@ -48,8 +48,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -112,6 +110,4 @@ QT_END_NAMESPACE Q_DECLARE_METATYPE(QAbstractVideoBuffer::HandleType) Q_DECLARE_METATYPE(QAbstractVideoBuffer::MapMode) -QT_END_HEADER - #endif diff --git a/src/multimedia/video/qabstractvideobuffer_p.h b/src/multimedia/video/qabstractvideobuffer_p.h index 2b9458c3..8841f75d 100644 --- a/src/multimedia/video/qabstractvideobuffer_p.h +++ b/src/multimedia/video/qabstractvideobuffer_p.h @@ -60,8 +60,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QAbstractVideoBufferPrivate @@ -76,7 +74,5 @@ public: QT_END_NAMESPACE -QT_END_HEADER - #endif diff --git a/src/multimedia/video/qabstractvideosurface.h b/src/multimedia/video/qabstractvideosurface.h index cb14b105..be4520d0 100644 --- a/src/multimedia/video/qabstractvideosurface.h +++ b/src/multimedia/video/qabstractvideosurface.h @@ -45,8 +45,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QRectF; @@ -113,6 +111,4 @@ QT_END_NAMESPACE Q_DECLARE_METATYPE(QAbstractVideoSurface*) Q_DECLARE_METATYPE(QAbstractVideoSurface::Error) -QT_END_HEADER - #endif diff --git a/src/multimedia/video/qimagevideobuffer_p.h b/src/multimedia/video/qimagevideobuffer_p.h index 2d341581..08c393b1 100644 --- a/src/multimedia/video/qimagevideobuffer_p.h +++ b/src/multimedia/video/qimagevideobuffer_p.h @@ -55,8 +55,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -79,7 +77,5 @@ public: QT_END_NAMESPACE -QT_END_HEADER - #endif diff --git a/src/multimedia/video/qmemoryvideobuffer_p.h b/src/multimedia/video/qmemoryvideobuffer_p.h index a497c075..73e0f525 100644 --- a/src/multimedia/video/qmemoryvideobuffer_p.h +++ b/src/multimedia/video/qmemoryvideobuffer_p.h @@ -55,10 +55,6 @@ // We mean it. // -QT_BEGIN_HEADER - -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -79,9 +75,5 @@ public: QT_END_NAMESPACE -QT_END_HEADER - - -QT_END_HEADER #endif diff --git a/src/multimedia/video/qvideoframe.h b/src/multimedia/video/qvideoframe.h index f1fd0b28..504a0d54 100644 --- a/src/multimedia/video/qvideoframe.h +++ b/src/multimedia/video/qvideoframe.h @@ -48,8 +48,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QSize; @@ -177,7 +175,5 @@ Q_DECLARE_METATYPE(QVideoFrame) Q_DECLARE_METATYPE(QVideoFrame::FieldType) Q_DECLARE_METATYPE(QVideoFrame::PixelFormat) -QT_END_HEADER - #endif diff --git a/src/multimedia/video/qvideoprobe.h b/src/multimedia/video/qvideoprobe.h index 8c8482d3..8220a1f7 100644 --- a/src/multimedia/video/qvideoprobe.h +++ b/src/multimedia/video/qvideoprobe.h @@ -45,8 +45,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QMediaObject; @@ -75,6 +73,4 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif // QVIDEOPROBE_H diff --git a/src/multimedia/video/qvideosurfaceformat.h b/src/multimedia/video/qvideosurfaceformat.h index 57eae4f8..fe7b6d9d 100644 --- a/src/multimedia/video/qvideosurfaceformat.h +++ b/src/multimedia/video/qvideosurfaceformat.h @@ -49,8 +49,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -143,7 +141,5 @@ Q_DECLARE_METATYPE(QVideoSurfaceFormat) Q_DECLARE_METATYPE(QVideoSurfaceFormat::Direction) Q_DECLARE_METATYPE(QVideoSurfaceFormat::YCbCrColorSpace) -QT_END_HEADER - #endif diff --git a/src/multimedia/video/qvideosurfaceoutput_p.h b/src/multimedia/video/qvideosurfaceoutput_p.h index 0657515c..fd803281 100644 --- a/src/multimedia/video/qvideosurfaceoutput_p.h +++ b/src/multimedia/video/qvideosurfaceoutput_p.h @@ -47,8 +47,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -79,7 +77,5 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif diff --git a/src/multimediawidgets/doc/qtmultimediawidgets.qdocconf b/src/multimediawidgets/doc/qtmultimediawidgets.qdocconf new file mode 100644 index 00000000..a25ee1a1 --- /dev/null +++ b/src/multimediawidgets/doc/qtmultimediawidgets.qdocconf @@ -0,0 +1,43 @@ +include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) + +project = qtmultimediawidgets +description = Qt Multimedia Widgets Documentation +url = http://qt-project.org/doc/qt-$QT_VER/qtmultimediawidgets +version = $QT_VERSION + +# The following parameters are for creating a qhp file, the qhelpgenerator +# program can convert the qhp file into a qch file which can be opened in +# Qt Assistant and/or Qt Creator. + +# Defines the name of the project. You cannot use operators (+, =, -) in +# the name. Properties for this project are set using a qhp..property +# format. +qhp.projects = qtmultimediawidgets +qhp.qtmultimediawidgets.file = qtmultimediawidgets.qhp +qhp.qtmultimediawidgets.namespace = org.qt-project.qtmultimediawidgets.$QT_VERSION_TAG +qhp.qtmultimediawidgets.indexTitle = Qt Multimedia +qhp.qtmultimediawidgets.virtualFolder = qtmultimediawidgets + +# For listing child nodes in Qt Creator or Assistant. +qhp.qtmultimediawidgets.subprojects = classes qmltypes +qhp.qtmultimediawidgets.subprojects.classes.title = C++ Classes +qhp.qtmultimediawidgets.subprojects.classes.indexTitle = Qt Multimedia Widgets C++ Classes +qhp.qtmultimediawidgets.subprojects.classes.selectors = class fake:headerfile +qhp.qtmultimediawidgets.subprojects.classes.sortPages = true +qhp.qtmultimediawidgets.subprojects.qmltypes.title = QML Types +qhp.qtmultimediawidgets.subprojects.qmltypes.indexTitle = Qt Multimedia Widgets QML Types +qhp.qtmultimediawidgets.subprojects.qmltypes.selectors = fake:qmlclass +qhp.qtmultimediawidgets.subprojects.qmltypes.sortPages = true + +exampledirs += ../../../examples/multimediawidgets \ + snippets + +headerdirs += ../ + +imagedirs += \ + +sourcedirs += ../ + +excludedirs += + +depends += qtcore qtdoc qtquick qtqml qtmultimedia qtwidgets qtgui diff --git a/src/multimediawidgets/doc/src/qtmultimediawidgets-index.qdoc b/src/multimediawidgets/doc/src/qtmultimediawidgets-index.qdoc new file mode 100644 index 00000000..07fa6320 --- /dev/null +++ b/src/multimediawidgets/doc/src/qtmultimediawidgets-index.qdoc @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! +\page qtmultimediawidgets-index.html +\title Qt Multimedia Widgets +\brief An essential module which provides multimedia-related widgets. + +Qt Multimedia Widgets provides additional multimedia-related widgets and +controls. The classes expand the capabilities of the \l{Qt Multimedia} and +\l{Qt Widgets} modules. + +\section1 Getting Started + +To enable Qt Multimedia Widgets in a project, add this directive into the +C++ files: +\code +#include +\endcode + +To link against the C++ libraries, add the following to your \c qmake project +file: +\code +QT += multimediawidgets +\endcode + +\section1 Related Information + +\section2 Reference +\list +\li \l{Qt Multimedia Widgets C++ Classes}{C++ Classes} +\endlist + +\section2 Examples +\list +\li \l{QML Camera Example} +\li \l{Camera Example} +\li \l{Media Player Example} +\li \l{Video Graphics Item Example} +\li \l{Video Widget Example} +\endlist + +*/ diff --git a/src/multimediawidgets/doc/src/qtmultimediawidgets.qdoc b/src/multimediawidgets/doc/src/qtmultimediawidgets.qdoc new file mode 100644 index 00000000..cc64ed17 --- /dev/null +++ b/src/multimediawidgets/doc/src/qtmultimediawidgets.qdoc @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! +\module QtMultimediaWidgets +\title Qt Multimedia Widgets C++ Classes +\brief Classes provided by the Qt Multimedia Widgets module. + +These classes are part of the \l{Qt Multimedia Widgets} module. + +To enable Qt Multimedia Widgets in a project, add this directive into the +C++ files: +\code +#include +\endcode + +To link against the C++ libraries, add the following to your \c qmake project +file: +\code +QT += multimediawidgets +\endcode + +*/ diff --git a/src/multimediawidgets/multimediawidgets.pro b/src/multimediawidgets/multimediawidgets.pro index 8637bbff..c6f21467 100644 --- a/src/multimediawidgets/multimediawidgets.pro +++ b/src/multimediawidgets/multimediawidgets.pro @@ -7,6 +7,8 @@ qtHaveModule(opengl):!contains(QT_CONFIG, opengles1) { DEFINES += QT_NO_OPENGL } +QMAKE_DOCS = $$PWD/doc/qtmultimediawidgets.qdocconf + load(qt_module) PRIVATE_HEADERS += \ @@ -26,7 +28,7 @@ SOURCES += \ qvideowidgetcontrol.cpp \ qvideowidget.cpp -mac { +mac:!ios { !simulator { PRIVATE_HEADERS += qpaintervideosurface_mac_p.h OBJECTIVE_SOURCES += qpaintervideosurface_mac.mm @@ -52,4 +54,3 @@ maemo6 { } HEADERS += $$PUBLIC_HEADERS $$PRIVATE_HEADERS - diff --git a/src/multimediawidgets/qcameraviewfinder.h b/src/multimediawidgets/qcameraviewfinder.h index c2eff6f5..4b3f7d08 100644 --- a/src/multimediawidgets/qcameraviewfinder.h +++ b/src/multimediawidgets/qcameraviewfinder.h @@ -53,8 +53,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -80,7 +78,5 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif // QCAMERA_H diff --git a/src/multimediawidgets/qeglimagetexturesurface_p.h b/src/multimediawidgets/qeglimagetexturesurface_p.h index 9a22e14b..cafd3238 100644 --- a/src/multimediawidgets/qeglimagetexturesurface_p.h +++ b/src/multimediawidgets/qeglimagetexturesurface_p.h @@ -65,8 +65,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QGLContext; @@ -142,7 +140,5 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif diff --git a/src/multimediawidgets/qgraphicsvideoitem.h b/src/multimediawidgets/qgraphicsvideoitem.h index c5d99332..6db81a55 100644 --- a/src/multimediawidgets/qgraphicsvideoitem.h +++ b/src/multimediawidgets/qgraphicsvideoitem.h @@ -47,8 +47,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QVideoSurfaceFormat; @@ -107,7 +105,5 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif diff --git a/src/multimediawidgets/qgraphicsvideoitem_maemo6.cpp b/src/multimediawidgets/qgraphicsvideoitem_maemo6.cpp index 665ea971..cdbc9820 100644 --- a/src/multimediawidgets/qgraphicsvideoitem_maemo6.cpp +++ b/src/multimediawidgets/qgraphicsvideoitem_maemo6.cpp @@ -203,7 +203,7 @@ void QGraphicsVideoItemPrivate::_q_serviceDestroyed() \brief The QGraphicsVideoItem class provides a graphics item which display video produced by a QMediaObject. - \inmodule QtMultimedia + \inmodule QtMultimediaWidgets \ingroup multimedia Attaching a QGraphicsVideoItem to a QMediaObject allows it to display diff --git a/src/multimediawidgets/qpaintervideosurface_mac_p.h b/src/multimediawidgets/qpaintervideosurface_mac_p.h index 4840b9cd..a56a650d 100644 --- a/src/multimediawidgets/qpaintervideosurface_mac_p.h +++ b/src/multimediawidgets/qpaintervideosurface_mac_p.h @@ -57,8 +57,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -95,6 +93,4 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif diff --git a/src/multimediawidgets/qpaintervideosurface_p.h b/src/multimediawidgets/qpaintervideosurface_p.h index abc099d2..12113a00 100644 --- a/src/multimediawidgets/qpaintervideosurface_p.h +++ b/src/multimediawidgets/qpaintervideosurface_p.h @@ -61,8 +61,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QGLContext; @@ -181,7 +179,5 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QPainterVideoSurface::ShaderTypes) QT_END_NAMESPACE -QT_END_HEADER - #endif diff --git a/src/multimediawidgets/qtmultimediawidgetdefs.h b/src/multimediawidgets/qtmultimediawidgetdefs.h index 32ef34ab..73b8b50f 100644 --- a/src/multimediawidgets/qtmultimediawidgetdefs.h +++ b/src/multimediawidgets/qtmultimediawidgetdefs.h @@ -55,7 +55,6 @@ #include -QT_BEGIN_HEADER QT_BEGIN_NAMESPACE #ifndef QT_STATIC @@ -69,7 +68,6 @@ QT_BEGIN_NAMESPACE #endif QT_END_NAMESPACE -QT_END_HEADER #endif // QMULTIMEDIAWIDGETS_P_H diff --git a/src/multimediawidgets/qvideowidget.h b/src/multimediawidgets/qvideowidget.h index d126785c..ec71bb6c 100644 --- a/src/multimediawidgets/qvideowidget.h +++ b/src/multimediawidgets/qvideowidget.h @@ -47,8 +47,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -131,7 +129,5 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif diff --git a/src/multimediawidgets/qvideowidget_p.h b/src/multimediawidgets/qvideowidget_p.h index ee2c07bf..a7412202 100644 --- a/src/multimediawidgets/qvideowidget_p.h +++ b/src/multimediawidgets/qvideowidget_p.h @@ -64,8 +64,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -282,7 +280,5 @@ public: QT_END_NAMESPACE -QT_END_HEADER - #endif diff --git a/src/multimediawidgets/qvideowidgetcontrol.h b/src/multimediawidgets/qvideowidgetcontrol.h index 49d338b7..b5c13063 100644 --- a/src/multimediawidgets/qvideowidgetcontrol.h +++ b/src/multimediawidgets/qvideowidgetcontrol.h @@ -47,8 +47,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -97,7 +95,5 @@ Q_MEDIA_DECLARE_CONTROL(QVideoWidgetControl, QVideoWidgetControl_iid) QT_END_NAMESPACE -QT_END_HEADER - #endif diff --git a/src/plugins/android/android.pro b/src/plugins/android/android.pro new file mode 100644 index 00000000..2cfc83f0 --- /dev/null +++ b/src/plugins/android/android.pro @@ -0,0 +1,5 @@ +TEMPLATE = subdirs + +SUBDIRS += mediaplayer \ + jar + diff --git a/src/plugins/android/jar/AndroidManifest.xml b/src/plugins/android/jar/AndroidManifest.xml new file mode 100644 index 00000000..7eae1854 --- /dev/null +++ b/src/plugins/android/jar/AndroidManifest.xml @@ -0,0 +1,6 @@ + + + diff --git a/src/plugins/android/jar/jar.pro b/src/plugins/android/jar/jar.pro new file mode 100644 index 00000000..b256412f --- /dev/null +++ b/src/plugins/android/jar/jar.pro @@ -0,0 +1,11 @@ +load(qt_build_paths) +CONFIG += java +TARGET = QtMultimedia +DESTDIR = $$MODULE_BASE_OUTDIR/jar +API_VERSION = android-11 + +JAVACLASSPATH += $$PWD/src + +JAVASOURCES += $$PWD/src/org/qtproject/qt5/android/multimedia/QtAndroidMediaPlayer.java \ + $$PWD/src/org/qtproject/qt5/android/multimedia/QtSurfaceTexture.java \ + $$PWD/src/org/qtproject/qt5/android/multimedia/QtSurfaceTextureHolder.java diff --git a/src/plugins/android/jar/src/org/qtproject/qt5/android/multimedia/QtAndroidMediaPlayer.java b/src/plugins/android/jar/src/org/qtproject/qt5/android/multimedia/QtAndroidMediaPlayer.java new file mode 100644 index 00000000..b2115b7d --- /dev/null +++ b/src/plugins/android/jar/src/org/qtproject/qt5/android/multimedia/QtAndroidMediaPlayer.java @@ -0,0 +1,445 @@ +/**************************************************************************** + ** + ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). + ** Contact: http://www.qt-project.org/legal + ** + ** This file is part of the QtMultimedia module of the Qt Toolkit. + ** + ** $QT_BEGIN_LICENSE:LGPL$ + ** Commercial License Usage + ** Licensees holding valid commercial Qt licenses may use this file in + ** accordance with the commercial license agreement provided with the + ** Software or, alternatively, in accordance with the terms contained in + ** a written agreement between you and Digia. For licensing terms and + ** conditions see http://qt.digia.com/licensing. For further information + ** use the contact form at http://qt.digia.com/contact-us. + ** + ** GNU Lesser General Public License Usage + ** Alternatively, this file may be used under the terms of the GNU Lesser + ** General Public License version 2.1 as published by the Free Software + ** Foundation and appearing in the file LICENSE.LGPL included in the + ** packaging of this file. Please review the following information to + ** ensure the GNU Lesser General Public License version 2.1 requirements + ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. + ** + ** In addition, as a special exception, Digia gives you certain additional + ** rights. These rights are described in the Digia Qt LGPL Exception + ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. + ** + ** GNU General Public License Usage + ** Alternatively, this file may be used under the terms of the GNU + ** General Public License version 3.0 as published by the Free Software + ** Foundation and appearing in the file LICENSE.GPL included in the + ** packaging of this file. Please review the following information to + ** ensure the GNU General Public License version 3.0 requirements will be + ** met: http://www.gnu.org/copyleft/gpl.html. + ** + ** + ** $QT_END_LICENSE$ + ** + ****************************************************************************/ + +package org.qtproject.qt5.android.multimedia; + +import java.io.IOException; +import java.lang.String; + +// API is level is < 9 unless marked otherwise. +import android.app.Activity; +import android.content.Context; +import android.media.MediaPlayer; +import android.net.Uri; +import android.util.Log; + +public class QtAndroidMediaPlayer extends MediaPlayer +{ + // Native callback functions for MediaPlayer + native public void onErrorNative(int what, int extra, long id); + native public void onBufferingUpdateNative(int percent, long id); + native public void onInfoNative(int what, int extra, long id); + native public void onMediaPlayerInfoNative(int what, int extra, long id); + native public void onVideoSizeChangedNative(int width, int height, long id); + + private Uri mUri = null; + private final long mID; + private boolean mMuted = false; + private boolean mPreparing = false; + private boolean mInitialized = false; + private int mVolume = 100; + private static final String TAG = "Qt MediaPlayer"; + private static Context mApplicationContext = null; + + final int MEDIA_PLAYER_INVALID_STATE = 1; + final int MEDIA_PLAYER_PREPARING = 2; + final int MEDIA_PLAYER_READY = 3; + final int MEDIA_PLAYER_DURATION = 4; + final int MEDIA_PLAYER_PROGRESS = 5; + final int MEDIA_PLAYER_FINISHED = 6; + + // Activity set by Qt on load. + static public void setActivity(final Activity activity) + { + try { + mApplicationContext = activity.getApplicationContext(); + } catch(final Exception e) { + Log.d(TAG, e.getMessage()); + } + } + + private class ProgressWatcher implements Runnable + { + @Override + public void run() + { + final int duratation = getDuration(); + int currentPosition = getCurrentPosition(); + + try { + while (duratation >= currentPosition && isPlaying()) { + onMediaPlayerInfoNative(MEDIA_PLAYER_PROGRESS, currentPosition, mID); + Thread.sleep(1000); + currentPosition = getCurrentPosition(); + } + } catch (final InterruptedException e) { + Log.d(TAG, e.getMessage()); + return; + } + } + } + + /** + * MediaPlayer OnErrorListener + */ + private class MediaPlayerErrorListener + implements MediaPlayer.OnErrorListener + { + @Override + public boolean onError(final MediaPlayer mp, + final int what, + final int extra) + { + reset(); + onErrorNative(what, extra, mID); + return true; + } + + } + + /** + * MediaPlayer OnBufferingListener + */ + private class MediaPlayerBufferingListener + implements MediaPlayer.OnBufferingUpdateListener + { + private int mBufferPercent = -1; + @Override + public void onBufferingUpdate(final android.media.MediaPlayer mp, + final int percent) + { + // Avoid updates when percent is unchanged. + // E.g., we keep getting updates when percent == 100 + if (mBufferPercent == percent) + return; + + onBufferingUpdateNative((mBufferPercent = percent), mID); + } + + } + + /** + * MediaPlayer OnCompletionListener + */ + private class MediaPlayerCompletionListener + implements MediaPlayer.OnCompletionListener + { + @Override + public void onCompletion(final MediaPlayer mp) + { + onMediaPlayerInfoNative(MEDIA_PLAYER_FINISHED, 0, mID); + reset(); + } + + } + + /** + * MediaPlayer OnInfoListener + */ + private class MediaPlayerInfoListener + implements MediaPlayer.OnInfoListener + { + @Override + public boolean onInfo(final MediaPlayer mp, + final int what, + final int extra) + { + onInfoNative(what, extra, mID); + return true; + } + + } + + /** + * MediaPlayer OnPreparedListener + */ + private class MediaPlayerPreparedListener + implements MediaPlayer.OnPreparedListener + { + + @Override + public void onPrepared(final MediaPlayer mp) + { + onMediaPlayerInfoNative(MEDIA_PLAYER_DURATION, getDuration(), mID); + onMediaPlayerInfoNative(MEDIA_PLAYER_READY, 0, mID); + mPreparing = false; + } + + } + + /** + * MediaPlayer OnSeekCompleteListener + */ + private class MediaPlayerSeekCompleteListener + implements MediaPlayer.OnSeekCompleteListener + { + + @Override + public void onSeekComplete(final MediaPlayer mp) + { + onMediaPlayerInfoNative(MEDIA_PLAYER_PROGRESS, getCurrentPosition(), mID); + } + + } + + /** + * MediaPlayer OnVideoSizeChangedListener + */ + private class MediaPlayerVideoSizeChangedListener + implements MediaPlayer.OnVideoSizeChangedListener + { + + @Override + public void onVideoSizeChanged(final MediaPlayer mp, + final int width, + final int height) + { + onVideoSizeChangedNative(width, height, mID); + } + + } + + public QtAndroidMediaPlayer(final long id) + { + super(); + mID = id; + setOnBufferingUpdateListener(new MediaPlayerBufferingListener()); + setOnCompletionListener(new MediaPlayerCompletionListener()); + setOnInfoListener(new MediaPlayerInfoListener()); + setOnSeekCompleteListener(new MediaPlayerSeekCompleteListener()); + setOnVideoSizeChangedListener(new MediaPlayerVideoSizeChangedListener()); + setOnErrorListener(new MediaPlayerErrorListener()); + } + + @Override + public void start() + { + if (!mInitialized) { + onMediaPlayerInfoNative(MEDIA_PLAYER_INVALID_STATE, 0, mID); + return; + } + + if (mApplicationContext == null) + return; + + if (mPreparing) + return; + + if (isPlaying()) + return; + + try { + super.start(); + Thread progressThread = new Thread(new ProgressWatcher()); + progressThread.start(); + } catch (final IllegalStateException e) { + reset(); + Log.d(TAG, e.getMessage()); + } + } + + @Override + public void pause() + { + if (!isPlaying()) + return; + + try { + super.pause(); + } catch (final IllegalStateException e) { + reset(); + Log.d(TAG, e.getMessage()); + } + } + + @Override + public void stop() + { + if (!mInitialized) + return; + + try { + super.stop(); + } catch (final IllegalStateException e) { + Log.d(TAG, e.getMessage()); + } finally { + reset(); + } + } + + @Override + public void seekTo(final int msec) + { + if (!mInitialized) + return; + + try { + super.seekTo(msec); + onMediaPlayerInfoNative(MEDIA_PLAYER_PROGRESS, msec, mID); + } catch (final IllegalStateException e) { + Log.d(TAG, e.getMessage()); + } + } + + @Override + public boolean isPlaying() + { + boolean playing = false; + + if (!mInitialized) + return playing; + + try { + playing = super.isPlaying(); + } catch (final IllegalStateException e) { + Log.d(TAG, e.getMessage()); + } + + return playing; + } + + public void setMediaPath(final String path) + { + if (mInitialized) + reset(); + + try { + mPreparing = true; + onMediaPlayerInfoNative(MEDIA_PLAYER_PREPARING, 0, mID); + mUri = Uri.parse(path); + setDataSource(mApplicationContext, mUri); + mInitialized = true; + setOnPreparedListener(new MediaPlayerPreparedListener()); + prepareAsync(); + } catch (final IOException e) { + mPreparing = false; + onErrorNative(MEDIA_ERROR_UNKNOWN, + /* MEDIA_ERROR_UNSUPPORTED= */ -1010, + mID); + } catch (final IllegalArgumentException e) { + Log.d(TAG, e.getMessage()); + } catch (final SecurityException e) { + Log.d(TAG, e.getMessage()); + } catch (final IllegalStateException e) { + Log.d(TAG, e.getMessage()); + } catch (final NullPointerException e) { + Log.d(TAG, e.getMessage()); + } + } + + @Override + public int getCurrentPosition() + { + int currentPosition = 0; + + if (!mInitialized) + return currentPosition; + + try { + currentPosition = super.getCurrentPosition(); + } catch (final IllegalStateException e) { + Log.d(TAG, e.getMessage()); + } + + return currentPosition; + } + + @Override + public int getDuration() + { + int duration = 0; + + if (!mInitialized) + return duration; + + try { + duration = super.getDuration(); + } catch (final IllegalStateException e) { + Log.d(TAG, e.getMessage()); + } + + return duration; + } + + private float adjustVolume(final int volume) + { + if (volume < 1) + return 0.0f; + + if (volume > 98) + return 1.0f; + + return (float) (1-(Math.log(100-volume)/Math.log(100))); + } + + public void setVolume(int volume) + { + if (volume < 0) + volume = 0; + + if (volume > 100) + volume = 100; + + float newVolume = adjustVolume(volume); + + try { + super.setVolume(newVolume, newVolume); + if (!mMuted) + mVolume = volume; + } catch (final IllegalStateException e) { + Log.d(TAG, e.getMessage()); + } + } + + public int getVolume() + { + return mVolume; + } + + public void mute(final boolean mute) + { + mMuted = mute; + setVolume(mute ? 0 : mVolume); + } + + public boolean isMuted() + { + return mMuted; + } + + @Override + public void reset() + { + mInitialized = false; + super.reset(); + } + +} diff --git a/src/plugins/android/jar/src/org/qtproject/qt5/android/multimedia/QtSurfaceTexture.java b/src/plugins/android/jar/src/org/qtproject/qt5/android/multimedia/QtSurfaceTexture.java new file mode 100644 index 00000000..b8837d55 --- /dev/null +++ b/src/plugins/android/jar/src/org/qtproject/qt5/android/multimedia/QtSurfaceTexture.java @@ -0,0 +1,74 @@ +/**************************************************************************** + ** + ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). + ** Contact: http://www.qt-project.org/legal + ** + ** This file is part of the QtMultimedia module of the Qt Toolkit. + ** + ** $QT_BEGIN_LICENSE:LGPL$ + ** Commercial License Usage + ** Licensees holding valid commercial Qt licenses may use this file in + ** accordance with the commercial license agreement provided with the + ** Software or, alternatively, in accordance with the terms contained in + ** a written agreement between you and Digia. For licensing terms and + ** conditions see http://qt.digia.com/licensing. For further information + ** use the contact form at http://qt.digia.com/contact-us. + ** + ** GNU Lesser General Public License Usage + ** Alternatively, this file may be used under the terms of the GNU Lesser + ** General Public License version 2.1 as published by the Free Software + ** Foundation and appearing in the file LICENSE.LGPL included in the + ** packaging of this file. Please review the following information to + ** ensure the GNU Lesser General Public License version 2.1 requirements + ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. + ** + ** In addition, as a special exception, Digia gives you certain additional + ** rights. These rights are described in the Digia Qt LGPL Exception + ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. + ** + ** GNU General Public License Usage + ** Alternatively, this file may be used under the terms of the GNU + ** General Public License version 3.0 as published by the Free Software + ** Foundation and appearing in the file LICENSE.GPL included in the + ** packaging of this file. Please review the following information to + ** ensure the GNU General Public License version 3.0 requirements will be + ** met: http://www.gnu.org/copyleft/gpl.html. + ** + ** + ** $QT_END_LICENSE$ + ** + ****************************************************************************/ + +package org.qtproject.qt5.android.multimedia; + +import android.graphics.SurfaceTexture; + +public class QtSurfaceTexture implements SurfaceTexture.OnFrameAvailableListener +{ + public SurfaceTexture surfaceTexture; + private int texID; + + public QtSurfaceTexture(int texName) + { + texID = texName; + surfaceTexture = new SurfaceTexture(texName); + surfaceTexture.setOnFrameAvailableListener(this); + } + + public void getTransformMatrix(float[] mtx) + { + surfaceTexture.getTransformMatrix(mtx); + } + + public void updateTexImage() + { + surfaceTexture.updateTexImage(); + } + + public void onFrameAvailable(SurfaceTexture surfaceTexture) + { + notifyFrameAvailable(texID); + } + + private static native void notifyFrameAvailable(int id); +} diff --git a/src/plugins/android/jar/src/org/qtproject/qt5/android/multimedia/QtSurfaceTextureHolder.java b/src/plugins/android/jar/src/org/qtproject/qt5/android/multimedia/QtSurfaceTextureHolder.java new file mode 100644 index 00000000..15c5f231 --- /dev/null +++ b/src/plugins/android/jar/src/org/qtproject/qt5/android/multimedia/QtSurfaceTextureHolder.java @@ -0,0 +1,114 @@ +/**************************************************************************** + ** + ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). + ** Contact: http://www.qt-project.org/legal + ** + ** This file is part of the QtMultimedia module of the Qt Toolkit. + ** + ** $QT_BEGIN_LICENSE:LGPL$ + ** Commercial License Usage + ** Licensees holding valid commercial Qt licenses may use this file in + ** accordance with the commercial license agreement provided with the + ** Software or, alternatively, in accordance with the terms contained in + ** a written agreement between you and Digia. For licensing terms and + ** conditions see http://qt.digia.com/licensing. For further information + ** use the contact form at http://qt.digia.com/contact-us. + ** + ** GNU Lesser General Public License Usage + ** Alternatively, this file may be used under the terms of the GNU Lesser + ** General Public License version 2.1 as published by the Free Software + ** Foundation and appearing in the file LICENSE.LGPL included in the + ** packaging of this file. Please review the following information to + ** ensure the GNU Lesser General Public License version 2.1 requirements + ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. + ** + ** In addition, as a special exception, Digia gives you certain additional + ** rights. These rights are described in the Digia Qt LGPL Exception + ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. + ** + ** GNU General Public License Usage + ** Alternatively, this file may be used under the terms of the GNU + ** General Public License version 3.0 as published by the Free Software + ** Foundation and appearing in the file LICENSE.GPL included in the + ** packaging of this file. Please review the following information to + ** ensure the GNU General Public License version 3.0 requirements will be + ** met: http://www.gnu.org/copyleft/gpl.html. + ** + ** + ** $QT_END_LICENSE$ + ** + ****************************************************************************/ + +package org.qtproject.qt5.android.multimedia; + +import android.view.SurfaceHolder; +import android.view.Surface; +import android.graphics.Rect; +import android.graphics.Canvas; + +public class QtSurfaceTextureHolder implements SurfaceHolder +{ + private Surface surfaceTexture; + + public QtSurfaceTextureHolder(Surface surface) + { + surfaceTexture = surface; + } + + public void addCallback(SurfaceHolder.Callback callback) + { + } + + public Surface getSurface() + { + return surfaceTexture; + } + + public Rect getSurfaceFrame() + { + return new Rect(); + } + + public boolean isCreating() + { + return false; + } + + public Canvas lockCanvas(Rect dirty) + { + return new Canvas(); + } + + public Canvas lockCanvas() + { + return new Canvas(); + } + + public void removeCallback(SurfaceHolder.Callback callback) + { + } + + public void setFixedSize(int width, int height) + { + } + + public void setFormat(int format) + { + } + + public void setKeepScreenOn(boolean screenOn) + { + } + + public void setSizeFromLayout() + { + } + + public void setType(int type) + { + } + + public void unlockCanvasAndPost(Canvas canvas) + { + } +} diff --git a/src/plugins/blackberry/mediaservice/blackberry_mediaservice.json b/src/plugins/android/mediaplayer/mediaplayer.json similarity index 100% rename from src/plugins/blackberry/mediaservice/blackberry_mediaservice.json rename to src/plugins/android/mediaplayer/mediaplayer.json diff --git a/src/plugins/android/mediaplayer/mediaplayer.pro b/src/plugins/android/mediaplayer/mediaplayer.pro new file mode 100644 index 00000000..cabe4c66 --- /dev/null +++ b/src/plugins/android/mediaplayer/mediaplayer.pro @@ -0,0 +1,24 @@ +TARGET = androidmediaplayer +QT += multimedia-private gui-private platformsupport-private network + +PLUGIN_TYPE = mediaservice +PLUGIN_CLASS_NAME = QAndroidMediaPlayerServicePlugin +load(qt_plugin) + +HEADERS += \ + qandroidmediaplayercontrol.h \ + qandroidmediaservice.h \ + qandroidmetadatareadercontrol.h \ + qandroidmediaserviceplugin.h \ + qandroidvideorendercontrol.h \ + qandroidvideooutput.h +SOURCES += \ + qandroidmediaplayercontrol.cpp \ + qandroidmediaservice.cpp \ + qandroidmetadatareadercontrol.cpp \ + qandroidmediaserviceplugin.cpp \ + qandroidvideorendercontrol.cpp + +OTHER_FILES += mediaplayer.json + +include (../wrappers/wrappers.pri) diff --git a/src/plugins/android/mediaplayer/qandroidmediaplayercontrol.cpp b/src/plugins/android/mediaplayer/qandroidmediaplayercontrol.cpp new file mode 100644 index 00000000..5a9c8b84 --- /dev/null +++ b/src/plugins/android/mediaplayer/qandroidmediaplayercontrol.cpp @@ -0,0 +1,496 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qandroidmediaplayercontrol.h" +#include "jmediaplayer.h" +#include "qandroidvideooutput.h" + +QT_BEGIN_NAMESPACE + +QAndroidMediaPlayerControl::QAndroidMediaPlayerControl(QObject *parent) + : QMediaPlayerControl(parent), + mMediaPlayer(new JMediaPlayer), + mCurrentState(QMediaPlayer::StoppedState), + mCurrentMediaStatus(QMediaPlayer::NoMedia), + mMediaStream(0), + mVideoOutput(0), + mSeekable(true), + mBufferPercent(-1), + mAudioAvailable(false), + mVideoAvailable(false), + mBuffering(false), + mMediaPlayerReady(false), + mPendingPosition(-1) +{ + connect(mMediaPlayer, SIGNAL(bufferingUpdate(qint32)), + this, SLOT(onBufferChanged(qint32))); + connect(mMediaPlayer, SIGNAL(info(qint32, qint32)), + this, SLOT(onInfo(qint32, qint32))); + connect(mMediaPlayer, SIGNAL(error(qint32, qint32)), + this, SLOT(onError(qint32, qint32))); + connect(mMediaPlayer, SIGNAL(mediaPlayerInfo(qint32, qint32)), + this, SLOT(onMediaPlayerInfo(qint32, qint32))); + connect(mMediaPlayer, SIGNAL(videoSizeChanged(qint32,qint32)), + this, SLOT(onVideoSizeChanged(qint32,qint32))); +} + +QAndroidMediaPlayerControl::~QAndroidMediaPlayerControl() +{ + delete mMediaPlayer; +} + +QMediaPlayer::State QAndroidMediaPlayerControl::state() const +{ + return mCurrentState; +} + +QMediaPlayer::MediaStatus QAndroidMediaPlayerControl::mediaStatus() const +{ + return mCurrentMediaStatus; +} + +qint64 QAndroidMediaPlayerControl::duration() const +{ + return (mCurrentMediaStatus == QMediaPlayer::InvalidMedia + || mCurrentMediaStatus == QMediaPlayer::NoMedia) ? 0 + : mMediaPlayer->getDuration(); +} + +qint64 QAndroidMediaPlayerControl::position() const +{ + if (!mMediaPlayerReady) + return mPendingPosition < 0 ? 0 : mPendingPosition; + + return mMediaPlayer->getCurrentPosition(); +} + +void QAndroidMediaPlayerControl::setPosition(qint64 position) +{ + if (!mSeekable) + return; + + const int seekPosition = (position > INT_MAX) ? INT_MAX : position; + + if (!mMediaPlayerReady) { + mPendingPosition = seekPosition; + Q_EMIT positionChanged(seekPosition); + return; + } + + mMediaPlayer->seekTo(seekPosition); + mPendingPosition = -1; +} + +int QAndroidMediaPlayerControl::volume() const +{ + return mMediaPlayer->volume(); +} + +void QAndroidMediaPlayerControl::setVolume(int volume) +{ + mMediaPlayer->setVolume(volume); + Q_EMIT volumeChanged(volume); +} + +bool QAndroidMediaPlayerControl::isMuted() const +{ + return mMediaPlayer->isMuted(); +} + +void QAndroidMediaPlayerControl::setMuted(bool muted) +{ + mMediaPlayer->setMuted(muted); + Q_EMIT mutedChanged(muted); +} + +int QAndroidMediaPlayerControl::bufferStatus() const +{ + return mBufferPercent; +} + +bool QAndroidMediaPlayerControl::isAudioAvailable() const +{ + return mAudioAvailable; +} + +bool QAndroidMediaPlayerControl::isVideoAvailable() const +{ + return mVideoAvailable; +} + +bool QAndroidMediaPlayerControl::isSeekable() const +{ + return mSeekable; +} + +QMediaTimeRange QAndroidMediaPlayerControl::availablePlaybackRanges() const +{ + return mAvailablePlaybackRange; +} + +void QAndroidMediaPlayerControl::updateAvailablePlaybackRanges() +{ + if (mBuffering) { + const qint64 pos = position(); + const qint64 end = (duration() / 100) * mBufferPercent; + mAvailablePlaybackRange.addInterval(pos, end); + } else if (mSeekable) { + mAvailablePlaybackRange = QMediaTimeRange(0, duration()); + } else { + mAvailablePlaybackRange = QMediaTimeRange(); + } + + Q_EMIT availablePlaybackRangesChanged(mAvailablePlaybackRange); +} + +qreal QAndroidMediaPlayerControl::playbackRate() const +{ + return 1.0f; +} + +void QAndroidMediaPlayerControl::setPlaybackRate(qreal rate) +{ + Q_UNUSED(rate); +} + +QMediaContent QAndroidMediaPlayerControl::media() const +{ + return mMediaContent; +} + +const QIODevice *QAndroidMediaPlayerControl::mediaStream() const +{ + return mMediaStream; +} + +void QAndroidMediaPlayerControl::setMedia(const QMediaContent &mediaContent, + QIODevice *stream) +{ + mMediaContent = mediaContent; + mMediaStream = stream; + + const QString uri = mediaContent.canonicalUrl().toString(); + + if (!uri.isEmpty()) + mMediaPlayer->setDataSource(uri); + else + setMediaStatus(QMediaPlayer::NoMedia); + + Q_EMIT mediaChanged(mMediaContent); + + resetBufferingProgress(); + + // reset some properties + setAudioAvailable(false); + setVideoAvailable(false); + setSeekable(true); +} + +void QAndroidMediaPlayerControl::setVideoOutput(QAndroidVideoOutput *videoOutput) +{ + if (mVideoOutput) + mVideoOutput->stop(); + + mVideoOutput = videoOutput; +} + +void QAndroidMediaPlayerControl::play() +{ + if (!mMediaPlayerReady) { + mPendingState = QMediaPlayer::PlayingState; + if (mCurrentState == QMediaPlayer::StoppedState + && !mMediaContent.isNull() + && mCurrentMediaStatus != QMediaPlayer::LoadingMedia) { + setMedia(mMediaContent, 0); + } + return; + } + + mMediaPlayer->play(); + setState(QMediaPlayer::PlayingState); +} + +void QAndroidMediaPlayerControl::pause() +{ + if (!mMediaPlayerReady) { + mPendingState = QMediaPlayer::PausedState; + return; + } + + mMediaPlayer->pause(); + setState(QMediaPlayer::PausedState); +} + +void QAndroidMediaPlayerControl::stop() +{ + mMediaPlayer->stop(); + setState(QMediaPlayer::StoppedState); +} + +void QAndroidMediaPlayerControl::onInfo(qint32 what, qint32 extra) +{ + Q_UNUSED(extra); + switch (what) { + case JMediaPlayer::MEDIA_INFO_UNKNOWN: + break; + case JMediaPlayer::MEDIA_INFO_VIDEO_TRACK_LAGGING: + // IGNORE + break; + case JMediaPlayer::MEDIA_INFO_VIDEO_RENDERING_START: + break; + case JMediaPlayer::MEDIA_INFO_BUFFERING_START: + mPendingState = mCurrentState; + setState(QMediaPlayer::PausedState); + setMediaStatus(QMediaPlayer::StalledMedia); + break; + case JMediaPlayer::MEDIA_INFO_BUFFERING_END: + setMediaStatus(mBufferPercent == 100 ? QMediaPlayer::BufferedMedia : QMediaPlayer::BufferingMedia); + flushPendingStates(); + break; + case JMediaPlayer::MEDIA_INFO_BAD_INTERLEAVING: + break; + case JMediaPlayer::MEDIA_INFO_NOT_SEEKABLE: + setSeekable(false); + break; + case JMediaPlayer::MEDIA_INFO_METADATA_UPDATE: + Q_EMIT metaDataUpdated(); + break; + } +} + +void QAndroidMediaPlayerControl::onMediaPlayerInfo(qint32 what, qint32 extra) +{ + switch (what) { + case JMediaPlayer::MEDIA_PLAYER_INVALID_STATE: + setError(what, QStringLiteral("Error: Invalid state")); + break; + case JMediaPlayer::MEDIA_PLAYER_PREPARING: + setMediaStatus(QMediaPlayer::LoadingMedia); + setState(QMediaPlayer::StoppedState); + break; + case JMediaPlayer::MEDIA_PLAYER_READY: + if (mBuffering) { + setMediaStatus(mBufferPercent == 100 ? QMediaPlayer::BufferedMedia + : QMediaPlayer::BufferingMedia); + } else { + setMediaStatus(QMediaPlayer::LoadedMedia); + mBufferPercent = 100; + Q_EMIT bufferStatusChanged(mBufferPercent); + updateAvailablePlaybackRanges(); + } + setAudioAvailable(true); + mMediaPlayerReady = true; + flushPendingStates(); + break; + case JMediaPlayer::MEDIA_PLAYER_DURATION: + Q_EMIT durationChanged(extra); + break; + case JMediaPlayer::MEDIA_PLAYER_PROGRESS: + Q_EMIT positionChanged(extra); + break; + case JMediaPlayer::MEDIA_PLAYER_FINISHED: + setState(QMediaPlayer::StoppedState); + setMediaStatus(QMediaPlayer::EndOfMedia); + break; + } +} + +void QAndroidMediaPlayerControl::onError(qint32 what, qint32 extra) +{ + QString errorString; + QMediaPlayer::Error error = QMediaPlayer::ResourceError; + + switch (what) { + case JMediaPlayer::MEDIA_ERROR_UNKNOWN: + errorString = QLatin1String("Error:"); + break; + case JMediaPlayer::MEDIA_ERROR_SERVER_DIED: + errorString = QLatin1String("Error: Server died"); + error = QMediaPlayer::ServiceMissingError; + break; + } + + switch (extra) { + case JMediaPlayer::MEDIA_ERROR_IO: // Network OR file error + errorString += QLatin1String(" (I/O operation failed)"); + error = QMediaPlayer::NetworkError; + setMediaStatus(QMediaPlayer::InvalidMedia); + break; + case JMediaPlayer::MEDIA_ERROR_MALFORMED: + errorString += QLatin1String(" (Malformed bitstream)"); + error = QMediaPlayer::FormatError; + setMediaStatus(QMediaPlayer::InvalidMedia); + break; + case JMediaPlayer::MEDIA_ERROR_UNSUPPORTED: + errorString += QLatin1String(" (Unsupported media)"); + error = QMediaPlayer::FormatError; + setMediaStatus(QMediaPlayer::InvalidMedia); + break; + case JMediaPlayer::MEDIA_ERROR_TIMED_OUT: + errorString += QLatin1String(" (Timed out)"); + break; + case JMediaPlayer::MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK: + errorString += QLatin1String(" (Unable to start progressive playback')"); + error = QMediaPlayer::FormatError; + setMediaStatus(QMediaPlayer::InvalidMedia); + break; + } + + setError(error, errorString); +} + +void QAndroidMediaPlayerControl::onBufferChanged(qint32 percent) +{ + mBuffering = true; + mBufferPercent = percent; + Q_EMIT bufferStatusChanged(mBufferPercent); + + updateAvailablePlaybackRanges(); + + if (mBufferPercent == 100) + setMediaStatus(QMediaPlayer::BufferedMedia); +} + +void QAndroidMediaPlayerControl::onVideoSizeChanged(qint32 width, qint32 height) +{ + if (width == 0 || height == 0) + return; + + setVideoAvailable(true); + + if (mVideoOutput) { + if (!mMediaPlayer->display()) + mMediaPlayer->setDisplay(mVideoOutput->surfaceHolder()); + if (mMediaPlayer->display()) + mVideoOutput->setVideoSize(QSize(width, height)); + } +} + +void QAndroidMediaPlayerControl::setState(QMediaPlayer::State state) +{ + if (mCurrentState == state) + return; + + if (state == QMediaPlayer::StoppedState) { + if (mVideoOutput) + mVideoOutput->stop(); + resetBufferingProgress(); + mMediaPlayerReady = false; + mPendingPosition = -1; + Q_EMIT positionChanged(0); + } + + mCurrentState = state; + Q_EMIT stateChanged(mCurrentState); +} + +void QAndroidMediaPlayerControl::setMediaStatus(QMediaPlayer::MediaStatus status) +{ + if (mCurrentMediaStatus == status) + return; + + if (status == QMediaPlayer::NoMedia || status == QMediaPlayer::InvalidMedia) + Q_EMIT durationChanged(0); + + mCurrentMediaStatus = status; + Q_EMIT mediaStatusChanged(mCurrentMediaStatus); +} + +void QAndroidMediaPlayerControl::setError(int error, + const QString &errorString) +{ + setState(QMediaPlayer::StoppedState); + Q_EMIT QMediaPlayerControl::error(error, errorString); +} + +void QAndroidMediaPlayerControl::setSeekable(bool seekable) +{ + if (mSeekable == seekable) + return; + + mSeekable = seekable; + Q_EMIT seekableChanged(mSeekable); +} + +void QAndroidMediaPlayerControl::setAudioAvailable(bool available) +{ + if (mAudioAvailable == available) + return; + + mAudioAvailable = available; + Q_EMIT audioAvailableChanged(mAudioAvailable); +} + +void QAndroidMediaPlayerControl::setVideoAvailable(bool available) +{ + if (mVideoAvailable == available) + return; + + mVideoAvailable = available; + Q_EMIT videoAvailableChanged(mVideoAvailable); +} + +void QAndroidMediaPlayerControl::resetBufferingProgress() +{ + mBuffering = false; + mBufferPercent = 0; + mAvailablePlaybackRange = QMediaTimeRange(); + Q_EMIT bufferStatusChanged(mBufferPercent); +} + +void QAndroidMediaPlayerControl::flushPendingStates() +{ + switch (mPendingState) { + case QMediaPlayer::PlayingState: + if (mPendingPosition > -1) + setPosition(mPendingPosition); + play(); + break; + case QMediaPlayer::PausedState: + pause(); + break; + case QMediaPlayer::StoppedState: + stop(); + break; + } +} + +QT_END_NAMESPACE diff --git a/src/plugins/android/mediaplayer/qandroidmediaplayercontrol.h b/src/plugins/android/mediaplayer/qandroidmediaplayercontrol.h new file mode 100644 index 00000000..445e8de7 --- /dev/null +++ b/src/plugins/android/mediaplayer/qandroidmediaplayercontrol.h @@ -0,0 +1,127 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QANDROIDMEDIAPLAYERCONTROL_H +#define QANDROIDMEDIAPLAYERCONTROL_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class JMediaPlayer; +class QAndroidVideoOutput; + +class QAndroidMediaPlayerControl : public QMediaPlayerControl +{ + Q_OBJECT +public: + explicit QAndroidMediaPlayerControl(QObject *parent = 0); + ~QAndroidMediaPlayerControl() Q_DECL_OVERRIDE; + + QMediaPlayer::State state() const Q_DECL_OVERRIDE; + QMediaPlayer::MediaStatus mediaStatus() const Q_DECL_OVERRIDE; + qint64 duration() const Q_DECL_OVERRIDE; + qint64 position() const Q_DECL_OVERRIDE; + int volume() const Q_DECL_OVERRIDE; + bool isMuted() const Q_DECL_OVERRIDE; + int bufferStatus() const Q_DECL_OVERRIDE; + bool isAudioAvailable() const Q_DECL_OVERRIDE; + bool isVideoAvailable() const Q_DECL_OVERRIDE; + bool isSeekable() const Q_DECL_OVERRIDE; + QMediaTimeRange availablePlaybackRanges() const Q_DECL_OVERRIDE; + qreal playbackRate() const Q_DECL_OVERRIDE; + void setPlaybackRate(qreal rate) Q_DECL_OVERRIDE; + QMediaContent media() const Q_DECL_OVERRIDE; + const QIODevice *mediaStream() const Q_DECL_OVERRIDE; + void setMedia(const QMediaContent &mediaContent, QIODevice *stream) Q_DECL_OVERRIDE; + + void setVideoOutput(QAndroidVideoOutput *videoOutput); + +Q_SIGNALS: + void metaDataUpdated(); + +public Q_SLOTS: + void setPosition(qint64 position) Q_DECL_OVERRIDE; + void play() Q_DECL_OVERRIDE; + void pause() Q_DECL_OVERRIDE; + void stop() Q_DECL_OVERRIDE; + void setVolume(int volume) Q_DECL_OVERRIDE; + void setMuted(bool muted) Q_DECL_OVERRIDE; + +private Q_SLOTS: + void onError(qint32 what, qint32 extra); + void onInfo(qint32 what, qint32 extra); + void onMediaPlayerInfo(qint32 what, qint32 extra); + void onBufferChanged(qint32 percent); + void onVideoSizeChanged(qint32 width, qint32 height); + +private: + JMediaPlayer *mMediaPlayer; + QMediaPlayer::State mCurrentState; + QMediaPlayer::MediaStatus mCurrentMediaStatus; + QMediaContent mMediaContent; + QIODevice *mMediaStream; + QAndroidVideoOutput *mVideoOutput; + bool mSeekable; + int mBufferPercent; + bool mAudioAvailable; + bool mVideoAvailable; + bool mBuffering; + QMediaTimeRange mAvailablePlaybackRange; + bool mMediaPlayerReady; + QMediaPlayer::State mPendingState; + qint64 mPendingPosition; + + void setState(QMediaPlayer::State state); + void setMediaStatus(QMediaPlayer::MediaStatus status); + void setError(int error, const QString &errorString); + void setSeekable(bool seekable); + void setAudioAvailable(bool available); + void setVideoAvailable(bool available); + void updateAvailablePlaybackRanges(); + void resetBufferingProgress(); + void flushPendingStates(); +}; + +QT_END_NAMESPACE + +#endif // QANDROIDMEDIAPLAYERCONTROL_H diff --git a/src/plugins/android/mediaplayer/qandroidmediaservice.cpp b/src/plugins/android/mediaplayer/qandroidmediaservice.cpp new file mode 100644 index 00000000..17595867 --- /dev/null +++ b/src/plugins/android/mediaplayer/qandroidmediaservice.cpp @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qandroidmediaservice.h" + +#include "qandroidmediaplayercontrol.h" +#include "qandroidmetadatareadercontrol.h" +#include "qandroidvideorendercontrol.h" + +QT_BEGIN_NAMESPACE + +QAndroidMediaService::QAndroidMediaService(QObject *parent) + : QMediaService(parent) + , mVideoRendererControl(0) +{ + mMediaControl = new QAndroidMediaPlayerControl; + mMetadataControl = new QAndroidMetaDataReaderControl; + connect(mMediaControl, SIGNAL(mediaChanged(QMediaContent)), + mMetadataControl, SLOT(onMediaChanged(QMediaContent))); + connect(mMediaControl, SIGNAL(metaDataUpdated()), + mMetadataControl, SLOT(onUpdateMetaData())); +} + +QAndroidMediaService::~QAndroidMediaService() +{ + delete mMediaControl; + delete mMetadataControl; + delete mVideoRendererControl; +} + +QMediaControl *QAndroidMediaService::requestControl(const char *name) +{ + if (qstrcmp(name, QMediaPlayerControl_iid) == 0) + return mMediaControl; + + if (qstrcmp(name, QMetaDataReaderControl_iid) == 0) + return mMetadataControl; + + if (qstrcmp(name, QVideoRendererControl_iid) == 0) { + if (!mVideoRendererControl) { + mVideoRendererControl = new QAndroidVideoRendererControl; + mMediaControl->setVideoOutput(mVideoRendererControl); + return mVideoRendererControl; + } + } + + return 0; +} + +void QAndroidMediaService::releaseControl(QMediaControl *control) +{ + if (control == mVideoRendererControl) { + mMediaControl->setVideoOutput(0); + delete mVideoRendererControl; + mVideoRendererControl = 0; + } +} + +QT_END_NAMESPACE diff --git a/src/plugins/android/mediaplayer/qandroidmediaservice.h b/src/plugins/android/mediaplayer/qandroidmediaservice.h new file mode 100644 index 00000000..4d310e8e --- /dev/null +++ b/src/plugins/android/mediaplayer/qandroidmediaservice.h @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QANDROIDMEDIASERVICE_H +#define QANDROIDMEDIASERVICE_H + +#include + +QT_BEGIN_NAMESPACE + +class QAndroidMediaPlayerControl; +class QAndroidMetaDataReaderControl; +class QAndroidVideoRendererControl; + +class QAndroidMediaService : public QMediaService +{ + Q_OBJECT +public: + explicit QAndroidMediaService(QObject *parent = 0); + ~QAndroidMediaService() Q_DECL_OVERRIDE; + + QMediaControl* requestControl(const char *name) Q_DECL_OVERRIDE; + void releaseControl(QMediaControl *control) Q_DECL_OVERRIDE; + +private: + QAndroidMediaPlayerControl *mMediaControl; + QAndroidMetaDataReaderControl *mMetadataControl; + QAndroidVideoRendererControl *mVideoRendererControl; +}; + +QT_END_NAMESPACE + +#endif // QANDROIDMEDIASERVICE_H diff --git a/src/plugins/android/mediaplayer/qandroidmediaserviceplugin.cpp b/src/plugins/android/mediaplayer/qandroidmediaserviceplugin.cpp new file mode 100644 index 00000000..3bf70341 --- /dev/null +++ b/src/plugins/android/mediaplayer/qandroidmediaserviceplugin.cpp @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qandroidmediaserviceplugin.h" + +#include "qandroidmediaservice.h" +#include "jmediaplayer.h" +#include "jsurfacetexture.h" +#include "jsurfacetextureholder.h" +#include + +QT_BEGIN_NAMESPACE + +QAndroidMediaServicePlugin::QAndroidMediaServicePlugin() +{ +} + +QAndroidMediaServicePlugin::~QAndroidMediaServicePlugin() +{ +} + +QMediaService *QAndroidMediaServicePlugin::create(const QString &key) +{ + if (key == QStringLiteral(Q_MEDIASERVICE_MEDIAPLAYER)) + return new QAndroidMediaService; + + qWarning() << "Android service plugin: unsupported key:" << key; + return 0; +} + +void QAndroidMediaServicePlugin::release(QMediaService *service) +{ + delete service; +} + +QMediaServiceProviderHint::Features QAndroidMediaServicePlugin::supportedFeatures(const QByteArray &service) const +{ + if (service == Q_MEDIASERVICE_MEDIAPLAYER) + return QMediaServiceProviderHint::VideoSurface; + + return QMediaServiceProviderHint::Features(); +} + + +Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void * /*reserved*/) +{ + typedef union { + JNIEnv *nativeEnvironment; + void *venv; + } UnionJNIEnvToVoid; + + UnionJNIEnvToVoid uenv; + uenv.venv = NULL; + + if (vm->GetEnv(&uenv.venv, JNI_VERSION_1_4) != JNI_OK) + return JNI_ERR; + + JNIEnv *jniEnv = uenv.nativeEnvironment; + + if (!JMediaPlayer::initJNI(jniEnv) || + !JSurfaceTexture::initJNI(jniEnv) || + !JSurfaceTextureHolder::initJNI(jniEnv)) { + return JNI_ERR; + } + + return JNI_VERSION_1_4; +} + +QT_END_NAMESPACE diff --git a/src/plugins/android/mediaplayer/qandroidmediaserviceplugin.h b/src/plugins/android/mediaplayer/qandroidmediaserviceplugin.h new file mode 100644 index 00000000..d004635f --- /dev/null +++ b/src/plugins/android/mediaplayer/qandroidmediaserviceplugin.h @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QANDROIDMEDIASERVICEPLUGIN_H +#define QANDROIDMEDIASERVICEPLUGIN_H + +#include + +QT_BEGIN_NAMESPACE + +class QMediaService; +class QAndroidMediaService; + +class QAndroidMediaServicePlugin + : public QMediaServiceProviderPlugin + , public QMediaServiceFeaturesInterface +{ + Q_OBJECT + Q_INTERFACES(QMediaServiceFeaturesInterface) + Q_PLUGIN_METADATA(IID "org.qt-project.qt.mediaserviceproviderfactory/5.0" + FILE "mediaplayer.json") + +public: + QAndroidMediaServicePlugin(); + ~QAndroidMediaServicePlugin(); + + QMediaService* create(QString const& key) Q_DECL_OVERRIDE; + void release(QMediaService *service) Q_DECL_OVERRIDE; + QMediaServiceProviderHint::Features supportedFeatures(const QByteArray &service) const Q_DECL_OVERRIDE; +}; + +QT_END_NAMESPACE + +#endif // QANDROIDMEDIASERVICEPLUGIN_H diff --git a/src/plugins/android/mediaplayer/qandroidmetadatareadercontrol.cpp b/src/plugins/android/mediaplayer/qandroidmetadatareadercontrol.cpp new file mode 100644 index 00000000..9b2f4e17 --- /dev/null +++ b/src/plugins/android/mediaplayer/qandroidmetadatareadercontrol.cpp @@ -0,0 +1,221 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qandroidmetadatareadercontrol.h" + +#include "jmediametadataretriever.h" +#include +#include + +QT_BEGIN_NAMESPACE + +// Genre name ordered by ID +// see: http://id3.org/id3v2.3.0#Appendix_A_-_Genre_List_from_ID3v1 +static const char* qt_ID3GenreNames[] = +{ + "Blues", "Classic Rock", "Country", "Dance", "Disco", "Funk", "Grunge", "Hip-Hop", "Jazz", + "Metal", "New Age", "Oldies", "Other", "Pop", "R&B", "Rap", "Reggae", "Rock", "Techno", + "Industrial", "Alternative", "Ska", "Death Metal", "Pranks", "Soundtrack", "Euro-Techno", + "Ambient", "Trip-Hop", "Vocal", "Jazz+Funk", "Fusion", "Trance", "Classical", "Instrumental", + "Acid", "House", "Game", "Sound Clip", "Gospel", "Noise", "AlternRock", "Bass", "Soul", "Punk", + "Space", "Meditative", "Instrumental Pop", "Instrumental Rock", "Ethnic", "Gothic", "Darkwave", + "Techno-Industrial", "Electronic", "Pop-Folk", "Eurodance", "Dream", "Southern Rock", "Comedy", + "Cult", "Gangsta", "Top 40", "Christian Rap", "Pop/Funk", "Jungle", "Native American", + "Cabaret", "New Wave", "Psychadelic", "Rave", "Showtunes", "Trailer", "Lo-Fi", "Tribal", + "Acid Punk", "Acid Jazz", "Polka", "Retro", "Musical", "Rock & Roll", "Hard Rock", "Folk", + "Folk-Rock", "National Folk", "Swing", "Fast Fusion", "Bebob", "Latin", "Revival", "Celtic", + "Bluegrass", "Avantgarde", "Gothic Rock", "Progressive Rock", "Psychedelic Rock", + "Symphonic Rock", "Slow Rock", "Big Band", "Chorus", "Easy Listening", "Acoustic", "Humour", + "Speech", "Chanson", "Opera", "Chamber Music", "Sonata", "Symphony", "Booty Bass", "Primus", + "Porn Groove", "Satire", "Slow Jam", "Club", "Tango", "Samba", "Folklore", "Ballad", + "Power Ballad", "Rhythmic Soul", "Freestyle", "Duet", "Punk Rock", "Drum Solo", "A capella", + "Euro-House", "Dance Hall" +}; + +QAndroidMetaDataReaderControl::QAndroidMetaDataReaderControl(QObject *parent) + : QMetaDataReaderControl(parent) + , m_available(false) + , m_retriever(0) +{ + m_retriever = new JMediaMetadataRetriever; + if (!m_retriever->isValid()) { + delete m_retriever; + m_retriever = 0; + } +} + +QAndroidMetaDataReaderControl::~QAndroidMetaDataReaderControl() +{ + if (m_retriever) { + m_retriever->release(); + delete m_retriever; + } +} + +bool QAndroidMetaDataReaderControl::isMetaDataAvailable() const +{ + return m_available; +} + +QVariant QAndroidMetaDataReaderControl::metaData(const QString &key) const +{ + return m_metadata.value(key); +} + +QStringList QAndroidMetaDataReaderControl::availableMetaData() const +{ + return m_metadata.keys(); +} + +void QAndroidMetaDataReaderControl::onMediaChanged(const QMediaContent &media) +{ + if (!m_retriever) + return; + + m_mediaContent = media; + updateData(); +} + +void QAndroidMetaDataReaderControl::onUpdateMetaData() +{ + if (!m_retriever || m_mediaContent.isNull()) + return; + + updateData(); +} + +void QAndroidMetaDataReaderControl::updateData() +{ + m_metadata.clear(); + + if (!m_mediaContent.isNull()) { + if (m_retriever->setDataSource(m_mediaContent.canonicalUrl())) { + QString mimeType = m_retriever->extractMetadata(JMediaMetadataRetriever::MimeType); + if (!mimeType.isNull()) + m_metadata.insert(QMediaMetaData::MediaType, mimeType); + + bool isVideo = !m_retriever->extractMetadata(JMediaMetadataRetriever::HasVideo).isNull() + || mimeType.startsWith(QStringLiteral("video")); + + QString string = m_retriever->extractMetadata(JMediaMetadataRetriever::Album); + if (!string.isNull()) + m_metadata.insert(QMediaMetaData::AlbumTitle, string); + + string = m_retriever->extractMetadata(JMediaMetadataRetriever::AlbumArtist); + if (!string.isNull()) + m_metadata.insert(QMediaMetaData::AlbumArtist, string); + + string = m_retriever->extractMetadata(JMediaMetadataRetriever::Artist); + if (!string.isNull()) { + m_metadata.insert(isVideo ? QMediaMetaData::LeadPerformer + : QMediaMetaData::ContributingArtist, + string.split('/', QString::SkipEmptyParts)); + } + + string = m_retriever->extractMetadata(JMediaMetadataRetriever::Author); + if (!string.isNull()) + m_metadata.insert(QMediaMetaData::Author, string.split('/', QString::SkipEmptyParts)); + + string = m_retriever->extractMetadata(JMediaMetadataRetriever::Bitrate); + if (!string.isNull()) { + m_metadata.insert(isVideo ? QMediaMetaData::VideoBitRate + : QMediaMetaData::AudioBitRate, + string.toInt()); + } + + string = m_retriever->extractMetadata(JMediaMetadataRetriever::CDTrackNumber); + if (!string.isNull()) + m_metadata.insert(QMediaMetaData::TrackNumber, string.toInt()); + + string = m_retriever->extractMetadata(JMediaMetadataRetriever::Composer); + if (!string.isNull()) + m_metadata.insert(QMediaMetaData::Composer, string.split('/', QString::SkipEmptyParts)); + + string = m_retriever->extractMetadata(JMediaMetadataRetriever::Date); + if (!string.isNull()) + m_metadata.insert(QMediaMetaData::Date, QDateTime::fromString(string, QStringLiteral("yyyyMMddTHHmmss.zzzZ")).date()); + + string = m_retriever->extractMetadata(JMediaMetadataRetriever::Duration); + if (!string.isNull()) + m_metadata.insert(QMediaMetaData::Duration, string.toLongLong()); + + string = m_retriever->extractMetadata(JMediaMetadataRetriever::Genre); + if (!string.isNull()) { + // The genre can be returned as an ID3v2 id, get the name for it in that case + if (string.startsWith('(') && string.endsWith(')')) { + bool ok = false; + int genreId = string.mid(1, string.length() - 2).toInt(&ok); + if (ok && genreId >= 0 && genreId <= 125) + string = QLatin1String(qt_ID3GenreNames[genreId]); + } + m_metadata.insert(QMediaMetaData::Genre, string); + } + + string = m_retriever->extractMetadata(JMediaMetadataRetriever::Title); + if (!string.isNull()) + m_metadata.insert(QMediaMetaData::Title, string); + + string = m_retriever->extractMetadata(JMediaMetadataRetriever::VideoHeight); + if (!string.isNull()) { + int height = string.toInt(); + int width = m_retriever->extractMetadata(JMediaMetadataRetriever::VideoWidth).toInt(); + m_metadata.insert(QMediaMetaData::Resolution, QSize(width, height)); + } + + string = m_retriever->extractMetadata(JMediaMetadataRetriever::Writer); + if (!string.isNull()) + m_metadata.insert(QMediaMetaData::Writer, string.split('/', QString::SkipEmptyParts)); + + string = m_retriever->extractMetadata(JMediaMetadataRetriever::Year); + if (!string.isNull()) + m_metadata.insert(QMediaMetaData::Year, string.toInt()); + } + } + + bool oldAvailable = m_available; + m_available = !m_metadata.isEmpty(); + if (m_available != oldAvailable) + Q_EMIT metaDataAvailableChanged(m_available); + + Q_EMIT metaDataChanged(); +} + +QT_END_NAMESPACE diff --git a/src/plugins/android/mediaplayer/qandroidmetadatareadercontrol.h b/src/plugins/android/mediaplayer/qandroidmetadatareadercontrol.h new file mode 100644 index 00000000..7ea736ff --- /dev/null +++ b/src/plugins/android/mediaplayer/qandroidmetadatareadercontrol.h @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QANDROIDMETADATAREADERCONTROL_H +#define QANDROIDMETADATAREADERCONTROL_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class JMediaMetadataRetriever; + +class QAndroidMetaDataReaderControl : public QMetaDataReaderControl +{ + Q_OBJECT +public: + explicit QAndroidMetaDataReaderControl(QObject *parent = 0); + ~QAndroidMetaDataReaderControl() Q_DECL_OVERRIDE; + + bool isMetaDataAvailable() const Q_DECL_OVERRIDE; + + QVariant metaData(const QString &key) const Q_DECL_OVERRIDE; + QStringList availableMetaData() const Q_DECL_OVERRIDE; + +public Q_SLOTS: + void onMediaChanged(const QMediaContent &media); + void onUpdateMetaData(); + +private: + void updateData(); + + QMediaContent m_mediaContent; + bool m_available; + QVariantMap m_metadata; + + JMediaMetadataRetriever *m_retriever; +}; + +QT_END_NAMESPACE + +#endif // QANDROIDMETADATAREADERCONTROL_H diff --git a/src/plugins/android/mediaplayer/qandroidvideooutput.h b/src/plugins/android/mediaplayer/qandroidvideooutput.h new file mode 100644 index 00000000..99db7c3e --- /dev/null +++ b/src/plugins/android/mediaplayer/qandroidvideooutput.h @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QANDROIDVIDEOOUTPUT_H +#define QANDROIDVIDEOOUTPUT_H + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QAndroidVideoOutput +{ +public: + QAndroidVideoOutput() { } + virtual ~QAndroidVideoOutput() { } + + virtual jobject surfaceHolder() = 0; + virtual void setVideoSize(const QSize &size) = 0; + virtual void stop() = 0; +}; + +QT_END_NAMESPACE + +#endif // QANDROIDVIDEOOUTPUT_H diff --git a/src/plugins/android/mediaplayer/qandroidvideorendercontrol.cpp b/src/plugins/android/mediaplayer/qandroidvideorendercontrol.cpp new file mode 100644 index 00000000..7b810fa4 --- /dev/null +++ b/src/plugins/android/mediaplayer/qandroidvideorendercontrol.cpp @@ -0,0 +1,375 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qandroidvideorendercontrol.h" + +#include +#include "jsurfacetextureholder.h" +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +static const GLfloat g_vertex_data[] = { + -1.f, 1.f, + 1.f, 1.f, + 1.f, -1.f, + -1.f, -1.f +}; + +static const GLfloat g_texture_data[] = { + 0.f, 0.f, + 1.f, 0.f, + 1.f, 1.f, + 0.f, 1.f +}; + +class TextureVideoBuffer : public QAbstractVideoBuffer +{ +public: + TextureVideoBuffer(GLuint textureId) + : QAbstractVideoBuffer(GLTextureHandle) + , m_textureId(textureId) + {} + + virtual ~TextureVideoBuffer() {} + + MapMode mapMode() const { return NotMapped; } + uchar *map(MapMode, int*, int*) { return 0; } + void unmap() {} + + QVariant handle() const + { + return QVariant::fromValue(m_textureId); + } + +private: + GLuint m_textureId; +}; + +class ImageVideoBuffer : public QAbstractVideoBuffer +{ +public: + ImageVideoBuffer(const QImage &image) + : QAbstractVideoBuffer(NoHandle) + , m_image(image) + , m_mode(NotMapped) + { + + } + + MapMode mapMode() const { return m_mode; } + uchar *map(MapMode mode, int *, int *) + { + if (mode != NotMapped && m_mode == NotMapped) { + m_mode = mode; + return m_image.bits(); + } + + return 0; + } + + void unmap() + { + m_mode = NotMapped; + } + +private: + QImage m_image; + MapMode m_mode; +}; + +QAndroidVideoRendererControl::QAndroidVideoRendererControl(QObject *parent) + : QVideoRendererControl(parent) + , m_surface(0) + , m_offscreenSurface(0) + , m_glContext(0) + , m_fbo(0) + , m_program(0) + , m_useImage(false) + , m_androidSurface(0) + , m_surfaceTexture(0) + , m_surfaceHolder(0) + , m_externalTex(0) +{ +} + +QAndroidVideoRendererControl::~QAndroidVideoRendererControl() +{ + if (m_glContext) + m_glContext->makeCurrent(m_offscreenSurface); + + if (m_surfaceTexture) { + QJNILocalRef surfaceTex = m_surfaceTexture->surfaceTexture(); + QJNIObject obj(surfaceTex.object()); + obj.callMethod("release"); + delete m_surfaceTexture; + m_surfaceTexture = 0; + } + if (m_androidSurface) { + m_androidSurface->callMethod("release"); + delete m_androidSurface; + m_androidSurface = 0; + } + if (m_surfaceHolder) { + delete m_surfaceHolder; + m_surfaceHolder = 0; + } + if (m_externalTex) + glDeleteTextures(1, &m_externalTex); + + delete m_fbo; + delete m_program; + delete m_glContext; + delete m_offscreenSurface; +} + +QAbstractVideoSurface *QAndroidVideoRendererControl::surface() const +{ + return m_surface; +} + +void QAndroidVideoRendererControl::setSurface(QAbstractVideoSurface *surface) +{ + if (surface == m_surface) + return; + + if (m_surface && m_surface->isActive()) + m_surface->stop(); + + m_surface = surface; + + m_useImage = !m_surface->supportedPixelFormats(QAbstractVideoBuffer::GLTextureHandle).contains(QVideoFrame::Format_BGR32); +} + +jobject QAndroidVideoRendererControl::surfaceHolder() +{ + if (m_surfaceHolder) + return m_surfaceHolder->object(); + + QOpenGLContext *currContext = QOpenGLContext::currentContext(); + + // If we don't have a GL context in the current thread, create one and share it + // with the render thread GL context + if (!currContext && !m_glContext) { + m_offscreenSurface = new QOffscreenSurface; + QSurfaceFormat format; + format.setSwapBehavior(QSurfaceFormat::SingleBuffer); + m_offscreenSurface->setFormat(format); + m_offscreenSurface->create(); + + QOpenGLContext *shareContext = 0; + if (m_surface) + shareContext = qobject_cast(m_surface->property("GLContext").value()); + m_glContext = new QOpenGLContext; + m_glContext->setFormat(m_offscreenSurface->requestedFormat()); + + if (shareContext) + m_glContext->setShareContext(shareContext); + + if (!m_glContext->create()) + return 0; + + // if sharing contexts is not supported, fallback to image rendering and send the bits + // to the video surface + if (!m_glContext->shareContext()) + m_useImage = true; + } + + if (m_glContext) + m_glContext->makeCurrent(m_offscreenSurface); + + glGenTextures(1, &m_externalTex); + m_surfaceTexture = new JSurfaceTexture(m_externalTex); + + if (m_surfaceTexture->isValid()) { + connect(m_surfaceTexture, SIGNAL(frameAvailable()), this, SLOT(onFrameAvailable())); + + QJNILocalRef surfaceTex = m_surfaceTexture->surfaceTexture(); + + m_androidSurface = new QJNIObject("android/view/Surface", + "(Landroid/graphics/SurfaceTexture;)V", + surfaceTex.object()); + + m_surfaceHolder = new JSurfaceTextureHolder(m_androidSurface->object()); + } else { + delete m_surfaceTexture; + m_surfaceTexture = 0; + glDeleteTextures(1, &m_externalTex); + } + + if (m_surfaceHolder) + return m_surfaceHolder->object(); + + return 0; +} + +void QAndroidVideoRendererControl::setVideoSize(const QSize &size) +{ + if (m_nativeSize == size) + return; + + m_nativeSize = size; + + delete m_fbo; + m_fbo = 0; +} + +void QAndroidVideoRendererControl::stop() +{ + if (m_surface && m_surface->isActive()) + m_surface->stop(); + m_nativeSize = QSize(); +} + +void QAndroidVideoRendererControl::onFrameAvailable() +{ + if (m_glContext) + m_glContext->makeCurrent(m_offscreenSurface); + + m_surfaceTexture->updateTexImage(); + + if (!m_nativeSize.isValid()) + return; + + renderFrameToFbo(); + + QAbstractVideoBuffer *buffer = 0; + QVideoFrame frame; + + if (m_useImage) { + buffer = new ImageVideoBuffer(m_fbo->toImage().mirrored()); + frame = QVideoFrame(buffer, m_nativeSize, QVideoFrame::Format_RGB32); + } else { + buffer = new TextureVideoBuffer(m_fbo->texture()); + frame = QVideoFrame(buffer, m_nativeSize, QVideoFrame::Format_BGR32); + } + + if (m_surface && frame.isValid()) { + if (m_surface->isActive() && (m_surface->surfaceFormat().pixelFormat() != frame.pixelFormat() + || m_surface->nativeResolution() != frame.size())) { + m_surface->stop(); + } + + if (!m_surface->isActive()) { + QVideoSurfaceFormat format(frame.size(), frame.pixelFormat(), + m_useImage ? QAbstractVideoBuffer::NoHandle + : QAbstractVideoBuffer::GLTextureHandle); + + m_surface->start(format); + } + + if (m_surface->isActive()) + m_surface->present(frame); + } +} + +void QAndroidVideoRendererControl::renderFrameToFbo() +{ + createGLResources(); + + m_fbo->bind(); + + glViewport(0, 0, m_nativeSize.width(), m_nativeSize.height()); + + m_program->bind(); + m_program->enableAttributeArray(0); + m_program->enableAttributeArray(1); + m_program->setUniformValue("frameTexture", GLuint(0)); + m_program->setUniformValue("texMatrix", m_surfaceTexture->getTransformMatrix()); + + glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, g_vertex_data); + glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, g_texture_data); + + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + + m_program->disableAttributeArray(0); + m_program->disableAttributeArray(1); + m_program->release(); + + glBindTexture(GL_TEXTURE_EXTERNAL_OES, 0); + m_fbo->release(); + + glFinish(); +} + +void QAndroidVideoRendererControl::createGLResources() +{ + if (!m_fbo) + m_fbo = new QOpenGLFramebufferObject(m_nativeSize); + + if (!m_program) { + m_program = new QOpenGLShaderProgram; + + QOpenGLShader *vertexShader = new QOpenGLShader(QOpenGLShader::Vertex, m_program); + vertexShader->compileSourceCode("attribute highp vec4 vertexCoordsArray; \n" \ + "attribute highp vec2 textureCoordArray; \n" \ + "uniform highp mat4 texMatrix; \n" \ + "varying highp vec2 textureCoords; \n" \ + "void main(void) \n" \ + "{ \n" \ + " gl_Position = vertexCoordsArray; \n" \ + " textureCoords = (texMatrix * vec4(textureCoordArray, 0.0, 1.0)).xy; \n" \ + "}\n"); + m_program->addShader(vertexShader); + + QOpenGLShader *fragmentShader = new QOpenGLShader(QOpenGLShader::Fragment, m_program); + fragmentShader->compileSourceCode("#extension GL_OES_EGL_image_external : require \n" \ + "varying highp vec2 textureCoords; \n" \ + "uniform samplerExternalOES frameTexture; \n" \ + "void main() \n" \ + "{ \n" \ + " gl_FragColor = texture2D(frameTexture, textureCoords); \n" \ + "}\n"); + m_program->addShader(fragmentShader); + + m_program->bindAttributeLocation("vertexCoordsArray", 0); + m_program->bindAttributeLocation("textureCoordArray", 1); + m_program->link(); + } +} + +QT_END_NAMESPACE diff --git a/src/plugins/android/mediaplayer/qandroidvideorendercontrol.h b/src/plugins/android/mediaplayer/qandroidvideorendercontrol.h new file mode 100644 index 00000000..525291e1 --- /dev/null +++ b/src/plugins/android/mediaplayer/qandroidvideorendercontrol.h @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QANDROIDVIDEORENDERCONTROL_H +#define QANDROIDVIDEORENDERCONTROL_H + +#include +#include "qandroidvideooutput.h" +#include "jsurfacetexture.h" + +QT_BEGIN_NAMESPACE + +class QOpenGLContext; +class QOffscreenSurface; +class QOpenGLFramebufferObject; +class QOpenGLShaderProgram; +class JSurfaceTextureHolder; + +class QAndroidVideoRendererControl : public QVideoRendererControl, public QAndroidVideoOutput +{ + Q_OBJECT +public: + explicit QAndroidVideoRendererControl(QObject *parent = 0); + ~QAndroidVideoRendererControl() Q_DECL_OVERRIDE; + + QAbstractVideoSurface *surface() const Q_DECL_OVERRIDE; + void setSurface(QAbstractVideoSurface *surface) Q_DECL_OVERRIDE; + + jobject surfaceHolder() Q_DECL_OVERRIDE; + void setVideoSize(const QSize &size) Q_DECL_OVERRIDE; + void stop() Q_DECL_OVERRIDE; + +private Q_SLOTS: + void onFrameAvailable(); + +private: + void setupSurface(); + void renderFrameToFbo(); + void createGLResources(); + + QAbstractVideoSurface *m_surface; + QOffscreenSurface *m_offscreenSurface; + QOpenGLContext *m_glContext; + QOpenGLFramebufferObject *m_fbo; + QOpenGLShaderProgram *m_program; + bool m_useImage; + QSize m_nativeSize; + + QJNIObject *m_androidSurface; + JSurfaceTexture *m_surfaceTexture; + JSurfaceTextureHolder *m_surfaceHolder; + uint m_externalTex; +}; + +QT_END_NAMESPACE + +#endif // QANDROIDVIDEORENDERCONTROL_H diff --git a/src/plugins/android/wrappers/jmediametadataretriever.cpp b/src/plugins/android/wrappers/jmediametadataretriever.cpp new file mode 100644 index 00000000..ae5abcf4 --- /dev/null +++ b/src/plugins/android/wrappers/jmediametadataretriever.cpp @@ -0,0 +1,126 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "jmediametadataretriever.h" + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +static jobject g_activity = 0; + +JMediaMetadataRetriever::JMediaMetadataRetriever() + : QJNIObject("android/media/MediaMetadataRetriever") +{ + if (!g_activity) { + QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface(); + g_activity = static_cast(nativeInterface->nativeResourceForIntegration("QtActivity")); + } +} + +JMediaMetadataRetriever::~JMediaMetadataRetriever() +{ +} + +QString JMediaMetadataRetriever::extractMetadata(MetadataKey key) +{ + QString value; + + QJNILocalRef metadata = callObjectMethod("extractMetadata", + "(I)Ljava/lang/String;", + jint(key)); + if (!metadata.isNull()) + value = qt_convertJString(metadata.object()); + + return value; +} + +void JMediaMetadataRetriever::release() +{ + callMethod("release"); +} + +bool JMediaMetadataRetriever::setDataSource(const QUrl &url) +{ + QAttachedJNIEnv env; + + bool loaded = false; + + QJNILocalRef string = qt_toJString(url.toString()); + + QJNILocalRef uri = callStaticObjectMethod("android/net/Uri", + "parse", + "(Ljava/lang/String;)Landroid/net/Uri;", + string.object()); + if (env->ExceptionCheck()) { + env->ExceptionClear(); + } else { + callMethod("setDataSource", + "(Landroid/content/Context;Landroid/net/Uri;)V", + g_activity, + uri.object()); + if (env->ExceptionCheck()) + env->ExceptionClear(); + else + loaded = true; + } + + return loaded; +} + +bool JMediaMetadataRetriever::setDataSource(const QString &path) +{ + QAttachedJNIEnv env; + + bool loaded = false; + + callMethod("setDataSource", "(Ljava/lang/String;)V", qt_toJString(path).object()); + if (env->ExceptionCheck()) + env->ExceptionClear(); + else + loaded = true; + + return loaded; +} + +QT_END_NAMESPACE diff --git a/src/plugins/android/wrappers/jmediametadataretriever.h b/src/plugins/android/wrappers/jmediametadataretriever.h new file mode 100644 index 00000000..dd63e0d8 --- /dev/null +++ b/src/plugins/android/wrappers/jmediametadataretriever.h @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef JMEDIAMETADATARETRIEVER_H +#define JMEDIAMETADATARETRIEVER_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class JMediaMetadataRetriever : public QJNIObject +{ +public: + enum MetadataKey { + Album = 1, + AlbumArtist = 13, + Artist = 2, + Author = 3, + Bitrate = 20, + CDTrackNumber = 0, + Compilation = 15, + Composer = 4, + Date = 5, + DiscNumber = 14, + Duration = 9, + Genre = 6, + HasAudio = 16, + HasVideo = 17, + Location = 23, + MimeType = 12, + NumTracks = 10, + Title = 7, + VideoHeight = 19, + VideoWidth = 18, + VideoRotation = 24, + Writer = 11, + Year = 8 + }; + + JMediaMetadataRetriever(); + ~JMediaMetadataRetriever(); + + QString extractMetadata(MetadataKey key); + void release(); + bool setDataSource(const QUrl &url); + bool setDataSource(const QString &path); + +}; + +QT_END_NAMESPACE + +#endif // JMEDIAMETADATARETRIEVER_H diff --git a/src/plugins/android/wrappers/jmediaplayer.cpp b/src/plugins/android/wrappers/jmediaplayer.cpp new file mode 100644 index 00000000..48e743b2 --- /dev/null +++ b/src/plugins/android/wrappers/jmediaplayer.cpp @@ -0,0 +1,265 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "jmediaplayer.h" + +#include +#include +#include +#include + +namespace { + +jclass mediaPlayerClass = 0; + +QMap mplayers; + +} + +QT_BEGIN_NAMESPACE + +bool JMediaPlayer::mActivitySet = false; + +JMediaPlayer::JMediaPlayer() + : QObject() + , QJNIObject(mediaPlayerClass, "(J)V", reinterpret_cast(this)) + , mId(reinterpret_cast(this)) + , mDisplay(0) +{ + mplayers.insert(mId, this); + + if (!mActivitySet) { + QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface(); + jobject activity = static_cast(nativeInterface->nativeResourceForIntegration("QtActivity")); + QJNIObject::callStaticMethod(mediaPlayerClass, + "setActivity", + "(Landroid/app/Activity;)V", + activity); + mActivitySet = true; + } +} + +JMediaPlayer::~JMediaPlayer() +{ + mplayers.remove(mId); +} + +void JMediaPlayer::onError(qint32 what, qint32 extra) +{ + Q_EMIT error(what, extra); +} + +void JMediaPlayer::onBufferingUpdate(qint32 percent) +{ + Q_EMIT bufferingUpdate(percent); +} + +void JMediaPlayer::onInfo(qint32 what, qint32 extra) +{ + Q_EMIT info(what, extra); +} + +void JMediaPlayer::onMediaPlayerInfo(qint32 what, qint32 extra) +{ + Q_EMIT mediaPlayerInfo(what, extra); +} + +void JMediaPlayer::onVideoSizeChanged(qint32 width, qint32 height) +{ + Q_EMIT videoSizeChanged(width, height); +} + +int JMediaPlayer::getCurrentPosition() +{ + return callMethod("getCurrentPosition"); +} + +int JMediaPlayer::getDuration() +{ + return callMethod("getDuration"); +} + +bool JMediaPlayer::isPlaying() +{ + return callMethod("isPlaying"); +} + +int JMediaPlayer::volume() +{ + return callMethod("getVolume"); +} + +bool JMediaPlayer::isMuted() +{ + return callMethod("isMuted"); +} + +void JMediaPlayer::play() +{ + callMethod("start"); +} + +void JMediaPlayer::pause() +{ + callMethod("pause"); +} + +void JMediaPlayer::stop() +{ + callMethod("stop"); +} + +void JMediaPlayer::seekTo(qint32 msec) +{ + callMethod("seekTo", "(I)V", jint(msec)); +} + +void JMediaPlayer::setMuted(bool mute) +{ + callMethod("mute", "(Z)V", jboolean(mute)); +} + +void JMediaPlayer::setDataSource(const QString &path) +{ + QJNILocalRef string = qt_toJString(path); + callMethod("setMediaPath", "(Ljava/lang/String;)V", string.object()); +} + +void JMediaPlayer::setVolume(int volume) +{ + callMethod("setVolume", "(I)V", jint(volume)); +} + +void JMediaPlayer::setDisplay(jobject surfaceHolder) +{ + mDisplay = surfaceHolder; + callMethod("setDisplay", "(Landroid/view/SurfaceHolder;)V", mDisplay); +} + +QT_END_NAMESPACE + +static void onErrorNative(JNIEnv *env, jobject thiz, jint what, jint extra, jlong id) +{ + Q_UNUSED(env); + Q_UNUSED(thiz); + JMediaPlayer *const mp = mplayers[id]; + if (!mp) + return; + + mp->onError(what, extra); +} + +static void onBufferingUpdateNative(JNIEnv *env, jobject thiz, jint percent, jlong id) +{ + Q_UNUSED(env); + Q_UNUSED(thiz); + JMediaPlayer *const mp = mplayers[id]; + if (!mp) + return; + + mp->onBufferingUpdate(percent); +} + +static void onInfoNative(JNIEnv *env, jobject thiz, jint what, jint extra, jlong id) +{ + Q_UNUSED(env); + Q_UNUSED(thiz); + JMediaPlayer *const mp = mplayers[id]; + if (!mp) + return; + + mp->onInfo(what, extra); +} + +static void onMediaPlayerInfoNative(JNIEnv *env, jobject thiz, jint what, jint extra, jlong id) +{ + Q_UNUSED(env); + Q_UNUSED(thiz); + JMediaPlayer *const mp = mplayers[id]; + if (!mp) + return; + + mp->onMediaPlayerInfo(what, extra); +} + +static void onVideoSizeChangedNative(JNIEnv *env, + jobject thiz, + jint width, + jint height, + jlong id) +{ + Q_UNUSED(env); + Q_UNUSED(thiz); + JMediaPlayer *const mp = mplayers[id]; + if (!mp) + return; + + mp->onVideoSizeChanged(width, height); +} + +QT_BEGIN_NAMESPACE + +bool JMediaPlayer::initJNI(JNIEnv *env) +{ + jclass jClass = env->FindClass("org/qtproject/qt5/android/multimedia/QtAndroidMediaPlayer"); + + if (jClass) { + mediaPlayerClass = static_cast(env->NewGlobalRef(jClass)); + + JNINativeMethod methods[] = { + {"onErrorNative", "(IIJ)V", reinterpret_cast(onErrorNative)}, + {"onBufferingUpdateNative", "(IJ)V", reinterpret_cast(onBufferingUpdateNative)}, + {"onInfoNative", "(IIJ)V", reinterpret_cast(onInfoNative)}, + {"onMediaPlayerInfoNative", "(IIJ)V", reinterpret_cast(onMediaPlayerInfoNative)}, + {"onVideoSizeChangedNative", "(IIJ)V", reinterpret_cast(onVideoSizeChangedNative)} + }; + + if (env->RegisterNatives(mediaPlayerClass, + methods, + sizeof(methods) / sizeof(methods[0])) < 0) { + return false; + } + } + + return true; +} + +QT_END_NAMESPACE diff --git a/src/plugins/android/wrappers/jmediaplayer.h b/src/plugins/android/wrappers/jmediaplayer.h new file mode 100644 index 00000000..f5cb1177 --- /dev/null +++ b/src/plugins/android/wrappers/jmediaplayer.h @@ -0,0 +1,133 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QANDROIDMEDIAPLAYER_H +#define QANDROIDMEDIAPLAYER_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class JMediaPlayer : public QObject, public QJNIObject +{ + Q_OBJECT +public: + JMediaPlayer(); + ~JMediaPlayer(); + + enum MediaError + { + // What + MEDIA_ERROR_UNKNOWN = 1, + MEDIA_ERROR_SERVER_DIED = 100, + // Extra + MEDIA_ERROR_IO = -1004, + MEDIA_ERROR_MALFORMED = -1007, + MEDIA_ERROR_UNSUPPORTED = -1010, + MEDIA_ERROR_TIMED_OUT = -110, + MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK = 200 + }; + + enum MediaInfo + { + MEDIA_INFO_UNKNOWN = 1, + MEDIA_INFO_VIDEO_TRACK_LAGGING = 700, + MEDIA_INFO_VIDEO_RENDERING_START = 3, + MEDIA_INFO_BUFFERING_START = 701, + MEDIA_INFO_BUFFERING_END = 702, + MEDIA_INFO_BAD_INTERLEAVING = 800, + MEDIA_INFO_NOT_SEEKABLE = 801, + MEDIA_INFO_METADATA_UPDATE = 802 + }; + + enum MediaPlayerInfo + { + MEDIA_PLAYER_INVALID_STATE = 1, + MEDIA_PLAYER_PREPARING = 2, + MEDIA_PLAYER_READY = 3, + MEDIA_PLAYER_DURATION = 4, + MEDIA_PLAYER_PROGRESS = 5, + MEDIA_PLAYER_FINISHED = 6 + }; + + int getCurrentPosition(); + int getDuration(); + bool isPlaying(); + int volume(); + bool isMuted(); + jobject display() { return mDisplay; } + + void play(); + void pause(); + void stop(); + void seekTo(qint32 msec); + void setMuted(bool mute); + void setDataSource(const QString &path); + void setVolume(int volume); + void setDisplay(jobject surfaceHolder); + + void onError(qint32 what, qint32 extra); + void onBufferingUpdate(qint32 percent); + void onInfo(qint32 what, qint32 extra); + void onMediaPlayerInfo(qint32 what, qint32 extra); + void onVideoSizeChanged(qint32 width, qint32 height); + + static bool initJNI(JNIEnv *env); + +Q_SIGNALS: + void error(qint32 what, qint32 extra); + void bufferingUpdate(qint32 percent); + void completion(); + void info(qint32 what, qint32 extra); + void mediaPlayerInfo(qint32 what, qint32 extra); + void videoSizeChanged(qint32 width, qint32 height); + +private: + jlong mId; + jobject mDisplay; + + static bool mActivitySet; +}; + +QT_END_NAMESPACE + +#endif // QANDROIDMEDIAPLAYER_H diff --git a/src/plugins/android/wrappers/jsurfacetexture.cpp b/src/plugins/android/wrappers/jsurfacetexture.cpp new file mode 100644 index 00000000..107f7be3 --- /dev/null +++ b/src/plugins/android/wrappers/jsurfacetexture.cpp @@ -0,0 +1,118 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "jsurfacetexture.h" +#include + +QT_BEGIN_NAMESPACE + +static jclass g_qtSurfaceTextureClass = 0; +static QHash g_objectMap; + +// native method for QtSurfaceTexture.java +static void notifyFrameAvailable(JNIEnv* , jobject, int id) +{ + JSurfaceTexture *obj = g_objectMap.value(id, 0); + if (obj) + Q_EMIT obj->frameAvailable(); +} + +JSurfaceTexture::JSurfaceTexture(unsigned int texName) + : QObject() + , QJNIObject(g_qtSurfaceTextureClass, "(I)V", jint(texName)) + , m_texID(int(texName)) +{ + if (m_jobject) + g_objectMap.insert(int(texName), this); +} + +JSurfaceTexture::~JSurfaceTexture() +{ + if (m_jobject) + g_objectMap.remove(m_texID); +} + +QMatrix4x4 JSurfaceTexture::getTransformMatrix() +{ + QAttachedJNIEnv env; + + QMatrix4x4 matrix; + jfloatArray array = env->NewFloatArray(16); + callMethod("getTransformMatrix", "([F)V", array); + env->GetFloatArrayRegion(array, 0, 16, matrix.data()); + env->DeleteLocalRef(array); + + return matrix; +} + +void JSurfaceTexture::updateTexImage() +{ + callMethod("updateTexImage"); +} + +QJNILocalRef JSurfaceTexture::surfaceTexture() +{ + return getObjectField("surfaceTexture", "Landroid/graphics/SurfaceTexture;"); +} + +static JNINativeMethod methods[] = { + {"notifyFrameAvailable", "(I)V", (void *)notifyFrameAvailable} +}; + +bool JSurfaceTexture::initJNI(JNIEnv *env) +{ + jclass clazz = env->FindClass("org/qtproject/qt5/android/multimedia/QtSurfaceTexture"); + if (env->ExceptionCheck()) + env->ExceptionClear(); + + if (clazz) { + g_qtSurfaceTextureClass = static_cast(env->NewGlobalRef(clazz)); + if (env->RegisterNatives(g_qtSurfaceTextureClass, + methods, + sizeof(methods) / sizeof(methods[0])) < 0) { + return false; + } + } + + return true; +} + +QT_END_NAMESPACE diff --git a/src/plugins/android/wrappers/jsurfacetexture.h b/src/plugins/android/wrappers/jsurfacetexture.h new file mode 100644 index 00000000..49e00766 --- /dev/null +++ b/src/plugins/android/wrappers/jsurfacetexture.h @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef JSURFACETEXTURE_H +#define JSURFACETEXTURE_H + +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +class JSurfaceTexture : public QObject, public QJNIObject +{ + Q_OBJECT +public: + explicit JSurfaceTexture(unsigned int texName); + ~JSurfaceTexture(); + + QMatrix4x4 getTransformMatrix(); + void updateTexImage(); + + QJNILocalRef surfaceTexture(); + + static bool initJNI(JNIEnv *env); + +Q_SIGNALS: + void frameAvailable(); + +private: + int m_texID; +}; + +QT_END_NAMESPACE + +#endif // JSURFACETEXTURE_H diff --git a/src/plugins/android/wrappers/jsurfacetextureholder.cpp b/src/plugins/android/wrappers/jsurfacetextureholder.cpp new file mode 100644 index 00000000..4ec8935c --- /dev/null +++ b/src/plugins/android/wrappers/jsurfacetextureholder.cpp @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "jsurfacetextureholder.h" + +QT_BEGIN_NAMESPACE + +static jclass g_qtSurfaceTextureHolderClass = 0; + +JSurfaceTextureHolder::JSurfaceTextureHolder(jobject surface) + : QJNIObject(g_qtSurfaceTextureHolderClass, "(Landroid/view/Surface;)V", surface) +{ +} + +bool JSurfaceTextureHolder::initJNI(JNIEnv *env) +{ + jclass clazz = env->FindClass("org/qtproject/qt5/android/multimedia/QtSurfaceTextureHolder"); + if (env->ExceptionCheck()) + env->ExceptionClear(); + + if (clazz) + g_qtSurfaceTextureHolderClass = static_cast(env->NewGlobalRef(clazz)); + + return true; +} + +QT_END_NAMESPACE diff --git a/src/plugins/android/wrappers/jsurfacetextureholder.h b/src/plugins/android/wrappers/jsurfacetextureholder.h new file mode 100644 index 00000000..5b567de3 --- /dev/null +++ b/src/plugins/android/wrappers/jsurfacetextureholder.h @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef JSURFACETEXTUREHOLDER_H +#define JSURFACETEXTUREHOLDER_H + +#include + +QT_BEGIN_NAMESPACE + +class JSurfaceTextureHolder : public QJNIObject +{ +public: + JSurfaceTextureHolder(jobject surface); + + static bool initJNI(JNIEnv *env); +}; + +QT_END_NAMESPACE + +#endif // JSURFACETEXTUREHOLDER_H diff --git a/src/plugins/android/wrappers/wrappers.pri b/src/plugins/android/wrappers/wrappers.pri new file mode 100644 index 00000000..5b47ef53 --- /dev/null +++ b/src/plugins/android/wrappers/wrappers.pri @@ -0,0 +1,15 @@ +QT += platformsupport-private + +INCLUDEPATH += $$PWD + +HEADERS += \ + $$PWD/jmediaplayer.h \ + $$PWD/jsurfacetexture.h \ + $$PWD/jsurfacetextureholder.h \ + $$PWD/jmediametadataretriever.h + +SOURCES += \ + $$PWD/jmediaplayer.cpp \ + $$PWD/jsurfacetexture.cpp \ + $$PWD/jsurfacetextureholder.cpp \ + $$PWD/jmediametadataretriever.cpp diff --git a/src/plugins/blackberry/bbserviceplugin.cpp b/src/plugins/blackberry/bbserviceplugin.cpp new file mode 100644 index 00000000..90364f3f --- /dev/null +++ b/src/plugins/blackberry/bbserviceplugin.cpp @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Research In Motion +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "bbserviceplugin.h" + +#include "bbcameraservice.h" +#include "bbmediaplayerservice.h" +#include "bbvideodeviceselectorcontrol.h" + +#include + +QT_BEGIN_NAMESPACE + +BbServicePlugin::BbServicePlugin() +{ +} + +QMediaService *BbServicePlugin::create(const QString &key) +{ + if (key == QLatin1String(Q_MEDIASERVICE_CAMERA)) + return new BbCameraService(); + + if (key == QLatin1String(Q_MEDIASERVICE_MEDIAPLAYER)) + return new BbMediaPlayerService(); + + return 0; +} + +void BbServicePlugin::release(QMediaService *service) +{ + delete service; +} + +QMediaServiceProviderHint::Features BbServicePlugin::supportedFeatures(const QByteArray &service) const +{ + Q_UNUSED(service) + return QMediaServiceProviderHint::Features(); +} + +QList BbServicePlugin::devices(const QByteArray &service) const +{ + if (service == Q_MEDIASERVICE_CAMERA) { + if (m_cameraDevices.isEmpty()) + updateDevices(); + + return m_cameraDevices; + } + + return QList(); +} + +QString BbServicePlugin::deviceDescription(const QByteArray &service, const QByteArray &device) +{ + if (service == Q_MEDIASERVICE_CAMERA) { + if (m_cameraDevices.isEmpty()) + updateDevices(); + + for (int i = 0; i < m_cameraDevices.count(); i++) + if (m_cameraDevices[i] == device) + return m_cameraDescriptions[i]; + } + + return QString(); +} + +void BbServicePlugin::updateDevices() const +{ + BbVideoDeviceSelectorControl::enumerateDevices(&m_cameraDevices, &m_cameraDescriptions); + + if (m_cameraDevices.isEmpty()) { + qWarning() << "No camera devices found"; + } +} + +QT_END_NAMESPACE diff --git a/src/plugins/blackberry/mediaservice/bbserviceplugin.h b/src/plugins/blackberry/bbserviceplugin.h similarity index 82% rename from src/plugins/blackberry/mediaservice/bbserviceplugin.h rename to src/plugins/blackberry/bbserviceplugin.h index dbf507f1..62fc4a0d 100644 --- a/src/plugins/blackberry/mediaservice/bbserviceplugin.h +++ b/src/plugins/blackberry/bbserviceplugin.h @@ -47,9 +47,11 @@ QT_BEGIN_NAMESPACE class BbServicePlugin : public QMediaServiceProviderPlugin, + public QMediaServiceSupportedDevicesInterface, public QMediaServiceFeaturesInterface { Q_OBJECT + Q_INTERFACES(QMediaServiceSupportedDevicesInterface) Q_INTERFACES(QMediaServiceFeaturesInterface) Q_PLUGIN_METADATA(IID "org.qt-project.qt.mediaserviceproviderfactory/5.0" FILE "blackberry_mediaservice.json") public: @@ -58,6 +60,16 @@ public: QMediaService *create(const QString &key) Q_DECL_OVERRIDE; void release(QMediaService *service) Q_DECL_OVERRIDE; QMediaServiceProviderHint::Features supportedFeatures(const QByteArray &service) const Q_DECL_OVERRIDE; + + QList devices(const QByteArray &service) const Q_DECL_OVERRIDE; + QString deviceDescription(const QByteArray &service, const QByteArray &device) Q_DECL_OVERRIDE; + QVariant deviceProperty(const QByteArray &service, const QByteArray &device, const QByteArray &property) Q_DECL_OVERRIDE; + +private: + void updateDevices() const; + + mutable QList m_cameraDevices; + mutable QStringList m_cameraDescriptions; }; QT_END_NAMESPACE diff --git a/src/plugins/blackberry/blackberry.pro b/src/plugins/blackberry/blackberry.pro index a0347652..806f2033 100644 --- a/src/plugins/blackberry/blackberry.pro +++ b/src/plugins/blackberry/blackberry.pro @@ -1,5 +1,17 @@ -TEMPLATE = subdirs +TARGET = qtmedia_blackberry +QT += multimedia-private gui-private -SUBDIRS += \ - mediaservice +PLUGIN_TYPE=mediaservice +PLUGIN_CLASS_NAME = BbServicePlugin +load(qt_plugin) +LIBS += -lscreen + +HEADERS += bbserviceplugin.h +SOURCES += bbserviceplugin.cpp + +include(common/common.pri) +include(camera/camera.pri) +include(mediaplayer/mediaplayer.pri) + +OTHER_FILES += blackberry_mediaservice.json diff --git a/src/plugins/blackberry/blackberry_mediaservice.json b/src/plugins/blackberry/blackberry_mediaservice.json new file mode 100644 index 00000000..54c1c9f0 --- /dev/null +++ b/src/plugins/blackberry/blackberry_mediaservice.json @@ -0,0 +1,3 @@ +{ + "Keys": ["org.qt-project.qt.camera", "org.qt-project.qt.mediaplayer"] +} diff --git a/src/plugins/blackberry/camera/bbcameraaudioencodersettingscontrol.cpp b/src/plugins/blackberry/camera/bbcameraaudioencodersettingscontrol.cpp new file mode 100644 index 00000000..2ff800a0 --- /dev/null +++ b/src/plugins/blackberry/camera/bbcameraaudioencodersettingscontrol.cpp @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Research In Motion +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "bbcameraaudioencodersettingscontrol.h" + +#include "bbcamerasession.h" + +QT_BEGIN_NAMESPACE + +BbCameraAudioEncoderSettingsControl::BbCameraAudioEncoderSettingsControl(BbCameraSession *session, QObject *parent) + : QAudioEncoderSettingsControl(parent) + , m_session(session) +{ +} + +QStringList BbCameraAudioEncoderSettingsControl::supportedAudioCodecs() const +{ + return QStringList() << QLatin1String("none") << QLatin1String("aac") << QLatin1String("raw"); +} + +QString BbCameraAudioEncoderSettingsControl::codecDescription(const QString &codecName) const +{ + if (codecName == QLatin1String("none")) + return tr("No compression"); + else if (codecName == QLatin1String("aac")) + return tr("AAC compression"); + else if (codecName == QLatin1String("raw")) + return tr("PCM uncompressed"); + + return QString(); +} + +QList BbCameraAudioEncoderSettingsControl::supportedSampleRates(const QAudioEncoderSettings &settings, bool *continuous) const +{ + Q_UNUSED(settings); + Q_UNUSED(continuous); + + // no API provided by BB10 yet + return QList(); +} + +QAudioEncoderSettings BbCameraAudioEncoderSettingsControl::audioSettings() const +{ + return m_session->audioSettings(); +} + +void BbCameraAudioEncoderSettingsControl::setAudioSettings(const QAudioEncoderSettings &settings) +{ + m_session->setAudioSettings(settings); +} + +QT_END_NAMESPACE diff --git a/src/plugins/blackberry/camera/bbcameraaudioencodersettingscontrol.h b/src/plugins/blackberry/camera/bbcameraaudioencodersettingscontrol.h new file mode 100644 index 00000000..21fb520e --- /dev/null +++ b/src/plugins/blackberry/camera/bbcameraaudioencodersettingscontrol.h @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Research In Motion +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef BBCAMERAAUDIOENCODERSETTINGSCONTROL_H +#define BBCAMERAAUDIOENCODERSETTINGSCONTROL_H + +#include + +QT_BEGIN_NAMESPACE + +class BbCameraSession; + +class BbCameraAudioEncoderSettingsControl : public QAudioEncoderSettingsControl +{ + Q_OBJECT +public: + explicit BbCameraAudioEncoderSettingsControl(BbCameraSession *session, QObject *parent = 0); + + QStringList supportedAudioCodecs() const Q_DECL_OVERRIDE; + QString codecDescription(const QString &codecName) const Q_DECL_OVERRIDE; + QList supportedSampleRates(const QAudioEncoderSettings &settings, bool *continuous = 0) const Q_DECL_OVERRIDE; + QAudioEncoderSettings audioSettings() const Q_DECL_OVERRIDE; + void setAudioSettings(const QAudioEncoderSettings &settings) Q_DECL_OVERRIDE; + +private: + BbCameraSession *m_session; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/blackberry/camera/bbcameracapturebufferformatcontrol.cpp b/src/plugins/blackberry/camera/bbcameracapturebufferformatcontrol.cpp new file mode 100644 index 00000000..57f3c9fb --- /dev/null +++ b/src/plugins/blackberry/camera/bbcameracapturebufferformatcontrol.cpp @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Research In Motion +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "bbcameracapturebufferformatcontrol.h" + +QT_BEGIN_NAMESPACE + +BbCameraCaptureBufferFormatControl::BbCameraCaptureBufferFormatControl(QObject *parent) + : QCameraCaptureBufferFormatControl(parent) +{ +} + +QList BbCameraCaptureBufferFormatControl::supportedBufferFormats() const +{ + return (QList() << QVideoFrame::Format_Jpeg); +} + +QVideoFrame::PixelFormat BbCameraCaptureBufferFormatControl::bufferFormat() const +{ + return QVideoFrame::Format_Jpeg; +} + +void BbCameraCaptureBufferFormatControl::setBufferFormat(QVideoFrame::PixelFormat format) +{ + Q_UNUSED(format) + // Do nothing, we support only Jpeg for now +} + +QT_END_NAMESPACE diff --git a/src/plugins/blackberry/camera/bbcameracapturebufferformatcontrol.h b/src/plugins/blackberry/camera/bbcameracapturebufferformatcontrol.h new file mode 100644 index 00000000..2897cb2f --- /dev/null +++ b/src/plugins/blackberry/camera/bbcameracapturebufferformatcontrol.h @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Research In Motion +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef BBCAMERACAPTUREBUFFERFORMATCONTROL_H +#define BBCAMERACAPTUREBUFFERFORMATCONTROL_H + +#include + +QT_BEGIN_NAMESPACE + +class BbCameraCaptureBufferFormatControl : public QCameraCaptureBufferFormatControl +{ + Q_OBJECT +public: + explicit BbCameraCaptureBufferFormatControl(QObject *parent = 0); + + QList supportedBufferFormats() const Q_DECL_OVERRIDE; + QVideoFrame::PixelFormat bufferFormat() const Q_DECL_OVERRIDE; + void setBufferFormat(QVideoFrame::PixelFormat format) Q_DECL_OVERRIDE; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/blackberry/camera/bbcameracapturedestinationcontrol.cpp b/src/plugins/blackberry/camera/bbcameracapturedestinationcontrol.cpp new file mode 100644 index 00000000..6b6bcfcb --- /dev/null +++ b/src/plugins/blackberry/camera/bbcameracapturedestinationcontrol.cpp @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Research In Motion +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "bbcameracapturedestinationcontrol.h" + +#include "bbcamerasession.h" + +QT_BEGIN_NAMESPACE + +BbCameraCaptureDestinationControl::BbCameraCaptureDestinationControl(BbCameraSession *session, QObject *parent) + : QCameraCaptureDestinationControl(parent) + , m_session(session) +{ + connect(m_session, SIGNAL(captureDestinationChanged(QCameraImageCapture::CaptureDestinations)), + this, SIGNAL(captureDestinationChanged(QCameraImageCapture::CaptureDestinations))); +} + +bool BbCameraCaptureDestinationControl::isCaptureDestinationSupported(QCameraImageCapture::CaptureDestinations destination) const +{ + return m_session->isCaptureDestinationSupported(destination); +} + +QCameraImageCapture::CaptureDestinations BbCameraCaptureDestinationControl::captureDestination() const +{ + return m_session->captureDestination();; +} + +void BbCameraCaptureDestinationControl::setCaptureDestination(QCameraImageCapture::CaptureDestinations destination) +{ + m_session->setCaptureDestination(destination); +} + +QT_END_NAMESPACE diff --git a/src/plugins/blackberry/camera/bbcameracapturedestinationcontrol.h b/src/plugins/blackberry/camera/bbcameracapturedestinationcontrol.h new file mode 100644 index 00000000..93a7d2d1 --- /dev/null +++ b/src/plugins/blackberry/camera/bbcameracapturedestinationcontrol.h @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Research In Motion +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef BBCAMERACAPTUREDESTINATIONCONTROL_H +#define BBCAMERACAPTUREDESTINATIONCONTROL_H + +#include + +QT_BEGIN_NAMESPACE + +class BbCameraSession; + +class BbCameraCaptureDestinationControl : public QCameraCaptureDestinationControl +{ + Q_OBJECT +public: + explicit BbCameraCaptureDestinationControl(BbCameraSession *session, QObject *parent = 0); + + bool isCaptureDestinationSupported(QCameraImageCapture::CaptureDestinations destination) const Q_DECL_OVERRIDE; + QCameraImageCapture::CaptureDestinations captureDestination() const Q_DECL_OVERRIDE; + void setCaptureDestination(QCameraImageCapture::CaptureDestinations destination) Q_DECL_OVERRIDE; + +private: + BbCameraSession *m_session; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/blackberry/camera/bbcameracontrol.cpp b/src/plugins/blackberry/camera/bbcameracontrol.cpp new file mode 100644 index 00000000..bc3c7826 --- /dev/null +++ b/src/plugins/blackberry/camera/bbcameracontrol.cpp @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Research In Motion +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "bbcameracontrol.h" + +#include "bbcamerasession.h" + +QT_BEGIN_NAMESPACE + +BbCameraControl::BbCameraControl(BbCameraSession *session, QObject *parent) + : QCameraControl(parent) + , m_session(session) +{ + connect(m_session, SIGNAL(statusChanged(QCamera::Status)), this, SIGNAL(statusChanged(QCamera::Status))); + connect(m_session, SIGNAL(stateChanged(QCamera::State)), this, SIGNAL(stateChanged(QCamera::State))); + connect(m_session, SIGNAL(error(int,QString)), this, SIGNAL(error(int,QString))); + connect(m_session, SIGNAL(captureModeChanged(QCamera::CaptureModes)), this, SIGNAL(captureModeChanged(QCamera::CaptureModes))); +} + +QCamera::State BbCameraControl::state() const +{ + return m_session->state(); +} + +void BbCameraControl::setState(QCamera::State state) +{ + m_session->setState(state); +} + +QCamera::CaptureModes BbCameraControl::captureMode() const +{ + return m_session->captureMode(); +} + +void BbCameraControl::setCaptureMode(QCamera::CaptureModes mode) +{ + m_session->setCaptureMode(mode); +} + +QCamera::Status BbCameraControl::status() const +{ + return m_session->status(); +} + +bool BbCameraControl::isCaptureModeSupported(QCamera::CaptureModes mode) const +{ + return m_session->isCaptureModeSupported(mode); +} + +bool BbCameraControl::canChangeProperty(PropertyChangeType /* changeType */, QCamera::Status /* status */) const +{ + return false; +} + +QT_END_NAMESPACE diff --git a/src/plugins/blackberry/camera/bbcameracontrol.h b/src/plugins/blackberry/camera/bbcameracontrol.h new file mode 100644 index 00000000..a5792c5d --- /dev/null +++ b/src/plugins/blackberry/camera/bbcameracontrol.h @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Research In Motion +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef BBCAMERACONTROL_H +#define BBCAMERACONTROL_H + +#include + +QT_BEGIN_NAMESPACE + +class BbCameraSession; + +class BbCameraControl : public QCameraControl +{ + Q_OBJECT +public: + explicit BbCameraControl(BbCameraSession *session, QObject *parent = 0); + + QCamera::State state() const Q_DECL_OVERRIDE; + void setState(QCamera::State state) Q_DECL_OVERRIDE; + + QCamera::Status status() const Q_DECL_OVERRIDE; + + QCamera::CaptureModes captureMode() const Q_DECL_OVERRIDE; + void setCaptureMode(QCamera::CaptureModes) Q_DECL_OVERRIDE; + bool isCaptureModeSupported(QCamera::CaptureModes mode) const Q_DECL_OVERRIDE; + + bool canChangeProperty(PropertyChangeType changeType, QCamera::Status status) const Q_DECL_OVERRIDE; + +private: + BbCameraSession *m_session; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/blackberry/camera/bbcameraexposurecontrol.cpp b/src/plugins/blackberry/camera/bbcameraexposurecontrol.cpp new file mode 100644 index 00000000..a24fdbaf --- /dev/null +++ b/src/plugins/blackberry/camera/bbcameraexposurecontrol.cpp @@ -0,0 +1,232 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Research In Motion +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "bbcameraexposurecontrol.h" + +#include "bbcamerasession.h" + +#include + +QT_BEGIN_NAMESPACE + +BbCameraExposureControl::BbCameraExposureControl(BbCameraSession *session, QObject *parent) + : QCameraExposureControl(parent) + , m_session(session) + , m_requestedExposureMode(QCameraExposure::ExposureAuto) +{ + connect(m_session, SIGNAL(statusChanged(QCamera::Status)), this, SLOT(statusChanged(QCamera::Status))); +} + +bool BbCameraExposureControl::isParameterSupported(ExposureParameter parameter) const +{ + switch (parameter) { + case QCameraExposureControl::ISO: + return false; + case QCameraExposureControl::Aperture: + return false; + case QCameraExposureControl::ShutterSpeed: + return false; + case QCameraExposureControl::ExposureCompensation: + return false; + case QCameraExposureControl::FlashPower: + return false; + case QCameraExposureControl::FlashCompensation: + return false; + case QCameraExposureControl::TorchPower: + return false; + case QCameraExposureControl::SpotMeteringPoint: + return false; + case QCameraExposureControl::ExposureMode: + return true; + case QCameraExposureControl::MeteringMode: + return false; + default: + return false; + } +} + +QVariantList BbCameraExposureControl::supportedParameterRange(ExposureParameter parameter, bool *continuous) const +{ + if (parameter != QCameraExposureControl::ExposureMode) // no other parameter supported by BB10 API at the moment + return QVariantList(); + + if (m_session->status() != QCamera::ActiveStatus) // we can query supported exposure modes only with active viewfinder + return QVariantList(); + + if (continuous) + *continuous = false; + + int supported = 0; + camera_scenemode_t modes[20]; + const camera_error_t result = camera_get_scene_modes(m_session->handle(), 20, &supported, modes); + if (result != CAMERA_EOK) { + qWarning() << "Unable to retrieve supported scene modes:" << result; + return QVariantList(); + } + + QVariantList exposureModes; + for (int i = 0; i < supported; ++i) { + switch (modes[i]) { + case CAMERA_SCENE_AUTO: + exposureModes << QVariant::fromValue(QCameraExposure::ExposureAuto); + break; + case CAMERA_SCENE_SPORTS: + exposureModes << QVariant::fromValue(QCameraExposure::ExposureSports); + break; + case CAMERA_SCENE_CLOSEUP: + exposureModes << QVariant::fromValue(QCameraExposure::ExposurePortrait); + break; + case CAMERA_SCENE_ACTION: + exposureModes << QVariant::fromValue(QCameraExposure::ExposureSports); + break; + case CAMERA_SCENE_BEACHANDSNOW: + exposureModes << QVariant::fromValue(QCameraExposure::ExposureBeach) << QVariant::fromValue(QCameraExposure::ExposureSnow); + break; + case CAMERA_SCENE_NIGHT: + exposureModes << QVariant::fromValue(QCameraExposure::ExposureNight); + break; + default: break; + } + } + + return exposureModes; +} + +QVariant BbCameraExposureControl::requestedValue(ExposureParameter parameter) const +{ + if (parameter != QCameraExposureControl::ExposureMode) // no other parameter supported by BB10 API at the moment + return QVariant(); + + return QVariant::fromValue(m_requestedExposureMode); +} + +QVariant BbCameraExposureControl::actualValue(ExposureParameter parameter) const +{ + if (parameter != QCameraExposureControl::ExposureMode) // no other parameter supported by BB10 API at the moment + return QVariantList(); + + if (m_session->status() != QCamera::ActiveStatus) // we can query actual scene modes only with active viewfinder + return QVariantList(); + + camera_scenemode_t sceneMode = CAMERA_SCENE_DEFAULT; + const camera_error_t result = camera_get_scene_mode(m_session->handle(), &sceneMode); + + if (result != CAMERA_EOK) { + qWarning() << "Unable to retrieve scene mode:" << result; + return QVariant(); + } + + switch (sceneMode) { + case CAMERA_SCENE_AUTO: + return QVariant::fromValue(QCameraExposure::ExposureAuto); + case CAMERA_SCENE_SPORTS: + return QVariant::fromValue(QCameraExposure::ExposureSports); + case CAMERA_SCENE_CLOSEUP: + return QVariant::fromValue(QCameraExposure::ExposurePortrait); + case CAMERA_SCENE_ACTION: + return QVariant::fromValue(QCameraExposure::ExposureSports); + case CAMERA_SCENE_BEACHANDSNOW: + return (m_requestedExposureMode == QCameraExposure::ExposureBeach ? QVariant::fromValue(QCameraExposure::ExposureBeach) + : QVariant::fromValue(QCameraExposure::ExposureSnow)); + case CAMERA_SCENE_NIGHT: + return QVariant::fromValue(QCameraExposure::ExposureNight); + default: + return QVariant(); + } +} + +bool BbCameraExposureControl::setValue(ExposureParameter parameter, const QVariant& value) +{ + if (parameter != QCameraExposureControl::ExposureMode) // no other parameter supported by BB10 API at the moment + return false; + + if (m_session->status() != QCamera::ActiveStatus) // we can set actual scene modes only with active viewfinder + return false; + + camera_scenemode_t sceneMode = CAMERA_SCENE_DEFAULT; + + if (value.isValid()) { + m_requestedExposureMode = value.value(); + emit requestedValueChanged(QCameraExposureControl::ExposureMode); + + switch (m_requestedExposureMode) { + case QCameraExposure::ExposureAuto: + sceneMode = CAMERA_SCENE_AUTO; + break; + case QCameraExposure::ExposureSports: + sceneMode = CAMERA_SCENE_SPORTS; + break; + case QCameraExposure::ExposurePortrait: + sceneMode = CAMERA_SCENE_CLOSEUP; + break; + case QCameraExposure::ExposureBeach: + sceneMode = CAMERA_SCENE_BEACHANDSNOW; + break; + case QCameraExposure::ExposureSnow: + sceneMode = CAMERA_SCENE_BEACHANDSNOW; + break; + case QCameraExposure::ExposureNight: + sceneMode = CAMERA_SCENE_NIGHT; + break; + default: + sceneMode = CAMERA_SCENE_DEFAULT; + break; + } + } + + const camera_error_t result = camera_set_scene_mode(m_session->handle(), sceneMode); + + if (result != CAMERA_EOK) { + qWarning() << "Unable to set scene mode:" << result; + return false; + } + + emit actualValueChanged(QCameraExposureControl::ExposureMode); + + return true; +} + +void BbCameraExposureControl::statusChanged(QCamera::Status status) +{ + if (status == QCamera::ActiveStatus || status == QCamera::LoadedStatus) + emit parameterRangeChanged(QCameraExposureControl::ExposureMode); +} + +QT_END_NAMESPACE diff --git a/src/plugins/blackberry/camera/bbcameraexposurecontrol.h b/src/plugins/blackberry/camera/bbcameraexposurecontrol.h new file mode 100644 index 00000000..f4659b62 --- /dev/null +++ b/src/plugins/blackberry/camera/bbcameraexposurecontrol.h @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Research In Motion +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef BBCAMERAEXPOSURECONTROL_H +#define BBCAMERAEXPOSURECONTROL_H + +#include + +QT_BEGIN_NAMESPACE + +class BbCameraSession; + +class BbCameraExposureControl : public QCameraExposureControl +{ + Q_OBJECT +public: + explicit BbCameraExposureControl(BbCameraSession *session, QObject *parent = 0); + + virtual bool isParameterSupported(ExposureParameter parameter) const Q_DECL_OVERRIDE; + virtual QVariantList supportedParameterRange(ExposureParameter parameter, bool *continuous) const Q_DECL_OVERRIDE; + + virtual QVariant requestedValue(ExposureParameter parameter) const Q_DECL_OVERRIDE; + virtual QVariant actualValue(ExposureParameter parameter) const Q_DECL_OVERRIDE; + virtual bool setValue(ExposureParameter parameter, const QVariant& value) Q_DECL_OVERRIDE; + +private Q_SLOTS: + void statusChanged(QCamera::Status status); + +private: + BbCameraSession *m_session; + QCameraExposure::ExposureMode m_requestedExposureMode; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/blackberry/camera/bbcameraflashcontrol.cpp b/src/plugins/blackberry/camera/bbcameraflashcontrol.cpp new file mode 100644 index 00000000..06ebe01f --- /dev/null +++ b/src/plugins/blackberry/camera/bbcameraflashcontrol.cpp @@ -0,0 +1,113 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Research In Motion +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "bbcameraflashcontrol.h" + +#include "bbcamerasession.h" + +#include + +QT_BEGIN_NAMESPACE + +BbCameraFlashControl::BbCameraFlashControl(BbCameraSession *session, QObject *parent) + : QCameraFlashControl(parent) + , m_session(session) + , m_flashMode(QCameraExposure::FlashAuto) +{ +} + +QCameraExposure::FlashModes BbCameraFlashControl::flashMode() const +{ + return m_flashMode; +} + +void BbCameraFlashControl::setFlashMode(QCameraExposure::FlashModes mode) +{ + if (m_flashMode == mode) + return; + + if (m_session->status() != QCamera::ActiveStatus) // can only be changed when viewfinder is active + return; + + if (m_flashMode == QCameraExposure::FlashVideoLight) { + const camera_error_t result = camera_config_videolight(m_session->handle(), CAMERA_VIDEOLIGHT_OFF); + if (result != CAMERA_EOK) + qWarning() << "Unable to switch off video light:" << result; + } + + m_flashMode = mode; + + if (m_flashMode == QCameraExposure::FlashVideoLight) { + const camera_error_t result = camera_config_videolight(m_session->handle(), CAMERA_VIDEOLIGHT_ON); + if (result != CAMERA_EOK) + qWarning() << "Unable to switch on video light:" << result; + } else { + camera_flashmode_t flashMode = CAMERA_FLASH_AUTO; + + if (m_flashMode.testFlag(QCameraExposure::FlashAuto)) flashMode = CAMERA_FLASH_AUTO; + else if (mode.testFlag(QCameraExposure::FlashOff)) flashMode = CAMERA_FLASH_OFF; + else if (mode.testFlag(QCameraExposure::FlashOn)) flashMode = CAMERA_FLASH_ON; + + const camera_error_t result = camera_config_flash(m_session->handle(), flashMode); + if (result != CAMERA_EOK) + qWarning() << "Unable to configure flash:" << result; + } +} + +bool BbCameraFlashControl::isFlashModeSupported(QCameraExposure::FlashModes mode) const +{ + bool supportsVideoLight = false; + if (m_session->handle() != CAMERA_HANDLE_INVALID) { + supportsVideoLight = camera_has_feature(m_session->handle(), CAMERA_FEATURE_VIDEOLIGHT); + } + + return (mode == QCameraExposure::FlashOff || + mode == QCameraExposure::FlashOn || + mode == QCameraExposure::FlashAuto || + ((mode == QCameraExposure::FlashVideoLight) && supportsVideoLight)); +} + +bool BbCameraFlashControl::isFlashReady() const +{ + //TODO: check for flash charge-level here?!? + return true; +} + +QT_END_NAMESPACE diff --git a/src/plugins/blackberry/camera/bbcameraflashcontrol.h b/src/plugins/blackberry/camera/bbcameraflashcontrol.h new file mode 100644 index 00000000..d46dc8c1 --- /dev/null +++ b/src/plugins/blackberry/camera/bbcameraflashcontrol.h @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Research In Motion +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef BBCAMERAFLASHCONTROL_H +#define BBCAMERAFLASHCONTROL_H + +#include + +QT_BEGIN_NAMESPACE + +class BbCameraSession; + +class BbCameraFlashControl : public QCameraFlashControl +{ + Q_OBJECT +public: + explicit BbCameraFlashControl(BbCameraSession *session, QObject *parent = 0); + + QCameraExposure::FlashModes flashMode() const Q_DECL_OVERRIDE; + void setFlashMode(QCameraExposure::FlashModes mode) Q_DECL_OVERRIDE; + bool isFlashModeSupported(QCameraExposure::FlashModes mode) const Q_DECL_OVERRIDE; + bool isFlashReady() const Q_DECL_OVERRIDE; + +private: + BbCameraSession *m_session; + QCameraExposure::FlashModes m_flashMode; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/blackberry/camera/bbcamerafocuscontrol.cpp b/src/plugins/blackberry/camera/bbcamerafocuscontrol.cpp new file mode 100644 index 00000000..e0b57d6c --- /dev/null +++ b/src/plugins/blackberry/camera/bbcamerafocuscontrol.cpp @@ -0,0 +1,331 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Research In Motion +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "bbcamerafocuscontrol.h" + +#include "bbcamerasession.h" + +#include + +QT_BEGIN_NAMESPACE + +BbCameraFocusControl::BbCameraFocusControl(BbCameraSession *session, QObject *parent) + : QCameraFocusControl(parent) + , m_session(session) + , m_focusMode(QCameraFocus::FocusModes()) + , m_focusPointMode(QCameraFocus::FocusPointAuto) + , m_customFocusPoint(QPointF(0, 0)) +{ +} + +QCameraFocus::FocusModes BbCameraFocusControl::focusMode() const +{ + camera_focusmode_t focusMode = CAMERA_FOCUSMODE_OFF; + + const camera_error_t result = camera_get_focus_mode(m_session->handle(), &focusMode); + if (result != CAMERA_EOK) { + qWarning() << "Unable to retrieve focus mode from camera:" << result; + return QCameraFocus::FocusModes(); + } + + switch (focusMode) { + case CAMERA_FOCUSMODE_EDOF: + return QCameraFocus::HyperfocalFocus; + case CAMERA_FOCUSMODE_MANUAL: + return QCameraFocus::ManualFocus; + case CAMERA_FOCUSMODE_AUTO: + return QCameraFocus::AutoFocus; + case CAMERA_FOCUSMODE_MACRO: + return QCameraFocus::MacroFocus; + case CAMERA_FOCUSMODE_CONTINUOUS_AUTO: + return QCameraFocus::ContinuousFocus; + case CAMERA_FOCUSMODE_CONTINUOUS_MACRO: // fall through + case CAMERA_FOCUSMODE_OFF: // fall through + default: + return QCameraFocus::FocusModes(); + } +} + +void BbCameraFocusControl::setFocusMode(QCameraFocus::FocusModes mode) +{ + if (m_focusMode == mode) + return; + + camera_focusmode_t focusMode = CAMERA_FOCUSMODE_OFF; + + if (mode == QCameraFocus::HyperfocalFocus) + focusMode = CAMERA_FOCUSMODE_EDOF; + else if (mode == QCameraFocus::ManualFocus) + focusMode = CAMERA_FOCUSMODE_MANUAL; + else if (mode == QCameraFocus::AutoFocus) + focusMode = CAMERA_FOCUSMODE_AUTO; + else if (mode == QCameraFocus::MacroFocus) + focusMode = CAMERA_FOCUSMODE_MACRO; + else if (mode == QCameraFocus::ContinuousFocus) + focusMode = CAMERA_FOCUSMODE_CONTINUOUS_AUTO; + + const camera_error_t result = camera_set_focus_mode(m_session->handle(), focusMode); + + if (result != CAMERA_EOK) { + qWarning() << "Unable to set focus mode:" << result; + return; + } + + m_focusMode = mode; + emit focusModeChanged(m_focusMode); +} + +bool BbCameraFocusControl::isFocusModeSupported(QCameraFocus::FocusModes mode) const +{ + if (m_session->state() == QCamera::UnloadedState) + return false; + + if (mode == QCameraFocus::HyperfocalFocus) + return false; //TODO how to check? + else if (mode == QCameraFocus::ManualFocus) + return camera_has_feature(m_session->handle(), CAMERA_FEATURE_MANUALFOCUS); + else if (mode == QCameraFocus::AutoFocus) + return camera_has_feature(m_session->handle(), CAMERA_FEATURE_AUTOFOCUS); + else if (mode == QCameraFocus::MacroFocus) + return camera_has_feature(m_session->handle(), CAMERA_FEATURE_MACROFOCUS); + else if (mode == QCameraFocus::ContinuousFocus) + return camera_has_feature(m_session->handle(), CAMERA_FEATURE_AUTOFOCUS); + + return false; +} + +QCameraFocus::FocusPointMode BbCameraFocusControl::focusPointMode() const +{ + return m_focusPointMode; +} + +void BbCameraFocusControl::setFocusPointMode(QCameraFocus::FocusPointMode mode) +{ + if (m_session->status() != QCamera::ActiveStatus) + return; + + if (m_focusPointMode == mode) + return; + + m_focusPointMode = mode; + emit focusPointModeChanged(m_focusPointMode); + + if (m_focusPointMode == QCameraFocus::FocusPointAuto) { + //TODO: is this correct? + const camera_error_t result = camera_set_focus_regions(m_session->handle(), 0, 0); + if (result != CAMERA_EOK) { + qWarning() << "Unable to set focus region:" << result; + return; + } + + emit focusZonesChanged(); + } else if (m_focusPointMode == QCameraFocus::FocusPointCenter) { + // get the size of the viewfinder + int viewfinderWidth = 0; + int viewfinderHeight = 0; + + if (!retrieveViewfinderSize(&viewfinderWidth, &viewfinderHeight)) + return; + + // define a 40x40 pixel focus region in the center of the viewfinder + camera_region_t focusRegion; + focusRegion.left = (viewfinderWidth / 2) - 20; + focusRegion.top = (viewfinderHeight / 2) - 20; + focusRegion.width = 40; + focusRegion.height = 40; + + camera_error_t result = camera_set_focus_regions(m_session->handle(), 1, &focusRegion); + if (result != CAMERA_EOK) { + qWarning() << "Unable to set focus region:" << result; + return; + } + + // re-set focus mode to apply focus region changes + camera_focusmode_t focusMode = CAMERA_FOCUSMODE_OFF; + result = camera_get_focus_mode(m_session->handle(), &focusMode); + camera_set_focus_mode(m_session->handle(), focusMode); + + emit focusZonesChanged(); + + } else if (m_focusPointMode == QCameraFocus::FocusPointFaceDetection) { + //TODO: implement later + } else if (m_focusPointMode == QCameraFocus::FocusPointCustom) { + updateCustomFocusRegion(); + } +} + +bool BbCameraFocusControl::isFocusPointModeSupported(QCameraFocus::FocusPointMode mode) const +{ + if (m_session->state() == QCamera::UnloadedState) + return false; + + if (mode == QCameraFocus::FocusPointAuto) { + return camera_has_feature(m_session->handle(), CAMERA_FEATURE_AUTOFOCUS); + } else if (mode == QCameraFocus::FocusPointCenter) { + return camera_has_feature(m_session->handle(), CAMERA_FEATURE_REGIONFOCUS); + } else if (mode == QCameraFocus::FocusPointFaceDetection) { + return false; //TODO: implement via custom region in combination with face detection in viewfinder + } else if (mode == QCameraFocus::FocusPointCustom) { + return camera_has_feature(m_session->handle(), CAMERA_FEATURE_REGIONFOCUS); + } + + return false; +} + +QPointF BbCameraFocusControl::customFocusPoint() const +{ + return m_customFocusPoint; +} + +void BbCameraFocusControl::setCustomFocusPoint(const QPointF &point) +{ + if (m_customFocusPoint == point) + return; + + m_customFocusPoint = point; + emit customFocusPointChanged(m_customFocusPoint); + + updateCustomFocusRegion(); +} + +QCameraFocusZoneList BbCameraFocusControl::focusZones() const +{ + if (m_session->state() == QCamera::UnloadedState) + return QCameraFocusZoneList(); + + camera_region_t regions[20]; + int supported = 0; + int asked = 0; + camera_error_t result = camera_get_focus_regions(m_session->handle(), 20, &supported, &asked, regions); + + if (result != CAMERA_EOK) { + qWarning() << "Unable to retrieve focus regions:" << result; + return QCameraFocusZoneList(); + } + + // retrieve width and height of viewfinder + int viewfinderWidth = 0; + int viewfinderHeight = 0; + if (m_session->captureMode() & QCamera::CaptureStillImage) + result = camera_get_photovf_property(m_session->handle(), + CAMERA_IMGPROP_WIDTH, &viewfinderWidth, + CAMERA_IMGPROP_HEIGHT, &viewfinderHeight); + else if (m_session->captureMode() & QCamera::CaptureVideo) + result = camera_get_videovf_property(m_session->handle(), + CAMERA_IMGPROP_WIDTH, &viewfinderWidth, + CAMERA_IMGPROP_HEIGHT, &viewfinderHeight); + + if (result != CAMERA_EOK) { + qWarning() << "Unable to retrieve viewfinder size:" << result; + return QCameraFocusZoneList(); + } + + QCameraFocusZoneList list; + for (int i = 0; i < asked; ++i) { + const int x = regions[i].left; + const int y = regions[i].top; + const int width = regions[i].width; + const int height = regions[i].height; + + QRectF rect(static_cast(x)/static_cast(viewfinderWidth), + static_cast(y)/static_cast(viewfinderHeight), + static_cast(width)/static_cast(viewfinderWidth), + static_cast(height)/static_cast(viewfinderHeight)); + + list << QCameraFocusZone(rect, QCameraFocusZone::Focused); //TODO: how to know if a zone is unused/selected/focused?!? + } + + return list; +} + +void BbCameraFocusControl::updateCustomFocusRegion() +{ + // get the size of the viewfinder + int viewfinderWidth = 0; + int viewfinderHeight = 0; + + if (!retrieveViewfinderSize(&viewfinderWidth, &viewfinderHeight)) + return; + + // define a 40x40 pixel focus region around the custom focus point + camera_region_t focusRegion; + focusRegion.left = qMax(0, static_cast(m_customFocusPoint.x() * viewfinderWidth) - 20); + focusRegion.top = qMax(0, static_cast(m_customFocusPoint.y() * viewfinderHeight) - 20); + focusRegion.width = 40; + focusRegion.height = 40; + + camera_error_t result = camera_set_focus_regions(m_session->handle(), 1, &focusRegion); + if (result != CAMERA_EOK) { + qWarning() << "Unable to set focus region:" << result; + return; + } + + // re-set focus mode to apply focus region changes + camera_focusmode_t focusMode = CAMERA_FOCUSMODE_OFF; + result = camera_get_focus_mode(m_session->handle(), &focusMode); + camera_set_focus_mode(m_session->handle(), focusMode); + + emit focusZonesChanged(); +} + +bool BbCameraFocusControl::retrieveViewfinderSize(int *width, int *height) +{ + if (!width || !height) + return false; + + camera_error_t result = CAMERA_EOK; + if (m_session->captureMode() & QCamera::CaptureStillImage) + result = camera_get_photovf_property(m_session->handle(), + CAMERA_IMGPROP_WIDTH, width, + CAMERA_IMGPROP_HEIGHT, height); + else if (m_session->captureMode() & QCamera::CaptureVideo) + result = camera_get_videovf_property(m_session->handle(), + CAMERA_IMGPROP_WIDTH, width, + CAMERA_IMGPROP_HEIGHT, height); + + if (result != CAMERA_EOK) { + qWarning() << "Unable to retrieve viewfinder size:" << result; + return false; + } + + return true; +} + +QT_END_NAMESPACE diff --git a/src/plugins/blackberry/camera/bbcamerafocuscontrol.h b/src/plugins/blackberry/camera/bbcamerafocuscontrol.h new file mode 100644 index 00000000..052c29b4 --- /dev/null +++ b/src/plugins/blackberry/camera/bbcamerafocuscontrol.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Research In Motion +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef BBCAMERAFOCUSCONTROL_H +#define BBCAMERAFOCUSCONTROL_H + +#include + +QT_BEGIN_NAMESPACE + +class BbCameraSession; + +class BbCameraFocusControl : public QCameraFocusControl +{ + Q_OBJECT +public: + explicit BbCameraFocusControl(BbCameraSession *session, QObject *parent = 0); + + QCameraFocus::FocusModes focusMode() const Q_DECL_OVERRIDE; + void setFocusMode(QCameraFocus::FocusModes mode) Q_DECL_OVERRIDE; + bool isFocusModeSupported(QCameraFocus::FocusModes mode) const Q_DECL_OVERRIDE; + QCameraFocus::FocusPointMode focusPointMode() const Q_DECL_OVERRIDE; + void setFocusPointMode(QCameraFocus::FocusPointMode mode) Q_DECL_OVERRIDE; + bool isFocusPointModeSupported(QCameraFocus::FocusPointMode mode) const Q_DECL_OVERRIDE; + QPointF customFocusPoint() const Q_DECL_OVERRIDE; + void setCustomFocusPoint(const QPointF &point) Q_DECL_OVERRIDE; + QCameraFocusZoneList focusZones() const Q_DECL_OVERRIDE; + +private: + void updateCustomFocusRegion(); + bool retrieveViewfinderSize(int *width, int *height); + + BbCameraSession *m_session; + + QCameraFocus::FocusModes m_focusMode; + QCameraFocus::FocusPointMode m_focusPointMode; + QPointF m_customFocusPoint; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/blackberry/camera/bbcameraimagecapturecontrol.cpp b/src/plugins/blackberry/camera/bbcameraimagecapturecontrol.cpp new file mode 100644 index 00000000..a2f61f73 --- /dev/null +++ b/src/plugins/blackberry/camera/bbcameraimagecapturecontrol.cpp @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Research In Motion +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "bbcameraimagecapturecontrol.h" + +#include "bbcamerasession.h" + +QT_BEGIN_NAMESPACE + +BbCameraImageCaptureControl::BbCameraImageCaptureControl(BbCameraSession *session, QObject *parent) + : QCameraImageCaptureControl(parent) + , m_session(session) +{ + connect(m_session, SIGNAL(readyForCaptureChanged(bool)), this, SIGNAL(readyForCaptureChanged(bool))); + connect(m_session, SIGNAL(imageExposed(int)), this, SIGNAL(imageExposed(int))); + connect(m_session, SIGNAL(imageCaptured(int,QImage)), this, SIGNAL(imageCaptured(int,QImage))); + connect(m_session, SIGNAL(imageMetadataAvailable(int,QString,QVariant)), this, SIGNAL(imageMetadataAvailable(int,QString,QVariant))); + connect(m_session, SIGNAL(imageAvailable(int,QVideoFrame)), this, SIGNAL(imageAvailable(int,QVideoFrame))); + connect(m_session, SIGNAL(imageSaved(int,QString)), this, SIGNAL(imageSaved(int,QString))); + connect(m_session, SIGNAL(imageCaptureError(int,int,QString)), this, SIGNAL(error(int,int,QString))); +} + +bool BbCameraImageCaptureControl::isReadyForCapture() const +{ + return m_session->isReadyForCapture(); +} + +QCameraImageCapture::DriveMode BbCameraImageCaptureControl::driveMode() const +{ + return m_session->driveMode(); +} + +void BbCameraImageCaptureControl::setDriveMode(QCameraImageCapture::DriveMode mode) +{ + m_session->setDriveMode(mode); +} + +int BbCameraImageCaptureControl::capture(const QString &fileName) +{ + return m_session->capture(fileName); +} + +void BbCameraImageCaptureControl::cancelCapture() +{ + m_session->cancelCapture(); +} + +QT_END_NAMESPACE diff --git a/src/plugins/blackberry/camera/bbcameraimagecapturecontrol.h b/src/plugins/blackberry/camera/bbcameraimagecapturecontrol.h new file mode 100644 index 00000000..a73a4f1d --- /dev/null +++ b/src/plugins/blackberry/camera/bbcameraimagecapturecontrol.h @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Research In Motion +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef BBCAMERAIMAGECAPTURECONTROL_H +#define BBCAMERAIMAGECAPTURECONTROL_H + +#include + +QT_BEGIN_NAMESPACE + +class BbCameraSession; + +class BbCameraImageCaptureControl : public QCameraImageCaptureControl +{ + Q_OBJECT +public: + explicit BbCameraImageCaptureControl(BbCameraSession *session, QObject *parent = 0); + + bool isReadyForCapture() const Q_DECL_OVERRIDE; + + QCameraImageCapture::DriveMode driveMode() const Q_DECL_OVERRIDE; + void setDriveMode(QCameraImageCapture::DriveMode mode) Q_DECL_OVERRIDE; + + int capture(const QString &fileName) Q_DECL_OVERRIDE; + void cancelCapture() Q_DECL_OVERRIDE; + +private: + BbCameraSession *m_session; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/blackberry/camera/bbcameraimageprocessingcontrol.cpp b/src/plugins/blackberry/camera/bbcameraimageprocessingcontrol.cpp new file mode 100644 index 00000000..54ae48c6 --- /dev/null +++ b/src/plugins/blackberry/camera/bbcameraimageprocessingcontrol.cpp @@ -0,0 +1,146 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Research In Motion +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "bbcameraimageprocessingcontrol.h" + +#include "bbcamerasession.h" + +#include + +QT_BEGIN_NAMESPACE + +BbCameraImageProcessingControl::BbCameraImageProcessingControl(BbCameraSession *session, QObject *parent) + : QCameraImageProcessingControl(parent) + , m_session(session) +{ +} + +bool BbCameraImageProcessingControl::isParameterSupported(ProcessingParameter parameter) const +{ + return (parameter == QCameraImageProcessingControl::WhiteBalancePreset); +} + +bool BbCameraImageProcessingControl::isParameterValueSupported(ProcessingParameter parameter, const QVariant &value) const +{ + if (parameter != QCameraImageProcessingControl::WhiteBalancePreset) + return false; + + if (m_session->handle() == CAMERA_HANDLE_INVALID) + return false; + + int supported = 0; + camera_whitebalancemode_t modes[20]; + const camera_error_t result = camera_get_whitebalance_modes(m_session->handle(), 20, &supported, modes); + + if (result != CAMERA_EOK) { + qWarning() << "Unable to retrieve supported whitebalance modes:" << result; + return false; + } + + QSet supportedModes; + for (int i = 0; i < supported; ++i) { + switch (modes[i]) { + case CAMERA_WHITEBALANCEMODE_AUTO: + supportedModes.insert(QCameraImageProcessing::WhiteBalanceAuto); + break; + case CAMERA_WHITEBALANCEMODE_MANUAL: + supportedModes.insert(QCameraImageProcessing::WhiteBalanceManual); + break; + default: + break; + } + } + + return supportedModes.contains(value.value()); +} + +QVariant BbCameraImageProcessingControl::parameter(ProcessingParameter parameter) const +{ + if (parameter != QCameraImageProcessingControl::WhiteBalancePreset) + return QVariant(); + + if (m_session->handle() == CAMERA_HANDLE_INVALID) + return QVariant(); + + camera_whitebalancemode_t mode; + const camera_error_t result = camera_get_whitebalance_mode(m_session->handle(), &mode); + + if (result != CAMERA_EOK) { + qWarning() << "Unable to retrieve current whitebalance mode:" << result; + return QVariant(); + } + + switch (mode) { + case CAMERA_WHITEBALANCEMODE_AUTO: + return QVariant::fromValue(QCameraImageProcessing::WhiteBalanceAuto); + case CAMERA_WHITEBALANCEMODE_MANUAL: + return QVariant::fromValue(QCameraImageProcessing::WhiteBalanceManual); + default: + return QVariant(); + } +} + +void BbCameraImageProcessingControl::setParameter(ProcessingParameter parameter, const QVariant &value) +{ + if (parameter != QCameraImageProcessingControl::WhiteBalancePreset) + return; + + if (m_session->handle() == CAMERA_HANDLE_INVALID) + return; + + camera_whitebalancemode_t mode = CAMERA_WHITEBALANCEMODE_DEFAULT; + switch (value.value()) { + case QCameraImageProcessing::WhiteBalanceAuto: + mode = CAMERA_WHITEBALANCEMODE_AUTO; + break; + case QCameraImageProcessing::WhiteBalanceManual: + mode = CAMERA_WHITEBALANCEMODE_MANUAL; + break; + default: + break; + } + + const camera_error_t result = camera_set_whitebalance_mode(m_session->handle(), mode); + + if (result != CAMERA_EOK) + qWarning() << "Unable to set whitebalance mode:" << result; +} + +QT_END_NAMESPACE diff --git a/src/plugins/blackberry/camera/bbcameraimageprocessingcontrol.h b/src/plugins/blackberry/camera/bbcameraimageprocessingcontrol.h new file mode 100644 index 00000000..ec16d66d --- /dev/null +++ b/src/plugins/blackberry/camera/bbcameraimageprocessingcontrol.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Research In Motion +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef BBCAMERAIMAGEPROCESSINGCONTROL_H +#define BBCAMERAIMAGEPROCESSINGCONTROL_H + +#include + +QT_BEGIN_NAMESPACE + +class BbCameraSession; + +class BbCameraImageProcessingControl : public QCameraImageProcessingControl +{ + Q_OBJECT +public: + explicit BbCameraImageProcessingControl(BbCameraSession *session, QObject *parent = 0); + + bool isParameterSupported(ProcessingParameter) const Q_DECL_OVERRIDE; + bool isParameterValueSupported(ProcessingParameter parameter, const QVariant &value) const Q_DECL_OVERRIDE; + QVariant parameter(ProcessingParameter parameter) const Q_DECL_OVERRIDE; + void setParameter(ProcessingParameter parameter, const QVariant &value) Q_DECL_OVERRIDE; + +private: + BbCameraSession *m_session; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/blackberry/camera/bbcameralockscontrol.cpp b/src/plugins/blackberry/camera/bbcameralockscontrol.cpp new file mode 100644 index 00000000..47194054 --- /dev/null +++ b/src/plugins/blackberry/camera/bbcameralockscontrol.cpp @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Research In Motion +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "bbcameralockscontrol.h" + +#include "bbcamerasession.h" + +QT_BEGIN_NAMESPACE + +BbCameraLocksControl::BbCameraLocksControl(BbCameraSession *session, QObject *parent) + : QCameraLocksControl(parent) + , m_session(session) +{ + connect(m_session, SIGNAL(lockStatusChanged(QCamera::LockType,QCamera::LockStatus,QCamera::LockChangeReason)), + this, SIGNAL(lockStatusChanged(QCamera::LockType,QCamera::LockStatus,QCamera::LockChangeReason))); +} + +QCamera::LockTypes BbCameraLocksControl::supportedLocks() const +{ + return m_session->supportedLocks(); +} + +QCamera::LockStatus BbCameraLocksControl::lockStatus(QCamera::LockType lock) const +{ + return m_session->lockStatus(lock); +} + +void BbCameraLocksControl::searchAndLock(QCamera::LockTypes locks) +{ + m_session->searchAndLock(locks); +} + +void BbCameraLocksControl::unlock(QCamera::LockTypes locks) +{ + m_session->unlock(locks); +} + +QT_END_NAMESPACE diff --git a/src/plugins/blackberry/camera/bbcameralockscontrol.h b/src/plugins/blackberry/camera/bbcameralockscontrol.h new file mode 100644 index 00000000..6c4b2da6 --- /dev/null +++ b/src/plugins/blackberry/camera/bbcameralockscontrol.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Research In Motion +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef BBCAMERALOCKSCONTROL_H +#define BBCAMERALOCKSCONTROL_H + +#include + +QT_BEGIN_NAMESPACE + +class BbCameraSession; + +class BbCameraLocksControl : public QCameraLocksControl +{ + Q_OBJECT +public: + explicit BbCameraLocksControl(BbCameraSession *session, QObject *parent = 0); + + QCamera::LockTypes supportedLocks() const Q_DECL_OVERRIDE; + QCamera::LockStatus lockStatus(QCamera::LockType lock) const Q_DECL_OVERRIDE; + void searchAndLock(QCamera::LockTypes locks) Q_DECL_OVERRIDE; + void unlock(QCamera::LockTypes locks) Q_DECL_OVERRIDE; + +private: + BbCameraSession *m_session; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/blackberry/camera/bbcameramediarecordercontrol.cpp b/src/plugins/blackberry/camera/bbcameramediarecordercontrol.cpp new file mode 100644 index 00000000..a4a42abf --- /dev/null +++ b/src/plugins/blackberry/camera/bbcameramediarecordercontrol.cpp @@ -0,0 +1,158 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Research In Motion +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "bbcameramediarecordercontrol.h" + +#include "bbcamerasession.h" + +#include +#include + +#include