diff options
Diffstat (limited to 'src/imports')
43 files changed, 0 insertions, 8627 deletions
diff --git a/src/imports/imports.pro b/src/imports/imports.pro deleted file mode 100644 index 669064b..0000000 --- a/src/imports/imports.pro +++ /dev/null @@ -1,5 +0,0 @@ - -TEMPLATE = subdirs - -SUBDIRS += multimedia - diff --git a/src/imports/multimedia/multimedia.cpp b/src/imports/multimedia/multimedia.cpp deleted file mode 100644 index deb47c5..0000000 --- a/src/imports/multimedia/multimedia.cpp +++ /dev/null @@ -1,108 +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 <QtDeclarative/qdeclarativeextensionplugin.h> -#include <QtDeclarative/qdeclarative.h> -#include <QtDeclarative/qdeclarativeengine.h> -#include <QtDeclarative/qdeclarativecomponent.h> -#include "qsoundeffect.h" - -#include "qdeclarativemediametadata_p.h" -#include "qdeclarativeaudio_p.h" -#include "qdeclarativevideooutput_p.h" -#include "qdeclarativeradio_p.h" -#include "qdeclarativeradiodata_p.h" -#include "qdeclarativebackgroundaudio_p.h" -#include "qdeclarativecamera_p.h" -#include "qdeclarativecamerapreviewprovider_p.h" -#include "qdeclarativecameraexposure_p.h" -#include "qdeclarativecameraflash_p.h" -#include "qdeclarativecamerafocus_p.h" -#include "qdeclarativecameraimageprocessing_p.h" - - -QML_DECLARE_TYPE(QSoundEffect) - -QT_BEGIN_NAMESPACE - -class QMultimediaDeclarativeModule : public QDeclarativeExtensionPlugin -{ - Q_OBJECT -public: - virtual void registerTypes(const char *uri) - { - Q_ASSERT(QLatin1String(uri) == QLatin1String("QtMultimedia") - || QLatin1String(uri) == QLatin1String("Qt.multimediakit")); - - qmlRegisterType<QSoundEffect>(uri, 4, 0, "SoundEffect"); - qmlRegisterType<QDeclarativeAudio>(uri, 4, 0, "Audio"); - qmlRegisterType<QDeclarativeAudio>(uri, 4, 0, "MediaPlayer"); - qmlRegisterType<QDeclarativeVideoOutput>(uri, 4, 0, "VideoOutput"); - qmlRegisterType<QDeclarativeRadio>(uri, 4, 0, "Radio"); - qmlRegisterType<QDeclarativeRadioData>(uri, 4, 0, "RadioData"); - qmlRegisterType<QDeclarativeBackgroundAudio>(uri, 4, 0, "BackgroundAudio"); - qmlRegisterType<QDeclarativeCamera>(uri, 4, 0, "Camera"); - qmlRegisterUncreatableType<QDeclarativeCameraCapture>(uri, 4, 0, "CameraCapture", - trUtf8("CameraCapture is only provided by Camera element")); - qmlRegisterUncreatableType<QDeclarativeCameraRecorder>(uri, 4, 0, "CameraRecorder", - trUtf8("CameraRecorder is only provided by Camera element")); - qmlRegisterUncreatableType<QDeclarativeCameraExposure>(uri, 4, 0, "CameraExposure", - trUtf8("CameraExposure is only provided by Camera element")); - qmlRegisterUncreatableType<QDeclarativeCameraFocus>(uri, 4, 0, "CameraFocus", - trUtf8("CameraFocus is only provided by Camera element")); - qmlRegisterUncreatableType<QDeclarativeCameraImageProcessing>(uri, 4, 0, "CameraImageProcessing", - trUtf8("CameraImageProcessing is only provided by Camera element")); - qmlRegisterType<QDeclarativeMediaMetaData>(); - } - - void initializeEngine(QDeclarativeEngine *engine, const char *uri) - { - Q_UNUSED(uri); - engine->addImageProvider("camera", new QDeclarativeCameraPreviewProvider); - } -}; - -QT_END_NAMESPACE - -#include "multimedia.moc" - -Q_EXPORT_PLUGIN2(qmultimediadeclarativemodule, QT_PREPEND_NAMESPACE(QMultimediaDeclarativeModule)); - diff --git a/src/imports/multimedia/multimedia.pro b/src/imports/multimedia/multimedia.pro deleted file mode 100644 index d5b6ae5..0000000 --- a/src/imports/multimedia/multimedia.pro +++ /dev/null @@ -1,76 +0,0 @@ -TARGET = declarative_multimedia -TARGETPATH = QtMultimedia - -include(../qimportbase.pri) - -QT += declarative network multimedia-private - -DESTDIR = $$QT.multimedia.imports/$$TARGETPATH -target.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH - -HEADERS += \ - qdeclarativeaudio_p.h \ - qdeclarativemediabase_p.h \ - qdeclarativemediametadata_p.h \ - qdeclarativevideooutput_p.h \ - qsgvideonode_p.h \ - qsgvideonode_i420.h \ - qsgvideonode_rgb.h \ - qdeclarativeradio_p.h \ - qdeclarativeradiodata_p.h \ - qdeclarativebackgroundaudio_p.h \ - qdeclarativecamera_p.h \ - qdeclarativecameracapture_p.h \ - qdeclarativecamerarecorder_p.h \ - qdeclarativecameraexposure_p.h \ - qdeclarativecameraflash_p.h \ - qdeclarativecamerafocus_p.h \ - qdeclarativecameraimageprocessing_p.h \ - qdeclarativecamerapreviewprovider_p.h - -SOURCES += \ - multimedia.cpp \ - qdeclarativeaudio.cpp \ - qdeclarativemediabase.cpp \ - qdeclarativevideooutput.cpp \ - qsgvideonode.cpp \ - qsgvideonode_i420.cpp \ - qsgvideonode_rgb.cpp \ - qdeclarativeradio.cpp \ - qdeclarativeradiodata.cpp \ - qdeclarativebackgroundaudio.cpp \ - qdeclarativecamera.cpp \ - qdeclarativecameracapture.cpp \ - qdeclarativecamerarecorder.cpp \ - qdeclarativecameraexposure.cpp \ - qdeclarativecameraflash.cpp \ - qdeclarativecamerafocus.cpp \ - qdeclarativecameraimageprocessing.cpp \ - qdeclarativecamerapreviewprovider.cpp - -disabled { - HEADERS += \ - qdeclarativevideo_p.h \ - - - SOURCES += \ - qdeclarativevideo.cpp \ - -} - -qmldir.files += $$PWD/qmldir -qmldir.path += $$[QT_INSTALL_IMPORTS]/$$TARGETPATH - -# another copy of the qmldir file so the old import works -OLDQMLDIRFILE = $${_PRO_FILE_PWD_}/qmldir.qtmultimediakit -oldcopy2build.input = OLDQMLDIRFILE -oldcopy2build.output = $$QT.multimedia.imports/Qt/multimediakit/qmldir -!contains(TEMPLATE_PREFIX, vc):oldcopy2build.variable_out = PRE_TARGETDEPS -oldcopy2build.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT} -oldcopy2build.name = COPY ${QMAKE_FILE_IN} -oldcopy2build.CONFIG += no_link -# `clean' should leave the build in a runnable state, which means it shouldn't delete qmldir -oldcopy2build.CONFIG += no_clean -QMAKE_EXTRA_COMPILERS += oldcopy2build - -INSTALLS += target qmldir diff --git a/src/imports/multimedia/qdeclarativeaudio.cpp b/src/imports/multimedia/qdeclarativeaudio.cpp deleted file mode 100644 index c12ef22..0000000 --- a/src/imports/multimedia/qdeclarativeaudio.cpp +++ /dev/null @@ -1,699 +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 "qdeclarativeaudio_p.h" - -#include <qmediaplayercontrol.h> - -QT_BEGIN_NAMESPACE - - -/*! - \qmlclass Audio QDeclarativeAudio - \brief The Audio element allows you to add audio playback to a scene. - - \ingroup qml-multimedia - - This element is part of the \bold{QtMultimedia 4.0} module. - - \qml - import Qt 4.7 - import QtMultimedia 4.0 - - Text { - text: "Click Me!"; - font.pointSize: 24; - width: 150; height: 50; - - Audio { - id: playMusic - source: "music.wav" - } - MouseArea { - id: playArea - anchors.fill: parent - onPressed: { playMusic.play() } - } - } - \endqml - - \sa Video -*/ - -/*! - \internal - \class QDeclarativeAudio - \brief The QDeclarativeAudio class provides an audio item that you can add to a QDeclarativeView. -*/ - -void QDeclarativeAudio::_q_error(int errorCode, const QString &errorString) -{ - m_error = QMediaPlayer::Error(errorCode); - m_errorString = errorString; - - emit error(Error(errorCode), errorString); - emit errorChanged(); -} - - -QDeclarativeAudio::QDeclarativeAudio(QObject *parent) - : QObject(parent) -{ -} - -QDeclarativeAudio::~QDeclarativeAudio() -{ - shutdown(); -} - -/*! - \qmlmethod Audio::play() - - Starts playback of the media. - - Sets the \l playing property to true, and the \l paused property to false. -*/ - -void QDeclarativeAudio::play() -{ - if (!m_complete) - return; - - setPaused(false); - setPlaying(true); -} - -/*! - \qmlmethod Audio::pause() - - Pauses playback of the media. - - Sets the \l playing and \l paused properties to true. -*/ - -void QDeclarativeAudio::pause() -{ - if (!m_complete) - return; - - setPaused(true); - setPlaying(true); -} - -/*! - \qmlmethod Audio::stop() - - Stops playback of the media. - - Sets the \l playing and \l paused properties to false. -*/ - -void QDeclarativeAudio::stop() -{ - if (!m_complete) - return; - - setPlaying(false); - setPaused(false); -} - -/*! - \qmlproperty url Audio::source - - This property holds the source URL of the media. -*/ - -/*! - \qmlproperty url Audio::autoLoad - - This property indicates if loading of media should begin immediately. - - Defaults to true, if false media will not be loaded until playback is started. -*/ - -/*! - \qmlproperty bool Audio::playing - - This property holds whether the media is playing. - - Defaults to false, and can be set to true to start playback. -*/ - -/*! - \qmlproperty bool Audio::paused - - This property holds whether the media is paused. - - Defaults to false, and can be set to true to pause playback. -*/ - -/*! - \qmlsignal Audio::onStarted() - - This handler is called when playback is started. -*/ - -/*! - \qmlsignal Audio::onResumed() - - This handler is called when playback is resumed from the paused state. -*/ - -/*! - \qmlsignal Audio::onPaused() - - This handler is called when playback is paused. -*/ - -/*! - \qmlsignal Audio::onStopped() - - This handler is called when playback is stopped. -*/ - -/*! - \qmlproperty enumeration Audio::status - - This property holds the status of media loading. It can be one of: - - \list - \o NoMedia - no media has been set. - \o Loading - the media is currently being loaded. - \o Loaded - the media has been loaded. - \o Buffering - the media is buffering data. - \o Stalled - playback has been interrupted while the media is buffering data. - \o Buffered - the media has buffered data. - \o EndOfMedia - the media has played to the end. - \o InvalidMedia - the media cannot be played. - \o UnknownStatus - the status of the media is unknown. - \endlist -*/ - -QDeclarativeAudio::Status QDeclarativeAudio::status() const -{ - return Status(m_status); -} - -/*! - \qmlproperty int Audio::duration - - This property holds the duration of the media in milliseconds. - - If the media doesn't have a fixed duration (a live stream for example) this will be 0. -*/ - -/*! - \qmlproperty int Audio::position - - This property holds the current playback position in milliseconds. - - If the \l seekable property is true, this property can be set to seek to a new position. -*/ - -/*! - \qmlproperty real Audio::volume - - This property holds the volume of the audio output, from 0.0 (silent) to 1.0 (maximum volume). -*/ - -/*! - \qmlproperty bool Audio::muted - - This property holds whether the audio output is muted. -*/ - -/*! - \qmlproperty real Audio::bufferProgress - - This property holds how much of the data buffer is currently filled, from 0.0 (empty) to 1.0 - (full). -*/ - -/*! - \qmlproperty bool Audio::seekable - - This property holds whether position of the audio can be changed. - - If true; setting a \l position value will cause playback to seek to the new position. -*/ - -/*! - \qmlproperty real Audio::playbackRate - - This property holds the rate at which audio is played at as a multiple of the normal rate. -*/ - -/*! - \qmlproperty enumeration Audio::error - - This property holds the error state of the audio. It can be one of: - - \list - \o NoError - there is no current error. - \o ResourceError - the audio cannot be played due to a problem allocating resources. - \o FormatError - the audio format is not supported. - \o NetworkError - the audio cannot be played due to network issues. - \o AccessDenied - the audio cannot be played due to insufficient permissions. - \o ServiceMissing - the audio cannot be played because the media service could not be - instantiated. - \endlist -*/ - -QDeclarativeAudio::Error QDeclarativeAudio::error() const -{ - return Error(m_error); -} - -void QDeclarativeAudio::classBegin() -{ - setObject(this); - emit mediaObjectChanged(); -} - -void QDeclarativeAudio::componentComplete() -{ - QDeclarativeMediaBase::componentComplete(); -} - - -/*! - \qmlproperty string Audio::errorString - - This property holds a string describing the current error condition in more detail. -*/ - -/*! - \qmlsignal Audio::onError(error, errorString) - - This handler is called when an \l {QMediaPlayer::Error}{error} has - occurred. The errorString parameter may contain more detailed - information about the error. -*/ - -/*! - \qmlproperty variant Audio::metaData.title - - This property holds the tile of the media. - - \sa {QtMultimedia::Title} -*/ - -/*! - \qmlproperty variant Audio::metaData.subTitle - - This property holds the sub-title of the media. - - \sa {QtMultimedia::SubTitle} -*/ - -/*! - \qmlproperty variant Audio::metaData.author - - This property holds the author of the media. - - \sa {QtMultimedia::Author} -*/ - -/*! - \qmlproperty variant Audio::metaData.comment - - This property holds a user comment about the media. - - \sa {QtMultimedia::Comment} -*/ - -/*! - \qmlproperty variant Audio::metaData.description - - This property holds a description of the media. - - \sa {QtMultimedia::Description} -*/ - -/*! - \qmlproperty variant Audio::metaData.category - - This property holds the category of the media - - \sa {QtMultimedia::Category} -*/ - -/*! - \qmlproperty variant Audio::metaData.genre - - This property holds the genre of the media. - - \sa {QtMultimedia::Genre} -*/ - -/*! - \qmlproperty variant Audio::metaData.year - - This property holds the year of release of the media. - - \sa {QtMultimedia::Year} -*/ - -/*! - \qmlproperty variant Audio::metaData.date - - This property holds the date of the media. - - \sa {QtMultimedia::Date} -*/ - -/*! - \qmlproperty variant Audio::metaData.userRating - - This property holds a user rating of the media in the range of 0 to 100. - - \sa {QtMultimedia::UserRating} -*/ - -/*! - \qmlproperty variant Audio::metaData.keywords - - This property holds a list of keywords describing the media. - - \sa {QtMultimedia::Keywords} -*/ - -/*! - \qmlproperty variant Audio::metaData.language - - This property holds the language of the media, as an ISO 639-2 code. - - \sa {QtMultimedia::Language} -*/ - -/*! - \qmlproperty variant Audio::metaData.publisher - - This property holds the publisher of the media. - - \sa {QtMultimedia::Publisher} -*/ - -/*! - \qmlproperty variant Audio::metaData.copyright - - This property holds the media's copyright notice. - - \sa {QtMultimedia::Copyright} -*/ - -/*! - \qmlproperty variant Audio::metaData.parentalRating - - This property holds the parental rating of the media. - - \sa {QtMultimedia::ParentalRating} -*/ - -/*! - \qmlproperty variant Audio::metaData.ratingOrganisation - - This property holds the name of the rating organisation responsible for the - parental rating of the media. - - \sa {QtMultimedia::RatingOrganisation} -*/ - -/*! - \qmlproperty variant Audio::metaData.size - - This property property holds the size of the media in bytes. - - \sa {QtMultimedia::Size} -*/ - -/*! - \qmlproperty variant Audio::metaData.mediaType - - This property holds the type of the media. - - \sa {QtMultimedia::MediaType} -*/ - -/*! - \qmlproperty variant Audio::metaData.audioBitRate - - This property holds the bit rate of the media's audio stream ni bits per - second. - - \sa {QtMultimedia::AudioBitRate} -*/ - -/*! - \qmlproperty variant Audio::metaData.audioCodec - - This property holds the encoding of the media audio stream. - - \sa {QtMultimedia::AudioCodec} -*/ - -/*! - \qmlproperty variant Audio::metaData.averageLevel - - This property holds the average volume level of the media. - - \sa {QtMultimedia::AverageLevel} -*/ - -/*! - \qmlproperty variant Audio::metaData.channelCount - - This property holds the number of channels in the media's audio stream. - - \sa {QtMultimedia::ChannelCount} -*/ - -/*! - \qmlproperty variant Audio::metaData.peakValue - - This property holds the peak volume of media's audio stream. - - \sa {QtMultimedia::PeakValue} -*/ - -/*! - \qmlproperty variant Audio::metaData.sampleRate - - This property holds the sample rate of the media's audio stream in hertz. - - \sa {QtMultimedia::SampleRate} -*/ - -/*! - \qmlproperty variant Audio::metaData.albumTitle - - This property holds the title of the album the media belongs to. - - \sa {QtMultimedia::AlbumTitle} -*/ - -/*! - \qmlproperty variant Audio::metaData.albumArtist - - This property holds the name of the principal artist of the album the media - belongs to. - - \sa {QtMultimedia::AlbumArtist} -*/ - -/*! - \qmlproperty variant Audio::metaData.contributingArtist - - This property holds the names of artists contributing to the media. - - \sa {QtMultimedia::ContributingArtist} -*/ - -/*! - \qmlproperty variant Audio::metaData.composer - - This property holds the composer of the media. - - \sa {QtMultimedia::Composer} -*/ - -/*! - \qmlproperty variant Audio::metaData.conductor - - This property holds the conductor of the media. - - \sa {QtMultimedia::Conductor} -*/ - -/*! - \qmlproperty variant Audio::metaData.lyrics - - This property holds the lyrics to the media. - - \sa {QtMultimedia::Lyrics} -*/ - -/*! - \qmlproperty variant Audio::metaData.mood - - This property holds the mood of the media. - - \sa {QtMultimedia::Mood} -*/ - -/*! - \qmlproperty variant Audio::metaData.trackNumber - - This property holds the track number of the media. - - \sa {QtMultimedia::TrackNumber} -*/ - -/*! - \qmlproperty variant Audio::metaData.trackCount - - This property holds the number of track on the album containing the media. - - \sa {QtMultimedia::TrackNumber} -*/ - -/*! - \qmlproperty variant Audio::metaData.coverArtUrlSmall - - This property holds the URL of a small cover art image. - - \sa {QtMultimedia::CoverArtUrlSmall} -*/ - -/*! - \qmlproperty variant Audio::metaData.coverArtUrlLarge - - This property holds the URL of a large cover art image. - - \sa {QtMultimedia::CoverArtUrlLarge} -*/ - -/*! - \qmlproperty variant Audio::metaData.resolution - - This property holds the dimension of an image or video. - - \sa {QtMultimedia::Resolution} -*/ - -/*! - \qmlproperty variant Audio::metaData.pixelAspectRatio - - This property holds the pixel aspect ratio of an image or video. - - \sa {QtMultimedia::PixelAspectRatio} -*/ - -/*! - \qmlproperty variant Audio::metaData.videoFrameRate - - This property holds the frame rate of the media's video stream. - - \sa {QtMultimedia::VideoFrameRate} -*/ - -/*! - \qmlproperty variant Audio::metaData.videoBitRate - - This property holds the bit rate of the media's video stream in bits per - second. - - \sa {QtMultimedia::VideoBitRate} -*/ - -/*! - \qmlproperty variant Audio::metaData.videoCodec - - This property holds the encoding of the media's video stream. - - \sa {QtMultimedia::VideoCodec} -*/ - -/*! - \qmlproperty variant Audio::metaData.posterUrl - - This property holds the URL of a poster image. - - \sa {QtMultimedia::PosterUrl} -*/ - -/*! - \qmlproperty variant Audio::metaData.chapterNumber - - This property holds the chapter number of the media. - - \sa {QtMultimedia::ChapterNumber} -*/ - -/*! - \qmlproperty variant Audio::metaData.director - - This property holds the director of the media. - - \sa {QtMultimedia::Director} -*/ - -/*! - \qmlproperty variant Audio::metaData.leadPerformer - - This property holds the lead performer in the media. - - \sa {QtMultimedia::LeadPerformer} -*/ - -/*! - \qmlproperty variant Audio::metaData.writer - - This property holds the writer of the media. - - \sa {QtMultimedia::Writer} -*/ - -QT_END_NAMESPACE - -#include "moc_qdeclarativeaudio_p.cpp" - - diff --git a/src/imports/multimedia/qdeclarativeaudio_p.h b/src/imports/multimedia/qdeclarativeaudio_p.h deleted file mode 100644 index 7c50bf9..0000000 --- a/src/imports/multimedia/qdeclarativeaudio_p.h +++ /dev/null @@ -1,183 +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$ -** -****************************************************************************/ - -#ifndef QDECLARATIVEAUDIO_P_H -#define QDECLARATIVEAUDIO_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QtCore/qbasictimer.h> -#include <QtDeclarative/qdeclarativeparserstatus.h> -#include <QtDeclarative/qdeclarative.h> - -#include "qdeclarativemediabase_p.h" - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QTimerEvent; - -class QDeclarativeAudio : public QObject, public QDeclarativeMediaBase, public QDeclarativeParserStatus -{ - Q_OBJECT - Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) - Q_PROPERTY(bool autoLoad READ isAutoLoad WRITE setAutoLoad NOTIFY autoLoadChanged) - Q_PROPERTY(bool playing READ isPlaying WRITE setPlaying NOTIFY playingChanged) - Q_PROPERTY(int loops READ loopCount WRITE setLoopCount NOTIFY loopCountChanged) - Q_PROPERTY(bool paused READ isPaused WRITE setPaused NOTIFY pausedChanged) - Q_PROPERTY(Status status READ status NOTIFY statusChanged) - Q_PROPERTY(int duration READ duration NOTIFY durationChanged) - Q_PROPERTY(int position READ position WRITE setPosition NOTIFY positionChanged) - Q_PROPERTY(qreal volume READ volume WRITE setVolume NOTIFY volumeChanged) - Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY mutedChanged) - Q_PROPERTY(int bufferProgress READ bufferProgress NOTIFY bufferProgressChanged) - Q_PROPERTY(bool seekable READ isSeekable NOTIFY seekableChanged) - Q_PROPERTY(qreal playbackRate READ playbackRate WRITE setPlaybackRate NOTIFY playbackRateChanged) - Q_PROPERTY(Error error READ error NOTIFY errorChanged) - Q_PROPERTY(QString errorString READ errorString NOTIFY errorChanged) - Q_PROPERTY(QDeclarativeMediaMetaData *metaData READ metaData CONSTANT) - Q_PROPERTY(QObject *mediaObject READ mediaObject NOTIFY mediaObjectChanged SCRIPTABLE false DESIGNABLE false) - Q_ENUMS(Status) - Q_ENUMS(Error) - Q_ENUMS(Loop) - Q_INTERFACES(QDeclarativeParserStatus) -public: - enum Status - { - UnknownStatus = QMediaPlayer::UnknownMediaStatus, - NoMedia = QMediaPlayer::NoMedia, - Loading = QMediaPlayer::LoadingMedia, - Loaded = QMediaPlayer::LoadedMedia, - Stalled = QMediaPlayer::StalledMedia, - Buffering = QMediaPlayer::BufferingMedia, - Buffered = QMediaPlayer::BufferedMedia, - EndOfMedia = QMediaPlayer::EndOfMedia, - InvalidMedia = QMediaPlayer::InvalidMedia - }; - - enum Error - { - NoError = QMediaPlayer::NoError, - ResourceError = QMediaPlayer::ResourceError, - FormatError = QMediaPlayer::FormatError, - NetworkError = QMediaPlayer::NetworkError, - AccessDenied = QMediaPlayer::AccessDeniedError, - ServiceMissing = QMediaPlayer::ServiceMissingError - }; - - enum Loop - { - Infinite = QDeclarativeMediaBase::INFINITE - }; - - QDeclarativeAudio(QObject *parent = 0); - ~QDeclarativeAudio(); - - Status status() const; - Error error() const; - - void classBegin(); - void componentComplete(); - - QObject *mediaObject() { return m_mediaObject; } - -public Q_SLOTS: - void play(); - void pause(); - void stop(); - -Q_SIGNALS: - void sourceChanged(); - void autoLoadChanged(); - void playingChanged(); - void pausedChanged(); - void loopCountChanged(); - - void started(); - void resumed(); - void paused(); - void stopped(); - - void statusChanged(); - - void durationChanged(); - void positionChanged(); - - void volumeChanged(); - void mutedChanged(); - - void bufferProgressChanged(); - - void seekableChanged(); - void playbackRateChanged(); - - void errorChanged(); - void error(QDeclarativeAudio::Error error, const QString &errorString); - - void mediaObjectChanged(); - -private Q_SLOTS: - void _q_error(int, const QString &); - -private: - Q_DISABLE_COPY(QDeclarativeAudio) - Q_PRIVATE_SLOT(mediaBase(), void _q_statusChanged()) - - inline QDeclarativeMediaBase *mediaBase() { return this; } -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeAudio)) - -QT_END_HEADER - -#endif diff --git a/src/imports/multimedia/qdeclarativebackgroundaudio.cpp b/src/imports/multimedia/qdeclarativebackgroundaudio.cpp deleted file mode 100644 index cd163d8..0000000 --- a/src/imports/multimedia/qdeclarativebackgroundaudio.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/**************************************************************************** -** -** 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 "qdeclarativebackgroundaudio_p.h" -#include <qmediabackgroundplaybackcontrol.h> -#include <qmediaservice.h> - -void QDeclarativeBackgroundAudio::classBegin() -{ - setObject(this, Q_MEDIASERVICE_BACKGROUNDMEDIAPLAYER); - if (m_mediaService) { - m_backgroundPlaybackControl = - static_cast<QMediaBackgroundPlaybackControl*>( - m_mediaService->requestControl(QMediaBackgroundPlaybackControl_iid)); - if (m_backgroundPlaybackControl) { - connect(m_backgroundPlaybackControl, SIGNAL(acquired()), this, SIGNAL(acquiredChanged())); - connect(m_backgroundPlaybackControl, SIGNAL(lost()), this, SIGNAL(acquiredChanged())); - } else { - qWarning("can not get QMediaBackgroundPlaybackControl!"); - } - } else { - qWarning("Unable to get any background mediaplayer!"); - } - emit mediaObjectChanged(); - - //Note: we are not calling QDeclarativeAudio::classBegin here, - //otherwise there will be conflict for setObject(). -} - -void QDeclarativeBackgroundAudio::componentComplete() -{ - QDeclarativeAudio::componentComplete(); -} - -QDeclarativeBackgroundAudio::QDeclarativeBackgroundAudio(QObject *parent) - : QDeclarativeAudio(parent) - , m_backgroundPlaybackControl(0) -{ - -} - -QDeclarativeBackgroundAudio::~QDeclarativeBackgroundAudio() -{ - if (m_backgroundPlaybackControl) - m_mediaService->releaseControl(m_backgroundPlaybackControl); -} - -/*! - \qmlproperty string BackgroundAudio::contextId - - This property holds the unique contextId for the application - - When a new contextId is set, the previously set contextId will be released automatically. -*/ -QString QDeclarativeBackgroundAudio::contextId() const -{ - return m_contextId; -} - -void QDeclarativeBackgroundAudio::setContextId(QString contextId) -{ - if (m_contextId == contextId) - return; - m_contextId = contextId; - if (m_backgroundPlaybackControl) - m_backgroundPlaybackControl->setContextId(m_contextId); - emit contextIdChanged(); -} - -/*! - \qmlproperty bool BackgroundAudio::acquired - - This property indicates whether the application holds the playback resource in music daemon -*/ -bool QDeclarativeBackgroundAudio::isAcquired() const -{ - if (!m_backgroundPlaybackControl) - return false; - return m_backgroundPlaybackControl->isAcquired(); -} - -/*! - \qmlmethod BackgroundAudio::acquire() - - try to acquire the playback resource in music daemon -*/ -void QDeclarativeBackgroundAudio::acquire() -{ - if (isAcquired() || !m_backgroundPlaybackControl) - return; - m_backgroundPlaybackControl->acquire(); -} - -/*! - \qmlmethod BackgroundAudio::acquire() - - try to release the playback resource in music daemon -*/ -void QDeclarativeBackgroundAudio::release() -{ - if (!isAcquired() || !m_backgroundPlaybackControl) - return; - m_backgroundPlaybackControl->release(); -} diff --git a/src/imports/multimedia/qdeclarativebackgroundaudio_p.h b/src/imports/multimedia/qdeclarativebackgroundaudio_p.h deleted file mode 100644 index f7f6778..0000000 --- a/src/imports/multimedia/qdeclarativebackgroundaudio_p.h +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ -#ifndef QDECLARATIVEBACKGROUNDAUDIO_P_H -#define QDECLARATIVEBACKGROUNDAUDIO_P_H -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qdeclarativeaudio_p.h" - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QMediaBackgroundPlaybackControl; -class QDeclarativeBackgroundAudio : public QDeclarativeAudio -{ - Q_OBJECT - Q_PROPERTY(QString contextId READ contextId WRITE setContextId NOTIFY contextIdChanged) - Q_PROPERTY(bool acquired READ isAcquired NOTIFY acquiredChanged) -public: - QDeclarativeBackgroundAudio(QObject *parent = 0); - ~QDeclarativeBackgroundAudio(); - - void classBegin(); - void componentComplete(); - - QString contextId() const; - void setContextId(QString contextId); - bool isAcquired() const; - -public Q_SLOTS: - void acquire(); - void release(); - -Q_SIGNALS: - void contextIdChanged(); - void acquiredChanged(); - -private: - Q_DISABLE_COPY(QDeclarativeBackgroundAudio) - QString m_contextId; - QMediaBackgroundPlaybackControl *m_backgroundPlaybackControl; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeBackgroundAudio)) - -QT_END_HEADER - -#endif // QDECLARATIVEBACKGROUNDAUDIO_P_H diff --git a/src/imports/multimedia/qdeclarativecamera.cpp b/src/imports/multimedia/qdeclarativecamera.cpp deleted file mode 100644 index 71b3b06..0000000 --- a/src/imports/multimedia/qdeclarativecamera.cpp +++ /dev/null @@ -1,580 +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 plugins 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 "qdeclarativecamera_p.h" -#include "qdeclarativecamerapreviewprovider_p.h" - -#include "qdeclarativecameraexposure_p.h" -#include "qdeclarativecameraflash_p.h" -#include "qdeclarativecamerafocus_p.h" -#include "qdeclarativecameraimageprocessing_p.h" - -#include <qmediaplayercontrol.h> -#include <qmediaservice.h> -#include <qvideorenderercontrol.h> -#include <QtDeclarative/qdeclarativeinfo.h> - -#include <QtCore/QTimer> -#include <QtGui/qevent.h> - -QT_BEGIN_NAMESPACE - -void QDeclarativeCamera::_q_error(int errorCode, const QString &errorString) -{ - emit error(Error(errorCode), errorString); - emit errorChanged(); -} - -void QDeclarativeCamera::_q_updateState(QCamera::State state) -{ - emit cameraStateChanged(QDeclarativeCamera::State(state)); -} - -/*! - \qmlclass Camera QDeclarativeCamera - \since 4.7 - \brief The Camera element allows you to add camera viewfinder to a scene. - \ingroup qml-multimedia - \inherits Item - - This element is part of the \bold{QtMultimedia 4.0} module. - - \qml - import Qt 4.7 - import QtMultimedia 4.0 - - Camera { - id: camera - - imageProcessing.whiteBalanceMode: CameraImageProcessing.WhiteBalanceFlash - - exposure { - exposureCompensation: -1.0 - exposureMode: Camera.ExposurePortrait - } - - flash.mode: Camera.FlashRedEyeReduction - - onImageCaptured : { - photoPreview.source = preview // Show the preview in an Image element - } - } - - VideoOutput { - source: camera - focus : visible // to receive focus and capture key events when visible - } - - Image { - id: photoPreview - } - \endqml - - You can use the \c Camera element to capture images from a camera, and manipulate the capture and - processing settings that get applied to the image. -*/ - -/*! - \class QDeclarativeCamera - \brief The QDeclarativeCamera class provides a camera item that you can add to a QDeclarativeView. -*/ - -/*! - Construct a declarative camera object using \a parent object. - */ -QDeclarativeCamera::QDeclarativeCamera(QObject *parent) : - QObject(parent), - m_camera(0), - m_pendingState(ActiveState), - m_componentComplete(false) -{ - m_camera = new QCamera(this); - - m_imageCapture = new QDeclarativeCameraCapture(m_camera, this); - m_videoRecorder = new QDeclarativeCameraRecorder(m_camera, this); - m_exposure = new QDeclarativeCameraExposure(m_camera, this); - m_flash = new QDeclarativeCameraFlash(m_camera, this); - m_focus = new QDeclarativeCameraFocus(m_camera, this); - m_imageProcessing = new QDeclarativeCameraImageProcessing(m_camera, this); - - connect(m_camera, SIGNAL(captureModeChanged(QCamera::CaptureMode)), this, SIGNAL(captureModeChanged())); - connect(m_camera, SIGNAL(lockStatusChanged(QCamera::LockStatus,QCamera::LockChangeReason)), this, SIGNAL(lockStatusChanged())); - connect(m_camera, SIGNAL(stateChanged(QCamera::State)), this, SLOT(_q_updateState(QCamera::State))); - - connect(m_camera->focus(), SIGNAL(opticalZoomChanged(qreal)), this, SIGNAL(opticalZoomChanged(qreal))); - connect(m_camera->focus(), SIGNAL(digitalZoomChanged(qreal)), this, SIGNAL(digitalZoomChanged(qreal))); - connect(m_camera->focus(), SIGNAL(maximumOpticalZoomChanged(qreal)), this, SIGNAL(maximumOpticalZoomChanged(qreal))); - connect(m_camera->focus(), SIGNAL(maximumDigitalZoomChanged(qreal)), this, SIGNAL(maximumDigitalZoomChanged(qreal))); -} - -/*! Destructor, clean up memory */ -QDeclarativeCamera::~QDeclarativeCamera() -{ - m_camera->unload(); -} - -void QDeclarativeCamera::classBegin() -{ -} - -void QDeclarativeCamera::componentComplete() -{ - m_componentComplete = true; - setCameraState(m_pendingState); -} - -/*! - Returns any camera error. - \sa QDeclarativeError::Error -*/ -QDeclarativeCamera::Error QDeclarativeCamera::error() const -{ - return QDeclarativeCamera::Error(m_camera->error()); -} - -/*! - \qmlproperty string Camera::errorString - - A description of the current error, if any. -*/ -QString QDeclarativeCamera::errorString() const -{ - return m_camera->errorString(); -} - -QDeclarativeCamera::CaptureMode QDeclarativeCamera::captureMode() const -{ - return QDeclarativeCamera::CaptureMode(m_camera->captureMode()); -} - -void QDeclarativeCamera::setCaptureMode(QDeclarativeCamera::CaptureMode mode) -{ - m_camera->setCaptureMode(QCamera::CaptureMode(mode)); -} - - -/*! - \qmlproperty enumeration Camera::cameraState - - The current state of the camera object. - - \table - \header \o Value \o Description - \row \o UnloadedState - \o The initial camera state, with camera not loaded, - the camera capabilities except of supported capture modes - are unknown. - While the supported settings are unknown in this state, - it's allowed to set the camera capture settings like codec, - resolution, or frame rate. - - \row \o LoadedState - \o The camera is loaded and ready to be configured. - - In the Idle state it's allowed to query camera capabilities, - set capture resolution, codecs, etc. - - The viewfinder is not active in the loaded state. - - \row \o ActiveState - \o In the active state as soon as camera is started - the viewfinder displays video frames and the - camera is ready for capture. - \endtable - - The default camera state is ActiveState. -*/ -/*! - \enum QDeclarativeCamera::State - \value UnloadedState - The initial camera state, with camera not loaded, - the camera capabilities except of supported capture modes - are unknown. - While the supported settings are unknown in this state, - it's allowed to set the camera capture settings like codec, - resolution, or frame rate. - - \value LoadedState - The camera is loaded and ready to be configured. - In the Idle state it's allowed to query camera capabilities, - set capture resolution, codecs, etc. - The viewfinder is not active in the loaded state. - - \value ActiveState - In the active state as soon as camera is started - the viewfinder displays video frames and the - camera is ready for capture. -*/ - -QDeclarativeCamera::State QDeclarativeCamera::cameraState() const -{ - return m_componentComplete ? QDeclarativeCamera::State(m_camera->state()) : m_pendingState; -} - -void QDeclarativeCamera::setCameraState(QDeclarativeCamera::State state) -{ - if (!m_componentComplete) { - m_pendingState = state; - return; - } - - switch (state) { - case QDeclarativeCamera::ActiveState: - m_camera->start(); - break; - case QDeclarativeCamera::UnloadedState: - m_camera->unload(); - break; - case QDeclarativeCamera::LoadedState: - m_camera->load(); - break; - } -} - -/*! - \qmlmethod Camera::start() - \fn QDeclarativeCamera::start() - - Starts the camera. -*/ -void QDeclarativeCamera::start() -{ - setCameraState(QDeclarativeCamera::ActiveState); -} - -/*! - \qmlmethod Camera::stop() - \fn QDeclarativeCamera::stop() - - Stops the camera. -*/ -void QDeclarativeCamera::stop() -{ - setCameraState(QDeclarativeCamera::LoadedState); -} - - -/*! - \qmlproperty enumeration Camera::lockStatus - - The overall status for all the requested camera locks. - - \table - \header \o Value \o Description - \row \o Unlocked - \o The application is not interested in camera settings value. - The camera may keep this parameter without changes, this is common with camera focus, - or adjust exposure and white balance constantly to keep the viewfinder image nice. - - \row \o Searching - \o The application has requested the camera focus, exposure or white balance lock with - searchAndLock(). This state indicates the camera is focusing or calculating exposure and white balance. - - \row \o Locked - \o The camera focus, exposure or white balance is locked. - The camera is ready to capture, application may check the exposure parameters. - - The locked state usually means the requested parameter stays the same, - except in the cases when the parameter is requested to be constantly updated. - For example in continuous focusing mode, the focus is considered locked as long - and the object is in focus, even while the actual focusing distance may be constantly changing. - \endtable -*/ -/*! - \property QDeclarativeCamera::lockStatus - - The overall status for all the requested camera locks. - - \table - \header \o Value \o Description - \row \o Unlocked - \o The application is not interested in camera settings value. - The camera may keep this parameter without changes, this is common with camera focus, - or adjust exposure and white balance constantly to keep the viewfinder image nice. - - \row \o Searching - \o The application has requested the camera focus, exposure or white balance lock with - searchAndLock(). This state indicates the camera is focusing or calculating exposure and white balance. - - \row \o Locked - \o The camera focus, exposure or white balance is locked. - The camera is ready to capture, application may check the exposure parameters. - - The locked state usually means the requested parameter stays the same, - except in the cases when the parameter is requested to be constantly updated. - For example in continuous focusing mode, the focus is considered locked as long - and the object is in focus, even while the actual focusing distance may be constantly changing. - \endtable -*/ -/*! - \enum QDeclarativeCamera::LockStatus - \value Unlocked - The application is not interested in camera settings value. - The camera may keep this parameter without changes, this is common with camera focus, - or adjust exposure and white balance constantly to keep the viewfinder image nice. - - \value Searching - The application has requested the camera focus, exposure or white balance lock with - searchAndLock(). This state indicates the camera is focusing or calculating exposure and white balance. - - \value Locked - The camera focus, exposure or white balance is locked. - The camera is ready to capture, application may check the exposure parameters. - - The locked state usually means the requested parameter stays the same, - except in the cases when the parameter is requested to be constantly updated. - For example in continuous focusing mode, the focus is considered locked as long - and the object is in focus, even while the actual focusing distance may be constantly changing. -*/ -QDeclarativeCamera::LockStatus QDeclarativeCamera::lockStatus() const -{ - return QDeclarativeCamera::LockStatus(m_camera->lockStatus()); -} - -/*! - \qmlmethod Camera::searchAndLock() - \fn QDeclarativeCamera::searchAndLock() - - Start focusing, exposure and white balance calculation. - If the camera has keyboard focus, searchAndLock() is called - automatically when the camera focus button is pressed. -*/ -void QDeclarativeCamera::searchAndLock() -{ - m_camera->searchAndLock(); -} - -/*! - \qmlmethod Camera::unlock() - \fn QDeclarativeCamera::unlock() - - Unlock focus. - - If the camera has keyboard focus, unlock() is called automatically - when the camera focus button is released. - */ -void QDeclarativeCamera::unlock() -{ - m_camera->unlock(); -} - -/*! - \qmlproperty real Camera::maximumOpticalZoom - \property QDeclarativeCamera::maximumOpticalZoom - - The maximum optical zoom factor, or 1.0 if optical zoom is not supported. -*/ -qreal QDeclarativeCamera::maximumOpticalZoom() const -{ - return m_camera->focus()->maximumOpticalZoom(); -} - -/*! - \qmlproperty real Camera::maximumDigitalZoom - \property QDeclarativeCamera::maximumDigitalZoom - - The maximum digital zoom factor, or 1.0 if digital zoom is not supported. -*/ -qreal QDeclarativeCamera::maximumDigitalZoom() const -{ - return m_camera->focus()->maximumDigitalZoom(); -} - -/*! - \qmlproperty real Camera::opticalZoom - \property QDeclarativeCamera::opticalZoom - - The current optical zoom factor. -*/ -qreal QDeclarativeCamera::opticalZoom() const -{ - return m_camera->focus()->opticalZoom(); -} - -void QDeclarativeCamera::setOpticalZoom(qreal value) -{ - m_camera->focus()->zoomTo(value, digitalZoom()); -} - -/*! - \qmlproperty real Camera::digitalZoom - \property QDeclarativeCamera::digitalZoom - - The current digital zoom factor. -*/ -qreal QDeclarativeCamera::digitalZoom() const -{ - return m_camera->focus()->digitalZoom(); -} - -void QDeclarativeCamera::setDigitalZoom(qreal value) -{ - m_camera->focus()->zoomTo(opticalZoom(), value); -} - - -/*! - \qmlsignal Camera::onError(error, errorString) - - - This handler is called when an error occurs. The enumeration value \a error is one of the - values defined below, and a descriptive string value is available in \a errorString. - - \table - \header \o Value \o Description - \row \o NoError \o No errors have occurred. - \row \o CameraError \o An error has occurred. - \row \o InvalidRequestError \o System resource doesn't support requested functionality. - \row \o ServiceMissingError \o No camera service available. - \row \o NotSupportedFeatureError \o The feature is not supported. - \endtable -*/ - -/*! - \fn void QDeclarativeCamera::lockStatusChanged() - - \qmlsignal Camera::lockStatusChanged() -*/ - -/*! - \fn void QDeclarativeCamera::stateChanged(QDeclarativeCamera::State) - - \qmlsignal Camera::stateChanged(Camera::State) -*/ - -/*! - \fn void QDeclarativeCamera::imageCaptured(const QString &) - - \qmlsignal Camera::imageCaptured(string) -*/ - -/*! - \fn void QDeclarativeCamera::imageSaved(const QString &) - - \qmlsignal Camera::imageSaved(string) -*/ - -/*! - \fn void QDeclarativeCamera::error(QDeclarativeCamera::Error , const QString &) - - \qmlsignal Camera::error(Camera::Error, string) -*/ - -/*! - \fn void QDeclarativeCamera::errorChanged() - -*/ -/*! - \qmlsignal Camera::errorChanged() -*/ - -/*! - \fn void QDeclarativeCamera::isoSensitivityChanged(int) -*/ -/*! - \qmlsignal Camera::isoSensitivityChanged(int) -*/ - -/*! - \fn void QDeclarativeCamera::apertureChanged(qreal) - - \qmlsignal Camera::apertureChanged(real) -*/ - -/*! - \fn void QDeclarativeCamera::shutterSpeedChanged(qreal) - -*/ -/*! - \qmlsignal Camera::shutterSpeedChanged(real) -*/ - -/*! - \fn void QDeclarativeCamera::exposureCompensationChanged(qreal) - -*/ -/*! - \qmlsignal Camera::exposureCompensationChanged(real) -*/ - -/*! - \fn void QDeclarativeCamera:opticalZoomChanged(qreal zoom) - - Optical zoom changed to \a zoom. -*/ -/*! - \qmlsignal Camera::opticalZoomChanged(real) -*/ - -/*! - \fn void QDeclarativeCamera::digitalZoomChanged(qreal) - - \qmlsignal Camera::digitalZoomChanged(real) -*/ - -/*! - \fn void QDeclarativeCamera::maximumOpticalZoomChanged(qreal) - - \qmlsignal Camera::maximumOpticalZoomChanged(real) -*/ - -/*! - \fn void QDeclarativeCamera::maximumDigitalZoomChanged(qreal) - - \qmlsignal Camera::maximumDigitalZoomChanged(real) -*/ - - -/*! - \fn void QDeclarativeCamera::captureResolutionChanged(const QSize &) - - \qmlsignal Camera::captureResolutionChanged(Item) -*/ - -/*! - \fn QDeclarativeCamera::cameraStateChanged(QDeclarativeCamera::State) - -*/ - - -QT_END_NAMESPACE - -#include "moc_qdeclarativecamera_p.cpp" diff --git a/src/imports/multimedia/qdeclarativecamera_p.h b/src/imports/multimedia/qdeclarativecamera_p.h deleted file mode 100644 index 7004f7e..0000000 --- a/src/imports/multimedia/qdeclarativecamera_p.h +++ /dev/null @@ -1,276 +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 plugins 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 QDECLARATIVECAMERA_H -#define QDECLARATIVECAMERA_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qdeclarativecameracapture_p.h" -#include "qdeclarativecamerarecorder_p.h" - -#include <qcamera.h> -#include <qcameraimageprocessing.h> -#include <qcameraimagecapture.h> - -#include <QtCore/qbasictimer.h> -#include <QtCore/qdatetime.h> -#include <QtDeclarative/qdeclarative.h> -#include <QtDeclarative/qdeclarativeparserstatus.h> - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QDeclarativeCameraExposure; -class QDeclarativeCameraFocus; -class QDeclarativeCameraFlash; -class QDeclarativeCameraImageProcessing; - -class QDeclarativeCamera : public QObject, public QDeclarativeParserStatus -{ - Q_OBJECT - Q_INTERFACES(QDeclarativeParserStatus) - - Q_PROPERTY(CaptureMode captureMode READ captureMode WRITE setCaptureMode NOTIFY captureModeChanged) - Q_PROPERTY(State cameraState READ cameraState WRITE setCameraState NOTIFY cameraStateChanged) - Q_PROPERTY(LockStatus lockStatus READ lockStatus NOTIFY lockStatusChanged) - Q_PROPERTY(QString errorString READ errorString NOTIFY errorChanged) - - Q_PROPERTY(qreal opticalZoom READ opticalZoom WRITE setOpticalZoom NOTIFY opticalZoomChanged) - Q_PROPERTY(qreal maximumOpticalZoom READ maximumOpticalZoom NOTIFY maximumOpticalZoomChanged) - Q_PROPERTY(qreal digitalZoom READ digitalZoom WRITE setDigitalZoom NOTIFY digitalZoomChanged) - Q_PROPERTY(qreal maximumDigitalZoom READ maximumDigitalZoom NOTIFY maximumDigitalZoomChanged) - - Q_PROPERTY(QObject *mediaObject READ mediaObject NOTIFY mediaObjectChanged SCRIPTABLE false DESIGNABLE false) - Q_PROPERTY(QDeclarativeCameraCapture* imageCapture READ imageCapture CONSTANT) - Q_PROPERTY(QDeclarativeCameraRecorder* videoRecorder READ videoRecorder CONSTANT) - Q_PROPERTY(QDeclarativeCameraExposure* exposure READ exposure CONSTANT) - Q_PROPERTY(QDeclarativeCameraFlash* flash READ flash CONSTANT) - Q_PROPERTY(QDeclarativeCameraFocus* focus READ focus CONSTANT) - Q_PROPERTY(QDeclarativeCameraImageProcessing* imageProcessing READ imageProcessing CONSTANT) - - Q_ENUMS(CaptureMode) - Q_ENUMS(State) - Q_ENUMS(LockStatus) - Q_ENUMS(Error) - - Q_ENUMS(FlashMode) - Q_ENUMS(ExposureMode) - - Q_ENUMS(FocusMode) - Q_ENUMS(FocusPointMode) - Q_ENUMS(FocusAreaStatus) -public: - enum CaptureMode { - CaptureStillImage = QCamera::CaptureStillImage, - CaptureVideo = QCamera::CaptureVideo - }; - - enum State - { - ActiveState = QCamera::ActiveState, - LoadedState = QCamera::LoadedState, - UnloadedState = QCamera::UnloadedState - }; - - enum LockStatus - { - Unlocked = QCamera::Unlocked, - Searching = QCamera::Searching, - Locked = QCamera::Locked - }; - - enum Error - { - NoError = QCamera::NoError, - CameraError = QCamera::CameraError, - InvalidRequestError = QCamera::InvalidRequestError, - ServiceMissingError = QCamera::ServiceMissingError, - NotSupportedFeatureError = QCamera::NotSupportedFeatureError - }; - - enum FlashMode { - FlashAuto = QCameraExposure::FlashAuto, - FlashOff = QCameraExposure::FlashOff, - FlashOn = QCameraExposure::FlashOn, - FlashRedEyeReduction = QCameraExposure::FlashRedEyeReduction, - FlashFill = QCameraExposure::FlashFill, - FlashTorch = QCameraExposure::FlashTorch, - FlashSlowSyncFrontCurtain = QCameraExposure::FlashSlowSyncFrontCurtain, - FlashSlowSyncRearCurtain = QCameraExposure::FlashSlowSyncRearCurtain, - FlashManual = QCameraExposure::FlashManual - }; - - enum ExposureMode { - ExposureAuto = QCameraExposure::ExposureAuto, - ExposureManual = QCameraExposure::ExposureManual, - ExposurePortrait = QCameraExposure::ExposurePortrait, - ExposureNight = QCameraExposure::ExposureNight, - ExposureBacklight = QCameraExposure::ExposureBacklight, - ExposureSpotlight = QCameraExposure::ExposureSpotlight, - ExposureSports = QCameraExposure::ExposureSports, - ExposureSnow = QCameraExposure::ExposureSnow, - ExposureBeach = QCameraExposure::ExposureBeach, - ExposureLargeAperture = QCameraExposure::ExposureLargeAperture, - ExposureSmallAperture = QCameraExposure::ExposureSmallAperture, - ExposureModeVendor = QCameraExposure::ExposureModeVendor - }; - - enum FocusMode { - FocusManual = QCameraFocus::ManualFocus, - FocusHyperfocal = QCameraFocus::HyperfocalFocus, - FocusInfinity = QCameraFocus::InfinityFocus, - FocusAuto = QCameraFocus::AutoFocus, - FocusContinuous = QCameraFocus::ContinuousFocus, - FocusMacro = QCameraFocus::MacroFocus - }; - Q_DECLARE_FLAGS(FocusModes, FocusMode) - - enum FocusPointMode { - FocusPointAuto = QCameraFocus::FocusPointAuto, - FocusPointCenter = QCameraFocus::FocusPointCenter, - FocusPointFaceDetection = QCameraFocus::FocusPointFaceDetection, - FocusPointCustom = QCameraFocus::FocusPointCustom - }; - - enum FocusAreaStatus { - FocusAreaUnused = QCameraFocusZone::Unused, - FocusAreaSelected = QCameraFocusZone::Selected, - FocusAreaFocused = QCameraFocusZone::Focused - }; - - - QDeclarativeCamera(QObject *parent = 0); - ~QDeclarativeCamera(); - - QObject *mediaObject() { return m_camera; } - - QDeclarativeCameraCapture *imageCapture() { return m_imageCapture; } - QDeclarativeCameraRecorder *videoRecorder() { return m_videoRecorder; } - QDeclarativeCameraExposure *exposure() { return m_exposure; } - QDeclarativeCameraFlash *flash() { return m_flash; } - QDeclarativeCameraFocus *focus() { return m_focus; } - QDeclarativeCameraImageProcessing *imageProcessing() { return m_imageProcessing; } - - CaptureMode captureMode() const; - State cameraState() const; - - Error error() const; - QString errorString() const; - - LockStatus lockStatus() const; - - qreal maximumOpticalZoom() const; - qreal maximumDigitalZoom() const; - - qreal opticalZoom() const; - qreal digitalZoom() const; - -public Q_SLOTS: - void setCaptureMode(CaptureMode mode); - - void start(); - void stop(); - - void setCameraState(State state); - - void searchAndLock(); - void unlock(); - - void setOpticalZoom(qreal); - void setDigitalZoom(qreal); - -Q_SIGNALS: - void errorChanged(); - void error(QDeclarativeCamera::Error error, const QString &errorString); - - void captureModeChanged(); - void cameraStateChanged(QDeclarativeCamera::State); - - void lockStatusChanged(); - - void opticalZoomChanged(qreal); - void digitalZoomChanged(qreal); - void maximumOpticalZoomChanged(qreal); - void maximumDigitalZoomChanged(qreal); - - void mediaObjectChanged(); - -private Q_SLOTS: - void _q_updateState(QCamera::State); - void _q_error(int, const QString &); - -protected: - void classBegin(); - void componentComplete(); - -private: - Q_DISABLE_COPY(QDeclarativeCamera) - QCamera *m_camera; - - QDeclarativeCameraCapture *m_imageCapture; - QDeclarativeCameraRecorder *m_videoRecorder; - QDeclarativeCameraExposure *m_exposure; - QDeclarativeCameraFlash *m_flash; - QDeclarativeCameraFocus *m_focus; - QDeclarativeCameraImageProcessing *m_imageProcessing; - - State m_pendingState; - bool m_componentComplete; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeCamera)) - -QT_END_HEADER - -#endif diff --git a/src/imports/multimedia/qdeclarativecameracapture.cpp b/src/imports/multimedia/qdeclarativecameracapture.cpp deleted file mode 100644 index c3d16bb..0000000 --- a/src/imports/multimedia/qdeclarativecameracapture.cpp +++ /dev/null @@ -1,233 +0,0 @@ -/**************************************************************************** -** -** 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 plugins 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 "qdeclarativecamera_p.h" -#include "qdeclarativecameracapture_p.h" -#include "qdeclarativecamerapreviewprovider_p.h" - -#include <QtCore/qurl.h> - -QT_BEGIN_NAMESPACE - -QDeclarativeCameraCapture::QDeclarativeCameraCapture(QCamera *camera, QObject *parent) : - QObject(parent), - m_camera(camera) -{ - m_capture = new QCameraImageCapture(camera, this); - - connect(m_capture, SIGNAL(readyForCaptureChanged(bool)), this, SIGNAL(readyForCaptureChanged(bool))); - connect(m_capture, SIGNAL(imageExposed(int)), this, SIGNAL(imageExposed())); - connect(m_capture, SIGNAL(imageCaptured(int,QImage)), this, SLOT(_q_imageCaptured(int, QImage))); - connect(m_capture, SIGNAL(imageMetadataAvailable(int,QString,QVariant)), this, - SLOT(_q_imageMetadataAvailable(int,QString,QVariant))); - connect(m_capture, SIGNAL(imageSaved(int,QString)), this, SLOT(_q_imageSaved(int, QString))); - connect(m_capture, SIGNAL(error(int,QCameraImageCapture::Error,QString)), - this, SLOT(_q_captureFailed(int,QCameraImageCapture::Error,QString))); -} - -QDeclarativeCameraCapture::~QDeclarativeCameraCapture() -{ -} - -/*! - \qmlproperty string CameraCapture::ready - \property QDeclarativeCameraCapture::ready - - Indicates camera is ready to capture photo. -*/ -bool QDeclarativeCameraCapture::isReadyForCapture() const -{ - return m_capture->isReadyForCapture(); -} - -/*! - \qmlmethod CameraCapture::capture() - \fn QDeclarativeCameraCapture::capture() - - Start image capture. The \l onImageCaptured() and \l onImageSaved() signals will - be emitted when the capture is complete. -*/ -void QDeclarativeCameraCapture::capture() -{ - m_capture->capture(); -} - -/*! - \qmlmethod CameraCapture::captureToLocation() - \fn QDeclarativeCameraCapture::captureToLocation() - - Start image capture to specified \a location. The \l onImageCaptured() and \l onImageSaved() signals will - be emitted when the capture is complete. -*/ -void QDeclarativeCameraCapture::captureToLocation(const QString &location) -{ - m_capture->capture(location); -} - -/*! - \qmlmethod CameraCapture::cancelCapture() - \fn QDeclarativeCameraCapture::cancelCapture() - - Cancel pendig image capture requests. -*/ - -void QDeclarativeCameraCapture::cancelCapture() -{ - m_capture->cancelCapture(); -} - -/*! - \qmlproperty string CameraCapture::capturedImagePath - \property QDeclarativeCameraCapture::capturedImagePath - - The path to the captured image. -*/ -QString QDeclarativeCameraCapture::capturedImagePath() const -{ - return m_capturedImagePath; -} - -void QDeclarativeCameraCapture::_q_imageCaptured(int id, const QImage &preview) -{ - QString previewId = QString("preview_%1").arg(id); - QDeclarativeCameraPreviewProvider::registerPreview(previewId, preview); - - emit imageCaptured(QLatin1String("image://camera/")+previewId); -} - -void QDeclarativeCameraCapture::_q_imageSaved(int id, const QString &fileName) -{ - Q_UNUSED(id); - m_capturedImagePath = fileName; - emit imageSaved(fileName); -} - -void QDeclarativeCameraCapture::_q_imageMetadataAvailable(int id, const QString &key, const QVariant &value) -{ - Q_UNUSED(id); - emit imageMetadataAvailable(key, value); -} - - -void QDeclarativeCameraCapture::_q_captureFailed(int id, QCameraImageCapture::Error error, const QString &message) -{ - Q_UNUSED(id); - Q_UNUSED(error); - qWarning() << "QCameraImageCapture error:" << message; - emit captureFailed(message); -} - -/*! - \qmlproperty size CameraCapture::resolution - \property QDeclarativeCameraCapture::resolution - - The resolution to capture the image at. If empty, the system will pick - a good size. -*/ - -QSize QDeclarativeCameraCapture::resolution() -{ - return m_imageSettings.resolution(); -} - -void QDeclarativeCameraCapture::setResolution(const QSize &captureResolution) -{ - if (captureResolution != resolution()) { - m_imageSettings.setResolution(captureResolution); - m_capture->setEncodingSettings(m_imageSettings); - emit resolutionChanged(captureResolution); - } -} - -QCameraImageCapture::Error QDeclarativeCameraCapture::error() const -{ - return m_capture->error(); -} - - -/*! - \qmlproperty size CameraCapture::errorString - \property QDeclarativeCameraCapture::errorString - - The last capture related error message. -*/ -QString QDeclarativeCameraCapture::errorString() const -{ - return m_capture->errorString(); -} - -void QDeclarativeCameraCapture::setMetadata(const QString &key, const QVariant &value) -{ - Q_UNUSED(key); - Q_UNUSED(value); - //m_capture->setExtendedMetaData(key, value); -} - -/*! - \qmlsignal CameraCapture::onCaptureFailed(message) - \fn QDeclarativeCameraCapture::captureFailed(const QString &message) - - This handler is called when an error occurs during capture. A descriptive message is available in \a message. -*/ - -/*! - \qmlsignal CameraCapture::onImageCaptured(preview) - \fn QDeclarativeCameraCapture::imageCaptured(const QString &preview) - - This handler is called when an image has been captured but not yet saved to the filesystem. The \a preview - parameter can be used as the URL supplied to an Image element. - - \sa onImageSaved -*/ - -/*! - \qmlsignal CameraCapture::onImageSaved(path) - \fn QDeclarativeCameraCapture::imageSaved(const QString &path) - - This handler is called after the image has been written to the filesystem. The \a path is a local file path, not a URL. - - \sa onImageCaptured -*/ - - -QT_END_NAMESPACE - -#include "moc_qdeclarativecameracapture_p.cpp" diff --git a/src/imports/multimedia/qdeclarativecameracapture_p.h b/src/imports/multimedia/qdeclarativecameracapture_p.h deleted file mode 100644 index 6effa74..0000000 --- a/src/imports/multimedia/qdeclarativecameracapture_p.h +++ /dev/null @@ -1,128 +0,0 @@ -/**************************************************************************** -** -** 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 plugins 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 QDECLARATIVECAMERACAPTURE_H -#define QDECLARATIVECAMERACAPTURE_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <qcamera.h> -#include <qcameraimagecapture.h> -#include <qmediaencodersettings.h> - -#include <QtDeclarative/qdeclarative.h> - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QDeclarativeCamera; - -class QDeclarativeCameraCapture : public QObject -{ - Q_OBJECT - Q_PROPERTY(bool ready READ isReadyForCapture NOTIFY readyForCaptureChanged) - Q_PROPERTY(QString capturedImagePath READ capturedImagePath NOTIFY imageSaved) - Q_PROPERTY(QSize resolution READ resolution WRITE setResolution NOTIFY resolutionChanged) - Q_PROPERTY(QString errorString READ errorString NOTIFY captureFailed) - -public: - ~QDeclarativeCameraCapture(); - - bool isReadyForCapture() const; - - QSize resolution(); - - QString capturedImagePath() const; - QCameraImageCapture::Error error() const; - QString errorString() const; - -public Q_SLOTS: - void capture(); - void captureToLocation(const QString &location); - void cancelCapture(); - - void setResolution(const QSize &resolution); - void setMetadata(const QString &key, const QVariant &value); - -Q_SIGNALS: - void readyForCaptureChanged(bool); - - void imageExposed(); - void imageCaptured(const QString &preview); - void imageMetadataAvailable(const QString &key, const QVariant &value); - void imageSaved(const QString &path); - void captureFailed(const QString &message); - - void resolutionChanged(const QSize &); - -private slots: - void _q_imageCaptured(int, const QImage&); - void _q_imageSaved(int, const QString&); - void _q_imageMetadataAvailable(int, const QString &, const QVariant &); - void _q_captureFailed(int, QCameraImageCapture::Error, const QString&); - -private: - friend class QDeclarativeCamera; - QDeclarativeCameraCapture(QCamera *camera, QObject *parent = 0); - - QCamera *m_camera; - QCameraImageCapture *m_capture; - QImageEncoderSettings m_imageSettings; - QString m_capturedImagePath; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeCameraCapture)) - -QT_END_HEADER - -#endif diff --git a/src/imports/multimedia/qdeclarativecameraexposure.cpp b/src/imports/multimedia/qdeclarativecameraexposure.cpp deleted file mode 100644 index 2dc9224..0000000 --- a/src/imports/multimedia/qdeclarativecameraexposure.cpp +++ /dev/null @@ -1,260 +0,0 @@ -/**************************************************************************** -** -** 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 plugins 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 "qdeclarativecamera_p.h" -#include "qdeclarativecameraexposure_p.h" - -QT_BEGIN_NAMESPACE - -/*! - \qmlclass CameraExposure QDeclarativeCameraExposure - \since 4.0 - \brief The CameraExposure element provides interface for exposure related camera settings. - \ingroup qml-multimedia - - This element is part of the \bold{QtMultimedia 4.0} module. - - It should not be constructed separately but provided by Camera.exposure. - - \qml - import QtQuick 2.0 - import QtMultimedia 4.0 - - Camera { - id: camera - - exposure.exposureCompensation: -1.0 - exposure.exposureMode: Camera.ExposurePortrait - } - - \endqml -*/ - -/*! - \class QDeclarativeCameraExposure - \brief The CameraExposure element provides interface for exposure related camera settings. -*/ - -/*! - Construct a declarative camera exposure object using \a parent object. - */ -QDeclarativeCameraExposure::QDeclarativeCameraExposure(QCamera *camera, QObject *parent) : - QObject(parent) -{ - m_exposure = camera->exposure(); - - connect(m_exposure, SIGNAL(isoSensitivityChanged(int)), this, SIGNAL(isoSensitivityChanged(int))); - connect(m_exposure, SIGNAL(apertureChanged(qreal)), this, SIGNAL(apertureChanged(qreal))); - connect(m_exposure, SIGNAL(shutterSpeedChanged(qreal)), this, SIGNAL(shutterSpeedChanged(qreal))); - - connect(m_exposure, SIGNAL(exposureCompensationChanged(qreal)), this, SIGNAL(exposureCompensationChanged(qreal))); -} - -QDeclarativeCameraExposure::~QDeclarativeCameraExposure() -{ -} - -/*! - \qmlproperty real CameraExposure::exposureCompensation - \property QDeclarativeCameraExposure::exposureCompensation - - Adjustment for the automatically calculated exposure. The value is - in EV units. - */ -qreal QDeclarativeCameraExposure::exposureCompensation() const -{ - return m_exposure->exposureCompensation(); -} - -void QDeclarativeCameraExposure::setExposureCompensation(qreal ev) -{ - m_exposure->setExposureCompensation(ev); -} - -/*! - \qmlproperty real CameraExposure::isoSensitivity - \property QDeclarativeCameraExposure::iso - - The sensor's ISO sensitivity. - */ -int QDeclarativeCameraExposure::isoSensitivity() const -{ - return m_exposure->isoSensitivity(); -} - -/*! - \qmlproperty real CameraExposure::shutterSpeed - \property QDeclarativeCameraExposure::shutterSpeed - - The camera's shutter speed, in seconds. -*/ -qreal QDeclarativeCameraExposure::shutterSpeed() const -{ - return m_exposure->shutterSpeed(); -} - -/*! - \qmlproperty real CameraExposure::aperture - \property QDeclarativeCameraExposure::aperture - - The lens aperture as an F number (the ratio of the focal length to effective aperture diameter). -*/ -qreal QDeclarativeCameraExposure::aperture() const -{ - return m_exposure->aperture(); -} - -int QDeclarativeCameraExposure::manualIsoSensitivity() const -{ - return m_manualIso; -} - -void QDeclarativeCameraExposure::setManualIsoSensitivity(int iso) -{ - m_manualIso = iso; - if (iso > 0) - m_exposure->setManualIsoSensitivity(iso); - else - m_exposure->setAutoIsoSensitivity(); - - emit manualIsoSensitivityChanged(iso); -} - -qreal QDeclarativeCameraExposure::manualShutterSpeed() const -{ - return m_manualShutterSpeed; -} - -void QDeclarativeCameraExposure::setManualShutterSpeed(qreal speed) -{ - m_manualShutterSpeed = speed; - if (speed > 0) - m_exposure->setManualShutterSpeed(speed); - else - m_exposure->setAutoShutterSpeed(); - - emit manualShutterSpeedChanged(speed); -} - -qreal QDeclarativeCameraExposure::manualAperture() const -{ - return m_manualAperture; -} - -void QDeclarativeCameraExposure::setManualAperture(qreal aperture) -{ - m_manualAperture = aperture; - if (aperture > 0) - m_exposure->setManualAperture(aperture); - else - m_exposure->setAutoAperture(); - - emit manualApertureChanged(aperture); -} - -/*! - Turn on auto aperture. The manual aperture value is reset to -1.0 - */ -void QDeclarativeCameraExposure::setAutoAperture() -{ - setManualAperture(-1.0); -} - -/*! - Turn on auto shutter speed. The manual shutter speed value is reset to -1.0 - */ -void QDeclarativeCameraExposure::setAutoShutterSpeed() -{ - setManualShutterSpeed(-1.0); -} - -/*! - Turn on auto ISO sensitivity. The manual ISO value is reset to -1. - */ -void QDeclarativeCameraExposure::setAutoIsoSensitivity() -{ - setManualIsoSensitivity(-1); -} - -/*! - \qmlproperty enumeration CameraExposure::exposureMode - \property QDeclarativeCameraExposure::exposureMode - - \table - \header \o Value \o Description - \row \o Camera.ExposureManual \o Manual mode. - \row \o Camera.ExposureAuto \o Automatic mode. - \row \o Camera.ExposureNight \o Night mode. - \row \o Camera.ExposureBacklight \o Backlight exposure mode. - \row \o Camera.ExposureSpotlight \o Spotlight exposure mode. - \row \o Camera.ExposureSports \o Spots exposure mode. - \row \o Camera.ExposureSnow \o Snow exposure mode. - \row \o Camera.ExposureBeach \o Beach exposure mode. - \row \o Camera.ExposureLargeAperture \o Use larger aperture with small depth of field. - \row \o Camera.ExposureSmallAperture \o Use smaller aperture. - \row \o Camera.ExposurePortrait \o Portrait exposure mode. - \row \o Camera.ExposureModeVendor \o The base value for device specific exposure modes. - \endtable -*/ - -QDeclarativeCamera::ExposureMode QDeclarativeCameraExposure::exposureMode() const -{ - return QDeclarativeCamera::ExposureMode(m_exposure->exposureMode()); -} - -void QDeclarativeCameraExposure::setExposureMode(QDeclarativeCamera::ExposureMode mode) -{ - if (exposureMode() != mode) { - m_exposure->setExposureMode(QCameraExposure::ExposureMode(mode)); - emit exposureModeChanged(exposureMode()); - } -} - -/*! - \qmlsignal CameraExposure::exposureModeChanged(CameraExposure::ExposureMode) - \fn void QDeclarativeCameraExposure::exposureModeChanged(QDeclarativeCamera::ExposureMode) -*/ - - - -QT_END_NAMESPACE - -#include "moc_qdeclarativecameraexposure_p.cpp" diff --git a/src/imports/multimedia/qdeclarativecameraexposure_p.h b/src/imports/multimedia/qdeclarativecameraexposure_p.h deleted file mode 100644 index 677d963..0000000 --- a/src/imports/multimedia/qdeclarativecameraexposure_p.h +++ /dev/null @@ -1,135 +0,0 @@ -/**************************************************************************** -** -** 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 plugins 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 QDECLARATIVECAMERAEXPOSURE_H -#define QDECLARATIVECAMERAEXPOSURE_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qdeclarativecamera_p.h" -#include <qcamera.h> -#include <qcameraexposure.h> - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QDeclarativeCamera; - -class QDeclarativeCameraExposure : public QObject -{ - Q_OBJECT - Q_PROPERTY(qreal exposureCompensation READ exposureCompensation WRITE setExposureCompensation NOTIFY exposureCompensationChanged) - - Q_PROPERTY(int iso READ isoSensitivity NOTIFY isoSensitivityChanged) - Q_PROPERTY(qreal shutterSpeed READ shutterSpeed NOTIFY shutterSpeedChanged) - Q_PROPERTY(qreal aperture READ aperture NOTIFY apertureChanged) - - Q_PROPERTY(qreal manualShutterSpeed READ manualShutterSpeed WRITE setManualShutterSpeed NOTIFY manualShutterSpeedChanged) - Q_PROPERTY(qreal manualAperture READ manualAperture WRITE setManualAperture NOTIFY manualApertureChanged) - Q_PROPERTY(qreal manualIso READ manualIsoSensitivity WRITE setManualIsoSensitivity NOTIFY manualIsoSensitivityChanged) - - Q_PROPERTY(QDeclarativeCamera::ExposureMode exposureMode READ exposureMode WRITE setExposureMode NOTIFY exposureModeChanged) - -public: - ~QDeclarativeCameraExposure(); - - QDeclarativeCamera::ExposureMode exposureMode() const; - qreal exposureCompensation() const; - - int isoSensitivity() const; - qreal shutterSpeed() const; - qreal aperture() const; - - int manualIsoSensitivity() const; - qreal manualShutterSpeed() const; - qreal manualAperture() const; - -public Q_SLOTS: - void setExposureMode(QDeclarativeCamera::ExposureMode); - void setExposureCompensation(qreal ev); - - void setManualAperture(qreal); - void setManualShutterSpeed(qreal); - void setManualIsoSensitivity(int iso); - - void setAutoAperture(); - void setAutoShutterSpeed(); - void setAutoIsoSensitivity(); - -Q_SIGNALS: - void isoSensitivityChanged(int); - void apertureChanged(qreal); - void shutterSpeedChanged(qreal); - - void manualIsoSensitivityChanged(int); - void manualApertureChanged(qreal); - void manualShutterSpeedChanged(qreal); - - void exposureCompensationChanged(qreal); - void exposureModeChanged(QDeclarativeCamera::ExposureMode); - -private: - friend class QDeclarativeCamera; - QDeclarativeCameraExposure(QCamera *camera, QObject *parent = 0); - - QCameraExposure *m_exposure; - int m_manualIso; - qreal m_manualAperture; - qreal m_manualShutterSpeed; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeCameraExposure)) - -QT_END_HEADER - -#endif diff --git a/src/imports/multimedia/qdeclarativecameraflash.cpp b/src/imports/multimedia/qdeclarativecameraflash.cpp deleted file mode 100644 index 13f21d6..0000000 --- a/src/imports/multimedia/qdeclarativecameraflash.cpp +++ /dev/null @@ -1,148 +0,0 @@ -/**************************************************************************** -** -** 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 plugins 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 "qdeclarativecamera_p.h" -#include "qdeclarativecameraflash_p.h" - -QT_BEGIN_NAMESPACE - -/*! - \qmlclass CameraFlash QDeclarativeCameraFlash - \since 4.0 - \brief The CameraFlash element provides interface for flash related camera settings. - \ingroup qml-multimedia - - This element is part of the \bold{QtMultimedia 4.0} module. - - It should not be constructed separately but provided by Camera.flash. - - \qml - import QtQuick 2.0 - import QtMultimedia 4.0 - - Camera { - id: camera - - exposure.exposureCompensation: -1.0 - flash.mode: Camera.FlashRedEyeReduction - } - - \endqml -*/ - -/*! - \class QDeclarativeCameraFlash - \internal - \brief The CameraFlash element provides interface for flash related camera settings. -*/ - -/*! - Construct a declarative camera flash object using \a parent object. - */ -QDeclarativeCameraFlash::QDeclarativeCameraFlash(QCamera *camera, QObject *parent) : - QObject(parent) -{ - m_exposure = camera->exposure(); - connect(m_exposure, SIGNAL(flashReady(bool)), this, SIGNAL(flashReady(bool))); -} - -QDeclarativeCameraFlash::~QDeclarativeCameraFlash() -{ -} - -/*! - \qmlproperty bool QDeclarativeCameraFlash::ready - \property bool QDeclarativeCameraFlash::ready - - Indicates flash is charged. -*/ -bool QDeclarativeCameraFlash::isFlashReady() const -{ - return m_exposure->isFlashReady(); -} - -/*! - \qmlproperty enumeration CameraExposure::flashMode - \property QDeclarativeCameraFlash::flashMode - - \table - \header \o Value \o Description - \row \o Camera.FlashOff \o Flash is Off. - \row \o Camera.FlashOn \o Flash is On. - \row \o Camera.FlashAuto \o Automatic flash. - \row \o Camera.FlashRedEyeReduction \o Red eye reduction flash. - \row \o Camera.FlashFill \o Use flash to fillin shadows. - \row \o Camera.FlashTorch \o Constant light source, useful for focusing and video capture. - \row \o Camera.FlashSlowSyncFrontCurtain - \o Use the flash in conjunction with a slow shutter speed. - This mode allows better exposure of distant objects and/or motion blur effect. - \row \o Camera.FlashSlowSyncRearCurtain - \o The similar mode to FlashSlowSyncFrontCurtain but flash is fired at the end of exposure. - \row \o Camera.FlashManual \o Flash power is manually set. - \endtable - -*/ -int QDeclarativeCameraFlash::flashMode() const -{ - return m_exposure->flashMode(); -} - -void QDeclarativeCameraFlash::setFlashMode(int mode) -{ - if (m_exposure->flashMode() != mode) { - m_exposure->setFlashMode(QCameraExposure::FlashModes(mode)); - emit flashModeChanged(mode); - } -} - -/*! - \qmlsignal CameraExposure::flashModeChanged(int) - \fn void QDeclarativeCameraFlash::flashModeChanged(int) -*/ - -/*! - \qmlsignal CameraExposure::flashReady(bool) - \fn void QDeclarativeCameraFlash::flashReady(bool) -*/ - -QT_END_NAMESPACE - -#include "moc_qdeclarativecameraflash_p.cpp" diff --git a/src/imports/multimedia/qdeclarativecameraflash_p.h b/src/imports/multimedia/qdeclarativecameraflash_p.h deleted file mode 100644 index 893c77d..0000000 --- a/src/imports/multimedia/qdeclarativecameraflash_p.h +++ /dev/null @@ -1,96 +0,0 @@ -/**************************************************************************** -** -** 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 plugins 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 QDECLARATIVECAMERAFLASH_H -#define QDECLARATIVECAMERAFLASH_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <qcamera.h> -#include <qcameraexposure.h> - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QDeclarativeCamera; - -class QDeclarativeCameraFlash : public QObject -{ - Q_OBJECT - Q_PROPERTY(bool ready READ isFlashReady NOTIFY flashReady) - Q_PROPERTY(int mode READ flashMode WRITE setFlashMode NOTIFY flashModeChanged) -public: - ~QDeclarativeCameraFlash(); - - int flashMode() const; - bool isFlashReady() const; - -public Q_SLOTS: - void setFlashMode(int); - -Q_SIGNALS: - void flashReady(bool status); - void flashModeChanged(int); - -private: - friend class QDeclarativeCamera; - QDeclarativeCameraFlash(QCamera *camera, QObject *parent = 0); - - QCameraExposure *m_exposure; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeCameraFlash)) - -QT_END_HEADER - -#endif diff --git a/src/imports/multimedia/qdeclarativecamerafocus.cpp b/src/imports/multimedia/qdeclarativecamerafocus.cpp deleted file mode 100644 index 03460bf..0000000 --- a/src/imports/multimedia/qdeclarativecamerafocus.cpp +++ /dev/null @@ -1,259 +0,0 @@ -/**************************************************************************** -** -** 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 plugins 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 "qdeclarativecamera_p.h" -#include "qdeclarativecamerafocus_p.h" - -QT_BEGIN_NAMESPACE - -/*! - \qmlclass CameraFocus QDeclarativeCameraFocus - \since 4.0 - \brief The CameraFocus element provides interface for focus related camera settings. - \ingroup qml-multimedia - - This element is part of the \bold{QtMultimedia 4.0} module. - - It should not be constructed separately but provided by Camera.focus. - - \qml - import QtQuick 2.0 - import QtMultimedia 4.0 - - Camera { - id: camera - - focus { - focusMode: Camera.FocusMacro - focusPointMode: Camera.FocusPointCustom - customFocusPoint: Qt.point(0.2, 0.2) //focus to top-left corner - } - } - - \endqml -*/ - -/*! - \class QDeclarativeCameraFocus - \brief The CameraFocus element provides interface for focus related camera settings. -*/ - -/*! - Construct a declarative camera focus object using \a parent object. - */ - -QDeclarativeCameraFocus::QDeclarativeCameraFocus(QCamera *camera, QObject *parent) : - QObject(parent) -{ - m_focus = camera->focus(); - m_focusZones = new FocusZonesModel(this); - - updateFocusZones(); - - connect(m_focus, SIGNAL(focusZonesChanged()), SLOT(updateFocusZones())); -} - -QDeclarativeCameraFocus::~QDeclarativeCameraFocus() -{ -} - - -/*! - \qmlproperty Camera::FocusModes CameraFocus::focusMode - \property QDeclarativeCameraFocus::focusMode - - The current camera focus mode. - - It's possible to combine multiple Camera::FocusMode values, - for example Camera.FocusMacro + Camera.FocusContinuous. -*/ -QDeclarativeCamera::FocusModes QDeclarativeCameraFocus::focusMode() const -{ - return QDeclarativeCamera::FocusModes(m_focus->focusMode()); -} - -bool QDeclarativeCameraFocus::isFocusModeSupported(QDeclarativeCamera::FocusModes mode) const -{ - return m_focus->isFocusModeSupported(QCameraFocus::FocusMode(int(mode))); -} - -void QDeclarativeCameraFocus::setFocusMode(QDeclarativeCamera::FocusModes mode) -{ - m_focus->setFocusMode(QCameraFocus::FocusMode(int(mode))); -} - -/*! - \qmlproperty CameraFocus::FocusPointMode CameraFocus::focusPointMode - \property QDeclarativeCameraFocus::focusPointMode - - The current camera focus point mode. -*/ -QDeclarativeCamera::FocusPointMode QDeclarativeCameraFocus::focusPointMode() const -{ - return QDeclarativeCamera::FocusPointMode(m_focus->focusPointMode()); -} - -void QDeclarativeCameraFocus::setFocusPointMode(QDeclarativeCamera::FocusPointMode mode) -{ - if (mode != focusPointMode()) { - m_focus->setFocusPointMode(QCameraFocus::FocusPointMode(mode)); - emit focusPointModeChanged(focusPointMode()); - } -} - -bool QDeclarativeCameraFocus::isFocusPointModeSupported(QDeclarativeCamera::FocusPointMode mode) const -{ - return m_focus->isFocusPointModeSupported(QCameraFocus::FocusPointMode(mode)); -} - -/*! - \qmlproperty QPointF CameraFocus::customFocusPoint - \property QDeclarativeCameraFocus::customFocusPoint - - Position of custom focus point, in relative frame coordinates: - QPointF(0,0) points to the left top frame point, QPointF(0.5,0.5) points to the frame center. - - Custom focus point is used only in FocusPointCustom focus mode. -*/ - -QPointF QDeclarativeCameraFocus::customFocusPoint() const -{ - return m_focus->customFocusPoint(); -} - -void QDeclarativeCameraFocus::setCustomFocusPoint(const QPointF &point) -{ - if (point != customFocusPoint()) { - m_focus->setCustomFocusPoint(point); - emit customFocusPointChanged(customFocusPoint()); - } -} - -/*! - \qmlproperty QPointF CameraFocus::focusZones - \property QDeclarativeCameraFocus::focusZones - - List of current camera focus zones, - each including area specified in the same coordinates as \l customFocusPoint - and zone status. - - \qml - - VideoOutput { - id: viewfinder - source: camera - - //display focus areas on camera viewfinder: - Repeater { - model: camera.focus.focusZones - - Rectangle { - border { - width: 2 - color: status == CameraFocus.Focused ? "green" : "white" - } - color: "transparent" - - x: area.x * viewfinder.width - y: area.y * viewfinder.height - width: area.width * viewfinder.width - height: area.height * viewfinder.height - } - } - } - \endqml -*/ - -QAbstractListModel *QDeclarativeCameraFocus::focusZones() const -{ - return m_focusZones; -} - -/*! \internal */ -void QDeclarativeCameraFocus::updateFocusZones() -{ - m_focusZones->setFocusZones(m_focus->focusZones()); -} - - -FocusZonesModel::FocusZonesModel(QObject *parent) - :QAbstractListModel(parent) -{ - QHash<int, QByteArray> roles; - roles[StatusRole] = "status"; - roles[AreaRole] = "area"; - setRoleNames(roles); -} - -int FocusZonesModel::rowCount(const QModelIndex &parent) const -{ - if (parent == QModelIndex()) - return m_focusZones.count(); - - return 0; -} - -QVariant FocusZonesModel::data(const QModelIndex &index, int role) const -{ - if (index.row() < 0 || index.row() > m_focusZones.count()) - return QVariant(); - - QCameraFocusZone zone = m_focusZones.value(index.row()); - - if (role == StatusRole) - return zone.status(); - - if (role == AreaRole) - return zone.area(); - - return QVariant(); -} - -void FocusZonesModel::setFocusZones(const QCameraFocusZoneList &zones) -{ - beginResetModel(); - m_focusZones = zones; - endResetModel(); -} - -QT_END_NAMESPACE - -#include "moc_qdeclarativecamerafocus_p.cpp" diff --git a/src/imports/multimedia/qdeclarativecamerafocus_p.h b/src/imports/multimedia/qdeclarativecamerafocus_p.h deleted file mode 100644 index f6dd872..0000000 --- a/src/imports/multimedia/qdeclarativecamerafocus_p.h +++ /dev/null @@ -1,136 +0,0 @@ -/**************************************************************************** -** -** 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 plugins 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 QDECLARATIVECAMERAFOCUS_H -#define QDECLARATIVECAMERAFOCUS_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QtCore/qabstractitemmodel.h> -#include <qcamera.h> -#include <qcamerafocus.h> -#include "qdeclarativecamera_p.h" - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class FocusZonesModel; -class QDeclarativeCamera; - -class QDeclarativeCameraFocus : public QObject -{ - Q_OBJECT - Q_PROPERTY(QDeclarativeCamera::FocusModes focusMode READ focusMode WRITE setFocusMode NOTIFY focusModeChanged) - Q_PROPERTY(QDeclarativeCamera::FocusPointMode focusPointMode READ focusPointMode WRITE setFocusPointMode NOTIFY focusPointModeChanged) - Q_PROPERTY(QPointF customFocusPoint READ customFocusPoint WRITE setCustomFocusPoint NOTIFY customFocusPointChanged) - Q_PROPERTY(QObject *focusZones READ focusZones CONSTANT) -public: - ~QDeclarativeCameraFocus(); - - QDeclarativeCamera::FocusModes focusMode() const; - QDeclarativeCamera::FocusPointMode focusPointMode() const; - QPointF customFocusPoint() const; - - QAbstractListModel *focusZones() const; - - Q_INVOKABLE bool isFocusModeSupported(QDeclarativeCamera::FocusModes mode) const; - Q_INVOKABLE bool isFocusPointModeSupported(QDeclarativeCamera::FocusPointMode) const; - -public Q_SLOTS: - void setFocusMode(QDeclarativeCamera::FocusModes); - void setFocusPointMode(QDeclarativeCamera::FocusPointMode mode); - void setCustomFocusPoint(const QPointF &point); - -Q_SIGNALS: - void focusModeChanged(QDeclarativeCamera::FocusModes); - void focusPointModeChanged(QDeclarativeCamera::FocusPointMode); - void customFocusPointChanged(const QPointF &); - -private Q_SLOTS: - void updateFocusZones(); - -private: - friend class QDeclarativeCamera; - QDeclarativeCameraFocus(QCamera *camera, QObject *parent = 0); - - QCameraFocus *m_focus; - FocusZonesModel *m_focusZones; -}; - -class FocusZonesModel : public QAbstractListModel -{ -Q_OBJECT -public: - enum FocusZoneRoles { - StatusRole = Qt::UserRole + 1, - AreaRole - }; - - FocusZonesModel(QObject *parent = 0); - - int rowCount(const QModelIndex &parent = QModelIndex()) const; - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; - -public slots: - void setFocusZones(const QCameraFocusZoneList &zones); - -private: - QCameraFocusZoneList m_focusZones; -}; - - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeCameraFocus)) - -QT_END_HEADER - -#endif diff --git a/src/imports/multimedia/qdeclarativecameraimageprocessing.cpp b/src/imports/multimedia/qdeclarativecameraimageprocessing.cpp deleted file mode 100644 index 75e942d..0000000 --- a/src/imports/multimedia/qdeclarativecameraimageprocessing.cpp +++ /dev/null @@ -1,204 +0,0 @@ -/**************************************************************************** -** -** 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 plugins 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 "qdeclarativecamera_p.h" -#include "qdeclarativecameraimageprocessing_p.h" - -QT_BEGIN_NAMESPACE - -QDeclarativeCameraImageProcessing::QDeclarativeCameraImageProcessing(QCamera *camera, QObject *parent) : - QObject(parent) -{ - m_imageProcessing = camera->imageProcessing(); -} - -QDeclarativeCameraImageProcessing::~QDeclarativeCameraImageProcessing() -{ -} - -/*! - \qmlproperty enumeration CameraImageProcessing::whiteBalanceMode - - \table - \header \o Value \o Description - \row \o WhiteBalanceManual \o Manual white balance. In this mode the manual white balance property value is used. - \row \o WhiteBalanceAuto \o Auto white balance mode. - \row \o WhiteBalanceSunlight \o Sunlight white balance mode. - \row \o WhiteBalanceCloudy \o Cloudy white balance mode. - \row \o WhiteBalanceShade \o Shade white balance mode. - \row \o WhiteBalanceTungsten \o Tungsten white balance mode. - \row \o WhiteBalanceFluorescent \o Fluorescent white balance mode. - \row \o WhiteBalanceFlash \o Flash white balance mode. - \row \o WhiteBalanceSunset \o Sunset white balance mode. - \row \o WhiteBalanceVendor \o Vendor defined white balance mode. - \endtable - - \sa manualWhiteBalance -*/ -/*! - \property QDeclarativeCameraImageProcessing::whiteBalanceMode - - \sa WhiteBalanceMode -*/ -QDeclarativeCameraImageProcessing::WhiteBalanceMode QDeclarativeCameraImageProcessing::whiteBalanceMode() const -{ - return WhiteBalanceMode(m_imageProcessing->whiteBalanceMode()); -} - -void QDeclarativeCameraImageProcessing::setWhiteBalanceMode(QDeclarativeCameraImageProcessing::WhiteBalanceMode mode) const -{ - if (whiteBalanceMode() != mode) { - m_imageProcessing->setWhiteBalanceMode(QCameraImageProcessing::WhiteBalanceMode(mode)); - emit whiteBalanceModeChanged(whiteBalanceMode()); - } -} - -/*! - \qmlproperty int CameraImageProcessing::manualWhiteBalance - - The color temperature used when in manual white balance mode (WhiteBalanceManual). - - \sa whiteBalanceMode -*/ -int QDeclarativeCameraImageProcessing::manualWhiteBalance() const -{ - return m_imageProcessing->manualWhiteBalance(); -} - -void QDeclarativeCameraImageProcessing::setManualWhiteBalance(int colorTemp) const -{ - if (manualWhiteBalance() != colorTemp) { - m_imageProcessing->setManualWhiteBalance(colorTemp); - emit manualWhiteBalanceChanged(manualWhiteBalance()); - } -} - -/*! - \qmlproperty int CameraImageProcessing::contrast - - Image contrast. - Valid contrast values range between -100 and 100, the default is 0. -*/ -int QDeclarativeCameraImageProcessing::contrast() const -{ - return m_imageProcessing->contrast(); -} - -void QDeclarativeCameraImageProcessing::setContrast(int value) -{ - if (value != contrast()) { - m_imageProcessing->setContrast(value); - emit contrastChanged(contrast()); - } -} - -/*! - \qmlproperty int CameraImageProcessing::saturation - - Image saturation. - Valid saturation values range between -100 and 100, the default is 0. -*/ -int QDeclarativeCameraImageProcessing::saturation() const -{ - return m_imageProcessing->saturation(); -} - -void QDeclarativeCameraImageProcessing::setSaturation(int value) -{ - if (value != saturation()) { - m_imageProcessing->setSaturation(value); - emit saturationChanged(saturation()); - } -} - -/*! - \qmlproperty int CameraImageProcessing::sharpeningLevel - - Level of sharpening applied to image. - - Valid sharpening level values range between -1 for default sharpening level, - 0 for sharpening disabled and 100 for maximum sharpening applied. -*/ -int QDeclarativeCameraImageProcessing::sharpeningLevel() const -{ - return m_imageProcessing->sharpeningLevel(); -} - -void QDeclarativeCameraImageProcessing::setSharpeningLevel(int value) -{ - if (value != sharpeningLevel()) { - m_imageProcessing->setSharpeningLevel(value); - emit sharpeningLevelChanged(sharpeningLevel()); - } -} - -/*! - \qmlproperty int CameraImageProcessing::denoisingLevel - - Level of denoising applied to image. - - Valid denoising level values range between -1 for default denoising level, - 0 for denoising disabled and 100 for maximum denoising applied. -*/ -int QDeclarativeCameraImageProcessing::denoisingLevel() const -{ - return m_imageProcessing->denoisingLevel(); -} - -void QDeclarativeCameraImageProcessing::setDenoisingLevel(int value) -{ - if (value != denoisingLevel()) { - m_imageProcessing->setDenoisingLevel(value); - emit denoisingLevelChanged(denoisingLevel()); - } -} - -/*! - \qmlsignal Camera::whiteBalanceModeChanged(Camera::WhiteBalanceMode) -*/ - -/*! - \qmlsignal Camera::manualWhiteBalanceChanged(int) -*/ - -QT_END_NAMESPACE - -#include "moc_qdeclarativecameraimageprocessing_p.cpp" diff --git a/src/imports/multimedia/qdeclarativecameraimageprocessing_p.h b/src/imports/multimedia/qdeclarativecameraimageprocessing_p.h deleted file mode 100644 index b861835..0000000 --- a/src/imports/multimedia/qdeclarativecameraimageprocessing_p.h +++ /dev/null @@ -1,132 +0,0 @@ -/**************************************************************************** -** -** 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 plugins 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 QDECLARATIVECAMERAIMAGEPROCESSING_H -#define QDECLARATIVECAMERAIMAGEPROCESSING_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <qcamera.h> -#include <qcameraimageprocessing.h> - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QDeclarativeCamera; - -class QDeclarativeCameraImageProcessing : public QObject -{ - Q_OBJECT - Q_ENUMS(WhiteBalanceMode) - - Q_PROPERTY(WhiteBalanceMode whiteBalanceMode READ whiteBalanceMode WRITE setWhiteBalanceMode NOTIFY whiteBalanceModeChanged) - Q_PROPERTY(int manualWhiteBalance READ manualWhiteBalance WRITE setManualWhiteBalance NOTIFY manualWhiteBalanceChanged) - Q_PROPERTY(int contrast READ contrast WRITE setContrast NOTIFY contrastChanged) - Q_PROPERTY(int saturation READ saturation WRITE setSaturation NOTIFY saturationChanged) - Q_PROPERTY(int sharpeningLevel READ sharpeningLevel WRITE setSharpeningLevel NOTIFY sharpeningLevelChanged) - Q_PROPERTY(int denoisingLevel READ denoisingLevel WRITE setDenoisingLevel NOTIFY denoisingLevelChanged) - -public: - enum WhiteBalanceMode { - WhiteBalanceAuto = QCameraImageProcessing::WhiteBalanceAuto, - WhiteBalanceManual = QCameraImageProcessing::WhiteBalanceManual, - WhiteBalanceSunlight = QCameraImageProcessing::WhiteBalanceSunlight, - WhiteBalanceCloudy = QCameraImageProcessing::WhiteBalanceCloudy, - WhiteBalanceShade = QCameraImageProcessing::WhiteBalanceShade, - WhiteBalanceTungsten = QCameraImageProcessing::WhiteBalanceTungsten, - WhiteBalanceFluorescent = QCameraImageProcessing::WhiteBalanceFluorescent, - WhiteBalanceFlash = QCameraImageProcessing::WhiteBalanceFlash, - WhiteBalanceSunset = QCameraImageProcessing::WhiteBalanceSunset, - WhiteBalanceVendor = QCameraImageProcessing::WhiteBalanceVendor - }; - - ~QDeclarativeCameraImageProcessing(); - - WhiteBalanceMode whiteBalanceMode() const; - int manualWhiteBalance() const; - - int contrast() const; - int saturation() const; - int sharpeningLevel() const; - int denoisingLevel() const; - -public Q_SLOTS: - void setWhiteBalanceMode(QDeclarativeCameraImageProcessing::WhiteBalanceMode mode) const; - void setManualWhiteBalance(int colorTemp) const; - - void setContrast(int value); - void setSaturation(int value); - void setSharpeningLevel(int value); - void setDenoisingLevel(int value); - -Q_SIGNALS: - void whiteBalanceModeChanged(QDeclarativeCameraImageProcessing::WhiteBalanceMode) const; - void manualWhiteBalanceChanged(int) const; - - void contrastChanged(int); - void saturationChanged(int); - void sharpeningLevelChanged(int); - void denoisingLevelChanged(int); - -private: - friend class QDeclarativeCamera; - QDeclarativeCameraImageProcessing(QCamera *camera, QObject *parent = 0); - - QCameraImageProcessing *m_imageProcessing; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeCameraImageProcessing)) - -QT_END_HEADER - -#endif diff --git a/src/imports/multimedia/qdeclarativecamerapreviewprovider.cpp b/src/imports/multimedia/qdeclarativecamerapreviewprovider.cpp deleted file mode 100644 index 16d528b..0000000 --- a/src/imports/multimedia/qdeclarativecamerapreviewprovider.cpp +++ /dev/null @@ -1,97 +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 plugins 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 "qdeclarativecamerapreviewprovider_p.h" -#include <QtCore/qmutex.h> -#include <QtCore/qdebug.h> - -QT_BEGIN_NAMESPACE - -struct QDeclarativeCameraPreviewProviderPrivate -{ - QString id; - QImage image; - QMutex mutex; -}; - -Q_GLOBAL_STATIC(QDeclarativeCameraPreviewProviderPrivate, qDeclarativeCameraPreviewProviderPrivate) - -QDeclarativeCameraPreviewProvider::QDeclarativeCameraPreviewProvider() -: QDeclarativeImageProvider(QDeclarativeImageProvider::Image) -{ -} - -QDeclarativeCameraPreviewProvider::~QDeclarativeCameraPreviewProvider() -{ - QDeclarativeCameraPreviewProviderPrivate *d = qDeclarativeCameraPreviewProviderPrivate(); - QMutexLocker lock(&d->mutex); - d->id.clear(); - d->image = QImage(); -} - -QImage QDeclarativeCameraPreviewProvider::requestImage(const QString &id, QSize *size, const QSize& requestedSize) -{ - QDeclarativeCameraPreviewProviderPrivate *d = qDeclarativeCameraPreviewProviderPrivate(); - QMutexLocker lock(&d->mutex); - - if (d->id != id) - return QImage(); - - QImage res = d->image; - if (!requestedSize.isEmpty()) - res = res.scaled(requestedSize, Qt::KeepAspectRatio, Qt::SmoothTransformation); - - if (size) - *size = res.size(); - - return res; -} - -void QDeclarativeCameraPreviewProvider::registerPreview(const QString &id, const QImage &preview) -{ - //only the last preview is kept - QDeclarativeCameraPreviewProviderPrivate *d = qDeclarativeCameraPreviewProviderPrivate(); - QMutexLocker lock(&d->mutex); - d->id = id; - d->image = preview; -} - -QT_END_NAMESPACE diff --git a/src/imports/multimedia/qdeclarativecamerapreviewprovider_p.h b/src/imports/multimedia/qdeclarativecamerapreviewprovider_p.h deleted file mode 100644 index 8f5ecc0..0000000 --- a/src/imports/multimedia/qdeclarativecamerapreviewprovider_p.h +++ /dev/null @@ -1,76 +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 plugins 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 QDECLARATIVECAMERAPREVIEWPROVIDER_H -#define QDECLARATIVECAMERAPREVIEWPROVIDER_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QtDeclarative/qdeclarativeimageprovider.h> - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QDeclarativeCameraPreviewProvider : public QDeclarativeImageProvider -{ -public: - QDeclarativeCameraPreviewProvider(); - ~QDeclarativeCameraPreviewProvider(); - - virtual QImage requestImage(const QString &id, QSize *size, const QSize& requestedSize); - static void registerPreview(const QString &id, const QImage &preview); -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif diff --git a/src/imports/multimedia/qdeclarativecamerarecorder.cpp b/src/imports/multimedia/qdeclarativecamerarecorder.cpp deleted file mode 100644 index 7328b04..0000000 --- a/src/imports/multimedia/qdeclarativecamerarecorder.cpp +++ /dev/null @@ -1,226 +0,0 @@ -/**************************************************************************** -** -** 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 plugins 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 "qdeclarativecamera_p.h" -#include "qdeclarativecamerarecorder_p.h" - -#include <QtCore/qurl.h> - -QT_BEGIN_NAMESPACE - -QDeclarativeCameraRecorder::QDeclarativeCameraRecorder(QCamera *camera, QObject *parent) : - QObject(parent) -{ - m_recorder = new QMediaRecorder(camera, this); - connect(m_recorder, SIGNAL(stateChanged(QMediaRecorder::State)), - SLOT(updateRecorderState(QMediaRecorder::State))); - connect(m_recorder, SIGNAL(error(QMediaRecorder::Error)), - SLOT(updateRecorderError(QMediaRecorder::Error))); - connect(m_recorder, SIGNAL(mutedChanged(bool)), SIGNAL(mutedChanged(bool))); - connect(m_recorder, SIGNAL(durationChanged(qint64)), SIGNAL(durationChanged(qint64))); -} - -QDeclarativeCameraRecorder::~QDeclarativeCameraRecorder() -{ -} - -QSize QDeclarativeCameraRecorder::captureResolution() -{ - return m_videoSettings.resolution(); -} - -QString QDeclarativeCameraRecorder::audioCodec() const -{ - return m_audioSettings.codec(); -} - -QString QDeclarativeCameraRecorder::videoCodec() const -{ - return m_videoSettings.codec(); -} - -QString QDeclarativeCameraRecorder::mediaContainer() const -{ - return m_mediaContainer; -} - -void QDeclarativeCameraRecorder::setCaptureResolution(const QSize &resolution) -{ - if (resolution != captureResolution()) { - m_videoSettings.setResolution(resolution); - applySettings(); - emit captureResolutionChanged(resolution); - } -} - -void QDeclarativeCameraRecorder::setAudioCodec(const QString &codec) -{ - if (codec != audioCodec()) { - m_audioSettings.setCodec(codec); - applySettings(); - emit audioCodecChanged(codec); - } -} - -void QDeclarativeCameraRecorder::setVideoCodec(const QString &codec) -{ - if (codec != videoCodec()) { - m_videoSettings.setCodec(codec); - applySettings(); - emit videoCodecChanged(codec); - } -} - -void QDeclarativeCameraRecorder::setMediaContainer(const QString &container) -{ - if (container != m_mediaContainer) { - m_mediaContainer = container; - applySettings(); - emit mediaContainerChanged(container); - } -} - -void QDeclarativeCameraRecorder::applySettings() -{ - m_recorder->setEncodingSettings(m_audioSettings, - m_videoSettings, - m_mediaContainer); -} - -QMediaRecorder::Error QDeclarativeCameraRecorder::error() const -{ - return m_recorder->error(); -} - -QString QDeclarativeCameraRecorder::errorString() const -{ - return m_recorder->errorString(); -} - -QDeclarativeCameraRecorder::RecorderState QDeclarativeCameraRecorder::recorderState() const -{ - //paused state is not supported for camera - QMediaRecorder::State state = m_recorder->state(); - - if (state == QMediaRecorder::PausedState) - state = QMediaRecorder::StoppedState; - - return RecorderState(state); -} - -void QDeclarativeCameraRecorder::record() -{ - setRecorderState(RecordingState); -} - -void QDeclarativeCameraRecorder::stop() -{ - setRecorderState(StoppedState); -} - -void QDeclarativeCameraRecorder::setRecorderState(QDeclarativeCameraRecorder::RecorderState state) -{ - if (!m_recorder) - return; - - switch (state) { - case QDeclarativeCameraRecorder::RecordingState: - m_recorder->record(); - break; - case QDeclarativeCameraRecorder::StoppedState: - m_recorder->stop(); - break; - } -} - -QString QDeclarativeCameraRecorder::outputLocation() const -{ - return m_recorder->outputLocation().toString(); -} - -void QDeclarativeCameraRecorder::setOutputLocation(const QUrl &location) -{ - m_recorder->setOutputLocation(location); -} - -qint64 QDeclarativeCameraRecorder::duration() const -{ - return m_recorder->duration(); -} - -bool QDeclarativeCameraRecorder::isMuted() const -{ - return m_recorder->isMuted(); -} - -void QDeclarativeCameraRecorder::setMuted(bool muted) -{ - m_recorder->setMuted(muted); -} - -void QDeclarativeCameraRecorder::setMetadata(const QString &key, const QVariant &value) -{ - m_recorder->setExtendedMetaData(key, value); -} - -void QDeclarativeCameraRecorder::updateRecorderState(QMediaRecorder::State state) -{ - if (state == QMediaRecorder::PausedState) - state = QMediaRecorder::StoppedState; - - if (state == QMediaRecorder::StoppedState) { - QString location = outputLocation(); - if (!location.isEmpty()) - emit outputLocationChanged(location); - } - - emit recorderStateChanged(RecorderState(state)); -} - -void QDeclarativeCameraRecorder::updateRecorderError(QMediaRecorder::Error errorCode) -{ - qWarning() << "QMediaRecorder error:" << errorString(); - emit error(errorCode); -} - -QT_END_NAMESPACE - -#include "moc_qdeclarativecamerarecorder_p.cpp" diff --git a/src/imports/multimedia/qdeclarativecamerarecorder_p.h b/src/imports/multimedia/qdeclarativecamerarecorder_p.h deleted file mode 100644 index 9164af9..0000000 --- a/src/imports/multimedia/qdeclarativecamerarecorder_p.h +++ /dev/null @@ -1,162 +0,0 @@ -/**************************************************************************** -** -** 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 plugins 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 QDECLARATIVECAMERARECORDER_H -#define QDECLARATIVECAMERARECORDER_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <qcamera.h> -#include <qmediarecorder.h> -#include <qmediaencodersettings.h> - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QDeclarativeCamera; - -class QDeclarativeCameraRecorder : public QObject -{ - Q_OBJECT - Q_ENUMS(RecorderState) - - Q_PROPERTY(RecorderState recorderState READ recorderState WRITE setRecorderState NOTIFY recorderStateChanged) - Q_PROPERTY(QSize resolution READ captureResolution WRITE setCaptureResolution NOTIFY captureResolutionChanged) - - Q_PROPERTY(QString videoCodec READ videoCodec WRITE setVideoCodec NOTIFY videoCodecChanged) - Q_PROPERTY(QString audioCodec READ audioCodec WRITE setAudioCodec NOTIFY audioCodecChanged) - Q_PROPERTY(QString mediaContainer READ mediaContainer WRITE setMediaContainer NOTIFY mediaContainerChanged) - - Q_PROPERTY(qint64 duration READ duration NOTIFY durationChanged) - Q_PROPERTY(QString outputLocation READ outputLocation WRITE setOutputLocation NOTIFY outputLocationChanged) - Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY mutedChanged) - Q_PROPERTY(QString errorString READ errorString NOTIFY error) - -public: - enum RecorderState - { - StoppedState = QMediaRecorder::StoppedState, - RecordingState = QMediaRecorder::RecordingState - }; - - ~QDeclarativeCameraRecorder(); - - RecorderState recorderState() const; - - QSize captureResolution(); - - QString outputLocation() const; - qint64 duration() const; - bool isMuted() const; - - QString audioCodec() const; - QString videoCodec() const; - QString mediaContainer() const; - - QMediaRecorder::Error error() const; - QString errorString() const; - -public Q_SLOTS: - void setOutputLocation(const QUrl &location); - - void record(); - void stop(); - void setRecorderState(QDeclarativeCameraRecorder::RecorderState state); - - void setMuted(bool muted); - void setMetadata(const QString &key, const QVariant &value); - - void setCaptureResolution(const QSize &resolution); - void setAudioCodec(const QString &codec); - void setVideoCodec(const QString &codec); - void setMediaContainer(const QString &container); - -Q_SIGNALS: - void recorderStateChanged(QDeclarativeCameraRecorder::RecorderState state); - void durationChanged(qint64 duration); - void mutedChanged(bool muted); - void outputLocationChanged(const QString &location); - - void error(QMediaRecorder::Error errorCode); - - void metaDataAvailableChanged(bool available); - void metaDataWritableChanged(bool writable); - void metaDataChanged(); - - void captureResolutionChanged(const QSize &); - void audioCodecChanged(const QString &codec); - void videoCodecChanged(const QString &codec); - void mediaContainerChanged(const QString &container); - -private slots: - void updateRecorderState(QMediaRecorder::State); - void updateRecorderError(QMediaRecorder::Error); - -private: - friend class QDeclarativeCamera; - QDeclarativeCameraRecorder(QCamera *camera, QObject *parent = 0); - - void applySettings(); - - QMediaRecorder *m_recorder; - - QAudioEncoderSettings m_audioSettings; - QVideoEncoderSettings m_videoSettings; - QString m_mediaContainer; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeCameraRecorder)) - -QT_END_HEADER - -#endif diff --git a/src/imports/multimedia/qdeclarativemediabase.cpp b/src/imports/multimedia/qdeclarativemediabase.cpp deleted file mode 100644 index b206862..0000000 --- a/src/imports/multimedia/qdeclarativemediabase.cpp +++ /dev/null @@ -1,571 +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 "qdeclarativemediabase_p.h" - -#include <QtCore/qcoreevent.h> -#include <QtCore/qurl.h> -#include <QtDeclarative/qdeclarativeinfo.h> - -#include <qmediaplayercontrol.h> -#include <qmediaservice.h> -#include <qmediaserviceprovider.h> -#include <qmetadatareadercontrol.h> - -#include "qdeclarativemediametadata_p.h" - -QT_BEGIN_NAMESPACE - - -class QDeclarativeMediaBaseObject : public QMediaObject -{ -public: - QDeclarativeMediaBaseObject(QMediaService *service) - : QMediaObject(0, service) - { - } -}; - -class QDeclarativeMediaBasePlayerControl : public QMediaPlayerControl -{ -public: - QDeclarativeMediaBasePlayerControl(QObject *parent) - : QMediaPlayerControl(parent) - { - } - - QMediaPlayer::State state() const { return QMediaPlayer::StoppedState; } - QMediaPlayer::MediaStatus mediaStatus() const { return QMediaPlayer::NoMedia; } - - qint64 duration() const { return 0; } - qint64 position() const { return 0; } - void setPosition(qint64) {} - int volume() const { return 0; } - void setVolume(int) {} - bool isMuted() const { return false; } - void setMuted(bool) {} - int bufferStatus() const { return 0; } - bool isAudioAvailable() const { return false; } - bool isVideoAvailable() const { return false; } - bool isSeekable() const { return false; } - QMediaTimeRange availablePlaybackRanges() const { return QMediaTimeRange(); } - qreal playbackRate() const { return 1; } - void setPlaybackRate(qreal) {} - QMediaContent media() const { return QMediaContent(); } - const QIODevice *mediaStream() const { return 0; } - void setMedia(const QMediaContent &, QIODevice *) {} - - void play() {} - void pause() {} - void stop() {} -}; - - -class QDeclarativeMediaBaseMetaDataControl : public QMetaDataReaderControl -{ -public: - QDeclarativeMediaBaseMetaDataControl(QObject *parent) - : QMetaDataReaderControl(parent) - { - } - - bool isMetaDataAvailable() const { return false; } - - QVariant metaData(QtMultimedia::MetaData) const { return QVariant(); } - QList<QtMultimedia::MetaData> availableMetaData() const { - return QList<QtMultimedia::MetaData>(); } - - QVariant extendedMetaData(const QString &) const { return QVariant(); } - QStringList availableExtendedMetaData() const { return QStringList(); } -}; - -class QDeclarativeMediaBaseAnimation : public QObject -{ -public: - QDeclarativeMediaBaseAnimation(QDeclarativeMediaBase *media) - : m_media(media) - { - } - - void start() { if (!m_timer.isActive()) m_timer.start(500, this); } - void stop() { m_timer.stop(); } - -protected: - void timerEvent(QTimerEvent *event) - { - if (event->timerId() == m_timer.timerId()) { - event->accept(); - - if (m_media->m_playing && !m_media->m_paused) - emit m_media->positionChanged(); - if (m_media->m_status == QMediaPlayer::BufferingMedia || QMediaPlayer::StalledMedia) - emit m_media->bufferProgressChanged(); - } else { - QObject::timerEvent(event); - } - } - -private: - QDeclarativeMediaBase *m_media; - QBasicTimer m_timer; -}; - -void QDeclarativeMediaBase::_q_statusChanged() -{ - if (m_playerControl->mediaStatus() == QMediaPlayer::EndOfMedia && m_runningCount != 0) { - m_runningCount -= 1; - m_playerControl->play(); - } - - const QMediaPlayer::MediaStatus oldStatus = m_status; - const bool wasPlaying = m_playing; - const bool wasPaused = m_paused; - - const QMediaPlayer::State state = m_playerControl->state(); - - m_status = m_playerControl->mediaStatus(); - - if (m_complete) - m_playing = state != QMediaPlayer::StoppedState; - - if (state == QMediaPlayer::PausedState) - m_paused = true; - else if (state == QMediaPlayer::PlayingState) - m_paused = false; - - if (m_status != oldStatus) - emit statusChanged(); - - switch (state) { - case QMediaPlayer::StoppedState: - if (wasPlaying) { - emit stopped(); - - if (!m_playing) - emit playingChanged(); - } - break; - case QMediaPlayer::PausedState: - if (!wasPlaying) { - emit started(); - if (m_playing) - emit playingChanged(); - } - if ((!wasPaused || !wasPlaying) && m_paused) - emit paused(); - if (!wasPaused && m_paused) - emit pausedChanged(); - - break; - - case QMediaPlayer::PlayingState: - if (wasPaused && wasPlaying) - emit resumed(); - else - emit started(); - - if (wasPaused && !m_paused) - emit pausedChanged(); - if (!wasPlaying && m_playing) - emit playingChanged(); - break; - } - - // Check - if ((m_playing && !m_paused) - || m_status == QMediaPlayer::BufferingMedia - || m_status == QMediaPlayer::StalledMedia) { - m_animation->start(); - } - else { - m_animation->stop(); - } -} - -QDeclarativeMediaBase::QDeclarativeMediaBase() - : m_paused(false) - , m_playing(false) - , m_autoLoad(true) - , m_loaded(false) - , m_muted(false) - , m_complete(false) - , m_loopCount(1) - , m_runningCount(0) - , m_position(0) - , m_vol(1.0) - , m_playbackRate(1.0) - , m_mediaService(0) - , m_playerControl(0) - , m_qmlObject(0) - , m_mediaObject(0) - , m_mediaProvider(0) - , m_metaDataControl(0) - , m_animation(0) - , m_status(QMediaPlayer::NoMedia) - , m_error(QMediaPlayer::ServiceMissingError) -{ -} - -QDeclarativeMediaBase::~QDeclarativeMediaBase() -{ -} - -void QDeclarativeMediaBase::shutdown() -{ - delete m_mediaObject; - m_metaData.reset(); - - if (m_mediaProvider) - m_mediaProvider->releaseService(m_mediaService); - - delete m_animation; - -} - -void QDeclarativeMediaBase::setObject(QObject *object, const QByteArray &type) -{ - m_qmlObject = object; - - if ((m_mediaProvider = QMediaServiceProvider::defaultServiceProvider()) != 0) { - m_mediaService = m_mediaProvider->requestService(type); - if (m_mediaService != 0) { - m_playerControl = qobject_cast<QMediaPlayerControl *>( - m_mediaService->requestControl(QMediaPlayerControl_iid)); - m_metaDataControl = qobject_cast<QMetaDataReaderControl *>( - m_mediaService->requestControl(QMetaDataReaderControl_iid)); - m_mediaObject = new QDeclarativeMediaBaseObject(m_mediaService); - } - } - - if (m_playerControl) { - QObject::connect(m_playerControl, SIGNAL(stateChanged(QMediaPlayer::State)), - object, SLOT(_q_statusChanged())); - QObject::connect(m_playerControl, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), - object, SLOT(_q_statusChanged())); - QObject::connect(m_playerControl, SIGNAL(mediaChanged(QMediaContent)), - object, SIGNAL(sourceChanged())); - QObject::connect(m_playerControl, SIGNAL(durationChanged(qint64)), - object, SIGNAL(durationChanged())); - QObject::connect(m_playerControl, SIGNAL(positionChanged(qint64)), - object, SIGNAL(positionChanged())); - QObject::connect(m_playerControl, SIGNAL(volumeChanged(int)), - object, SIGNAL(volumeChanged())); - QObject::connect(m_playerControl, SIGNAL(mutedChanged(bool)), - object, SIGNAL(mutedChanged())); - QObject::connect(m_playerControl, SIGNAL(bufferStatusChanged(int)), - object, SIGNAL(bufferProgressChanged())); - QObject::connect(m_playerControl, SIGNAL(seekableChanged(bool)), - object, SIGNAL(seekableChanged())); - QObject::connect(m_playerControl, SIGNAL(playbackRateChanged(qreal)), - object, SIGNAL(playbackRateChanged())); - QObject::connect(m_playerControl, SIGNAL(error(int,QString)), - object, SLOT(_q_error(int,QString))); - - m_animation = new QDeclarativeMediaBaseAnimation(this); - m_error = QMediaPlayer::NoError; - } else { - m_playerControl = new QDeclarativeMediaBasePlayerControl(object); - } - - if (!m_metaDataControl) - m_metaDataControl = new QDeclarativeMediaBaseMetaDataControl(object); - - m_metaData.reset(new QDeclarativeMediaMetaData(m_metaDataControl)); - - QObject::connect(m_metaDataControl, SIGNAL(metaDataChanged()), - m_metaData.data(), SIGNAL(metaDataChanged())); -} - -void QDeclarativeMediaBase::componentComplete() -{ - if (!qFuzzyCompare(m_vol, qreal(1.0))) - m_playerControl->setVolume(m_vol * 100); - if (m_muted) - m_playerControl->setMuted(m_muted); - if (!qFuzzyCompare(m_playbackRate, qreal(1.0))) - m_playerControl->setPlaybackRate(m_playbackRate); - - if (!m_source.isEmpty() && (m_autoLoad || m_playing)) // Override autoLoad if playing set - m_playerControl->setMedia(m_source, 0); - - m_complete = true; - - if (m_playing) { - if (m_position > 0) - m_playerControl->setPosition(m_position); - - if (m_source.isEmpty()) { - m_playing = false; - - emit playingChanged(); - } else if (m_paused) { - m_playerControl->pause(); - } else { - m_playerControl->play(); - } - } -} - -// Properties - -QUrl QDeclarativeMediaBase::source() const -{ - return m_source; -} - -void QDeclarativeMediaBase::setSource(const QUrl &url) -{ - if (url == m_source) - return; - - m_source = url; - m_loaded = false; - if (m_complete && (m_autoLoad || url.isEmpty())) { - if (m_error != QMediaPlayer::ServiceMissingError && m_error != QMediaPlayer::NoError) { - m_error = QMediaPlayer::NoError; - m_errorString = QString(); - - emit errorChanged(); - } - - m_playerControl->setMedia(m_source, 0); - m_loaded = true; - } - else - emit sourceChanged(); -} - -bool QDeclarativeMediaBase::isAutoLoad() const -{ - return m_autoLoad; -} - -void QDeclarativeMediaBase::setAutoLoad(bool autoLoad) -{ - if (m_autoLoad == autoLoad) - return; - - m_autoLoad = autoLoad; - emit autoLoadChanged(); -} - -int QDeclarativeMediaBase::loopCount() const -{ - return m_loopCount; -} - -void QDeclarativeMediaBase::setLoopCount(int loopCount) -{ - if (loopCount == 0) - loopCount = 1; - else if (loopCount < -1) - loopCount = -1; - - if (m_loopCount == loopCount) { - return; - } - m_loopCount = loopCount; - emit loopCountChanged(); -} - -bool QDeclarativeMediaBase::isPlaying() const -{ - return m_playing; -} - -void QDeclarativeMediaBase::setPlaying(bool playing) -{ - if (playing == m_playing) - return; - - if (m_complete) { - if (playing) { - if (!m_autoLoad && !m_loaded) { - m_playerControl->setMedia(m_source, 0); - m_playerControl->setPosition(m_position); - m_loaded = true; - } - - m_runningCount = m_loopCount - 1; - - if (!m_paused) - m_playerControl->play(); - else - m_playerControl->pause(); - } else { - m_playerControl->stop(); - } - } else { - m_playing = playing; - emit playingChanged(); - } -} - -bool QDeclarativeMediaBase::isPaused() const -{ - return m_paused; -} - -void QDeclarativeMediaBase::setPaused(bool paused) -{ - if (m_paused == paused) - return; - - if (m_complete && m_playing) { - if (!m_autoLoad && !m_loaded) { - m_playerControl->setMedia(m_source, 0); - m_playerControl->setPosition(m_position); - m_loaded = true; - } - - if (!paused) - m_playerControl->play(); - else - m_playerControl->pause(); - } else { - m_paused = paused; - emit pausedChanged(); - } -} - -int QDeclarativeMediaBase::duration() const -{ - return !m_complete ? 0 : m_playerControl->duration(); -} - -int QDeclarativeMediaBase::position() const -{ - return !m_complete ? m_position : m_playerControl->position(); -} - -void QDeclarativeMediaBase::setPosition(int position) -{ - if (this->position() == position) - return; - - m_position = position; - if (m_complete) - m_playerControl->setPosition(m_position); - else - emit positionChanged(); -} - -qreal QDeclarativeMediaBase::volume() const -{ - return !m_complete ? m_vol : qreal(m_playerControl->volume()) / 100; -} - -void QDeclarativeMediaBase::setVolume(qreal volume) -{ - if (volume < 0 || volume > 1) { - qmlInfo(m_qmlObject) << m_qmlObject->tr("volume should be between 0.0 and 1.0"); - return; - } - - if (m_vol == volume) - return; - - m_vol = volume; - - if (m_complete) - m_playerControl->setVolume(qRound(volume * 100)); - else - emit volumeChanged(); -} - -bool QDeclarativeMediaBase::isMuted() const -{ - return !m_complete ? m_muted : m_playerControl->isMuted(); -} - -void QDeclarativeMediaBase::setMuted(bool muted) -{ - if (m_muted == muted) - return; - - m_muted = muted; - - if (m_complete) - m_playerControl->setMuted(muted); - else - emit mutedChanged(); -} - -qreal QDeclarativeMediaBase::bufferProgress() const -{ - return !m_complete ? 0 : qreal(m_playerControl->bufferStatus()) / 100; -} - -bool QDeclarativeMediaBase::isSeekable() const -{ - return !m_complete ? false : m_playerControl->isSeekable(); -} - -qreal QDeclarativeMediaBase::playbackRate() const -{ - return m_playbackRate; -} - -void QDeclarativeMediaBase::setPlaybackRate(qreal rate) -{ - if (m_playbackRate == rate) - return; - - m_playbackRate = rate; - - if (m_complete) - m_playerControl->setPlaybackRate(m_playbackRate); - else - emit playbackRateChanged(); -} - -QString QDeclarativeMediaBase::errorString() const -{ - return m_errorString; -} - -QDeclarativeMediaMetaData *QDeclarativeMediaBase::metaData() const -{ - return m_metaData.data(); -} - -QT_END_NAMESPACE - diff --git a/src/imports/multimedia/qdeclarativemediabase_p.h b/src/imports/multimedia/qdeclarativemediabase_p.h deleted file mode 100644 index 964bb07..0000000 --- a/src/imports/multimedia/qdeclarativemediabase_p.h +++ /dev/null @@ -1,187 +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$ -** -****************************************************************************/ - -#ifndef QDECLARATIVEMEDIABASE_P_H -#define QDECLARATIVEMEDIABASE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QtCore/qbasictimer.h> -#include <qmediaplayer.h> - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QMediaPlayerControl; -class QMediaService; -class QMediaServiceProvider; -class QMetaDataReaderControl; -class QDeclarativeMediaBaseAnimation; -class QDeclarativeMediaMetaData; - -class QDeclarativeMediaBase -{ -public: - enum Loop { - INFINITE = -1 - }; - - QDeclarativeMediaBase(); - virtual ~QDeclarativeMediaBase(); - - QUrl source() const; - void setSource(const QUrl &url); - - bool isAutoLoad() const; - void setAutoLoad(bool autoLoad); - - int loopCount() const; - void setLoopCount(int loopCount); - - bool isPlaying() const; - void setPlaying(bool playing); - - bool isPaused() const; - void setPaused(bool paused); - - int duration() const; - - int position() const; - void setPosition(int position); - - qreal volume() const; - void setVolume(qreal volume); - - bool isMuted() const; - void setMuted(bool muted); - - qreal bufferProgress() const; - - bool isSeekable() const; - - qreal playbackRate() const; - void setPlaybackRate(qreal rate); - - QString errorString() const; - - QDeclarativeMediaMetaData *metaData() const; - - void _q_statusChanged(); - - void _q_metaDataChanged(); - - void componentComplete(); - -protected: - void shutdown(); - - void setObject(QObject *object, const QByteArray &type = Q_MEDIASERVICE_MEDIAPLAYER); - - virtual void sourceChanged() = 0; - virtual void autoLoadChanged() = 0; - virtual void playingChanged() = 0; - virtual void pausedChanged() = 0; - virtual void loopCountChanged() = 0; - - virtual void started() = 0; - virtual void resumed() = 0; - virtual void paused() = 0; - virtual void stopped() = 0; - - virtual void statusChanged() = 0; - - virtual void durationChanged() = 0; - virtual void positionChanged() = 0; - - virtual void volumeChanged() = 0; - virtual void mutedChanged() = 0; - - virtual void bufferProgressChanged() = 0; - - virtual void seekableChanged() = 0; - virtual void playbackRateChanged() = 0; - - virtual void errorChanged() = 0; - - bool m_paused; - bool m_playing; - bool m_autoLoad; - bool m_loaded; - bool m_muted; - bool m_complete; - int m_loopCount; - int m_runningCount; - int m_position; - qreal m_vol; - qreal m_playbackRate; - QMediaService *m_mediaService; - QMediaPlayerControl *m_playerControl; - - QObject *m_qmlObject; - QMediaObject *m_mediaObject; - QMediaServiceProvider *m_mediaProvider; - QMetaDataReaderControl *m_metaDataControl; - QDeclarativeMediaBaseAnimation *m_animation; - QScopedPointer<QDeclarativeMediaMetaData> m_metaData; - - QMediaPlayer::MediaStatus m_status; - QMediaPlayer::Error m_error; - QString m_errorString; - QUrl m_source; - - friend class QDeclarativeMediaBaseAnimation; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif diff --git a/src/imports/multimedia/qdeclarativemediametadata_p.h b/src/imports/multimedia/qdeclarativemediametadata_p.h deleted file mode 100644 index 4a73705..0000000 --- a/src/imports/multimedia/qdeclarativemediametadata_p.h +++ /dev/null @@ -1,185 +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$ -** -****************************************************************************/ - -#ifndef QDECLARATIVEMEDIAMETADATA_P_H -#define QDECLARATIVEMEDIAMETADATA_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <qmetadatareadercontrol.h> - -#include <qdeclarative.h> - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QDeclarativeMediaMetaData : public QObject -{ - Q_OBJECT - Q_PROPERTY(QVariant title READ title NOTIFY metaDataChanged) - Q_PROPERTY(QVariant subTitle READ subTitle NOTIFY metaDataChanged) - Q_PROPERTY(QVariant author READ author NOTIFY metaDataChanged) - Q_PROPERTY(QVariant comment READ comment NOTIFY metaDataChanged) - Q_PROPERTY(QVariant description READ description NOTIFY metaDataChanged) - Q_PROPERTY(QVariant category READ category NOTIFY metaDataChanged) - Q_PROPERTY(QVariant genre READ genre NOTIFY metaDataChanged) - Q_PROPERTY(QVariant year READ year NOTIFY metaDataChanged) - Q_PROPERTY(QVariant date READ date NOTIFY metaDataChanged) - Q_PROPERTY(QVariant userRating READ userRating NOTIFY metaDataChanged) - Q_PROPERTY(QVariant keywords READ keywords NOTIFY metaDataChanged) - Q_PROPERTY(QVariant language READ language NOTIFY metaDataChanged) - Q_PROPERTY(QVariant publisher READ publisher NOTIFY metaDataChanged) - Q_PROPERTY(QVariant copyright READ copyright NOTIFY metaDataChanged) - Q_PROPERTY(QVariant parentalRating READ parentalRating NOTIFY metaDataChanged) - Q_PROPERTY(QVariant ratingOrganisation READ ratingOrganisation NOTIFY metaDataChanged) - Q_PROPERTY(QVariant size READ size NOTIFY metaDataChanged) - Q_PROPERTY(QVariant mediaType READ mediaType NOTIFY metaDataChanged) - Q_PROPERTY(QVariant duration READ duration NOTIFY metaDataChanged) - Q_PROPERTY(QVariant audioBitRate READ audioBitRate NOTIFY metaDataChanged) - Q_PROPERTY(QVariant audioCodec READ audioCodec NOTIFY metaDataChanged) - Q_PROPERTY(QVariant averageLevel READ averageLevel NOTIFY metaDataChanged) - Q_PROPERTY(QVariant channelCount READ channelCount NOTIFY metaDataChanged) - Q_PROPERTY(QVariant peakValue READ peakValue NOTIFY metaDataChanged) - Q_PROPERTY(QVariant sampleRate READ sampleRate NOTIFY metaDataChanged) - Q_PROPERTY(QVariant albumTitle READ albumTitle NOTIFY metaDataChanged) - Q_PROPERTY(QVariant albumArtist READ albumArtist NOTIFY metaDataChanged) - Q_PROPERTY(QVariant contributingArtist READ contributingArtist NOTIFY metaDataChanged) - Q_PROPERTY(QVariant composer READ composer NOTIFY metaDataChanged) - Q_PROPERTY(QVariant conductor READ conductor NOTIFY metaDataChanged) - Q_PROPERTY(QVariant lyrics READ lyrics NOTIFY metaDataChanged) - Q_PROPERTY(QVariant mood READ mood NOTIFY metaDataChanged) - Q_PROPERTY(QVariant trackNumber READ trackNumber NOTIFY metaDataChanged) - Q_PROPERTY(QVariant trackCount READ trackCount NOTIFY metaDataChanged) - Q_PROPERTY(QVariant coverArtUrlSmall READ coverArtUrlSmall NOTIFY metaDataChanged) - Q_PROPERTY(QVariant coverArtUrlLarge READ coverArtUrlLarge NOTIFY metaDataChanged) - Q_PROPERTY(QVariant resolution READ resolution NOTIFY metaDataChanged) - Q_PROPERTY(QVariant pixelAspectRatio READ pixelAspectRatio NOTIFY metaDataChanged) - Q_PROPERTY(QVariant videoFrameRate READ videoFrameRate NOTIFY metaDataChanged) - Q_PROPERTY(QVariant videoBitRate READ videoBitRate NOTIFY metaDataChanged) - Q_PROPERTY(QVariant videoCodec READ videoCodec NOTIFY metaDataChanged) - Q_PROPERTY(QVariant posterUrl READ posterUrl NOTIFY metaDataChanged) - Q_PROPERTY(QVariant chapterNumber READ chapterNumber NOTIFY metaDataChanged) - Q_PROPERTY(QVariant director READ director NOTIFY metaDataChanged) - Q_PROPERTY(QVariant leadPerformer READ leadPerformer NOTIFY metaDataChanged) - Q_PROPERTY(QVariant writer READ writer NOTIFY metaDataChanged) -public: - QDeclarativeMediaMetaData(QMetaDataReaderControl *control, QObject *parent = 0) - : QObject(parent) - , m_control(control) - { - } - - QVariant title() const { return m_control->metaData(QtMultimedia::Title); } - QVariant subTitle() const { return m_control->metaData(QtMultimedia::SubTitle); } - QVariant author() const { return m_control->metaData(QtMultimedia::Author); } - QVariant comment() const { return m_control->metaData(QtMultimedia::Comment); } - QVariant description() const { return m_control->metaData(QtMultimedia::Description); } - QVariant category() const { return m_control->metaData(QtMultimedia::Category); } - QVariant genre() const { return m_control->metaData(QtMultimedia::Genre); } - QVariant year() const { return m_control->metaData(QtMultimedia::Year); } - QVariant date() const { return m_control->metaData(QtMultimedia::Date); } - QVariant userRating() const { return m_control->metaData(QtMultimedia::UserRating); } - QVariant keywords() const { return m_control->metaData(QtMultimedia::Keywords); } - QVariant language() const { return m_control->metaData(QtMultimedia::Language); } - QVariant publisher() const { return m_control->metaData(QtMultimedia::Publisher); } - QVariant copyright() const { return m_control->metaData(QtMultimedia::Copyright); } - QVariant parentalRating() const { return m_control->metaData(QtMultimedia::ParentalRating); } - QVariant ratingOrganisation() const { - return m_control->metaData(QtMultimedia::RatingOrganisation); } - QVariant size() const { return m_control->metaData(QtMultimedia::Size); } - QVariant mediaType() const { return m_control->metaData(QtMultimedia::MediaType); } - QVariant duration() const { return m_control->metaData(QtMultimedia::Duration); } - QVariant audioBitRate() const { return m_control->metaData(QtMultimedia::AudioBitRate); } - QVariant audioCodec() const { return m_control->metaData(QtMultimedia::AudioCodec); } - QVariant averageLevel() const { return m_control->metaData(QtMultimedia::AverageLevel); } - QVariant channelCount() const { return m_control->metaData(QtMultimedia::ChannelCount); } - QVariant peakValue() const { return m_control->metaData(QtMultimedia::PeakValue); } - QVariant sampleRate() const { return m_control->metaData(QtMultimedia::SampleRate); } - QVariant albumTitle() const { return m_control->metaData(QtMultimedia::AlbumTitle); } - QVariant albumArtist() const { return m_control->metaData(QtMultimedia::AlbumArtist); } - QVariant contributingArtist() const { - return m_control->metaData(QtMultimedia::ContributingArtist); } - QVariant composer() const { return m_control->metaData(QtMultimedia::Composer); } - QVariant conductor() const { return m_control->metaData(QtMultimedia::Conductor); } - QVariant lyrics() const { return m_control->metaData(QtMultimedia::Lyrics); } - QVariant mood() const { return m_control->metaData(QtMultimedia::Mood); } - QVariant trackNumber() const { return m_control->metaData(QtMultimedia::TrackNumber); } - QVariant trackCount() const { return m_control->metaData(QtMultimedia::TrackCount); } - QVariant coverArtUrlSmall() const { - return m_control->metaData(QtMultimedia::CoverArtUrlSmall); } - QVariant coverArtUrlLarge() const { - return m_control->metaData(QtMultimedia::CoverArtUrlLarge); } - QVariant resolution() const { return m_control->metaData(QtMultimedia::Resolution); } - QVariant pixelAspectRatio() const { - return m_control->metaData(QtMultimedia::PixelAspectRatio); } - QVariant videoFrameRate() const { return m_control->metaData(QtMultimedia::VideoFrameRate); } - QVariant videoBitRate() const { return m_control->metaData(QtMultimedia::VideoBitRate); } - QVariant videoCodec() const { return m_control->metaData(QtMultimedia::VideoCodec); } - QVariant posterUrl() const { return m_control->metaData(QtMultimedia::PosterUrl); } - QVariant chapterNumber() const { return m_control->metaData(QtMultimedia::ChapterNumber); } - QVariant director() const { return m_control->metaData(QtMultimedia::Director); } - QVariant leadPerformer() const { return m_control->metaData(QtMultimedia::LeadPerformer); } - QVariant writer() const { return m_control->metaData(QtMultimedia::Writer); } - -Q_SIGNALS: - void metaDataChanged(); - -private: - QMetaDataReaderControl *m_control; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeMediaMetaData)) - -QT_END_HEADER - -#endif diff --git a/src/imports/multimedia/qdeclarativeradio.cpp b/src/imports/multimedia/qdeclarativeradio.cpp deleted file mode 100644 index e2b495d..0000000 --- a/src/imports/multimedia/qdeclarativeradio.cpp +++ /dev/null @@ -1,218 +0,0 @@ -/**************************************************************************** -** -** 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 "qdeclarativeradio_p.h" - -QT_BEGIN_NAMESPACE - -QDeclarativeRadio::QDeclarativeRadio(QObject *parent) : - QObject(parent), - m_radioTuner(0) -{ - m_radioTuner = new QRadioTuner(this); - - connect(m_radioTuner, SIGNAL(stateChanged(QRadioTuner::State)), this, SLOT(_q_stateChanged(QRadioTuner::State))); - connect(m_radioTuner, SIGNAL(bandChanged(QRadioTuner::Band)), this, SLOT(_q_bandChanged(QRadioTuner::Band))); - - connect(m_radioTuner, SIGNAL(frequencyChanged(int)), this, SIGNAL(frequencyChanged(int))); - connect(m_radioTuner, SIGNAL(stereoStatusChanged(bool)), this, SIGNAL(stereoStatusChanged(bool))); - connect(m_radioTuner, SIGNAL(searchingChanged(bool)), this, SIGNAL(searchingChanged(bool))); - connect(m_radioTuner, SIGNAL(signalStrengthChanged(int)), this, SIGNAL(signalStrengthChanged(int))); - connect(m_radioTuner, SIGNAL(volumeChanged(int)), this, SIGNAL(volumeChanged(int))); - connect(m_radioTuner, SIGNAL(mutedChanged(bool)), this, SIGNAL(mutedChanged(bool))); - connect(m_radioTuner, SIGNAL(stationFound(int, QString)), this, SIGNAL(stationFound(int, QString))); - - connect(m_radioTuner, SIGNAL(error(QRadioTuner::Error)), this, SLOT(_q_error(QRadioTuner::Error))); -} - -QDeclarativeRadio::~QDeclarativeRadio() -{ -} - -QDeclarativeRadio::State QDeclarativeRadio::state() const -{ - return static_cast<QDeclarativeRadio::State>(m_radioTuner->state()); -} - -QDeclarativeRadio::Band QDeclarativeRadio::band() const -{ - return static_cast<QDeclarativeRadio::Band>(m_radioTuner->band()); -} - -int QDeclarativeRadio::frequency() const -{ - return m_radioTuner->frequency(); -} - -QDeclarativeRadio::StereoMode QDeclarativeRadio::stereoMode() const -{ - return static_cast<QDeclarativeRadio::StereoMode>(m_radioTuner->stereoMode()); -} - -int QDeclarativeRadio::volume() const -{ - return m_radioTuner->volume(); -} - -bool QDeclarativeRadio::muted() const -{ - return m_radioTuner->isMuted(); -} - -bool QDeclarativeRadio::stereo() const -{ - return m_radioTuner->isStereo(); -} - -int QDeclarativeRadio::signalStrength() const -{ - return m_radioTuner->signalStrength(); -} - -bool QDeclarativeRadio::searching() const -{ - return m_radioTuner->isSearching(); -} - -int QDeclarativeRadio::frequencyStep() const -{ - return m_radioTuner->frequencyStep(m_radioTuner->band()); -} - -int QDeclarativeRadio::minimumFrequency() const -{ - return m_radioTuner->frequencyRange(m_radioTuner->band()).first; -} - -int QDeclarativeRadio::maximumFrequency() const -{ - return m_radioTuner->frequencyRange(m_radioTuner->band()).second; -} - -bool QDeclarativeRadio::isAvailable() const -{ - return m_radioTuner->isAvailable(); -} - -void QDeclarativeRadio::setBand(QDeclarativeRadio::Band band) -{ - m_radioTuner->setBand(static_cast<QRadioTuner::Band>(band)); -} - -void QDeclarativeRadio::setFrequency(int frequency) -{ - m_radioTuner->setFrequency(frequency); -} - -void QDeclarativeRadio::setStereoMode(QDeclarativeRadio::StereoMode stereoMode) -{ - m_radioTuner->setStereoMode(static_cast<QRadioTuner::StereoMode>(stereoMode)); -} - -void QDeclarativeRadio::setVolume(int volume) -{ - m_radioTuner->setVolume(volume); -} - -void QDeclarativeRadio::setMuted(bool muted) -{ - m_radioTuner->setMuted(muted); -} - -void QDeclarativeRadio::cancelScan() -{ - m_radioTuner->cancelSearch(); -} - -void QDeclarativeRadio::scanDown() -{ - m_radioTuner->searchBackward(); -} - -void QDeclarativeRadio::scanUp() -{ - m_radioTuner->searchForward(); -} - -void QDeclarativeRadio::searchAllStations(QDeclarativeRadio::SearchMode searchMode) -{ - m_radioTuner->searchAllStations(static_cast<QRadioTuner::SearchMode>(searchMode)); -} - -void QDeclarativeRadio::tuneDown() -{ - int f = frequency(); - f = f - frequencyStep(); - setFrequency(f); -} - -void QDeclarativeRadio::tuneUp() -{ - int f = frequency(); - f = f + frequencyStep(); - setFrequency(f); -} - -void QDeclarativeRadio::start() -{ - m_radioTuner->start(); -} - -void QDeclarativeRadio::stop() -{ - m_radioTuner->stop(); -} - -void QDeclarativeRadio::_q_stateChanged(QRadioTuner::State state) -{ - emit stateChanged(static_cast<QDeclarativeRadio::State>(state)); -} - -void QDeclarativeRadio::_q_bandChanged(QRadioTuner::Band band) -{ - emit bandChanged(static_cast<QDeclarativeRadio::Band>(band)); -} - -void QDeclarativeRadio::_q_error(QRadioTuner::Error errorCode) -{ - emit error(static_cast<QDeclarativeRadio::Error>(errorCode)); - emit errorChanged(); -} diff --git a/src/imports/multimedia/qdeclarativeradio_p.h b/src/imports/multimedia/qdeclarativeradio_p.h deleted file mode 100644 index d719f6f..0000000 --- a/src/imports/multimedia/qdeclarativeradio_p.h +++ /dev/null @@ -1,184 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -#ifndef QDECLARATIVERADIO_P_H -#define QDECLARATIVERADIO_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QtDeclarative/qdeclarative.h> -#include <qradiotuner.h> - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QDeclarativeRadio : public QObject -{ - Q_OBJECT - Q_PROPERTY(State state READ state NOTIFY stateChanged) - Q_PROPERTY(Band band READ band WRITE setBand NOTIFY bandChanged) - Q_PROPERTY(int frequency READ frequency WRITE setFrequency NOTIFY frequencyChanged) - Q_PROPERTY(bool stereo READ stereo NOTIFY stereoStatusChanged) - Q_PROPERTY(StereoMode stereoMode READ stereoMode WRITE setStereoMode) - Q_PROPERTY(int signalStrength READ signalStrength NOTIFY signalStrengthChanged) - Q_PROPERTY(int volume READ volume WRITE setVolume NOTIFY volumeChanged) - Q_PROPERTY(bool muted READ muted WRITE setMuted NOTIFY mutedChanged) - Q_PROPERTY(bool searching READ searching NOTIFY searchingChanged) - Q_PROPERTY(int frequencyStep READ frequencyStep NOTIFY bandChanged) - Q_PROPERTY(int minimumFrequency READ minimumFrequency NOTIFY bandChanged) - Q_PROPERTY(int maximumFrequency READ maximumFrequency NOTIFY bandChanged) - Q_ENUMS(State) - Q_ENUMS(Band) - Q_ENUMS(Error) - Q_ENUMS(StereoMode) - Q_ENUMS(SearchMode) - -public: - enum State { - ActiveState = QRadioTuner::ActiveState, - StoppedState = QRadioTuner::StoppedState - }; - - enum Band { - AM = QRadioTuner::AM, - FM = QRadioTuner::FM, - SW = QRadioTuner::SW, - LW = QRadioTuner::LW, - FM2 = QRadioTuner::FM2 - }; - - enum Error { - NoError = QRadioTuner::NoError, - ResourceError = QRadioTuner::ResourceError, - OpenError = QRadioTuner::OpenError, - OutOfRangeError = QRadioTuner::OutOfRangeError - }; - - enum StereoMode { - ForceStereo = QRadioTuner::ForceStereo, - ForceMono = QRadioTuner::ForceMono, - Auto = QRadioTuner::Auto - }; - - enum SearchMode { - SearchFast = QRadioTuner::SearchFast, - SearchGetStationId = QRadioTuner::SearchGetStationId - }; - - QDeclarativeRadio(QObject *parent = 0); - ~QDeclarativeRadio(); - - QDeclarativeRadio::State state() const; - QDeclarativeRadio::Band band() const; - int frequency() const; - QDeclarativeRadio::StereoMode stereoMode() const; - int volume() const; - bool muted() const; - - bool stereo() const; - int signalStrength() const; - bool searching() const; - - int frequencyStep() const; - int minimumFrequency() const; - int maximumFrequency() const; - - Q_INVOKABLE bool isAvailable() const; - -public Q_SLOTS: - void setBand(QDeclarativeRadio::Band band); - void setFrequency(int frequency); - void setStereoMode(QDeclarativeRadio::StereoMode stereoMode); - void setVolume(int volume); - void setMuted(bool muted); - - void cancelScan(); - void scanDown(); - void scanUp(); - void tuneUp(); - void tuneDown(); - void searchAllStations(QDeclarativeRadio::SearchMode searchMode = QDeclarativeRadio::SearchFast ); - - void start(); - void stop(); - -Q_SIGNALS: - void stateChanged(QDeclarativeRadio::State state); - void bandChanged(QDeclarativeRadio::Band band); - void frequencyChanged(int frequency); - void stereoStatusChanged(bool stereo); - void searchingChanged(bool searching); - void signalStrengthChanged(int signalStrength); - void volumeChanged(int volume); - void mutedChanged(bool muted); - void stationFound(int frequency, QString stationId); - - void errorChanged(); - void error(QDeclarativeRadio::Error errorCode); - -private Q_SLOTS: - void _q_stateChanged(QRadioTuner::State state); - void _q_bandChanged(QRadioTuner::Band band); - void _q_error(QRadioTuner::Error errorCode); - -private: - Q_DISABLE_COPY(QDeclarativeRadio) - - QRadioTuner *m_radioTuner; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeRadio)) - -QT_END_HEADER - -#endif // QDECLARATIVERADIO_P_H diff --git a/src/imports/multimedia/qdeclarativeradiodata.cpp b/src/imports/multimedia/qdeclarativeradiodata.cpp deleted file mode 100644 index debea99..0000000 --- a/src/imports/multimedia/qdeclarativeradiodata.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/**************************************************************************** -** -** 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 "qdeclarativeradiodata_p.h" - -QT_BEGIN_NAMESPACE - -QDeclarativeRadioData::QDeclarativeRadioData(QObject *parent) : - QObject(parent), - m_radioData(0) -{ - m_radioData = new QRadioData(this); - - connect(m_radioData, SIGNAL(programTypeChanged(QRadioData::ProgramType)), this, - SLOT(_q_programTypeChanged(QRadioData::ProgramType))); - - connect(m_radioData, SIGNAL(stationIdChanged(QString)), this, SIGNAL(stationIdChanged(QString))); - connect(m_radioData, SIGNAL(programTypeNameChanged(QString)), this, SIGNAL(programTypeNameChanged(QString))); - connect(m_radioData, SIGNAL(stationNameChanged(QString)), this, SIGNAL(stationNameChanged(QString))); - connect(m_radioData, SIGNAL(radioTextChanged(QString)), this, SIGNAL(radioTextChanged(QString))); - connect(m_radioData, SIGNAL(alternativeFrequenciesEnabledChanged(bool)), this, - SIGNAL(alternativeFrequenciesEnabledChanged(bool))); - - connect(m_radioData, SIGNAL(error(QRadioData::Error)), this, SLOT(_q_error(QRadioData::Error))); -} - -QDeclarativeRadioData::~QDeclarativeRadioData() -{ -} - -bool QDeclarativeRadioData::isAvailable() const -{ - return m_radioData->isAvailable(); -} - -QString QDeclarativeRadioData::stationId() const -{ - return m_radioData->stationId(); -} - -QDeclarativeRadioData::ProgramType QDeclarativeRadioData::programType() const -{ - return static_cast<QDeclarativeRadioData::ProgramType>(m_radioData->programType()); -} - -QString QDeclarativeRadioData::programTypeName() const -{ - return m_radioData->programTypeName(); -} - -QString QDeclarativeRadioData::stationName() const -{ - return m_radioData->stationName(); -} - -QString QDeclarativeRadioData::radioText() const -{ - return m_radioData->radioText(); -} - -bool QDeclarativeRadioData::alternativeFrequenciesEnabled() const -{ - return m_radioData->isAlternativeFrequenciesEnabled(); -} - -void QDeclarativeRadioData::setAlternativeFrequenciesEnabled(bool enabled) -{ - m_radioData->setAlternativeFrequenciesEnabled(enabled); -} - -void QDeclarativeRadioData::_q_programTypeChanged(QRadioData::ProgramType programType) -{ - emit programTypeChanged(static_cast<QDeclarativeRadioData::ProgramType>(programType)); -} - -void QDeclarativeRadioData::_q_error(QRadioData::Error errorCode) -{ - emit error(static_cast<QDeclarativeRadioData::Error>(errorCode)); - emit errorChanged(); -} diff --git a/src/imports/multimedia/qdeclarativeradiodata_p.h b/src/imports/multimedia/qdeclarativeradiodata_p.h deleted file mode 100644 index fc43563..0000000 --- a/src/imports/multimedia/qdeclarativeradiodata_p.h +++ /dev/null @@ -1,178 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -#ifndef QDECLARATIVERADIODATA_P_H -#define QDECLARATIVERADIODATA_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QtDeclarative/qdeclarative.h> -#include <qradiodata.h> - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QDeclarativeRadioData : public QObject -{ - Q_OBJECT - Q_PROPERTY(QString stationId READ stationId NOTIFY stationIdChanged) - Q_PROPERTY(QDeclarativeRadioData::ProgramType programType READ programType NOTIFY programTypeChanged) - Q_PROPERTY(QString programTypeName READ programTypeName NOTIFY programTypeNameChanged) - Q_PROPERTY(QString stationName READ stationName NOTIFY stationNameChanged) - Q_PROPERTY(QString radioText READ radioText NOTIFY radioTextChanged) - Q_PROPERTY(bool alternativeFrequenciesEnabled READ alternativeFrequenciesEnabled - WRITE setAlternativeFrequenciesEnabled NOTIFY alternativeFrequenciesEnabledChanged) - Q_ENUMS(Error) - Q_ENUMS(ProgramType) - -public: - - enum Error { - NoError = QRadioData::NoError, - ResourceError = QRadioData::ResourceError, - OpenError = QRadioData::OpenError, - OutOfRangeError = QRadioData::OutOfRangeError - }; - - enum ProgramType { - Undefined = QRadioData::Undefined, - News = QRadioData::News, - CurrentAffairs = QRadioData::CurrentAffairs, - Information = QRadioData::Information, - Sport = QRadioData::Sport, - Education = QRadioData::Education, - Drama = QRadioData::Drama, - Culture = QRadioData::Culture, - Science = QRadioData::Science, - Varied = QRadioData::Varied, - PopMusic = QRadioData::PopMusic, - RockMusic = QRadioData::RockMusic, - EasyListening = QRadioData::EasyListening, - LightClassical = QRadioData::LightClassical, - SeriousClassical = QRadioData::SeriousClassical, - OtherMusic = QRadioData::OtherMusic, - Weather = QRadioData::Weather, - Finance = QRadioData::Finance, - ChildrensProgrammes = QRadioData::ChildrensProgrammes, - SocialAffairs = QRadioData::SocialAffairs, - Religion = QRadioData::Religion, - PhoneIn = QRadioData::PhoneIn, - Travel = QRadioData::Travel, - Leisure = QRadioData::Leisure, - JazzMusic = QRadioData::JazzMusic, - CountryMusic = QRadioData::CountryMusic, - NationalMusic = QRadioData::NationalMusic, - OldiesMusic = QRadioData::OldiesMusic, - FolkMusic = QRadioData::FolkMusic, - Documentary = QRadioData::Documentary, - AlarmTest = QRadioData::AlarmTest, - Alarm = QRadioData::Alarm, - Talk = QRadioData::Talk, - ClassicRock = QRadioData::ClassicRock, - AdultHits = QRadioData::AdultHits, - SoftRock = QRadioData::SoftRock, - Top40 = QRadioData::Top40, - Soft = QRadioData::Soft, - Nostalgia = QRadioData::Nostalgia, - Classical = QRadioData::Classical, - RhythmAndBlues = QRadioData::RhythmAndBlues, - SoftRhythmAndBlues = QRadioData::SoftRhythmAndBlues, - Language = QRadioData::Language, - ReligiousMusic = QRadioData::ReligiousMusic, - ReligiousTalk = QRadioData::ReligiousTalk, - Personality = QRadioData::Personality, - Public = QRadioData::Public, - College = QRadioData::College, - }; - - QDeclarativeRadioData(QObject *parent = 0); - ~QDeclarativeRadioData(); - - Q_INVOKABLE bool isAvailable() const; - - QString stationId() const; - QDeclarativeRadioData::ProgramType programType() const; - QString programTypeName() const; - QString stationName() const; - QString radioText() const; - bool alternativeFrequenciesEnabled() const; - -public Q_SLOTS: - void setAlternativeFrequenciesEnabled(bool enabled); - -Q_SIGNALS: - void stationIdChanged(QString stationId); - void programTypeChanged(QDeclarativeRadioData::ProgramType programType); - void programTypeNameChanged(QString programTypeName); - void stationNameChanged(QString stationName); - void radioTextChanged(QString radioText); - void alternativeFrequenciesEnabledChanged(bool enabled); - - void errorChanged(); - void error(QDeclarativeRadioData::Error errorCode); - -private Q_SLOTS: - void _q_programTypeChanged(QRadioData::ProgramType programType); - void _q_error(QRadioData::Error errorCode); - -private: - Q_DISABLE_COPY(QDeclarativeRadioData) - - QRadioData *m_radioData; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeRadioData)) - -QT_END_HEADER - -#endif // QDECLARATIVERADIODATA_P_H diff --git a/src/imports/multimedia/qdeclarativevideo.cpp b/src/imports/multimedia/qdeclarativevideo.cpp deleted file mode 100644 index 956d1d7..0000000 --- a/src/imports/multimedia/qdeclarativevideo.cpp +++ /dev/null @@ -1,951 +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 "qdeclarativevideo_p.h" - -#include <qmediaplayercontrol.h> -#include <qmediaservice.h> -#include <private/qpaintervideosurface_p.h> -#include <qvideorenderercontrol.h> - - -QT_BEGIN_NAMESPACE - - -void QDeclarativeVideo::_q_nativeSizeChanged(const QSizeF &size) -{ - setImplicitWidth(size.width()); - setImplicitHeight(size.height()); -} - -void QDeclarativeVideo::_q_error(int errorCode, const QString &errorString) -{ - m_error = QMediaPlayer::Error(errorCode); - m_errorString = errorString; - - emit error(Error(errorCode), errorString); - emit errorChanged(); -} - - -/*! - \qmlclass Video QDeclarativeVideo - \brief The Video element allows you to add videos to a scene. - \inherits Item - \ingroup qml-multimedia - - This element is part of the \bold{QtMultimedia 4.0} module. - - \qml - import Qt 4.7 - import QtMultimedia 4.0 - - Video { - id: video - width : 800 - height : 600 - source: "video.avi" - - MouseArea { - anchors.fill: parent - onClicked: { - video.play() - } - } - - focus: true - Keys.onSpacePressed: video.paused = !video.paused - Keys.onLeftPressed: video.position -= 5000 - Keys.onRightPressed: video.position += 5000 - } - \endqml - - The Video item supports untransformed, stretched, and uniformly scaled video presentation. - For a description of stretched uniformly scaled presentation, see the \l fillMode property - description. - - The Video item is only visible when the \l hasVideo property is true and the video is playing. - - \sa Audio -*/ - -/*! - \internal - \class QDeclarativeVideo - \brief The QDeclarativeVideo class provides a video item that you can add to a QDeclarativeView. -*/ - -QDeclarativeVideo::QDeclarativeVideo(QDeclarativeItem *parent) - : QDeclarativeItem(parent) - , m_graphicsItem(0) - -{ -} - -QDeclarativeVideo::~QDeclarativeVideo() -{ - shutdown(); - - delete m_graphicsItem; -} - -/*! - \qmlproperty url Video::source - - This property holds the source URL of the media. -*/ - -/*! - \qmlproperty url Video::autoLoad - - This property indicates if loading of media should begin immediately. - - Defaults to true, if false media will not be loaded until playback is started. -*/ - -/*! - \qmlproperty bool Video::playing - - This property holds whether the media is playing. - - Defaults to false, and can be set to true to start playback. -*/ - -/*! - \qmlproperty bool Video::paused - - This property holds whether the media is paused. - - Defaults to false, and can be set to true to pause playback. -*/ - -/*! - \qmlsignal Video::onStarted() - - This handler is called when playback is started. -*/ - -/*! - \qmlsignal Video::onResumed() - - This handler is called when playback is resumed from the paused state. -*/ - -/*! - \qmlsignal Video::onPaused() - - This handler is called when playback is paused. -*/ - -/*! - \qmlsignal Video::onStopped() - - This handler is called when playback is stopped. -*/ - -/*! - \qmlproperty enumeration Video::status - - This property holds the status of media loading. It can be one of: - - \list - \o NoMedia - no media has been set. - \o Loading - the media is currently being loaded. - \o Loaded - the media has been loaded. - \o Buffering - the media is buffering data. - \o Stalled - playback has been interrupted while the media is buffering data. - \o Buffered - the media has buffered data. - \o EndOfMedia - the media has played to the end. - \o InvalidMedia - the media cannot be played. - \o UnknownStatus - the status of the media is cannot be determined. - \endlist -*/ - -QDeclarativeVideo::Status QDeclarativeVideo::status() const -{ - return Status(m_status); -} - -/*! - \qmlproperty int Video::duration - - This property holds the duration of the media in milliseconds. - - If the media doesn't have a fixed duration (a live stream for example) this will be 0. -*/ - -/*! - \qmlproperty int Video::position - - This property holds the current playback position in milliseconds. -*/ - -/*! - \qmlproperty real Video::volume - - This property holds the volume of the audio output, from 0.0 (silent) to 1.0 (maximum volume). -*/ - -/*! - \qmlproperty bool Video::muted - - This property holds whether the audio output is muted. -*/ - -/*! - \qmlproperty bool Video::hasAudio - - This property holds whether the media contains audio. -*/ - -bool QDeclarativeVideo::hasAudio() const -{ - return !m_complete ? false : m_playerControl->isAudioAvailable(); -} - -/*! - \qmlproperty bool Video::hasVideo - - This property holds whether the media contains video. -*/ - -bool QDeclarativeVideo::hasVideo() const -{ - return !m_complete ? false : m_playerControl->isVideoAvailable(); -} - -/*! - \qmlproperty real Video::bufferProgress - - This property holds how much of the data buffer is currently filled, from 0.0 (empty) to 1.0 - (full). -*/ - -/*! - \qmlproperty bool Video::seekable - - This property holds whether position of the video can be changed. -*/ - -/*! - \qmlproperty real Video::playbackRate - - This property holds the rate at which video is played at as a multiple of the normal rate. -*/ - -/*! - \qmlproperty enumeration Video::error - - This property holds the error state of the video. It can be one of: - - \list - \o NoError - there is no current error. - \o ResourceError - the video cannot be played due to a problem allocating resources. - \o FormatError - the video format is not supported. - \o NetworkError - the video cannot be played due to network issues. - \o AccessDenied - the video cannot be played due to insufficient permissions. - \o ServiceMissing - the video cannot be played because the media service could not be - instantiated. - \endlist -*/ - - -QDeclarativeVideo::Error QDeclarativeVideo::error() const -{ - return Error(m_error); -} - -/*! - \qmlproperty string Video::errorString - - This property holds a string describing the current error condition in more detail. -*/ - -/*! - \qmlsignal Video::onError(error, errorString) - - This handler is called when an \l {QMediaPlayer::Error}{error} has - occurred. The errorString parameter may contain more detailed - information about the error. -*/ - -/*! - \qmlproperty enumeration Video::fillMode - - Set this property to define how the video is scaled to fit the target area. - - \list - \o Stretch - the video is scaled to fit. - \o PreserveAspectFit - the video is scaled uniformly to fit without cropping - \o PreserveAspectCrop - the video is scaled uniformly to fill, cropping if necessary - \endlist - - The default fill mode is PreserveAspectFit. -*/ - -QDeclarativeVideo::FillMode QDeclarativeVideo::fillMode() const -{ - return FillMode(m_graphicsItem->aspectRatioMode()); -} - -void QDeclarativeVideo::setFillMode(FillMode mode) -{ - m_graphicsItem->setAspectRatioMode(Qt::AspectRatioMode(mode)); -} - -/*! - \qmlmethod Video::play() - - Starts playback of the media. - - Sets the \l playing property to true, and the \l paused property to false. -*/ - -void QDeclarativeVideo::play() -{ - if (!m_complete) - return; - - setPaused(false); - setPlaying(true); -} - -/*! - \qmlmethod Video::pause() - - Pauses playback of the media. - - Sets the \l playing and \l paused properties to true. -*/ - -void QDeclarativeVideo::pause() -{ - if (!m_complete) - return; - - setPaused(true); - setPlaying(true); -} - -/*! - \qmlmethod Video::stop() - - Stops playback of the media. - - Sets the \l playing and \l paused properties to false. -*/ - -void QDeclarativeVideo::stop() -{ - if (!m_complete) - return; - - setPlaying(false); - setPaused(false); -} - -void QDeclarativeVideo::paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) -{ -} - -void QDeclarativeVideo::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) -{ - m_graphicsItem->setSize(newGeometry.size()); - - QDeclarativeItem::geometryChanged(newGeometry, oldGeometry); -} - -void QDeclarativeVideo::classBegin() -{ - m_graphicsItem = new QGraphicsVideoItem(this); - connect(m_graphicsItem, SIGNAL(nativeSizeChanged(QSizeF)), - this, SLOT(_q_nativeSizeChanged(QSizeF))); - - setObject(this); - - if (m_mediaService) { - connect(m_playerControl, SIGNAL(audioAvailableChanged(bool)), - this, SIGNAL(hasAudioChanged())); - connect(m_playerControl, SIGNAL(videoAvailableChanged(bool)), - this, SIGNAL(hasVideoChanged())); - - m_mediaObject->bind(m_graphicsItem); - } -} - -void QDeclarativeVideo::componentComplete() -{ - QDeclarativeMediaBase::componentComplete(); -} - -QT_END_NAMESPACE - -// *************************************** -// Documentation for meta-data properties. -// *************************************** - -/*! - \qmlproperty variant Video::metaData.title - - This property holds the tile of the media. - - \sa {QtMultimedia::Title} -*/ - -/*! - \qmlproperty variant Video::metaData.subTitle - - This property holds the sub-title of the media. - - \sa {QtMultimedia::SubTitle} -*/ - -/*! - \qmlproperty variant Video::metaData.author - - This property holds the author of the media. - - \sa {QtMultimedia::Author} -*/ - -/*! - \qmlproperty variant Video::metaData.comment - - This property holds a user comment about the media. - - \sa {QtMultimedia::Comment} -*/ - -/*! - \qmlproperty variant Video::metaData.description - - This property holds a description of the media. - - \sa {QtMultimedia::Description} -*/ - -/*! - \qmlproperty variant Video::metaData.category - - This property holds the category of the media - - \sa {QtMultimedia::Category} -*/ - -/*! - \qmlproperty variant Video::metaData.genre - - This property holds the genre of the media. - - \sa {QtMultimedia::Genre} -*/ - -/*! - \qmlproperty variant Video::metaData.year - - This property holds the year of release of the media. - - \sa {QtMultimedia::Year} -*/ - -/*! - \qmlproperty variant Video::metaData.date - - This property holds the date of the media. - - \sa {QtMultimedia::Date} -*/ - -/*! - \qmlproperty variant Video::metaData.userRating - - This property holds a user rating of the media in the range of 0 to 100. - - \sa {QtMultimedia::UserRating} -*/ - -/*! - \qmlproperty variant Video::metaData.keywords - - This property holds a list of keywords describing the media. - - \sa {QtMultimedia::Keywords} -*/ - -/*! - \qmlproperty variant Video::metaData.language - - This property holds the language of the media, as an ISO 639-2 code. - - \sa {QtMultimedia::Language} -*/ - -/*! - \qmlproperty variant Video::metaData.publisher - - This property holds the publisher of the media. - - \sa {QtMultimedia::Publisher} -*/ - -/*! - \qmlproperty variant Video::metaData.copyright - - This property holds the media's copyright notice. - - \sa {QtMultimedia::Copyright} -*/ - -/*! - \qmlproperty variant Video::metaData.parentalRating - - This property holds the parental rating of the media. - - \sa {QtMultimedia::ParentalRating} -*/ - -/*! - \qmlproperty variant Video::metaData.ratingOrganisation - - This property holds the name of the rating organisation responsible for the - parental rating of the media. - - \sa {QtMultimedia::RatingOrganisation} -*/ - -/*! - \qmlproperty variant Video::metaData.size - - This property property holds the size of the media in bytes. - - \sa {QtMultimedia::Size} -*/ - -/*! - \qmlproperty variant Video::metaData.mediaType - - This property holds the type of the media. - - \sa {QtMultimedia::MediaType} -*/ - -/*! - \qmlproperty variant Video::metaData.audioBitRate - - This property holds the bit rate of the media's audio stream ni bits per - second. - - \sa {QtMultimedia::AudioBitRate} -*/ - -/*! - \qmlproperty variant Video::metaData.audioCodec - - This property holds the encoding of the media audio stream. - - \sa {QtMultimedia::AudioCodec} -*/ - -/*! - \qmlproperty variant Video::metaData.averageLevel - - This property holds the average volume level of the media. - - \sa {QtMultimedia::AverageLevel} -*/ - -/*! - \qmlproperty variant Video::metaData.channelCount - - This property holds the number of channels in the media's audio stream. - - \sa {QtMultimedia::ChannelCount} -*/ - -/*! - \qmlproperty variant Video::metaData.peakValue - - This property holds the peak volume of media's audio stream. - - \sa {QtMultimedia::PeakValue} -*/ - -/*! - \qmlproperty variant Video::metaData.sampleRate - - This property holds the sample rate of the media's audio stream in hertz. - - \sa {QtMultimedia::SampleRate} -*/ - -/*! - \qmlproperty variant Video::metaData.albumTitle - - This property holds the title of the album the media belongs to. - - \sa {QtMultimedia::AlbumTitle} -*/ - -/*! - \qmlproperty variant Video::metaData.albumArtist - - This property holds the name of the principal artist of the album the media - belongs to. - - \sa {QtMultimedia::AlbumArtist} -*/ - -/*! - \qmlproperty variant Video::metaData.contributingArtist - - This property holds the names of artists contributing to the media. - - \sa {QtMultimedia::ContributingArtist} -*/ - -/*! - \qmlproperty variant Video::metaData.composer - - This property holds the composer of the media. - - \sa {QtMultimedia::Composer} -*/ - -/*! - \qmlproperty variant Video::metaData.conductor - - This property holds the conductor of the media. - - \sa {QtMultimedia::Conductor} -*/ - -/*! - \qmlproperty variant Video::metaData.lyrics - - This property holds the lyrics to the media. - - \sa {QtMultimedia::Lyrics} -*/ - -/*! - \qmlproperty variant Video::metaData.mood - - This property holds the mood of the media. - - \sa {QtMultimedia::Mood} -*/ - -/*! - \qmlproperty variant Video::metaData.trackNumber - - This property holds the track number of the media. - - \sa {QtMultimedia::TrackNumber} -*/ - -/*! - \qmlproperty variant Video::metaData.trackCount - - This property holds the number of track on the album containing the media. - - \sa {QtMultimedia::TrackNumber} -*/ - -/*! - \qmlproperty variant Video::metaData.coverArtUrlSmall - - This property holds the URL of a small cover art image. - - \sa {QtMultimedia::CoverArtUrlSmall} -*/ - -/*! - \qmlproperty variant Video::metaData.coverArtUrlLarge - - This property holds the URL of a large cover art image. - - \sa {QtMultimedia::CoverArtUrlLarge} -*/ - -/*! - \qmlproperty variant Video::metaData.resolution - - This property holds the dimension of an image or video. - - \sa {QtMultimedia::Resolution} -*/ - -/*! - \qmlproperty variant Video::metaData.pixelAspectRatio - - This property holds the pixel aspect ratio of an image or video. - - \sa {QtMultimedia::PixelAspectRatio} -*/ - -/*! - \qmlproperty variant Video::metaData.videoFrameRate - - This property holds the frame rate of the media's video stream. - - \sa {QtMultimedia::VideoFrameRate} -*/ - -/*! - \qmlproperty variant Video::metaData.videoBitRate - - This property holds the bit rate of the media's video stream in bits per - second. - - \sa {QtMultimedia::VideoBitRate} -*/ - -/*! - \qmlproperty variant Video::metaData.videoCodec - - This property holds the encoding of the media's video stream. - - \sa {QtMultimedia::VideoCodec} -*/ - -/*! - \qmlproperty variant Video::metaData.posterUrl - - This property holds the URL of a poster image. - - \sa {QtMultimedia::PosterUrl} -*/ - -/*! - \qmlproperty variant Video::metaData.chapterNumber - - This property holds the chapter number of the media. - - \sa {QtMultimedia::ChapterNumber} -*/ - -/*! - \qmlproperty variant Video::metaData.director - - This property holds the director of the media. - - \sa {QtMultimedia::Director} -*/ - -/*! - \qmlproperty variant Video::metaData.leadPerformer - - This property holds the lead performer in the media. - - \sa {QtMultimedia::LeadPerformer} -*/ - -/*! - \qmlproperty variant Video::metaData.writer - - This property holds the writer of the media. - - \sa {QtMultimedia::Writer} -*/ - -// The remaining properties are related to photos, and are technically -// available but will certainly never have values. -#ifndef Q_QDOC - -/*! - \qmlproperty variant Video::metaData.cameraManufacturer - - \sa {QtMultimedia::CameraManufacturer} -*/ - -/*! - \qmlproperty variant Video::metaData.cameraModel - - \sa {QtMultimedia::CameraModel} -*/ - -/*! - \qmlproperty variant Video::metaData.event - - \sa {QtMultimedia::Event} -*/ - -/*! - \qmlproperty variant Video::metaData.subject - - \sa {QtMultimedia::Subject} -*/ - -/*! - \qmlproperty variant Video::metaData.orientation - - \sa {QtMultimedia::Orientation} -*/ - -/*! - \qmlproperty variant Video::metaData.exposureTime - - \sa {QtMultimedia::ExposureTime} -*/ - -/*! - \qmlproperty variant Video::metaData.fNumber - - \sa {QtMultimedia::FNumber} -*/ - -/*! - \qmlproperty variant Video::metaData.exposureProgram - - \sa {QtMultimedia::ExposureProgram} -*/ - -/*! - \qmlproperty variant Video::metaData.isoSpeedRatings - - \sa {QtMultimedia::ISOSpeedRatings} -*/ - -/*! - \qmlproperty variant Video::metaData.exposureBiasValue - - \sa {QtMultimedia::ExposureBiasValue} -*/ - -/*! - \qmlproperty variant Video::metaData.dateTimeDigitized - - \sa {QtMultimedia::DateTimeDigitized} -*/ - -/*! - \qmlproperty variant Video::metaData.subjectDistance - - \sa {QtMultimedia::SubjectDistance} -*/ - -/*! - \qmlproperty variant Video::metaData.meteringMode - - \sa {QtMultimedia::MeteringMode} -*/ - -/*! - \qmlproperty variant Video::metaData.lightSource - - \sa {QtMultimedia::LightSource} -*/ - -/*! - \qmlproperty variant Video::metaData.flash - - \sa {QtMultimedia::Flash} -*/ - -/*! - \qmlproperty variant Video::metaData.focalLength - - \sa {QtMultimedia::FocalLength} -*/ - -/*! - \qmlproperty variant Video::metaData.exposureMode - - \sa {QtMultimedia::ExposureMode} -*/ - -/*! - \qmlproperty variant Video::metaData.whiteBalance - - \sa {QtMultimedia::WhiteBalance} -*/ - -/*! - \qmlproperty variant Video::metaData.DigitalZoomRatio - - \sa {QtMultimedia::DigitalZoomRatio} -*/ - -/*! - \qmlproperty variant Video::metaData.focalLengthIn35mmFilm - - \sa {QtMultimedia::FocalLengthIn35mmFile} -*/ - -/*! - \qmlproperty variant Video::metaData.sceneCaptureType - - \sa {QtMultimedia::SceneCaptureType} -*/ - -/*! - \qmlproperty variant Video::metaData.gainControl - - \sa {QtMultimedia::GainControl} -*/ - -/*! - \qmlproperty variant Video::metaData.contrast - - \sa {QtMultimedia::contrast} -*/ - -/*! - \qmlproperty variant Video::metaData.saturation - - \sa {QtMultimedia::Saturation} -*/ - -/*! - \qmlproperty variant Video::metaData.sharpness - - \sa {QtMultimedia::Sharpness} -*/ - -/*! - \qmlproperty variant Video::metaData.deviceSettingDescription - - \sa {QtMultimedia::DeviceSettingDescription} -*/ - -#endif - -#include "moc_qdeclarativevideo_p.cpp" diff --git a/src/imports/multimedia/qdeclarativevideo_p.h b/src/imports/multimedia/qdeclarativevideo_p.h deleted file mode 100644 index 2375825..0000000 --- a/src/imports/multimedia/qdeclarativevideo_p.h +++ /dev/null @@ -1,202 +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$ -** -****************************************************************************/ - -#ifndef QDECLARATIVEVIDEO_H -#define QDECLARATIVEVIDEO_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qdeclarativemediabase_p.h" - -#include <qgraphicsvideoitem.h> - -#include <QtCore/qbasictimer.h> -#include <QtQuick1/qdeclarativeitem.h> - - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QTimerEvent; -class QVideoSurfaceFormat; - - -class QDeclarativeVideo : public QDeclarativeItem, public QDeclarativeMediaBase -{ - Q_OBJECT - Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) - Q_PROPERTY(bool autoLoad READ isAutoLoad WRITE setAutoLoad NOTIFY autoLoadChanged) - Q_PROPERTY(bool playing READ isPlaying WRITE setPlaying NOTIFY playingChanged) - Q_PROPERTY(bool paused READ isPaused WRITE setPaused NOTIFY pausedChanged) - Q_PROPERTY(Status status READ status NOTIFY statusChanged) - Q_PROPERTY(int duration READ duration NOTIFY durationChanged) - Q_PROPERTY(int position READ position WRITE setPosition NOTIFY positionChanged) - Q_PROPERTY(qreal volume READ volume WRITE setVolume NOTIFY volumeChanged) - Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY mutedChanged) - Q_PROPERTY(bool hasAudio READ hasAudio NOTIFY hasAudioChanged) - Q_PROPERTY(bool hasVideo READ hasVideo NOTIFY hasVideoChanged) - Q_PROPERTY(int bufferProgress READ bufferProgress NOTIFY bufferProgressChanged) - Q_PROPERTY(bool seekable READ isSeekable NOTIFY seekableChanged) - Q_PROPERTY(qreal playbackRate READ playbackRate WRITE setPlaybackRate NOTIFY playbackRateChanged) - Q_PROPERTY(Error error READ error NOTIFY errorChanged) - Q_PROPERTY(QString errorString READ errorString NOTIFY errorChanged) - Q_PROPERTY(FillMode fillMode READ fillMode WRITE setFillMode) - Q_PROPERTY(QDeclarativeMediaMetaData *metaData READ metaData CONSTANT) - Q_ENUMS(FillMode) - Q_ENUMS(Status) - Q_ENUMS(Error) -public: - enum FillMode - { - Stretch = Qt::IgnoreAspectRatio, - PreserveAspectFit = Qt::KeepAspectRatio, - PreserveAspectCrop = Qt::KeepAspectRatioByExpanding - }; - - enum Status - { - UnknownStatus = QMediaPlayer::UnknownMediaStatus, - NoMedia = QMediaPlayer::NoMedia, - Loading = QMediaPlayer::LoadingMedia, - Loaded = QMediaPlayer::LoadedMedia, - Stalled = QMediaPlayer::StalledMedia, - Buffering = QMediaPlayer::BufferingMedia, - Buffered = QMediaPlayer::BufferedMedia, - EndOfMedia = QMediaPlayer::EndOfMedia, - InvalidMedia = QMediaPlayer::InvalidMedia - }; - - enum Error - { - NoError = QMediaPlayer::NoError, - ResourceError = QMediaPlayer::ResourceError, - FormatError = QMediaPlayer::FormatError, - NetworkError = QMediaPlayer::NetworkError, - AccessDenied = QMediaPlayer::AccessDeniedError, - ServiceMissing = QMediaPlayer::ServiceMissingError - }; - - QDeclarativeVideo(QDeclarativeItem *parent = 0); - ~QDeclarativeVideo(); - - bool hasAudio() const; - bool hasVideo() const; - - FillMode fillMode() const; - void setFillMode(FillMode mode); - - Status status() const; - Error error() const; - - void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); - - void classBegin(); - void componentComplete(); - -public Q_SLOTS: - void play(); - void pause(); - void stop(); - -Q_SIGNALS: - void sourceChanged(); - void autoLoadChanged(); - void playingChanged(); - void pausedChanged(); - void loopCountChanged(); - - void started(); - void resumed(); - void paused(); - void stopped(); - - void statusChanged(); - - void durationChanged(); - void positionChanged(); - - void volumeChanged(); - void mutedChanged(); - void hasAudioChanged(); - void hasVideoChanged(); - - void bufferProgressChanged(); - - void seekableChanged(); - void playbackRateChanged(); - - void errorChanged(); - void error(QDeclarativeVideo::Error error, const QString &errorString); - -protected: - void geometryChanged(const QRectF &geometry, const QRectF &); - -private Q_SLOTS: - void _q_nativeSizeChanged(const QSizeF &size); - void _q_error(int, const QString &); - -private: - Q_DISABLE_COPY(QDeclarativeVideo) - - QGraphicsVideoItem *m_graphicsItem; - - Q_PRIVATE_SLOT(mediaBase(), void _q_statusChanged()) - - inline QDeclarativeMediaBase *mediaBase() { return this; } -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeVideo)) - -QT_END_HEADER - -#endif diff --git a/src/imports/multimedia/qdeclarativevideooutput.cpp b/src/imports/multimedia/qdeclarativevideooutput.cpp deleted file mode 100644 index 2371fdb..0000000 --- a/src/imports/multimedia/qdeclarativevideooutput.cpp +++ /dev/null @@ -1,366 +0,0 @@ -/**************************************************************************** -** -** 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 "qdeclarativevideooutput_p.h" - -#include "qsgvideonode_p.h" -#include "qsgvideonode_i420.h" -#include "qsgvideonode_rgb.h" - -#include <QtDeclarative/qquickitem.h> - -#include <QtMultimedia/QAbstractVideoSurface> -#include <QtMultimedia/qmediaservice.h> -#include <QtMultimedia/qvideorenderercontrol.h> -#include <QtMultimedia/qvideosurfaceformat.h> - - -#include <QtCore/qmetaobject.h> - -//#define DEBUG_VIDEOITEM - -class QSGVideoItemSurface : public QAbstractVideoSurface -{ -public: - QSGVideoItemSurface(QDeclarativeVideoOutput *item, QObject *parent = 0) : - QAbstractVideoSurface(parent), - m_item(item) - { - } - - ~QSGVideoItemSurface() - { - } - - QList<QVideoFrame::PixelFormat> supportedPixelFormats(QAbstractVideoBuffer::HandleType handleType) const - { - QList<QVideoFrame::PixelFormat> formats; - - foreach (QSGVideoNodeFactory* factory, m_item->m_videoNodeFactories) { - formats.append(factory->supportedPixelFormats(handleType)); - } - - return formats; - } - - bool start(const QVideoSurfaceFormat &format) - { -#ifdef DEBUG_VIDEOITEM - qDebug() << Q_FUNC_INFO << format; -#endif - - if (!supportedPixelFormats(format.handleType()).contains(format.pixelFormat())) - return false; - - return QAbstractVideoSurface::start(format); - } - - virtual bool present(const QVideoFrame &frame) - { - if (!frame.isValid()) { - qWarning() << Q_FUNC_INFO << "I'm getting bad frames here..."; - return false; - } - m_item->present(frame); - return true; - } - -private: - QDeclarativeVideoOutput *m_item; -}; - -/*! - \qmlclass VideoOutput QDeclarativeVideoOutput - \brief The VideoOutput element allows you to render video or camera viewfinder. - - \ingroup qml-multimedia - - This element is part of the \bold{QtMultimedia 4.0} module. - - \qml - import QtQuick 2.0 - import QtMultimedia 4.0 - - Rectangle { - width: 800 - height: 600 - color: "black" - - MediaPlayer { - id: player - source: "file://video.webm" - playing: true - } - - VideoOutput { - id: videoOutput - source: player - anchors.fill: parent - } - } - - \endqml - - The VideoOutput item supports untransformed, stretched, and uniformly scaled video presentation. - For a description of stretched uniformly scaled presentation, see the \l fillMode property - description. - - \sa MediaPlayer, Camera -*/ - -/*! - \internal - \class QDeclarativeVideoOutput - \brief The QDeclarativeVideoOutput class provides a video output item. -*/ - -QDeclarativeVideoOutput::QDeclarativeVideoOutput(QQuickItem *parent) : - QQuickItem(parent), - m_fillMode(PreserveAspectFit) -{ - setFlag(ItemHasContents, true); - m_surface = new QSGVideoItemSurface(this); - connect(m_surface, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat)), - this, SLOT(_q_updateNativeSize(QVideoSurfaceFormat)), Qt::QueuedConnection); - - m_videoNodeFactories.append(new QSGVideoNodeFactory_I420); - m_videoNodeFactories.append(new QSGVideoNodeFactory_RGB); -} - -QDeclarativeVideoOutput::~QDeclarativeVideoOutput() -{ - m_source.clear(); - _q_updateMediaObject(); - delete m_surface; - qDeleteAll(m_videoNodeFactories); -} - -/*! - \qmlproperty variant VideoOutput::source - - This property holds the source item providing the video frames like MediaPlayer or Camera. -*/ - -void QDeclarativeVideoOutput::setSource(QObject *source) -{ -#ifdef DEBUG_VIDEOITEM - qDebug() << Q_FUNC_INFO << source; -#endif - - if (source == m_source.data()) - return; - - if (m_source) - disconnect(0, m_source.data(), SLOT(_q_updateMediaObject())); - - m_source = source; - - if (m_source) { - const QMetaObject *metaObject = m_source.data()->metaObject(); - const QMetaProperty mediaObjectProperty = metaObject->property( - metaObject->indexOfProperty("mediaObject")); - - if (mediaObjectProperty.hasNotifySignal()) { - QMetaMethod method = mediaObjectProperty.notifySignal(); - QMetaObject::connect(m_source.data(), method.methodIndex(), - this, this->metaObject()->indexOfSlot("updateMediaObject()"), - Qt::DirectConnection, 0); - - } - } - - _q_updateMediaObject(); - emit sourceChanged(); -} - -void QDeclarativeVideoOutput::_q_updateMediaObject() -{ - QMediaObject *mediaObject = 0; - - if (m_source) - mediaObject = qobject_cast<QMediaObject*>(m_source.data()->property("mediaObject").value<QObject*>()); - -#ifdef DEBUG_VIDEOITEM - qDebug() << Q_FUNC_INFO << mediaObject; -#endif - - if (m_mediaObject.data() == mediaObject) - return; - - if (m_rendererControl) { - m_rendererControl.data()->setSurface(0); - m_service.data()->releaseControl(m_rendererControl.data()); - } - - m_mediaObject = mediaObject; - m_mediaObject.clear(); - m_service.clear(); - m_rendererControl.clear(); - - if (mediaObject) { - if (QMediaService *service = mediaObject->service()) { - if (QMediaControl *control = service->requestControl(QVideoRendererControl_iid)) { - if ((m_rendererControl = qobject_cast<QVideoRendererControl *>(control))) { - m_service = service; - m_mediaObject = mediaObject; - m_rendererControl.data()->setSurface(m_surface); - } else { - qWarning() << Q_FUNC_INFO << "Media service has no renderer control available"; - service->releaseControl(control); - } - } - } - } -} - -void QDeclarativeVideoOutput::present(const QVideoFrame &frame) -{ - m_frame = frame; - update(); -} - -/*! - \qmlproperty enumeration VideoOutput::fillMode - - Set this property to define how the video is scaled to fit the target area. - - \list - \o Stretch - the video is scaled to fit. - \o PreserveAspectFit - the video is scaled uniformly to fit without cropping - \o PreserveAspectCrop - the video is scaled uniformly to fill, cropping if necessary - \endlist - - The default fill mode is PreserveAspectFit. -*/ - -QDeclarativeVideoOutput::FillMode QDeclarativeVideoOutput::fillMode() const -{ - return m_fillMode; -} - -void QDeclarativeVideoOutput::setFillMode(FillMode mode) -{ - if (mode == m_fillMode) - return; - - m_fillMode = mode; - update(); - - emit fillModeChanged(mode); -} - -void QDeclarativeVideoOutput::_q_updateNativeSize(const QVideoSurfaceFormat &format) -{ - const QSize &size = format.sizeHint(); - if (m_nativeSize != size) { - m_nativeSize = size; - - setImplicitWidth(size.width()); - setImplicitHeight(size.height()); - } -} - -void QDeclarativeVideoOutput::_q_updateGeometry() -{ - QRectF rect(0, 0, width(), height()); - - if (m_nativeSize.isEmpty()) { - //this is necessary for item to receive the - //first paint event and configure video surface. - m_boundingRect = rect; - m_sourceRect = QRectF(0, 0, 1, 1); - } else if (m_fillMode == Stretch) { - m_boundingRect = rect; - m_sourceRect = QRectF(0, 0, 1, 1); - } else if (m_fillMode == PreserveAspectFit) { - QSizeF size = m_nativeSize; - size.scale(rect.size(), Qt::KeepAspectRatio); - - m_boundingRect = QRectF(0, 0, size.width(), size.height()); - m_boundingRect.moveCenter(rect.center()); - - m_sourceRect = QRectF(0, 0, 1, 1); - } else if (m_fillMode == PreserveAspectCrop) { - 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)); - } -} - -QSGNode *QDeclarativeVideoOutput::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) -{ - QSGVideoNode *videoNode = static_cast<QSGVideoNode *>(oldNode); - - if (videoNode && videoNode->pixelFormat() != m_frame.pixelFormat()) { -#ifdef DEBUG_VIDEOITEM - qDebug() << "updatePaintNode: deleting old video node because frame format changed..."; -#endif - delete videoNode; - videoNode = 0; - } - - if (!m_frame.isValid()) { -#ifdef DEBUG_VIDEOITEM - qDebug() << "updatePaintNode: no frames yet... aborting..."; -#endif - return 0; - } - - if (videoNode == 0) { - foreach (QSGVideoNodeFactory* factory, m_videoNodeFactories) { - videoNode = factory->createNode(m_surface->surfaceFormat()); - if (videoNode) - break; - } - } - - if (videoNode == 0) - return 0; - - _q_updateGeometry(); - videoNode->setTexturedRectGeometry(m_boundingRect, m_sourceRect); - videoNode->setCurrentFrame(m_frame); - return videoNode; -} diff --git a/src/imports/multimedia/qdeclarativevideooutput_p.h b/src/imports/multimedia/qdeclarativevideooutput_p.h deleted file mode 100644 index 80170f1..0000000 --- a/src/imports/multimedia/qdeclarativevideooutput_p.h +++ /dev/null @@ -1,115 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -#ifndef QDECLARATIVEVIDEOOUTPUT_P_H -#define QDECLARATIVEVIDEOOUTPUT_P_H - -#include <qquickitem.h> - -#include <QtMultimedia/qvideoframe.h> -#include <QtMultimedia/qmediaobject.h> - -#include <QtCore/qsharedpointer.h> - -#include "qsgvideonode_p.h" - -class QSGVideoItemSurface; -class QVideoRendererControl; -class QMediaService; -class QVideoSurfaceFormat; - -class QDeclarativeVideoOutput : public QQuickItem -{ - Q_OBJECT - Q_DISABLE_COPY(QDeclarativeVideoOutput) - Q_PROPERTY(QObject* source READ source WRITE setSource NOTIFY sourceChanged) - Q_PROPERTY(FillMode fillMode READ fillMode WRITE setFillMode NOTIFY fillModeChanged) - Q_ENUMS(FillMode) - -public: - enum FillMode - { - Stretch = Qt::IgnoreAspectRatio, - PreserveAspectFit = Qt::KeepAspectRatio, - PreserveAspectCrop = Qt::KeepAspectRatioByExpanding - }; - - QDeclarativeVideoOutput(QQuickItem *parent = 0); - ~QDeclarativeVideoOutput(); - - QObject *source() const { return m_source.data(); } - void setSource(QObject *source); - - FillMode fillMode() const; - void setFillMode(FillMode mode); - -Q_SIGNALS: - void sourceChanged(); - void fillModeChanged(QDeclarativeVideoOutput::FillMode); - -protected: - QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *); - -private Q_SLOTS: - void _q_updateMediaObject(); - void _q_updateNativeSize(const QVideoSurfaceFormat&); - void _q_updateGeometry(); - -private: - void present(const QVideoFrame &frame); - - friend class QSGVideoItemSurface; - - QWeakPointer<QObject> m_source; - QWeakPointer<QMediaObject> m_mediaObject; - QWeakPointer<QMediaService> m_service; - QWeakPointer<QVideoRendererControl> m_rendererControl; - - QList<QSGVideoNodeFactory*> m_videoNodeFactories; - QSGVideoItemSurface *m_surface; - QVideoFrame m_frame; - FillMode m_fillMode; - QSize m_nativeSize; - QRectF m_boundingRect; - QRectF m_sourceRect; -}; - -#endif // QDECLARATIVEVIDEOOUTPUT_H diff --git a/src/imports/multimedia/qmldir b/src/imports/multimedia/qmldir deleted file mode 100644 index 91caaba..0000000 --- a/src/imports/multimedia/qmldir +++ /dev/null @@ -1 +0,0 @@ -plugin declarative_multimedia diff --git a/src/imports/multimedia/qmldir.qtmultimediakit b/src/imports/multimedia/qmldir.qtmultimediakit deleted file mode 100644 index 4942048..0000000 --- a/src/imports/multimedia/qmldir.qtmultimediakit +++ /dev/null @@ -1 +0,0 @@ -plugin declarative_multimedia ../../QtMultimedia diff --git a/src/imports/multimedia/qsgvideonode.cpp b/src/imports/multimedia/qsgvideonode.cpp deleted file mode 100644 index 712caff..0000000 --- a/src/imports/multimedia/qsgvideonode.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** 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 "qsgvideonode_p.h" - -QSGVideoNode::QSGVideoNode() -{ -} - -void QSGVideoNode::setTexturedRectGeometry(const QRectF &rect, const QRectF &textureRect) -{ - if (rect == m_rect && textureRect == m_textureRect) - return; - - m_rect = rect; - m_textureRect = textureRect; - - QSGGeometry *g = geometry(); - - if (g == 0) { - g = new QSGGeometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4); - QSGGeometry::updateTexturedRectGeometry(g, rect, textureRect); - setGeometry(g); - } else { - QSGGeometry::updateTexturedRectGeometry(g, rect, textureRect); - } - - markDirty(DirtyGeometry); -} diff --git a/src/imports/multimedia/qsgvideonode_i420.cpp b/src/imports/multimedia/qsgvideonode_i420.cpp deleted file mode 100644 index 11135c1..0000000 --- a/src/imports/multimedia/qsgvideonode_i420.cpp +++ /dev/null @@ -1,296 +0,0 @@ -/**************************************************************************** -** -** 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 "qsgvideonode_i420.h" -#include <QtDeclarative/qsgtexturematerial.h> -#include <QtDeclarative/qsgmaterial.h> -#include <QtGui/QOpenGLContext> -#include <QtGui/QOpenGLFunctions> -#include <QtOpenGL/qglshaderprogram.h> - -QList<QVideoFrame::PixelFormat> QSGVideoNodeFactory_I420::supportedPixelFormats( - QAbstractVideoBuffer::HandleType handleType) const -{ - QList<QVideoFrame::PixelFormat> formats; - - if (handleType == QAbstractVideoBuffer::NoHandle) - formats << QVideoFrame::Format_YUV420P << QVideoFrame::Format_YV12; - - return formats; -} - -QSGVideoNode *QSGVideoNodeFactory_I420::createNode(const QVideoSurfaceFormat &format) -{ - if (supportedPixelFormats(format.handleType()).contains(format.pixelFormat())) - return new QSGVideoNode_I420(format); - - return 0; -} - - -class QSGVideoMaterialShader_YUV420 : public QSGMaterialShader -{ -public: - void updateState(const RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial); - - virtual char const *const *attributeNames() const { - static const char *names[] = { - "qt_VertexPosition", - "qt_VertexTexCoord", - 0 - }; - return names; - } - -protected: - - virtual const char *vertexShader() const { - const char *shader = - "uniform highp mat4 qt_Matrix; \n" - "attribute highp vec4 qt_VertexPosition; \n" - "attribute highp vec2 qt_VertexTexCoord; \n" - "varying highp vec2 qt_TexCoord; \n" - "void main() { \n" - " qt_TexCoord = qt_VertexTexCoord; \n" - " gl_Position = qt_Matrix * qt_VertexPosition; \n" - "}"; - return shader; - } - - virtual const char *fragmentShader() const { - static const char *shader = - "uniform sampler2D yTexture;" - "uniform sampler2D uTexture;" - "uniform sampler2D vTexture;" - "uniform mediump mat4 colorMatrix;" - "uniform lowp float opacity;" - "" - "varying highp vec2 qt_TexCoord;" - "" - "void main()" - "{" - " mediump float Y = texture2D(yTexture, qt_TexCoord).r;" - " mediump float U = texture2D(uTexture, qt_TexCoord).r;" - " mediump float V = texture2D(vTexture, qt_TexCoord).r;" - " mediump vec4 color = vec4(Y, U, V, 1.);" - " gl_FragColor = colorMatrix * color * opacity;" - "}"; - return shader; - } - - virtual void initialize() { - m_id_matrix = program()->uniformLocation("qt_Matrix"); - m_id_yTexture = program()->uniformLocation("yTexture"); - m_id_uTexture = program()->uniformLocation("uTexture"); - m_id_vTexture = program()->uniformLocation("vTexture"); - m_id_colorMatrix = program()->uniformLocation("colorMatrix"); - m_id_opacity = program()->uniformLocation("opacity"); - } - - int m_id_matrix; - int m_id_yTexture; - int m_id_uTexture; - int m_id_vTexture; - int m_id_colorMatrix; - int m_id_opacity; -}; - - -class QSGVideoMaterial_YUV420 : public QSGMaterial -{ -public: - QSGVideoMaterial_YUV420(const QVideoSurfaceFormat &format) - { - switch (format.yCbCrColorSpace()) { - case QVideoSurfaceFormat::YCbCr_JPEG: - colorMatrix = 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: - colorMatrix = 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: - colorMatrix = 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); - } - - setFlag(Blending, false); - } - - virtual QSGMaterialType *type() const { - static QSGMaterialType theType; - return &theType; - } - - virtual QSGMaterialShader *createShader() const { - return new QSGVideoMaterialShader_YUV420; - } - - virtual int compare(const QSGMaterial *other) const { - const QSGVideoMaterial_YUV420 *m = static_cast<const QSGVideoMaterial_YUV420 *>(other); - int d = idY - m->idY; - if (d) - return d; - else if ((d = idU - m->idU) != 0) - return d; - else - return idV - m->idV; - } - - void updateBlending() { - setFlag(Blending, qFuzzyCompare(opacity, 1.0) ? false : true); - } - - GLuint idY; - GLuint idU; - GLuint idV; - qreal opacity; - QMatrix4x4 colorMatrix; -}; - - -QSGVideoNode_I420::QSGVideoNode_I420(const QVideoSurfaceFormat &format) : - m_width(0), - m_height(0), - m_format(format) -{ - m_material = new QSGVideoMaterial_YUV420(format); - setMaterial(m_material); - m_material->opacity = 1; -} - -QSGVideoNode_I420::~QSGVideoNode_I420() -{ - if (m_width != 0 && m_height != 0) - glDeleteTextures(3, m_id); -} - -void QSGVideoNode_I420::setCurrentFrame(const QVideoFrame &frame) -{ - m_frame = frame; - - m_frame.map(QAbstractVideoBuffer::ReadOnly); - - int fw = frame.width(); - int fh = frame.height(); - - // Frame has changed size, recreate textures... - if (fw != m_width || fh != m_height) { - if (m_width != 0 && m_height != 0) - glDeleteTextures(3, m_id); - glGenTextures(3, m_id); - m_width = fw; - m_height = fh; - - m_material->idY = m_id[0]; - m_material->idU = m_id[1]; - m_material->idV = m_id[2]; - } - - const uchar *bits = frame.bits(); - int bpl = frame.bytesPerLine(); - int bpl2 = (bpl / 2 + 3) & ~3; - int offsetU = bpl * fh; - int offsetV = bpl * fh + bpl2 * fh / 2; - - if (m_frame.pixelFormat() == QVideoFrame::Format_YV12) - qSwap(offsetU, offsetV); - - bindTexture(m_id[0], GL_TEXTURE0, fw, fh, bits); - bindTexture(m_id[1], GL_TEXTURE1, fw/2, fh / 2, bits + offsetU); - bindTexture(m_id[2], GL_TEXTURE2, fw/2, fh / 2, bits + offsetV); - - m_frame.unmap(); - - markDirty(DirtyMaterial); -} - -void QSGVideoNode_I420::bindTexture(int id, int unit, int w, int h, const uchar *bits) -{ - QOpenGLFunctions *functions = QOpenGLContext::currentContext()->functions(); - functions->glActiveTexture(unit); - glBindTexture(GL_TEXTURE_2D, id); - glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, w, h, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, bits); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); -} - - -void QSGVideoMaterialShader_YUV420::updateState(const RenderState &state, - QSGMaterial *newMaterial, - QSGMaterial *oldMaterial) -{ - Q_UNUSED(oldMaterial); - - QOpenGLFunctions *functions = state.context()->functions(); - QSGVideoMaterial_YUV420 *mat = static_cast<QSGVideoMaterial_YUV420 *>(newMaterial); - program()->setUniformValue(m_id_yTexture, 0); - program()->setUniformValue(m_id_uTexture, 1); - program()->setUniformValue(m_id_vTexture, 2); - - functions->glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, mat->idY); - functions->glActiveTexture(GL_TEXTURE1); - glBindTexture(GL_TEXTURE_2D, mat->idU); - functions->glActiveTexture(GL_TEXTURE2); - glBindTexture(GL_TEXTURE_2D, mat->idV); - - program()->setUniformValue(m_id_colorMatrix, mat->colorMatrix); - if (state.isOpacityDirty()) { - mat->opacity = state.opacity(); - program()->setUniformValue(m_id_opacity, GLfloat(mat->opacity)); - } - - if (state.isMatrixDirty()) - program()->setUniformValue(m_id_matrix, state.combinedMatrix()); -} diff --git a/src/imports/multimedia/qsgvideonode_i420.h b/src/imports/multimedia/qsgvideonode_i420.h deleted file mode 100644 index b02864a..0000000 --- a/src/imports/multimedia/qsgvideonode_i420.h +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -#ifndef QSGVIDEONODE_I420_H -#define QSGVIDEONODE_I420_H - -#include "qsgvideonode_p.h" -#include <QtMultimedia/qvideosurfaceformat.h> - -class QSGVideoMaterial_YUV420; -class QSGVideoNode_I420 : public QSGVideoNode -{ -public: - QSGVideoNode_I420(const QVideoSurfaceFormat &format); - ~QSGVideoNode_I420(); - - virtual QVideoFrame::PixelFormat pixelFormat() const { - return m_format.pixelFormat(); - } - void setCurrentFrame(const QVideoFrame &frame); - -private: - void bindTexture(int id, int unit, int w, int h, const uchar *bits); - - int m_width; - int m_height; - GLuint m_id[3]; - - QVideoSurfaceFormat m_format; - QSGVideoMaterial_YUV420 *m_material; - QVideoFrame m_frame; -}; - -class QSGVideoNodeFactory_I420 : public QSGVideoNodeFactory { -public: - QList<QVideoFrame::PixelFormat> supportedPixelFormats(QAbstractVideoBuffer::HandleType handleType) const; - QSGVideoNode *createNode(const QVideoSurfaceFormat &format); -}; - - -#endif // QSGVIDEONODE_I420_H diff --git a/src/imports/multimedia/qsgvideonode_p.h b/src/imports/multimedia/qsgvideonode_p.h deleted file mode 100644 index 466b456..0000000 --- a/src/imports/multimedia/qsgvideonode_p.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -#ifndef QSGVIDEONODE_P_H -#define QSGVIDEONODE_P_H - -#include <QtDeclarative/qsgnode.h> - -#include <QtMultimedia/qvideoframe.h> -#include <QtMultimedia/qvideosurfaceformat.h> -#include <QtOpenGL/qglfunctions.h> - -class QSGVideoNode : public QSGGeometryNode -{ -public: - QSGVideoNode(); - - virtual void setCurrentFrame(const QVideoFrame &frame) = 0; - virtual QVideoFrame::PixelFormat pixelFormat() const = 0; - - void setTexturedRectGeometry(const QRectF &boundingRect, const QRectF &textureRect); - -private: - QRectF m_rect; - QRectF m_textureRect; -}; - -class QSGVideoNodeFactory { -public: - virtual QList<QVideoFrame::PixelFormat> supportedPixelFormats(QAbstractVideoBuffer::HandleType handleType) const = 0; - virtual QSGVideoNode *createNode(const QVideoSurfaceFormat &format) = 0; -}; - -#endif // QSGVIDEONODE_H diff --git a/src/imports/multimedia/qsgvideonode_rgb.cpp b/src/imports/multimedia/qsgvideonode_rgb.cpp deleted file mode 100644 index 41d778e..0000000 --- a/src/imports/multimedia/qsgvideonode_rgb.cpp +++ /dev/null @@ -1,275 +0,0 @@ -/**************************************************************************** -** -** 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 "qsgvideonode_rgb.h" -#include <QtDeclarative/qsgtexturematerial.h> -#include <QtDeclarative/qsgmaterial.h> -#include <QtGui/QOpenGLContext> -#include <QtGui/QOpenGLFunctions> -#include <QtOpenGL/qglshaderprogram.h> - -QList<QVideoFrame::PixelFormat> QSGVideoNodeFactory_RGB::supportedPixelFormats( - QAbstractVideoBuffer::HandleType handleType) const -{ - QList<QVideoFrame::PixelFormat> pixelFormats; - - if (handleType == QAbstractVideoBuffer::NoHandle) { - pixelFormats.append(QVideoFrame::Format_RGB565); - pixelFormats.append(QVideoFrame::Format_RGB32); - pixelFormats.append(QVideoFrame::Format_ARGB32); - pixelFormats.append(QVideoFrame::Format_BGR32); - pixelFormats.append(QVideoFrame::Format_BGRA32); - } - - return pixelFormats; -} - -QSGVideoNode *QSGVideoNodeFactory_RGB::createNode(const QVideoSurfaceFormat &format) -{ - if (supportedPixelFormats(format.handleType()).contains(format.pixelFormat())) - return new QSGVideoNode_RGB(format); - - return 0; -} - - -class QSGVideoMaterialShader_RGB : public QSGMaterialShader -{ -public: - QSGVideoMaterialShader_RGB(QVideoFrame::PixelFormat pixelFormat) - : QSGMaterialShader(), - m_pixelFormat(pixelFormat) - { - } - - void updateState(const RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial); - - virtual char const *const *attributeNames() const { - static const char *names[] = { - "qt_VertexPosition", - "qt_VertexTexCoord", - 0 - }; - return names; - } - -protected: - - virtual const char *vertexShader() const { - const char *shader = - "uniform highp mat4 qt_Matrix; \n" - "attribute highp vec4 qt_VertexPosition; \n" - "attribute highp vec2 qt_VertexTexCoord; \n" - "varying highp vec2 qt_TexCoord; \n" - "void main() { \n" - " qt_TexCoord = qt_VertexTexCoord; \n" - " gl_Position = qt_Matrix * qt_VertexPosition; \n" - "}"; - return shader; - } - - virtual const char *fragmentShader() const { - static const char *shader = - "uniform sampler2D rgbTexture;" - "uniform lowp float opacity;" - "" - "varying highp vec2 qt_TexCoord;" - "" - "void main()" - "{" - " gl_FragColor = texture2D(rgbTexture, qt_TexCoord) * opacity;" - "}"; - - static const char *colorsSwapShader = - "uniform sampler2D rgbTexture;" - "uniform lowp float opacity;" - "" - "varying highp vec2 qt_TexCoord;" - "" - "void main()" - "{" - " gl_FragColor = vec4(texture2D(rgbTexture, qt_TexCoord).bgr, 1.0) * opacity;" - "}"; - - - switch (m_pixelFormat) { - case QVideoFrame::Format_RGB32: - case QVideoFrame::Format_ARGB32: - return colorsSwapShader; - default: - return shader; - } - } - - virtual void initialize() { - m_id_matrix = program()->uniformLocation("qt_Matrix"); - m_id_rgbTexture = program()->uniformLocation("rgbTexture"); - m_id_opacity = program()->uniformLocation("opacity"); - } - - int m_id_matrix; - int m_id_rgbTexture; - int m_id_opacity; - QVideoFrame::PixelFormat m_pixelFormat; -}; - - -class QSGVideoMaterial_RGB : public QSGMaterial -{ -public: - QSGVideoMaterial_RGB(const QVideoSurfaceFormat &format) : - m_format(format), - m_textureId(0), - m_opacity(1.0) - { - setFlag(Blending, false); - } - - ~QSGVideoMaterial_RGB() - { - if (m_textureId) - glDeleteTextures(1, &m_textureId); - } - - virtual QSGMaterialType *type() const { - static QSGMaterialType theType; - return &theType; - } - - virtual QSGMaterialShader *createShader() const { - return new QSGVideoMaterialShader_RGB(m_format.pixelFormat()); - } - - virtual int compare(const QSGMaterial *other) const { - const QSGVideoMaterial_RGB *m = static_cast<const QSGVideoMaterial_RGB *>(other); - return m_textureId - m->m_textureId; - } - - void updateBlending() { - setFlag(Blending, qFuzzyCompare(m_opacity, qreal(1.0)) ? false : true); - } - - void setVideoFrame(const QVideoFrame &frame) { - m_frame = frame; - } - - void bind() - { - QOpenGLFunctions *functions = QOpenGLContext::currentContext()->functions(); - - if (m_frame.isValid() && m_frame.map(QAbstractVideoBuffer::ReadOnly)) { - if (m_textureSize != m_frame.size()) { - if (!m_textureSize.isEmpty()) - glDeleteTextures(1, &m_textureId); - glGenTextures(1, &m_textureId); - m_textureSize = m_frame.size(); - } - - GLint dataType = GL_UNSIGNED_BYTE; - GLint dataFormat = GL_RGBA; - - if (m_frame.pixelFormat() == QVideoFrame::Format_RGB565) { - dataType = GL_UNSIGNED_SHORT_5_6_5; - dataFormat = GL_RGB; - } - - functions->glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, m_textureId); - glTexImage2D(GL_TEXTURE_2D, 0, dataFormat, - m_textureSize.width(), m_textureSize.height(), - 0, dataFormat, dataType, m_frame.bits()); - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - - m_frame.unmap(); - m_frame = QVideoFrame(); - } else { - functions->glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, m_textureId); - } - } - - QVideoFrame m_frame; - QSize m_textureSize; - QVideoSurfaceFormat m_format; - GLuint m_textureId; - qreal m_opacity; -}; - - -QSGVideoNode_RGB::QSGVideoNode_RGB(const QVideoSurfaceFormat &format) : - m_format(format) -{ - m_material = new QSGVideoMaterial_RGB(format); - setMaterial(m_material); -} - -QSGVideoNode_RGB::~QSGVideoNode_RGB() -{ -} - -void QSGVideoNode_RGB::setCurrentFrame(const QVideoFrame &frame) -{ - m_material->setVideoFrame(frame); - markDirty(DirtyMaterial); -} - -void QSGVideoMaterialShader_RGB::updateState(const RenderState &state, - QSGMaterial *newMaterial, - QSGMaterial *oldMaterial) -{ - Q_UNUSED(oldMaterial); - QSGVideoMaterial_RGB *mat = static_cast<QSGVideoMaterial_RGB *>(newMaterial); - program()->setUniformValue(m_id_rgbTexture, 0); - - mat->bind(); - - if (state.isOpacityDirty()) { - mat->m_opacity = state.opacity(); - mat->updateBlending(); - program()->setUniformValue(m_id_opacity, GLfloat(mat->m_opacity)); - } - - if (state.isMatrixDirty()) - program()->setUniformValue(m_id_matrix, state.combinedMatrix()); -} diff --git a/src/imports/multimedia/qsgvideonode_rgb.h b/src/imports/multimedia/qsgvideonode_rgb.h deleted file mode 100644 index cd82adc..0000000 --- a/src/imports/multimedia/qsgvideonode_rgb.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -#ifndef QSGVIDEONODE_RGB_H -#define QSGVIDEONODE_RGB_H - -#include "qsgvideonode_p.h" -#include <QtMultimedia/qvideosurfaceformat.h> - -class QSGVideoMaterial_RGB; - -class QSGVideoNode_RGB : public QSGVideoNode -{ -public: - QSGVideoNode_RGB(const QVideoSurfaceFormat &format); - ~QSGVideoNode_RGB(); - - virtual QVideoFrame::PixelFormat pixelFormat() const { - return m_format.pixelFormat(); - } - void setCurrentFrame(const QVideoFrame &frame); - -private: - QVideoSurfaceFormat m_format; - QSGVideoMaterial_RGB *m_material; - QVideoFrame m_frame; -}; - -class QSGVideoNodeFactory_RGB : public QSGVideoNodeFactory { -public: - QList<QVideoFrame::PixelFormat> supportedPixelFormats(QAbstractVideoBuffer::HandleType handleType) const; - QSGVideoNode *createNode(const QVideoSurfaceFormat &format); -}; - - -#endif // QSGVIDEONODE_RGB_H diff --git a/src/imports/qimportbase.pri b/src/imports/qimportbase.pri deleted file mode 100644 index 999bc5c..0000000 --- a/src/imports/qimportbase.pri +++ /dev/null @@ -1,30 +0,0 @@ -load(qt_module) - -TEMPLATE = lib -CONFIG += qt plugin - -win32|mac:!win32-msvc:!macx-xcode:CONFIG += debug_and_release - -isEmpty(TARGETPATH) { - error("qimportbase.pri: You must provide a TARGETPATH!") -} -isEmpty(TARGET) { - error("qimportbase.pri: You must provide a TARGET!") -} - -QMLDIRFILE = $${_PRO_FILE_PWD_}/qmldir -copy2build.input = QMLDIRFILE -copy2build.output = $$QT.multimedia.imports/$$TARGETPATH/qmldir -!contains(TEMPLATE_PREFIX, vc):copy2build.variable_out = PRE_TARGETDEPS -copy2build.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT} -copy2build.name = COPY ${QMAKE_FILE_IN} -copy2build.CONFIG += no_link -# `clean' should leave the build in a runnable state, which means it shouldn't delete qmldir -copy2build.CONFIG += no_clean -QMAKE_EXTRA_COMPILERS += copy2build - -TARGET = $$qtLibraryTarget($$TARGET) -contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols - -load(qt_targets) - |