+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** 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$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtMultimedia 4.0
-
-Item {
- id: video
-
- property alias fillMode: videoOut.fillMode
- property alias orientation: videoOut.orientation
-
- readonly property int stretch: VideoOutput.Stretch
- readonly property int preserveAspectFit: VideoOutput.PreserveAspectFit
- readonly property int preserveAspectCrop: VideoOutput.PreserveAspectCrop
-
- property alias autoLoad: player.autoLoad
- property alias bufferProgress: player.bufferProgress
- property alias duration: player.duration
- property alias error: player.error
- property alias errorString: player.errorString
- property alias hasAudio: player.hasAudio
- property alias hasVideo: player.hasVideo
- property alias metaData: player.metaData
- property alias muted: player.muted
- property alias paused: player.paused
- property alias playbackRate: player.playbackRate
- property alias playing: player.playing
- property alias position: player.position
- property alias seekable: player.seekable
- property alias source: player.source
- property alias status: player.status
- property alias volume: player.volume
-
- signal resumed
- signal started
- signal stopped
-
- VideoOutput {
- id: videoOut
- anchors.fill: video
- source: player
- }
-
- MediaPlayer {
- id: player
- onResumed: video.resumed()
- onStarted: video.started()
- onStopped: video.stopped()
- }
-
- function play() {
- player.play();
- }
-
- function pause() {
- player.pause();
- }
-
- function stop() {
- player.stop();
- }
-}
#include "qdeclarativemediametadata_p.h"
#include "qdeclarativeaudio_p.h"
-#include "qdeclarativeaudio_p_4.h"
#include "qdeclarativevideooutput_p.h"
#include "qdeclarativeradio_p.h"
#include "qdeclarativeradiodata_p.h"
public:
virtual void registerTypes(const char *uri)
{
- Q_ASSERT(QLatin1String(uri) == QLatin1String("QtMultimedia")
- || QLatin1String(uri) == QLatin1String("Qt.multimediakit"));
+ Q_ASSERT(QLatin1String(uri) == QLatin1String("QtMultimedia"));
- qmlRegisterType<QSoundEffect>(uri, 4, 0, "SoundEffect");
- qmlRegisterType<QDeclarativeAudio_4>(uri, 4, 0, "Audio");
- qmlRegisterType<QDeclarativeAudio_4>(uri, 4, 0, "MediaPlayer");
- qmlRegisterType<QDeclarativeVideoOutput>(uri, 4, 0, "VideoOutput");
- qmlRegisterType<QDeclarativeRadio>(uri, 4, 0, "Radio");
- qmlRegisterType<QDeclarativeRadioData>(uri, 4, 0, "RadioData");
- qmlRegisterType<QDeclarativeCamera>(uri, 4, 0, "Camera");
- qmlRegisterUncreatableType<QDeclarativeCameraCapture>(uri, 4, 0, "CameraCapture",
- trUtf8("CameraCapture is provided by Camera"));
- qmlRegisterUncreatableType<QDeclarativeCameraRecorder>(uri, 4, 0, "CameraRecorder",
- trUtf8("CameraRecorder is provided by Camera"));
- qmlRegisterUncreatableType<QDeclarativeCameraExposure>(uri, 4, 0, "CameraExposure",
- trUtf8("CameraExposure is provided by Camera"));
- qmlRegisterUncreatableType<QDeclarativeCameraFocus>(uri, 4, 0, "CameraFocus",
- trUtf8("CameraFocus is provided by Camera"));
- qmlRegisterUncreatableType<QDeclarativeCameraFlash>(uri, 4, 0, "CameraFlash",
- trUtf8("CameraFlash is provided by Camera"));
- qmlRegisterUncreatableType<QDeclarativeCameraImageProcessing>(uri, 4, 0, "CameraImageProcessing",
- trUtf8("CameraImageProcessing is only provided by Camera type"));
-
- // Introduced to help transition from QtMultimedia 4.0 to 5.0 (official for Qt 5)
- // the 4.0 versioned types will be removed once all clients have made the transition.
qmlRegisterType<QSoundEffect>(uri, 5, 0, "SoundEffect");
qmlRegisterType<QDeclarativeAudio>(uri, 5, 0, "Audio");
qmlRegisterType<QDeclarativeAudio>(uri, 5, 0, "MediaPlayer");
qdeclarativecamerafocus_p.h \
qdeclarativecameraimageprocessing_p.h \
qdeclarativecamerapreviewprovider_p.h \
- qdeclarativetorch_p.h \
- qdeclarativeaudio_p_4.h \
- qdeclarativemediabase_p_4.h \
- qdeclarativemediametadata_p_4.h
+ qdeclarativetorch_p.h
SOURCES += \
multimedia.cpp \
qdeclarativecamerafocus.cpp \
qdeclarativecameraimageprocessing.cpp \
qdeclarativecamerapreviewprovider.cpp \
- qdeclarativetorch.cpp \
- qdeclarativemediabase_4.cpp \
- qdeclarativeaudio_4.cpp
+ qdeclarativetorch.cpp
OTHER_FILES += \
- Video_4.qml \
Video.qml
# plugin.qmltypes is used by Qt Creator for syntax highlighting and the QML code model. It needs
# Tell qmake to create such makefile that qmldir, plugins.qmltypes and target
# (i.e. declarative_multimedia) are all copied to $$[QT_INSTALL_IMPORTS]/QtMultimedia directory,
-qmldir.files += $$PWD/qmldir $$PWD/plugins.qmltypes $$PWD/Video.qml $$PWD/Video_4.qml
+qmldir.files += $$PWD/qmldir $$PWD/plugins.qmltypes $$PWD/Video.qml
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
"UnavailableStatus": 0,
"UnloadedStatus": 1,
"LoadingStatus": 2,
- "LoadedStatus": 3,
- "StandbyStatus": 4,
- "StartingStatus": 5,
- "ActiveStatus": 6
+ "UnloadingStatus": 3,
+ "LoadedStatus": 4,
+ "StandbyStatus": 5,
+ "StartingStatus": 6,
+ "StoppingStatus": 7,
+ "ActiveStatus": 8
}
}
Enum {
Property { name: "lockStatus"; type: "QCamera::LockStatus"; isReadonly: true }
Signal {
name: "stateChanged"
+ type: "void"
Parameter { type: "QCamera::State" }
}
Signal {
name: "captureModeChanged"
+ type: "void"
Parameter { type: "QCamera::CaptureModes" }
}
Signal {
name: "statusChanged"
+ type: "void"
Parameter { type: "QCamera::Status" }
}
- Signal { name: "locked" }
- Signal { name: "lockFailed" }
+ Signal { name: "locked"; type: "void" }
+ Signal { name: "lockFailed"; type: "void" }
Signal {
name: "lockStatusChanged"
+ type: "void"
Parameter { type: "QCamera::LockStatus" }
Parameter { type: "QCamera::LockChangeReason" }
}
Signal {
name: "lockStatusChanged"
+ type: "void"
Parameter { type: "QCamera::LockType" }
Parameter { type: "QCamera::LockStatus" }
Parameter { type: "QCamera::LockChangeReason" }
}
Signal {
name: "error"
+ type: "void"
Parameter { type: "QCamera::Error" }
}
Method {
name: "setCaptureMode"
+ type: "void"
Parameter { name: "mode"; type: "QCamera::CaptureModes" }
}
- Method { name: "load" }
- Method { name: "unload" }
- Method { name: "start" }
- Method { name: "stop" }
- Method { name: "searchAndLock" }
- Method { name: "unlock" }
+ Method { name: "load"; type: "void" }
+ Method { name: "unload"; type: "void" }
+ Method { name: "start"; type: "void" }
+ Method { name: "stop"; type: "void" }
+ Method { name: "searchAndLock"; type: "void" }
+ Method { name: "unlock"; type: "void" }
Method {
name: "searchAndLock"
+ type: "void"
Parameter { name: "locks"; type: "QCamera::LockTypes" }
}
Method {
name: "unlock"
+ type: "void"
Parameter { name: "locks"; type: "QCamera::LockTypes" }
}
}
Property { name: "status"; type: "Status"; isReadonly: true }
Property { name: "duration"; type: "int"; isReadonly: true }
Property { name: "position"; type: "int" }
- Property { name: "volume"; type: "qreal" }
+ Property { name: "volume"; type: "double" }
Property { name: "muted"; type: "bool" }
Property { name: "hasAudio"; type: "bool"; isReadonly: true }
Property { name: "hasVideo"; type: "bool"; isReadonly: true }
Property { name: "bufferProgress"; type: "int"; isReadonly: true }
Property { name: "seekable"; type: "bool"; isReadonly: true }
- Property { name: "playbackRate"; type: "qreal" }
+ Property { name: "playbackRate"; type: "double" }
Property { name: "error"; type: "Error"; isReadonly: true }
Property { name: "errorString"; type: "string"; isReadonly: true }
Property {
}
Property { name: "mediaObject"; type: "QObject"; isReadonly: true; isPointer: true }
Property { name: "availability"; type: "Availability"; isReadonly: true }
- Signal { name: "loopCountChanged" }
- Signal { name: "paused" }
- Signal { name: "stopped" }
- Signal { name: "playing" }
+ Signal { name: "sourceChanged"; type: "void" }
+ Signal { name: "autoLoadChanged"; type: "void" }
+ Signal { name: "loopCountChanged"; type: "void" }
+ Signal { name: "playbackStateChanged"; type: "void" }
+ Signal { name: "autoPlayChanged"; type: "void" }
+ Signal { name: "paused"; type: "void" }
+ Signal { name: "stopped"; type: "void" }
+ Signal { name: "playing"; type: "void" }
+ Signal { name: "statusChanged"; type: "void" }
+ Signal { name: "durationChanged"; type: "void" }
+ Signal { name: "positionChanged"; type: "void" }
+ Signal { name: "volumeChanged"; type: "void" }
+ Signal { name: "mutedChanged"; type: "void" }
+ Signal { name: "hasAudioChanged"; type: "void" }
+ Signal { name: "hasVideoChanged"; type: "void" }
+ Signal { name: "bufferProgressChanged"; type: "void" }
+ Signal { name: "seekableChanged"; type: "void" }
+ Signal { name: "playbackRateChanged"; type: "void" }
Signal {
name: "availabilityChanged"
+ type: "void"
Parameter { name: "availability"; type: "Availability" }
}
+ Signal { name: "errorChanged"; type: "void" }
Signal {
name: "error"
+ type: "void"
Parameter { name: "error"; type: "QDeclarativeAudio::Error" }
Parameter { name: "errorString"; type: "string" }
}
- Method { name: "play" }
- Method { name: "pause" }
- Method { name: "stop" }
- }
- Component {
- name: "QDeclarativeAudio_4"
- prototype: "QObject"
- exports: ["Audio 4.0", "MediaPlayer 4.0"]
- Enum {
- name: "Status"
- values: {
- "UnknownStatus": 0,
- "NoMedia": 1,
- "Loading": 2,
- "Loaded": 3,
- "Stalled": 4,
- "Buffering": 5,
- "Buffered": 6,
- "EndOfMedia": 7,
- "InvalidMedia": 8
- }
- }
- Enum {
- name: "Error"
- values: {
- "NoError": 0,
- "ResourceError": 1,
- "FormatError": 2,
- "NetworkError": 3,
- "AccessDenied": 4,
- "ServiceMissing": 5
- }
- }
- Enum {
- name: "Loop"
- values: {
- "Infinite": -1
- }
- }
- Property { name: "source"; type: "QUrl" }
- Property { name: "autoLoad"; type: "bool" }
- Property { name: "playing"; type: "bool" }
- Property { name: "loops"; type: "int" }
- Property { name: "paused"; type: "bool" }
- Property { name: "status"; type: "Status"; isReadonly: true }
- Property { name: "duration"; type: "int"; isReadonly: true }
- Property { name: "position"; type: "int" }
- Property { name: "volume"; type: "qreal" }
- Property { name: "muted"; type: "bool" }
- Property { name: "hasAudio"; type: "bool"; isReadonly: true }
- Property { name: "hasVideo"; type: "bool"; isReadonly: true }
- Property { name: "bufferProgress"; type: "int"; isReadonly: true }
- Property { name: "seekable"; type: "bool"; isReadonly: true }
- Property { name: "playbackRate"; type: "qreal" }
- Property { name: "error"; type: "Error"; isReadonly: true }
- Property { name: "errorString"; type: "string"; isReadonly: true }
- Property {
- name: "metaData"
- type: "QDeclarativeMediaMetaData_4"
- isReadonly: true
- isPointer: true
- }
- Property { name: "mediaObject"; type: "QObject"; isReadonly: true; isPointer: true }
- Signal { name: "loopCountChanged" }
- Signal { name: "started" }
- Signal { name: "resumed" }
- Signal { name: "paused" }
- Signal { name: "stopped" }
- Signal {
- name: "error"
- Parameter { name: "error"; type: "QDeclarativeAudio_4::Error" }
- Parameter { name: "errorString"; type: "string" }
- }
- Method { name: "play" }
- Method { name: "pause" }
- Method { name: "stop" }
+ Signal { name: "mediaObjectChanged"; type: "void" }
+ Method { name: "play"; type: "void" }
+ Method { name: "pause"; type: "void" }
+ Method { name: "stop"; type: "void" }
}
Component {
name: "QDeclarativeCamera"
prototype: "QObject"
- exports: ["Camera 4.0", "Camera 5.0"]
+ exports: ["Camera 5.0"]
Enum {
name: "CaptureMode"
values: {
+ "CaptureViewfinder": 0,
"CaptureStillImage": 1,
"CaptureVideo": 2
}
}
}
Enum {
+ name: "Status"
+ values: {
+ "UnavailableStatus": 0,
+ "UnloadedStatus": 1,
+ "LoadingStatus": 2,
+ "UnloadingStatus": 3,
+ "LoadedStatus": 4,
+ "StandbyStatus": 5,
+ "StartingStatus": 6,
+ "StoppingStatus": 7,
+ "ActiveStatus": 8
+ }
+ }
+ Enum {
name: "LockStatus"
values: {
"Unlocked": 0,
}
Property { name: "captureMode"; type: "CaptureMode" }
Property { name: "cameraState"; type: "State" }
+ Property { name: "cameraStatus"; type: "Status"; isReadonly: true }
Property { name: "lockStatus"; type: "LockStatus"; isReadonly: true }
+ Property { name: "errorCode"; type: "Error"; isReadonly: true }
Property { name: "errorString"; type: "string"; isReadonly: true }
Property { name: "availability"; type: "Availability"; isReadonly: true }
- Property { name: "opticalZoom"; type: "qreal" }
- Property { name: "maximumOpticalZoom"; type: "qreal"; isReadonly: true }
- Property { name: "digitalZoom"; type: "qreal" }
- Property { name: "maximumDigitalZoom"; type: "qreal"; isReadonly: true }
+ Property { name: "opticalZoom"; type: "double" }
+ Property { name: "maximumOpticalZoom"; type: "double"; isReadonly: true }
+ Property { name: "digitalZoom"; type: "double" }
+ Property { name: "maximumDigitalZoom"; type: "double"; isReadonly: true }
Property { name: "mediaObject"; type: "QObject"; isReadonly: true; isPointer: true }
Property {
name: "imageCapture"
isReadonly: true
isPointer: true
}
- Signal { name: "errorChanged" }
+ Signal { name: "errorChanged"; type: "void" }
Signal {
name: "error"
- Parameter { name: "error"; type: "QDeclarativeCamera::Error" }
+ type: "void"
+ Parameter { name: "errorCode"; type: "QDeclarativeCamera::Error" }
Parameter { name: "errorString"; type: "string" }
}
+ Signal { name: "captureModeChanged"; type: "void" }
Signal {
name: "cameraStateChanged"
+ type: "void"
Parameter { type: "QDeclarativeCamera::State" }
}
+ Signal { name: "cameraStatusChanged"; type: "void" }
+ Signal { name: "lockStatusChanged"; type: "void" }
Signal {
name: "opticalZoomChanged"
- Parameter { type: "qreal" }
+ type: "void"
+ Parameter { type: "double" }
}
Signal {
name: "digitalZoomChanged"
- Parameter { type: "qreal" }
+ type: "void"
+ Parameter { type: "double" }
}
Signal {
name: "maximumOpticalZoomChanged"
- Parameter { type: "qreal" }
+ type: "void"
+ Parameter { type: "double" }
}
Signal {
name: "maximumDigitalZoomChanged"
- Parameter { type: "qreal" }
+ type: "void"
+ Parameter { type: "double" }
}
+ Signal { name: "mediaObjectChanged"; type: "void" }
Signal {
name: "availabilityChanged"
+ type: "void"
Parameter { name: "availability"; type: "Availability" }
}
Method {
name: "setCaptureMode"
+ type: "void"
Parameter { name: "mode"; type: "CaptureMode" }
}
- Method { name: "start" }
- Method { name: "stop" }
+ Method { name: "start"; type: "void" }
+ Method { name: "stop"; type: "void" }
Method {
name: "setCameraState"
+ type: "void"
Parameter { name: "state"; type: "State" }
}
- Method { name: "searchAndLock" }
- Method { name: "unlock" }
+ Method { name: "searchAndLock"; type: "void" }
+ Method { name: "unlock"; type: "void" }
Method {
name: "setOpticalZoom"
- Parameter { type: "qreal" }
+ type: "void"
+ Parameter { type: "double" }
}
Method {
name: "setDigitalZoom"
- Parameter { type: "qreal" }
+ type: "void"
+ Parameter { type: "double" }
}
}
Component {
name: "QDeclarativeCameraCapture"
prototype: "QObject"
- exports: ["CameraCapture 4.0", "CameraCapture 5.0"]
+ exports: ["CameraCapture 5.0"]
Property { name: "ready"; type: "bool"; isReadonly: true }
Property { name: "capturedImagePath"; type: "string"; isReadonly: true }
Property { name: "resolution"; type: "QSize" }
Property { name: "errorString"; type: "string"; isReadonly: true }
Signal {
name: "readyForCaptureChanged"
+ type: "void"
Parameter { type: "bool" }
}
Signal {
name: "imageExposed"
+ type: "void"
Parameter { name: "requestId"; type: "int" }
}
Signal {
name: "imageCaptured"
+ type: "void"
Parameter { name: "requestId"; type: "int" }
Parameter { name: "preview"; type: "string" }
}
Signal {
name: "imageMetadataAvailable"
+ type: "void"
Parameter { name: "requestId"; type: "int" }
Parameter { name: "key"; type: "string" }
Parameter { name: "value"; type: "QVariant" }
}
Signal {
name: "imageSaved"
+ type: "void"
Parameter { name: "requestId"; type: "int" }
Parameter { name: "path"; type: "string" }
}
Signal {
name: "captureFailed"
+ type: "void"
Parameter { name: "requestId"; type: "int" }
Parameter { name: "message"; type: "string" }
}
Signal {
name: "resolutionChanged"
+ type: "void"
Parameter { type: "QSize" }
}
Method { name: "capture"; type: "int" }
type: "int"
Parameter { name: "location"; type: "string" }
}
- Method { name: "cancelCapture" }
+ Method { name: "cancelCapture"; type: "void" }
Method {
name: "setResolution"
+ type: "void"
Parameter { name: "resolution"; type: "QSize" }
}
Method {
name: "setMetadata"
+ type: "void"
Parameter { name: "key"; type: "string" }
Parameter { name: "value"; type: "QVariant" }
}
Component {
name: "QDeclarativeCameraExposure"
prototype: "QObject"
- exports: ["CameraExposure 4.0", "CameraExposure 5.0"]
- Property { name: "exposureCompensation"; type: "qreal" }
+ exports: ["CameraExposure 5.0"]
+ Property { name: "exposureCompensation"; type: "double" }
Property { name: "iso"; type: "int"; isReadonly: true }
- Property { name: "shutterSpeed"; type: "qreal"; isReadonly: true }
- Property { name: "aperture"; type: "qreal"; isReadonly: true }
- Property { name: "manualShutterSpeed"; type: "qreal" }
- Property { name: "manualAperture"; type: "qreal" }
- Property { name: "manualIso"; type: "qreal" }
+ Property { name: "shutterSpeed"; type: "double"; isReadonly: true }
+ Property { name: "aperture"; type: "double"; isReadonly: true }
+ Property { name: "manualShutterSpeed"; type: "double" }
+ Property { name: "manualAperture"; type: "double" }
+ Property { name: "manualIso"; type: "double" }
Property { name: "exposureMode"; type: "QDeclarativeCamera::ExposureMode" }
Property { name: "spotMeteringPoint"; type: "QPointF" }
Property { name: "meteringMode"; type: "QDeclarativeCamera::MeteringMode" }
Signal {
name: "isoSensitivityChanged"
+ type: "void"
Parameter { type: "int" }
}
Signal {
name: "apertureChanged"
- Parameter { type: "qreal" }
+ type: "void"
+ Parameter { type: "double" }
}
Signal {
name: "shutterSpeedChanged"
- Parameter { type: "qreal" }
+ type: "void"
+ Parameter { type: "double" }
}
Signal {
name: "manualIsoSensitivityChanged"
+ type: "void"
Parameter { type: "int" }
}
Signal {
name: "manualApertureChanged"
- Parameter { type: "qreal" }
+ type: "void"
+ Parameter { type: "double" }
}
Signal {
name: "manualShutterSpeedChanged"
- Parameter { type: "qreal" }
+ type: "void"
+ Parameter { type: "double" }
}
Signal {
name: "exposureCompensationChanged"
- Parameter { type: "qreal" }
+ type: "void"
+ Parameter { type: "double" }
}
Signal {
name: "exposureModeChanged"
+ type: "void"
Parameter { type: "QDeclarativeCamera::ExposureMode" }
}
Signal {
name: "meteringModeChanged"
+ type: "void"
Parameter { type: "QDeclarativeCamera::MeteringMode" }
}
Signal {
name: "spotMeteringPointChanged"
+ type: "void"
Parameter { type: "QPointF" }
}
Method {
name: "setExposureMode"
+ type: "void"
Parameter { type: "QDeclarativeCamera::ExposureMode" }
}
Method {
name: "setExposureCompensation"
- Parameter { name: "ev"; type: "qreal" }
+ type: "void"
+ Parameter { name: "ev"; type: "double" }
}
Method {
name: "setManualAperture"
- Parameter { type: "qreal" }
+ type: "void"
+ Parameter { type: "double" }
}
Method {
name: "setManualShutterSpeed"
- Parameter { type: "qreal" }
+ type: "void"
+ Parameter { type: "double" }
}
Method {
name: "setManualIsoSensitivity"
+ type: "void"
Parameter { name: "iso"; type: "int" }
}
- Method { name: "setAutoAperture" }
- Method { name: "setAutoShutterSpeed" }
- Method { name: "setAutoIsoSensitivity" }
+ Method { name: "setAutoAperture"; type: "void" }
+ Method { name: "setAutoShutterSpeed"; type: "void" }
+ Method { name: "setAutoIsoSensitivity"; type: "void" }
}
Component {
name: "QDeclarativeCameraFlash"
prototype: "QObject"
- exports: ["CameraFlash 4.0", "CameraFlash 5.0"]
+ exports: ["CameraFlash 5.0"]
Property { name: "ready"; type: "bool"; isReadonly: true }
Property { name: "mode"; type: "int" }
Signal {
name: "flashReady"
+ type: "void"
Parameter { name: "status"; type: "bool" }
}
Signal {
name: "flashModeChanged"
+ type: "void"
Parameter { type: "int" }
}
Method {
name: "setFlashMode"
+ type: "void"
Parameter { type: "int" }
}
}
Component {
name: "QDeclarativeCameraFocus"
prototype: "QObject"
- exports: ["CameraFocus 4.0", "CameraFocus 5.0"]
+ exports: ["CameraFocus 5.0"]
Property { name: "focusMode"; type: "QDeclarativeCamera::FocusMode" }
Property { name: "focusPointMode"; type: "QDeclarativeCamera::FocusPointMode" }
Property { name: "customFocusPoint"; type: "QPointF" }
Property { name: "focusZones"; type: "QObject"; isReadonly: true; isPointer: true }
Signal {
name: "focusModeChanged"
+ type: "void"
Parameter { type: "QDeclarativeCamera::FocusMode" }
}
Signal {
name: "focusPointModeChanged"
+ type: "void"
Parameter { type: "QDeclarativeCamera::FocusPointMode" }
}
Signal {
name: "customFocusPointChanged"
+ type: "void"
Parameter { type: "QPointF" }
}
Method {
name: "setFocusMode"
+ type: "void"
Parameter { type: "QDeclarativeCamera::FocusMode" }
}
Method {
name: "setFocusPointMode"
+ type: "void"
Parameter { name: "mode"; type: "QDeclarativeCamera::FocusPointMode" }
}
Method {
name: "setCustomFocusPoint"
+ type: "void"
Parameter { name: "point"; type: "QPointF" }
}
Method {
Method {
name: "isFocusPointModeSupported"
type: "bool"
- Parameter { type: "QDeclarativeCamera::FocusPointMode" }
+ Parameter { name: "mode"; type: "QDeclarativeCamera::FocusPointMode" }
}
}
Component {
name: "QDeclarativeCameraImageProcessing"
prototype: "QObject"
- exports: ["CameraImageProcessing 4.0", "CameraImageProcessing 5.0"]
+ exports: ["CameraImageProcessing 5.0"]
Enum {
name: "WhiteBalanceMode"
values: {
}
}
Property { name: "whiteBalanceMode"; type: "WhiteBalanceMode" }
- Property { name: "manualWhiteBalance"; type: "qreal" }
- Property { name: "contrast"; type: "qreal" }
- Property { name: "saturation"; type: "qreal" }
- Property { name: "sharpeningLevel"; type: "qreal" }
- Property { name: "denoisingLevel"; type: "qreal" }
+ Property { name: "manualWhiteBalance"; type: "double" }
+ Property { name: "contrast"; type: "double" }
+ Property { name: "saturation"; type: "double" }
+ Property { name: "sharpeningLevel"; type: "double" }
+ Property { name: "denoisingLevel"; type: "double" }
Signal {
name: "whiteBalanceModeChanged"
+ type: "void"
Parameter { type: "QDeclarativeCameraImageProcessing::WhiteBalanceMode" }
}
Signal {
name: "manualWhiteBalanceChanged"
- Parameter { type: "qreal" }
+ type: "void"
+ Parameter { type: "double" }
}
Signal {
name: "contrastChanged"
- Parameter { type: "qreal" }
+ type: "void"
+ Parameter { type: "double" }
}
Signal {
name: "saturationChanged"
- Parameter { type: "qreal" }
+ type: "void"
+ Parameter { type: "double" }
}
Signal {
name: "sharpeningLevelChanged"
- Parameter { type: "qreal" }
+ type: "void"
+ Parameter { type: "double" }
}
Signal {
name: "denoisingLevelChanged"
- Parameter { type: "qreal" }
+ type: "void"
+ Parameter { type: "double" }
}
Method {
name: "setWhiteBalanceMode"
+ type: "void"
Parameter { name: "mode"; type: "QDeclarativeCameraImageProcessing::WhiteBalanceMode" }
}
Method {
name: "setManualWhiteBalance"
- Parameter { name: "colorTemp"; type: "qreal" }
+ type: "void"
+ Parameter { name: "colorTemp"; type: "double" }
}
Method {
name: "setContrast"
- Parameter { name: "value"; type: "qreal" }
+ type: "void"
+ Parameter { name: "value"; type: "double" }
}
Method {
name: "setSaturation"
- Parameter { name: "value"; type: "qreal" }
+ type: "void"
+ Parameter { name: "value"; type: "double" }
}
Method {
name: "setSharpeningLevel"
- Parameter { name: "value"; type: "qreal" }
+ type: "void"
+ Parameter { name: "value"; type: "double" }
}
Method {
name: "setDenoisingLevel"
- Parameter { name: "value"; type: "qreal" }
+ type: "void"
+ Parameter { name: "value"; type: "double" }
}
}
Component {
name: "QDeclarativeCameraRecorder"
prototype: "QObject"
- exports: ["CameraRecorder 4.0", "CameraRecorder 5.0"]
+ exports: ["CameraRecorder 5.0"]
Enum {
name: "RecorderState"
values: {
}
}
Enum {
+ name: "RecorderStatus"
+ values: {
+ "UnavailableStatus": 0,
+ "UnloadedStatus": 1,
+ "LoadingStatus": 2,
+ "LoadedStatus": 3,
+ "StartingStatus": 4,
+ "RecordingStatus": 5,
+ "PausedStatus": 6,
+ "FinalizingStatus": 7
+ }
+ }
+ Enum {
name: "EncodingMode"
values: {
"ConstantQualityEncoding": 0,
"AverageBitRateEncoding": 2
}
}
+ Enum {
+ name: "Error"
+ values: {
+ "NoError": 0,
+ "ResourceError": 1,
+ "FormatError": 2,
+ "OutOfSpaceError": 3
+ }
+ }
Property { name: "recorderState"; type: "RecorderState" }
+ Property { name: "recorderStatus"; type: "RecorderStatus"; isReadonly: true }
Property { name: "videoCodec"; type: "string" }
Property { name: "resolution"; type: "QSize" }
- Property { name: "frameRate"; type: "qreal" }
+ Property { name: "frameRate"; type: "double" }
Property { name: "videoBitRate"; type: "int" }
Property { name: "videoEncodingMode"; type: "EncodingMode" }
Property { name: "audioCodec"; type: "string" }
Property { name: "audioSampleRate"; type: "int" }
Property { name: "audioEncodingMode"; type: "EncodingMode" }
Property { name: "mediaContainer"; type: "string" }
- Property { name: "duration"; type: "qint64"; isReadonly: true }
+ Property { name: "duration"; type: "qlonglong"; isReadonly: true }
Property { name: "outputLocation"; type: "string" }
Property { name: "actualLocation"; type: "string"; isReadonly: true }
Property { name: "muted"; type: "bool" }
Property { name: "errorString"; type: "string"; isReadonly: true }
+ Property { name: "errorCode"; type: "string"; isReadonly: true }
Signal {
name: "recorderStateChanged"
+ type: "void"
Parameter { name: "state"; type: "QDeclarativeCameraRecorder::RecorderState" }
}
+ Signal { name: "recorderStatusChanged"; type: "void" }
Signal {
name: "durationChanged"
- Parameter { name: "duration"; type: "qint64" }
+ type: "void"
+ Parameter { name: "duration"; type: "qlonglong" }
}
Signal {
name: "mutedChanged"
+ type: "void"
Parameter { name: "muted"; type: "bool" }
}
Signal {
name: "outputLocationChanged"
+ type: "void"
Parameter { name: "location"; type: "string" }
}
Signal {
name: "actualLocationChanged"
+ type: "void"
Parameter { name: "location"; type: "string" }
}
Signal {
name: "error"
- Parameter { name: "errorCode"; type: "QMediaRecorder::Error" }
+ type: "void"
+ Parameter { name: "errorCode"; type: "QDeclarativeCameraRecorder::Error" }
+ Parameter { name: "errorString"; type: "string" }
}
Signal {
name: "metaDataChanged"
+ type: "void"
Parameter { name: "key"; type: "string" }
Parameter { name: "value"; type: "QVariant" }
}
Signal {
name: "captureResolutionChanged"
+ type: "void"
Parameter { type: "QSize" }
}
Signal {
name: "audioCodecChanged"
+ type: "void"
Parameter { name: "codec"; type: "string" }
}
Signal {
name: "videoCodecChanged"
+ type: "void"
Parameter { name: "codec"; type: "string" }
}
Signal {
name: "mediaContainerChanged"
+ type: "void"
Parameter { name: "container"; type: "string" }
}
Signal {
name: "frameRateChanged"
- Parameter { name: "arg"; type: "qreal" }
+ type: "void"
+ Parameter { name: "arg"; type: "double" }
}
Signal {
name: "videoBitRateChanged"
+ type: "void"
Parameter { name: "arg"; type: "int" }
}
Signal {
name: "audioBitRateChanged"
+ type: "void"
Parameter { name: "arg"; type: "int" }
}
Signal {
name: "audioChannelsChanged"
+ type: "void"
Parameter { name: "arg"; type: "int" }
}
Signal {
name: "audioSampleRateChanged"
+ type: "void"
Parameter { name: "arg"; type: "int" }
}
Signal {
name: "audioEncodingModeChanged"
+ type: "void"
Parameter { name: "encodingMode"; type: "EncodingMode" }
}
Signal {
name: "videoEncodingModeChanged"
+ type: "void"
Parameter { name: "encodingMode"; type: "EncodingMode" }
}
Method {
name: "setOutputLocation"
+ type: "void"
Parameter { name: "location"; type: "string" }
}
- Method { name: "record" }
- Method { name: "stop" }
+ Method { name: "record"; type: "void" }
+ Method { name: "stop"; type: "void" }
Method {
name: "setRecorderState"
+ type: "void"
Parameter { name: "state"; type: "QDeclarativeCameraRecorder::RecorderState" }
}
Method {
name: "setMuted"
+ type: "void"
Parameter { name: "muted"; type: "bool" }
}
Method {
name: "setMetadata"
+ type: "void"
Parameter { name: "key"; type: "string" }
Parameter { name: "value"; type: "QVariant" }
}
Method {
name: "setCaptureResolution"
+ type: "void"
Parameter { name: "resolution"; type: "QSize" }
}
Method {
name: "setAudioCodec"
+ type: "void"
Parameter { name: "codec"; type: "string" }
}
Method {
name: "setVideoCodec"
+ type: "void"
Parameter { name: "codec"; type: "string" }
}
Method {
name: "setMediaContainer"
+ type: "void"
Parameter { name: "container"; type: "string" }
}
Method {
name: "setFrameRate"
- Parameter { name: "frameRate"; type: "qreal" }
+ type: "void"
+ Parameter { name: "frameRate"; type: "double" }
}
Method {
name: "setVideoBitRate"
+ type: "void"
Parameter { name: "rate"; type: "int" }
}
Method {
name: "setAudioBitRate"
+ type: "void"
Parameter { name: "rate"; type: "int" }
}
Method {
name: "setAudioChannels"
+ type: "void"
Parameter { name: "channels"; type: "int" }
}
Method {
name: "setAudioSampleRate"
+ type: "void"
Parameter { name: "rate"; type: "int" }
}
Method {
name: "setVideoEncodingMode"
+ type: "void"
Parameter { name: "encodingMode"; type: "EncodingMode" }
}
Method {
name: "setAudioEncodingMode"
+ type: "void"
Parameter { name: "encodingMode"; type: "EncodingMode" }
}
}
Component {
name: "QDeclarativeRadio"
prototype: "QObject"
- exports: ["Radio 4.0", "Radio 5.0"]
+ exports: ["Radio 5.0"]
Enum {
name: "State"
values: {
Property { name: "radioData"; type: "QDeclarativeRadioData"; isReadonly: true; isPointer: true }
Signal {
name: "stateChanged"
+ type: "void"
Parameter { name: "state"; type: "QDeclarativeRadio::State" }
}
Signal {
name: "bandChanged"
+ type: "void"
Parameter { name: "band"; type: "QDeclarativeRadio::Band" }
}
Signal {
name: "frequencyChanged"
+ type: "void"
Parameter { name: "frequency"; type: "int" }
}
Signal {
name: "stereoStatusChanged"
+ type: "void"
Parameter { name: "stereo"; type: "bool" }
}
Signal {
name: "searchingChanged"
+ type: "void"
Parameter { name: "searching"; type: "bool" }
}
Signal {
name: "signalStrengthChanged"
+ type: "void"
Parameter { name: "signalStrength"; type: "int" }
}
Signal {
name: "volumeChanged"
+ type: "void"
Parameter { name: "volume"; type: "int" }
}
Signal {
name: "mutedChanged"
+ type: "void"
Parameter { name: "muted"; type: "bool" }
}
Signal {
name: "stationFound"
+ type: "void"
Parameter { name: "frequency"; type: "int" }
Parameter { name: "stationId"; type: "string" }
}
Signal {
name: "antennaConnectedChanged"
+ type: "void"
Parameter { name: "connectionStatus"; type: "bool" }
}
Signal {
name: "availabilityChanged"
+ type: "void"
Parameter { name: "availability"; type: "Availability" }
}
- Signal { name: "errorChanged" }
+ Signal { name: "errorChanged"; type: "void" }
Signal {
name: "error"
+ type: "void"
Parameter { name: "errorCode"; type: "QDeclarativeRadio::Error" }
}
Method {
name: "setBand"
+ type: "void"
Parameter { name: "band"; type: "QDeclarativeRadio::Band" }
}
Method {
name: "setFrequency"
+ type: "void"
Parameter { name: "frequency"; type: "int" }
}
Method {
name: "setStereoMode"
+ type: "void"
Parameter { name: "stereoMode"; type: "QDeclarativeRadio::StereoMode" }
}
Method {
name: "setVolume"
+ type: "void"
Parameter { name: "volume"; type: "int" }
}
Method {
name: "setMuted"
+ type: "void"
Parameter { name: "muted"; type: "bool" }
}
- Method { name: "cancelScan" }
- Method { name: "scanDown" }
- Method { name: "scanUp" }
- Method { name: "tuneUp" }
- Method { name: "tuneDown" }
+ Method { name: "cancelScan"; type: "void" }
+ Method { name: "scanDown"; type: "void" }
+ Method { name: "scanUp"; type: "void" }
+ Method { name: "tuneUp"; type: "void" }
+ Method { name: "tuneDown"; type: "void" }
Method {
name: "searchAllStations"
+ type: "void"
Parameter { name: "searchMode"; type: "QDeclarativeRadio::SearchMode" }
}
- Method { name: "searchAllStations" }
- Method { name: "start" }
- Method { name: "stop" }
+ Method { name: "searchAllStations"; type: "void" }
+ Method { name: "start"; type: "void" }
+ Method { name: "stop"; type: "void" }
Method { name: "isAvailable"; type: "bool" }
}
Component {
name: "QDeclarativeRadioData"
prototype: "QObject"
- exports: ["RadioData 4.0", "RadioData 5.0"]
+ exports: ["RadioData 5.0"]
Enum {
name: "Error"
values: {
Property { name: "availability"; type: "Availability"; isReadonly: true }
Signal {
name: "stationIdChanged"
+ type: "void"
Parameter { name: "stationId"; type: "string" }
}
Signal {
name: "programTypeChanged"
+ type: "void"
Parameter { name: "programType"; type: "QDeclarativeRadioData::ProgramType" }
}
Signal {
name: "programTypeNameChanged"
+ type: "void"
Parameter { name: "programTypeName"; type: "string" }
}
Signal {
name: "stationNameChanged"
+ type: "void"
Parameter { name: "stationName"; type: "string" }
}
Signal {
name: "radioTextChanged"
+ type: "void"
Parameter { name: "radioText"; type: "string" }
}
Signal {
name: "alternativeFrequenciesEnabledChanged"
+ type: "void"
Parameter { name: "enabled"; type: "bool" }
}
Signal {
name: "availabilityChanged"
+ type: "void"
Parameter { name: "availability"; type: "Availability" }
}
- Signal { name: "errorChanged" }
+ Signal { name: "errorChanged"; type: "void" }
Signal {
name: "error"
+ type: "void"
Parameter { name: "errorCode"; type: "QDeclarativeRadioData::Error" }
}
Method {
name: "setAlternativeFrequenciesEnabled"
+ type: "void"
Parameter { name: "enabled"; type: "bool" }
}
Method { name: "isAvailable"; type: "bool" }
exports: ["Torch 5.0"]
Property { name: "enabled"; type: "bool" }
Property { name: "power"; type: "int" }
+ Signal { name: "enabledChanged"; type: "void" }
+ Signal { name: "powerChanged"; type: "void" }
}
Component {
name: "QDeclarativeVideoOutput"
defaultProperty: "data"
prototype: "QQuickItem"
- exports: ["VideoOutput 4.0", "VideoOutput 5.0"]
+ exports: ["VideoOutput 5.0"]
Enum {
name: "FillMode"
values: {
Property { name: "orientation"; type: "int" }
Property { name: "sourceRect"; type: "QRectF"; isReadonly: true }
Property { name: "contentRect"; type: "QRectF"; isReadonly: true }
+ Signal { name: "sourceChanged"; type: "void" }
Signal {
name: "fillModeChanged"
+ type: "void"
Parameter { type: "QDeclarativeVideoOutput::FillMode" }
}
+ Signal { name: "orientationChanged"; type: "void" }
+ Signal { name: "sourceRectChanged"; type: "void" }
+ Signal { name: "contentRectChanged"; type: "void" }
Method {
name: "mapPointToItem"
type: "QPointF"
Property { name: "notifyInterval"; type: "int" }
Signal {
name: "notifyIntervalChanged"
+ type: "void"
Parameter { name: "milliSeconds"; type: "int" }
}
Signal {
name: "metaDataAvailableChanged"
+ type: "void"
Parameter { name: "available"; type: "bool" }
}
- Signal { name: "metaDataChanged" }
+ Signal { name: "metaDataChanged"; type: "void" }
Signal {
name: "metaDataChanged"
+ type: "void"
Parameter { name: "key"; type: "string" }
Parameter { name: "value"; type: "QVariant" }
}
Signal {
name: "availabilityChanged"
+ type: "void"
Parameter { name: "available"; type: "bool" }
}
Signal {
name: "availabilityErrorChanged"
+ type: "void"
Parameter { name: "error"; type: "QtMultimedia::AvailabilityError" }
}
}
Component {
name: "QSoundEffect"
prototype: "QObject"
- exports: ["SoundEffect 4.0", "SoundEffect 5.0"]
+ exports: ["SoundEffect 5.0"]
Enum {
name: "Loop"
values: {
Property { name: "source"; type: "QUrl" }
Property { name: "loops"; type: "int" }
Property { name: "loopsRemaining"; type: "int"; isReadonly: true }
- Property { name: "volume"; type: "qreal" }
+ Property { name: "volume"; type: "double" }
Property { name: "muted"; type: "bool" }
Property { name: "playing"; type: "bool"; isReadonly: true }
Property { name: "status"; type: "Status"; isReadonly: true }
- Signal { name: "loopCountChanged" }
- Signal { name: "loadedChanged" }
- Method { name: "play" }
- Method { name: "stop" }
+ Property { name: "category"; type: "string" }
+ Signal { name: "sourceChanged"; type: "void" }
+ Signal { name: "loopCountChanged"; type: "void" }
+ Signal { name: "loopsRemainingChanged"; type: "void" }
+ Signal { name: "volumeChanged"; type: "void" }
+ Signal { name: "mutedChanged"; type: "void" }
+ Signal { name: "loadedChanged"; type: "void" }
+ Signal { name: "playingChanged"; type: "void" }
+ Signal { name: "statusChanged"; type: "void" }
+ Signal { name: "categoryChanged"; type: "void" }
+ Method { name: "play"; type: "void" }
+ Method { name: "stop"; type: "void" }
}
}
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** 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_4.h"
-
-#include <qmediaplayercontrol.h>
-
-QT_BEGIN_NAMESPACE
-
-
-/*
- \qmlclass Audio QDeclarativeAudio
- \brief The Audio element allows you to add audio playback to a scene.
-
- \ingroup multimedia_qml
-
- This element is part of the \b{QtMultimedia 5.0} module.
-
- \qml
- import QtQuick 2.0
- import QtMultimedia 5.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 QQuickView.
-*/
-
-void QDeclarativeAudio_4::_q_error(int errorCode, const QString &errorString)
-{
- m_error = QMediaPlayer::Error(errorCode);
- m_errorString = errorString;
-
- emit error(Error(errorCode), errorString);
- emit errorChanged();
-}
-
-
-QDeclarativeAudio_4::QDeclarativeAudio_4(QObject *parent)
- : QObject(parent)
-{
-}
-
-QDeclarativeAudio_4::~QDeclarativeAudio_4()
-{
- 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_4::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_4::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_4::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
- \li NoMedia - no media has been set.
- \li Loading - the media is currently being loaded.
- \li Loaded - the media has been loaded.
- \li Buffering - the media is buffering data.
- \li Stalled - playback has been interrupted while the media is buffering data.
- \li Buffered - the media has buffered data.
- \li EndOfMedia - the media has played to the end.
- \li InvalidMedia - the media cannot be played.
- \li UnknownStatus - the status of the media is unknown.
- \endlist
-*/
-
-QDeclarativeAudio_4::Status QDeclarativeAudio_4::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 bool Audio::hasAudio
-
- This property holds whether the media contains audio.
-*/
-
-bool QDeclarativeAudio_4::hasAudio() const
-{
- return !m_complete ? false : m_playerControl->isAudioAvailable();
-}
-
-/*
- \qmlproperty bool Audio::hasVideo
-
- This property holds whether the media contains video.
-*/
-
-bool QDeclarativeAudio_4::hasVideo() const
-{
- return !m_complete ? false : m_playerControl->isVideoAvailable();
-}
-
-/*
- \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
- \li NoError - there is no current error.
- \li ResourceError - the audio cannot be played due to a problem allocating resources.
- \li FormatError - the audio format is not supported.
- \li NetworkError - the audio cannot be played due to network issues.
- \li AccessDenied - the audio cannot be played due to insufficient permissions.
- \li ServiceMissing - the audio cannot be played because the media service could not be
- instantiated.
- \endlist
-*/
-
-QDeclarativeAudio_4::Error QDeclarativeAudio_4::error() const
-{
- return Error(m_error);
-}
-
-void QDeclarativeAudio_4::classBegin()
-{
- setObject(this);
-
- if (m_mediaService) {
- connect(m_playerControl, SIGNAL(audioAvailableChanged(bool)),
- this, SIGNAL(hasAudioChanged()));
- connect(m_playerControl, SIGNAL(videoAvailableChanged(bool)),
- this, SIGNAL(hasVideoChanged()));
- }
-
- emit mediaObjectChanged();
-}
-
-void QDeclarativeAudio_4::componentComplete()
-{
- QDeclarativeMediaBase_4::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::MetaData::Title}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.subTitle
-
- This property holds the sub-title of the media.
-
- \sa {QtMultimedia::MetaData::SubTitle}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.author
-
- This property holds the author of the media.
-
- \sa {QtMultimedia::MetaData::Author}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.comment
-
- This property holds a user comment about the media.
-
- \sa {QtMultimedia::MetaData::Comment}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.description
-
- This property holds a description of the media.
-
- \sa {QtMultimedia::MetaData::Description}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.category
-
- This property holds the category of the media
-
- \sa {QtMultimedia::MetaData::Category}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.genre
-
- This property holds the genre of the media.
-
- \sa {QtMultimedia::MetaData::Genre}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.year
-
- This property holds the year of release of the media.
-
- \sa {QtMultimedia::MetaData::Year}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.date
-
- This property holds the date of the media.
-
- \sa {QtMultimedia::MetaData::Date}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.userRating
-
- This property holds a user rating of the media in the range of 0 to 100.
-
- \sa {QtMultimedia::MetaData::UserRating}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.keywords
-
- This property holds a list of keywords describing the media.
-
- \sa {QtMultimedia::MetaData::Keywords}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.language
-
- This property holds the language of the media, as an ISO 639-2 code.
-
- \sa {QtMultimedia::MetaData::Language}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.publisher
-
- This property holds the publisher of the media.
-
- \sa {QtMultimedia::MetaData::Publisher}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.copyright
-
- This property holds the media's copyright notice.
-
- \sa {QtMultimedia::MetaData::Copyright}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.parentalRating
-
- This property holds the parental rating of the media.
-
- \sa {QtMultimedia::MetaData::ParentalRating}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.ratingOrganization
-
- This property holds the name of the rating organization responsible for the
- parental rating of the media.
-
- \sa {QtMultimedia::MetaData::RatingOrganization}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.size
-
- This property property holds the size of the media in bytes.
-
- \sa {QtMultimedia::MetaData::Size}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.mediaType
-
- This property holds the type of the media.
-
- \sa {QtMultimedia::MetaData::MediaType}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.audioBitRate
-
- This property holds the bit rate of the media's audio stream ni bits per
- second.
-
- \sa {QtMultimedia::MetaData::AudioBitRate}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.audioCodec
-
- This property holds the encoding of the media audio stream.
-
- \sa {QtMultimedia::MetaData::AudioCodec}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.averageLevel
-
- This property holds the average volume level of the media.
-
- \sa {QtMultimedia::MetaData::AverageLevel}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.channelCount
-
- This property holds the number of channels in the media's audio stream.
-
- \sa {QtMultimedia::MetaData::ChannelCount}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.peakValue
-
- This property holds the peak volume of media's audio stream.
-
- \sa {QtMultimedia::MetaData::PeakValue}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.sampleRate
-
- This property holds the sample rate of the media's audio stream in hertz.
-
- \sa {QtMultimedia::MetaData::SampleRate}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.albumTitle
-
- This property holds the title of the album the media belongs to.
-
- \sa {QtMultimedia::MetaData::AlbumTitle}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.albumArtist
-
- This property holds the name of the principal artist of the album the media
- belongs to.
-
- \sa {QtMultimedia::MetaData::AlbumArtist}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.contributingArtist
-
- This property holds the names of artists contributing to the media.
-
- \sa {QtMultimedia::MetaData::ContributingArtist}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.composer
-
- This property holds the composer of the media.
-
- \sa {QtMultimedia::MetaData::Composer}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.conductor
-
- This property holds the conductor of the media.
-
- \sa {QtMultimedia::MetaData::Conductor}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.lyrics
-
- This property holds the lyrics to the media.
-
- \sa {QtMultimedia::MetaData::Lyrics}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.mood
-
- This property holds the mood of the media.
-
- \sa {QtMultimedia::MetaData::Mood}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.trackNumber
-
- This property holds the track number of the media.
-
- \sa {QtMultimedia::MetaData::TrackNumber}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.trackCount
-
- This property holds the number of track on the album containing the media.
-
- \sa {QtMultimedia::MetaData::TrackNumber}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.coverArtUrlSmall
-
- This property holds the URL of a small cover art image.
-
- \sa {QtMultimedia::MetaData::CoverArtUrlSmall}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.coverArtUrlLarge
-
- This property holds the URL of a large cover art image.
-
- \sa {QtMultimedia::MetaData::CoverArtUrlLarge}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.resolution
-
- This property holds the dimension of an image or video.
-
- \sa {QtMultimedia::MetaData::Resolution}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.pixelAspectRatio
-
- This property holds the pixel aspect ratio of an image or video.
-
- \sa {QtMultimedia::MetaData::PixelAspectRatio}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.videoFrameRate
-
- This property holds the frame rate of the media's video stream.
-
- \sa {QtMultimedia::MetaData::VideoFrameRate}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.videoBitRate
-
- This property holds the bit rate of the media's video stream in bits per
- second.
-
- \sa {QtMultimedia::MetaData::VideoBitRate}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.videoCodec
-
- This property holds the encoding of the media's video stream.
-
- \sa {QtMultimedia::MetaData::VideoCodec}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.posterUrl
-
- This property holds the URL of a poster image.
-
- \sa {QtMultimedia::MetaData::PosterUrl}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.chapterNumber
-
- This property holds the chapter number of the media.
-
- \sa {QtMultimedia::MetaData::ChapterNumber}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.director
-
- This property holds the director of the media.
-
- \sa {QtMultimedia::MetaData::Director}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.leadPerformer
-
- This property holds the lead performer in the media.
-
- \sa {QtMultimedia::MetaData::LeadPerformer}
-*/
-
-/*
- \qmlproperty variant Audio::metaData.writer
-
- This property holds the writer of the media.
-
- \sa {QtMultimedia::MetaData::Writer}
-*/
-
-QT_END_NAMESPACE
-
-#include "moc_qdeclarativeaudio_p_4.cpp"
-
-
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** 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_4_P_H
-#define QDECLARATIVEAUDIO_4_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 <QtQml/qqmlparserstatus.h>
-#include <QtQml/qqml.h>
-
-#include "qdeclarativemediabase_p_4.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class QTimerEvent;
-
-class QDeclarativeAudio_4 : public QObject, public QDeclarativeMediaBase_4, public QQmlParserStatus
-{
- 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(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(QDeclarativeMediaMetaData_4 *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(QQmlParserStatus)
-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_4::INFINITE
- };
-
- QDeclarativeAudio_4(QObject *parent = 0);
- ~QDeclarativeAudio_4();
-
- bool hasAudio() const;
- bool hasVideo() const;
-
- 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 hasAudioChanged();
- void hasVideoChanged();
-
- void bufferProgressChanged();
-
- void seekableChanged();
- void playbackRateChanged();
-
- void errorChanged();
- void error(QDeclarativeAudio_4::Error error, const QString &errorString);
-
- void mediaObjectChanged();
-
-private Q_SLOTS:
- void _q_error(int, const QString &);
-
-private:
- Q_DISABLE_COPY(QDeclarativeAudio_4)
- Q_PRIVATE_SLOT(mediaBase(), void _q_statusChanged())
-
- inline QDeclarativeMediaBase_4 *mediaBase() { return this; }
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeAudio_4))
-
-QT_END_HEADER
-
-#endif
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** 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_4.h"
-
-#include <QtCore/qcoreevent.h>
-#include <QtCore/qurl.h>
-#include <QtQml/qqmlinfo.h>
-
-#include <qmediaplayercontrol.h>
-#include <qmediaservice.h>
-#include <private/qmediaserviceprovider_p.h>
-#include <qmetadatareadercontrol.h>
-
-#include "qdeclarativemediametadata_p_4.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(const QString &) const { return QVariant(); }
- QStringList availableMetaData() const { return QStringList(); }
-};
-
-class QDeclarativeMediaBaseAnimation : public QObject
-{
-public:
- QDeclarativeMediaBaseAnimation(QDeclarativeMediaBase_4 *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_4 *m_media;
- QBasicTimer m_timer;
-};
-
-void QDeclarativeMediaBase_4::_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_4::QDeclarativeMediaBase_4()
- : 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_4::~QDeclarativeMediaBase_4()
-{
-}
-
-void QDeclarativeMediaBase_4::shutdown()
-{
- delete m_mediaObject;
- m_metaData.reset();
-
- if (m_mediaProvider)
- m_mediaProvider->releaseService(m_mediaService);
-
- delete m_animation;
-
-}
-
-void QDeclarativeMediaBase_4::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_4(m_metaDataControl));
-
- QObject::connect(m_metaDataControl, SIGNAL(metaDataChanged()),
- m_metaData.data(), SIGNAL(metaDataChanged()));
-}
-
-void QDeclarativeMediaBase_4::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_4::source() const
-{
- return m_source;
-}
-
-void QDeclarativeMediaBase_4::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_4::isAutoLoad() const
-{
- return m_autoLoad;
-}
-
-void QDeclarativeMediaBase_4::setAutoLoad(bool autoLoad)
-{
- if (m_autoLoad == autoLoad)
- return;
-
- m_autoLoad = autoLoad;
- emit autoLoadChanged();
-}
-
-int QDeclarativeMediaBase_4::loopCount() const
-{
- return m_loopCount;
-}
-
-void QDeclarativeMediaBase_4::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_4::isPlaying() const
-{
- return m_playing;
-}
-
-void QDeclarativeMediaBase_4::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_4::isPaused() const
-{
- return m_paused;
-}
-
-void QDeclarativeMediaBase_4::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_4::duration() const
-{
- return !m_complete ? 0 : m_playerControl->duration();
-}
-
-int QDeclarativeMediaBase_4::position() const
-{
- return !m_complete ? m_position : m_playerControl->position();
-}
-
-void QDeclarativeMediaBase_4::setPosition(int position)
-{
- if (this->position() == position)
- return;
-
- m_position = position;
- if (m_complete)
- m_playerControl->setPosition(m_position);
- else
- emit positionChanged();
-}
-
-qreal QDeclarativeMediaBase_4::volume() const
-{
- return !m_complete ? m_vol : qreal(m_playerControl->volume()) / 100;
-}
-
-void QDeclarativeMediaBase_4::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_4::isMuted() const
-{
- return !m_complete ? m_muted : m_playerControl->isMuted();
-}
-
-void QDeclarativeMediaBase_4::setMuted(bool muted)
-{
- if (m_muted == muted)
- return;
-
- m_muted = muted;
-
- if (m_complete)
- m_playerControl->setMuted(muted);
- else
- emit mutedChanged();
-}
-
-qreal QDeclarativeMediaBase_4::bufferProgress() const
-{
- return !m_complete ? 0 : qreal(m_playerControl->bufferStatus()) / 100;
-}
-
-bool QDeclarativeMediaBase_4::isSeekable() const
-{
- return !m_complete ? false : m_playerControl->isSeekable();
-}
-
-qreal QDeclarativeMediaBase_4::playbackRate() const
-{
- return m_playbackRate;
-}
-
-void QDeclarativeMediaBase_4::setPlaybackRate(qreal rate)
-{
- if (m_playbackRate == rate)
- return;
-
- m_playbackRate = rate;
-
- if (m_complete)
- m_playerControl->setPlaybackRate(m_playbackRate);
- else
- emit playbackRateChanged();
-}
-
-QString QDeclarativeMediaBase_4::errorString() const
-{
- return m_errorString;
-}
-
-QDeclarativeMediaMetaData_4 *QDeclarativeMediaBase_4::metaData() const
-{
- return m_metaData.data();
-}
-
-QT_END_NAMESPACE
-
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** 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_4_P_H
-#define QDECLARATIVEMEDIABASE_4_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>
-#include <private/qmediaserviceprovider_p.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class QMediaPlayerControl;
-class QMediaService;
-class QMediaServiceProvider;
-class QMetaDataReaderControl;
-class QDeclarativeMediaBaseAnimation;
-class QDeclarativeMediaMetaData_4;
-
-class QDeclarativeMediaBase_4
-{
-public:
- enum Loop {
- INFINITE = -1
- };
-
- QDeclarativeMediaBase_4();
- virtual ~QDeclarativeMediaBase_4();
-
- 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_4 *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_4> 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
+++ /dev/null
-
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** 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_4_H
-#define QDECLARATIVEMEDIAMETADATA_P_4_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 <QtQml/qqml.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class QDeclarativeMediaMetaData_4 : 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 ratingOrganization READ ratingOrganization 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_4(QMetaDataReaderControl *control, QObject *parent = 0)
- : QObject(parent)
- , m_control(control)
- {
- }
-
- QVariant title() const { return m_control->metaData(QtMultimedia::MetaData::Title); }
- QVariant subTitle() const { return m_control->metaData(QtMultimedia::MetaData::SubTitle); }
- QVariant author() const { return m_control->metaData(QtMultimedia::MetaData::Author); }
- QVariant comment() const { return m_control->metaData(QtMultimedia::MetaData::Comment); }
- QVariant description() const { return m_control->metaData(QtMultimedia::MetaData::Description); }
- QVariant category() const { return m_control->metaData(QtMultimedia::MetaData::Category); }
- QVariant genre() const { return m_control->metaData(QtMultimedia::MetaData::Genre); }
- QVariant year() const { return m_control->metaData(QtMultimedia::MetaData::Year); }
- QVariant date() const { return m_control->metaData(QtMultimedia::MetaData::Date); }
- QVariant userRating() const { return m_control->metaData(QtMultimedia::MetaData::UserRating); }
- QVariant keywords() const { return m_control->metaData(QtMultimedia::MetaData::Keywords); }
- QVariant language() const { return m_control->metaData(QtMultimedia::MetaData::Language); }
- QVariant publisher() const { return m_control->metaData(QtMultimedia::MetaData::Publisher); }
- QVariant copyright() const { return m_control->metaData(QtMultimedia::MetaData::Copyright); }
- QVariant parentalRating() const { return m_control->metaData(QtMultimedia::MetaData::ParentalRating); }
- QVariant ratingOrganization() const {
- return m_control->metaData(QtMultimedia::MetaData::RatingOrganization); }
- QVariant size() const { return m_control->metaData(QtMultimedia::MetaData::Size); }
- QVariant mediaType() const { return m_control->metaData(QtMultimedia::MetaData::MediaType); }
- QVariant duration() const { return m_control->metaData(QtMultimedia::MetaData::Duration); }
- QVariant audioBitRate() const { return m_control->metaData(QtMultimedia::MetaData::AudioBitRate); }
- QVariant audioCodec() const { return m_control->metaData(QtMultimedia::MetaData::AudioCodec); }
- QVariant averageLevel() const { return m_control->metaData(QtMultimedia::MetaData::AverageLevel); }
- QVariant channelCount() const { return m_control->metaData(QtMultimedia::MetaData::ChannelCount); }
- QVariant peakValue() const { return m_control->metaData(QtMultimedia::MetaData::PeakValue); }
- QVariant sampleRate() const { return m_control->metaData(QtMultimedia::MetaData::SampleRate); }
- QVariant albumTitle() const { return m_control->metaData(QtMultimedia::MetaData::AlbumTitle); }
- QVariant albumArtist() const { return m_control->metaData(QtMultimedia::MetaData::AlbumArtist); }
- QVariant contributingArtist() const {
- return m_control->metaData(QtMultimedia::MetaData::ContributingArtist); }
- QVariant composer() const { return m_control->metaData(QtMultimedia::MetaData::Composer); }
- QVariant conductor() const { return m_control->metaData(QtMultimedia::MetaData::Conductor); }
- QVariant lyrics() const { return m_control->metaData(QtMultimedia::MetaData::Lyrics); }
- QVariant mood() const { return m_control->metaData(QtMultimedia::MetaData::Mood); }
- QVariant trackNumber() const { return m_control->metaData(QtMultimedia::MetaData::TrackNumber); }
- QVariant trackCount() const { return m_control->metaData(QtMultimedia::MetaData::TrackCount); }
- QVariant coverArtUrlSmall() const {
- return m_control->metaData(QtMultimedia::MetaData::CoverArtUrlSmall); }
- QVariant coverArtUrlLarge() const {
- return m_control->metaData(QtMultimedia::MetaData::CoverArtUrlLarge); }
- QVariant resolution() const { return m_control->metaData(QtMultimedia::MetaData::Resolution); }
- QVariant pixelAspectRatio() const {
- return m_control->metaData(QtMultimedia::MetaData::PixelAspectRatio); }
- QVariant videoFrameRate() const { return m_control->metaData(QtMultimedia::MetaData::VideoFrameRate); }
- QVariant videoBitRate() const { return m_control->metaData(QtMultimedia::MetaData::VideoBitRate); }
- QVariant videoCodec() const { return m_control->metaData(QtMultimedia::MetaData::VideoCodec); }
- QVariant posterUrl() const { return m_control->metaData(QtMultimedia::MetaData::PosterUrl); }
- QVariant chapterNumber() const { return m_control->metaData(QtMultimedia::MetaData::ChapterNumber); }
- QVariant director() const { return m_control->metaData(QtMultimedia::MetaData::Director); }
- QVariant leadPerformer() const { return m_control->metaData(QtMultimedia::MetaData::LeadPerformer); }
- QVariant writer() const { return m_control->metaData(QtMultimedia::MetaData::Writer); }
-
-Q_SIGNALS:
- void metaDataChanged();
-
-private:
- QMetaDataReaderControl *m_control;
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeMediaMetaData_4))
-
-QT_END_HEADER
-
-#endif // QDECLARATIVEMEDIAMETADATA_P_4_H
plugin declarative_multimedia
typeinfo plugins.qmltypes
Video 5.0 Video.qml
-Video 4.0 Video_4.qml
+++ /dev/null
-plugin declarative_multimedia ../../QtMultimedia
qwavedecoder \
qaudiobuffer \
qdeclarativeaudio \
- qdeclarativeaudio_4 \
qaudiodecoder \
qaudioprobe \
qvideoprobe \
+++ /dev/null
-CONFIG += testcase
-TARGET = tst_qdeclarativeaudio_4
-
-QT += multimedia-private qml testlib
-CONFIG += no_private_qt_headers_warning
-
-HEADERS += \
- $$QT.multimedia.sources/../imports/multimedia/qdeclarativeaudio_p_4.h \
- $$QT.multimedia.sources/../imports/multimedia/qdeclarativemediabase_p_4.h \
- $$QT.multimedia.sources/../imports/multimedia/qdeclarativemediametadata_p_4.h
-
-SOURCES += \
- tst_qdeclarativeaudio_4.cpp \
- $$QT.multimedia.sources/../imports/multimedia/qdeclarativeaudio_4.cpp \
- $$QT.multimedia.sources/../imports/multimedia/qdeclarativemediabase_4.cpp
-
-INCLUDEPATH += $$QT.multimedia.sources/../imports/multimedia
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** 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$
-**
-****************************************************************************/
-
-//TESTED_COMPONENT=plugins/declarative/multimedia
-
-#include <QtTest/QtTest>
-
-#include "qdeclarativeaudio_p_4.h"
-#include "qdeclarativemediametadata_p_4.h"
-
-#include <qmediaplayercontrol.h>
-#include <qmediaservice.h>
-#include <private/qmediaserviceprovider_p.h>
-#include <qmetadatareadercontrol.h>
-
-#include <QtGui/qguiapplication.h>
-
-class tst_QDeclarativeAudio_4 : public QObject
-{
- Q_OBJECT
-public slots:
- void initTestCase();
-
-private slots:
- void nullPlayerControl();
- void nullMetaDataControl();
- void nullService();
-
- void source();
- void autoLoad();
- void playing();
- void paused();
- void duration();
- void position();
- void volume();
- void muted();
- void bufferProgress();
- void seekable();
- void playbackRate();
- void status();
- void metaData_data();
- void metaData();
- void error();
- void loops();
-};
-
-Q_DECLARE_METATYPE(QDeclarativeAudio_4::Error);
-
-class QtTestMediaPlayerControl : public QMediaPlayerControl
-{
- Q_OBJECT
-public:
- QtTestMediaPlayerControl(QObject *parent = 0)
- : QMediaPlayerControl(parent)
- , m_state(QMediaPlayer::StoppedState)
- , m_mediaStatus(QMediaPlayer::NoMedia)
- , m_duration(0)
- , m_position(0)
- , m_playbackRate(1.0)
- , m_volume(100)
- , m_bufferStatus(0)
- , m_muted(false)
- , m_audioAvailable(false)
- , m_videoAvailable(false)
- , m_seekable(false)
- {
- }
-
- QMediaPlayer::State state() const { return m_state; }
- void updateState(QMediaPlayer::State state) { emit stateChanged(m_state = state); }
-
- QMediaPlayer::MediaStatus mediaStatus() const { return m_mediaStatus; }
- void updateMediaStatus(QMediaPlayer::MediaStatus status) {
- emit mediaStatusChanged(m_mediaStatus = status); }
- void updateMediaStatus(QMediaPlayer::MediaStatus status, QMediaPlayer::State state)
- {
- m_mediaStatus = status;
- m_state = state;
-
- emit mediaStatusChanged(m_mediaStatus);
- emit stateChanged(m_state);
- }
-
- qint64 duration() const { return m_duration; }
- void setDuration(qint64 duration) { emit durationChanged(m_duration = duration); }
-
- qint64 position() const { return m_position; }
- void setPosition(qint64 position) { emit positionChanged(m_position = position); }
-
- int volume() const { return m_volume; }
- void setVolume(int volume) { emit volumeChanged(m_volume = volume); }
-
- bool isMuted() const { return m_muted; }
- void setMuted(bool muted) { emit mutedChanged(m_muted = muted); }
-
- int bufferStatus() const { return m_bufferStatus; }
- void setBufferStatus(int status) { emit bufferStatusChanged(m_bufferStatus = status); }
-
- bool isAudioAvailable() const { return m_audioAvailable; }
- void setAudioAvailable(bool available) {
- emit audioAvailableChanged(m_audioAvailable = available); }
- bool isVideoAvailable() const { return m_videoAvailable; }
- void setVideoAvailable(bool available) {
- emit videoAvailableChanged(m_videoAvailable = available); }
-
- bool isSeekable() const { return m_seekable; }
- void setSeekable(bool seekable) { emit seekableChanged(m_seekable = seekable); }
-
- QMediaTimeRange availablePlaybackRanges() const { return QMediaTimeRange(); }
-
- qreal playbackRate() const { return m_playbackRate; }
- void setPlaybackRate(qreal rate) { emit playbackRateChanged(m_playbackRate = rate); }
-
- QMediaContent media() const { return m_media; }
- const QIODevice *mediaStream() const { return 0; }
- void setMedia(const QMediaContent &media, QIODevice *)
- {
- m_media = media;
-
- m_mediaStatus = m_media.isNull()
- ? QMediaPlayer::NoMedia
- : QMediaPlayer::LoadingMedia;
-
- emit mediaChanged(m_media);
- emit mediaStatusChanged(m_mediaStatus);
- }
-
- void play()
- {
- m_state = QMediaPlayer::PlayingState;
- if (m_mediaStatus == QMediaPlayer::EndOfMedia)
- updateMediaStatus(QMediaPlayer::LoadedMedia);
- emit stateChanged(m_state);
- }
- void pause() { emit stateChanged(m_state = QMediaPlayer::PausedState); }
- void stop() { emit stateChanged(m_state = QMediaPlayer::StoppedState); }
-
- void emitError(QMediaPlayer::Error err, const QString &errorString) {
- emit error(err, errorString); }
-
-private:
- QMediaPlayer::State m_state;
- QMediaPlayer::MediaStatus m_mediaStatus;
- qint64 m_duration;
- qint64 m_position;
- qreal m_playbackRate;
- int m_volume;
- int m_bufferStatus;
- bool m_muted;
- bool m_audioAvailable;
- bool m_videoAvailable;
- bool m_seekable;
- QMediaContent m_media;
-};
-
-class QtTestMetaDataControl : public QMetaDataReaderControl
-{
- Q_OBJECT
-public:
- QtTestMetaDataControl(QObject *parent = 0)
- : QMetaDataReaderControl(parent)
- {
- }
-
- bool isMetaDataAvailable() const { return true; }
-
- QVariant metaData(const QString &key) const { return m_metaData.value(key); }
- void setMetaData(const QString &key, const QVariant &value) {
- m_metaData.insert(key, value); emit metaDataChanged(); }
-
- QStringList availableMetaData() const { return m_metaData.keys(); }
-
-private:
- QMap<QString, QVariant> m_metaData;
-};
-
-class QtTestMediaService : public QMediaService
-{
- Q_OBJECT
-public:
- QtTestMediaService(
- QtTestMediaPlayerControl *playerControl,
- QtTestMetaDataControl *metaDataControl,
- QObject *parent)
- : QMediaService(parent)
- , playerControl(playerControl)
- , metaDataControl(metaDataControl)
- {
- }
-
- QMediaControl *requestControl(const char *name)
- {
- if (qstrcmp(name, QMediaPlayerControl_iid) == 0)
- return playerControl;
- else if (qstrcmp(name, QMetaDataReaderControl_iid) == 0)
- return metaDataControl;
- else
- return 0;
- }
-
- void releaseControl(QMediaControl *) {}
-
- QtTestMediaPlayerControl *playerControl;
- QtTestMetaDataControl *metaDataControl;
-};
-
-class QtTestMediaServiceProvider : public QMediaServiceProvider
-{
- Q_OBJECT
-public:
- QtTestMediaServiceProvider()
- : service(new QtTestMediaService(
- new QtTestMediaPlayerControl(this), new QtTestMetaDataControl(this), this))
- {
- setDefaultServiceProvider(this);
- }
-
- QtTestMediaServiceProvider(QtTestMediaService *service)
- : service(service)
- {
- setDefaultServiceProvider(this);
- }
-
- QtTestMediaServiceProvider(
- QtTestMediaPlayerControl *playerControl, QtTestMetaDataControl *metaDataControl)
- : service(new QtTestMediaService(playerControl, metaDataControl, this))
- {
- setDefaultServiceProvider(this);
- }
-
- ~QtTestMediaServiceProvider()
- {
- setDefaultServiceProvider(0);
- }
-
- QMediaService *requestService(
- const QByteArray &type,
- const QMediaServiceProviderHint & = QMediaServiceProviderHint())
- {
- requestedService = type;
-
- return service;
- }
-
- void releaseService(QMediaService *) {}
-
- inline QtTestMediaPlayerControl *playerControl() { return service->playerControl; }
- inline QtTestMetaDataControl *metaDataControl() { return service->metaDataControl; }
-
- QtTestMediaService *service;
- QByteArray requestedService;
-};
-
-void tst_QDeclarativeAudio_4::initTestCase()
-{
- qRegisterMetaType<QDeclarativeAudio_4::Error>();
-}
-
-void tst_QDeclarativeAudio_4::nullPlayerControl()
-{
- QtTestMetaDataControl metaDataControl;
- QtTestMediaServiceProvider provider(0, &metaDataControl);
-
- QDeclarativeAudio_4 audio;
- audio.classBegin();
-
- QCOMPARE(audio.source(), QUrl());
- audio.setSource(QUrl("http://example.com"));
- QCOMPARE(audio.source(), QUrl("http://example.com"));
-
- QCOMPARE(audio.isPlaying(), false);
- audio.setPlaying(true);
- QCOMPARE(audio.isPlaying(), true);
- audio.setPlaying(false);
- audio.play();
- QCOMPARE(audio.isPlaying(), false);
-
- QCOMPARE(audio.isPaused(), false);
- audio.pause();
- QCOMPARE(audio.isPaused(), false);
- audio.setPaused(true);
- QCOMPARE(audio.isPaused(), true);
-
- QCOMPARE(audio.duration(), 0);
-
- QCOMPARE(audio.position(), 0);
- audio.setPosition(10000);
- QCOMPARE(audio.position(), 10000);
-
- QCOMPARE(audio.volume(), qreal(1.0));
- audio.setVolume(0.5);
- QCOMPARE(audio.volume(), qreal(0.5));
-
- QCOMPARE(audio.isMuted(), false);
- audio.setMuted(true);
- QCOMPARE(audio.isMuted(), true);
-
- QCOMPARE(audio.bufferProgress(), qreal(0));
-
- QCOMPARE(audio.isSeekable(), false);
-
- QCOMPARE(audio.playbackRate(), qreal(1.0));
-
- QCOMPARE(audio.status(), QDeclarativeAudio_4::NoMedia);
-
- QCOMPARE(audio.error(), QDeclarativeAudio_4::ServiceMissing);
-}
-
-void tst_QDeclarativeAudio_4::nullMetaDataControl()
-{
- QtTestMediaPlayerControl playerControl;
- QtTestMediaServiceProvider provider(&playerControl, 0);
-
- QDeclarativeAudio_4 audio;
- audio.classBegin();
- audio.componentComplete();
-
- QVERIFY(audio.metaData());
-}
-
-void tst_QDeclarativeAudio_4::nullService()
-{
- QtTestMediaServiceProvider provider(0);
-
- QDeclarativeAudio_4 audio;
- audio.classBegin();
-
- QCOMPARE(audio.source(), QUrl());
- audio.setSource(QUrl("http://example.com"));
- QCOMPARE(audio.source(), QUrl("http://example.com"));
-
- QCOMPARE(audio.isPlaying(), false);
- audio.setPlaying(true);
- QCOMPARE(audio.isPlaying(), true);
- audio.setPlaying(false);
- audio.play();
- QCOMPARE(audio.isPlaying(), false);
-
- QCOMPARE(audio.isPaused(), false);
- audio.pause();
- QCOMPARE(audio.isPaused(), false);
- audio.setPaused(true);
- QCOMPARE(audio.isPaused(), true);
-
- QCOMPARE(audio.duration(), 0);
-
- QCOMPARE(audio.position(), 0);
- audio.setPosition(10000);
- QCOMPARE(audio.position(), 10000);
-
- QCOMPARE(audio.volume(), qreal(1.0));
- audio.setVolume(0.5);
- QCOMPARE(audio.volume(), qreal(0.5));
-
- QCOMPARE(audio.isMuted(), false);
- audio.setMuted(true);
- QCOMPARE(audio.isMuted(), true);
-
- QCOMPARE(audio.bufferProgress(), qreal(0));
-
- QCOMPARE(audio.isSeekable(), false);
-
- QCOMPARE(audio.playbackRate(), qreal(1.0));
-
- QCOMPARE(audio.status(), QDeclarativeAudio_4::NoMedia);
-
- QCOMPARE(audio.error(), QDeclarativeAudio_4::ServiceMissing);
-
- QVERIFY(audio.metaData());
-}
-
-void tst_QDeclarativeAudio_4::source()
-{
- const QUrl url1("http://example.com");
- const QUrl url2("file:///local/path");
- const QUrl url3;
-
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio_4 audio;
- audio.classBegin();
- audio.componentComplete();
-
- QSignalSpy spy(&audio, SIGNAL(sourceChanged()));
-
- audio.setSource(url1);
- QCOMPARE(audio.source(), url1);
- QCOMPARE(provider.playerControl()->media().canonicalUrl(), url1);
- QCOMPARE(spy.count(), 1);
-
- audio.setSource(url2);
- QCOMPARE(audio.source(), url2);
- QCOMPARE(provider.playerControl()->media().canonicalUrl(), url2);
- QCOMPARE(spy.count(), 2);
-
- audio.setSource(url3);
- QCOMPARE(audio.source(), url3);
- QCOMPARE(provider.playerControl()->media().canonicalUrl(), url3);
- QCOMPARE(spy.count(), 3);
-}
-
-void tst_QDeclarativeAudio_4::autoLoad()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio_4 audio;
- audio.classBegin();
- audio.componentComplete();
-
- QSignalSpy spy(&audio, SIGNAL(autoLoadChanged()));
-
- QCOMPARE(audio.isAutoLoad(), true);
-
- audio.setAutoLoad(false);
- QCOMPARE(audio.isAutoLoad(), false);
- QCOMPARE(spy.count(), 1);
-
- audio.setSource(QUrl("http://example.com"));
- QCOMPARE(audio.source(), QUrl("http://example.com"));
- audio.play();
- QCOMPARE(audio.isPlaying(), true);
- audio.stop();
-
- audio.setAutoLoad(true);
- audio.setSource(QUrl("http://example.com"));
- audio.setPaused(true);
- QCOMPARE(spy.count(), 2);
- QCOMPARE(audio.isPaused(), true);
-}
-
-void tst_QDeclarativeAudio_4::playing()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio_4 audio;
- audio.classBegin();
-
- QSignalSpy playingChangedSpy(&audio, SIGNAL(playingChanged()));
- QSignalSpy startedSpy(&audio, SIGNAL(started()));
- QSignalSpy stoppedSpy(&audio, SIGNAL(stopped()));
-
- int playingChanged = 0;
- int started = 0;
- int stopped = 0;
-
- audio.componentComplete();
- audio.setSource(QUrl("http://example.com"));
-
- QCOMPARE(audio.isPlaying(), false);
-
- // setPlaying(true) when stopped.
- audio.setPlaying(true);
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(startedSpy.count(), ++started);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPlaying(false) when playing.
- audio.setPlaying(false);
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(stoppedSpy.count(), ++stopped);
-
- // play() when stopped.
- audio.play();
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(startedSpy.count(), ++started);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // stop() when playing.
- audio.stop();
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(stoppedSpy.count(), ++stopped);
-
- // stop() when stopped.
- audio.stop();
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPlaying(false) when stopped.
- audio.setPlaying(false);
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- audio.setPlaying(true);
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(startedSpy.count(), ++started);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPlaying(true) when playing.
- audio.setPlaying(true);
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // play() when playing.
- audio.play();
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(stoppedSpy.count(), stopped);
-}
-
-void tst_QDeclarativeAudio_4::paused()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio_4 audio;
- audio.classBegin();
-
- QSignalSpy playingChangedSpy(&audio, SIGNAL(playingChanged()));
- QSignalSpy pausedChangedSpy(&audio, SIGNAL(pausedChanged()));
- QSignalSpy startedSpy(&audio, SIGNAL(started()));
- QSignalSpy pausedSpy(&audio, SIGNAL(paused()));
- QSignalSpy resumedSpy(&audio, SIGNAL(resumed()));
- QSignalSpy stoppedSpy(&audio, SIGNAL(stopped()));
-
- int playingChanged = 0;
- int pausedChanged = 0;
- int started = 0;
- int paused = 0;
- int resumed = 0;
- int stopped = 0;
-
- audio.componentComplete();
- audio.setSource(QUrl("http://example.com"));
-
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(audio.isPaused(), false);
-
- // setPlaying(true) when stopped.
- audio.setPlaying(true);
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(audio.isPaused(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), ++started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPaused(true) when playing.
- audio.setPaused(true);
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(audio.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), ++paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPaused(true) when paused.
- audio.setPaused(true);
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(audio.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // pause() when paused.
- audio.pause();
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(audio.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPaused(false) when paused.
- audio.setPaused(false);
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(audio.isPaused(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), ++resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPaused(false) when playing.
- audio.setPaused(false);
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(audio.isPaused(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // pause() when playing.
- audio.pause();
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(audio.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), ++paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPlaying(false) when paused.
- audio.setPlaying(false);
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(audio.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), ++stopped);
-
- // setPaused(true) when stopped and paused.
- audio.setPaused(true);
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(audio.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPaused(false) when stopped and paused.
- audio.setPaused(false);
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(audio.isPaused(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPaused(true) when stopped.
- audio.setPaused(true);
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(audio.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPlaying(true) when stopped and paused.
- audio.setPlaying(true);
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(audio.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), ++started);
- QCOMPARE(pausedSpy.count(), ++paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // play() when paused.
- audio.play();
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(audio.isPaused(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), ++resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPaused(true) when playing.
- audio.setPaused(true);
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(audio.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), ++paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // stop() when paused.
- audio.stop();
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(audio.isPaused(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), ++stopped);
-
- // setPaused(true) when stopped.
- audio.setPaused(true);
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(audio.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // stop() when stopped and paused.
- audio.stop();
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(audio.isPaused(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // pause() when stopped.
- audio.pause();
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(audio.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), ++started);
- QCOMPARE(pausedSpy.count(), ++paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPlaying(false) when paused.
- audio.setPlaying(false);
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(audio.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), ++stopped);
-
- // pause() when stopped and paused.
- audio.pause();
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(audio.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), ++started);
- QCOMPARE(pausedSpy.count(), ++paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPlaying(false) when paused.
- audio.setPlaying(false);
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(audio.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), ++stopped);
-
- // play() when stopped and paused.
- audio.play();
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(audio.isPaused(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), ++started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-}
-
-void tst_QDeclarativeAudio_4::duration()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio_4 audio;
- audio.classBegin();
- audio.componentComplete();
-
- QSignalSpy spy(&audio, SIGNAL(durationChanged()));
-
- QCOMPARE(audio.duration(), 0);
-
- provider.playerControl()->setDuration(4040);
- QCOMPARE(audio.duration(), 4040);
- QCOMPARE(spy.count(), 1);
-
- provider.playerControl()->setDuration(-129);
- QCOMPARE(audio.duration(), -129);
- QCOMPARE(spy.count(), 2);
-
- provider.playerControl()->setDuration(0);
- QCOMPARE(audio.duration(), 0);
- QCOMPARE(spy.count(), 3);
-
- // Unnecessary duration changed signals aren't filtered.
- provider.playerControl()->setDuration(0);
- QCOMPARE(audio.duration(), 0);
- QCOMPARE(spy.count(), 4);
-}
-
-void tst_QDeclarativeAudio_4::position()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio_4 audio;
- audio.classBegin();
- audio.componentComplete();
-
- QSignalSpy spy(&audio, SIGNAL(positionChanged()));
-
- QCOMPARE(audio.position(), 0);
-
- // QDeclarativeAudio_4 won't bound set positions to the duration. A media service may though.
- QCOMPARE(audio.duration(), 0);
-
- audio.setPosition(450);
- QCOMPARE(audio.position(), 450);
- QCOMPARE(provider.playerControl()->position(), qint64(450));
- QCOMPARE(spy.count(), 1);
-
- audio.setPosition(-5403);
- QCOMPARE(audio.position(), -5403);
- QCOMPARE(provider.playerControl()->position(), qint64(-5403));
- QCOMPARE(spy.count(), 2);
-
- audio.setPosition(-5403);
- QCOMPARE(audio.position(), -5403);
- QCOMPARE(provider.playerControl()->position(), qint64(-5403));
- QCOMPARE(spy.count(), 2);
-
- // Check the signal change signal is emitted if the change originates from the media service.
- provider.playerControl()->setPosition(0);
- QCOMPARE(audio.position(), 0);
- QCOMPARE(spy.count(), 3);
-
- connect(&audio, SIGNAL(positionChanged()), &QTestEventLoop::instance(), SLOT(exitLoop()));
-
- provider.playerControl()->updateState(QMediaPlayer::PlayingState);
- QTestEventLoop::instance().enterLoop(1);
- QVERIFY(spy.count() > 3 && spy.count() < 6); // 4 or 5
-
- provider.playerControl()->updateState(QMediaPlayer::PausedState);
- QTestEventLoop::instance().enterLoop(1);
- QVERIFY(spy.count() < 6);
-}
-
-void tst_QDeclarativeAudio_4::volume()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio_4 audio;
- audio.classBegin();
- audio.componentComplete();
-
- QSignalSpy spy(&audio, SIGNAL(volumeChanged()));
-
- QCOMPARE(audio.volume(), qreal(1.0));
-
- audio.setVolume(0.7);
- QCOMPARE(audio.volume(), qreal(0.7));
- QCOMPARE(provider.playerControl()->volume(), 70);
- QCOMPARE(spy.count(), 1);
-
- audio.setVolume(0.7);
- QCOMPARE(audio.volume(), qreal(0.7));
- QCOMPARE(provider.playerControl()->volume(), 70);
- QCOMPARE(spy.count(), 1);
-
- provider.playerControl()->setVolume(30);
- QCOMPARE(audio.volume(), qreal(0.3));
- QCOMPARE(spy.count(), 2);
-}
-
-void tst_QDeclarativeAudio_4::muted()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio_4 audio;
- audio.classBegin();
- audio.componentComplete();
-
- QSignalSpy spy(&audio, SIGNAL(mutedChanged()));
-
- QCOMPARE(audio.isMuted(), false);
-
- audio.setMuted(true);
- QCOMPARE(audio.isMuted(), true);
- QCOMPARE(provider.playerControl()->isMuted(), true);
- QCOMPARE(spy.count(), 1);
-
- provider.playerControl()->setMuted(false);
- QCOMPARE(audio.isMuted(), false);
- QCOMPARE(spy.count(), 2);
-
- audio.setMuted(false);
- QCOMPARE(audio.isMuted(), false);
- QCOMPARE(provider.playerControl()->isMuted(), false);
- QCOMPARE(spy.count(), 3);
-}
-
-void tst_QDeclarativeAudio_4::bufferProgress()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio_4 audio;
- audio.classBegin();
- audio.componentComplete();
-
- QSignalSpy spy(&audio, SIGNAL(bufferProgressChanged()));
-
- QCOMPARE(audio.bufferProgress(), qreal(0.0));
-
- provider.playerControl()->setBufferStatus(20);
- QCOMPARE(audio.bufferProgress(), qreal(0.2));
- QCOMPARE(spy.count(), 1);
-
- provider.playerControl()->setBufferStatus(20);
- QCOMPARE(audio.bufferProgress(), qreal(0.2));
- QCOMPARE(spy.count(), 2);
-
- provider.playerControl()->setBufferStatus(40);
- QCOMPARE(audio.bufferProgress(), qreal(0.4));
- QCOMPARE(spy.count(), 3);
-
- connect(&audio, SIGNAL(positionChanged()), &QTestEventLoop::instance(), SLOT(exitLoop()));
-
- provider.playerControl()->updateMediaStatus(
- QMediaPlayer::BufferingMedia, QMediaPlayer::PlayingState);
- QTestEventLoop::instance().enterLoop(1);
- QVERIFY(spy.count() > 3 && spy.count() < 6); // 4 or 5
-
- provider.playerControl()->updateMediaStatus(QMediaPlayer::BufferedMedia);
- QTestEventLoop::instance().enterLoop(1);
- QVERIFY(spy.count() < 6);
-}
-
-void tst_QDeclarativeAudio_4::seekable()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio_4 audio;
- audio.classBegin();
- audio.componentComplete();
-
- QSignalSpy spy(&audio, SIGNAL(seekableChanged()));
-
- QCOMPARE(audio.isSeekable(), false);
-
- provider.playerControl()->setSeekable(true);
- QCOMPARE(audio.isSeekable(), true);
- QCOMPARE(spy.count(), 1);
-
- provider.playerControl()->setSeekable(true);
- QCOMPARE(audio.isSeekable(), true);
- QCOMPARE(spy.count(), 2);
-
- provider.playerControl()->setSeekable(false);
- QCOMPARE(audio.isSeekable(), false);
- QCOMPARE(spy.count(), 3);
-}
-
-void tst_QDeclarativeAudio_4::playbackRate()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio_4 audio;
- audio.classBegin();
- audio.componentComplete();
-
- QSignalSpy spy(&audio, SIGNAL(playbackRateChanged()));
-
- QCOMPARE(audio.playbackRate(), qreal(1.0));
-
- audio.setPlaybackRate(0.5);
- QCOMPARE(audio.playbackRate(), qreal(0.5));
- QCOMPARE(provider.playerControl()->playbackRate(), qreal(0.5));
- QCOMPARE(spy.count(), 1);
-
- provider.playerControl()->setPlaybackRate(2.0);
- QCOMPARE(provider.playerControl()->playbackRate(), qreal(2.0));
- QCOMPARE(spy.count(), 2);
-
- audio.setPlaybackRate(2.0);
- QCOMPARE(audio.playbackRate(), qreal(2.0));
- QCOMPARE(provider.playerControl()->playbackRate(), qreal(2.0));
- QCOMPARE(spy.count(), 3);
-}
-
-void tst_QDeclarativeAudio_4::status()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio_4 audio;
- audio.classBegin();
- audio.componentComplete();
-
- QSignalSpy statusChangedSpy(&audio, SIGNAL(statusChanged()));
-
- QCOMPARE(audio.status(), QDeclarativeAudio_4::NoMedia);
-
- // Set media, start loading.
- provider.playerControl()->updateMediaStatus(QMediaPlayer::LoadingMedia);
- QCOMPARE(audio.status(), QDeclarativeAudio_4::Loading);
- QCOMPARE(statusChangedSpy.count(), 1);
-
- // Finish loading.
- provider.playerControl()->updateMediaStatus(QMediaPlayer::LoadedMedia);
- QCOMPARE(audio.status(), QDeclarativeAudio_4::Loaded);
- QCOMPARE(statusChangedSpy.count(), 2);
-
- // Play, start buffering.
- provider.playerControl()->updateMediaStatus(
- QMediaPlayer::StalledMedia, QMediaPlayer::PlayingState);
- QCOMPARE(audio.status(), QDeclarativeAudio_4::Stalled);
- QCOMPARE(statusChangedSpy.count(), 3);
-
- // Enough data buffered to proceed.
- provider.playerControl()->updateMediaStatus(QMediaPlayer::BufferingMedia);
- QCOMPARE(audio.status(), QDeclarativeAudio_4::Buffering);
- QCOMPARE(statusChangedSpy.count(), 4);
-
- // Errant second buffering status changed.
- provider.playerControl()->updateMediaStatus(QMediaPlayer::BufferingMedia);
- QCOMPARE(audio.status(), QDeclarativeAudio_4::Buffering);
- QCOMPARE(statusChangedSpy.count(), 4);
-
- // Buffer full.
- provider.playerControl()->updateMediaStatus(QMediaPlayer::BufferedMedia);
- QCOMPARE(audio.status(), QDeclarativeAudio_4::Buffered);
- QCOMPARE(statusChangedSpy.count(), 5);
-
- // Buffer getting low.
- provider.playerControl()->updateMediaStatus(QMediaPlayer::BufferingMedia);
- QCOMPARE(audio.status(), QDeclarativeAudio_4::Buffering);
- QCOMPARE(statusChangedSpy.count(), 6);
-
- // Buffer full.
- provider.playerControl()->updateMediaStatus(QMediaPlayer::BufferedMedia);
- QCOMPARE(audio.status(), QDeclarativeAudio_4::Buffered);
- QCOMPARE(statusChangedSpy.count(), 7);
-
- // Finished.
- provider.playerControl()->updateMediaStatus(
- QMediaPlayer::EndOfMedia, QMediaPlayer::StoppedState);
- QCOMPARE(audio.status(), QDeclarativeAudio_4::EndOfMedia);
- QCOMPARE(statusChangedSpy.count(), 8);
-}
-
-void tst_QDeclarativeAudio_4::metaData_data()
-{
- QTest::addColumn<QByteArray>("propertyName");
- QTest::addColumn<QString>("propertyKey");
- QTest::addColumn<QVariant>("value");
-
- QTest::newRow("title")
- << QByteArray("title")
- << QtMultimedia::MetaData::Title
- << QVariant(QString::fromLatin1("This is a title"));
-
- QTest::newRow("genre")
- << QByteArray("genre")
- << QtMultimedia::MetaData::Genre
- << QVariant(QString::fromLatin1("rock"));
-
- QTest::newRow("trackNumber")
- << QByteArray("trackNumber")
- << QtMultimedia::MetaData::TrackNumber
- << QVariant(8);
-}
-
-void tst_QDeclarativeAudio_4::metaData()
-{
- QFETCH(QByteArray, propertyName);
- QFETCH(QString, propertyKey);
- QFETCH(QVariant, value);
-
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio_4 audio;
- audio.classBegin();
- audio.componentComplete();
-
- QSignalSpy spy(audio.metaData(), SIGNAL(metaDataChanged()));
-
- const int index = audio.metaData()->metaObject()->indexOfProperty(propertyName.constData());
- QVERIFY(index != -1);
-
- QMetaProperty property = audio.metaData()->metaObject()->property(index);
- QCOMPARE(property.read(&audio), QVariant());
-
- property.write(audio.metaData(), value);
- QCOMPARE(property.read(audio.metaData()), QVariant());
- QCOMPARE(provider.metaDataControl()->metaData(propertyKey), QVariant());
- QCOMPARE(spy.count(), 0);
-
- provider.metaDataControl()->setMetaData(propertyKey, value);
- QCOMPARE(property.read(audio.metaData()), value);
- QCOMPARE(spy.count(), 1);
-}
-
-void tst_QDeclarativeAudio_4::error()
-{
- const QString errorString = QLatin1String("Failed to open device.");
-
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio_4 audio;
- audio.classBegin();
- audio.componentComplete();
-
- QSignalSpy errorSpy(&audio, SIGNAL(error(QDeclarativeAudio_4::Error,QString)));
- QSignalSpy errorChangedSpy(&audio, SIGNAL(errorChanged()));
-
- QCOMPARE(audio.error(), QDeclarativeAudio_4::NoError);
- QCOMPARE(audio.errorString(), QString());
-
- provider.playerControl()->emitError(QMediaPlayer::ResourceError, errorString);
-
- QCOMPARE(audio.error(), QDeclarativeAudio_4::ResourceError);
- QCOMPARE(audio.errorString(), errorString);
- QCOMPARE(errorSpy.count(), 1);
- QCOMPARE(errorChangedSpy.count(), 1);
-
- // Changing the source resets the error properties.
- audio.setSource(QUrl("http://example.com"));
- QCOMPARE(audio.error(), QDeclarativeAudio_4::NoError);
- QCOMPARE(audio.errorString(), QString());
- QCOMPARE(errorSpy.count(), 1);
- QCOMPARE(errorChangedSpy.count(), 2);
-
- // But isn't noisy.
- audio.setSource(QUrl("file:///file/path"));
- QCOMPARE(audio.error(), QDeclarativeAudio_4::NoError);
- QCOMPARE(audio.errorString(), QString());
- QCOMPARE(errorSpy.count(), 1);
- QCOMPARE(errorChangedSpy.count(), 2);
-}
-
-void tst_QDeclarativeAudio_4::loops()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio_4 audio;
-
- QSignalSpy loopsChangedSpy(&audio, SIGNAL(loopCountChanged()));
- QSignalSpy playingChangedSpy(&audio, SIGNAL(playingChanged()));
- QSignalSpy stoppedSpy(&audio, SIGNAL(stopped()));
-
- int playingChanged = 0;
- int stopped = 0;
- int loopsChanged = 0;
-
- audio.classBegin();
- audio.componentComplete();
-
- QCOMPARE(audio.isPlaying(), false);
-
- //setLoopCount(3) when stopped.
- audio.setLoopCount(3);
- QCOMPARE(audio.loopCount(), 3);
- QCOMPARE(loopsChangedSpy.count(), ++loopsChanged);
-
- //play till end
- audio.play();
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
-
- // setPlaying(true) when playing.
- audio.setPlaying(true);
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- provider.playerControl()->updateMediaStatus(QMediaPlayer::EndOfMedia, QMediaPlayer::StoppedState);
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
-
- //play to end
- provider.playerControl()->updateMediaStatus(QMediaPlayer::EndOfMedia, QMediaPlayer::StoppedState);
- //play to end
- provider.playerControl()->updateMediaStatus(QMediaPlayer::EndOfMedia, QMediaPlayer::StoppedState);
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(stoppedSpy.count(), ++stopped);
-
- // stop when playing
- audio.play();
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- provider.playerControl()->updateMediaStatus(QMediaPlayer::EndOfMedia, QMediaPlayer::StoppedState);
- audio.stop();
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(stoppedSpy.count(), ++stopped);
-
- //setPlaying(true) with infinite loop
- audio.setLoopCount(-1);
- QCOMPARE(audio.loopCount(), -1);
- QCOMPARE(loopsChangedSpy.count(), ++loopsChanged);
- audio.setPlaying(true);
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- provider.playerControl()->updateMediaStatus(QMediaPlayer::EndOfMedia, QMediaPlayer::StoppedState);
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
-
- // play() when playing.
- audio.play();
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPlaying(false) when playing in infinite loop.
- audio.setPlaying(false);
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(stoppedSpy.count(), ++stopped);
-
- qDebug() << "testing version 4";
-}
-
-QTEST_MAIN(tst_QDeclarativeAudio_4)
-
-#include "tst_qdeclarativeaudio_4.moc"