diff options
Diffstat (limited to 'src/multimediakit')
132 files changed, 831 insertions, 6482 deletions
diff --git a/src/multimediakit/audio/qaudio.h b/src/multimediakit/audio/qaudio.h index b420d878c..16accfef9 100644 --- a/src/multimediakit/audio/qaudio.h +++ b/src/multimediakit/audio/qaudio.h @@ -51,6 +51,9 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE + +QT_MODULE(Multimedia) + //QTM_SYNC_HEADER_EXPORT QAudio namespace QAudio diff --git a/src/multimediakit/audio/qaudio_mac_p.h b/src/multimediakit/audio/qaudio_mac_p.h index 4acff79d0..06ce43010 100644 --- a/src/multimediakit/audio/qaudio_mac_p.h +++ b/src/multimediakit/audio/qaudio_mac_p.h @@ -65,6 +65,9 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + extern QDebug operator<<(QDebug dbg, const QAudioFormat& audioFormat); diff --git a/src/multimediakit/audio/qaudiodevicefactory_p.h b/src/multimediakit/audio/qaudiodevicefactory_p.h index 74104bb73..16ddb573a 100644 --- a/src/multimediakit/audio/qaudiodevicefactory_p.h +++ b/src/multimediakit/audio/qaudiodevicefactory_p.h @@ -65,6 +65,9 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QAbstractAudioInput; class QAbstractAudioOutput; class QAbstractAudioDeviceInfo; diff --git a/src/multimediakit/audio/qaudiodeviceinfo.cpp b/src/multimediakit/audio/qaudiodeviceinfo.cpp index 4b71b273b..6b6f7951e 100644 --- a/src/multimediakit/audio/qaudiodeviceinfo.cpp +++ b/src/multimediakit/audio/qaudiodeviceinfo.cpp @@ -188,8 +188,6 @@ bool QAudioDeviceInfo::isNull() const Device names vary depending on the platform/audio plugin being used. - XXX - They are a unique string identifier for the audio device. eg. default, Intel, U0x46d0x9a4 diff --git a/src/multimediakit/audio/qaudiodeviceinfo.h b/src/multimediakit/audio/qaudiodeviceinfo.h index 703447910..e8616ce35 100644 --- a/src/multimediakit/audio/qaudiodeviceinfo.h +++ b/src/multimediakit/audio/qaudiodeviceinfo.h @@ -59,6 +59,9 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QAudioDeviceFactory; class QAudioDeviceInfoPrivate; diff --git a/src/multimediakit/audio/qaudiodeviceinfo_alsa_p.h b/src/multimediakit/audio/qaudiodeviceinfo_alsa_p.h index 5afc8f8c4..cf19d2554 100644 --- a/src/multimediakit/audio/qaudiodeviceinfo_alsa_p.h +++ b/src/multimediakit/audio/qaudiodeviceinfo_alsa_p.h @@ -65,8 +65,13 @@ #include "qaudiodeviceinfo.h" #include "qaudiosystem.h" +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + const unsigned int MAX_SAMPLE_RATES = 5; const unsigned int SAMPLE_RATES[] = { 8000, 11025, 22050, 44100, 48000 }; @@ -117,5 +122,8 @@ private: QT_END_NAMESPACE +QT_END_HEADER + + #endif diff --git a/src/multimediakit/audio/qaudiodeviceinfo_mac_p.h b/src/multimediakit/audio/qaudiodeviceinfo_mac_p.h index 099d7fd61..3b9ca4676 100644 --- a/src/multimediakit/audio/qaudiodeviceinfo_mac_p.h +++ b/src/multimediakit/audio/qaudiodeviceinfo_mac_p.h @@ -62,6 +62,9 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QAudioDeviceInfoInternal : public QAbstractAudioDeviceInfo { public: diff --git a/src/multimediakit/audio/qaudiodeviceinfo_win32_p.h b/src/multimediakit/audio/qaudiodeviceinfo_win32_p.h index 9ed3b66d5..2d4e27106 100644 --- a/src/multimediakit/audio/qaudiodeviceinfo_win32_p.h +++ b/src/multimediakit/audio/qaudiodeviceinfo_win32_p.h @@ -63,8 +63,13 @@ #include <qaudiosystem.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + const unsigned int MAX_SAMPLE_RATES = 5; const unsigned int SAMPLE_RATES[] = { 8000, 11025, 22050, 44100, 48000 }; @@ -109,4 +114,7 @@ private: QT_END_NAMESPACE +QT_END_HEADER + + #endif diff --git a/src/multimediakit/audio/qaudioformat.h b/src/multimediakit/audio/qaudioformat.h index ebee33a7b..c6600cdcf 100644 --- a/src/multimediakit/audio/qaudioformat.h +++ b/src/multimediakit/audio/qaudioformat.h @@ -53,6 +53,9 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QAudioFormatPrivate; diff --git a/src/multimediakit/audio/qaudioinput.cpp b/src/multimediakit/audio/qaudioinput.cpp index bb4f89653..4a6bfaefd 100644 --- a/src/multimediakit/audio/qaudioinput.cpp +++ b/src/multimediakit/audio/qaudioinput.cpp @@ -57,12 +57,6 @@ QT_BEGIN_NAMESPACE \ingroup multimedia \since 1.0 - XXX Needs more blurb about use cases etc - Link to terminology etc - Push/Pull mode - State diagram - - You can construct an audio input with the system's \l{QAudioDeviceInfo::defaultInputDevice()}{default audio input device}. It is also possible to create QAudioInput with a diff --git a/src/multimediakit/audio/qaudioinput.h b/src/multimediakit/audio/qaudioinput.h index 13d3cb015..8684a10fe 100644 --- a/src/multimediakit/audio/qaudioinput.h +++ b/src/multimediakit/audio/qaudioinput.h @@ -57,6 +57,9 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QAbstractAudioInput; diff --git a/src/multimediakit/audio/qaudioinput_alsa_p.h b/src/multimediakit/audio/qaudioinput_alsa_p.h index 2a5b3df1a..a05f6954d 100644 --- a/src/multimediakit/audio/qaudioinput_alsa_p.h +++ b/src/multimediakit/audio/qaudioinput_alsa_p.h @@ -67,8 +67,13 @@ #include "qaudiodeviceinfo.h" #include "qaudiosystem.h" +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class InputPrivate; class RingBuffer @@ -180,4 +185,7 @@ private: QT_END_NAMESPACE +QT_END_HEADER + + #endif diff --git a/src/multimediakit/audio/qaudioinput_mac_p.h b/src/multimediakit/audio/qaudioinput_mac_p.h index cc0e62b11..99e8ad061 100644 --- a/src/multimediakit/audio/qaudioinput_mac_p.h +++ b/src/multimediakit/audio/qaudioinput_mac_p.h @@ -72,6 +72,9 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QTimer; class QIODevice; class QAbstractAudioDeviceInfo; diff --git a/src/multimediakit/audio/qaudioinput_win32_p.h b/src/multimediakit/audio/qaudioinput_win32_p.h index 0fc1ae8a6..10d41a552 100644 --- a/src/multimediakit/audio/qaudioinput_win32_p.h +++ b/src/multimediakit/audio/qaudioinput_win32_p.h @@ -69,8 +69,13 @@ #include <qaudiosystem.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + // For compat with 4.6 #if !defined(QT_WIN_CALLBACK) # if defined(Q_CC_MINGW) @@ -168,4 +173,7 @@ private: QT_END_NAMESPACE +QT_END_HEADER + + #endif diff --git a/src/multimediakit/audio/qaudiooutput.cpp b/src/multimediakit/audio/qaudiooutput.cpp index 10496bd98..ea9dcb11f 100644 --- a/src/multimediakit/audio/qaudiooutput.cpp +++ b/src/multimediakit/audio/qaudiooutput.cpp @@ -58,8 +58,6 @@ QT_BEGIN_NAMESPACE \ingroup multimedia \since 1.0 - XXX - You can construct an audio output with the system's \l{QAudioDeviceInfo::defaultOutputDevice()}{default audio output device}. It is also possible to create QAudioOutput with a @@ -148,7 +146,7 @@ QAudioOutput::QAudioOutput(const QAudioDeviceInfo &audioDevice, const QAudioForm /*! Destroys this audio output. - XXX This will release any system resources used and free any buffers. + This will release any system resources used and free any buffers. */ QAudioOutput::~QAudioOutput() { @@ -207,7 +205,6 @@ QIODevice* QAudioOutput::start() /*! Stops the audio output, detaching from the system resource. - XXX Sets error() to QAudio::NoError, state() to QAudio::StoppedState and emit stateChanged() signal. \since 1.0 @@ -220,7 +217,6 @@ void QAudioOutput::stop() /*! Drops all audio data in the buffers, resets buffers to zero. - XXX what about state \since 1.0 */ void QAudioOutput::reset() @@ -231,8 +227,6 @@ void QAudioOutput::reset() /*! Stops processing audio data, preserving buffered audio data. - XXX - Sets error() to QAudio::NoError, state() to QAudio::SuspendedState and emits stateChanged() signal. \since 1.0 @@ -245,8 +239,6 @@ void QAudioOutput::suspend() /*! Resumes processing audio data after a suspend(). -XXX - Sets error() to QAudio::NoError. Sets state() to QAudio::ActiveState if you previously called start(QIODevice*). Sets state() to QAudio::IdleState if you previously called start(). diff --git a/src/multimediakit/audio/qaudiooutput.h b/src/multimediakit/audio/qaudiooutput.h index bc7fa62db..b61c4d9f3 100644 --- a/src/multimediakit/audio/qaudiooutput.h +++ b/src/multimediakit/audio/qaudiooutput.h @@ -57,6 +57,9 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QAbstractAudioOutput; diff --git a/src/multimediakit/audio/qaudiooutput_alsa_p.h b/src/multimediakit/audio/qaudiooutput_alsa_p.h index 953dc7ae7..f914ded2c 100644 --- a/src/multimediakit/audio/qaudiooutput_alsa_p.h +++ b/src/multimediakit/audio/qaudiooutput_alsa_p.h @@ -66,8 +66,13 @@ #include "qaudiodeviceinfo.h" #include "qaudiosystem.h" +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class OutputPrivate; class QAudioOutputPrivate : public QAbstractAudioOutput @@ -164,4 +169,7 @@ private: QT_END_NAMESPACE +QT_END_HEADER + + #endif diff --git a/src/multimediakit/audio/qaudiooutput_mac_p.h b/src/multimediakit/audio/qaudiooutput_mac_p.h index 8e7a11919..d1cf680b1 100644 --- a/src/multimediakit/audio/qaudiooutput_mac_p.h +++ b/src/multimediakit/audio/qaudiooutput_mac_p.h @@ -72,6 +72,9 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QIODevice; class QAbstractAudioDeviceInfo; diff --git a/src/multimediakit/audio/qaudiooutput_win32_p.h b/src/multimediakit/audio/qaudiooutput_win32_p.h index 6ca6fc562..aa86d4e9b 100644 --- a/src/multimediakit/audio/qaudiooutput_win32_p.h +++ b/src/multimediakit/audio/qaudiooutput_win32_p.h @@ -76,8 +76,13 @@ # endif #endif +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QAudioOutputPrivate : public QAbstractAudioOutput { Q_OBJECT @@ -164,4 +169,7 @@ private: QT_END_NAMESPACE +QT_END_HEADER + + #endif diff --git a/src/multimediakit/audio/qaudiopluginloader.cpp b/src/multimediakit/audio/qaudiopluginloader.cpp index 2807fcf9d..4aa24d57b 100644 --- a/src/multimediakit/audio/qaudiopluginloader.cpp +++ b/src/multimediakit/audio/qaudiopluginloader.cpp @@ -43,7 +43,7 @@ #include "qaudiopluginloader_p.h" #include <QtCore/qcoreapplication.h> -#include <QtGui/qapplication.h> +#include <QtWidgets/qapplication.h> #include <QtCore/qpluginloader.h> #include <QtCore/qfactoryinterface.h> #include <QtCore/qdir.h> @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE QAudioPluginLoader::QAudioPluginLoader(const char *iid, const QString &location, Qt::CaseSensitivity): m_iid(iid) { - m_location = location + "/"; + m_location = location + QLatin1Char('/'); load(); } diff --git a/src/multimediakit/audio/qaudiopluginloader_p.h b/src/multimediakit/audio/qaudiopluginloader_p.h index 89d9679d8..a0f130fd1 100644 --- a/src/multimediakit/audio/qaudiopluginloader_p.h +++ b/src/multimediakit/audio/qaudiopluginloader_p.h @@ -61,8 +61,13 @@ #include <QtCore/qpluginloader.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QAudioPluginLoader { public: @@ -89,4 +94,7 @@ private: QT_END_NAMESPACE +QT_END_HEADER + + #endif // QAUDIOPLUGINLOADER_H diff --git a/src/multimediakit/audio/qaudiosystem.h b/src/multimediakit/audio/qaudiosystem.h index 6773343ad..7430528a8 100644 --- a/src/multimediakit/audio/qaudiosystem.h +++ b/src/multimediakit/audio/qaudiosystem.h @@ -53,6 +53,9 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class Q_MULTIMEDIA_EXPORT QAbstractAudioDeviceInfo : public QObject { Q_OBJECT diff --git a/src/multimediakit/audio/qaudiosystemplugin.h b/src/multimediakit/audio/qaudiosystemplugin.h index 13e642fde..5a876dedb 100644 --- a/src/multimediakit/audio/qaudiosystemplugin.h +++ b/src/multimediakit/audio/qaudiosystemplugin.h @@ -58,6 +58,9 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + struct Q_MULTIMEDIA_EXPORT QAudioSystemFactoryInterface : public QFactoryInterface { virtual QList<QByteArray> availableDevices(QAudio::Mode) const = 0; diff --git a/src/multimediakit/effects/qsamplecache_p.cpp b/src/multimediakit/effects/qsamplecache_p.cpp index da550e8ae..1610a4382 100644 --- a/src/multimediakit/effects/qsamplecache_p.cpp +++ b/src/multimediakit/effects/qsamplecache_p.cpp @@ -297,7 +297,7 @@ void QSample::addRef() // Called in loading thread void QSample::readSample() { - Q_ASSERT(QThread::currentThread()->objectName() == "QSampleCache::LoadingThread"); + Q_ASSERT(QThread::currentThread()->objectName() == QLatin1String("QSampleCache::LoadingThread")); QMutexLocker m(&m_mutex); #ifdef QT_SAMPLECACHE_DEBUG qDebug() << "QSample: readSample"; @@ -316,7 +316,7 @@ void QSample::readSample() // Called in loading thread void QSample::decoderReady() { - Q_ASSERT(QThread::currentThread()->objectName() == "QSampleCache::LoadingThread"); + Q_ASSERT(QThread::currentThread()->objectName() == QLatin1String("QSampleCache::LoadingThread")); QMutexLocker m(&m_mutex); #ifdef QT_SAMPLECACHE_DEBUG qDebug() << "QSample: decoder ready"; @@ -343,7 +343,7 @@ QSample::State QSample::state() const // Essentially a second ctor, doesn't need locks (?) void QSample::load() { - Q_ASSERT(QThread::currentThread()->objectName() == "QSampleCache::LoadingThread"); + Q_ASSERT(QThread::currentThread()->objectName() == QLatin1String("QSampleCache::LoadingThread")); #ifdef QT_SAMPLECACHE_DEBUG qDebug() << "QSample: load [" << m_url << "]"; #endif @@ -358,7 +358,7 @@ void QSample::load() // Called in loading thread void QSample::decoderError() { - Q_ASSERT(QThread::currentThread()->objectName() == "QSampleCache::LoadingThread"); + Q_ASSERT(QThread::currentThread()->objectName() == QLatin1String("QSampleCache::LoadingThread")); QMutexLocker m(&m_mutex); #ifdef QT_SAMPLECACHE_DEBUG qDebug() << "QSample: decoder error"; @@ -371,7 +371,7 @@ void QSample::decoderError() // Called in loading thread from decoder when sample is done. Locked already. void QSample::onReady() { - Q_ASSERT(QThread::currentThread()->objectName() == "QSampleCache::LoadingThread"); + Q_ASSERT(QThread::currentThread()->objectName() == QLatin1String("QSampleCache::LoadingThread")); #ifdef QT_SAMPLECACHE_DEBUG qDebug() << "QSample: load ready"; #endif diff --git a/src/multimediakit/effects/qsamplecache_p.h b/src/multimediakit/effects/qsamplecache_p.h index fbe246008..91ca457e6 100644 --- a/src/multimediakit/effects/qsamplecache_p.h +++ b/src/multimediakit/effects/qsamplecache_p.h @@ -66,6 +66,9 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QNetworkAccessManager; class QSampleCache; class QWaveDecoder; diff --git a/src/multimediakit/effects/qsoundeffect_p.h b/src/multimediakit/effects/qsoundeffect_p.h index de8de12a3..4d6764742 100644 --- a/src/multimediakit/effects/qsoundeffect_p.h +++ b/src/multimediakit/effects/qsoundeffect_p.h @@ -63,6 +63,9 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QSoundEffectPrivate; class Q_MULTIMEDIA_EXPORT QSoundEffect : public QObject diff --git a/src/multimediakit/effects/qsoundeffect_pulse_p.cpp b/src/multimediakit/effects/qsoundeffect_pulse_p.cpp index f65fd9995..4570f8fd5 100644 --- a/src/multimediakit/effects/qsoundeffect_pulse_p.cpp +++ b/src/multimediakit/effects/qsoundeffect_pulse_p.cpp @@ -359,6 +359,8 @@ void QSoundEffectPrivate::setSource(const QUrl &url) case QSample::Error: decoderError(); break; + default: + break; } } diff --git a/src/multimediakit/effects/qsoundeffect_pulse_p.h b/src/multimediakit/effects/qsoundeffect_pulse_p.h index 6653f0533..c78bcdec5 100644 --- a/src/multimediakit/effects/qsoundeffect_pulse_p.h +++ b/src/multimediakit/effects/qsoundeffect_pulse_p.h @@ -66,6 +66,9 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QSoundEffectPrivate : public QObject { Q_OBJECT diff --git a/src/multimediakit/effects/qsoundeffect_qmedia_p.h b/src/multimediakit/effects/qsoundeffect_qmedia_p.h index 9e5dd25db..adafa04a2 100644 --- a/src/multimediakit/effects/qsoundeffect_qmedia_p.h +++ b/src/multimediakit/effects/qsoundeffect_qmedia_p.h @@ -62,6 +62,9 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QSoundEffectPrivate : public QObject { diff --git a/src/multimediakit/effects/qsoundeffect_qsound_p.cpp b/src/multimediakit/effects/qsoundeffect_qsound_p.cpp index 1706af9f1..0b9082eb5 100644 --- a/src/multimediakit/effects/qsoundeffect_qsound_p.cpp +++ b/src/multimediakit/effects/qsoundeffect_qsound_p.cpp @@ -53,7 +53,7 @@ #include "qsoundeffect_qsound_p.h" #include <QtCore/qcoreapplication.h> -#include <QtGui/qsound.h> +#include <QtWidgets/qsound.h> #include <QtCore/qstringlist.h> diff --git a/src/multimediakit/effects/qsoundeffect_qsound_p.h b/src/multimediakit/effects/qsoundeffect_qsound_p.h index 085a97ea2..c98ad79ce 100644 --- a/src/multimediakit/effects/qsoundeffect_qsound_p.h +++ b/src/multimediakit/effects/qsoundeffect_qsound_p.h @@ -62,6 +62,9 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QSound; class QSoundEffectPrivate : public QObject diff --git a/src/multimediakit/effects/qwavedecoder_p.h b/src/multimediakit/effects/qwavedecoder_p.h index d2e438fe7..6c4c00c25 100644 --- a/src/multimediakit/effects/qwavedecoder_p.h +++ b/src/multimediakit/effects/qwavedecoder_p.h @@ -61,6 +61,9 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QWaveDecoder : public QIODevice { diff --git a/src/multimediakit/multimediakit.pro b/src/multimediakit/multimediakit.pro index 4cc1dbfdc..968832651 100644 --- a/src/multimediakit/multimediakit.pro +++ b/src/multimediakit/multimediakit.pro @@ -9,7 +9,6 @@ CONFIG += module MODULE_PRI += ../../modules/qt_multimediakit.pri contains(QT_CONFIG, opengl) | contains(QT_CONFIG, opengles2) { - QT += opengl } else { DEFINES += QT_NO_OPENGL } @@ -21,6 +20,7 @@ load(qt_module_config) HEADERS += qtmultimediakitversion.h + PRIVATE_HEADERS += \ qmediacontrol_p.h \ qmediaobject_p.h \ @@ -28,9 +28,7 @@ PRIVATE_HEADERS += \ qmediaplaylist_p.h \ qmediaplaylistprovider_p.h \ qmediaimageviewerservice_p.h \ - qvideowidget_p.h \ qmediapluginloader_p.h \ - qpaintervideosurface_p.h \ qvideosurfaceoutput_p.h PUBLIC_HEADERS += \ @@ -46,6 +44,7 @@ PUBLIC_HEADERS += \ qmediaplaylistnavigator.h \ qmediaplaylistprovider.h \ qmediaplaylistioplugin.h \ + qmediabackgroundplaybackcontrol.h \ qmediacontent.h \ qmediaresource.h \ qmediarecorder.h \ @@ -59,9 +58,6 @@ PUBLIC_HEADERS += \ qradiotuner.h \ qradiotunercontrol.h \ qtmedianamespace.h \ - qvideowidget.h \ - qvideowindowcontrol.h \ - qvideowidgetcontrol.h \ qaudioencodercontrol.h \ qvideoencodercontrol.h \ qimageencodercontrol.h \ @@ -71,7 +67,6 @@ PUBLIC_HEADERS += \ qmediaplaylistsourcecontrol.h \ qaudioendpointselector.h \ qvideodevicecontrol.h \ - qgraphicsvideoitem.h \ qvideorenderercontrol.h \ qmediatimerange.h \ qmedianetworkaccesscontrol.h \ @@ -102,9 +97,6 @@ SOURCES += qmediacontrol.cpp \ qmediastreamscontrol.cpp \ qradiotuner.cpp \ qradiotunercontrol.cpp \ - qvideowidget.cpp \ - qvideowindowcontrol.cpp \ - qvideowidgetcontrol.cpp \ qaudioencodercontrol.cpp \ qvideoencodercontrol.cpp \ qimageencodercontrol.cpp \ @@ -115,16 +107,15 @@ SOURCES += qmediacontrol.cpp \ qaudioendpointselector.cpp \ qvideodevicecontrol.cpp \ qmediapluginloader.cpp \ - qpaintervideosurface.cpp \ qvideorenderercontrol.cpp \ qmediatimerange.cpp \ qmedianetworkaccesscontrol.cpp \ - qvideosurfaceoutput.cpp + qvideosurfaceoutput.cpp \ + qmediabackgroundplaybackcontrol.cpp #Camera PUBLIC_HEADERS += \ qcamera.h \ - qcameraviewfinder.h \ qcameraimagecapture.h \ qcameraimagecapturecontrol.h \ qcameraexposure.h \ @@ -141,7 +132,6 @@ PUBLIC_HEADERS += \ SOURCES += \ qcamera.cpp \ - qcameraviewfinder.cpp \ qcameraexposure.cpp \ qcamerafocus.cpp \ qcameraimageprocessing.cpp \ @@ -161,29 +151,7 @@ include(video/video.pri) include(effects/effects.pri) mac:!qpa { -!simulator { - HEADERS += qpaintervideosurface_mac_p.h - OBJECTIVE_SOURCES += qpaintervideosurface_mac.mm -} LIBS += -framework AppKit -framework QuartzCore -framework QTKit } -maemo6 { - isEqual(QT_ARCH,armv6) { - HEADERS += qeglimagetexturesurface_p.h - SOURCES += qeglimagetexturesurface.cpp - - SOURCES += qgraphicsvideoitem_maemo6.cpp - - LIBS += -lX11 - } else { - SOURCES += qgraphicsvideoitem.cpp - } -} - -!maemo* { - SOURCES += qgraphicsvideoitem.cpp -} - HEADERS += $$PUBLIC_HEADERS $$PRIVATE_HEADERS - diff --git a/src/multimediakit/qaudiocapturesource.h b/src/multimediakit/qaudiocapturesource.h index 7f2200895..e27450514 100644 --- a/src/multimediakit/qaudiocapturesource.h +++ b/src/multimediakit/qaudiocapturesource.h @@ -55,8 +55,13 @@ #include "qmediaserviceprovider.h" +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QAudioCaptureSourcePrivate; class Q_MULTIMEDIA_EXPORT QAudioCaptureSource : public QMediaObject @@ -92,4 +97,7 @@ private: QT_END_NAMESPACE +QT_END_HEADER + + #endif // QAUDIOCAPTURESOURCE_H diff --git a/src/multimediakit/qaudioencodercontrol.h b/src/multimediakit/qaudioencodercontrol.h index e464bc055..2e3a4bf87 100644 --- a/src/multimediakit/qaudioencodercontrol.h +++ b/src/multimediakit/qaudioencodercontrol.h @@ -47,7 +47,12 @@ #include <QtCore/qlist.h> #include <QtCore/qpair.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE + +QT_MODULE(Multimedia) + class QStringList; class QAudioFormat; QT_END_NAMESPACE @@ -84,4 +89,7 @@ Q_MEDIA_DECLARE_CONTROL(QAudioEncoderControl, QAudioEncoderControl_iid) QT_END_NAMESPACE +QT_END_HEADER + + #endif // QAUDIOCAPTUREPROPERTIESCONTROL_H diff --git a/src/multimediakit/qaudioendpointselector.cpp b/src/multimediakit/qaudioendpointselector.cpp index 9bbe267a3..8f2f28f56 100644 --- a/src/multimediakit/qaudioendpointselector.cpp +++ b/src/multimediakit/qaudioendpointselector.cpp @@ -55,8 +55,6 @@ QT_BEGIN_NAMESPACE endpoints available on a system and allows one to be selected as the audio of a media service. - XXX why do I care - The interface name of QAudioEndpointSelector is \c com.nokia.Qt.QAudioEndpointSelector/1.0 as defined in QAudioEndpointSelector_iid. diff --git a/src/multimediakit/qaudioendpointselector.h b/src/multimediakit/qaudioendpointselector.h index 1fc10904c..00250bc54 100644 --- a/src/multimediakit/qaudioendpointselector.h +++ b/src/multimediakit/qaudioendpointselector.h @@ -45,8 +45,13 @@ #include <qaudio.h> #include <qmediacontrol.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class Q_MULTIMEDIA_EXPORT QAudioEndpointSelector : public QMediaControl { Q_OBJECT @@ -75,4 +80,7 @@ Q_MEDIA_DECLARE_CONTROL(QAudioEndpointSelector, QAudioEndpointSelector_iid) QT_END_NAMESPACE +QT_END_HEADER + + #endif // QAUDIOENDPOINTSELECTOR_H diff --git a/src/multimediakit/qcamera.cpp b/src/multimediakit/qcamera.cpp index d7fb532db..7870c2494 100644 --- a/src/multimediakit/qcamera.cpp +++ b/src/multimediakit/qcamera.cpp @@ -52,8 +52,6 @@ #include <qcameraimageprocessingcontrol.h> #include <qcameraimagecapturecontrol.h> #include <qvideodevicecontrol.h> -#include <qvideowidget.h> -#include <qgraphicsvideoitem.h> #include <qvideosurfaceoutput_p.h> QT_USE_NAMESPACE @@ -365,7 +363,7 @@ QCamera::QCamera(const QByteArray& device, QObject *parent): if (d->service != 0) { //pass device name to service if (d->deviceControl) { - QString deviceName(device); + QString deviceName = QString::fromLatin1(device); for (int i=0; i<d->deviceControl->deviceCount(); i++) { if (d->deviceControl->deviceName(i) == deviceName) { @@ -470,6 +468,8 @@ QCameraImageProcessing *QCamera::imageProcessing() const The previously set viewfinder is detached. \since 1.1 */ + +// QVideoWidget is forward declared void QCamera::setViewfinder(QVideoWidget *viewfinder) { Q_D(QCamera); @@ -478,7 +478,10 @@ void QCamera::setViewfinder(QVideoWidget *viewfinder) if (d->viewfinder) unbind(d->viewfinder); - d->viewfinder = viewfinder && bind(viewfinder) ? viewfinder : 0; + // We don't know (in this library) that QVideoWidget inherits QObject + QObject *viewFinderObject = reinterpret_cast<QObject*>(viewfinder); + + d->viewfinder = viewFinderObject && bind(viewFinderObject) ? viewFinderObject : 0; } /*! @@ -486,6 +489,7 @@ void QCamera::setViewfinder(QVideoWidget *viewfinder) The previously set viewfinder is detached. \since 1.1 */ +// QGraphicsVideoItem is forward declared void QCamera::setViewfinder(QGraphicsVideoItem *viewfinder) { Q_D(QCamera); @@ -494,7 +498,11 @@ void QCamera::setViewfinder(QGraphicsVideoItem *viewfinder) if (d->viewfinder) unbind(d->viewfinder); - d->viewfinder = viewfinder && bind(viewfinder) ? viewfinder : 0; + // We don't know (in this library) that QGraphicsVideoItem (multiply) inherits QObject + // but QObject inheritance depends on QObject coming first, so try this out. + QObject *viewFinderObject = reinterpret_cast<QObject*>(viewfinder); + + d->viewfinder = viewFinderObject && bind(viewFinderObject) ? viewFinderObject : 0; } /*! diff --git a/src/multimediakit/qcamera.h b/src/multimediakit/qcamera.h index 268e09e6a..5091759ab 100644 --- a/src/multimediakit/qcamera.h +++ b/src/multimediakit/qcamera.h @@ -59,8 +59,13 @@ #include <qmediaserviceprovider.h> #include <qmediaenumdebug.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QAbstractVideoSurface; class QVideoWidget; class QGraphicsVideoItem; @@ -228,4 +233,6 @@ 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/multimediakit/qcameracapturebufferformatcontrol.h b/src/multimediakit/qcameracapturebufferformatcontrol.h index cf296e60e..81079a77d 100644 --- a/src/multimediakit/qcameracapturebufferformatcontrol.h +++ b/src/multimediakit/qcameracapturebufferformatcontrol.h @@ -45,8 +45,13 @@ #include <qmediacontrol.h> #include <qcameraimagecapture.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class Q_MULTIMEDIA_EXPORT QCameraCaptureBufferFormatControl : public QMediaControl { Q_OBJECT @@ -69,5 +74,8 @@ Q_MEDIA_DECLARE_CONTROL(QCameraCaptureBufferFormatControl, QCameraCaptureBufferF QT_END_NAMESPACE +QT_END_HEADER + + #endif diff --git a/src/multimediakit/qcameracapturedestinationcontrol.h b/src/multimediakit/qcameracapturedestinationcontrol.h index 7dcae365f..cdd769a4d 100644 --- a/src/multimediakit/qcameracapturedestinationcontrol.h +++ b/src/multimediakit/qcameracapturedestinationcontrol.h @@ -45,8 +45,13 @@ #include <qmediacontrol.h> #include <qcameraimagecapture.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class Q_MULTIMEDIA_EXPORT QCameraCaptureDestinationControl : public QMediaControl { Q_OBJECT @@ -69,5 +74,8 @@ Q_MEDIA_DECLARE_CONTROL(QCameraCaptureDestinationControl, QCameraCaptureDestinat QT_END_NAMESPACE +QT_END_HEADER + + #endif diff --git a/src/multimediakit/qcameracontrol.h b/src/multimediakit/qcameracontrol.h index e64f77a64..dfc2b3743 100644 --- a/src/multimediakit/qcameracontrol.h +++ b/src/multimediakit/qcameracontrol.h @@ -47,8 +47,13 @@ #include <qcamera.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class Q_MULTIMEDIA_EXPORT QCameraControl : public QMediaControl { Q_OBJECT @@ -89,5 +94,8 @@ Q_MEDIA_DECLARE_CONTROL(QCameraControl, QCameraControl_iid) QT_END_NAMESPACE +QT_END_HEADER + + #endif // QCAMERACONTROL_H diff --git a/src/multimediakit/qcameraexposure.h b/src/multimediakit/qcameraexposure.h index 590f73402..088e7c036 100644 --- a/src/multimediakit/qcameraexposure.h +++ b/src/multimediakit/qcameraexposure.h @@ -45,8 +45,13 @@ #include <qmediaobject.h> #include <qmediaenumdebug.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QCamera; class QCameraExposurePrivate; @@ -175,4 +180,6 @@ 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/multimediakit/qcameraexposurecontrol.h b/src/multimediakit/qcameraexposurecontrol.h index b764a9112..ff60784bf 100644 --- a/src/multimediakit/qcameraexposurecontrol.h +++ b/src/multimediakit/qcameraexposurecontrol.h @@ -49,8 +49,13 @@ #include <qcamera.h> #include <qmediaenumdebug.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class Q_MULTIMEDIA_EXPORT QCameraExposureControl : public QMediaControl { Q_OBJECT @@ -112,5 +117,8 @@ Q_MEDIA_ENUM_DEBUG(QCameraExposureControl, ExposureParameter) QT_END_NAMESPACE +QT_END_HEADER + + #endif // QCAMERAEXPOSURECONTROL_H diff --git a/src/multimediakit/qcameraflashcontrol.cpp b/src/multimediakit/qcameraflashcontrol.cpp index 1633a6481..27bf09a7c 100644 --- a/src/multimediakit/qcameraflashcontrol.cpp +++ b/src/multimediakit/qcameraflashcontrol.cpp @@ -60,8 +60,6 @@ QT_BEGIN_NAMESPACE You can retrieve this control from the camera object in the usual way: - XXX snippet for retrieving control - Some camera devices may not have flash hardware, or may not be configurable. In that case, there will be no QCameraFlashControl available. diff --git a/src/multimediakit/qcameraflashcontrol.h b/src/multimediakit/qcameraflashcontrol.h index d2b393990..89b3b9d06 100644 --- a/src/multimediakit/qcameraflashcontrol.h +++ b/src/multimediakit/qcameraflashcontrol.h @@ -48,8 +48,13 @@ #include <qcameraexposure.h> #include <qcamera.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class Q_MULTIMEDIA_EXPORT QCameraFlashControl : public QMediaControl { Q_OBJECT @@ -75,5 +80,8 @@ Q_MEDIA_DECLARE_CONTROL(QCameraFlashControl, QCameraFlashControl_iid) QT_END_NAMESPACE +QT_END_HEADER + + #endif // QCAMERAFLASHCONTROL_H diff --git a/src/multimediakit/qcamerafocus.h b/src/multimediakit/qcamerafocus.h index 78ca75406..064af7aa1 100644 --- a/src/multimediakit/qcamerafocus.h +++ b/src/multimediakit/qcamerafocus.h @@ -52,8 +52,13 @@ #include <qmediaobject.h> #include <qmediaenumdebug.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QCamera; class QCameraFocusZoneData; @@ -173,4 +178,6 @@ 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/multimediakit/qcamerafocuscontrol.h b/src/multimediakit/qcamerafocuscontrol.h index 7962435a3..20ffe6af1 100644 --- a/src/multimediakit/qcamerafocuscontrol.h +++ b/src/multimediakit/qcamerafocuscontrol.h @@ -47,8 +47,13 @@ #include <qcamerafocus.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class Q_MULTIMEDIA_EXPORT QCameraFocusControl : public QMediaControl { Q_OBJECT @@ -91,5 +96,8 @@ Q_MEDIA_DECLARE_CONTROL(QCameraFocusControl, QCameraFocusControl_iid) QT_END_NAMESPACE +QT_END_HEADER + + #endif // QCAMERAFOCUSCONTROL_H diff --git a/src/multimediakit/qcameraimagecapture.h b/src/multimediakit/qcameraimagecapture.h index 0e33f37fb..f4a5a9c11 100644 --- a/src/multimediakit/qcameraimagecapture.h +++ b/src/multimediakit/qcameraimagecapture.h @@ -49,7 +49,12 @@ #include <qmediaenumdebug.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE + +QT_MODULE(Multimedia) + class QSize; QT_END_NAMESPACE @@ -159,5 +164,7 @@ 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/multimediakit/qcameraimagecapturecontrol.h b/src/multimediakit/qcameraimagecapturecontrol.h index 6915b5dd2..b9ac599f6 100644 --- a/src/multimediakit/qcameraimagecapturecontrol.h +++ b/src/multimediakit/qcameraimagecapturecontrol.h @@ -45,7 +45,12 @@ #include <qmediacontrol.h> #include <qcameraimagecapture.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE + +QT_MODULE(Multimedia) + class QImage; QT_END_NAMESPACE @@ -87,5 +92,8 @@ Q_MEDIA_DECLARE_CONTROL(QCameraImageCaptureControl, QCameraImageCaptureControl_i QT_END_NAMESPACE +QT_END_HEADER + + #endif // QCAMERAIMAGECAPTURECONTROL_H diff --git a/src/multimediakit/qcameraimageprocessing.h b/src/multimediakit/qcameraimageprocessing.h index aba38a3dc..42a7eb589 100644 --- a/src/multimediakit/qcameraimageprocessing.h +++ b/src/multimediakit/qcameraimageprocessing.h @@ -53,8 +53,13 @@ #include <qmediaservice.h> #include <qmediaenumdebug.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QCamera; class QCameraImageProcessingPrivate; @@ -114,4 +119,6 @@ Q_DECLARE_METATYPE(QCameraImageProcessing::WhiteBalanceMode) Q_MEDIA_ENUM_DEBUG(QCameraImageProcessing, WhiteBalanceMode) +QT_END_HEADER + #endif // QCAMERAIMAGEPROCESSING_H diff --git a/src/multimediakit/qcameraimageprocessingcontrol.h b/src/multimediakit/qcameraimageprocessingcontrol.h index db77f09ac..8c739287c 100644 --- a/src/multimediakit/qcameraimageprocessingcontrol.h +++ b/src/multimediakit/qcameraimageprocessingcontrol.h @@ -48,8 +48,13 @@ #include <qcamera.h> #include <qmediaenumdebug.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class Q_MULTIMEDIA_EXPORT QCameraImageProcessingControl : public QMediaControl { Q_OBJECT @@ -89,5 +94,7 @@ Q_DECLARE_METATYPE(QCameraImageProcessingControl::ProcessingParameter) Q_MEDIA_ENUM_DEBUG(QCameraImageProcessingControl, ProcessingParameter) +QT_END_HEADER + #endif diff --git a/src/multimediakit/qcameralockscontrol.h b/src/multimediakit/qcameralockscontrol.h index 0d6e1a224..93120ee1a 100644 --- a/src/multimediakit/qcameralockscontrol.h +++ b/src/multimediakit/qcameralockscontrol.h @@ -47,8 +47,13 @@ #include <qcamera.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class Q_MULTIMEDIA_EXPORT QCameraLocksControl : public QMediaControl { Q_OBJECT @@ -74,5 +79,8 @@ Q_MEDIA_DECLARE_CONTROL(QCameraLocksControl, QCameraLocksControl_iid) QT_END_NAMESPACE +QT_END_HEADER + + #endif // QCAMERALOCKSCONTROL_H diff --git a/src/multimediakit/qcameraviewfinder.cpp b/src/multimediakit/qcameraviewfinder.cpp deleted file mode 100644 index c4df95934..000000000 --- a/src/multimediakit/qcameraviewfinder.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QDebug> - -#include <qmediaobject_p.h> - -#include <qcamera.h> -#include <qcameraviewfinder.h> -#include <qvideowidget_p.h> -#include <qvideodevicecontrol.h> - -QT_USE_NAMESPACE - -/*! - \class QCameraViewfinder - - - \brief The QCameraViewfinder class provides a camera viewfinder widget. - - \inmodule QtMultimediaKit - \ingroup camera - \since 1.1 - - \snippet doc/src/snippets/multimedia-snippets/camera.cpp Camera - -*/ - -class QCameraViewfinderPrivate : public QVideoWidgetPrivate -{ - Q_DECLARE_NON_CONST_PUBLIC(QCameraViewfinder) -public: - QCameraViewfinderPrivate(): - QVideoWidgetPrivate() - { - } -}; - -/*! - Constructs a new camera viewfinder widget. - - The \a parent is passed to QVideoWidget. -*/ - -QCameraViewfinder::QCameraViewfinder(QWidget *parent) - :QVideoWidget(*new QCameraViewfinderPrivate, parent) -{ -} - -/*! - Destroys a camera viewfinder widget. -*/ -QCameraViewfinder::~QCameraViewfinder() -{ -} - -/*! - \reimp - \since 1.1 -*/ -QMediaObject *QCameraViewfinder::mediaObject() const -{ - return QVideoWidget::mediaObject(); -} - -/*! - \reimp - \since 1.1 -*/ -bool QCameraViewfinder::setMediaObject(QMediaObject *object) -{ - return QVideoWidget::setMediaObject(object); -} - -#include "moc_qcameraviewfinder.cpp" diff --git a/src/multimediakit/qeglimagetexturesurface.cpp b/src/multimediakit/qeglimagetexturesurface.cpp deleted file mode 100644 index 685ae031f..000000000 --- a/src/multimediakit/qeglimagetexturesurface.cpp +++ /dev/null @@ -1,554 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <qeglimagetexturesurface_p.h> -#include <qpaintervideosurface_p.h> - -#include <QtCore/qmath.h> -#include <QtCore/qvariant.h> -#include <QtCore/qdebug.h> -#include <QtGui/qpainter.h> -#include <QtGui/qx11info_x11.h> -#include <qvideosurfaceformat.h> - - -QT_BEGIN_NAMESPACE - -//#define DEBUG_OMAPFB_SURFACE - -const QAbstractVideoBuffer::HandleType EGLImageTextureHandle = -QAbstractVideoBuffer::HandleType(QAbstractVideoBuffer::UserHandle+3434); - -/*! - \class QOmapFbVideoSurface - \internal - \since 1.2 -*/ - -/*! -*/ -QEglImageTextureSurface::QEglImageTextureSurface(QObject *parent) - : QAbstractVideoSurface(parent) - , m_context(0) - , m_program(0) - , m_pixelFormat(QVideoFrame::Format_Invalid) - , m_ready(false) - , m_colorKey(49,0,49) - , m_fallbackSurface(0) - , m_fallbackSurfaceActive(false) -{ - m_fallbackSurface = new QPainterVideoSurface(this); -} - -/*! -*/ -QEglImageTextureSurface::~QEglImageTextureSurface() -{ - if (isActive()) - stop(); -} - -/*! - \since 1.2 -*/ -QList<QVideoFrame::PixelFormat> QEglImageTextureSurface::supportedPixelFormats( - QAbstractVideoBuffer::HandleType handleType) const -{ -#ifdef DEBUG_OMAPFB_SURFACE - qDebug() << Q_FUNC_INFO << handleType; -#endif - - if (handleType == EGLImageTextureHandle) { - return QList<QVideoFrame::PixelFormat>() - << QVideoFrame::Format_RGB32 - << QVideoFrame::Format_ARGB32; - } - - return m_fallbackSurface->supportedPixelFormats(handleType); -} - -const char *qt_glsl_eglTextureVertexShaderProgram = - "attribute highp vec4 vertexCoordArray;\n" - "attribute mediump vec2 textureCoordArray;\n" - "uniform highp mat4 positionMatrix;\n" - "varying mediump vec2 textureCoord;\n" - "void main (void)\n" - "{\n" - " gl_Position = positionMatrix * vertexCoordArray;\n" - " textureCoord = textureCoordArray;\n" - "}"; - -static const char* qt_glsl_eglTextureShaderProgram = - "#extension GL_OES_EGL_image_external: enable\n" - "\n" - "uniform samplerExternalOES texRgb;\n" - "varying mediump vec2 textureCoord;\n" - "\n" - "void main (void)\n" - "{\n" - " gl_FragColor = texture2D(texRgb, textureCoord);\n" - "}"; - - -/*! - \since 1.2 -*/ -bool QEglImageTextureSurface::start(const QVideoSurfaceFormat &format) -{ -#ifdef DEBUG_OMAPFB_SURFACE - qDebug() << Q_FUNC_INFO << format; -#endif - - m_fallbackSurfaceActive = false; - if (format.handleType() != EGLImageTextureHandle) { - qWarning() << Q_FUNC_INFO << "Non EGLImageTextureHandle based format requested, fallback to QPainterVideoSurface"; - connect(m_fallbackSurface, SIGNAL(activeChanged(bool)), - this, SIGNAL(activeChanged(bool))); - connect(m_fallbackSurface, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat)), - this, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat))); - connect(m_fallbackSurface, SIGNAL(supportedFormatsChanged()), - this, SIGNAL(supportedFormatsChanged())); - connect(m_fallbackSurface, SIGNAL(nativeResolutionChanged(QSize)), - this, SIGNAL(nativeResolutionChanged(QSize))); - connect(m_fallbackSurface, SIGNAL(frameChanged()), - this, SIGNAL(frameChanged())); - - if (m_fallbackSurface->start(format)) { - m_fallbackSurfaceActive = true; - QAbstractVideoSurface::start(format); - } else { - qWarning() << Q_FUNC_INFO << "failed to start video surface:" << m_fallbackSurface->error(); - setError(m_fallbackSurface->error()); - - disconnect(m_fallbackSurface, SIGNAL(activeChanged(bool)), - this, SIGNAL(activeChanged(bool))); - disconnect(m_fallbackSurface, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat)), - this, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat))); - disconnect(m_fallbackSurface, SIGNAL(supportedFormatsChanged()), - this, SIGNAL(supportedFormatsChanged())); - disconnect(m_fallbackSurface, SIGNAL(nativeResolutionChanged(QSize)), - this, SIGNAL(nativeResolutionChanged(QSize))); - disconnect(m_fallbackSurface, SIGNAL(frameChanged()), - this, SIGNAL(frameChanged())); - } - - return m_fallbackSurfaceActive; - } - - QAbstractVideoSurface::Error error = NoError; - - if (isActive()) - stop(); - - if (format.frameSize().isEmpty()) { - setError(UnsupportedFormatError); - } else if (m_context) { - m_context->makeCurrent(); - m_program = new QGLShaderProgram(m_context, this); - - if (!m_program->addShaderFromSourceCode(QGLShader::Vertex, qt_glsl_eglTextureVertexShaderProgram)) { - qWarning("QOmapFbVideoSurface: Vertex shader compile error %s", - qPrintable(m_program->log())); - error = ResourceError; - } - - if (error == NoError - && !m_program->addShaderFromSourceCode(QGLShader::Fragment, qt_glsl_eglTextureShaderProgram)) { - qWarning("QOmapFbVideoSurface: Vertex shader compile error %s", - qPrintable(m_program->log())); - error = QAbstractVideoSurface::ResourceError; - } - - if (error == NoError) { - m_program->bindAttributeLocation("textureCoordArray", 1); - if(!m_program->link()) { - qWarning("QOmapFbVideoSurface: Shader link error %s", qPrintable(m_program->log())); - m_program->removeAllShaders(); - error = QAbstractVideoSurface::ResourceError; - } - } - - if (error != QAbstractVideoSurface::NoError) { - delete m_program; - m_program = 0; - } - } - - if (error == QAbstractVideoSurface::NoError) { - m_scanLineDirection = format.scanLineDirection(); - m_frameSize = format.frameSize(); - m_pixelFormat = format.pixelFormat(); - m_frameSize = format.frameSize(); - m_sourceRect = format.viewport(); - m_ready = true; - - return QAbstractVideoSurface::start(format); - } - - QAbstractVideoSurface::stop(); - return false; -} - -/*! - \since 1.2 -*/ -void QEglImageTextureSurface::stop() -{ -#ifdef DEBUG_OMAPFB_SURFACE - qDebug() << Q_FUNC_INFO; -#endif - - if (m_fallbackSurfaceActive) { - m_fallbackSurface->stop(); - m_fallbackSurfaceActive = false; - - disconnect(m_fallbackSurface, SIGNAL(activeChanged(bool)), - this, SIGNAL(activeChanged(bool))); - disconnect(m_fallbackSurface, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat)), - this, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat))); - disconnect(m_fallbackSurface, SIGNAL(supportedFormatsChanged()), - this, SIGNAL(supportedFormatsChanged())); - disconnect(m_fallbackSurface, SIGNAL(nativeResolutionChanged(QSize)), - this, SIGNAL(nativeResolutionChanged(QSize))); - disconnect(m_fallbackSurface, SIGNAL(frameChanged()), - this, SIGNAL(frameChanged())); - - m_ready = false; - QAbstractVideoSurface::stop(); - } - - if (isActive()) { - if (m_context) - m_context->makeCurrent(); - m_frame = QVideoFrame(); - - m_program->removeAllShaders(); - delete m_program; - m_program = 0; - m_ready = false; - - QAbstractVideoSurface::stop(); - } -} - -/*! - \since 1.2 -*/ -bool QEglImageTextureSurface::present(const QVideoFrame &frame) -{ - if (m_fallbackSurfaceActive) { - if (m_fallbackSurface->present(frame)) { - return true; - } else { - setError(m_fallbackSurface->error()); - stop(); - return false; - } - } - - if (!m_ready) { - if (!isActive()) - setError(StoppedError); - else - m_frame = frame; - } else if (frame.isValid() - && (frame.pixelFormat() != m_pixelFormat || frame.size() != m_frameSize)) { - setError(IncorrectFormatError); - qWarning() << "Received frame of incorrect format, stopping the surface"; - - stop(); - } else { - if (m_context) - m_context->makeCurrent(); - m_frame = frame; - m_ready = false; - emit frameChanged(); - return true; - } - return false; -} - -/*! - \since 1.2 -*/ -int QEglImageTextureSurface::brightness() const -{ - return m_fallbackSurface->brightness(); -} - -/*! - \since 1.2 -*/ -void QEglImageTextureSurface::setBrightness(int brightness) -{ - m_fallbackSurface->setBrightness(brightness); -} - -/*! - \since 1.2 -*/ -int QEglImageTextureSurface::contrast() const -{ - return m_fallbackSurface->contrast(); -} - -/*! - \since 1.2 -*/ -void QEglImageTextureSurface::setContrast(int contrast) -{ - m_fallbackSurface->setContrast(contrast); -} - -/*! - \since 1.2 -*/ -int QEglImageTextureSurface::hue() const -{ - return m_fallbackSurface->hue(); -} - -/*! - \since 1.2 -*/ -void QEglImageTextureSurface::setHue(int hue) -{ - m_fallbackSurface->setHue(hue); -} - -/*! - \since 1.2 -*/ -int QEglImageTextureSurface::saturation() const -{ - return m_fallbackSurface->saturation(); -} - -/*! - \since 1.2 -*/ -void QEglImageTextureSurface::setSaturation(int saturation) -{ - m_fallbackSurface->setSaturation(saturation); -} - -/*! - \since 1.2 -*/ -bool QEglImageTextureSurface::isReady() const -{ - return m_fallbackSurfaceActive ? m_fallbackSurface->isReady() : m_ready; -} - -/*! - \since 1.2 -*/ -void QEglImageTextureSurface::setReady(bool ready) -{ - m_ready = ready; - if (m_fallbackSurfaceActive) - m_fallbackSurface->setReady(ready); -} - -/*! - \since 1.2 -*/ -void QEglImageTextureSurface::paint(QPainter *painter, const QRectF &target, const QRectF &sourceRect) -{ - if (m_fallbackSurfaceActive) { - m_fallbackSurface->paint(painter, target, sourceRect); - return; - } - - if (!isActive() || !m_frame.isValid()) { - painter->fillRect(target, QBrush(Qt::black)); - } else { - const QRectF source( - m_sourceRect.x() + m_sourceRect.width() * sourceRect.x(), - m_sourceRect.y() + m_sourceRect.height() * sourceRect.y(), - m_sourceRect.width() * sourceRect.width(), - m_sourceRect.height() * sourceRect.height()); - - bool stencilTestEnabled = glIsEnabled(GL_STENCIL_TEST); - bool scissorTestEnabled = glIsEnabled(GL_SCISSOR_TEST); - - painter->beginNativePainting(); - - if (stencilTestEnabled) - glEnable(GL_STENCIL_TEST); - if (scissorTestEnabled) - glEnable(GL_SCISSOR_TEST); - - const int width = QGLContext::currentContext()->device()->width(); - const int height = QGLContext::currentContext()->device()->height(); - - const QTransform transform = painter->deviceTransform(); - - const GLfloat wfactor = 2.0 / width; - const GLfloat hfactor = -2.0 / height; - - const GLfloat positionMatrix[4][4] = - { - { - /*(0,0)*/ GLfloat(wfactor * transform.m11() - transform.m13()), - /*(0,1)*/ GLfloat(hfactor * transform.m12() + transform.m13()), - /*(0,2)*/ 0.0, - /*(0,3)*/ GLfloat(transform.m13()) - }, { - /*(1,0)*/ GLfloat(wfactor * transform.m21() - transform.m23()), - /*(1,1)*/ GLfloat(hfactor * transform.m22() + transform.m23()), - /*(1,2)*/ 0.0, - /*(1,3)*/ GLfloat(transform.m23()) - }, { - /*(2,0)*/ 0.0, - /*(2,1)*/ 0.0, - /*(2,2)*/ -1.0, - /*(2,3)*/ 0.0 - }, { - /*(3,0)*/ GLfloat(wfactor * transform.dx() - transform.m33()), - /*(3,1)*/ GLfloat(hfactor * transform.dy() + transform.m33()), - /*(3,2)*/ 0.0, - /*(3,3)*/ GLfloat(transform.m33()) - } - }; - - const GLfloat vTop = m_scanLineDirection == QVideoSurfaceFormat::TopToBottom - ? target.top() - : target.bottom() + 1; - const GLfloat vBottom = m_scanLineDirection == QVideoSurfaceFormat::TopToBottom - ? target.bottom() + 1 - : target.top(); - - - const GLfloat vertexCoordArray[] = - { - GLfloat(target.left()) , GLfloat(vBottom), - GLfloat(target.right() + 1), GLfloat(vBottom), - GLfloat(target.left()) , GLfloat(vTop), - GLfloat(target.right() + 1), GLfloat(vTop) - }; - - const GLfloat txLeft = source.left() / m_frameSize.width(); - const GLfloat txRight = source.right() / m_frameSize.width(); - const GLfloat txTop = m_scanLineDirection == QVideoSurfaceFormat::TopToBottom - ? source.top() / m_frameSize.height() - : source.bottom() / m_frameSize.height(); - const GLfloat txBottom = m_scanLineDirection == QVideoSurfaceFormat::TopToBottom - ? source.bottom() / m_frameSize.height() - : source.top() / m_frameSize.height(); - - const GLfloat textureCoordArray[] = - { - txLeft , txBottom, - txRight, txBottom, - txLeft , txTop, - txRight, txTop - }; - - m_program->bind(); - - m_program->enableAttributeArray("vertexCoordArray"); - m_program->enableAttributeArray("textureCoordArray"); - m_program->setAttributeArray("vertexCoordArray", vertexCoordArray, 2); - m_program->setAttributeArray("textureCoordArray", textureCoordArray, 2); - m_program->setUniformValue("positionMatrix", positionMatrix); - m_program->setUniformValue("texRgb", 0); - - //map() binds the external texture - m_frame.map(QAbstractVideoBuffer::ReadOnly); - - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - - //it's necessary to unbind the external texture - m_frame.unmap(); - - m_program->release(); - - painter->endNativePainting(); - } -} - -/*! - \fn QOmapFbVideoSurface::frameChanged() - \since 1.2 -*/ - -/*! - \since 1.2 -*/ -const QGLContext *QEglImageTextureSurface::glContext() const -{ - return m_context; -} - -/*! - \since 1.2 -*/ -void QEglImageTextureSurface::setGLContext(QGLContext *context) -{ - if (m_context == context) - return; - - stop(); - - m_context = context; - - m_fallbackSurface->setGLContext(context); - if (m_fallbackSurface->supportedShaderTypes() & QPainterVideoSurface::GlslShader) { - m_fallbackSurface->setShaderType(QPainterVideoSurface::GlslShader); - } else { - m_fallbackSurface->setShaderType(QPainterVideoSurface::FragmentProgramShader); - } - - emit supportedFormatsChanged(); -} - -void QEglImageTextureSurface::viewportDestroyed() -{ - m_context = 0; - m_fallbackSurface->viewportDestroyed(); - - setError(ResourceError); - stop(); -} - -#include "moc_qeglimagetexturesurface_p.cpp" -QT_END_NAMESPACE diff --git a/src/multimediakit/qeglimagetexturesurface_p.h b/src/multimediakit/qeglimagetexturesurface_p.h deleted file mode 100644 index d8aceb74d..000000000 --- a/src/multimediakit/qeglimagetexturesurface_p.h +++ /dev/null @@ -1,142 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QEGLIMAGETEXTURESURFACE_P_H -#define QEGLIMAGETEXTURESURFACE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <qtmultimediakitdefs.h> -#include <QtCore/qsize.h> -#include <QtGui/qimage.h> -#include <QtGui/qmatrix4x4.h> -#include <QtGui/qpaintengine.h> - -#include <QtOpenGL/qglshaderprogram.h> - -#include <qabstractvideosurface.h> -#include <qvideosurfaceformat.h> -#include <qvideoframe.h> - -QT_BEGIN_NAMESPACE -class QGLContext; -class QGLShaderProgram; -class QPainterVideoSurface; - -class QEglImageTextureSurface : public QAbstractVideoSurface -{ - Q_OBJECT -public: - explicit QEglImageTextureSurface(QObject *parent = 0); - ~QEglImageTextureSurface(); - - QList<QVideoFrame::PixelFormat> supportedPixelFormats( - QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle) const; - - bool start(const QVideoSurfaceFormat &format); - void stop(); - - bool present(const QVideoFrame &frame); - - int brightness() const; - void setBrightness(int brightness); - - int contrast() const; - void setContrast(int contrast); - - int hue() const; - void setHue(int hue); - - int saturation() const; - void setSaturation(int saturation); - - bool isReady() const; - void setReady(bool ready); - - void paint(QPainter *painter, const QRectF &target, const QRectF &source = QRectF(0, 0, 1, 1)); - - const QGLContext *glContext() const; - void setGLContext(QGLContext *context); - - bool isOverlayEnabled() const; - void setOverlayEnabled(bool enabled); - - QRect displayRect() const; - void setDisplayRect(const QRect &rect); - -public Q_SLOTS: - void viewportDestroyed(); - -Q_SIGNALS: - void frameChanged(); - -private: - QGLContext *m_context; - QGLShaderProgram *m_program; - - QVideoFrame m_frame; - - QVideoFrame::PixelFormat m_pixelFormat; - QVideoSurfaceFormat::Direction m_scanLineDirection; - QSize m_frameSize; - QRect m_sourceRect; - bool m_ready; - - QRect m_viewport; - QRect m_displayRect; - QColor m_colorKey; - - QPainterVideoSurface *m_fallbackSurface; - bool m_fallbackSurfaceActive; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/multimediakit/qgraphicsvideoitem.cpp b/src/multimediakit/qgraphicsvideoitem.cpp deleted file mode 100644 index 1f8f6db61..000000000 --- a/src/multimediakit/qgraphicsvideoitem.cpp +++ /dev/null @@ -1,432 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgraphicsvideoitem.h" - -#include <qmediaobject.h> -#include <qmediaservice.h> -#include <qpaintervideosurface_p.h> -#include <qvideorenderercontrol.h> - -#include <QtCore/qcoreevent.h> -#include <QtCore/qpointer.h> - -#include <qvideosurfaceformat.h> - -#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_1_CL) && !defined(QT_OPENGL_ES_1) -#include <QtOpenGL/qgl.h> -#endif - -Q_DECLARE_METATYPE(QVideoSurfaceFormat) - -QT_BEGIN_NAMESPACE - -class QGraphicsVideoItemPrivate -{ -public: - QGraphicsVideoItemPrivate() - : q_ptr(0) - , surface(0) - , mediaObject(0) - , service(0) - , rendererControl(0) - , aspectRatioMode(Qt::KeepAspectRatio) - , updatePaintDevice(true) - , rect(0.0, 0.0, 320, 240) - { - } - - QGraphicsVideoItem *q_ptr; - - QPainterVideoSurface *surface; - QPointer<QMediaObject> mediaObject; - QMediaService *service; - QVideoRendererControl *rendererControl; - Qt::AspectRatioMode aspectRatioMode; - bool updatePaintDevice; - QRectF rect; - QRectF boundingRect; - QRectF sourceRect; - QSizeF nativeSize; - - void clearService(); - void updateRects(); - - void _q_present(); - void _q_formatChanged(const QVideoSurfaceFormat &format); - void _q_updateNativeSize(); - void _q_serviceDestroyed(); -}; - -void QGraphicsVideoItemPrivate::clearService() -{ - if (rendererControl) { - surface->stop(); - rendererControl->setSurface(0); - service->releaseControl(rendererControl); - rendererControl = 0; - } - if (service) { - QObject::disconnect(service, SIGNAL(destroyed()), q_ptr, SLOT(_q_serviceDestroyed())); - service = 0; - } -} - -void QGraphicsVideoItemPrivate::updateRects() -{ - q_ptr->prepareGeometryChange(); - - if (nativeSize.isEmpty()) { - //this is necessary for item to receive the - //first paint event and configure video surface. - boundingRect = rect; - } else if (aspectRatioMode == Qt::IgnoreAspectRatio) { - boundingRect = rect; - sourceRect = QRectF(0, 0, 1, 1); - } else if (aspectRatioMode == Qt::KeepAspectRatio) { - QSizeF size = nativeSize; - size.scale(rect.size(), Qt::KeepAspectRatio); - - boundingRect = QRectF(0, 0, size.width(), size.height()); - boundingRect.moveCenter(rect.center()); - - sourceRect = QRectF(0, 0, 1, 1); - } else if (aspectRatioMode == Qt::KeepAspectRatioByExpanding) { - boundingRect = rect; - - QSizeF size = rect.size(); - size.scale(nativeSize, Qt::KeepAspectRatio); - - sourceRect = QRectF( - 0, 0, size.width() / nativeSize.width(), size.height() / nativeSize.height()); - sourceRect.moveCenter(QPointF(0.5, 0.5)); - } -} - -void QGraphicsVideoItemPrivate::_q_present() -{ - if (q_ptr->isObscured()) { - q_ptr->update(boundingRect); - surface->setReady(true); - } else { - q_ptr->update(boundingRect); - } -} - -void QGraphicsVideoItemPrivate::_q_updateNativeSize() -{ - const QSize &size = surface->surfaceFormat().sizeHint(); - if (nativeSize != size) { - nativeSize = size; - - updateRects(); - emit q_ptr->nativeSizeChanged(nativeSize); - } -} - -void QGraphicsVideoItemPrivate::_q_serviceDestroyed() -{ - rendererControl = 0; - service = 0; - - surface->stop(); -} - - -/*! - \class QGraphicsVideoItem - - \brief The QGraphicsVideoItem class provides a graphics item which display video produced by a QMediaObject. - - \inmodule QtMultimediaKit - \ingroup multimedia - \since 1.0 - - Attaching a QGraphicsVideoItem to a QMediaObject allows it to display - the video or image output of that media object. A QGraphicsVideoItem - is attached to a media object by passing a pointer to the QMediaObject - to the setMediaObject() function. - - \snippet doc/src/snippets/multimedia-snippets/video.cpp Video graphics item - - \bold {Note}: Only a single display output can be attached to a media - object at one time. - - \sa QMediaObject, QMediaPlayer, QVideoWidget -*/ - -/*! - Constructs a graphics item that displays video. - - The \a parent is passed to QGraphicsItem. -*/ -QGraphicsVideoItem::QGraphicsVideoItem(QGraphicsItem *parent) - : QGraphicsObject(parent) - , d_ptr(new QGraphicsVideoItemPrivate) -{ - d_ptr->q_ptr = this; - d_ptr->surface = new QPainterVideoSurface; - - qRegisterMetaType<QVideoSurfaceFormat>(); - - connect(d_ptr->surface, SIGNAL(frameChanged()), this, SLOT(_q_present())); - connect(d_ptr->surface, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat)), - this, SLOT(_q_updateNativeSize()), Qt::QueuedConnection); -} - -/*! - Destroys a video graphics item. -*/ -QGraphicsVideoItem::~QGraphicsVideoItem() -{ - if (d_ptr->rendererControl) { - d_ptr->rendererControl->setSurface(0); - d_ptr->service->releaseControl(d_ptr->rendererControl); - } - - delete d_ptr->surface; - delete d_ptr; -} - -/*! - \property QGraphicsVideoItem::mediaObject - \brief the media object which provides the video displayed by a graphics - item. - \since 1.0 -*/ - -QMediaObject *QGraphicsVideoItem::mediaObject() const -{ - return d_func()->mediaObject; -} - -/*! - \internal - \since 1.0 -*/ -bool QGraphicsVideoItem::setMediaObject(QMediaObject *object) -{ - Q_D(QGraphicsVideoItem); - - if (object == d->mediaObject) - return true; - - d->clearService(); - - d->mediaObject = object; - - if (d->mediaObject) { - d->service = d->mediaObject->service(); - - if (d->service) { - QMediaControl *control = d->service->requestControl(QVideoRendererControl_iid); - if (control) { - d->rendererControl = qobject_cast<QVideoRendererControl *>(control); - - if (d->rendererControl) { - //don't set the surface untill the item is painted - //at least once and the surface is configured - if (!d->updatePaintDevice) - d->rendererControl->setSurface(d->surface); - else - update(boundingRect()); - - connect(d->service, SIGNAL(destroyed()), this, SLOT(_q_serviceDestroyed())); - - return true; - } - if (control) - d->service->releaseControl(control); - } - } - } - - d->mediaObject = 0; - return false; -} - -/*! - \property QGraphicsVideoItem::aspectRatioMode - \brief how a video is scaled to fit the graphics item's size. - \since 1.0 -*/ - -Qt::AspectRatioMode QGraphicsVideoItem::aspectRatioMode() const -{ - return d_func()->aspectRatioMode; -} - -void QGraphicsVideoItem::setAspectRatioMode(Qt::AspectRatioMode mode) -{ - Q_D(QGraphicsVideoItem); - - d->aspectRatioMode = mode; - d->updateRects(); -} - -/*! - \property QGraphicsVideoItem::offset - \brief the video item's offset. - - QGraphicsVideoItem will draw video using the offset for its top left - corner. - \since 1.0 -*/ - -QPointF QGraphicsVideoItem::offset() const -{ - return d_func()->rect.topLeft(); -} - -void QGraphicsVideoItem::setOffset(const QPointF &offset) -{ - Q_D(QGraphicsVideoItem); - - d->rect.moveTo(offset); - d->updateRects(); -} - -/*! - \property QGraphicsVideoItem::size - \brief the video item's size. - - QGraphicsVideoItem will draw video scaled to fit size according to its - fillMode. - \since 1.0 -*/ - -QSizeF QGraphicsVideoItem::size() const -{ - return d_func()->rect.size(); -} - -void QGraphicsVideoItem::setSize(const QSizeF &size) -{ - Q_D(QGraphicsVideoItem); - - d->rect.setSize(size.isValid() ? size : QSizeF(0, 0)); - d->updateRects(); -} - -/*! - \property QGraphicsVideoItem::nativeSize - \brief the native size of the video. - \since 1.0 -*/ - -QSizeF QGraphicsVideoItem::nativeSize() const -{ - return d_func()->nativeSize; -} - -/*! - \fn QGraphicsVideoItem::nativeSizeChanged(const QSizeF &size) - - Signals that the native \a size of the video has changed. - \since 1.0 -*/ - -/*! - \reimp - \since 1.0 -*/ -QRectF QGraphicsVideoItem::boundingRect() const -{ - return d_func()->boundingRect; -} - -/*! - \reimp - \since 1.0 -*/ -void QGraphicsVideoItem::paint( - QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) -{ - Q_D(QGraphicsVideoItem); - - Q_UNUSED(option); - Q_UNUSED(widget); - - if (d->surface && d->updatePaintDevice) { - d->updatePaintDevice = false; -#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_1_CL) && !defined(QT_OPENGL_ES_1) - if (widget) - connect(widget, SIGNAL(destroyed()), d->surface, SLOT(viewportDestroyed())); - - d->surface->setGLContext(const_cast<QGLContext *>(QGLContext::currentContext())); - if (d->surface->supportedShaderTypes() & QPainterVideoSurface::GlslShader) { - d->surface->setShaderType(QPainterVideoSurface::GlslShader); - } else { - d->surface->setShaderType(QPainterVideoSurface::FragmentProgramShader); - } -#endif - if (d->rendererControl && d->rendererControl->surface() != d->surface) - d->rendererControl->setSurface(d->surface); - } - - if (d->surface && d->surface->isActive()) { - d->surface->paint(painter, d->boundingRect, d->sourceRect); - d->surface->setReady(true); - } -} - -/*! - \reimp - - \internal - \since 1.0 -*/ -QVariant QGraphicsVideoItem::itemChange(GraphicsItemChange change, const QVariant &value) -{ - return QGraphicsItem::itemChange(change, value); -} - -/*! - \internal - \since 1.0 -*/ -void QGraphicsVideoItem::timerEvent(QTimerEvent *event) -{ - QGraphicsObject::timerEvent(event); -} - -#include "moc_qgraphicsvideoitem.cpp" -QT_END_NAMESPACE diff --git a/src/multimediakit/qgraphicsvideoitem.h b/src/multimediakit/qgraphicsvideoitem.h deleted file mode 100644 index 309ec4ddb..000000000 --- a/src/multimediakit/qgraphicsvideoitem.h +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGRAPHICSVIDEOITEM_H -#define QGRAPHICSVIDEOITEM_H - -#include <QtGui/qgraphicsitem.h> - -#include <qvideowidget.h> -#include <qmediabindableinterface.h> - -QT_BEGIN_NAMESPACE -class QVideoSurfaceFormat; -QT_END_NAMESPACE - -QT_BEGIN_NAMESPACE - -class QGraphicsVideoItemPrivate; -class Q_MULTIMEDIA_EXPORT QGraphicsVideoItem : public QGraphicsObject, public QMediaBindableInterface -{ - Q_OBJECT - Q_INTERFACES(QMediaBindableInterface) - Q_PROPERTY(QMediaObject* mediaObject READ mediaObject WRITE setMediaObject) - Q_PROPERTY(Qt::AspectRatioMode aspectRatioMode READ aspectRatioMode WRITE setAspectRatioMode) - Q_PROPERTY(QPointF offset READ offset WRITE setOffset) - Q_PROPERTY(QSizeF size READ size WRITE setSize) - Q_PROPERTY(QSizeF nativeSize READ nativeSize NOTIFY nativeSizeChanged) -public: - QGraphicsVideoItem(QGraphicsItem *parent = 0); - ~QGraphicsVideoItem(); - - QMediaObject *mediaObject() const; - - Qt::AspectRatioMode aspectRatioMode() const; - void setAspectRatioMode(Qt::AspectRatioMode mode); - - QPointF offset() const; - void setOffset(const QPointF &offset); - - QSizeF size() const; - void setSize(const QSizeF &size); - - QSizeF nativeSize() const; - - QRectF boundingRect() const; - - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); - -Q_SIGNALS: - void nativeSizeChanged(const QSizeF &size); - -protected: - void timerEvent(QTimerEvent *event); - QVariant itemChange(GraphicsItemChange change, const QVariant &value); - - bool setMediaObject(QMediaObject *object); - - QGraphicsVideoItemPrivate *d_ptr; - -private: - Q_DECLARE_PRIVATE(QGraphicsVideoItem) - Q_PRIVATE_SLOT(d_func(), void _q_present()) - Q_PRIVATE_SLOT(d_func(), void _q_updateNativeSize()) - Q_PRIVATE_SLOT(d_func(), void _q_serviceDestroyed()) -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/multimediakit/qgraphicsvideoitem_maemo6.cpp b/src/multimediakit/qgraphicsvideoitem_maemo6.cpp deleted file mode 100644 index e0f812ca6..000000000 --- a/src/multimediakit/qgraphicsvideoitem_maemo6.cpp +++ /dev/null @@ -1,498 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgraphicsvideoitem.h" - -#include <QtCore/qcoreevent.h> -#include <QtCore/qpointer.h> -#include <QtCore/qbasictimer.h> - -#include <QtGui/qgraphicsscene.h> - -#include <qmediaobject.h> -#include <qmediaservice.h> -#include <qpaintervideosurface_p.h> -#include <qeglimagetexturesurface_p.h> -#include <qvideorenderercontrol.h> - -#include <qvideosurfaceformat.h> - -#include <X11/Xlib.h> - -#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_1_CL) && !defined(QT_OPENGL_ES_1) -#include <QtOpenGL/qgl.h> -#endif - -//#define ENABLE_OVERLAY - -namespace -{ -//XInitThreads is necessary for gltexturesink element. -//To ensure it's called before main() it's better to link to -//libQtMultimediaKit.so directly, not when QML multimedia plugin is loaded. -class InitThreads -{ -public: - InitThreads() - { - XInitThreads(); - } -} _initThreads; -} - -Q_DECLARE_METATYPE(QVideoSurfaceFormat) - -QT_BEGIN_NAMESPACE - -class QGraphicsVideoItemPrivate -{ -public: - QGraphicsVideoItemPrivate() - : q_ptr(0) - , surface(0) - , mediaObject(0) - , service(0) - , rendererControl(0) - , aspectRatioMode(Qt::KeepAspectRatio) - , updatePaintDevice(true) - , rect(0.0, 0.0, 320, 240) - { - } - - QGraphicsVideoItem *q_ptr; - - QEglImageTextureSurface *surface; - QPointer<QMediaObject> mediaObject; - QMediaService *service; - QVideoRendererControl *rendererControl; - Qt::AspectRatioMode aspectRatioMode; - bool updatePaintDevice; - QRectF rect; - QRectF boundingRect; - QRectF sourceRect; - QSizeF nativeSize; - - void clearService(); - void updateRects(); - - void _q_present(); - void _q_formatChanged(const QVideoSurfaceFormat &format); - void _q_updateNativeSize(); - void _q_serviceDestroyed(); -}; - -void QGraphicsVideoItemPrivate::clearService() -{ - if (rendererControl) { - surface->stop(); - rendererControl->setSurface(0); - service->releaseControl(rendererControl); - rendererControl = 0; - } - if (service) { - QObject::disconnect(service, SIGNAL(destroyed()), q_ptr, SLOT(_q_serviceDestroyed())); - service = 0; - } -} - -void QGraphicsVideoItemPrivate::updateRects() -{ - q_ptr->prepareGeometryChange(); - - if (nativeSize.isEmpty()) { - //this is necessary for item to receive the - //first paint event and configure video surface. - boundingRect = rect; - } else if (aspectRatioMode == Qt::IgnoreAspectRatio) { - boundingRect = rect; - sourceRect = QRectF(0, 0, 1, 1); - } else if (aspectRatioMode == Qt::KeepAspectRatio) { - QSizeF size = nativeSize; - size.scale(rect.size(), Qt::KeepAspectRatio); - - boundingRect = QRectF(0, 0, size.width(), size.height()); - boundingRect.moveCenter(rect.center()); - - sourceRect = QRectF(0, 0, 1, 1); - } else if (aspectRatioMode == Qt::KeepAspectRatioByExpanding) { - boundingRect = rect; - - QSizeF size = rect.size(); - size.scale(nativeSize, Qt::KeepAspectRatio); - - sourceRect = QRectF( - 0, 0, size.width() / nativeSize.width(), size.height() / nativeSize.height()); - sourceRect.moveCenter(QPointF(0.5, 0.5)); - } -} - -void QGraphicsVideoItemPrivate::_q_present() -{ - if (q_ptr->isObscured()) { - q_ptr->update(boundingRect); - surface->setReady(true); - } else { - q_ptr->update(boundingRect); - } -} - -void QGraphicsVideoItemPrivate::_q_updateNativeSize() -{ - QSize size = surface->surfaceFormat().sizeHint(); - if (size.isEmpty()) - size = rendererControl->property("nativeSize").toSize(); - - if (nativeSize != size) { - nativeSize = size; - - updateRects(); - emit q_ptr->nativeSizeChanged(nativeSize); - } -} - -void QGraphicsVideoItemPrivate::_q_serviceDestroyed() -{ - rendererControl = 0; - service = 0; - - surface->stop(); -} - - -/*! - \class QGraphicsVideoItem - - \brief The QGraphicsVideoItem class provides a graphics item which display video produced by a QMediaObject. - - \inmodule QtMultimediaKit - \ingroup multimedia - - Attaching a QGraphicsVideoItem to a QMediaObject allows it to display - the video or image output of that media object. A QGraphicsVideoItem - is attached to a media object by passing a pointer to the QMediaObject - to the setMediaObject() function. - - \code - player = new QMediaPlayer(this); - - QGraphicsVideoItem *item = new QGraphicsVideoItem; - player->setVideoOutput(item); - graphicsView->scene()->addItem(item); - graphicsView->show(); - - player->setMedia(video); - player->play(); - \endcode - - \bold {Note}: Only a single display output can be attached to a media - object at one time. - - \sa QMediaObject, QMediaPlayer, QVideoWidget -*/ - -/*! - Constructs a graphics item that displays video. - - The \a parent is passed to QGraphicsItem. -*/ -QGraphicsVideoItem::QGraphicsVideoItem(QGraphicsItem *parent) - : QGraphicsObject(parent) - , d_ptr(new QGraphicsVideoItemPrivate) -{ - d_ptr->q_ptr = this; - d_ptr->surface = new QEglImageTextureSurface(this); - - qRegisterMetaType<QVideoSurfaceFormat>(); - - connect(d_ptr->surface, SIGNAL(frameChanged()), this, SLOT(_q_present())); - connect(d_ptr->surface, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat)), - this, SLOT(_q_updateNativeSize()), Qt::QueuedConnection); -} - -/*! - Destroys a video graphics item. -*/ -QGraphicsVideoItem::~QGraphicsVideoItem() -{ - if (d_ptr->rendererControl) { - d_ptr->rendererControl->setSurface(0); - d_ptr->service->releaseControl(d_ptr->rendererControl); - } - - delete d_ptr->surface; - delete d_ptr; -} - -/*! - \property QGraphicsVideoItem::mediaObject - \brief the media object which provides the video displayed by a graphics - item. -*/ - -QMediaObject *QGraphicsVideoItem::mediaObject() const -{ - return d_func()->mediaObject; -} - -/*! - \internal -*/ -bool QGraphicsVideoItem::setMediaObject(QMediaObject *object) -{ - Q_D(QGraphicsVideoItem); - - if (object == d->mediaObject) - return true; - - d->clearService(); - - d->mediaObject = object; - - if (d->mediaObject) { - d->service = d->mediaObject->service(); - - if (d->service) { - QMediaControl *control = d->service->requestControl(QVideoRendererControl_iid); - if (control) { - d->rendererControl = qobject_cast<QVideoRendererControl *>(control); - - if (d->rendererControl) { - connect(d->rendererControl, SIGNAL(nativeSizeChanged()), - this, SLOT(_q_updateNativeSize()), Qt::QueuedConnection); - d->_q_updateNativeSize(); - //don't set the surface untill the item is painted - //at least once and the surface is configured - if (!d->updatePaintDevice) - d->rendererControl->setSurface(d->surface); - else - update(boundingRect()); - - connect(d->service, SIGNAL(destroyed()), this, SLOT(_q_serviceDestroyed())); - - return true; - } - if (control) - d->service->releaseControl(control); - } - } - } - - d->mediaObject = 0; - return false; -} - -/*! - \property QGraphicsVideoItem::aspectRatioMode - \brief how a video is scaled to fit the graphics item's size. -*/ - -Qt::AspectRatioMode QGraphicsVideoItem::aspectRatioMode() const -{ - return d_func()->aspectRatioMode; -} - -void QGraphicsVideoItem::setAspectRatioMode(Qt::AspectRatioMode mode) -{ - Q_D(QGraphicsVideoItem); - - d->aspectRatioMode = mode; - d->updateRects(); -} - -/*! - \property QGraphicsVideoItem::offset - \brief the video item's offset. - - QGraphicsVideoItem will draw video using the offset for its top left - corner. -*/ - -QPointF QGraphicsVideoItem::offset() const -{ - return d_func()->rect.topLeft(); -} - -void QGraphicsVideoItem::setOffset(const QPointF &offset) -{ - Q_D(QGraphicsVideoItem); - - d->rect.moveTo(offset); - d->updateRects(); -} - -/*! - \property QGraphicsVideoItem::size - \brief the video item's size. - - QGraphicsVideoItem will draw video scaled to fit size according to its - fillMode. -*/ - -QSizeF QGraphicsVideoItem::size() const -{ - return d_func()->rect.size(); -} - -void QGraphicsVideoItem::setSize(const QSizeF &size) -{ - Q_D(QGraphicsVideoItem); - - d->rect.setSize(size.isValid() ? size : QSizeF(0, 0)); - d->updateRects(); -} - -/*! - \property QGraphicsVideoItem::nativeSize - \brief the native size of the video. -*/ - -QSizeF QGraphicsVideoItem::nativeSize() const -{ - return d_func()->nativeSize; -} - -/*! - \fn QGraphicsVideoItem::nativeSizeChanged(const QSizeF &size) - - Signals that the native \a size of the video has changed. -*/ - -/*! - \reimp -*/ -QRectF QGraphicsVideoItem::boundingRect() const -{ - return d_func()->boundingRect; -} - -/*! - \reimp -*/ -void QGraphicsVideoItem::paint( - QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) -{ - Q_D(QGraphicsVideoItem); - - Q_UNUSED(option); - Q_UNUSED(widget); - - if (d->surface && d->rendererControl && d->updatePaintDevice) { - d->updatePaintDevice = false; - - if (widget) - d->rendererControl->setProperty("winId", qulonglong(widget->winId())); - -#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_1_CL) && !defined(QT_OPENGL_ES_1) - if (widget) - connect(widget, SIGNAL(destroyed()), d->surface, SLOT(viewportDestroyed())); - - d->surface->setGLContext(const_cast<QGLContext *>(QGLContext::currentContext())); -#endif - if (d->rendererControl->surface() != d->surface) - d->rendererControl->setSurface(d->surface); - } - - - //overlay doesn't work reliably - - //check if the item is obscured: -#ifdef ENABLE_OVERLAY - if (!isObscured()) { - bool obscured = false; - - if (scene()) { - foreach (QGraphicsItem *item, - scene()->items(mapToScene(boundingRect()), Qt::IntersectsItemBoundingRect) ) { - if (item->flags() & QGraphicsItem::ItemHasNoContents) - continue; - - if (item == this) - break; - - if (collidesWithItem(item)) { - obscured = true; - break; - } - } - } - - d->rendererControl->setProperty("overlayEnabled", !obscured); - } - - if (d->rendererControl->property("overlayEnabled").toBool()) { - QTransform transform = painter->combinedTransform(); - QRect overlayRect = transform.mapRect(d->boundingRect).toRect(); - - d->rendererControl->setProperty("overlayGeometry", overlayRect); - QMetaObject::invokeMethod(d->rendererControl, "repaintOverlay"); - - painter->fillRect(d->boundingRect, - d->rendererControl->property("colorKey").value<QColor>()); - } else -#endif //ENABLE_OVERLAY - { - if (d->surface && d->surface->isActive()) { - d->surface->paint(painter, d->boundingRect, d->sourceRect); - d->surface->setReady(true); - } - } -} - -/*! - \reimp - - \internal -*/ -QVariant QGraphicsVideoItem::itemChange(GraphicsItemChange change, const QVariant &value) -{ - return QGraphicsItem::itemChange(change, value); -} - -/*! - \internal -*/ -void QGraphicsVideoItem::timerEvent(QTimerEvent *event) -{ - QGraphicsObject::timerEvent(event); -} - -#include "moc_qgraphicsvideoitem.cpp" -QT_END_NAMESPACE diff --git a/src/multimediakit/qimageencodercontrol.h b/src/multimediakit/qimageencodercontrol.h index cebcecb33..c8a8261a4 100644 --- a/src/multimediakit/qimageencodercontrol.h +++ b/src/multimediakit/qimageencodercontrol.h @@ -48,7 +48,12 @@ #include <QtCore/qsize.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE + +QT_MODULE(Multimedia) + class QByteArray; class QStringList; QT_END_NAMESPACE @@ -80,4 +85,7 @@ Q_MEDIA_DECLARE_CONTROL(QImageEncoderControl, QImageEncoderControl_iid) QT_END_NAMESPACE +QT_END_HEADER + + #endif diff --git a/src/multimediakit/qlocalmediaplaylistprovider.h b/src/multimediakit/qlocalmediaplaylistprovider.h index 32b50cfe2..e712a3f73 100644 --- a/src/multimediakit/qlocalmediaplaylistprovider.h +++ b/src/multimediakit/qlocalmediaplaylistprovider.h @@ -44,8 +44,13 @@ #include "qmediaplaylistprovider.h" +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QLocalMediaPlaylistProviderPrivate; class Q_MULTIMEDIA_EXPORT QLocalMediaPlaylistProvider : public QMediaPlaylistProvider { @@ -76,4 +81,7 @@ private: QT_END_NAMESPACE +QT_END_HEADER + + #endif // QLOCALMEDIAPAYLISTSOURCE_H diff --git a/src/multimediakit/qmediabackgroundplaybackcontrol.cpp b/src/multimediakit/qmediabackgroundplaybackcontrol.cpp new file mode 100644 index 000000000..0413fba01 --- /dev/null +++ b/src/multimediakit/qmediabackgroundplaybackcontrol.cpp @@ -0,0 +1,149 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qmediabackgroundplaybackcontrol.h" +#include "qmediacontrol_p.h" + +QT_BEGIN_NAMESPACE + + +/*! + \class QMediaBackgroundPlaybackControl + \inmodule QtMultimediaKit + \ingroup multimedia + \since 5.0 + + + \brief The QMediaBackgroundPlaybackControl class provides access to the background playback + related control of a QMediaService. + + If a QMediaService can play media in background, it should implement QMediaBackgroundPlaybackControl. + This control provides a means to set the \l {setContextId()}{contextId} for application, + \l {acquire()}{acquire the resource for playback} and \l {release()} {release the playback resource}. + + The interface name of QMediaBackgroundPlaybackControl is \c com.nokia.Qt.QMediaBackgroundPlaybackControl/1.0 as + defined in QMediaBackgroundPlaybackControl_iid. + + \sa QMediaService::requestControl(), QMediaPlayer +*/ + +/*! + \macro QMediaBackgroundPlaybackControl_iid + + \c com.nokia.Qt.QMediaBackgroundPlaybackControl/1.0 + + Defines the interface name of the QMediaBackgroundPlaybackControl class. + + \relates QMediaBackgroundPlaybackControl +*/ + +/*! + Destroys a media background playback control. +*/ +QMediaBackgroundPlaybackControl::~QMediaBackgroundPlaybackControl() +{ +} + +/*! + Constructs a new media background playback control with the given \a parent. +*/ +QMediaBackgroundPlaybackControl::QMediaBackgroundPlaybackControl(QObject *parent): + QMediaControl(*new QMediaControlPrivate, parent) +{ +} + +/*! + \fn QMediaBackgroundPlaybackControl::setContextId(const QString& contextId) + + Sets the contextId for the application, the last contextId will be released if previously set. + \l {acquire()}{acquire method} will be automatically invoked after setting a new contextId. + + contextId is an unique string set by the application and is used by the background daemon to + distinguish and manage different context for different application. + + \since 1.0 +*/ + +/*! + \fn QMediaBackgroundPlaybackControl::acquire() + + Try to acquire the playback resource for current application + \since 1.0 +*/ + +/*! + \fn QMediaBackgroundPlaybackControl::release() + + Give up the playback resource if current applicaiton holds it. + \since 1.0 +*/ + +/*! + \property QMediaBackgroundPlaybackControl::isAcquired() + \brief indicate whether the background playback resource is granted or not + + It may take sometime for the backend to actually update this value before the first use. + + By default this property is false + + \since 1.0 +*/ + +/*! + \fn QMediaBackgroundPlaybackControl::acquired() + + Signals that the playback resource is acquired + + \since 1.0 +*/ + +/*! + \fn QMediaBackgroundPlaybackControl::lost() + + Signals that the playback resource is lost + + \since 1.0 +*/ + +#include "moc_qmediabackgroundplaybackcontrol.cpp" +QT_END_NAMESPACE + + diff --git a/src/multimediakit/qcameraviewfinder.h b/src/multimediakit/qmediabackgroundplaybackcontrol.h index 0feee37c1..2cf8d1935 100644 --- a/src/multimediakit/qcameraviewfinder.h +++ b/src/multimediakit/qmediabackgroundplaybackcontrol.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -39,44 +39,45 @@ ** ****************************************************************************/ -#ifndef QCAMERAVIEWFINDER_H -#define QCAMERAVIEWFINDER_H +#ifndef QMEDIABACKGROUNDPLAYBACKCONTROL_H +#define QMEDIABACKGROUNDPLAYBACKCONTROL_H -#include <QtCore/qstringlist.h> -#include <QtCore/qpair.h> -#include <QtCore/qsize.h> -#include <QtCore/qpoint.h> -#include <QtCore/qrect.h> +#include "qmediacontrol.h" -#include <qmediacontrol.h> -#include <qmediaobject.h> -#include <qmediaservice.h> -#include <qvideowidget.h> - -#include <qmediaserviceprovider.h> +QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -class QCamera; +QT_MODULE(Multimedia) + -class QCameraViewfinderPrivate; -class Q_MULTIMEDIA_EXPORT QCameraViewfinder : public QVideoWidget +class Q_MULTIMEDIA_EXPORT QMediaBackgroundPlaybackControl : public QMediaControl { Q_OBJECT + public: - QCameraViewfinder(QWidget *parent = 0); - ~QCameraViewfinder(); + virtual ~QMediaBackgroundPlaybackControl(); - QMediaObject *mediaObject() const; + virtual void setContextId(const QString& contextId) = 0; + virtual void acquire() = 0; + virtual void release() = 0; -protected: - bool setMediaObject(QMediaObject *object); + virtual bool isAcquired() const = 0; + +Q_SIGNALS: + void acquired(); + void lost(); -private: - Q_DISABLE_COPY(QCameraViewfinder) - Q_DECLARE_PRIVATE(QCameraViewfinder) +protected: + QMediaBackgroundPlaybackControl(QObject* parent = 0); }; +#define QMediaBackgroundPlaybackControl_iid "com.nokia.Qt.QMediaBackgroundPlaybackControl/1.0" +Q_MEDIA_DECLARE_CONTROL(QMediaBackgroundPlaybackControl, QMediaBackgroundPlaybackControl_iid) + QT_END_NAMESPACE -#endif // QCAMERA_H +QT_END_HEADER + + +#endif // QMEDIABACKGROUNDPLAYBACKCONTROL_H diff --git a/src/multimediakit/qmediabindableinterface.h b/src/multimediakit/qmediabindableinterface.h index 68e11fa2d..02b5b1a21 100644 --- a/src/multimediakit/qmediabindableinterface.h +++ b/src/multimediakit/qmediabindableinterface.h @@ -44,8 +44,13 @@ #include <qmediaobject.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QMediaObject; class Q_MULTIMEDIA_EXPORT QMediaBindableInterface @@ -66,4 +71,7 @@ Q_DECLARE_INTERFACE(QMediaBindableInterface, QMediaBindableInterface_iid) QT_END_NAMESPACE +QT_END_HEADER + + #endif // QMEDIABINDABLEINTERFACE_H diff --git a/src/multimediakit/qmediacontainercontrol.h b/src/multimediakit/qmediacontainercontrol.h index 162b9af25..af48605d0 100644 --- a/src/multimediakit/qmediacontainercontrol.h +++ b/src/multimediakit/qmediacontainercontrol.h @@ -45,8 +45,13 @@ #include "qmediacontrol.h" +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class Q_MULTIMEDIA_EXPORT QMediaContainerControl : public QMediaControl { Q_OBJECT @@ -69,4 +74,7 @@ Q_MEDIA_DECLARE_CONTROL(QMediaContainerControl, QMediaContainerControl_iid) QT_END_NAMESPACE +QT_END_HEADER + + #endif // QMEDIACONTAINERCONTROL_H diff --git a/src/multimediakit/qmediacontent.h b/src/multimediakit/qmediacontent.h index 73e156f0d..99471f305 100644 --- a/src/multimediakit/qmediacontent.h +++ b/src/multimediakit/qmediacontent.h @@ -50,8 +50,13 @@ #include <qtmultimediakitdefs.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QMediaContentPrivate; class Q_MULTIMEDIA_EXPORT QMediaContent { @@ -85,6 +90,6 @@ QT_END_NAMESPACE Q_DECLARE_METATYPE(QMediaContent) - +QT_END_HEADER #endif // QMEDIACONTENT_H diff --git a/src/multimediakit/qmediacontrol.cpp b/src/multimediakit/qmediacontrol.cpp index b47d694c1..b7dfb3dc5 100644 --- a/src/multimediakit/qmediacontrol.cpp +++ b/src/multimediakit/qmediacontrol.cpp @@ -63,8 +63,6 @@ QT_BEGIN_NAMESPACE the core functionality of the service and a number of optional controls which expose any additional functionality. - XXX concrete example of this relationship - A pointer to a control implemented by a media service can be obtained using the \l {QMediaService::requestControl()} member of QMediaService. If the service doesn't implement a control it will instead return a null pointer. diff --git a/src/multimediakit/qmediacontrol.h b/src/multimediakit/qmediacontrol.h index 171e95bae..47cc13524 100644 --- a/src/multimediakit/qmediacontrol.h +++ b/src/multimediakit/qmediacontrol.h @@ -49,8 +49,13 @@ #include <QtCore/qvariant.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QMediaControlPrivate; class Q_MULTIMEDIA_EXPORT QMediaControl : public QObject { @@ -76,4 +81,7 @@ template <typename T> const char *qmediacontrol_iid() { return 0; } QT_END_NAMESPACE +QT_END_HEADER + + #endif // QABSTRACTMEDIACONTROL_H diff --git a/src/multimediakit/qmediacontrol_p.h b/src/multimediakit/qmediacontrol_p.h index baf5b8e5c..cde6cc688 100644 --- a/src/multimediakit/qmediacontrol_p.h +++ b/src/multimediakit/qmediacontrol_p.h @@ -55,8 +55,13 @@ #include <qtmultimediakitdefs.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QMediaControl; class QMediaControlPrivate @@ -69,4 +74,7 @@ public: QT_END_NAMESPACE +QT_END_HEADER + + #endif diff --git a/src/multimediakit/qmediaencodersettings.h b/src/multimediakit/qmediaencodersettings.h index a37d11202..14edc08f3 100644 --- a/src/multimediakit/qmediaencodersettings.h +++ b/src/multimediakit/qmediaencodersettings.h @@ -48,8 +48,13 @@ #include <qtmultimediakitdefs.h> #include "qtmedianamespace.h" +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QAudioEncoderSettingsPrivate; class Q_MULTIMEDIA_EXPORT QAudioEncoderSettings @@ -157,4 +162,7 @@ private: QT_END_NAMESPACE +QT_END_HEADER + + #endif diff --git a/src/multimediakit/qmediaimageviewer.cpp b/src/multimediakit/qmediaimageviewer.cpp index 1a5e659f1..cac508f8d 100644 --- a/src/multimediakit/qmediaimageviewer.cpp +++ b/src/multimediakit/qmediaimageviewer.cpp @@ -44,12 +44,10 @@ #include "qmediaobject_p.h" #include "qmediaimageviewerservice_p.h" -#include <qgraphicsvideoitem.h> #include <qmediaplaylist.h> #include <qmediaplaylistsourcecontrol.h> #include <qmediacontent.h> #include <qmediaresource.h> -#include <qvideowidget.h> #include <qvideosurfaceoutput_p.h> #include <QtCore/qcoreevent.h> @@ -411,7 +409,10 @@ void QMediaImageViewer::setVideoOutput(QVideoWidget *widget) if (d->videoOutput) unbind(d->videoOutput); - d->videoOutput = bind(widget) ? widget : 0; + // We don't know (in this library) that QVideoWidget inherits QObject + QObject *widgetObject = reinterpret_cast<QObject*>(widget); + + d->videoOutput = widgetObject && bind(widgetObject) ? widgetObject : 0; } /*! @@ -428,7 +429,11 @@ void QMediaImageViewer::setVideoOutput(QGraphicsVideoItem *item) if (d->videoOutput) unbind(d->videoOutput); - d->videoOutput = bind(item) ? item : 0; + // We don't know (in this library) that QGraphicsVideoItem (multiply) inherits QObject + // but QObject inheritance depends on QObject coming first, so try this out. + QObject *itemObject = reinterpret_cast<QObject*>(item); + + d->videoOutput = itemObject && bind(itemObject) ? itemObject : 0; } /*! diff --git a/src/multimediakit/qmediaimageviewer.h b/src/multimediakit/qmediaimageviewer.h index 8c6116851..7010fad3f 100644 --- a/src/multimediakit/qmediaimageviewer.h +++ b/src/multimediakit/qmediaimageviewer.h @@ -46,8 +46,13 @@ #include "qmediacontent.h" #include <qmediaenumdebug.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QAbstractVideoSurface; class QGraphicsVideoItem; class QMediaPlaylist; @@ -132,4 +137,6 @@ Q_DECLARE_METATYPE(QMediaImageViewer::MediaStatus) Q_MEDIA_ENUM_DEBUG(QMediaImageViewer, State) Q_MEDIA_ENUM_DEBUG(QMediaImageViewer, MediaStatus) +QT_END_HEADER + #endif diff --git a/src/multimediakit/qmediaimageviewerservice.cpp b/src/multimediakit/qmediaimageviewerservice.cpp index 869872c54..65de7a81b 100644 --- a/src/multimediakit/qmediaimageviewerservice.cpp +++ b/src/multimediakit/qmediaimageviewerservice.cpp @@ -48,13 +48,11 @@ #include <qmediaresource.h> #include <qmediaobject_p.h> #include <qvideorenderercontrol.h> -#include <qvideowidgetcontrol.h> #include <QtCore/qdebug.h> #include <QtCore/qurl.h> #include <QtGui/qimagereader.h> -#include <QtGui/qpainter.h> #include <QtNetwork/qnetworkaccessmanager.h> #include <QtNetwork/qnetworkreply.h> diff --git a/src/multimediakit/qmediaimageviewerservice_p.h b/src/multimediakit/qmediaimageviewerservice_p.h index 55d36c8cb..e40cdc5f4 100644 --- a/src/multimediakit/qmediaimageviewerservice_p.h +++ b/src/multimediakit/qmediaimageviewerservice_p.h @@ -57,13 +57,16 @@ #include <qmediaservice.h> #include <qmediaimageviewer.h> #include <qvideorenderercontrol.h> -#include <qvideowidget.h> -#include <qvideowidgetcontrol.h> #include <QtCore/qpointer.h> #include <QtGui/qimage.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE + +QT_MODULE(Multimedia) + class QAbstractVideoSurface; class QNetworkAccessManager; QT_END_NAMESPACE @@ -138,4 +141,7 @@ private: QT_END_NAMESPACE +QT_END_HEADER + + #endif diff --git a/src/multimediakit/qmedianetworkaccesscontrol.h b/src/multimediakit/qmedianetworkaccesscontrol.h index f16edfb8e..22ee95711 100644 --- a/src/multimediakit/qmedianetworkaccesscontrol.h +++ b/src/multimediakit/qmedianetworkaccesscontrol.h @@ -48,8 +48,13 @@ #include <QtCore/qlist.h> #include <QtNetwork/qnetworkconfiguration.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class Q_MULTIMEDIA_EXPORT QMediaNetworkAccessControl : public QMediaControl { Q_OBJECT @@ -72,4 +77,7 @@ Q_MEDIA_DECLARE_CONTROL(QMediaNetworkAccessControl, QMediaNetworkAccessControl_i QT_END_NAMESPACE +QT_END_HEADER + + #endif diff --git a/src/multimediakit/qmediaobject.cpp b/src/multimediakit/qmediaobject.cpp index 3276a2b44..2f6840e04 100644 --- a/src/multimediakit/qmediaobject.cpp +++ b/src/multimediakit/qmediaobject.cpp @@ -74,8 +74,6 @@ void QMediaObjectPrivate::_q_notify() \ingroup multimedia \since 1.0 - XXX why do I care - QMediaObject derived classes provide access to the functionality of a QMediaService. Each media object hosts a QMediaService and uses the QMediaControl interfaces implemented by the service to implement its @@ -156,8 +154,6 @@ void QMediaObject::setNotifyInterval(int milliSeconds) that wrap this functionality, so this function rarely needs to be called directly. - XXX for example - The object passed must implement the QMediaBindableInterface interface. \since 1.0 diff --git a/src/multimediakit/qmediaobject.h b/src/multimediakit/qmediaobject.h index 081764f1e..0fcf4cdee 100644 --- a/src/multimediakit/qmediaobject.h +++ b/src/multimediakit/qmediaobject.h @@ -48,8 +48,13 @@ #include <qtmultimediakitdefs.h> #include "qtmedianamespace.h" +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QMediaService; class QMediaBindableInterface; @@ -107,4 +112,7 @@ private: QT_END_NAMESPACE +QT_END_HEADER + + #endif // QABSTRACTMEDIAOBJECT_H diff --git a/src/multimediakit/qmediaobject_p.h b/src/multimediakit/qmediaobject_p.h index 53225d6c0..f27420cf0 100644 --- a/src/multimediakit/qmediaobject_p.h +++ b/src/multimediakit/qmediaobject_p.h @@ -59,8 +59,13 @@ #include "qmediaobject.h" +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QMetaDataReaderControl; #define Q_DECLARE_NON_CONST_PUBLIC(Class) \ @@ -88,4 +93,7 @@ public: QT_END_NAMESPACE +QT_END_HEADER + + #endif diff --git a/src/multimediakit/qmediaplayer.cpp b/src/multimediakit/qmediaplayer.cpp index 75e414f6d..4e87e9c42 100644 --- a/src/multimediakit/qmediaplayer.cpp +++ b/src/multimediakit/qmediaplayer.cpp @@ -55,9 +55,7 @@ #include <qmediaplaylist.h> #include <qmediaplaylistcontrol.h> #include <qmediaplaylistsourcecontrol.h> -#include <qvideowidget.h> #include <qvideosurfaceoutput_p.h> -#include <qgraphicsvideoitem.h> #include <qmedianetworkaccesscontrol.h> QT_BEGIN_NAMESPACE @@ -748,7 +746,10 @@ void QMediaPlayer::setVideoOutput(QVideoWidget *output) if (d->videoOutput) unbind(d->videoOutput); - d->videoOutput = output && bind(output) ? output : 0; + // We don't know (in this library) that QVideoWidget inherits QObject + QObject *outputObject = reinterpret_cast<QObject*>(output); + + d->videoOutput = outputObject && bind(outputObject) ? outputObject : 0; } /*! @@ -767,7 +768,11 @@ void QMediaPlayer::setVideoOutput(QGraphicsVideoItem *output) if (d->videoOutput) unbind(d->videoOutput); - d->videoOutput = output && bind(output) ? output : 0; + // We don't know (in this library) that QGraphicsVideoItem (multiply) inherits QObject + // but QObject inheritance depends on QObject coming first, so try this out. + QObject *outputObject = reinterpret_cast<QObject*>(output); + + d->videoOutput = outputObject && bind(outputObject) ? outputObject : 0; } /*! diff --git a/src/multimediakit/qmediaplayer.h b/src/multimediakit/qmediaplayer.h index 8361c3efa..af096147f 100644 --- a/src/multimediakit/qmediaplayer.h +++ b/src/multimediakit/qmediaplayer.h @@ -52,8 +52,13 @@ QT_BEGIN_HEADER +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QAbstractVideoSurface; class QMediaPlaylist; class QVideoWidget; diff --git a/src/multimediakit/qmediaplayercontrol.h b/src/multimediakit/qmediaplayercontrol.h index c83099d8c..a6e02ee9a 100644 --- a/src/multimediakit/qmediaplayercontrol.h +++ b/src/multimediakit/qmediaplayercontrol.h @@ -48,8 +48,13 @@ #include <QtCore/qpair.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QMediaPlaylist; class Q_MULTIMEDIA_EXPORT QMediaPlayerControl : public QMediaControl @@ -119,5 +124,8 @@ Q_MEDIA_DECLARE_CONTROL(QMediaPlayerControl, QMediaPlayerControl_iid) QT_END_NAMESPACE +QT_END_HEADER + + #endif // QMEDIAPLAYERCONTROL_H diff --git a/src/multimediakit/qmediaplaylist.h b/src/multimediakit/qmediaplaylist.h index ea48c3deb..7b4b62260 100644 --- a/src/multimediakit/qmediaplaylist.h +++ b/src/multimediakit/qmediaplaylist.h @@ -50,8 +50,13 @@ #include <qmediaenumdebug.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QMediaPlaylistProvider; class QMediaPlaylistPrivate; @@ -144,4 +149,6 @@ 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/multimediakit/qmediaplaylist_p.h b/src/multimediakit/qmediaplaylist_p.h index 12a257f04..c04483c02 100644 --- a/src/multimediakit/qmediaplaylist_p.h +++ b/src/multimediakit/qmediaplaylist_p.h @@ -66,8 +66,13 @@ # pragma Q_MOC_EXPAND_MACROS #endif +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QMediaPlaylistControl; class QMediaPlaylistProvider; class QMediaPlaylistReader; @@ -166,4 +171,7 @@ private: QT_END_NAMESPACE +QT_END_HEADER + + #endif // QMEDIAPLAYLIST_P_H diff --git a/src/multimediakit/qmediaplaylistcontrol.h b/src/multimediakit/qmediaplaylistcontrol.h index 5a65fef59..2cce448fa 100644 --- a/src/multimediakit/qmediaplaylistcontrol.h +++ b/src/multimediakit/qmediaplaylistcontrol.h @@ -47,8 +47,13 @@ #include "qmediaplaylistnavigator.h" +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QMediaPlaylistProvider; class Q_MULTIMEDIA_EXPORT QMediaPlaylistControl : public QMediaControl @@ -87,4 +92,7 @@ Q_MEDIA_DECLARE_CONTROL(QMediaPlaylistControl, QMediaPlaylistControl_iid) QT_END_NAMESPACE +QT_END_HEADER + + #endif // QMEDIAPLAYLISTCONTROL_H diff --git a/src/multimediakit/qmediaplaylistioplugin.h b/src/multimediakit/qmediaplaylistioplugin.h index 2d792df16..4234fb8ea 100644 --- a/src/multimediakit/qmediaplaylistioplugin.h +++ b/src/multimediakit/qmediaplaylistioplugin.h @@ -50,7 +50,12 @@ #include "qmediacontent.h" +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE + +QT_MODULE(Multimedia) + class QString; class QUrl; class QByteArray; @@ -115,4 +120,7 @@ public: QT_END_NAMESPACE +QT_END_HEADER + + #endif // QMEDIAPLAYLISTIOPLUGIN_H diff --git a/src/multimediakit/qmediaplaylistnavigator.h b/src/multimediakit/qmediaplaylistnavigator.h index 4f2e15dbf..72e452072 100644 --- a/src/multimediakit/qmediaplaylistnavigator.h +++ b/src/multimediakit/qmediaplaylistnavigator.h @@ -46,8 +46,13 @@ #include "qmediaplaylist.h" #include <QtCore/qobject.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QMediaPlaylistNavigatorPrivate; class Q_MULTIMEDIA_EXPORT QMediaPlaylistNavigator : public QObject { @@ -104,4 +109,7 @@ private: QT_END_NAMESPACE +QT_END_HEADER + + #endif // QMEDIAPLAYLISTNAVIGATOR_H diff --git a/src/multimediakit/qmediaplaylistprovider.h b/src/multimediakit/qmediaplaylistprovider.h index 07723810c..79167e8ba 100644 --- a/src/multimediakit/qmediaplaylistprovider.h +++ b/src/multimediakit/qmediaplaylistprovider.h @@ -47,7 +47,12 @@ #include "qmediacontent.h" #include "qmediaplaylist.h" +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE + +QT_MODULE(Multimedia) + class QString; QT_END_NAMESPACE @@ -104,4 +109,7 @@ private: QT_END_NAMESPACE +QT_END_HEADER + + #endif // QMEDIAPLAYLISTPROVIDER_H diff --git a/src/multimediakit/qmediaplaylistprovider_p.h b/src/multimediakit/qmediaplaylistprovider_p.h index 1ca28f9e9..71fb86f20 100644 --- a/src/multimediakit/qmediaplaylistprovider_p.h +++ b/src/multimediakit/qmediaplaylistprovider_p.h @@ -55,8 +55,13 @@ #include "qmediaplaylist.h" +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QMediaPlaylistProviderPrivate { public: @@ -68,5 +73,8 @@ public: QT_END_NAMESPACE +QT_END_HEADER + + #endif // QMEDIAPLAYLISTSOURCE_P_H diff --git a/src/multimediakit/qmediaplaylistsourcecontrol.h b/src/multimediakit/qmediaplaylistsourcecontrol.h index e55287fbc..040bb6431 100644 --- a/src/multimediakit/qmediaplaylistsourcecontrol.h +++ b/src/multimediakit/qmediaplaylistsourcecontrol.h @@ -45,8 +45,13 @@ #include <qmediacontrol.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QMediaPlaylist; class Q_MULTIMEDIA_EXPORT QMediaPlaylistSourceControl : public QMediaControl @@ -71,4 +76,7 @@ Q_MEDIA_DECLARE_CONTROL(QMediaPlaylistSourceControl, QMediaPlaylistSourceControl QT_END_NAMESPACE +QT_END_HEADER + + #endif // QMEDIAPLAYLISTCONTROL_H diff --git a/src/multimediakit/qmediapluginloader_p.h b/src/multimediakit/qmediapluginloader_p.h index 0c4ad767b..2f0a4d939 100644 --- a/src/multimediakit/qmediapluginloader_p.h +++ b/src/multimediakit/qmediapluginloader_p.h @@ -60,8 +60,13 @@ #include <QtCore/qmap.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QMediaServiceProviderPlugin; class Q_AUTOTEST_EXPORT QMediaPluginLoader @@ -88,4 +93,7 @@ private: QT_END_NAMESPACE +QT_END_HEADER + + #endif // QMEDIAPLUGINLOADER_H diff --git a/src/multimediakit/qmediarecorder.h b/src/multimediakit/qmediarecorder.h index 53e829526..1e99b95c6 100644 --- a/src/multimediakit/qmediarecorder.h +++ b/src/multimediakit/qmediarecorder.h @@ -50,7 +50,12 @@ #include <QtCore/qpair.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE + +QT_MODULE(Multimedia) + class QUrl; class QSize; class QAudioFormat; @@ -187,4 +192,6 @@ Q_DECLARE_METATYPE(QMediaRecorder::Error) Q_MEDIA_ENUM_DEBUG(QMediaRecorder, State) Q_MEDIA_ENUM_DEBUG(QMediaRecorder, Error) +QT_END_HEADER + #endif // QMEDIARECORDER_H diff --git a/src/multimediakit/qmediarecordercontrol.h b/src/multimediakit/qmediarecordercontrol.h index f7ef516b9..26f244c08 100644 --- a/src/multimediakit/qmediarecordercontrol.h +++ b/src/multimediakit/qmediarecordercontrol.h @@ -45,7 +45,12 @@ #include "qmediacontrol.h" #include "qmediarecorder.h" +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE + +QT_MODULE(Multimedia) + class QUrl; QT_END_NAMESPACE @@ -90,4 +95,7 @@ Q_MEDIA_DECLARE_CONTROL(QMediaRecorderControl, QMediaRecorderControl_iid) QT_END_NAMESPACE +QT_END_HEADER + + #endif diff --git a/src/multimediakit/qmediaresource.h b/src/multimediakit/qmediaresource.h index 6b2738181..02469e04c 100644 --- a/src/multimediakit/qmediaresource.h +++ b/src/multimediakit/qmediaresource.h @@ -48,8 +48,13 @@ #include <qtmultimediakitdefs.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class Q_MULTIMEDIA_EXPORT QMediaResource { public: @@ -124,5 +129,6 @@ QT_END_NAMESPACE Q_DECLARE_METATYPE(QMediaResource) Q_DECLARE_METATYPE(QMediaResourceList) +QT_END_HEADER #endif diff --git a/src/multimediakit/qmediaservice.h b/src/multimediakit/qmediaservice.h index 77e1615ae..7bf90ba4f 100644 --- a/src/multimediakit/qmediaservice.h +++ b/src/multimediakit/qmediaservice.h @@ -48,8 +48,13 @@ #include "qmediacontrol.h" +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QMediaServicePrivate; class Q_MULTIMEDIA_EXPORT QMediaService : public QObject { @@ -85,5 +90,8 @@ private: QT_END_NAMESPACE +QT_END_HEADER + + #endif // QABSTRACTMEDIASERVICE_H diff --git a/src/multimediakit/qmediaservice_p.h b/src/multimediakit/qmediaservice_p.h index a0f0b6b7f..83fd7287f 100644 --- a/src/multimediakit/qmediaservice_p.h +++ b/src/multimediakit/qmediaservice_p.h @@ -53,8 +53,13 @@ // We mean it. // +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QAudioDeviceControl; class QMediaServicePrivate @@ -68,5 +73,8 @@ public: QT_END_NAMESPACE +QT_END_HEADER + + #endif diff --git a/src/multimediakit/qmediaserviceprovider.cpp b/src/multimediakit/qmediaserviceprovider.cpp index dab7fe00d..e9ac801c0 100644 --- a/src/multimediakit/qmediaserviceprovider.cpp +++ b/src/multimediakit/qmediaserviceprovider.cpp @@ -110,6 +110,9 @@ public: \value VideoSurface The service is capable of renderering to a QAbstractVideoSurface output. + + \value BackgroundPlayback + The service is capable of doing playback in the background */ /*! @@ -289,7 +292,7 @@ class QPluginServiceProvider : public QMediaServiceProvider public: QMediaService* requestService(const QByteArray &type, const QMediaServiceProviderHint &hint) { - QString key(type); + QString key(QLatin1String(type.constData())); QList<QMediaServiceProviderPlugin *>plugins; foreach (QObject *obj, loader()->instances(key)) { @@ -404,7 +407,7 @@ public: const QStringList& codecs, int flags) const { - QList<QObject*> instances = loader()->instances(serviceType); + QList<QObject*> instances = loader()->instances(QLatin1String(serviceType)); if (instances.isEmpty()) return QtMultimediaKit::NotSupported; @@ -456,7 +459,7 @@ public: QStringList supportedMimeTypes(const QByteArray &serviceType, int flags) const { - QList<QObject*> instances = loader()->instances(serviceType); + QList<QObject*> instances = loader()->instances(QLatin1String(serviceType)); QStringList supportedTypes; @@ -505,7 +508,7 @@ public: { QList<QByteArray> res; - foreach(QObject *obj, loader()->instances(serviceType)) { + foreach (QObject *obj, loader()->instances(QLatin1String(serviceType))) { QMediaServiceSupportedDevicesInterface *iface = qobject_cast<QMediaServiceSupportedDevicesInterface*>(obj); @@ -519,7 +522,7 @@ public: QString deviceDescription(const QByteArray &serviceType, const QByteArray &device) { - foreach(QObject *obj, loader()->instances(serviceType)) { + foreach (QObject *obj, loader()->instances(QLatin1String(serviceType))) { QMediaServiceSupportedDevicesInterface *iface = qobject_cast<QMediaServiceSupportedDevicesInterface*>(obj); diff --git a/src/multimediakit/qmediaserviceprovider.h b/src/multimediakit/qmediaserviceprovider.h index d9a789bf4..6305796b0 100644 --- a/src/multimediakit/qmediaserviceprovider.h +++ b/src/multimediakit/qmediaserviceprovider.h @@ -47,8 +47,13 @@ #include <qtmultimediakitdefs.h> #include "qtmedianamespace.h" +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QMediaService; class QMediaServiceProviderHintPrivate; @@ -61,7 +66,8 @@ public: LowLatencyPlayback = 0x01, RecordingSupport = 0x02, StreamPlayback = 0x04, - VideoSurface = 0x08 + VideoSurface = 0x08, + BackgroundPlayback = 0x10, }; Q_DECLARE_FLAGS(Features, Feature) @@ -167,4 +173,7 @@ public: QT_END_NAMESPACE +QT_END_HEADER + + #endif // QMEDIASERVICEPROVIDER_H diff --git a/src/multimediakit/qmediaserviceproviderplugin.h b/src/multimediakit/qmediaserviceproviderplugin.h index 6cf45fda4..5d150a22b 100644 --- a/src/multimediakit/qmediaserviceproviderplugin.h +++ b/src/multimediakit/qmediaserviceproviderplugin.h @@ -52,8 +52,13 @@ # pragma Q_MOC_EXPAND_MACROS #endif +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QMediaService; struct Q_MULTIMEDIA_EXPORT QMediaServiceProviderFactoryInterface : public QFactoryInterface @@ -117,5 +122,8 @@ public: QT_END_NAMESPACE +QT_END_HEADER + + #endif // QMEDIASERVICEPROVIDERPLUGIN_H diff --git a/src/multimediakit/qmediastreamscontrol.h b/src/multimediakit/qmediastreamscontrol.h index dd5468ee2..10c38e130 100644 --- a/src/multimediakit/qmediastreamscontrol.h +++ b/src/multimediakit/qmediastreamscontrol.h @@ -48,8 +48,13 @@ #include "qtmultimediakitdefs.h" #include <qmediaenumdebug.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class Q_MULTIMEDIA_EXPORT QMediaStreamsControl : public QMediaControl { Q_OBJECT @@ -84,5 +89,7 @@ Q_DECLARE_METATYPE(QMediaStreamsControl::StreamType) Q_MEDIA_ENUM_DEBUG(QMediaStreamsControl, StreamType) +QT_END_HEADER + #endif // QMEDIASTREAMSCONTROL_H diff --git a/src/multimediakit/qmediatimerange.h b/src/multimediakit/qmediatimerange.h index 15ef12691..927801f34 100644 --- a/src/multimediakit/qmediatimerange.h +++ b/src/multimediakit/qmediatimerange.h @@ -46,8 +46,13 @@ #include "qtmedianamespace.h" #include <QtCore/qshareddata.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QMediaTimeRangePrivate; class Q_MULTIMEDIA_EXPORT QMediaTimeInterval @@ -129,4 +134,7 @@ Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, const QMediaTimeRange &); QT_END_NAMESPACE +QT_END_HEADER + + #endif // QMEDIATIMERANGE_H diff --git a/src/multimediakit/qmetadatareadercontrol.h b/src/multimediakit/qmetadatareadercontrol.h index cb0ed7387..4689e30bc 100644 --- a/src/multimediakit/qmetadatareadercontrol.h +++ b/src/multimediakit/qmetadatareadercontrol.h @@ -50,8 +50,13 @@ #include <qtmultimediakitdefs.h> #include "qtmedianamespace.h" +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class Q_MULTIMEDIA_EXPORT QMetaDataReaderControl : public QMediaControl { @@ -81,4 +86,7 @@ Q_MEDIA_DECLARE_CONTROL(QMetaDataReaderControl, QMetaDataReaderControl_iid) QT_END_NAMESPACE +QT_END_HEADER + + #endif // QMETADATAPROVIDER_H diff --git a/src/multimediakit/qmetadatawritercontrol.h b/src/multimediakit/qmetadatawritercontrol.h index 417e91abb..41a2fbba7 100644 --- a/src/multimediakit/qmetadatawritercontrol.h +++ b/src/multimediakit/qmetadatawritercontrol.h @@ -50,8 +50,13 @@ #include <qtmultimediakitdefs.h> #include "qtmedianamespace.h" +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class Q_MULTIMEDIA_EXPORT QMetaDataWriterControl : public QMediaControl { @@ -86,4 +91,7 @@ Q_MEDIA_DECLARE_CONTROL(QMetaDataWriterControl, QMetaDataWriterControl_iid) QT_END_NAMESPACE +QT_END_HEADER + + #endif diff --git a/src/multimediakit/qpaintervideosurface.cpp b/src/multimediakit/qpaintervideosurface.cpp deleted file mode 100644 index bd82f7841..000000000 --- a/src/multimediakit/qpaintervideosurface.cpp +++ /dev/null @@ -1,1728 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <qpaintervideosurface_p.h> -#include <qpaintervideosurface_mac_p.h> - -#include <qmath.h> - -#include <qpainter.h> -#include <qvariant.h> -#include <qvideosurfaceformat.h> - -#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_1_CL) && !defined(QT_OPENGL_ES_1) -#include <qglshaderprogram.h> -#ifndef GL_CLAMP_TO_EDGE -#define GL_CLAMP_TO_EDGE 0x812F -#endif -#endif - -#include <QtDebug> -QT_BEGIN_NAMESPACE - -QVideoSurfacePainter::~QVideoSurfacePainter() -{ -} - -class QVideoSurfaceGenericPainter : public QVideoSurfacePainter -{ -public: - QVideoSurfaceGenericPainter(); - - QList<QVideoFrame::PixelFormat> supportedPixelFormats( - QAbstractVideoBuffer::HandleType handleType) const; - - bool isFormatSupported( - const QVideoSurfaceFormat &format, QVideoSurfaceFormat *similar) const; - - QAbstractVideoSurface::Error start(const QVideoSurfaceFormat &format); - void stop(); - - QAbstractVideoSurface::Error setCurrentFrame(const QVideoFrame &frame); - - QAbstractVideoSurface::Error paint( - const QRectF &target, QPainter *painter, const QRectF &source); - - void updateColors(int brightness, int contrast, int hue, int saturation); - -private: - QList<QVideoFrame::PixelFormat> m_imagePixelFormats; - QVideoFrame m_frame; - QSize m_imageSize; - QImage::Format m_imageFormat; - QVideoSurfaceFormat::Direction m_scanLineDirection; -}; - -QVideoSurfaceGenericPainter::QVideoSurfaceGenericPainter() - : m_imageFormat(QImage::Format_Invalid) - , m_scanLineDirection(QVideoSurfaceFormat::TopToBottom) -{ - m_imagePixelFormats - << QVideoFrame::Format_RGB32 -#ifndef QT_OPENGL_ES // The raster formats should be a subset of the GL formats. - << QVideoFrame::Format_RGB24 -#endif - << QVideoFrame::Format_ARGB32 - << QVideoFrame::Format_RGB565; -} - -QList<QVideoFrame::PixelFormat> QVideoSurfaceGenericPainter::supportedPixelFormats( - QAbstractVideoBuffer::HandleType handleType) const -{ - switch (handleType) { - case QAbstractVideoBuffer::QPixmapHandle: - case QAbstractVideoBuffer::NoHandle: - return m_imagePixelFormats; - default: - ; - } - return QList<QVideoFrame::PixelFormat>(); -} - -bool QVideoSurfaceGenericPainter::isFormatSupported( - const QVideoSurfaceFormat &format, QVideoSurfaceFormat *) const -{ - switch (format.handleType()) { - case QAbstractVideoBuffer::QPixmapHandle: - return true; - case QAbstractVideoBuffer::NoHandle: - return m_imagePixelFormats.contains(format.pixelFormat()) - && !format.frameSize().isEmpty(); - default: - ; - } - return false; -} - -QAbstractVideoSurface::Error QVideoSurfaceGenericPainter::start(const QVideoSurfaceFormat &format) -{ - m_frame = QVideoFrame(); - m_imageFormat = QVideoFrame::imageFormatFromPixelFormat(format.pixelFormat()); - m_imageSize = format.frameSize(); - m_scanLineDirection = format.scanLineDirection(); - - const QAbstractVideoBuffer::HandleType t = format.handleType(); - if (t == QAbstractVideoBuffer::NoHandle) { - if (m_imageFormat != QImage::Format_Invalid -#ifdef QT_OPENGL_ES - && format.pixelFormat() != QVideoFrame::Format_RGB24 -#endif - && !m_imageSize.isEmpty()) { - return QAbstractVideoSurface::NoError; - } - } else if (t == QAbstractVideoBuffer::QPixmapHandle) { - return QAbstractVideoSurface::NoError; - } - return QAbstractVideoSurface::UnsupportedFormatError; -} - -void QVideoSurfaceGenericPainter::stop() -{ - m_frame = QVideoFrame(); -} - -QAbstractVideoSurface::Error QVideoSurfaceGenericPainter::setCurrentFrame(const QVideoFrame &frame) -{ - m_frame = frame; - - return QAbstractVideoSurface::NoError; -} - -QAbstractVideoSurface::Error QVideoSurfaceGenericPainter::paint( - const QRectF &target, QPainter *painter, const QRectF &source) -{ - if (!m_frame.isValid()) { - painter->fillRect(target, Qt::black); - return QAbstractVideoSurface::NoError; - } - - if (m_frame.handleType() == QAbstractVideoBuffer::QPixmapHandle) { - painter->drawPixmap(target, m_frame.handle().value<QPixmap>(), source); - } else if (m_frame.map(QAbstractVideoBuffer::ReadOnly)) { - QImage image( - m_frame.bits(), - m_imageSize.width(), - m_imageSize.height(), - m_frame.bytesPerLine(), - m_imageFormat); - - if (m_scanLineDirection == QVideoSurfaceFormat::BottomToTop) { - const QTransform oldTransform = painter->transform(); - - painter->scale(1, -1); - painter->translate(0, -target.bottom()); - painter->drawImage( - QRectF(target.x(), 0, target.width(), target.height()), image, source); - painter->setTransform(oldTransform); - } else { - painter->drawImage(target, image, source); - } - - m_frame.unmap(); - } else if (m_frame.isValid()) { - return QAbstractVideoSurface::IncorrectFormatError; - } else { - painter->fillRect(target, Qt::black); - } - return QAbstractVideoSurface::NoError; -} - -void QVideoSurfaceGenericPainter::updateColors(int, int, int, int) -{ -} - -#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_1_CL) && !defined(QT_OPENGL_ES_1) - -#ifndef Q_WS_MAC -# ifndef APIENTRYP -# ifdef APIENTRY -# define APIENTRYP APIENTRY * -# else -# define APIENTRY -# define APIENTRYP * -# endif -# endif -#else -# define APIENTRY -# define APIENTRYP * -#endif - -#ifndef GL_TEXTURE0 -# define GL_TEXTURE0 0x84C0 -# define GL_TEXTURE1 0x84C1 -# define GL_TEXTURE2 0x84C2 -#endif -#ifndef GL_PROGRAM_ERROR_STRING_ARB -# define GL_PROGRAM_ERROR_STRING_ARB 0x8874 -#endif - -#ifndef GL_UNSIGNED_SHORT_5_6_5 -# define GL_UNSIGNED_SHORT_5_6_5 33635 -#endif - -class QVideoSurfaceGLPainter : public QVideoSurfacePainter -{ -public: - QVideoSurfaceGLPainter(QGLContext *context); - ~QVideoSurfaceGLPainter(); - QList<QVideoFrame::PixelFormat> supportedPixelFormats( - QAbstractVideoBuffer::HandleType handleType) const; - - bool isFormatSupported( - const QVideoSurfaceFormat &format, QVideoSurfaceFormat *similar) const; - - QAbstractVideoSurface::Error setCurrentFrame(const QVideoFrame &frame); - - QAbstractVideoSurface::Error paint( - const QRectF &target, QPainter *painter, const QRectF &source); - - void updateColors(int brightness, int contrast, int hue, int saturation); - void viewportDestroyed(); - -protected: - void initRgbTextureInfo(GLenum internalFormat, GLuint format, GLenum type, const QSize &size); - void initYuv420PTextureInfo(const QSize &size); - void initYv12TextureInfo(const QSize &size); - -#ifndef QT_OPENGL_ES - typedef void (APIENTRY *_glActiveTexture) (GLenum); - _glActiveTexture glActiveTexture; -#endif - - QList<QVideoFrame::PixelFormat> m_imagePixelFormats; - QList<QVideoFrame::PixelFormat> m_glPixelFormats; - QMatrix4x4 m_colorMatrix; - QVideoFrame m_frame; - - QGLContext *m_context; - QAbstractVideoBuffer::HandleType m_handleType; - QVideoSurfaceFormat::Direction m_scanLineDirection; - QVideoSurfaceFormat::YCbCrColorSpace m_colorSpace; - GLenum m_textureFormat; - GLuint m_textureInternalFormat; - GLenum m_textureType; - int m_textureCount; - GLuint m_textureIds[3]; - int m_textureWidths[3]; - int m_textureHeights[3]; - int m_textureOffsets[3]; - bool m_yuv; -}; - -QVideoSurfaceGLPainter::QVideoSurfaceGLPainter(QGLContext *context) - : m_context(context) - , m_handleType(QAbstractVideoBuffer::NoHandle) - , m_scanLineDirection(QVideoSurfaceFormat::TopToBottom) - , m_colorSpace(QVideoSurfaceFormat::YCbCr_BT601) - , m_textureFormat(0) - , m_textureInternalFormat(0) - , m_textureType(0) - , m_textureCount(0) - , m_yuv(false) -{ -#ifndef QT_OPENGL_ES - glActiveTexture = (_glActiveTexture)m_context->getProcAddress(QLatin1String("glActiveTexture")); -#endif -} - -QVideoSurfaceGLPainter::~QVideoSurfaceGLPainter() -{ -} - -void QVideoSurfaceGLPainter::viewportDestroyed() -{ - m_context = 0; -} - -QList<QVideoFrame::PixelFormat> QVideoSurfaceGLPainter::supportedPixelFormats( - QAbstractVideoBuffer::HandleType handleType) const -{ - switch (handleType) { - case QAbstractVideoBuffer::NoHandle: - return m_imagePixelFormats; - case QAbstractVideoBuffer::QPixmapHandle: - case QAbstractVideoBuffer::GLTextureHandle: - return m_glPixelFormats; - default: - ; - } - return QList<QVideoFrame::PixelFormat>(); -} - -bool QVideoSurfaceGLPainter::isFormatSupported( - const QVideoSurfaceFormat &format, QVideoSurfaceFormat *) const -{ - if (format.frameSize().isEmpty()) { - return false; - } else { - switch (format.handleType()) { - case QAbstractVideoBuffer::NoHandle: - return m_imagePixelFormats.contains(format.pixelFormat()); - case QAbstractVideoBuffer::QPixmapHandle: - case QAbstractVideoBuffer::GLTextureHandle: - return m_glPixelFormats.contains(format.pixelFormat()); - default: - ; - } - } - return false; -} - -QAbstractVideoSurface::Error QVideoSurfaceGLPainter::setCurrentFrame(const QVideoFrame &frame) -{ - m_frame = frame; - - if (m_handleType == QAbstractVideoBuffer::GLTextureHandle) { - m_textureIds[0] = frame.handle().toInt(); - } else if (m_frame.map(QAbstractVideoBuffer::ReadOnly)) { - m_context->makeCurrent(); - - for (int i = 0; i < m_textureCount; ++i) { - glBindTexture(GL_TEXTURE_2D, m_textureIds[i]); - glTexImage2D( - GL_TEXTURE_2D, - 0, - m_textureInternalFormat, - m_textureWidths[i], - m_textureHeights[i], - 0, - m_textureFormat, - m_textureType, - m_frame.bits() + m_textureOffsets[i]); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - } - m_frame.unmap(); - } else if (m_handleType != QAbstractVideoBuffer::QPixmapHandle && m_frame.isValid()) { - return QAbstractVideoSurface::IncorrectFormatError; - } - - return QAbstractVideoSurface::NoError; -} - -QAbstractVideoSurface::Error QVideoSurfaceGLPainter::paint( - const QRectF &target, QPainter *painter, const QRectF &source) -{ - if (!m_frame.isValid()) { - painter->fillRect(target, Qt::black); - return QAbstractVideoSurface::NoError; - } - - if (m_frame.handleType() == QAbstractVideoBuffer::QPixmapHandle) { - painter->drawPixmap(target, m_frame.handle().value<QPixmap>(), source); - } else if (m_frame.isValid()) { - return QAbstractVideoSurface::IncorrectFormatError; - } else { - painter->fillRect(target, Qt::black); - } - return QAbstractVideoSurface::NoError; -} - -void QVideoSurfaceGLPainter::updateColors(int brightness, int contrast, int hue, int saturation) -{ - const qreal b = brightness / 200.0; - const qreal c = contrast / 100.0 + 1.0; - const qreal h = hue / 100.0; - const qreal s = saturation / 100.0 + 1.0; - - const qreal cosH = qCos(M_PI * h); - const qreal sinH = qSin(M_PI * h); - - const qreal h11 = 0.787 * cosH - 0.213 * sinH + 0.213; - const qreal h21 = -0.213 * cosH + 0.143 * sinH + 0.213; - const qreal h31 = -0.213 * cosH - 0.787 * sinH + 0.213; - - const qreal h12 = -0.715 * cosH - 0.715 * sinH + 0.715; - const qreal h22 = 0.285 * cosH + 0.140 * sinH + 0.715; - const qreal h32 = -0.715 * cosH + 0.715 * sinH + 0.715; - - const qreal h13 = -0.072 * cosH + 0.928 * sinH + 0.072; - const qreal h23 = -0.072 * cosH - 0.283 * sinH + 0.072; - const qreal h33 = 0.928 * cosH + 0.072 * sinH + 0.072; - - const qreal sr = (1.0 - s) * 0.3086; - const qreal sg = (1.0 - s) * 0.6094; - const qreal sb = (1.0 - s) * 0.0820; - - const qreal sr_s = sr + s; - const qreal sg_s = sg + s; - const qreal sb_s = sr + s; - - const float m4 = (s + sr + sg + sb) * (0.5 - 0.5 * c + b); - - m_colorMatrix(0, 0) = c * (sr_s * h11 + sg * h21 + sb * h31); - m_colorMatrix(0, 1) = c * (sr_s * h12 + sg * h22 + sb * h32); - m_colorMatrix(0, 2) = c * (sr_s * h13 + sg * h23 + sb * h33); - m_colorMatrix(0, 3) = m4; - - m_colorMatrix(1, 0) = c * (sr * h11 + sg_s * h21 + sb * h31); - m_colorMatrix(1, 1) = c * (sr * h12 + sg_s * h22 + sb * h32); - m_colorMatrix(1, 2) = c * (sr * h13 + sg_s * h23 + sb * h33); - m_colorMatrix(1, 3) = m4; - - m_colorMatrix(2, 0) = c * (sr * h11 + sg * h21 + sb_s * h31); - m_colorMatrix(2, 1) = c * (sr * h12 + sg * h22 + sb_s * h32); - m_colorMatrix(2, 2) = c * (sr * h13 + sg * h23 + sb_s * h33); - m_colorMatrix(2, 3) = m4; - - m_colorMatrix(3, 0) = 0.0; - m_colorMatrix(3, 1) = 0.0; - m_colorMatrix(3, 2) = 0.0; - m_colorMatrix(3, 3) = 1.0; - - if (m_yuv) { - QMatrix4x4 colorSpaceMatrix; - - switch (m_colorSpace) { - case QVideoSurfaceFormat::YCbCr_JPEG: - colorSpaceMatrix = QMatrix4x4( - 1.0, 0.000, 1.402, -0.701, - 1.0, -0.344, -0.714, 0.529, - 1.0, 1.772, 0.000, -0.886, - 0.0, 0.000, 0.000, 1.0000); - break; - case QVideoSurfaceFormat::YCbCr_BT709: - case QVideoSurfaceFormat::YCbCr_xvYCC709: - colorSpaceMatrix = QMatrix4x4( - 1.164, 0.000, 1.793, -0.5727, - 1.164, -0.534, -0.213, 0.3007, - 1.164, 2.115, 0.000, -1.1302, - 0.0, 0.000, 0.000, 1.0000); - break; - default: //BT 601: - colorSpaceMatrix = QMatrix4x4( - 1.164, 0.000, 1.596, -0.8708, - 1.164, -0.392, -0.813, 0.5296, - 1.164, 2.017, 0.000, -1.081, - 0.0, 0.000, 0.000, 1.0000); - } - - m_colorMatrix = m_colorMatrix * colorSpaceMatrix; - } -} - -void QVideoSurfaceGLPainter::initRgbTextureInfo( - GLenum internalFormat, GLuint format, GLenum type, const QSize &size) -{ - m_yuv = false; - m_textureInternalFormat = internalFormat; - m_textureFormat = format; - m_textureType = type; - m_textureCount = 1; - m_textureWidths[0] = size.width(); - m_textureHeights[0] = size.height(); - m_textureOffsets[0] = 0; -} - -void QVideoSurfaceGLPainter::initYuv420PTextureInfo(const QSize &size) -{ - int bytesPerLine = (size.width() + 3) & ~3; - int bytesPerLine2 = (size.width() / 2 + 3) & ~3; - - m_yuv = true; - m_textureInternalFormat = GL_LUMINANCE; - m_textureFormat = GL_LUMINANCE; - m_textureType = GL_UNSIGNED_BYTE; - m_textureCount = 3; - m_textureWidths[0] = bytesPerLine; - m_textureHeights[0] = size.height(); - m_textureOffsets[0] = 0; - m_textureWidths[1] = bytesPerLine2; - m_textureHeights[1] = size.height() / 2; - m_textureOffsets[1] = bytesPerLine * size.height(); - m_textureWidths[2] = bytesPerLine2; - m_textureHeights[2] = size.height() / 2; - m_textureOffsets[2] = bytesPerLine * size.height() + bytesPerLine2 * size.height()/2; -} - -void QVideoSurfaceGLPainter::initYv12TextureInfo(const QSize &size) -{ - int bytesPerLine = (size.width() + 3) & ~3; - int bytesPerLine2 = (size.width() / 2 + 3) & ~3; - - m_yuv = true; - m_textureInternalFormat = GL_LUMINANCE; - m_textureFormat = GL_LUMINANCE; - m_textureType = GL_UNSIGNED_BYTE; - m_textureCount = 3; - m_textureWidths[0] = bytesPerLine; - m_textureHeights[0] = size.height(); - m_textureOffsets[0] = 0; - m_textureWidths[1] = bytesPerLine2; - m_textureHeights[1] = size.height() / 2; - m_textureOffsets[1] = bytesPerLine * size.height() + bytesPerLine2 * size.height()/2; - m_textureWidths[2] = bytesPerLine2; - m_textureHeights[2] = size.height() / 2; - m_textureOffsets[2] = bytesPerLine * size.height(); -} - -#ifndef QT_OPENGL_ES - -# ifndef GL_FRAGMENT_PROGRAM_ARB -# define GL_FRAGMENT_PROGRAM_ARB 0x8804 -# define GL_PROGRAM_FORMAT_ASCII_ARB 0x8875 -# endif - -// Paints an RGB32 frame -static const char *qt_arbfp_xrgbShaderProgram = - "!!ARBfp1.0\n" - "PARAM matrix[4] = { program.local[0..2]," - "{ 0.0, 0.0, 0.0, 1.0 } };\n" - "TEMP xrgb;\n" - "TEX xrgb.xyz, fragment.texcoord[0], texture[0], 2D;\n" - "MOV xrgb.w, matrix[3].w;\n" - "DP4 result.color.x, xrgb.zyxw, matrix[0];\n" - "DP4 result.color.y, xrgb.zyxw, matrix[1];\n" - "DP4 result.color.z, xrgb.zyxw, matrix[2];\n" - "END"; - -// Paints an ARGB frame. -static const char *qt_arbfp_argbShaderProgram = - "!!ARBfp1.0\n" - "PARAM matrix[4] = { program.local[0..2]," - "{ 0.0, 0.0, 0.0, 1.0 } };\n" - "TEMP argb;\n" - "TEX argb, fragment.texcoord[0], texture[0], 2D;\n" - "MOV argb.w, matrix[3].w;\n" - "DP4 result.color.x, argb.zyxw, matrix[0];\n" - "DP4 result.color.y, argb.zyxw, matrix[1];\n" - "DP4 result.color.z, argb.zyxw, matrix[2];\n" - "TEX result.color.w, fragment.texcoord[0], texture, 2D;\n" - "END"; - -// Paints an RGB(A) frame. -static const char *qt_arbfp_rgbShaderProgram = - "!!ARBfp1.0\n" - "PARAM matrix[4] = { program.local[0..2]," - "{ 0.0, 0.0, 0.0, 1.0 } };\n" - "TEMP rgb;\n" - "TEX rgb, fragment.texcoord[0], texture[0], 2D;\n" - "MOV rgb.w, matrix[3].w;\n" - "DP4 result.color.x, rgb, matrix[0];\n" - "DP4 result.color.y, rgb, matrix[1];\n" - "DP4 result.color.z, rgb, matrix[2];\n" - "TEX result.color.w, fragment.texcoord[0], texture, 2D;\n" - "END"; - -// Paints a YUV420P or YV12 frame. -static const char *qt_arbfp_yuvPlanarShaderProgram = - "!!ARBfp1.0\n" - "PARAM matrix[4] = { program.local[0..2]," - "{ 0.0, 0.0, 0.0, 1.0 } };\n" - "TEMP yuv;\n" - "TEX yuv.x, fragment.texcoord[0], texture[0], 2D;\n" - "TEX yuv.y, fragment.texcoord[0], texture[1], 2D;\n" - "TEX yuv.z, fragment.texcoord[0], texture[2], 2D;\n" - "MOV yuv.w, matrix[3].w;\n" - "DP4 result.color.x, yuv, matrix[0];\n" - "DP4 result.color.y, yuv, matrix[1];\n" - "DP4 result.color.z, yuv, matrix[2];\n" - "END"; - -// Paints a YUV444 frame. -static const char *qt_arbfp_xyuvShaderProgram = - "!!ARBfp1.0\n" - "PARAM matrix[4] = { program.local[0..2]," - "{ 0.0, 0.0, 0.0, 1.0 } };\n" - "TEMP ayuv;\n" - "TEX ayuv, fragment.texcoord[0], texture[0], 2D;\n" - "MOV ayuv.x, matrix[3].w;\n" - "DP4 result.color.x, ayuv.yzwx, matrix[0];\n" - "DP4 result.color.y, ayuv.yzwx, matrix[1];\n" - "DP4 result.color.z, ayuv.yzwx, matrix[2];\n" - "END"; - -// Paints a AYUV444 frame. -static const char *qt_arbfp_ayuvShaderProgram = - "!!ARBfp1.0\n" - "PARAM matrix[4] = { program.local[0..2]," - "{ 0.0, 0.0, 0.0, 1.0 } };\n" - "TEMP ayuv;\n" - "TEX ayuv, fragment.texcoord[0], texture[0], 2D;\n" - "MOV ayuv.x, matrix[3].w;\n" - "DP4 result.color.x, ayuv.yzwx, matrix[0];\n" - "DP4 result.color.y, ayuv.yzwx, matrix[1];\n" - "DP4 result.color.z, ayuv.yzwx, matrix[2];\n" - "TEX result.color.w, fragment.texcoord[0], texture, 2D;\n" - "END"; - -class QVideoSurfaceArbFpPainter : public QVideoSurfaceGLPainter -{ -public: - QVideoSurfaceArbFpPainter(QGLContext *context); - - QAbstractVideoSurface::Error start(const QVideoSurfaceFormat &format); - void stop(); - - QAbstractVideoSurface::Error paint( - const QRectF &target, QPainter *painter, const QRectF &source); - -private: - typedef void (APIENTRY *_glProgramStringARB) (GLenum, GLenum, GLsizei, const GLvoid *); - typedef void (APIENTRY *_glBindProgramARB) (GLenum, GLuint); - typedef void (APIENTRY *_glDeleteProgramsARB) (GLsizei, const GLuint *); - typedef void (APIENTRY *_glGenProgramsARB) (GLsizei, GLuint *); - typedef void (APIENTRY *_glProgramLocalParameter4fARB) ( - GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat); - typedef void (APIENTRY *_glActiveTexture) (GLenum); - - _glProgramStringARB glProgramStringARB; - _glBindProgramARB glBindProgramARB; - _glDeleteProgramsARB glDeleteProgramsARB; - _glGenProgramsARB glGenProgramsARB; - _glProgramLocalParameter4fARB glProgramLocalParameter4fARB; - - GLuint m_programId; - QSize m_frameSize; -}; - -QVideoSurfaceArbFpPainter::QVideoSurfaceArbFpPainter(QGLContext *context) - : QVideoSurfaceGLPainter(context) - , m_programId(0) -{ - glProgramStringARB = (_glProgramStringARB) m_context->getProcAddress( - QLatin1String("glProgramStringARB")); - glBindProgramARB = (_glBindProgramARB) m_context->getProcAddress( - QLatin1String("glBindProgramARB")); - glDeleteProgramsARB = (_glDeleteProgramsARB) m_context->getProcAddress( - QLatin1String("glDeleteProgramsARB")); - glGenProgramsARB = (_glGenProgramsARB) m_context->getProcAddress( - QLatin1String("glGenProgramsARB")); - glProgramLocalParameter4fARB = (_glProgramLocalParameter4fARB) m_context->getProcAddress( - QLatin1String("glProgramLocalParameter4fARB")); - - m_imagePixelFormats - << QVideoFrame::Format_RGB32 - << QVideoFrame::Format_BGR32 - << QVideoFrame::Format_ARGB32 - << QVideoFrame::Format_RGB24 - << QVideoFrame::Format_BGR24 - << QVideoFrame::Format_RGB565 - << QVideoFrame::Format_AYUV444 - << QVideoFrame::Format_YUV444 - << QVideoFrame::Format_YV12 - << QVideoFrame::Format_YUV420P; - m_glPixelFormats - << QVideoFrame::Format_RGB32 - << QVideoFrame::Format_ARGB32; -} - -QAbstractVideoSurface::Error QVideoSurfaceArbFpPainter::start(const QVideoSurfaceFormat &format) -{ - Q_ASSERT(m_textureCount == 0); - - QAbstractVideoSurface::Error error = QAbstractVideoSurface::NoError; - - m_context->makeCurrent(); - - const char *program = 0; - - if (format.handleType() == QAbstractVideoBuffer::NoHandle) { - switch (format.pixelFormat()) { - case QVideoFrame::Format_RGB32: - initRgbTextureInfo(GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, format.frameSize()); - program = qt_arbfp_xrgbShaderProgram; - break; - case QVideoFrame::Format_BGR32: - initRgbTextureInfo(GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, format.frameSize()); - program = qt_arbfp_rgbShaderProgram; - break; - case QVideoFrame::Format_ARGB32: - initRgbTextureInfo(GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, format.frameSize()); - program = qt_arbfp_argbShaderProgram; - break; - case QVideoFrame::Format_RGB24: - initRgbTextureInfo(GL_RGB8, GL_RGBA, GL_UNSIGNED_BYTE, format.frameSize()); - program = qt_arbfp_rgbShaderProgram; - break; - case QVideoFrame::Format_BGR24: - initRgbTextureInfo(GL_RGB8, GL_RGBA, GL_UNSIGNED_BYTE, format.frameSize()); - program = qt_arbfp_xrgbShaderProgram; - break; - case QVideoFrame::Format_RGB565: - initRgbTextureInfo(GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, format.frameSize()); - program = qt_arbfp_rgbShaderProgram; - break; - case QVideoFrame::Format_YUV444: - initRgbTextureInfo(GL_RGB, GL_RGB, GL_UNSIGNED_BYTE, format.frameSize()); - program = qt_arbfp_xyuvShaderProgram; - m_yuv = true; - break; - case QVideoFrame::Format_AYUV444: - initRgbTextureInfo(GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, format.frameSize()); - program = qt_arbfp_ayuvShaderProgram; - m_yuv = true; - break; - case QVideoFrame::Format_YV12: - initYv12TextureInfo(format.frameSize()); - program = qt_arbfp_yuvPlanarShaderProgram; - break; - case QVideoFrame::Format_YUV420P: - initYuv420PTextureInfo(format.frameSize()); - program = qt_arbfp_yuvPlanarShaderProgram; - break; - default: - break; - } - } else if (format.handleType() == QAbstractVideoBuffer::GLTextureHandle) { - switch (format.pixelFormat()) { - case QVideoFrame::Format_RGB32: - case QVideoFrame::Format_ARGB32: - m_yuv = false; - m_textureCount = 1; - program = qt_arbfp_rgbShaderProgram; - break; - default: - break; - } - } else if (format.handleType() == QAbstractVideoBuffer::QPixmapHandle) { - m_handleType = QAbstractVideoBuffer::QPixmapHandle; - return QAbstractVideoSurface::NoError; - } - - if (!program) { - error = QAbstractVideoSurface::UnsupportedFormatError; - } else { - glGenProgramsARB(1, &m_programId); - - GLenum glError = glGetError(); - if (glError != GL_NO_ERROR) { - qWarning("QPainterVideoSurface: ARBfb Shader allocation error %x", int(glError)); - m_textureCount = 0; - m_programId = 0; - - error = QAbstractVideoSurface::ResourceError; - } else { - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, m_programId); - glProgramStringARB( - GL_FRAGMENT_PROGRAM_ARB, - GL_PROGRAM_FORMAT_ASCII_ARB, - qstrlen(program), - reinterpret_cast<const GLvoid *>(program)); - - if ((glError = glGetError()) != GL_NO_ERROR) { - const GLubyte* errorString = glGetString(GL_PROGRAM_ERROR_STRING_ARB); - - qWarning("QPainterVideoSurface: ARBfp Shader compile error %x, %s", - int(glError), - reinterpret_cast<const char *>(errorString)); - glDeleteProgramsARB(1, &m_programId); - - m_textureCount = 0; - m_programId = 0; - - error = QAbstractVideoSurface::ResourceError; - } else { - m_handleType = format.handleType(); - m_scanLineDirection = format.scanLineDirection(); - m_frameSize = format.frameSize(); - m_colorSpace = format.yCbCrColorSpace(); - - if (m_handleType == QAbstractVideoBuffer::NoHandle) - glGenTextures(m_textureCount, m_textureIds); - } - } - } - - return error; -} - -void QVideoSurfaceArbFpPainter::stop() -{ - if (m_context) { - m_context->makeCurrent(); - - if (m_handleType != QAbstractVideoBuffer::GLTextureHandle) - glDeleteTextures(m_textureCount, m_textureIds); - glDeleteProgramsARB(1, &m_programId); - } - - m_textureCount = 0; - m_programId = 0; - m_handleType = QAbstractVideoBuffer::NoHandle; -} - -QAbstractVideoSurface::Error QVideoSurfaceArbFpPainter::paint( - const QRectF &target, QPainter *painter, const QRectF &source) -{ - if (!m_frame.isValid()) { - painter->fillRect(target, Qt::black); - return QAbstractVideoSurface::NoError; - } - - const QAbstractVideoBuffer::HandleType h = m_frame.handleType(); - if (h == QAbstractVideoBuffer::NoHandle || h == QAbstractVideoBuffer::GLTextureHandle) { - bool stencilTestEnabled = glIsEnabled(GL_STENCIL_TEST); - bool scissorTestEnabled = glIsEnabled(GL_SCISSOR_TEST); - - painter->beginNativePainting(); - - if (stencilTestEnabled) - glEnable(GL_STENCIL_TEST); - if (scissorTestEnabled) - glEnable(GL_SCISSOR_TEST); - - const float txLeft = source.left() / m_frameSize.width(); - const float txRight = source.right() / m_frameSize.width(); - const float txTop = m_scanLineDirection == QVideoSurfaceFormat::TopToBottom - ? source.top() / m_frameSize.height() - : source.bottom() / m_frameSize.height(); - const float txBottom = m_scanLineDirection == QVideoSurfaceFormat::TopToBottom - ? source.bottom() / m_frameSize.height() - : source.top() / m_frameSize.height(); - - const float tx_array[] = - { - txLeft , txBottom, - txRight, txBottom, - txLeft , txTop, - txRight, txTop - }; - - const GLfloat vTop = m_scanLineDirection == QVideoSurfaceFormat::TopToBottom - ? target.top() - : target.bottom() + 1; - const GLfloat vBottom = m_scanLineDirection == QVideoSurfaceFormat::TopToBottom - ? target.bottom() + 1 - : target.top(); - - const GLfloat v_array[] = - { - GLfloat(target.left()) , GLfloat(vBottom), - GLfloat(target.right() + 1), GLfloat(vBottom), - GLfloat(target.left()) , GLfloat(vTop), - GLfloat(target.right() + 1), GLfloat(vTop) - }; - - glEnable(GL_FRAGMENT_PROGRAM_ARB); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, m_programId); - - glProgramLocalParameter4fARB( - GL_FRAGMENT_PROGRAM_ARB, - 0, - m_colorMatrix(0, 0), - m_colorMatrix(0, 1), - m_colorMatrix(0, 2), - m_colorMatrix(0, 3)); - glProgramLocalParameter4fARB( - GL_FRAGMENT_PROGRAM_ARB, - 1, - m_colorMatrix(1, 0), - m_colorMatrix(1, 1), - m_colorMatrix(1, 2), - m_colorMatrix(1, 3)); - glProgramLocalParameter4fARB( - GL_FRAGMENT_PROGRAM_ARB, - 2, - m_colorMatrix(2, 0), - m_colorMatrix(2, 1), - m_colorMatrix(2, 2), - m_colorMatrix(2, 3)); - - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, m_textureIds[0]); - - if (m_textureCount == 3) { - glActiveTexture(GL_TEXTURE1); - glBindTexture(GL_TEXTURE_2D, m_textureIds[1]); - glActiveTexture(GL_TEXTURE2); - glBindTexture(GL_TEXTURE_2D, m_textureIds[2]); - glActiveTexture(GL_TEXTURE0); - } - - glVertexPointer(2, GL_FLOAT, 0, v_array); - glTexCoordPointer(2, GL_FLOAT, 0, tx_array); - - glEnableClientState(GL_VERTEX_ARRAY); - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - glDisableClientState(GL_VERTEX_ARRAY); - glDisable(GL_FRAGMENT_PROGRAM_ARB); - - painter->endNativePainting(); - - return QAbstractVideoSurface::NoError; - } - - return QVideoSurfaceGLPainter::paint(target, painter, source); -} - -#endif - -static const char *qt_glsl_vertexShaderProgram = - "attribute highp vec4 vertexCoordArray;\n" - "attribute highp vec2 textureCoordArray;\n" - "uniform highp mat4 positionMatrix;\n" - "varying highp vec2 textureCoord;\n" - "void main(void)\n" - "{\n" - " gl_Position = positionMatrix * vertexCoordArray;\n" - " textureCoord = textureCoordArray;\n" - "}\n"; - -// Paints an RGB32 frame -static const char *qt_glsl_xrgbShaderProgram = - "uniform sampler2D texRgb;\n" - "uniform mediump mat4 colorMatrix;\n" - "varying highp vec2 textureCoord;\n" - "void main(void)\n" - "{\n" - " highp vec4 color = vec4(texture2D(texRgb, textureCoord.st).bgr, 1.0);\n" - " gl_FragColor = colorMatrix * color;\n" - "}\n"; - -// Paints an ARGB frame. -static const char *qt_glsl_argbShaderProgram = - "uniform sampler2D texRgb;\n" - "uniform mediump mat4 colorMatrix;\n" - "varying highp vec2 textureCoord;\n" - "void main(void)\n" - "{\n" - " highp vec4 color = vec4(texture2D(texRgb, textureCoord.st).bgr, 1.0);\n" - " color = colorMatrix * color;\n" - " gl_FragColor = vec4(color.rgb, texture2D(texRgb, textureCoord.st).a);\n" - "}\n"; - -// Paints an RGB(A) frame. -static const char *qt_glsl_rgbShaderProgram = - "uniform sampler2D texRgb;\n" - "uniform mediump mat4 colorMatrix;\n" - "varying highp vec2 textureCoord;\n" - "void main(void)\n" - "{\n" - " highp vec4 color = vec4(texture2D(texRgb, textureCoord.st).rgb, 1.0);\n" - " color = colorMatrix * color;\n" - " gl_FragColor = vec4(color.rgb, texture2D(texRgb, textureCoord.st).a);\n" - "}\n"; - -// Paints a YUV420P or YV12 frame. -static const char *qt_glsl_yuvPlanarShaderProgram = - "uniform sampler2D texY;\n" - "uniform sampler2D texU;\n" - "uniform sampler2D texV;\n" - "uniform mediump mat4 colorMatrix;\n" - "varying highp vec2 textureCoord;\n" - "void main(void)\n" - "{\n" - " highp vec4 color = vec4(\n" - " texture2D(texY, textureCoord.st).r,\n" - " texture2D(texU, textureCoord.st).r,\n" - " texture2D(texV, textureCoord.st).r,\n" - " 1.0);\n" - " gl_FragColor = colorMatrix * color;\n" - "}\n"; - -// Paints a YUV444 frame. -static const char *qt_glsl_xyuvShaderProgram = - "uniform sampler2D texRgb;\n" - "uniform mediump mat4 colorMatrix;\n" - "varying highp vec2 textureCoord;\n" - "void main(void)\n" - "{\n" - " highp vec4 color = vec4(texture2D(texRgb, textureCoord.st).gba, 1.0);\n" - " gl_FragColor = colorMatrix * color;\n" - "}\n"; - -// Paints a AYUV444 frame. -static const char *qt_glsl_ayuvShaderProgram = - "uniform sampler2D texRgb;\n" - "uniform mediump mat4 colorMatrix;\n" - "varying highp vec2 textureCoord;\n" - "void main(void)\n" - "{\n" - " highp vec4 color = vec4(texture2D(texRgb, textureCoord.st).gba, 1.0);\n" - " color = colorMatrix * color;\n" - " gl_FragColor = vec4(color.rgb, texture2D(texRgb, textureCoord.st).r);\n" - "}\n"; - -class QVideoSurfaceGlslPainter : public QVideoSurfaceGLPainter -{ -public: - QVideoSurfaceGlslPainter(QGLContext *context); - - QAbstractVideoSurface::Error start(const QVideoSurfaceFormat &format); - void stop(); - - QAbstractVideoSurface::Error paint( - const QRectF &target, QPainter *painter, const QRectF &source); - -private: - QGLShaderProgram m_program; - QSize m_frameSize; -}; - -QVideoSurfaceGlslPainter::QVideoSurfaceGlslPainter(QGLContext *context) - : QVideoSurfaceGLPainter(context) - , m_program(context) -{ - m_imagePixelFormats - << QVideoFrame::Format_RGB32 - << QVideoFrame::Format_BGR32 - << QVideoFrame::Format_ARGB32 -#ifndef QT_OPENGL_ES - << QVideoFrame::Format_RGB24 - << QVideoFrame::Format_BGR24 -#endif - << QVideoFrame::Format_RGB565 - << QVideoFrame::Format_YUV444 - << QVideoFrame::Format_AYUV444 - << QVideoFrame::Format_YV12 - << QVideoFrame::Format_YUV420P; - m_glPixelFormats - << QVideoFrame::Format_RGB32 - << QVideoFrame::Format_ARGB32; -} - -QAbstractVideoSurface::Error QVideoSurfaceGlslPainter::start(const QVideoSurfaceFormat &format) -{ - Q_ASSERT(m_textureCount == 0); - - QAbstractVideoSurface::Error error = QAbstractVideoSurface::NoError; - - m_context->makeCurrent(); - - const char *fragmentProgram = 0; - - if (format.handleType() == QAbstractVideoBuffer::NoHandle) { - switch (format.pixelFormat()) { - case QVideoFrame::Format_RGB32: - initRgbTextureInfo(GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, format.frameSize()); - fragmentProgram = qt_glsl_xrgbShaderProgram; - break; - case QVideoFrame::Format_BGR32: - initRgbTextureInfo(GL_RGB, GL_RGBA, GL_UNSIGNED_BYTE, format.frameSize()); - fragmentProgram = qt_glsl_rgbShaderProgram; - break; - case QVideoFrame::Format_ARGB32: - initRgbTextureInfo(GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, format.frameSize()); - fragmentProgram = qt_glsl_argbShaderProgram; - break; -#ifndef QT_OPENGL_ES - case QVideoFrame::Format_RGB24: - initRgbTextureInfo(GL_RGB8, GL_RGB, GL_UNSIGNED_BYTE, format.frameSize()); - fragmentProgram = qt_glsl_rgbShaderProgram; - break; - case QVideoFrame::Format_BGR24: - initRgbTextureInfo(GL_RGB8, GL_RGB, GL_UNSIGNED_BYTE, format.frameSize()); - fragmentProgram = qt_glsl_argbShaderProgram; - break; -#endif - case QVideoFrame::Format_RGB565: - initRgbTextureInfo(GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, format.frameSize()); - fragmentProgram = qt_glsl_rgbShaderProgram; - break; - case QVideoFrame::Format_YUV444: - initRgbTextureInfo(GL_RGB, GL_RGB, GL_UNSIGNED_BYTE, format.frameSize()); - fragmentProgram = qt_glsl_xyuvShaderProgram; - m_yuv = true; - break; - case QVideoFrame::Format_AYUV444: - initRgbTextureInfo(GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, format.frameSize()); - fragmentProgram = qt_glsl_ayuvShaderProgram; - m_yuv = true; - break; - case QVideoFrame::Format_YV12: - initYv12TextureInfo(format.frameSize()); - fragmentProgram = qt_glsl_yuvPlanarShaderProgram; - break; - case QVideoFrame::Format_YUV420P: - initYuv420PTextureInfo(format.frameSize()); - fragmentProgram = qt_glsl_yuvPlanarShaderProgram; - break; - default: - break; - } - } else if (format.handleType() == QAbstractVideoBuffer::GLTextureHandle) { - switch (format.pixelFormat()) { - case QVideoFrame::Format_RGB32: - case QVideoFrame::Format_ARGB32: - m_yuv = false; - m_textureCount = 1; - fragmentProgram = qt_glsl_rgbShaderProgram; - break; - default: - break; - } - } else if (format.handleType() == QAbstractVideoBuffer::QPixmapHandle) { - m_handleType = QAbstractVideoBuffer::QPixmapHandle; - return QAbstractVideoSurface::NoError; - } - - if (!fragmentProgram) { - error = QAbstractVideoSurface::UnsupportedFormatError; - } else if (!m_program.addShaderFromSourceCode(QGLShader::Vertex, qt_glsl_vertexShaderProgram)) { - qWarning("QPainterVideoSurface: Vertex shader compile error %s", - qPrintable(m_program.log())); - error = QAbstractVideoSurface::ResourceError; - } else if (!m_program.addShaderFromSourceCode(QGLShader::Fragment, fragmentProgram)) { - qWarning("QPainterVideoSurface: Shader compile error %s", qPrintable(m_program.log())); - error = QAbstractVideoSurface::ResourceError; - m_program.removeAllShaders(); - } else if(!m_program.link()) { - qWarning("QPainterVideoSurface: Shader link error %s", qPrintable(m_program.log())); - m_program.removeAllShaders(); - error = QAbstractVideoSurface::ResourceError; - } else { - m_handleType = format.handleType(); - m_scanLineDirection = format.scanLineDirection(); - m_frameSize = format.frameSize(); - m_colorSpace = format.yCbCrColorSpace(); - - if (m_handleType == QAbstractVideoBuffer::NoHandle) - glGenTextures(m_textureCount, m_textureIds); - } - - return error; -} - -void QVideoSurfaceGlslPainter::stop() -{ - if (m_context) { - m_context->makeCurrent(); - - if (m_handleType != QAbstractVideoBuffer::GLTextureHandle) - glDeleteTextures(m_textureCount, m_textureIds); - } - - m_program.removeAllShaders(); - - m_textureCount = 0; - m_handleType = QAbstractVideoBuffer::NoHandle; -} - -QAbstractVideoSurface::Error QVideoSurfaceGlslPainter::paint( - const QRectF &target, QPainter *painter, const QRectF &source) -{ - if (!m_frame.isValid()) { - painter->fillRect(target, Qt::black); - return QAbstractVideoSurface::NoError; - } - - const QAbstractVideoBuffer::HandleType h = m_frame.handleType(); - if (h == QAbstractVideoBuffer::NoHandle || h == QAbstractVideoBuffer::GLTextureHandle) { - bool stencilTestEnabled = glIsEnabled(GL_STENCIL_TEST); - bool scissorTestEnabled = glIsEnabled(GL_SCISSOR_TEST); - - painter->beginNativePainting(); - - if (stencilTestEnabled) - glEnable(GL_STENCIL_TEST); - if (scissorTestEnabled) - glEnable(GL_SCISSOR_TEST); - - const int width = QGLContext::currentContext()->device()->width(); - const int height = QGLContext::currentContext()->device()->height(); - - const QTransform transform = painter->deviceTransform(); - - const GLfloat wfactor = 2.0 / width; - const GLfloat hfactor = -2.0 / height; - - const GLfloat positionMatrix[4][4] = - { - { - /*(0,0)*/ GLfloat(wfactor * transform.m11() - transform.m13()), - /*(0,1)*/ GLfloat(hfactor * transform.m12() + transform.m13()), - /*(0,2)*/ 0.0, - /*(0,3)*/ GLfloat(transform.m13()) - }, { - /*(1,0)*/ GLfloat(wfactor * transform.m21() - transform.m23()), - /*(1,1)*/ GLfloat(hfactor * transform.m22() + transform.m23()), - /*(1,2)*/ 0.0, - /*(1,3)*/ GLfloat(transform.m23()) - }, { - /*(2,0)*/ 0.0, - /*(2,1)*/ 0.0, - /*(2,2)*/ -1.0, - /*(2,3)*/ 0.0 - }, { - /*(3,0)*/ GLfloat(wfactor * transform.dx() - transform.m33()), - /*(3,1)*/ GLfloat(hfactor * transform.dy() + transform.m33()), - /*(3,2)*/ 0.0, - /*(3,3)*/ GLfloat(transform.m33()) - } - }; - - const GLfloat vTop = m_scanLineDirection == QVideoSurfaceFormat::TopToBottom - ? target.top() - : target.bottom() + 1; - const GLfloat vBottom = m_scanLineDirection == QVideoSurfaceFormat::TopToBottom - ? target.bottom() + 1 - : target.top(); - - - const GLfloat vertexCoordArray[] = - { - GLfloat(target.left()) , GLfloat(vBottom), - GLfloat(target.right() + 1), GLfloat(vBottom), - GLfloat(target.left()) , GLfloat(vTop), - GLfloat(target.right() + 1), GLfloat(vTop) - }; - - const GLfloat txLeft = source.left() / m_frameSize.width(); - const GLfloat txRight = source.right() / m_frameSize.width(); - const GLfloat txTop = m_scanLineDirection == QVideoSurfaceFormat::TopToBottom - ? source.top() / m_frameSize.height() - : source.bottom() / m_frameSize.height(); - const GLfloat txBottom = m_scanLineDirection == QVideoSurfaceFormat::TopToBottom - ? source.bottom() / m_frameSize.height() - : source.top() / m_frameSize.height(); - - const GLfloat textureCoordArray[] = - { - txLeft , txBottom, - txRight, txBottom, - txLeft , txTop, - txRight, txTop - }; - - m_program.bind(); - - m_program.enableAttributeArray("vertexCoordArray"); - m_program.enableAttributeArray("textureCoordArray"); - m_program.setAttributeArray("vertexCoordArray", vertexCoordArray, 2); - m_program.setAttributeArray("textureCoordArray", textureCoordArray, 2); - m_program.setUniformValue("positionMatrix", positionMatrix); - - if (m_textureCount == 3) { - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, m_textureIds[0]); - glActiveTexture(GL_TEXTURE1); - glBindTexture(GL_TEXTURE_2D, m_textureIds[1]); - glActiveTexture(GL_TEXTURE2); - glBindTexture(GL_TEXTURE_2D, m_textureIds[2]); - glActiveTexture(GL_TEXTURE0); - - m_program.setUniformValue("texY", 0); - m_program.setUniformValue("texU", 1); - m_program.setUniformValue("texV", 2); - } else { - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, m_textureIds[0]); - - m_program.setUniformValue("texRgb", 0); - } - m_program.setUniformValue("colorMatrix", m_colorMatrix); - - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - - m_program.release(); - - painter->endNativePainting(); - - return QAbstractVideoSurface::NoError; - } - - return QVideoSurfaceGLPainter::paint(target, painter, source); -} - -#endif - -/*! - \class QPainterVideoSurface - \since 1.0 - \internal -*/ - -/*! -*/ -QPainterVideoSurface::QPainterVideoSurface(QObject *parent) - : QAbstractVideoSurface(parent) - , m_painter(0) -#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_1_CL) && !defined(QT_OPENGL_ES_1) - , m_glContext(0) - , m_shaderTypes(NoShaders) - , m_shaderType(NoShaders) -#endif - , m_brightness(0) - , m_contrast(0) - , m_hue(0) - , m_saturation(0) - , m_pixelFormat(QVideoFrame::Format_Invalid) - , m_colorsDirty(true) - , m_ready(false) -{ -} - -/*! -*/ -QPainterVideoSurface::~QPainterVideoSurface() -{ - if (isActive()) - m_painter->stop(); - - delete m_painter; -} - -/*! - \since 1.0 -*/ -QList<QVideoFrame::PixelFormat> QPainterVideoSurface::supportedPixelFormats( - QAbstractVideoBuffer::HandleType handleType) const -{ - if (!m_painter) - const_cast<QPainterVideoSurface *>(this)->createPainter(); - - return m_painter->supportedPixelFormats(handleType); -} - -/*! - \since 1.0 -*/ -bool QPainterVideoSurface::isFormatSupported( - const QVideoSurfaceFormat &format, QVideoSurfaceFormat *similar) const -{ - if (!m_painter) - const_cast<QPainterVideoSurface *>(this)->createPainter(); - - return m_painter->isFormatSupported(format, similar); -} - -/*! - \since 1.0 -*/ -bool QPainterVideoSurface::start(const QVideoSurfaceFormat &format) -{ - if (isActive()) - m_painter->stop(); - - if (!m_painter) - createPainter(); - - if (format.frameSize().isEmpty()) { - setError(UnsupportedFormatError); - } else { - QAbstractVideoSurface::Error error = m_painter->start(format); - - if (error != QAbstractVideoSurface::NoError) { - setError(error); - } else { - m_pixelFormat = format.pixelFormat(); - m_frameSize = format.frameSize(); - m_sourceRect = format.viewport(); - m_colorsDirty = true; - m_ready = true; - - return QAbstractVideoSurface::start(format); - } - } - - QAbstractVideoSurface::stop(); - - return false; -} - -/*! - \since 1.0 -*/ -void QPainterVideoSurface::stop() -{ - if (isActive()) { - m_painter->stop(); - m_ready = false; - - QAbstractVideoSurface::stop(); - } -} - -/*! - \since 1.0 -*/ -bool QPainterVideoSurface::present(const QVideoFrame &frame) -{ - if (!m_ready) { - if (!isActive()) - setError(StoppedError); - } else if (frame.isValid() - && (frame.pixelFormat() != m_pixelFormat || frame.size() != m_frameSize)) { - setError(IncorrectFormatError); - - stop(); - } else { - QAbstractVideoSurface::Error error = m_painter->setCurrentFrame(frame); - - if (error != QAbstractVideoSurface::NoError) { - setError(error); - - stop(); - } else { - m_ready = false; - - emit frameChanged(); - - return true; - } - } - return false; -} - -/*! - \since 1.0 -*/ -int QPainterVideoSurface::brightness() const -{ - return m_brightness; -} - -/*! - \since 1.0 -*/ -void QPainterVideoSurface::setBrightness(int brightness) -{ - m_brightness = brightness; - - m_colorsDirty = true; -} - -/*! - \since 1.0 -*/ -int QPainterVideoSurface::contrast() const -{ - return m_contrast; -} - -/*! - \since 1.0 -*/ -void QPainterVideoSurface::setContrast(int contrast) -{ - m_contrast = contrast; - - m_colorsDirty = true; -} - -/*! - \since 1.0 -*/ -int QPainterVideoSurface::hue() const -{ - return m_hue; -} - -/*! - \since 1.0 -*/ -void QPainterVideoSurface::setHue(int hue) -{ - m_hue = hue; - - m_colorsDirty = true; -} - -/*! - \since 1.0 -*/ -int QPainterVideoSurface::saturation() const -{ - return m_saturation; -} - -/*! - \since 1.0 -*/ -void QPainterVideoSurface::setSaturation(int saturation) -{ - m_saturation = saturation; - - m_colorsDirty = true; -} - -/*! - \since 1.0 -*/ -bool QPainterVideoSurface::isReady() const -{ - return m_ready; -} - -/*! - \since 1.0 -*/ -void QPainterVideoSurface::setReady(bool ready) -{ - m_ready = ready; -} - -/*! - \since 1.0 -*/ -void QPainterVideoSurface::paint(QPainter *painter, const QRectF &target, const QRectF &source) -{ - if (!isActive()) { - painter->fillRect(target, QBrush(Qt::black)); - } else { - if (m_colorsDirty) { - m_painter->updateColors(m_brightness, m_contrast, m_hue, m_saturation); - m_colorsDirty = false; - } - - const QRectF sourceRect( - m_sourceRect.x() + m_sourceRect.width() * source.x(), - m_sourceRect.y() + m_sourceRect.height() * source.y(), - m_sourceRect.width() * source.width(), - m_sourceRect.height() * source.height()); - - QAbstractVideoSurface::Error error = m_painter->paint(target, painter, sourceRect); - - if (error != QAbstractVideoSurface::NoError) { - setError(error); - - stop(); - } - } -} - -/*! - \fn QPainterVideoSurface::frameChanged() - \since 1.0 -*/ - -#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_1_CL) && !defined(QT_OPENGL_ES_1) - -/*! -*/ -const QGLContext *QPainterVideoSurface::glContext() const -{ - return m_glContext; -} - -/*! -*/ -void QPainterVideoSurface::setGLContext(QGLContext *context) -{ - if (m_glContext == context) - return; - - m_glContext = context; - - m_shaderTypes = NoShaders; - - if (m_glContext) { - m_glContext->makeCurrent(); - - const QByteArray extensions(reinterpret_cast<const char *>(glGetString(GL_EXTENSIONS))); -#ifndef QT_OPENGL_ES - - if (extensions.contains("ARB_fragment_program")) - m_shaderTypes |= FragmentProgramShader; -#endif - if (QGLShaderProgram::hasOpenGLShaderPrograms(m_glContext) -#ifndef QT_OPENGL_ES_2 - && extensions.contains("ARB_shader_objects") -#endif - ) - m_shaderTypes |= GlslShader; - } - - ShaderType type = (m_shaderType & m_shaderTypes) - ? m_shaderType - : NoShaders; - - if (type != m_shaderType || type != NoShaders) { - m_shaderType = type; - - if (isActive()) { - m_painter->stop(); - delete m_painter; - m_painter = 0; - m_ready = false; - - setError(ResourceError); - QAbstractVideoSurface::stop(); - } - emit supportedFormatsChanged(); - } -} - -/*! - \enum QPainterVideoSurface::ShaderType - - \value NoShaders - \value FragmentProgramShader - \value HlslShader -*/ - -/*! - \typedef QPainterVideoSurface::ShaderTypes -*/ - -/*! - \since 1.0 -*/ -QPainterVideoSurface::ShaderTypes QPainterVideoSurface::supportedShaderTypes() const -{ - return m_shaderTypes; -} - -/*! - \since 1.0 -*/ -QPainterVideoSurface::ShaderType QPainterVideoSurface::shaderType() const -{ - return m_shaderType; -} - -/*! - \since 1.0 -*/ -void QPainterVideoSurface::setShaderType(ShaderType type) -{ - if (!(type & m_shaderTypes)) - type = NoShaders; - - if (type != m_shaderType) { - m_shaderType = type; - - if (isActive()) { - m_painter->stop(); - delete m_painter; - m_painter = 0; - m_ready = false; - - setError(ResourceError); - QAbstractVideoSurface::stop(); - } else { - delete m_painter; - m_painter = 0; - } - emit supportedFormatsChanged(); - } -} - -#endif - -void QPainterVideoSurface::viewportDestroyed() -{ - if (m_painter) { - m_painter->viewportDestroyed(); - - setError(ResourceError); - stop(); - delete m_painter; - m_painter = 0; - } -} - -void QPainterVideoSurface::createPainter() -{ - Q_ASSERT(!m_painter); - -#ifdef Q_WS_MAC - if (m_glContext) - m_glContext->makeCurrent(); - - m_painter = new QVideoSurfaceCoreGraphicsPainter(m_glContext != 0); - return; -#endif - -#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_1_CL) && !defined(QT_OPENGL_ES_1) - switch (m_shaderType) { -#ifndef QT_OPENGL_ES - case FragmentProgramShader: - Q_ASSERT(m_glContext); - m_glContext->makeCurrent(); - m_painter = new QVideoSurfaceArbFpPainter(m_glContext); - break; -#endif - case GlslShader: - Q_ASSERT(m_glContext); - m_glContext->makeCurrent(); - m_painter = new QVideoSurfaceGlslPainter(m_glContext); - break; - default: - m_painter = new QVideoSurfaceGenericPainter; - break; - } -#else - m_painter = new QVideoSurfaceGenericPainter; -#endif -} - -#include "moc_qpaintervideosurface_p.cpp" -QT_END_NAMESPACE - - diff --git a/src/multimediakit/qpaintervideosurface_mac.mm b/src/multimediakit/qpaintervideosurface_mac.mm deleted file mode 100644 index 02eabfe7d..000000000 --- a/src/multimediakit/qpaintervideosurface_mac.mm +++ /dev/null @@ -1,285 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <AppKit/AppKit.h> -#include <QuartzCore/CIContext.h> -#include <CGLCurrent.h> -#include <OpenGL/gl.h> - -#include "qpaintervideosurface_mac_p.h" - -#include <QtCore/qdatetime.h> - -#include <qmath.h> - -#include <qpainter.h> -#include <qvariant.h> -#include <qvideosurfaceformat.h> - -#include <QtDebug> - -QT_BEGIN_NAMESPACE - -extern CGContextRef qt_mac_cg_context(const QPaintDevice *pdev); //qpaintdevice_mac.cpp - -QVideoSurfaceCoreGraphicsPainter::QVideoSurfaceCoreGraphicsPainter(bool glSupported) - : ciContext(0) - , m_imageFormat(QImage::Format_Invalid) - , m_scanLineDirection(QVideoSurfaceFormat::TopToBottom) -{ - //qDebug() << "QVideoSurfaceCoreGraphicsPainter, GL supported:" << glSupported; - ciContext = 0; - m_imagePixelFormats - << QVideoFrame::Format_RGB32 - << QVideoFrame::Format_ARGB32 - << QVideoFrame::Format_ARGB32_Premultiplied - << QVideoFrame::Format_RGB24 - << QVideoFrame::Format_RGB565 - << QVideoFrame::Format_RGB555 - << QVideoFrame::Format_ARGB8565_Premultiplied; - - m_supportedHandles - << QAbstractVideoBuffer::NoHandle - << QAbstractVideoBuffer::CoreImageHandle; - - if (glSupported) - m_supportedHandles << QAbstractVideoBuffer::GLTextureHandle; -} - -QVideoSurfaceCoreGraphicsPainter::~QVideoSurfaceCoreGraphicsPainter() -{ - [(CIContext*)ciContext release]; -} - -QList<QVideoFrame::PixelFormat> QVideoSurfaceCoreGraphicsPainter::supportedPixelFormats( - QAbstractVideoBuffer::HandleType handleType) const -{ - return m_supportedHandles.contains(handleType) - ? m_imagePixelFormats - : QList<QVideoFrame::PixelFormat>(); -} - -bool QVideoSurfaceCoreGraphicsPainter::isFormatSupported( - const QVideoSurfaceFormat &format, QVideoSurfaceFormat *) const -{ - return m_supportedHandles.contains(format.handleType()) - && m_imagePixelFormats.contains(format.pixelFormat()) - && !format.frameSize().isEmpty(); -} - -QAbstractVideoSurface::Error QVideoSurfaceCoreGraphicsPainter::start(const QVideoSurfaceFormat &format) -{ - m_frame = QVideoFrame(); - m_imageFormat = QVideoFrame::imageFormatFromPixelFormat(format.pixelFormat()); - m_imageSize = format.frameSize(); - m_scanLineDirection = format.scanLineDirection(); - - return m_supportedHandles.contains(format.handleType()) - && m_imageFormat != QImage::Format_Invalid - && !m_imageSize.isEmpty() - ? QAbstractVideoSurface::NoError - : QAbstractVideoSurface::UnsupportedFormatError; -} - -void QVideoSurfaceCoreGraphicsPainter::stop() -{ - m_frame = QVideoFrame(); -} - -QAbstractVideoSurface::Error QVideoSurfaceCoreGraphicsPainter::setCurrentFrame(const QVideoFrame &frame) -{ - m_frame = frame; - - return QAbstractVideoSurface::NoError; -} - -QAbstractVideoSurface::Error QVideoSurfaceCoreGraphicsPainter::paint( - const QRectF &target, QPainter *painter, const QRectF &source) -{ - if (m_frame.handleType() == QAbstractVideoBuffer::CoreImageHandle) { - if (painter->paintEngine()->type() == QPaintEngine::CoreGraphics ) { - - CIImage *img = (CIImage*)(m_frame.handle().value<void*>()); - - if (img) { - CGContextRef cgContext = qt_mac_cg_context(painter->device()); - - if (cgContext) { - painter->beginNativePainting(); - - CGRect sRect = CGRectMake(source.x(), source.y(), source.width(), source.height()); - CGRect dRect = CGRectMake(target.x(), target.y(), target.width(), target.height()); - - NSBitmapImageRep *bitmap = [[NSBitmapImageRep alloc] initWithCIImage:img]; - - if (m_scanLineDirection == QVideoSurfaceFormat::TopToBottom) { - CGContextSaveGState( cgContext ); - CGContextTranslateCTM(cgContext, 0, dRect.origin.y + CGRectGetMaxY(dRect)); - CGContextScaleCTM(cgContext, 1, -1); - - CGContextDrawImage(cgContext, dRect, [bitmap CGImage]); - - CGContextRestoreGState(cgContext); - } else { - CGContextDrawImage(cgContext, dRect, [bitmap CGImage]); - } - - [bitmap release]; - - painter->endNativePainting(); - - return QAbstractVideoSurface::NoError; - } - } - } else if (painter->paintEngine()->type() == QPaintEngine::OpenGL2 || - painter->paintEngine()->type() == QPaintEngine::OpenGL) { - CIImage *img = (CIImage*)(m_frame.handle().value<void*>()); - - if (img) { - CGLContextObj cglContext = CGLGetCurrentContext(); - - if (cglContext) { - - if (!ciContext) { - CGLContextObj cglContext = CGLGetCurrentContext(); - NSOpenGLPixelFormat *nsglPixelFormat = [NSOpenGLView defaultPixelFormat]; - CGLPixelFormatObj cglPixelFormat = static_cast<CGLPixelFormatObj>([nsglPixelFormat CGLPixelFormatObj]); - - ciContext = [CIContext contextWithCGLContext:cglContext - pixelFormat:cglPixelFormat - options:nil]; - - [(CIContext*)ciContext retain]; - } - - CGRect sRect = CGRectMake(source.x(), source.y(), source.width(), source.height()); - CGRect dRect = m_scanLineDirection == QVideoSurfaceFormat::TopToBottom ? - CGRectMake(target.x(), target.y()+target.height(), target.width(), -target.height()) : - CGRectMake(target.x(), target.y(), target.width(), target.height()); - - - painter->beginNativePainting(); - - [(CIContext*)ciContext drawImage:img inRect:dRect fromRect:sRect]; - - painter->endNativePainting(); - - return QAbstractVideoSurface::NoError; - } - } - } - } - - if (m_frame.handleType() == QAbstractVideoBuffer::GLTextureHandle && - (painter->paintEngine()->type() == QPaintEngine::OpenGL2 || - painter->paintEngine()->type() == QPaintEngine::OpenGL)) { - - painter->beginNativePainting(); - GLuint texture = m_frame.handle().toUInt(); - - glDisable(GL_CULL_FACE); - glEnable(GL_TEXTURE_2D); - - glBindTexture(GL_TEXTURE_2D, texture); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - - const float txLeft = source.left() / m_frame.width(); - const float txRight = source.right() / m_frame.width(); - const float txTop = m_scanLineDirection == QVideoSurfaceFormat::TopToBottom - ? source.top() / m_frame.height() - : source.bottom() / m_frame.height(); - const float txBottom = m_scanLineDirection == QVideoSurfaceFormat::TopToBottom - ? source.bottom() / m_frame.height() - : source.top() / m_frame.height(); - - glBegin(GL_QUADS); - QRectF rect = target; - glTexCoord2f(txLeft, txBottom); - glVertex2f(rect.topLeft().x(), rect.topLeft().y()); - glTexCoord2f(txRight, txBottom); - glVertex2f(rect.topRight().x() + 1, rect.topRight().y()); - glTexCoord2f(txRight, txTop); - glVertex2f(rect.bottomRight().x() + 1, rect.bottomRight().y() + 1); - glTexCoord2f(txLeft, txTop); - glVertex2f(rect.bottomLeft().x(), rect.bottomLeft().y() + 1); - glEnd(); - painter->endNativePainting(); - - return QAbstractVideoSurface::NoError; - } - - //fallback case, software rendering - if (m_frame.map(QAbstractVideoBuffer::ReadOnly)) { - QImage image( - m_frame.bits(), - m_imageSize.width(), - m_imageSize.height(), - m_frame.bytesPerLine(), - m_imageFormat); - - if (m_scanLineDirection == QVideoSurfaceFormat::BottomToTop) { - const QTransform oldTransform = painter->transform(); - - painter->scale(1, -1); - painter->translate(0, -target.bottom()); - painter->drawImage( - QRectF(target.x(), 0, target.width(), target.height()), image, source); - painter->setTransform(oldTransform); - } else { - painter->drawImage(target, image, source); - } - - m_frame.unmap(); - } else if (m_frame.isValid()) { - return QAbstractVideoSurface::IncorrectFormatError; - } else { - painter->fillRect(target, Qt::black); - } - - return QAbstractVideoSurface::NoError; -} - -void QVideoSurfaceCoreGraphicsPainter::updateColors(int, int, int, int) -{ -} - -QT_END_NAMESPACE diff --git a/src/multimediakit/qpaintervideosurface_mac_p.h b/src/multimediakit/qpaintervideosurface_mac_p.h deleted file mode 100644 index 667d4b5e3..000000000 --- a/src/multimediakit/qpaintervideosurface_mac_p.h +++ /dev/null @@ -1,100 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPAINTERVIDEOSURFACE_MAC_P_H -#define QPAINTERVIDEOSURFACE_MAC_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qpaintervideosurface_p.h" -#include <qvideosurfaceformat.h> -#include <qvideoframe.h> - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QVideoSurfaceCoreGraphicsPainter : public QVideoSurfacePainter -{ -public: - QVideoSurfaceCoreGraphicsPainter(bool glSupported); - ~QVideoSurfaceCoreGraphicsPainter(); - - QList<QVideoFrame::PixelFormat> supportedPixelFormats( - QAbstractVideoBuffer::HandleType handleType) const; - - bool isFormatSupported( - const QVideoSurfaceFormat &format, QVideoSurfaceFormat *similar) const; - - QAbstractVideoSurface::Error start(const QVideoSurfaceFormat &format); - void stop(); - - QAbstractVideoSurface::Error setCurrentFrame(const QVideoFrame &frame); - - QAbstractVideoSurface::Error paint( - const QRectF &target, QPainter *painter, const QRectF &source); - - void updateColors(int brightness, int contrast, int hue, int saturation); - -private: - void* ciContext; - QList<QVideoFrame::PixelFormat> m_imagePixelFormats; - QVideoFrame m_frame; - QSize m_imageSize; - QImage::Format m_imageFormat; - QVector<QAbstractVideoBuffer::HandleType> m_supportedHandles; - QVideoSurfaceFormat::Direction m_scanLineDirection; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif diff --git a/src/multimediakit/qpaintervideosurface_p.h b/src/multimediakit/qpaintervideosurface_p.h deleted file mode 100644 index 19361ed5f..000000000 --- a/src/multimediakit/qpaintervideosurface_p.h +++ /dev/null @@ -1,183 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPAINTERVIDEOSURFACE_P_H -#define QPAINTERVIDEOSURFACE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <qtmultimediakitdefs.h> -#include <QtCore/qsize.h> -#include <QtGui/qimage.h> -#include <QtGui/qmatrix4x4.h> -#include <QtGui/qpaintengine.h> -#include <qabstractvideosurface.h> -#include <qvideoframe.h> - -QT_BEGIN_NAMESPACE -class QGLContext; -QT_END_NAMESPACE - -QT_USE_NAMESPACE - -QT_BEGIN_NAMESPACE - -class QVideoSurfacePainter -{ -public: - virtual ~QVideoSurfacePainter(); - - virtual QList<QVideoFrame::PixelFormat> supportedPixelFormats( - QAbstractVideoBuffer::HandleType handleType) const = 0; - - virtual bool isFormatSupported( - const QVideoSurfaceFormat &format, QVideoSurfaceFormat *similar) const = 0; - - virtual QAbstractVideoSurface::Error start(const QVideoSurfaceFormat &format) = 0; - virtual void stop() = 0; - - virtual QAbstractVideoSurface::Error setCurrentFrame(const QVideoFrame &frame) = 0; - - virtual QAbstractVideoSurface::Error paint( - const QRectF &target, QPainter *painter, const QRectF &source) = 0; - - virtual void updateColors(int brightness, int contrast, int hue, int saturation) = 0; - virtual void viewportDestroyed() {} -}; - - -class Q_AUTOTEST_EXPORT QPainterVideoSurface : public QAbstractVideoSurface -{ - Q_OBJECT -public: - explicit QPainterVideoSurface(QObject *parent = 0); - ~QPainterVideoSurface(); - - QList<QVideoFrame::PixelFormat> supportedPixelFormats( - QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle) const; - - bool isFormatSupported( - const QVideoSurfaceFormat &format, QVideoSurfaceFormat *similar = 0) const; - - bool start(const QVideoSurfaceFormat &format); - void stop(); - - bool present(const QVideoFrame &frame); - - int brightness() const; - void setBrightness(int brightness); - - int contrast() const; - void setContrast(int contrast); - - int hue() const; - void setHue(int hue); - - int saturation() const; - void setSaturation(int saturation); - - bool isReady() const; - void setReady(bool ready); - - void paint(QPainter *painter, const QRectF &target, const QRectF &source = QRectF(0, 0, 1, 1)); - -#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_1_CL) && !defined(QT_OPENGL_ES_1) - const QGLContext *glContext() const; - void setGLContext(QGLContext *context); - - enum ShaderType - { - NoShaders = 0x00, - FragmentProgramShader = 0x01, - GlslShader = 0x02 - }; - - Q_DECLARE_FLAGS(ShaderTypes, ShaderType) - - ShaderTypes supportedShaderTypes() const; - - ShaderType shaderType() const; - void setShaderType(ShaderType type); -#endif - -public Q_SLOTS: - void viewportDestroyed(); - -Q_SIGNALS: - void frameChanged(); - -private: - void createPainter(); - - QVideoSurfacePainter *m_painter; -#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_1_CL) && !defined(QT_OPENGL_ES_1) - QGLContext *m_glContext; - ShaderTypes m_shaderTypes; - ShaderType m_shaderType; -#endif - int m_brightness; - int m_contrast; - int m_hue; - int m_saturation; - - QVideoFrame::PixelFormat m_pixelFormat; - QSize m_frameSize; - QRect m_sourceRect; - bool m_colorsDirty; - bool m_ready; -}; - -#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_1_CL) && !defined(QT_OPENGL_ES_1) -Q_DECLARE_OPERATORS_FOR_FLAGS(QPainterVideoSurface::ShaderTypes) -#endif - -QT_END_NAMESPACE - -#endif diff --git a/src/multimediakit/qradiotuner.h b/src/multimediakit/qradiotuner.h index e88f8488d..c0f94125f 100644 --- a/src/multimediakit/qradiotuner.h +++ b/src/multimediakit/qradiotuner.h @@ -50,8 +50,13 @@ #include <QPair> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QRadioTunerPrivate; class Q_MULTIMEDIA_EXPORT QRadioTuner : public QMediaObject { @@ -148,4 +153,6 @@ Q_MEDIA_ENUM_DEBUG(QRadioTuner, Band) Q_MEDIA_ENUM_DEBUG(QRadioTuner, Error) Q_MEDIA_ENUM_DEBUG(QRadioTuner, StereoMode) +QT_END_HEADER + #endif // QRADIOPLAYER_H diff --git a/src/multimediakit/qradiotunercontrol.h b/src/multimediakit/qradiotunercontrol.h index 6f9471700..ae6990ddc 100644 --- a/src/multimediakit/qradiotunercontrol.h +++ b/src/multimediakit/qradiotunercontrol.h @@ -45,8 +45,13 @@ #include "qmediacontrol.h" #include "qradiotuner.h" +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class Q_MULTIMEDIA_EXPORT QRadioTunerControl : public QMediaControl { Q_OBJECT @@ -97,7 +102,7 @@ Q_SIGNALS: void bandChanged(QRadioTuner::Band band); void frequencyChanged(int frequency); void stereoStatusChanged(bool stereo); - void searchingChanged(bool stereo); + void searchingChanged(bool searching); void signalStrengthChanged(int signalStrength); void volumeChanged(int volume); void mutedChanged(bool muted); @@ -112,4 +117,7 @@ Q_MEDIA_DECLARE_CONTROL(QRadioTunerControl, QRadioTunerControl_iid) QT_END_NAMESPACE +QT_END_HEADER + + #endif // QRADIOTUNERCONTROL_H diff --git a/src/multimediakit/qtmedianamespace.h b/src/multimediakit/qtmedianamespace.h index 9e71617e2..cadbc28d9 100644 --- a/src/multimediakit/qtmedianamespace.h +++ b/src/multimediakit/qtmedianamespace.h @@ -47,8 +47,13 @@ #include <qtmultimediakitdefs.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + namespace QtMultimediaKit { enum MetaData @@ -187,4 +192,7 @@ namespace QtMultimediaKit QT_END_NAMESPACE +QT_END_HEADER + + #endif diff --git a/src/multimediakit/qtmultimediakitdefs.h b/src/multimediakit/qtmultimediakitdefs.h index d6ac059db..5ddc3e91c 100644 --- a/src/multimediakit/qtmultimediakitdefs.h +++ b/src/multimediakit/qtmultimediakitdefs.h @@ -73,7 +73,7 @@ # endif #endif -#if !defined(Q_SERVICEFW_EXPORT) +#if !defined(Q_MULTIMEDIA_EXPORT) # if defined(QT_SHARED) # define Q_MULTIMEDIA_EXPORT Q_DECL_EXPORT # else diff --git a/src/multimediakit/qvideodevicecontrol.h b/src/multimediakit/qvideodevicecontrol.h index 260c15868..6f44c4671 100644 --- a/src/multimediakit/qvideodevicecontrol.h +++ b/src/multimediakit/qvideodevicecontrol.h @@ -44,8 +44,12 @@ #include "qmediacontrol.h" +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + class Q_MULTIMEDIA_EXPORT QVideoDeviceControl : public QMediaControl { Q_OBJECT @@ -77,7 +81,8 @@ protected: #define QVideoDeviceControl_iid "com.nokia.Qt.QVideoDeviceControl/1.0" Q_MEDIA_DECLARE_CONTROL(QVideoDeviceControl, QVideoDeviceControl_iid) - QT_END_NAMESPACE +QT_END_HEADER + #endif // QVIDEODEVICECONTROL_H diff --git a/src/multimediakit/qvideoencodercontrol.h b/src/multimediakit/qvideoencodercontrol.h index bf37a8364..343af8039 100644 --- a/src/multimediakit/qvideoencodercontrol.h +++ b/src/multimediakit/qvideoencodercontrol.h @@ -48,7 +48,12 @@ #include <QtCore/qpair.h> #include <QtCore/qsize.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE + +QT_MODULE(Multimedia) + class QByteArray; class QStringList; QT_END_NAMESPACE @@ -87,4 +92,7 @@ Q_MEDIA_DECLARE_CONTROL(QVideoEncoderControl, QVideoEncoderControl_iid) QT_END_NAMESPACE +QT_END_HEADER + + #endif diff --git a/src/multimediakit/qvideorenderercontrol.h b/src/multimediakit/qvideorenderercontrol.h index 70bc64f69..b3a70837c 100644 --- a/src/multimediakit/qvideorenderercontrol.h +++ b/src/multimediakit/qvideorenderercontrol.h @@ -44,7 +44,12 @@ #include "qmediacontrol.h" +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE + +QT_MODULE(Multimedia) + class QAbstractVideoSurface; QT_END_NAMESPACE @@ -70,4 +75,7 @@ Q_MEDIA_DECLARE_CONTROL(QVideoRendererControl, QVideoRendererControl_iid) QT_END_NAMESPACE +QT_END_HEADER + + #endif // QVIDEORENDERERCONTROL_H diff --git a/src/multimediakit/qvideosurfaceoutput_p.h b/src/multimediakit/qvideosurfaceoutput_p.h index d74f73082..76ec5e84d 100644 --- a/src/multimediakit/qvideosurfaceoutput_p.h +++ b/src/multimediakit/qvideosurfaceoutput_p.h @@ -46,8 +46,13 @@ #include <QtCore/qsharedpointer.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QAbstractVideoSurface; class QVideoRendererControl; @@ -75,4 +80,7 @@ private: QT_END_NAMESPACE +QT_END_HEADER + + #endif diff --git a/src/multimediakit/qvideowidget.cpp b/src/multimediakit/qvideowidget.cpp deleted file mode 100644 index 6ed9209c2..000000000 --- a/src/multimediakit/qvideowidget.cpp +++ /dev/null @@ -1,1043 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qvideowidget_p.h" - -#include <qmediaobject.h> -#include <qmediaservice.h> -#include <qvideowindowcontrol.h> -#include <qvideowidgetcontrol.h> - -#include <qpaintervideosurface_p.h> -#include <qvideorenderercontrol.h> -#include <qvideosurfaceformat.h> -#include <qpainter.h> - -#include <qapplication.h> -#include <qevent.h> -#include <qdialog.h> -#include <qboxlayout.h> -#include <qnamespace.h> - -using namespace Qt; - -QT_BEGIN_NAMESPACE - -QVideoWidgetControlBackend::QVideoWidgetControlBackend( - QMediaService *service, QVideoWidgetControl *control, QWidget *widget) - : m_service(service) - , m_widgetControl(control) -{ - connect(control, SIGNAL(brightnessChanged(int)), widget, SLOT(_q_brightnessChanged(int))); - connect(control, SIGNAL(contrastChanged(int)), widget, SLOT(_q_contrastChanged(int))); - connect(control, SIGNAL(hueChanged(int)), widget, SLOT(_q_hueChanged(int))); - connect(control, SIGNAL(saturationChanged(int)), widget, SLOT(_q_saturationChanged(int))); - connect(control, SIGNAL(fullScreenChanged(bool)), widget, SLOT(_q_fullScreenChanged(bool))); - - QBoxLayout *layout = new QVBoxLayout; - layout->setMargin(0); - layout->setSpacing(0); - - layout->addWidget(control->videoWidget()); - - widget->setLayout(layout); -} - -void QVideoWidgetControlBackend::releaseControl() -{ - m_service->releaseControl(m_widgetControl); -} - -void QVideoWidgetControlBackend::setBrightness(int brightness) -{ - m_widgetControl->setBrightness(brightness); -} - -void QVideoWidgetControlBackend::setContrast(int contrast) -{ - m_widgetControl->setContrast(contrast); -} - -void QVideoWidgetControlBackend::setHue(int hue) -{ - m_widgetControl->setHue(hue); -} - -void QVideoWidgetControlBackend::setSaturation(int saturation) -{ - m_widgetControl->setSaturation(saturation); -} - -void QVideoWidgetControlBackend::setFullScreen(bool fullScreen) -{ - m_widgetControl->setFullScreen(fullScreen); -} - - -Qt::AspectRatioMode QVideoWidgetControlBackend::aspectRatioMode() const -{ - return m_widgetControl->aspectRatioMode(); -} - -void QVideoWidgetControlBackend::setAspectRatioMode(Qt::AspectRatioMode mode) -{ - m_widgetControl->setAspectRatioMode(mode); -} - -QRendererVideoWidgetBackend::QRendererVideoWidgetBackend( - QMediaService *service, QVideoRendererControl *control, QWidget *widget) - : m_service(service) - , m_rendererControl(control) - , m_widget(widget) - , m_surface(new QPainterVideoSurface) - , m_aspectRatioMode(Qt::KeepAspectRatio) - , m_updatePaintDevice(true) -{ - connect(this, SIGNAL(brightnessChanged(int)), m_widget, SLOT(_q_brightnessChanged(int))); - connect(this, SIGNAL(contrastChanged(int)), m_widget, SLOT(_q_contrastChanged(int))); - connect(this, SIGNAL(hueChanged(int)), m_widget, SLOT(_q_hueChanged(int))); - connect(this, SIGNAL(saturationChanged(int)), m_widget, SLOT(_q_saturationChanged(int))); - connect(m_surface, SIGNAL(frameChanged()), this, SLOT(frameChanged())); - connect(m_surface, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat)), - this, SLOT(formatChanged(QVideoSurfaceFormat))); - - m_rendererControl->setSurface(m_surface); -} - -QRendererVideoWidgetBackend::~QRendererVideoWidgetBackend() -{ - delete m_surface; -} - -void QRendererVideoWidgetBackend::releaseControl() -{ - m_service->releaseControl(m_rendererControl); -} - -void QRendererVideoWidgetBackend::clearSurface() -{ - m_rendererControl->setSurface(0); -} - -void QRendererVideoWidgetBackend::setBrightness(int brightness) -{ - m_surface->setBrightness(brightness); - - emit brightnessChanged(brightness); -} - -void QRendererVideoWidgetBackend::setContrast(int contrast) -{ - m_surface->setContrast(contrast); - - emit contrastChanged(contrast); -} - -void QRendererVideoWidgetBackend::setHue(int hue) -{ - m_surface->setHue(hue); - - emit hueChanged(hue); -} - -void QRendererVideoWidgetBackend::setSaturation(int saturation) -{ - m_surface->setSaturation(saturation); - - emit saturationChanged(saturation); -} - -Qt::AspectRatioMode QRendererVideoWidgetBackend::aspectRatioMode() const -{ - return m_aspectRatioMode; -} - -void QRendererVideoWidgetBackend::setAspectRatioMode(Qt::AspectRatioMode mode) -{ - m_aspectRatioMode = mode; - - m_widget->updateGeometry(); -} - -void QRendererVideoWidgetBackend::setFullScreen(bool) -{ -} - -QSize QRendererVideoWidgetBackend::sizeHint() const -{ - return m_surface->surfaceFormat().sizeHint(); -} - -void QRendererVideoWidgetBackend::showEvent() -{ -} - -void QRendererVideoWidgetBackend::hideEvent(QHideEvent *) -{ -#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_1_CL) && !defined(QT_OPENGL_ES_1) - m_updatePaintDevice = true; - m_surface->setGLContext(0); -#endif -} - -void QRendererVideoWidgetBackend::resizeEvent(QResizeEvent *) -{ - updateRects(); -} - -void QRendererVideoWidgetBackend::moveEvent(QMoveEvent *) -{ -} - -void QRendererVideoWidgetBackend::paintEvent(QPaintEvent *event) -{ - QPainter painter(m_widget); - - if (m_widget->testAttribute(Qt::WA_OpaquePaintEvent)) { - QRegion borderRegion = event->region(); - borderRegion = borderRegion.subtracted(m_boundingRect); - - QBrush brush = m_widget->palette().window(); - - QVector<QRect> rects = borderRegion.rects(); - for (QVector<QRect>::iterator it = rects.begin(), end = rects.end(); it != end; ++it) { - painter.fillRect(*it, brush); - } - } - - if (m_surface->isActive() && m_boundingRect.intersects(event->rect())) { - m_surface->paint(&painter, m_boundingRect, m_sourceRect); - - m_surface->setReady(true); - } else { - #if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_1_CL) && !defined(QT_OPENGL_ES_1) - if (m_updatePaintDevice && (painter.paintEngine()->type() == QPaintEngine::OpenGL - || painter.paintEngine()->type() == QPaintEngine::OpenGL2)) { - m_updatePaintDevice = false; - - m_surface->setGLContext(const_cast<QGLContext *>(QGLContext::currentContext())); - if (m_surface->supportedShaderTypes() & QPainterVideoSurface::GlslShader) { - m_surface->setShaderType(QPainterVideoSurface::GlslShader); - } else { - m_surface->setShaderType(QPainterVideoSurface::FragmentProgramShader); - } - } -#endif - } - -} - -void QRendererVideoWidgetBackend::formatChanged(const QVideoSurfaceFormat &format) -{ - m_nativeSize = format.sizeHint(); - - updateRects(); - - m_widget->updateGeometry(); - m_widget->update(); -} - -void QRendererVideoWidgetBackend::frameChanged() -{ - m_widget->update(m_boundingRect); -} - -void QRendererVideoWidgetBackend::updateRects() -{ - QRect rect = m_widget->rect(); - - if (m_nativeSize.isEmpty()) { - m_boundingRect = QRect(); - } else if (m_aspectRatioMode == Qt::IgnoreAspectRatio) { - m_boundingRect = rect; - m_sourceRect = QRectF(0, 0, 1, 1); - } else if (m_aspectRatioMode == Qt::KeepAspectRatio) { - QSize size = m_nativeSize; - size.scale(rect.size(), Qt::KeepAspectRatio); - - m_boundingRect = QRect(0, 0, size.width(), size.height()); - m_boundingRect.moveCenter(rect.center()); - - m_sourceRect = QRectF(0, 0, 1, 1); - } else if (m_aspectRatioMode == Qt::KeepAspectRatioByExpanding) { - m_boundingRect = rect; - - QSizeF size = rect.size(); - size.scale(m_nativeSize, Qt::KeepAspectRatio); - - m_sourceRect = QRectF( - 0, 0, size.width() / m_nativeSize.width(), size.height() / m_nativeSize.height()); - m_sourceRect.moveCenter(QPointF(0.5, 0.5)); - } -} - -QWindowVideoWidgetBackend::QWindowVideoWidgetBackend( - QMediaService *service, QVideoWindowControl *control, QWidget *widget) - : m_service(service) - , m_windowControl(control) - , m_widget(widget) - , m_aspectRatioMode(Qt::KeepAspectRatio) -{ - connect(control, SIGNAL(brightnessChanged(int)), m_widget, SLOT(_q_brightnessChanged(int))); - connect(control, SIGNAL(contrastChanged(int)), m_widget, SLOT(_q_contrastChanged(int))); - connect(control, SIGNAL(hueChanged(int)), m_widget, SLOT(_q_hueChanged(int))); - connect(control, SIGNAL(saturationChanged(int)), m_widget, SLOT(_q_saturationChanged(int))); - connect(control, SIGNAL(fullScreenChanged(bool)), m_widget, SLOT(_q_fullScreenChanged(bool))); - connect(control, SIGNAL(nativeSizeChanged()), m_widget, SLOT(_q_dimensionsChanged())); - - control->setWinId(widget->winId()); -} - -QWindowVideoWidgetBackend::~QWindowVideoWidgetBackend() -{ -} - -void QWindowVideoWidgetBackend::releaseControl() -{ - m_service->releaseControl(m_windowControl); -} - -void QWindowVideoWidgetBackend::setBrightness(int brightness) -{ - m_windowControl->setBrightness(brightness); -} - -void QWindowVideoWidgetBackend::setContrast(int contrast) -{ - m_windowControl->setContrast(contrast); -} - -void QWindowVideoWidgetBackend::setHue(int hue) -{ - m_windowControl->setHue(hue); -} - -void QWindowVideoWidgetBackend::setSaturation(int saturation) -{ - m_windowControl->setSaturation(saturation); -} - -void QWindowVideoWidgetBackend::setFullScreen(bool fullScreen) -{ - m_windowControl->setFullScreen(fullScreen); -} - -Qt::AspectRatioMode QWindowVideoWidgetBackend::aspectRatioMode() const -{ - return m_windowControl->aspectRatioMode(); -} - -void QWindowVideoWidgetBackend::setAspectRatioMode(Qt::AspectRatioMode mode) -{ - m_windowControl->setAspectRatioMode(mode); -} - -QSize QWindowVideoWidgetBackend::sizeHint() const -{ - return m_windowControl->nativeSize(); -} - -void QWindowVideoWidgetBackend::showEvent() -{ - m_windowControl->setWinId(m_widget->winId()); - - m_windowControl->setDisplayRect(m_widget->rect()); - -#if defined(Q_WS_WIN) - m_widget->setUpdatesEnabled(false); -#endif -} - -void QWindowVideoWidgetBackend::hideEvent(QHideEvent *) -{ -#if defined(Q_WS_WIN) - m_widget->setUpdatesEnabled(true); -#endif -} - -void QWindowVideoWidgetBackend::moveEvent(QMoveEvent *) -{ - m_windowControl->setDisplayRect(m_widget->rect()); -} - -void QWindowVideoWidgetBackend::resizeEvent(QResizeEvent *) -{ - m_windowControl->setDisplayRect(m_widget->rect()); -} - -void QWindowVideoWidgetBackend::paintEvent(QPaintEvent *event) -{ - if (m_widget->testAttribute(Qt::WA_OpaquePaintEvent)) { - QPainter painter(m_widget); - - painter.fillRect(event->rect(), m_widget->palette().window()); - } - - m_windowControl->repaint(); - - event->accept(); -} - -#if defined(Q_WS_WIN) -bool QWindowVideoWidgetBackend::winEvent(MSG *message, long *) -{ - if (message->message == WM_PAINT) - m_windowControl->repaint(); - - return false; -} -#endif - -void QVideoWidgetPrivate::setCurrentControl(QVideoWidgetControlInterface *control) -{ - if (currentControl != control) { - currentControl = control; - - currentControl->setBrightness(brightness); - currentControl->setContrast(contrast); - currentControl->setHue(hue); - currentControl->setSaturation(saturation); - currentControl->setAspectRatioMode(aspectRatioMode); - } -} - -void QVideoWidgetPrivate::clearService() -{ - if (service) { - QObject::disconnect(service, SIGNAL(destroyed()), q_func(), SLOT(_q_serviceDestroyed())); - - if (widgetBackend) { - QLayout *layout = q_func()->layout(); - - for (QLayoutItem *item = layout->takeAt(0); item; item = layout->takeAt(0)) { - item->widget()->setParent(0); - delete item; - } - delete layout; - - widgetBackend->releaseControl(); - - delete widgetBackend; - widgetBackend = 0; - } else if (rendererBackend) { - rendererBackend->clearSurface(); - rendererBackend->releaseControl(); - - delete rendererBackend; - rendererBackend = 0; - } else { - windowBackend->releaseControl(); - - delete windowBackend; - windowBackend = 0; - } - - currentBackend = 0; - currentControl = 0; - service = 0; - } -} - -bool QVideoWidgetPrivate::createWidgetBackend() -{ - if (QMediaControl *control = service->requestControl(QVideoWidgetControl_iid)) { - if (QVideoWidgetControl *widgetControl = qobject_cast<QVideoWidgetControl *>(control)) { - widgetBackend = new QVideoWidgetControlBackend(service, widgetControl, q_func()); - - setCurrentControl(widgetBackend); - - return true; - } - service->releaseControl(control); - } - return false; -} - -bool QVideoWidgetPrivate::createWindowBackend() -{ - if (QMediaControl *control = service->requestControl(QVideoWindowControl_iid)) { - if (QVideoWindowControl *windowControl = qobject_cast<QVideoWindowControl *>(control)) { - windowBackend = new QWindowVideoWidgetBackend(service, windowControl, q_func()); - currentBackend = windowBackend; - - setCurrentControl(windowBackend); - - return true; - } - service->releaseControl(control); - } - return false; -} - -bool QVideoWidgetPrivate::createRendererBackend() -{ - if (QMediaControl *control = service->requestControl(QVideoRendererControl_iid)) { - if (QVideoRendererControl *rendererControl = qobject_cast<QVideoRendererControl *>(control)) { - rendererBackend = new QRendererVideoWidgetBackend(service, rendererControl, q_func()); - currentBackend = rendererBackend; - - setCurrentControl(rendererBackend); - - return true; - } - service->releaseControl(control); - } - return false; -} - -void QVideoWidgetPrivate::_q_serviceDestroyed() -{ - if (widgetBackend) - delete q_func()->layout(); - - delete widgetBackend; - delete windowBackend; - delete rendererBackend; - - widgetBackend = 0; - windowBackend = 0; - rendererBackend = 0; - currentControl = 0; - currentBackend = 0; - service = 0; -} - -void QVideoWidgetPrivate::_q_brightnessChanged(int b) -{ - if (b != brightness) - emit q_func()->brightnessChanged(brightness = b); -} - -void QVideoWidgetPrivate::_q_contrastChanged(int c) -{ - if (c != contrast) - emit q_func()->contrastChanged(contrast = c); -} - -void QVideoWidgetPrivate::_q_hueChanged(int h) -{ - if (h != hue) - emit q_func()->hueChanged(hue = h); -} - -void QVideoWidgetPrivate::_q_saturationChanged(int s) -{ - if (s != saturation) - emit q_func()->saturationChanged(saturation = s); -} - - -void QVideoWidgetPrivate::_q_fullScreenChanged(bool fullScreen) -{ - if (!fullScreen && q_func()->isFullScreen()) - q_func()->showNormal(); -} - -void QVideoWidgetPrivate::_q_dimensionsChanged() -{ - q_func()->updateGeometry(); - q_func()->update(); -} - -/*! - \class QVideoWidget - - - \brief The QVideoWidget class provides a widget which presents video - produced by a media object. - \ingroup multimedia - \inmodule QtMultimediaKit - \since 1.0 - - \inmodule QtMultimediaKit - - Attaching a QVideoWidget to a QMediaObject allows it to display the - video or image output of that media object. A QVideoWidget is attached - to media object by passing a pointer to the QMediaObject in its - constructor, and detached by destroying the QVideoWidget. - - \snippet doc/src/snippets/multimedia-snippets/video.cpp Video widget - - \bold {Note}: Only a single display output can be attached to a media - object at one time. - - \sa QMediaObject, QMediaPlayer, QGraphicsVideoItem -*/ - -/*! - Constructs a new video widget. - - The \a parent is passed to QWidget. -*/ -QVideoWidget::QVideoWidget(QWidget *parent) - : QWidget(parent, 0) - , d_ptr(new QVideoWidgetPrivate) -{ - d_ptr->q_ptr = this; -} - -/*! - \internal -*/ -QVideoWidget::QVideoWidget(QVideoWidgetPrivate &dd, QWidget *parent) - : QWidget(parent, 0) - , d_ptr(&dd) -{ - d_ptr->q_ptr = this; - - QPalette palette = QWidget::palette(); - palette.setColor(QPalette::Background, Qt::black); - setPalette(palette); -} - -/*! - Destroys a video widget. -*/ -QVideoWidget::~QVideoWidget() -{ - d_ptr->clearService(); - - delete d_ptr; -} - -/*! - \property QVideoWidget::mediaObject - \brief the media object which provides the video displayed by a widget. - \since 1.0 -*/ - -QMediaObject *QVideoWidget::mediaObject() const -{ - return d_func()->mediaObject; -} - -/*! - \internal - \since 1.0 -*/ -bool QVideoWidget::setMediaObject(QMediaObject *object) -{ - Q_D(QVideoWidget); - - if (object == d->mediaObject) - return true; - - d->clearService(); - - d->mediaObject = object; - - if (d->mediaObject) - d->service = d->mediaObject->service(); - - if (d->service) { - if (d->createWidgetBackend()) { - // Nothing to do here. - } else if ((!window() || !window()->testAttribute(Qt::WA_DontShowOnScreen)) - && d->createWindowBackend()) { - if (isVisible()) - d->windowBackend->showEvent(); - } else if (d->createRendererBackend()) { - if (isVisible()) - d->rendererBackend->showEvent(); - } else { - d->service = 0; - d->mediaObject = 0; - - return false; - } - - connect(d->service, SIGNAL(destroyed()), SLOT(_q_serviceDestroyed())); - } else { - d->mediaObject = 0; - - return false; - } - - return true; -} - -/*! - \property QVideoWidget::aspectRatioMode - \brief how video is scaled with respect to its aspect ratio. - \since 1.0 -*/ - -Qt::AspectRatioMode QVideoWidget::aspectRatioMode() const -{ - return d_func()->aspectRatioMode; -} - -void QVideoWidget::setAspectRatioMode(Qt::AspectRatioMode mode) -{ - Q_D(QVideoWidget); - - if (d->currentControl) { - d->currentControl->setAspectRatioMode(mode); - d->aspectRatioMode = d->currentControl->aspectRatioMode(); - } else { - d->aspectRatioMode = mode; - } -} - -/*! - \property QVideoWidget::fullScreen - \brief whether video display is confined to a window or is fullScreen. - \since 1.0 -*/ - -void QVideoWidget::setFullScreen(bool fullScreen) -{ - Q_D(QVideoWidget); - - if (fullScreen) { - Qt::WindowFlags flags = windowFlags(); - - d->nonFullScreenFlags = flags & (Qt::Window | Qt::SubWindow); - flags |= Qt::Window; - flags &= ~Qt::SubWindow; - setWindowFlags(flags); - - showFullScreen(); - } else { - showNormal(); - } -} - -/*! - \fn QVideoWidget::fullScreenChanged(bool fullScreen) - - Signals that the \a fullScreen mode of a video widget has changed. - - \since 1.0 - \sa fullScreen -*/ - -/*! - \property QVideoWidget::brightness - \brief an adjustment to the brightness of displayed video. - - Valid brightness values range between -100 and 100, the default is 0. - \since 1.0 -*/ - -int QVideoWidget::brightness() const -{ - return d_func()->brightness; -} - -void QVideoWidget::setBrightness(int brightness) -{ - Q_D(QVideoWidget); - - int boundedBrightness = qBound(-100, brightness, 100); - - if (d->currentControl) - d->currentControl->setBrightness(boundedBrightness); - else if (d->brightness != boundedBrightness) - emit brightnessChanged(d->brightness = boundedBrightness); -} - -/*! - \fn QVideoWidget::brightnessChanged(int brightness) - - Signals that a video widgets's \a brightness adjustment has changed. - - \since 1.0 - \sa brightness -*/ - -/*! - \property QVideoWidget::contrast - \brief an adjustment to the contrast of displayed video. - - Valid contrast values range between -100 and 100, the default is 0. - - \since 1.0 -*/ - -int QVideoWidget::contrast() const -{ - return d_func()->contrast; -} - -void QVideoWidget::setContrast(int contrast) -{ - Q_D(QVideoWidget); - - int boundedContrast = qBound(-100, contrast, 100); - - if (d->currentControl) - d->currentControl->setContrast(boundedContrast); - else if (d->contrast != boundedContrast) - emit contrastChanged(d->contrast = boundedContrast); -} - -/*! - \fn QVideoWidget::contrastChanged(int contrast) - - Signals that a video widgets's \a contrast adjustment has changed. - - \since 1.0 - \sa contrast -*/ - -/*! - \property QVideoWidget::hue - \brief an adjustment to the hue of displayed video. - - Valid hue values range between -100 and 100, the default is 0. - \since 1.0 -*/ - -int QVideoWidget::hue() const -{ - return d_func()->hue; -} - -void QVideoWidget::setHue(int hue) -{ - Q_D(QVideoWidget); - - int boundedHue = qBound(-100, hue, 100); - - if (d->currentControl) - d->currentControl->setHue(boundedHue); - else if (d->hue != boundedHue) - emit hueChanged(d->hue = boundedHue); -} - -/*! - \fn QVideoWidget::hueChanged(int hue) - - Signals that a video widgets's \a hue has changed. - - \since 1.0 - \sa hue -*/ - -/*! - \property QVideoWidget::saturation - \brief an adjustment to the saturation of displayed video. - - Valid saturation values range between -100 and 100, the default is 0. - \since 1.0 -*/ - -int QVideoWidget::saturation() const -{ - return d_func()->saturation; -} - -void QVideoWidget::setSaturation(int saturation) -{ - Q_D(QVideoWidget); - - int boundedSaturation = qBound(-100, saturation, 100); - - if (d->currentControl) - d->currentControl->setSaturation(boundedSaturation); - else if (d->saturation != boundedSaturation) - emit saturationChanged(d->saturation = boundedSaturation); - -} - -/*! - \fn QVideoWidget::saturationChanged(int saturation) - - Signals that a video widgets's \a saturation has changed. - - \since 1.0 - \sa saturation -*/ - -/*! - Returns the size hint for the current back end, - if there is one, or else the size hint from QWidget. - \since 1.0 - */ -QSize QVideoWidget::sizeHint() const -{ - Q_D(const QVideoWidget); - - if (d->currentBackend) - return d->currentBackend->sizeHint(); - else - return QWidget::sizeHint(); - - -} - -/*! - Current event \a event. - Returns the value of the baseclass QWidget::event(QEvent *event) function. - \since 1.0 -*/ -bool QVideoWidget::event(QEvent *event) -{ - Q_D(QVideoWidget); - - if (event->type() == QEvent::WindowStateChange) { - Qt::WindowFlags flags = windowFlags(); - - if (windowState() & Qt::WindowFullScreen) { - if (d->currentControl) - d->currentControl->setFullScreen(true); - - if (!d->wasFullScreen) - emit fullScreenChanged(d->wasFullScreen = true); - } else { - if (d->currentControl) - d->currentControl->setFullScreen(false); - - if (d->wasFullScreen) { - flags &= ~(Qt::Window | Qt::SubWindow); //clear the flags... - flags |= d->nonFullScreenFlags; //then we reset the flags (window and subwindow) - setWindowFlags(flags); - - emit fullScreenChanged(d->wasFullScreen = false); - } - } - } - return QWidget::event(event); -} - -/*! - Handles the show \a event. - \since 1.0 - */ -void QVideoWidget::showEvent(QShowEvent *event) -{ - Q_D(QVideoWidget); - - QWidget::showEvent(event); - - // The window backend won't work for re-directed windows so use the renderer backend instead. - if (d->windowBackend && window()->testAttribute(Qt::WA_DontShowOnScreen)) { - d->windowBackend->releaseControl(); - - delete d->windowBackend; - d->windowBackend = 0; - - d->createRendererBackend(); - } - - if (d->currentBackend) - d->currentBackend->showEvent(); -} - -/*! - - Handles the hide \a event. - \since 1.0 -*/ -void QVideoWidget::hideEvent(QHideEvent *event) -{ - Q_D(QVideoWidget); - - if (d->currentBackend) - d->currentBackend->hideEvent(event); - - QWidget::hideEvent(event); -} - -/*! - Handles the resize \a event. - \since 1.0 - */ -void QVideoWidget::resizeEvent(QResizeEvent *event) -{ - Q_D(QVideoWidget); - - QWidget::resizeEvent(event); - - if (d->currentBackend) - d->currentBackend->resizeEvent(event); -} - -/*! - Handles the move \a event. - \since 1.0 - */ -void QVideoWidget::moveEvent(QMoveEvent *event) -{ - Q_D(QVideoWidget); - - if (d->currentBackend) - d->currentBackend->moveEvent(event); -} - -/*! - Handles the paint \a event. - \since 1.0 - */ -void QVideoWidget::paintEvent(QPaintEvent *event) -{ - Q_D(QVideoWidget); - - if (d->currentBackend) { - d->currentBackend->paintEvent(event); - } else if (testAttribute(Qt::WA_OpaquePaintEvent)) { - QPainter painter(this); - - painter.fillRect(event->rect(), palette().window()); - } -} - - -#if defined(Q_WS_WIN) -/*! - \reimp - \internal - \since 1.1 -*/ -bool QVideoWidget::winEvent(MSG *message, long *result) -{ - return d_func()->windowBackend && d_func()->windowBackend->winEvent(message, result) - ? true - : QWidget::winEvent(message, result); -} -#endif - - -#include "moc_qvideowidget.cpp" -#include "moc_qvideowidget_p.cpp" -QT_END_NAMESPACE - diff --git a/src/multimediakit/qvideowidget.h b/src/multimediakit/qvideowidget.h deleted file mode 100644 index 43c603ed4..000000000 --- a/src/multimediakit/qvideowidget.h +++ /dev/null @@ -1,131 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QVIDEOWIDGET_H -#define QVIDEOWIDGET_H - -#include <QtGui/qwidget.h> - -#include <qtmultimediakitdefs.h> -#include <qmediabindableinterface.h> - -QT_BEGIN_NAMESPACE - -class QMediaObject; - -class QVideoWidgetPrivate; -class Q_MULTIMEDIA_EXPORT QVideoWidget : public QWidget, public QMediaBindableInterface -{ - Q_OBJECT - Q_INTERFACES(QMediaBindableInterface) - Q_PROPERTY(QMediaObject* mediaObject READ mediaObject WRITE setMediaObject) - Q_PROPERTY(bool fullScreen READ isFullScreen WRITE setFullScreen NOTIFY fullScreenChanged) - Q_PROPERTY(Qt::AspectRatioMode aspectRatioMode READ aspectRatioMode WRITE setAspectRatioMode) - Q_PROPERTY(int brightness READ brightness WRITE setBrightness NOTIFY brightnessChanged) - Q_PROPERTY(int contrast READ contrast WRITE setContrast NOTIFY contrastChanged) - Q_PROPERTY(int hue READ hue WRITE setHue NOTIFY hueChanged) - Q_PROPERTY(int saturation READ saturation WRITE setSaturation NOTIFY saturationChanged) - -public: - QVideoWidget(QWidget *parent = 0); - ~QVideoWidget(); - - QMediaObject *mediaObject() const; - -#ifdef Q_QDOC - bool isFullScreen() const; -#endif - - Qt::AspectRatioMode aspectRatioMode() const; - - int brightness() const; - int contrast() const; - int hue() const; - int saturation() const; - - QSize sizeHint() const; - -public Q_SLOTS: - void setFullScreen(bool fullScreen); - void setAspectRatioMode(Qt::AspectRatioMode mode); - void setBrightness(int brightness); - void setContrast(int contrast); - void setHue(int hue); - void setSaturation(int saturation); - -Q_SIGNALS: - void fullScreenChanged(bool fullScreen); - void brightnessChanged(int brightness); - void contrastChanged(int contrast); - void hueChanged(int hue); - void saturationChanged(int saturation); - -protected: - bool event(QEvent *event); - void showEvent(QShowEvent *event); - void hideEvent(QHideEvent *event); - void resizeEvent(QResizeEvent *event); - void moveEvent(QMoveEvent *event); - void paintEvent(QPaintEvent *event); - - bool setMediaObject(QMediaObject *object); - -#if defined(Q_WS_WIN) - bool winEvent(MSG *message, long *result); -#endif - - QVideoWidget(QVideoWidgetPrivate &dd, QWidget *parent); - QVideoWidgetPrivate *d_ptr; - -private: - Q_DECLARE_PRIVATE(QVideoWidget) - Q_PRIVATE_SLOT(d_func(), void _q_serviceDestroyed()) - Q_PRIVATE_SLOT(d_func(), void _q_brightnessChanged(int)) - Q_PRIVATE_SLOT(d_func(), void _q_contrastChanged(int)) - Q_PRIVATE_SLOT(d_func(), void _q_hueChanged(int)) - Q_PRIVATE_SLOT(d_func(), void _q_saturationChanged(int)) - Q_PRIVATE_SLOT(d_func(), void _q_fullScreenChanged(bool)) - Q_PRIVATE_SLOT(d_func(), void _q_dimensionsChanged()) -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/multimediakit/qvideowidget_p.h b/src/multimediakit/qvideowidget_p.h deleted file mode 100644 index 4676cb6b9..000000000 --- a/src/multimediakit/qvideowidget_p.h +++ /dev/null @@ -1,282 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QVIDEOWIDGET_P_H -#define QVIDEOWIDGET_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <qtmultimediakitdefs.h> -#include "qvideowidget.h" - -#ifndef QT_NO_OPENGL -#include <QGLWidget> -#endif - -#include "qpaintervideosurface_p.h" - -#include <QtCore/qpointer.h> - -QT_BEGIN_NAMESPACE - -class QMediaService; - -class QVideoWidgetControlInterface -{ -public: - virtual ~QVideoWidgetControlInterface() {} - - virtual void setBrightness(int brightness) = 0; - virtual void setContrast(int contrast) = 0; - virtual void setHue(int hue) = 0; - virtual void setSaturation(int saturation) = 0; - - virtual void setFullScreen(bool fullScreen) = 0; - - virtual Qt::AspectRatioMode aspectRatioMode() const = 0; - virtual void setAspectRatioMode(Qt::AspectRatioMode mode) = 0; -}; - -class QVideoWidgetBackend : public QObject, public QVideoWidgetControlInterface -{ - Q_OBJECT -public: - virtual QSize sizeHint() const = 0; - - virtual void showEvent() = 0; - virtual void hideEvent(QHideEvent *event) = 0; - virtual void resizeEvent(QResizeEvent *event) = 0; - virtual void moveEvent(QMoveEvent *event) = 0; - virtual void paintEvent(QPaintEvent *event) = 0; -}; - -class QVideoWidgetControl; - -class QVideoWidgetControlBackend : public QObject, public QVideoWidgetControlInterface -{ - Q_OBJECT -public: - QVideoWidgetControlBackend(QMediaService *service, QVideoWidgetControl *control, QWidget *widget); - - void releaseControl(); - - void setBrightness(int brightness); - void setContrast(int contrast); - void setHue(int hue); - void setSaturation(int saturation); - - void setFullScreen(bool fullScreen); - - Qt::AspectRatioMode aspectRatioMode() const; - void setAspectRatioMode(Qt::AspectRatioMode mode); - -private: - QMediaService *m_service; - QVideoWidgetControl *m_widgetControl; -}; - - -class QVideoRendererControl; - -class QRendererVideoWidgetBackend : public QVideoWidgetBackend -{ - Q_OBJECT -public: - QRendererVideoWidgetBackend(QMediaService *service, QVideoRendererControl *control, QWidget *widget); - ~QRendererVideoWidgetBackend(); - - void releaseControl(); - void clearSurface(); - - void setBrightness(int brightness); - void setContrast(int contrast); - void setHue(int hue); - void setSaturation(int saturation); - - void setFullScreen(bool fullScreen); - - Qt::AspectRatioMode aspectRatioMode() const; - void setAspectRatioMode(Qt::AspectRatioMode mode); - - QSize sizeHint() const; - - void showEvent(); - void hideEvent(QHideEvent *event); - void resizeEvent(QResizeEvent *event); - void moveEvent(QMoveEvent *event); - void paintEvent(QPaintEvent *event); - -Q_SIGNALS: - void fullScreenChanged(bool fullScreen); - void brightnessChanged(int brightness); - void contrastChanged(int contrast); - void hueChanged(int hue); - void saturationChanged(int saturation); - -private Q_SLOTS: - void formatChanged(const QVideoSurfaceFormat &format); - void frameChanged(); - -private: - void updateRects(); - - QMediaService *m_service; - QVideoRendererControl *m_rendererControl; - QWidget *m_widget; - QPainterVideoSurface *m_surface; - Qt::AspectRatioMode m_aspectRatioMode; - QRect m_boundingRect; - QRectF m_sourceRect; - QSize m_nativeSize; - bool m_updatePaintDevice; -}; - -class QVideoWindowControl; - -class QWindowVideoWidgetBackend : public QVideoWidgetBackend -{ - Q_OBJECT -public: - QWindowVideoWidgetBackend(QMediaService *service, QVideoWindowControl *control, QWidget *widget); - ~QWindowVideoWidgetBackend(); - - void releaseControl(); - - void setBrightness(int brightness); - void setContrast(int contrast); - void setHue(int hue); - void setSaturation(int saturation); - - void setFullScreen(bool fullScreen); - - Qt::AspectRatioMode aspectRatioMode() const; - void setAspectRatioMode(Qt::AspectRatioMode mode); - - QSize sizeHint() const; - - void showEvent(); - void hideEvent(QHideEvent *event); - void resizeEvent(QResizeEvent *event); - void moveEvent(QMoveEvent *event); - void paintEvent(QPaintEvent *event); - -#if defined(Q_WS_WIN) - bool winEvent(MSG *message, long *result); -#endif - -private: - QMediaService *m_service; - QVideoWindowControl *m_windowControl; - QWidget *m_widget; - Qt::AspectRatioMode m_aspectRatioMode; - QSize m_pixelAspectRatio; -}; - -class QMediaService; -class QVideoOutputControl; - -class QVideoWidgetPrivate -{ - Q_DECLARE_PUBLIC(QVideoWidget) -public: - QVideoWidgetPrivate() - : q_ptr(0) - , mediaObject(0) - , service(0) - , widgetBackend(0) - , windowBackend(0) - , rendererBackend(0) - , currentControl(0) - , currentBackend(0) - , brightness(0) - , contrast(0) - , hue(0) - , saturation(0) - , aspectRatioMode(Qt::KeepAspectRatio) - , nonFullScreenFlags(0) - , wasFullScreen(false) - { - } - - QVideoWidget *q_ptr; - QPointer<QMediaObject> mediaObject; - QMediaService *service; - QVideoWidgetControlBackend *widgetBackend; - QWindowVideoWidgetBackend *windowBackend; - QRendererVideoWidgetBackend *rendererBackend; - QVideoWidgetControlInterface *currentControl; - QVideoWidgetBackend *currentBackend; - int brightness; - int contrast; - int hue; - int saturation; - Qt::AspectRatioMode aspectRatioMode; - Qt::WindowFlags nonFullScreenFlags; - bool wasFullScreen; - - bool createWidgetBackend(); - bool createWindowBackend(); - bool createRendererBackend(); - - void setCurrentControl(QVideoWidgetControlInterface *control); - void clearService(); - - void _q_serviceDestroyed(); - void _q_brightnessChanged(int brightness); - void _q_contrastChanged(int contrast); - void _q_hueChanged(int hue); - void _q_saturationChanged(int saturation); - void _q_fullScreenChanged(bool fullScreen); - void _q_dimensionsChanged(); -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/multimediakit/qvideowidgetcontrol.cpp b/src/multimediakit/qvideowidgetcontrol.cpp deleted file mode 100644 index cd29cbd8c..000000000 --- a/src/multimediakit/qvideowidgetcontrol.cpp +++ /dev/null @@ -1,245 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qvideowidgetcontrol.h" -#include "qmediacontrol_p.h" - -QT_BEGIN_NAMESPACE - -/*! - \class QVideoWidgetControl - - - \brief The QVideoWidgetControl class provides a media control which - implements a video widget. - - \inmodule QtMultimediaKit - \ingroup multimedia - \since 1.0 - - The videoWidget() property of QVideoWidgetControl provides a pointer to a - video widget implemented by the control's media service. This widget is - owned by the media service and so care should be taken not to delete it. - - \snippet doc/src/snippets/multimedia-snippets/video.cpp Video widget control - - QVideoWidgetControl is one of number of possible video output controls. - - The interface name of QVideoWidgetControl is \c com.nokia.Qt.QVideoWidgetControl/1.0 as - defined in QVideoWidgetControl_iid. - - \sa QMediaService::requestControl(), QVideoWidget -*/ - -/*! - \macro QVideoWidgetControl_iid - - \c com.nokia.Qt.QVideoWidgetControl/1.0 - - Defines the interface name of the QVideoWidgetControl class. - - \relates QVideoWidgetControl -*/ - -/*! - Constructs a new video widget control with the given \a parent. -*/ -QVideoWidgetControl::QVideoWidgetControl(QObject *parent) - :QMediaControl(parent) -{ -} - -/*! - Destroys a video widget control. -*/ -QVideoWidgetControl::~QVideoWidgetControl() -{ -} - -/*! - \fn QVideoWidgetControl::isFullScreen() const - - Returns true if the video is shown using the complete screen. - \since 1.0 -*/ - -/*! - \fn QVideoWidgetControl::setFullScreen(bool fullScreen) - - Sets whether a video widget is in \a fullScreen mode. - \since 1.0 -*/ - -/*! - \fn QVideoWidgetControl::fullScreenChanged(bool fullScreen) - - Signals that the \a fullScreen state of a video widget has changed. - \since 1.0 -*/ - -/*! - \fn QVideoWidgetControl::aspectRatioMode() const - - Returns how video is scaled to fit the widget with respect to its aspect ratio. - \since 1.0 -*/ - -/*! - \fn QVideoWidgetControl::setAspectRatioMode(Qt::AspectRatioMode mode) - - Sets the aspect ratio \a mode which determines how video is scaled to the fit the widget with - respect to its aspect ratio. - \since 1.0 -*/ - -/*! - \fn QVideoWidgetControl::brightness() const - - Returns the brightness adjustment applied to a video. - - Valid brightness values range between -100 and 100, the default is 0. - \since 1.0 -*/ - -/*! - \fn QVideoWidgetControl::setBrightness(int brightness) - - Sets a \a brightness adjustment for a video. - - Valid brightness values range between -100 and 100, the default is 0. - \since 1.0 -*/ - -/*! - \fn QVideoWidgetControl::brightnessChanged(int brightness) - - Signals that a video widget's \a brightness adjustment has changed. - \since 1.0 -*/ - -/*! - \fn QVideoWidgetControl::contrast() const - - Returns the contrast adjustment applied to a video. - - Valid contrast values range between -100 and 100, the default is 0. - \since 1.0 -*/ - -/*! - \fn QVideoWidgetControl::setContrast(int contrast) - - Sets the contrast adjustment for a video widget to \a contrast. - - Valid contrast values range between -100 and 100, the default is 0. - \since 1.0 -*/ - - -/*! - \fn QVideoWidgetControl::contrastChanged(int contrast) - - Signals that a video widget's \a contrast adjustment has changed. - \since 1.0 -*/ - -/*! - \fn QVideoWidgetControl::hue() const - - Returns the hue adjustment applied to a video widget. - - Value hue values range between -100 and 100, the default is 0. - \since 1.0 -*/ - -/*! - \fn QVideoWidgetControl::setHue(int hue) - - Sets a \a hue adjustment for a video widget. - - Valid hue values range between -100 and 100, the default is 0. - \since 1.0 -*/ - - -/*! - \fn QVideoWidgetControl::hueChanged(int hue) - - Signals that a video widget's \a hue adjustment has changed. - \since 1.0 -*/ - -/*! - \fn QVideoWidgetControl::saturation() const - - Returns the saturation adjustment applied to a video widget. - - Value saturation values range between -100 and 100, the default is 0. - \since 1.0 -*/ - - -/*! - \fn QVideoWidgetControl::setSaturation(int saturation) - - Sets a \a saturation adjustment for a video widget. - - Valid saturation values range between -100 and 100, the default is 0. - \since 1.0 -*/ - -/*! - \fn QVideoWidgetControl::saturationChanged(int saturation) - - Signals that a video widget's \a saturation adjustment has changed. - \since 1.0 -*/ - -/*! - \fn QVideoWidgetControl::videoWidget() - - Returns the QWidget. - \since 1.0 -*/ - -#include "moc_qvideowidgetcontrol.cpp" -QT_END_NAMESPACE - diff --git a/src/multimediakit/qvideowidgetcontrol.h b/src/multimediakit/qvideowidgetcontrol.h deleted file mode 100644 index d5797918d..000000000 --- a/src/multimediakit/qvideowidgetcontrol.h +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QVIDEOWIDGETCONTROL_H -#define QVIDEOWIDGETCONTROL_H - -#include "qvideowidget.h" -#include "qmediacontrol.h" - -#include <QtGui/qwidget.h> - -QT_BEGIN_NAMESPACE - -class QVideoWidgetControlPrivate; - -class Q_MULTIMEDIA_EXPORT QVideoWidgetControl : public QMediaControl -{ - Q_OBJECT - -public: - virtual ~QVideoWidgetControl(); - - virtual QWidget *videoWidget() = 0; - - virtual Qt::AspectRatioMode aspectRatioMode() const = 0; - virtual void setAspectRatioMode(Qt::AspectRatioMode mode) = 0; - - virtual bool isFullScreen() const = 0; - virtual void setFullScreen(bool fullScreen) = 0; - - virtual int brightness() const = 0; - virtual void setBrightness(int brightness) = 0; - - virtual int contrast() const = 0; - virtual void setContrast(int contrast) = 0; - - virtual int hue() const = 0; - virtual void setHue(int hue) = 0; - - virtual int saturation() const = 0; - virtual void setSaturation(int saturation) = 0; - -Q_SIGNALS: - void fullScreenChanged(bool fullScreen); - void brightnessChanged(int brightness); - void contrastChanged(int contrast); - void hueChanged(int hue); - void saturationChanged(int saturation); - -protected: - QVideoWidgetControl(QObject *parent = 0); -}; - -#define QVideoWidgetControl_iid "com.nokia.Qt.QVideoWidgetControl/1.0" -Q_MEDIA_DECLARE_CONTROL(QVideoWidgetControl, QVideoWidgetControl_iid) - -QT_END_NAMESPACE - -#endif diff --git a/src/multimediakit/qvideowindowcontrol.cpp b/src/multimediakit/qvideowindowcontrol.cpp deleted file mode 100644 index 0adcfec06..000000000 --- a/src/multimediakit/qvideowindowcontrol.cpp +++ /dev/null @@ -1,284 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qvideowindowcontrol.h" - -QT_BEGIN_NAMESPACE - -/*! - \class QVideoWindowControl - - \inmodule QtMultimediaKit - \ingroup multimedia - \brief The QVideoWindowControl class provides a media control for rendering video to a window. - \since 1.0 - - - The winId() property QVideoWindowControl allows a platform specific window - ID to be set as the video render target of a QMediaService. The - displayRect() property is used to set the region of the window the video - should be rendered to, and the aspectRatioMode() property indicates how the - video should be scaled to fit the displayRect(). - - \snippet doc/src/snippets/multimedia-snippets/video.cpp Video window control - - QVideoWindowControl is one of a number of possible video output controls. - - The interface name of QVideoWindowControl is \c com.nokia.Qt.QVideoWindowControl/1.0 as - defined in QVideoWindowControl_iid. - - \sa QMediaService::requestControl(), QVideoWidget -*/ - -/*! - \macro QVideoWindowControl_iid - - \c com.nokia.Qt.QVideoWindowControl/1.0 - - Defines the interface name of the QVideoWindowControl class. - - \relates QVideoWindowControl -*/ - -/*! - Constructs a new video window control with the given \a parent. -*/ -QVideoWindowControl::QVideoWindowControl(QObject *parent) - : QMediaControl(parent) -{ -} - -/*! - Destroys a video window control. -*/ -QVideoWindowControl::~QVideoWindowControl() -{ -} - -/*! - \fn QVideoWindowControl::winId() const - - Returns the ID of the window a video overlay end point renders to. - \since 1.0 -*/ - -/*! - \fn QVideoWindowControl::setWinId(WId id) - - Sets the \a id of the window a video overlay end point renders to. - \since 1.0 -*/ - -/*! - \fn QVideoWindowControl::displayRect() const - Returns the sub-rect of a window where video is displayed. - \since 1.0 -*/ - -/*! - \fn QVideoWindowControl::setDisplayRect(const QRect &rect) - Sets the sub-\a rect of a window where video is displayed. - \since 1.0 -*/ - -/*! - \fn QVideoWindowControl::isFullScreen() const - - Identifies if a video overlay is a fullScreen overlay. - - Returns true if the video overlay is fullScreen, and false otherwise. - \since 1.0 -*/ - -/*! - \fn QVideoWindowControl::setFullScreen(bool fullScreen) - - Sets whether a video overlay is a \a fullScreen overlay. - \since 1.0 -*/ - -/*! - \fn QVideoWindowControl::fullScreenChanged(bool fullScreen) - - Signals that the \a fullScreen state of a video overlay has changed. - \since 1.0 -*/ - -/*! - \fn QVideoWindowControl::repaint() - - Repaints the last frame. - \since 1.0 -*/ - -/*! - \fn QVideoWindowControl::nativeSize() const - - Returns a suggested size for the video display based on the resolution and aspect ratio of the - video. - \since 1.0 -*/ - -/*! - \fn QVideoWindowControl::nativeSizeChanged() - - Signals that the native dimensions of the video have changed. - \since 1.0 -*/ - - -/*! - \fn QVideoWindowControl::aspectRatioMode() const - - Returns how video is scaled to fit the display region with respect to its aspect ratio. - \since 1.0 -*/ - -/*! - \fn QVideoWindowControl::setAspectRatioMode(Qt::AspectRatioMode mode) - - Sets the aspect ratio \a mode which determines how video is scaled to the fit the display region - with respect to its aspect ratio. - \since 1.0 -*/ - -/*! - \fn QVideoWindowControl::brightness() const - - Returns the brightness adjustment applied to a video overlay. - - Valid brightness values range between -100 and 100, the default is 0. - \since 1.0 -*/ - -/*! - \fn QVideoWindowControl::setBrightness(int brightness) - - Sets a \a brightness adjustment for a video overlay. - - Valid brightness values range between -100 and 100, the default is 0. - \since 1.0 -*/ - -/*! - \fn QVideoWindowControl::brightnessChanged(int brightness) - - Signals that a video overlay's \a brightness adjustment has changed. - \since 1.0 -*/ - -/*! - \fn QVideoWindowControl::contrast() const - - Returns the contrast adjustment applied to a video overlay. - - Valid contrast values range between -100 and 100, the default is 0. - \since 1.0 -*/ - -/*! - \fn QVideoWindowControl::setContrast(int contrast) - - Sets the \a contrast adjustment for a video overlay. - - Valid contrast values range between -100 and 100, the default is 0. - \since 1.0 -*/ - -/*! - \fn QVideoWindowControl::contrastChanged(int contrast) - - Signals that a video overlay's \a contrast adjustment has changed. - \since 1.0 -*/ - -/*! - \fn QVideoWindowControl::hue() const - - Returns the hue adjustment applied to a video overlay. - - Value hue values range between -100 and 100, the default is 0. - \since 1.0 -*/ - -/*! - \fn QVideoWindowControl::setHue(int hue) - - Sets a \a hue adjustment for a video overlay. - - Valid hue values range between -100 and 100, the default is 0. - \since 1.0 -*/ - -/*! - \fn QVideoWindowControl::hueChanged(int hue) - - Signals that a video overlay's \a hue adjustment has changed. - \since 1.0 -*/ - -/*! - \fn QVideoWindowControl::saturation() const - - Returns the saturation adjustment applied to a video overlay. - - Value saturation values range between -100 and 100, the default is 0. - \since 1.0 -*/ - -/*! - \fn QVideoWindowControl::setSaturation(int saturation) - Sets a \a saturation adjustment for a video overlay. - - Valid saturation values range between -100 and 100, the default is 0. - \since 1.0 -*/ - -/*! - \fn QVideoWindowControl::saturationChanged(int saturation) - - Signals that a video overlay's \a saturation adjustment has changed. - \since 1.0 -*/ - -#include "moc_qvideowindowcontrol.cpp" -QT_END_NAMESPACE - diff --git a/src/multimediakit/qvideowindowcontrol.h b/src/multimediakit/qvideowindowcontrol.h deleted file mode 100644 index c48294d85..000000000 --- a/src/multimediakit/qvideowindowcontrol.h +++ /dev/null @@ -1,104 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QVIDEOWINDOWCONTROL_H -#define QVIDEOWINDOWCONTROL_H - -#include "qmediacontrol.h" -#include "qvideowidget.h" - -#include <QtGui/qwidget.h> - -QT_BEGIN_NAMESPACE - -class Q_MULTIMEDIA_EXPORT QVideoWindowControl : public QMediaControl -{ - Q_OBJECT - -public: - ~QVideoWindowControl(); - - virtual WId winId() const = 0; - virtual void setWinId(WId id) = 0; - - virtual QRect displayRect() const = 0; - virtual void setDisplayRect(const QRect &rect) = 0; - - virtual bool isFullScreen() const = 0; - virtual void setFullScreen(bool fullScreen) = 0; - - virtual void repaint() = 0; - - virtual QSize nativeSize() const = 0; - - virtual Qt::AspectRatioMode aspectRatioMode() const = 0; - virtual void setAspectRatioMode(Qt::AspectRatioMode mode) = 0; - - virtual int brightness() const = 0; - virtual void setBrightness(int brightness) = 0; - - virtual int contrast() const = 0; - virtual void setContrast(int contrast) = 0; - - virtual int hue() const = 0; - virtual void setHue(int hue) = 0; - - virtual int saturation() const = 0; - virtual void setSaturation(int saturation) = 0; - -Q_SIGNALS: - void fullScreenChanged(bool fullScreen); - void brightnessChanged(int brightness); - void contrastChanged(int contrast); - void hueChanged(int hue); - void saturationChanged(int saturation); - void nativeSizeChanged(); - -protected: - QVideoWindowControl(QObject *parent = 0); -}; - -#define QVideoWindowControl_iid "com.nokia.Qt.QVideoWindowControl/1.0" -Q_MEDIA_DECLARE_CONTROL(QVideoWindowControl, QVideoWindowControl_iid) - -QT_END_NAMESPACE - -#endif diff --git a/src/multimediakit/video/qabstractvideobuffer.cpp b/src/multimediakit/video/qabstractvideobuffer.cpp index 8704e40fc..88c00f6a5 100644 --- a/src/multimediakit/video/qabstractvideobuffer.cpp +++ b/src/multimediakit/video/qabstractvideobuffer.cpp @@ -55,8 +55,6 @@ QT_BEGIN_NAMESPACE video data. Creating a subclass of QAbstractVideoBuffer will allow you to construct video frames from preallocated or static buffers. - XXX where do these come from? - The contents of a buffer can be accessed by mapping the buffer to memory using the map() function which returns a pointer to memory containing the contents of the the video buffer. The memory returned by map() is released by calling the unmap() function. @@ -64,8 +62,6 @@ QT_BEGIN_NAMESPACE The handle() of a buffer may also be used to manipulate its contents using type specific APIs. The type of a buffer's handle is given by the handleType() function. - XXX example of handle stuff (opengl etc) - \sa QVideoFrame */ @@ -194,8 +190,6 @@ QAbstractVideoBuffer::HandleType QAbstractVideoBuffer::handleType() const The type of the handle is given by handleType() function. - XXX put a table here too - \since 1.0 \sa handleType() */ diff --git a/src/multimediakit/video/qabstractvideobuffer.h b/src/multimediakit/video/qabstractvideobuffer.h index 25e63825a..5662ee140 100644 --- a/src/multimediakit/video/qabstractvideobuffer.h +++ b/src/multimediakit/video/qabstractvideobuffer.h @@ -52,6 +52,9 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QVariant; class QAbstractVideoBufferPrivate; diff --git a/src/multimediakit/video/qabstractvideobuffer_p.h b/src/multimediakit/video/qabstractvideobuffer_p.h index 2d2107e8a..80c37222b 100644 --- a/src/multimediakit/video/qabstractvideobuffer_p.h +++ b/src/multimediakit/video/qabstractvideobuffer_p.h @@ -60,8 +60,13 @@ #include <qtmedianamespace.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QAbstractVideoBufferPrivate { public: @@ -77,4 +82,7 @@ public: QT_END_NAMESPACE +QT_END_HEADER + + #endif diff --git a/src/multimediakit/video/qabstractvideosurface.cpp b/src/multimediakit/video/qabstractvideosurface.cpp index 13c2b25de..62a8acf57 100644 --- a/src/multimediakit/video/qabstractvideosurface.cpp +++ b/src/multimediakit/video/qabstractvideosurface.cpp @@ -61,8 +61,6 @@ Q_DECLARE_METATYPE(QAbstractVideoSurface::Error) A video surface presents a continuous stream of identically formatted frames, where the format of each frame is compatible with a stream format supplied when starting a presentation. - XXX Why do I carE? - The QAbstractVideoSurface class defines the standard interface that video producers use to inter-operate with video presentation surfaces. It is not supposed to be instantiated directly. Instead, you should subclass it to create new video surfaces. @@ -78,8 +76,6 @@ Q_DECLARE_METATYPE(QAbstractVideoSurface::Error) hold a reference to the buffer of a presented video frame until a new frame is presented or streaming is stopped. The stop() function will disable a surface and a release any video buffers it holds references to. - - XXX Example? */ /*! diff --git a/src/multimediakit/video/qabstractvideosurface.h b/src/multimediakit/video/qabstractvideosurface.h index d473a9263..37c4d385f 100644 --- a/src/multimediakit/video/qabstractvideosurface.h +++ b/src/multimediakit/video/qabstractvideosurface.h @@ -49,6 +49,9 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QRectF; class QVideoSurfaceFormat; diff --git a/src/multimediakit/video/qimagevideobuffer_p.h b/src/multimediakit/video/qimagevideobuffer_p.h index 2432f5dcf..dae952ed4 100644 --- a/src/multimediakit/video/qimagevideobuffer_p.h +++ b/src/multimediakit/video/qimagevideobuffer_p.h @@ -55,8 +55,13 @@ #include <qabstractvideobuffer.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QImage; class QImageVideoBufferPrivate; @@ -76,4 +81,7 @@ public: QT_END_NAMESPACE +QT_END_HEADER + + #endif diff --git a/src/multimediakit/video/qmemoryvideobuffer_p.h b/src/multimediakit/video/qmemoryvideobuffer_p.h index 06d7d70cf..d5bc4e3c8 100644 --- a/src/multimediakit/video/qmemoryvideobuffer_p.h +++ b/src/multimediakit/video/qmemoryvideobuffer_p.h @@ -57,8 +57,13 @@ QT_BEGIN_HEADER +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QMemoryVideoBufferPrivate; class Q_MULTIMEDIA_EXPORT QMemoryVideoBuffer : public QAbstractVideoBuffer @@ -78,4 +83,7 @@ QT_END_NAMESPACE QT_END_HEADER + +QT_END_HEADER + #endif diff --git a/src/multimediakit/video/qvideoframe.cpp b/src/multimediakit/video/qvideoframe.cpp index 9286f898f..7c6bbdb11 100644 --- a/src/multimediakit/video/qvideoframe.cpp +++ b/src/multimediakit/video/qvideoframe.cpp @@ -120,8 +120,6 @@ private: A QVideoFrame encapsulates the data of a video frame, and information about the frame. - XXX why do I care - The contents of a video frame can be mapped to memory using the map() function. While mapped, the video data can accessed using the bits() function, which returns a pointer to a buffer. The total size of this buffer is given by the mappedBytes() function, and the size of each line is given @@ -133,8 +131,6 @@ private: \note QVideoFrame is explicitly shared, any change made to video frame will also apply to any copies. - - XXX example */ /*! @@ -343,8 +339,6 @@ QVideoFrame::QVideoFrame(const QImage &image) /*! Constructs a copy of \a other. - XXX reference count - \since 1.0 */ QVideoFrame::QVideoFrame(const QVideoFrame &other) @@ -365,8 +359,6 @@ QVideoFrame &QVideoFrame::operator =(const QVideoFrame &other) /*! Destroys a video frame. - - XXX reference count */ QVideoFrame::~QVideoFrame() { @@ -397,8 +389,6 @@ QVideoFrame::PixelFormat QVideoFrame::pixelFormat() const /*! Returns the type of a video frame's handle. - XXX What about it? - \since 1.0 */ QAbstractVideoBuffer::HandleType QVideoFrame::handleType() const @@ -536,8 +526,6 @@ QAbstractVideoBuffer::MapMode QVideoFrame::mapMode() const Returns true if the buffer was mapped to memory in the given \a mode and false otherwise. - XXX examples and why do I care - \since 1.0 \sa unmap(), mapMode(), bits() */ @@ -581,8 +569,6 @@ void QVideoFrame::unmap() \note This is the bytes per line of the first plane only. The bytes per line of subsequent planes should be calculated as per the frame type. - XXX examples of these calculations - This value is only valid while the frame data is \l {map()}{mapped}. \since 1.0 @@ -643,8 +629,6 @@ int QVideoFrame::mappedBytes() const For an OpenGL texture this would be the texture ID. - XXX Perhaps a table with corresondence - \since 1.0 \sa QAbstractVideoBuffer::handle() */ @@ -674,7 +658,6 @@ void QVideoFrame::setStartTime(qint64 time) /*! Returns the presentation time when a frame should stop being displayed. - XXX example? if start=end what happens? \since 1.0 */ qint64 QVideoFrame::endTime() const diff --git a/src/multimediakit/video/qvideoframe.h b/src/multimediakit/video/qvideoframe.h index 20890b4e8..6dffaf59d 100644 --- a/src/multimediakit/video/qvideoframe.h +++ b/src/multimediakit/video/qvideoframe.h @@ -51,6 +51,8 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + class QSize; class QVariant; diff --git a/src/multimediakit/video/qvideosurfaceformat.cpp b/src/multimediakit/video/qvideosurfaceformat.cpp index da27b5f41..4d198e186 100644 --- a/src/multimediakit/video/qvideosurfaceformat.cpp +++ b/src/multimediakit/video/qvideosurfaceformat.cpp @@ -142,9 +142,6 @@ public: A video surface presents a stream of video frames. The surface's format describes the type of the frames and determines how they should be presented. - XXX Why do I care - XXX why isn't it videostreamformat then? - The core properties of a video stream required to setup a video surface are the pixel format given by pixelFormat(), and the frame dimensions given by frameSize(). diff --git a/src/multimediakit/video/qvideosurfaceformat.h b/src/multimediakit/video/qvideosurfaceformat.h index 3fed1991e..f830b80a6 100644 --- a/src/multimediakit/video/qvideosurfaceformat.h +++ b/src/multimediakit/video/qvideosurfaceformat.h @@ -53,6 +53,9 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +QT_MODULE(Multimedia) + + class QDebug; class QVideoSurfaceFormatPrivate; |